diff --git a/.buildkite/configure_signing.sh b/.buildkite/configure_signing.sh deleted file mode 100755 index cfdba0d07..000000000 --- a/.buildkite/configure_signing.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -#see https://central.sonatype.org/publish/publish-gradle/#distributing-your-public-key - -set -e - -mkdir -p /tmp -keyring_file="/tmp/keyring.gpg" - -vault kv get --field="keyring" kv/ci-shared/release-eng/team-release-secrets/elasticsearch-java/gpg | base64 -d > $keyring_file -signing_password=$(vault kv get --field="passphase" kv/ci-shared/release-eng/team-release-secrets/elasticsearch-java/gpg) -signing_key=$(vault kv get --field="key_id" kv/ci-shared/release-eng/team-release-secrets/elasticsearch-java/gpg) - -maven_username=$(vault kv get --field="username" kv/ci-shared/release-eng/team-release-secrets/elasticsearch-java/maven_central) -maven_password=$(vault kv get --field="password" kv/ci-shared/release-eng/team-release-secrets/elasticsearch-java/maven_central) - -cat > gradle.properties < $keyring_file +## NOTE: passphase is the name of the field. +signing_password=$(vault kv get --field="passphase" $vault_path/gpg) +signing_key=$(vault kv get --field="key_id" $vault_path/gpg) + +maven_username=$(vault kv get --field="username" $vault_path/maven_central) +maven_password=$(vault kv get --field="password" $vault_path/maven_central) + +cat >> gradle.properties < missing version parameter\033[0m" + exit 1 + fi + echo -e "\033[36;1mTARGET: release artefact $VERSION\033[0m" TASK=release TASK_ARGS=("$VERSION" "$output_folder") ;; @@ -159,7 +169,7 @@ if [[ "$CMD" == "assemble" ]]; then fi build_image - echo -e "\033[34;1mINFO:\033[0m Building version ${assemble_version}\033[0m" + echo -e "\033[34;1mINFO:\033[0m Building version ${assemble_version}\033[0m" docker run --rm --env VERSION=$assemble_version -u "$(id -u)" \ $git_mount $src_mount $output_mount \ $docker_image \ @@ -176,6 +186,25 @@ if [[ "$CMD" == "assemble" ]]; then fi fi +if [[ "$CMD" == "release" ]]; then + rm -rf .ci/output/repository + build_image + echo -e "\033[34;1mINFO:\033[0m Building version ${VERSION}\033[0m" + + if [[ "$DRY_RUN" = "true" ]]; then + echo "Dry run: building and publishing to the local repository" + gradle_task="publishAllPublicationsToDryRunRepository" + else + echo "Releasing to Maven snapshot repo" + gradle_task="publishToSonatype closeAndReleaseStagingRepositories" + fi + docker run --rm --env VERSION=$VERSION -u "$(id -u)" \ + $git_mount $src_mount $output_mount \ + -v /tmp/secured:/tmp/secured \ + $docker_image \ + $gradle_task +fi + if [[ "$CMD" == "bump" ]]; then echo $VERSION > config/version.txt fi diff --git a/.ci/release.sh b/.ci/release.sh deleted file mode 100755 index 69bb9c469..000000000 --- a/.ci/release.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env bash -# -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -set -euo pipefail - -WORKFLOW=$1 -STACK_VERSION=$(cat config/version.txt) - -# Branch: BRANCH env var > Buildkite's BUILDKITE_BRANCH var > minor version -BRANCH=${BRANCH:-${BUILDKITE_BRANCH:-${STACK_VERSION%.*}}} - -if [[ "$BRANCH" = "main" && "$WORKFLOW" = "staging" ]]; then - echo "No staging build for the main branch - skipping" - exit 0 -fi - -# Add snapshot suffix if needed -BUILD_VERSION=$STACK_VERSION -[ "$WORKFLOW" = "snapshot" ] && BUILD_VERSION="${BUILD_VERSION}-SNAPSHOT" - -echo "Releasing version $STACK_VERSION, branch: $BRANCH, workflow: $WORKFLOW" - -DRA_CREDS=$(vault kv get -field=data -format=json kv/ci-shared/release/dra-role) - -.ci/make.sh assemble "$BUILD_VERSION" - -# set required permissions on artifacts and directory -chmod -R a+r $PWD/.ci/output/* -chmod -R a+w $PWD/.ci/output -# Artifacts should be generated -docker run --rm \ - --name release-manager \ - -e VAULT_ADDR="$(echo "$DRA_CREDS" | jq -r '.vault_addr')" \ - -e VAULT_ROLE_ID="$(echo "$DRA_CREDS" | jq -r '.role_id')" \ - -e VAULT_SECRET_ID="$(echo "$DRA_CREDS" | jq -r '.secret_id')" \ - --mount type=bind,readonly=false,src="$PWD",target=/artifacts \ - docker.elastic.co/infra/release-manager:latest \ - cli collect \ - --project elasticsearch-java \ - --branch "$BRANCH" \ - --commit "$(git rev-parse HEAD)" \ - --workflow "$WORKFLOW" \ - --version "$STACK_VERSION" \ - --artifact-set main diff --git a/.ci/release_central.sh b/.ci/release_central.sh new file mode 100755 index 000000000..72f41fb6d --- /dev/null +++ b/.ci/release_central.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +# +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +#see https://central.sonatype.org/publish/publish-gradle/#distributing-your-public-key + +set -euo pipefail + +.ci/configure_signing.sh + +.ci/make.sh release $VERSION diff --git a/.ci/release_dra.sh b/.ci/release_dra.sh new file mode 100755 index 000000000..8415c5dfd --- /dev/null +++ b/.ci/release_dra.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash +# +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +set -euo pipefail + +WORKFLOW=$1 +STACK_VERSION=$(cat config/version.txt) +VERSION_QUALIFIER=$(cat config/version-qualifier.txt) + +# Branch: BRANCH env var > Buildkite's BUILDKITE_BRANCH var > minor version +BRANCH=${BRANCH:-${BUILDKITE_BRANCH:-${STACK_VERSION%.*}}} + +if [[ "$BRANCH" = "main" && "$WORKFLOW" = "staging" && "$VERSION_QUALIFIER" = "" ]]; then + echo "No staging build for the main branch - skipping" + exit 0 +fi + +# Add snapshot suffix if needed +BUILD_VERSION=$STACK_VERSION +[ "$WORKFLOW" = "snapshot" ] && BUILD_VERSION="${BUILD_VERSION}-SNAPSHOT" + +echo "Releasing version $STACK_VERSION, branch: $BRANCH, workflow: $WORKFLOW, qualifier: $VERSION_QUALIFIER" + +DRA_CREDS=$(vault kv get -field=data -format=json kv/ci-shared/release/dra-role) + +.ci/make.sh assemble "$BUILD_VERSION" + +# set required permissions on artifacts and directory +chmod -R a+r $PWD/.ci/output/* +chmod -R a+w $PWD/.ci/output +# Artifacts should be generated +if [ "$WORKFLOW" = "snapshot" ]; then + docker run --rm \ + --name release-manager \ + -e VAULT_ADDR="$(echo "$DRA_CREDS" | jq -r '.vault_addr')" \ + -e VAULT_ROLE_ID="$(echo "$DRA_CREDS" | jq -r '.role_id')" \ + -e VAULT_SECRET_ID="$(echo "$DRA_CREDS" | jq -r '.secret_id')" \ + --mount type=bind,readonly=false,src="$PWD",target=/artifacts \ + docker.elastic.co/infra/release-manager:latest \ + cli collect \ + --project elasticsearch-java \ + --branch "$BRANCH" \ + --commit "$(git rev-parse HEAD)" \ + --workflow "$WORKFLOW" \ + --version "$STACK_VERSION" \ + --artifact-set main +fi +if [ "$WORKFLOW" = "staging" ]; then + docker run --rm \ + --name release-manager \ + -e VAULT_ADDR="$(echo "$DRA_CREDS" | jq -r '.vault_addr')" \ + -e VAULT_ROLE_ID="$(echo "$DRA_CREDS" | jq -r '.role_id')" \ + -e VAULT_SECRET_ID="$(echo "$DRA_CREDS" | jq -r '.secret_id')" \ + --mount type=bind,readonly=false,src="$PWD",target=/artifacts \ + docker.elastic.co/infra/release-manager:latest \ + cli collect \ + --project elasticsearch-java \ + --branch "$BRANCH" \ + --commit "$(git rev-parse HEAD)" \ + --workflow "$WORKFLOW" \ + --version "$STACK_VERSION" \ + --qualifier "$VERSION_QUALIFIER" \ + --artifact-set main +fi diff --git a/.github/workflows/docs-build.yml b/.github/workflows/docs-build.yml new file mode 100644 index 000000000..bb466166d --- /dev/null +++ b/.github/workflows/docs-build.yml @@ -0,0 +1,19 @@ +name: docs-build + +on: + push: + branches: + - main + pull_request_target: ~ + merge_group: ~ + +jobs: + docs-preview: + uses: elastic/docs-builder/.github/workflows/preview-build.yml@main + with: + path-pattern: docs/** + permissions: + deployments: write + id-token: write + contents: read + pull-requests: read diff --git a/.github/workflows/docs-cleanup.yml b/.github/workflows/docs-cleanup.yml new file mode 100644 index 000000000..f83e017b5 --- /dev/null +++ b/.github/workflows/docs-cleanup.yml @@ -0,0 +1,14 @@ +name: docs-cleanup + +on: + pull_request_target: + types: + - closed + +jobs: + docs-preview: + uses: elastic/docs-builder/.github/workflows/preview-cleanup.yml@main + permissions: + contents: none + id-token: write + deployments: write diff --git a/.github/workflows/release_central.yml b/.github/workflows/release_central.yml new file mode 100644 index 000000000..21e9f6177 --- /dev/null +++ b/.github/workflows/release_central.yml @@ -0,0 +1,56 @@ +name: "Release to Maven Central" + +on: + workflow_dispatch: + inputs: + branch: + description: "Branch or tag ref to run the workflow on" + required: true + version: + description: "The version to release. Must start with the one in config/version.txt" + required: true + dry_run: + description: Used to test other workflow steps, does not publish to Maven Central. + type: boolean + required: true + default: false + +env: + BRANCH: ${{ inputs.branch }} + VERSION: ${{ inputs.version }} + DRY_RUN: ${{ inputs.dry_run }} + +jobs: + validate-version: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ inputs.branch }} + fetch-depth: '1' + - name: Validate version + shell: bash + run: | + repo_version="$(cat config/version.txt)" + if [[ ! "$VERSION" = $repo_version* ]]; then + echo "Workflow version ($VERSION) and config/version.txt ($repo_version) do not match." + exit 1 + fi + + maven-central-deploy: + name: "Deploy to Maven Central (Buildkite)" + runs-on: ubuntu-latest + needs: + - validate-version + steps: + - id: buildkite-run + uses: elastic/oblt-actions/buildkite/run@v1 + with: + pipeline: "elasticsearch-java-release" + wait-for: true + token: ${{ secrets.BUILDKITE_TOKEN }} + branch: ${{ inputs.branch }} + env-vars: | + DRY_RUN=${{ inputs.dry_run }} + VERSION=${{ inputs.version }} diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml new file mode 100644 index 000000000..e2138789c --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,23 @@ +name: Java Unit Tests + +on: + workflow_run: + workflows: ['Validate Gradle Wrapper'] + types: [completed] + branches: + - 'main' + +jobs: + tests: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + - name: Run java client tests + run: ./gradlew test -p java-client diff --git a/README.md b/README.md index 59a78fb39..30e100ab7 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ Elastic logo # Elasticsearch Java Client +Elasticsearch is a distributed, RESTful search engine optimized for speed and relevance on production-scale workloads. You can use Elasticsearch to perform real-time search over massive datasets for applications including Vector search, Full-text search, Logs, Metrics, Application Performance Monitoring, Security Logs and more ! -The official Java client for [Elasticsearch](https://github.com/elastic/elasticsearch). +This repo has the official Java client for [Elasticsearch](https://github.com/elastic/elasticsearch). The Java client for Elasticsearch provides strongly typed requests and responses for all Elasticsearch APIs. It delegates protocol handling to an http client such as the [Elasticsearch Low Level REST client](https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/java-rest-low.html) that takes care of all transport-level concerns (http connection establishment and pooling, retries, etc). diff --git a/build.gradle.kts b/build.gradle.kts index 70a44a710..456ddd08c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,10 +16,43 @@ * specific language governing permissions and limitations * under the License. */ +plugins { + id("io.github.gradle-nexus.publish-plugin") version "2.0.0" +} + +nexusPublishing { + repositories { + sonatype() + } +} + +repositories { + mavenCentral() +} + +group = "co.elastic.clients" +description = "Maven central release of the official elasticsearch java client" + +subprojects { + group = rootProject.group + version = rootProject.version +} allprojects { group = "co.elastic.clients" - version = (File(project.rootDir, "config/version.txt").readText().trim() + "-SNAPSHOT") + // Release manager provides a $VERSION. If not present, it's a local or CI snapshot build. + // also need to add the qualifier in case it's a staging build + version = "" + if (System.getenv("VERSION")==null) { + version = (File(project.rootDir, "config/version.txt").readText().trim() + "-SNAPSHOT") + } + else if (System.getenv("VERSION").contains("-")) { + // Either SNAPSHOT or a version qualifier included in $VERSION for ad-hoc releases + version = System.getenv("VERSION") + } + else { + version = System.getenv("VERSION") + "-" + File(project.rootDir, "config/version-qualifier.txt").readText().trim() + } repositories { maven { @@ -67,10 +100,10 @@ tasks.register(name = "publishForReleaseManager") { println("Releasing version $version") - val releaseDir = File(rootProject.buildDir, "release") + val releaseDir = File(rootProject.layout.buildDirectory.get().asFile, "release") releaseDir.mkdirs() - File(rootProject.buildDir, "repository/co/elastic/clients").listFiles()?.forEach { artifact -> + File(rootProject.layout.buildDirectory.get().asFile, "repository/co/elastic/clients").listFiles()?.forEach { artifact -> println("Releasing artifact " + artifact.name) val versionDir = File(artifact, version) diff --git a/catalog-info.yaml b/catalog-info.yaml index 562e4cfdf..6c1077dbc 100644 --- a/catalog-info.yaml +++ b/catalog-info.yaml @@ -26,3 +26,39 @@ spec: devtools-team: {} everyone: access_level: READ_ONLY + + +--- +# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/rre.schema.json +apiVersion: backstage.io/v1alpha1 +kind: Resource +metadata: + name: buildkite-pipeline-elasticsearch-java-release + description: Buildkite Release pipeline for elasticsearch-java + links: + - title: Pipeline + url: https://buildkite.com/elastic/elasticsearch-java-release + tags: + - buildkite + - gpg-sign + - maven-central +spec: + type: buildkite-pipeline + owner: group:devtools-team + system: buildkite + implementation: + apiVersion: buildkite.elastic.dev/v1 + kind: Pipeline + metadata: + description: Elasticsearch Java Client Release + name: elasticsearch-java-release + spec: + repository: elastic/elasticsearch-java + pipeline_file: ".buildkite/release_central.yml" + provider_settings: + trigger_mode: none + teams: + devtools-team: + access_level: MANAGE_BUILD_AND_READ + everyone: + access_level: READ_ONLY diff --git a/config/version-qualifier.txt b/config/version-qualifier.txt new file mode 100644 index 000000000..0da56cbcc --- /dev/null +++ b/config/version-qualifier.txt @@ -0,0 +1 @@ +alpha1 diff --git a/config/version.txt b/config/version.txt index 894aa0bc6..47da986f8 100644 --- a/config/version.txt +++ b/config/version.txt @@ -1 +1 @@ -8.16.0 +9.1.0 diff --git a/docs/_releases.asciidoc b/docs/_releases.asciidoc deleted file mode 100644 index f8980014d..000000000 --- a/docs/_releases.asciidoc +++ /dev/null @@ -1,11 +0,0 @@ -:is_main_branch: - -// Non man branches should include the following (8.1 exemplified below) -// // Versions for the 8.1.x releases -// :v8_1_0_released: -// :v8_1_1_released: - -// // Handle version bump in the docs build -// ifeval::["{version}" == "v8.1.2"] -// :v8_1_2_released: -// endif::[] diff --git a/docs/api-conventions/blocking-and-async.asciidoc b/docs/api-conventions/blocking-and-async.asciidoc deleted file mode 100644 index 41a880002..000000000 --- a/docs/api-conventions/blocking-and-async.asciidoc +++ /dev/null @@ -1,19 +0,0 @@ -[[blocking-and-async]] -=== Blocking and asynchronous clients - -API clients come in two flavors: blocking and asynchronous. All methods on -asynchronous clients return a standard `CompletableFuture`. - -Both flavors can be used at the same time depending on your needs, sharing the -same transport object: - -["source","java"] --------------------------------------------------- -ElasticsearchTransport transport = ... - -include-tagged::{doc-tests-src}/api_conventions/ApiConventionsTest.java[blocking-and-async] --------------------------------------------------- - -Although we won't go in deeper details on asynchronous programming in Java, remember to handle failures of asynchronous tasks. It's easy to overlook them and have errors go unnoticed. - -{doc-tests-blurb} diff --git a/docs/api-conventions/building-objects.asciidoc b/docs/api-conventions/building-objects.asciidoc deleted file mode 100644 index db3e3e493..000000000 --- a/docs/api-conventions/building-objects.asciidoc +++ /dev/null @@ -1,68 +0,0 @@ -[[building-objects]] -=== Building API objects - -[discrete] -==== Builder objects - -All data types in the {java-client} are immutable. Object creation uses the -https://www.informit.com/articles/article.aspx?p=1216151&seqNum=2[builder pattern] -that was popularized in *Effective Java* in 2008. - -["source","java"] --------------------------------------------------- -ElasticsearchClient client = ... -include-tagged::{doc-tests-src}/api_conventions/ApiConventionsTest.java[builders] --------------------------------------------------- - -Note that a builder should not be reused after its `build()` method has been -called. - -[discrete] -==== Builder lambda expressions - -Although this works nicely, having to instantiate builder classes and call the -`build()` method is a bit verbose. So every property setter in the {java-client} also -accepts a lambda expression that takes a newly created builder as a parameter -and returns a populated builder. The snippet above can also be written as: - -["source","java"] --------------------------------------------------- -ElasticsearchClient client = ... -include-tagged::{doc-tests-src}/api_conventions/ApiConventionsTest.java[builder-lambdas] --------------------------------------------------- - -This approach allows for much more concise code, and also avoids importing -classes (and even remembering their names) since types are inferred from the -method parameter signature. - -Note in the above example that builder variables are only used to start a chain -of property setters. The names of these variables are therefore unimportant and -can be shortened to improve readability: - -["source","java"] --------------------------------------------------- -ElasticsearchClient client = ... -include-tagged::{doc-tests-src}/api_conventions/ApiConventionsTest.java[builder-lambdas-short] --------------------------------------------------- - -Builder lambdas become particularly useful with complex nested queries like the -one below, taken from the -{ref}/query-dsl-intervals-query.html[intervals query API documentation]. - -This example also highlights a useful naming convention for builder parameters in -deeply nested structures. For lambda expressions with a single argument, Kotlin -provides the implicit `it` parameter and Scala allows use of `_`. This can be approximated -in Java by using an underscore or a single letter prefix followed by a number representing the depth -level (i.e. `_0`, `_1`, or `b0`, `b1` and so on). Not only does this remove the need to create -throw-away variable names, but it also improves code readability. Correct indentation -also allows the structure of the query to stand out. - -["source","java"] --------------------------------------------------- -ElasticsearchClient client = ... -include-tagged::{doc-tests-src}/api_conventions/ApiConventionsTest.java[builder-intervals] --------------------------------------------------- -<1> Search results will be mapped to `SomeApplicationData` instances to -be readily available to the application. - -{doc-tests-blurb} diff --git a/docs/api-conventions/exceptions.asciidoc b/docs/api-conventions/exceptions.asciidoc deleted file mode 100644 index ef1c7863c..000000000 --- a/docs/api-conventions/exceptions.asciidoc +++ /dev/null @@ -1,15 +0,0 @@ -[[exception-conventions]] -=== Exceptions - -Client methods can throw two kinds of exceptions: - -* Requests that were received by the {es} server but that were rejected -(validation error, server internal timeout exceeded, etc) will produce an -`ElasticsearchException`. This exception contains details about the error, -provided by {es}. - -* Requests that failed to reach the server (network error, server unavailable, -etc) will produce a `TransportException`. That exception's cause is the exception -thrown by the lower-level implementation. In the case of the `RestClientTransport` -it will be a `ResponseException` that contains the low level HTTP response. - diff --git a/docs/api-conventions/index.asciidoc b/docs/api-conventions/index.asciidoc deleted file mode 100644 index d30023609..000000000 --- a/docs/api-conventions/index.asciidoc +++ /dev/null @@ -1,32 +0,0 @@ -[[api-conventions]] -== API conventions - -The {java-client} uses a very consistent code structure, using modern code -patterns that make complex requests easier to write and complex responses easier -to process. The sections below explain these in details. - -* <> -* <> -* <> -* <> -* <> -* <> -* <> -ifdef::is_main_branch,v8_1_1_released,v7_17_2_released[] -* <> -endif::is_main_branch,v8_1_1_released,v7_17_2_released[] -* <> - -include::package-structure.asciidoc[] -include::method-naming.asciidoc[] -include::blocking-and-async.asciidoc[] -include::building-objects.asciidoc[] -include::lists-and-maps.asciidoc[] -include::variant-types.asciidoc[] -include::object-lifecycles.asciidoc[] - -ifdef::is_main_branch,v8_1_1_released,v7_17_2_released[] -include::loading-json.asciidoc[] -endif::is_main_branch,v8_1_1_released,v7_17_2_released[] - -include::exceptions.asciidoc[] diff --git a/docs/api-conventions/lists-and-maps.asciidoc b/docs/api-conventions/lists-and-maps.asciidoc deleted file mode 100644 index 117295b50..000000000 --- a/docs/api-conventions/lists-and-maps.asciidoc +++ /dev/null @@ -1,40 +0,0 @@ -[[lists-and-maps]] -=== Lists and maps - -[discrete] -==== Additive builder setters - -Properties of type `List` and `Map` are exposed by object builders as a set of overloaded -additive-only methods that _update_ the property value, by appending to lists and adding -new entries to maps (or replacing existing ones). - -Object builders create immutable objects, and this also applies to list and map properties -that are made immutable at object construction time. - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/api_conventions/ApiConventionsTest.java[collections] --------------------------------------------------- - -[discrete] -==== List and map values are never `null` - -The {es} API has a lot of optional properties. For single-valued properties, the {java-client} -represents missing optional values as `null`. Applications therefore have to null-check -optional values before using them. - -For lists and maps however, applications often only care about whether they're empty or not, -or even just iterate on their content. Using `null` values is then cumbersome. To avoid this, -{java-client} collection properties are never `null`, and missing optional collections are -returned as an empty collection. - -If you ever need to distinguish between a missing (undefined) optional collection and an -effectively-empty collection returned by {es}, the `ApiTypeHelper` class provides a utility -method to distinguish them: - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/api_conventions/ApiConventionsTest.java[optional-collections] --------------------------------------------------- - -{doc-tests-blurb} diff --git a/docs/api-conventions/loading-json.asciidoc b/docs/api-conventions/loading-json.asciidoc deleted file mode 100644 index 5c50f4a1a..000000000 --- a/docs/api-conventions/loading-json.asciidoc +++ /dev/null @@ -1,87 +0,0 @@ -[[loading-json]] -=== Creating API objects from JSON data - -ifeval::["{minor-version}" == "7.17"] -NOTE: This feature was added in version 7.17.2 -endif::[] - -ifeval::["{minor-version}" == "8.1"] -NOTE: This feature was added in version 8.1.1 -endif::[] - -A common workflow during application development with Elasticsearch is to use the Kibana Developer Console to interactively prepare and test queries, aggregations, index mappings and other complex API calls. This results in working JSON snippets that you may want to use in your application. - -As translating these JSON snippets to Java code can be time-consuming and error-prone, most of the data classes in the {java-client} can be loaded from JSON text: object builders have `withJson()` methods that populate the builder from raw JSON. This also allows you to combine dynamically loaded JSON with programmatic construction of objects. - -Under the hood, the `withJson()` methods call the object's deserializer. The JSON text's structure and value types therefore have to be correct for the target data structure. Using `withJson()` keeps the strong typing guarantees of the {java-client}. - -[discrete] -==== Examples - -[discrete] -===== Loading an index definition from a resource file - -Consider a resource file `some-index.json` containing an index definition: - -["source", "json"] --------------------------------------------------- -{ - "mappings": { - "properties": { - "field1": { "type": "text" } - } - } -} --------------------------------------------------- - -You can create an index from that definition as follows: - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/api_conventions/LoadingJsonTest.java[load-index] --------------------------------------------------- -<1> open an input stream for the JSON resource file. -<2> populate the index creation request with the resource file contents. - -[discrete] -===== Ingesting documents from JSON files - -Similarly, you can read documents to be stored in {es} from data files: - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/api_conventions/LoadingJsonTest.java[ingest-data] --------------------------------------------------- -<1> when calling `withJson()` on data structures that have generic type parameters, these generic types will be considered to be `JsonData`. - -[discrete] -===== Creating a search request combining JSON and programmatic construction - -You can combine `withJson()` with regular calls to setter methods. The example below loads the query part of a search request from a `String` and programmatically adds an aggregation. - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/api_conventions/LoadingJsonTest.java[query] --------------------------------------------------- -<1> loads the query from the JSON string. -<2> adds the aggregation. -<3> since this is an aggregation we don't care about result documents and set their target class to `Void`, meaning they will just be ignored. Note that setting `size` to zero actually prevents any document from being returned. - -[discrete] -===== Creating a search request from multiple JSON snippets - -The `withJson()` methods are partial deserializers: the properties loaded from the JSON will set property values or replace the previous ones, but will not reset other properties not found in the JSON input. You can use this to combine multiple JSON snippets to build complex search requests. In the example below, we combine separate definitions of a query that selects some documents and an aggregation that is run on the results of this query. - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/api_conventions/LoadingJsonTest.java[query-and-agg] --------------------------------------------------- -<1> set max number of returned document to 100 for queries. -<2> we do not want any matching document in aggregations. -<3> loads the query part of the request. -<4> loads the aggregation part of the request (overwrites `size` from the query). -<5> additional request properties set programmatically. - -Notice that order matters when the JSON snippets have some common properties: just as when setting property values programmatically, the last value that is set for a property overwrites the previous one. - -{doc-tests-blurb} diff --git a/docs/api-conventions/method-naming.asciidoc b/docs/api-conventions/method-naming.asciidoc deleted file mode 100644 index 704f8a9c3..000000000 --- a/docs/api-conventions/method-naming.asciidoc +++ /dev/null @@ -1,15 +0,0 @@ -[[method-naming]] -=== Method naming conventions - -Classes in the {java-client} contain two kinds of methods and properties: - -* Methods and properties that are part of the API, such as -`ElasticsearchClient.search()` or `SearchResponse.maxScore()`. They are derived -from their respective names in the {es} JSON API using the standard Java -`camelCaseNaming` convention. - -* Methods and properties that are part of the framework on which the Java API -Client is built, such as `Query._kind()`. These methods and properties are -prefixed with an underscore to both avoid any naming conflicts with API names, -and as an easy way to distinguish the API from the framework. - diff --git a/docs/api-conventions/object-lifecycles.asciidoc b/docs/api-conventions/object-lifecycles.asciidoc deleted file mode 100644 index a4500ce0b..000000000 --- a/docs/api-conventions/object-lifecycles.asciidoc +++ /dev/null @@ -1,31 +0,0 @@ -[[object-lifecycles]] -=== Object life cycles and thread safety - -There are five kinds of objects in the {java-client} with different life cycles: - - -**Object mapper**:: -Stateless and thread-safe, but can be costly to create. -It’s usually a singleton that is created at application startup and used to -create the transport. - -**Transport**:: -Thread-safe, holds network resources through the underlying HTTP client. A -transport object is associated with an {es} cluster and has to be explicitly -closed to release the underlying resources such as network connections. - -**Clients**:: -Immutable, stateless and thread-safe. -These are very lightweight objects that just wrap a transport and provide API -endpoints as methods. Closing a client closes the underlying transport. - -**Builders**:: -Mutable, non thread-safe. -Builders are transient objects that should not be reused after calling -`build()`. - -**Requests & other API objects**:: -Immutable, thread-safe. -If your application uses the same request or same parts of a request over and -over, these objects can be prepared in advance and reused across multiple calls -over multiple clients with different transports. diff --git a/docs/api-conventions/package-structure.asciidoc b/docs/api-conventions/package-structure.asciidoc deleted file mode 100644 index f51d0f476..000000000 --- a/docs/api-conventions/package-structure.asciidoc +++ /dev/null @@ -1,26 +0,0 @@ -[[package-structure]] -=== Package structure and namespace clients - -The {es} API is large and is organized into feature groups, as can be seen in -the {ref}/rest-apis.html[{es} API documentation]. - -The {java-client} follows this structure: feature groups are called “namespaces”, -and each namespace is located in a subpackage of -`co.elastic.clients.elasticsearch`. - -Each of the namespace clients can be accessed from the top level {es} client. The -only exceptions are the “search” and “document” APIs which are located in the `core` -subpackage and can be accessed on the main {es} client object. - -The snippet below shows how to use the indices namespace client to create an -index (the lambda syntax is explained in <>): - -["source","java"] --------------------------------------------------- -// Create the "products" index -ElasticsearchClient client = ... -client.indices().create(c -> c.index("products")); --------------------------------------------------- - -Namespace clients are very lightweight objects that can be created on the fly. - diff --git a/docs/api-conventions/variant-types.asciidoc b/docs/api-conventions/variant-types.asciidoc deleted file mode 100644 index 99f602e9d..000000000 --- a/docs/api-conventions/variant-types.asciidoc +++ /dev/null @@ -1,106 +0,0 @@ -[[variant-types]] -=== Variant types - -The {es} API has a lot of variant types: queries, aggregations, field mappings, -analyzers, and so on. Finding the correct class name in such large collections -can be challenging. - -The {java-client} builders make this easy: the builders for variant types, such as -`Query`, have methods for each of the available implementations. We’ve seen this -in action above with `intervals` (a kind of query) and `allOf`, `match` and -`anyOf` (various kinds of intervals). - -This is because variant objects in the {java-client} are implementations of a -“tagged union”: they contain the identifier (or tag) of the variant they hold -and the value for that variant. For example, a `Query` object can contain an -`IntervalsQuery` with tag `intervals`, a `TermQuery` with tag `term`, and so on. -This approach allows writing fluent code where you can let the IDE completion -features guide you to build and navigate complex nested structures: - -Variant builders have setter methods for every available implementation. They -use the same conventions as regular properties and accept both a builder lambda -expression and a ready-made object of the actual type of the variant. Here’s an -example to build a term query: - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/api_conventions/ApiConventionsTest.java[variant-creation] --------------------------------------------------- -<1> Choose the `term` variant to build a term query. -<2> Build the terms query with a builder lambda expression. -<3> Build the `Query` that now holds a `TermQuery` object of kind `term`. - -Variant objects have getter methods for every available implementation. These -methods check that the object actually holds a variant of that kind and return -the value downcasted to the correct type. They throw an `IllegalStateException` -otherwise. This approach allows writing fluent code to traverse variants. - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/api_conventions/ApiConventionsTest.java[variant-navigation] --------------------------------------------------- - -Variant objects also provide information on the variant kind they currently hold: - -* with `is` methods for each of the variant kinds: `isTerm()`, `isIntervals()`, `isFuzzy()`, etc. - -* with a nested `Kind` enumeration that defines all variant kinds. - -This information can then be used to navigate down into specific variants after checking -their actual kind: - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/api_conventions/ApiConventionsTest.java[variant-kind] --------------------------------------------------- -<1> Test if the variant is of a specific kind. -<2> Test a larger set of variant kinds. -<3> Get the kind and value held by the variant object. - -[discrete] -[[variant-types-custom]] -==== Custom extensions provided by {es} plugins - -{es} accepts plugins that can extend the available variants for a number of types. This includes queries, aggregations, text analyzers and tokenizers, ingest processors, etc. - -The {java-client} classes for these types accept a `_custom` variant in addition to the builtin ones. This allows you to use these plugin-defined extensions by providing arbitrary JSON in requests, and also receive arbitrary JSON produced by the plugins in responses. - -In the examples below we use a hypothetical plugin that adds a `sphere-distance` aggregation that groups documents containing 3D coordinates according to their distance to a reference location. - -To create a custom aggregation, use the `_custom()` aggregation type and provide its identifier, defined by the plugin, and parameters. The parameters can be any object or value that can be serialized to JSON. In the example below we use a simple map: - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/api_conventions/ApiConventionsTest.java[custom-variant-creation] --------------------------------------------------- -<1> Parameters for the custom aggregation. -<2> Create a custom aggregation named `neighbors` of kind `sphere-distance` with its parameters. - -The results of custom variants are returned as raw JSON represented by a `JsonData` object. You can then traverse the JSON tree to get the data. Since this is not always convenient, you can also define classes that represent that JSON data and deserialize them from the raw JSON. - -Traversing the JSON tree: - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/api_conventions/ApiConventionsTest.java[custom-variant-navigation-json] --------------------------------------------------- -<1> Use `Void` if you're only interested in aggregation results, not search hits (see also <>). -<2> Get the `neighbors` aggregation result as custom JSON result. -<3> Traverse the JSON tree to extract the result data. - -Using a class that represents the custom aggregation results: - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/api_conventions/ApiConventionsTest.java[custom-variant-navigation-typed] --------------------------------------------------- -<1> Deserialize the custom JSON to a dedicated `SphereDistanceAggregate` class. - -Where `SphereDistanceAggregate` can be defined as follows: -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/api_conventions/ApiConventionsTest.java[custom-variant-types] --------------------------------------------------- - - -{doc-tests-blurb} diff --git a/docs/docset.yml b/docs/docset.yml new file mode 100644 index 000000000..b4b03b47d --- /dev/null +++ b/docs/docset.yml @@ -0,0 +1,15 @@ +project: 'Java API Client' +exclude: + - external-resources.md + - design/* + - local/README.md +cross_links: + - docs-content + - elasticsearch +toc: + - toc: reference + - toc: release-notes +subs: + serverless-full: "Elastic Cloud Serverless" + es3: "Elasticsearch Serverless" + es: "Elasticsearch" diff --git a/docs/external-resources.asciidoc b/docs/external-resources.asciidoc deleted file mode 100644 index 5a73c851c..000000000 --- a/docs/external-resources.asciidoc +++ /dev/null @@ -1,10 +0,0 @@ -[[external-resources]] -== External resources - -// Note: we keep the actual links in GitHub to ease maintenance and avoid publishing external -// links on the corporate website. This is particularly important as the documentation for -// older versions of the Elastic Stack may stop being updated on the website. - -There is some material related to the {java-client} available outside this website that provides additional information or different perspectives on the library. - -You can find a community-maintained list of external resources in the https://github.com/elastic/elasticsearch-java/tree/main/docs/external-resources.md[{java-client} GitHub repository]. diff --git a/docs/getting-started.asciidoc b/docs/getting-started.asciidoc deleted file mode 100644 index 337e2e3b1..000000000 --- a/docs/getting-started.asciidoc +++ /dev/null @@ -1,172 +0,0 @@ -[[getting-started-java]] -== Getting started - -This page guides you through the installation process of the Java client, shows -you how to instantiate the client, and how to perform basic Elasticsearch -operations with it. - -[discrete] -=== Requirements - -* Java 8 or later. -* A JSON object mapping library to allow seamless integration of -your application classes with the Elasticsearch API. The examples below -show usage with Jackson. - -[discrete] -=== Installation - -[discrete] -==== Installation in a Gradle project by using Jackson - -["source","groovy",subs="attributes+"] --------------------------------------------------- -dependencies { - implementation 'co.elastic.clients:elasticsearch-java:{version}' - implementation 'com.fasterxml.jackson.core:jackson-databind:2.17.0' -} --------------------------------------------------- - -[discrete] -==== Installation in a Maven project by using Jackson - -In the `pom.xml` of your project, add the following repository definition and -dependencies: - -["source","xml",subs="attributes+"] --------------------------------------------------- - - - - - co.elastic.clients - elasticsearch-java - {version} - - - - com.fasterxml.jackson.core - jackson-databind - 2.17.0 - - - - --------------------------------------------------- - - -Refer to the <> page to learn more. - - -[discrete] -=== Connecting - -You can connect to the Elastic Cloud using an API key and the Elasticsearch -endpoint. - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/getting_started/ConnectingTest.java[create-client] --------------------------------------------------- - -Your Elasticsearch endpoint can be found on the **My deployment** page of your -deployment: - -image::images/es-endpoint.jpg[alt="Finding Elasticsearch endpoint",align="center"] - -You can generate an API key on the **Management** page under Security. - -image::images/create-api-key.png[alt="Create API key",align="center"] - -For other connection options, refer to the <> section. - - -[discrete] -=== Operations - -Time to use Elasticsearch! This section walks you through the basic, and most -important, operations of Elasticsearch. For more operations and more advanced -examples, refer to the <> page. - - -[discrete] -==== Creating an index - -This is how you create the `product` index: - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/usage/IndexingTest.java[create-products-index] --------------------------------------------------- - -[discrete] -==== Indexing documents - -This is a simple way of indexing a document, here a `Product` application object: - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/usage/IndexingTest.java[single-doc-dsl] --------------------------------------------------- - -[discrete] -==== Getting documents - -You can get documents by using the following code: - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/usage/ReadingTest.java[get-by-id] --------------------------------------------------- -<1> The get request, with the index name and identifier. -<2> The target class, here `Product`. - - -[discrete] -==== Searching documents - -This is how you can create a single match query with the Java client: - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/usage/SearchingTest.java[search-getting-started] --------------------------------------------------- - -[discrete] -==== Updating documents - -This is how you can update a document, for example to add a new field: - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/usage/IndexingTest.java[single-doc-update] --------------------------------------------------- - - - -[discrete] -==== Deleting documents - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/usage/IndexingTest.java[single-doc-delete] --------------------------------------------------- - - -[discrete] -==== Deleting an index - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/usage/IndexingTest.java[delete-products-index] --------------------------------------------------- - -[discrete] -== Examples - -The https://github.com/elastic/elasticsearch-java/tree/main/examples[examples] folder in the Github repository contains full working examples showing how to set up and use the client. - -[discrete] -== Further reading - -* Learn more about the <> of the Java client. diff --git a/docs/index-local.asciidoc b/docs/index-local.asciidoc deleted file mode 100644 index f7860b40d..000000000 --- a/docs/index-local.asciidoc +++ /dev/null @@ -1,5 +0,0 @@ -// Allow building docs locally without a checkout of the Elasticsearch repo -:elasticsearch-root: {docdir}/local/elasticsearch -:local-docs: true - -include::index.asciidoc[] diff --git a/docs/index.asciidoc b/docs/index.asciidoc deleted file mode 100644 index 29b4e6cd9..000000000 --- a/docs/index.asciidoc +++ /dev/null @@ -1,40 +0,0 @@ -= Elasticsearch Java API Client - -include::{asciidoc-dir}/../../shared/versions/stack/{source_branch}.asciidoc[] -include::{asciidoc-dir}/../../shared/attributes.asciidoc[] - -include::_releases.asciidoc[] - -:java-client: Java API Client -:doc-tests-src: {docdir}/../java-client/src/test/java/co/elastic/clients/documentation -:doc-tests-url: https://github.com/elastic/elasticsearch-java/tree/{branch}/java-client/src/test/java/co/elastic/clients/documentation -:doc-tests-blurb: The source code for the examples above can be found in the {doc-tests-url}[{java-client} tests]. - -:es-docs: https://www.elastic.co/guide/en/elasticsearch/reference/{branch} - -ifeval::["{release-state}"=="unreleased"] -:java-client-javadoc: https://snapshots.elastic.co/javadoc/co/elastic/clients/elasticsearch-java/{version}-SNAPSHOT -:rest-client-javadoc: https://snapshots.elastic.co/javadoc/org/elasticsearch/client/elasticsearch-rest-client/{version}-SNAPSHOT -:rest-client-sniffer-javadoc: https://snapshots.elastic.co/javadoc/org/elasticsearch/client/elasticsearch-rest-client-sniffer/{version}-SNAPSHOT -:version_qualified: {bare_version}-SNAPSHOT -endif::[] - -ifeval::["{release-state}"!="unreleased"] -:java-client-javadoc: https://artifacts.elastic.co/javadoc/co/elastic/clients/elasticsearch-java/{version} -:rest-client-javadoc: https://artifacts.elastic.co/javadoc/org/elasticsearch/client/elasticsearch-rest-client/{version} -:rest-client-sniffer-javadoc: https://artifacts.elastic.co/javadoc/org/elasticsearch/client/elasticsearch-rest-client-sniffer/{version} -:version_qualified: {bare_version} -endif::[] - -include::introduction.asciidoc[] -include::getting-started.asciidoc[] -include::setup/index.asciidoc[] -include::api-conventions/index.asciidoc[] - -include::usage/index.asciidoc[] - -include::troubleshooting/index.asciidoc[] -include::javadoc-and-source.asciidoc[] -include::release-notes/index.asciidoc[] -include::external-resources.asciidoc[] -include::{elasticsearch-root}/docs/java-rest/low-level/index.asciidoc[] diff --git a/docs/introduction.asciidoc b/docs/introduction.asciidoc deleted file mode 100644 index d283813d8..000000000 --- a/docs/introduction.asciidoc +++ /dev/null @@ -1,38 +0,0 @@ -[[introduction]] -== Introduction - -This is the documentation for the official Java API Client for {es}. The client -provides strongly typed requests and responses for all {es} APIs. - -[discrete] -=== Features - -* Strongly typed requests and responses for all {es} APIs. -* Blocking and asynchronous versions of all APIs. -* Use of fluent builders and functional patterns to allow writing concise yet - readable code when creating complex nested structures. -* Seamless integration of application classes by using an object mapper such as - Jackson or any JSON-B implementation. -* Delegates protocol handling to an http client such as the <> - that takes care of all transport-level concerns: HTTP connection pooling, - retries, node discovery, and so on. - -[discrete] -=== Elasticsearch server compatibility policy - -The {es} Java client is forward compatible; meaning that the client supports -communicating with greater or equal minor versions of {es} without breaking. It -does not mean that the client automatically supports new features of newer -{es} versions; it is only possible after a release of a new client version. For -example, a 8.12 client version won't automatically support the new features of -the 8.13 version of {es}, the 8.13 client version is required for that. {es} -language clients are only backwards compatible with default distributions and -without guarantees made. - -|=== -| Elasticsearch Version | Elasticsearch-Java Branch | Supported - -| main | main | -| 8.x | 8.x | 8.x -| 7.x | 7.x | 7.17 -|=== \ No newline at end of file diff --git a/docs/javadoc-and-source.asciidoc b/docs/javadoc-and-source.asciidoc deleted file mode 100644 index 8298f97c5..000000000 --- a/docs/javadoc-and-source.asciidoc +++ /dev/null @@ -1,6 +0,0 @@ -[[java-client-javadoc]] -== Javadoc and source code - -The javadoc for the {java-client} can be found at {java-client-javadoc}/index.html. - -The source code is at https://github.com/elastic/elasticsearch-java/ and is licensed under the Apache 2.0 License. diff --git a/docs/local/elasticsearch/docs/java-rest/low-level/index.asciidoc b/docs/local/elasticsearch/docs/java-rest/low-level/index.asciidoc deleted file mode 100644 index c7b8560f3..000000000 --- a/docs/local/elasticsearch/docs/java-rest/low-level/index.asciidoc +++ /dev/null @@ -1,4 +0,0 @@ -[[java-rest-low]] -== Java Low Level REST Client - -This is a stub for the Java Low Level REST Client. diff --git a/docs/reference/_basic_authentication.md b/docs/reference/_basic_authentication.md new file mode 100644 index 000000000..5e54beed3 --- /dev/null +++ b/docs/reference/_basic_authentication.md @@ -0,0 +1,51 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/_basic_authentication.html +--- + +# Basic authentication [_basic_authentication] + +Configuring basic authentication can be done by providing an `HttpClientConfigCallback` while building the `RestClient` through its builder. The interface has one method that receives an instance of [`org.apache.http.impl.nio.client.HttpAsyncClientBuilder`](https://hc.apache.org/httpcomponents-asyncclient-4.1.x/current/httpasyncclient/apidocs/org/apache/http/impl/nio/client/HttpAsyncClientBuilder.html) as an argument and has the same return type. The http client builder can be modified and then returned. In the following example we set a default credentials provider that requires basic authentication. + +```java +final CredentialsProvider credentialsProvider = + new BasicCredentialsProvider(); +credentialsProvider.setCredentials(AuthScope.ANY, + new UsernamePasswordCredentials("user", "test-user-password")); + +RestClientBuilder builder = RestClient.builder( + new HttpHost("localhost", 9200)) + .setHttpClientConfigCallback(new HttpClientConfigCallback() { + @Override + public HttpAsyncClientBuilder customizeHttpClient( + HttpAsyncClientBuilder httpClientBuilder) { + return httpClientBuilder + .setDefaultCredentialsProvider(credentialsProvider); + } + }); +``` + +Preemptive Authentication can be disabled, which means that every request will be sent without authorization headers to see if it is accepted and, upon receiving an HTTP 401 response, it will resend the exact same request with the basic authentication header. If you wish to do this, then you can do so by disabling it via the `HttpAsyncClientBuilder`: + +```java +final CredentialsProvider credentialsProvider = + new BasicCredentialsProvider(); +credentialsProvider.setCredentials(AuthScope.ANY, + new UsernamePasswordCredentials("user", "test-user-password")); + +RestClientBuilder builder = RestClient.builder( + new HttpHost("localhost", 9200)) + .setHttpClientConfigCallback(new HttpClientConfigCallback() { + @Override + public HttpAsyncClientBuilder customizeHttpClient( + HttpAsyncClientBuilder httpClientBuilder) { + httpClientBuilder.disableAuthCaching(); <1> + return httpClientBuilder + .setDefaultCredentialsProvider(credentialsProvider); + } + }); +``` + +1. Disable preemptive authentication + + diff --git a/docs/reference/_encrypted_communication.md b/docs/reference/_encrypted_communication.md new file mode 100644 index 000000000..8edab1187 --- /dev/null +++ b/docs/reference/_encrypted_communication.md @@ -0,0 +1,95 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/_encrypted_communication.html +--- + +# Encrypted communication [_encrypted_communication] + +Encrypted communication using TLS can also be configured through the `HttpClientConfigCallback`. The [`org.apache.http.impl.nio.client.HttpAsyncClientBuilder`](https://hc.apache.org/httpcomponents-asyncclient-4.1.x/current/httpasyncclient/apidocs/org/apache/http/impl/nio/client/HttpAsyncClientBuilder.html) received as an argument exposes multiple methods to configure encrypted communication: `setSSLContext`, `setSSLSessionStrategy` and `setConnectionManager`, in order of precedence from the least important. + +When accessing an Elasticsearch cluster that is setup for TLS on the HTTP layer, the client needs to trust the certificate that Elasticsearch is using. The following is an example of setting up the client to trust the CA that has signed the certificate that Elasticsearch is using, when that CA certificate is available in a PKCS#12 keystore: + +```java +Path trustStorePath = Paths.get("/path/to/truststore.p12"); +KeyStore truststore = KeyStore.getInstance("pkcs12"); +try (InputStream is = Files.newInputStream(trustStorePath)) { + truststore.load(is, keyStorePass.toCharArray()); +} +SSLContextBuilder sslBuilder = SSLContexts.custom() + .loadTrustMaterial(truststore, null); +final SSLContext sslContext = sslBuilder.build(); +RestClientBuilder builder = RestClient.builder( + new HttpHost("localhost", 9200, "https")) + .setHttpClientConfigCallback(new HttpClientConfigCallback() { + @Override + public HttpAsyncClientBuilder customizeHttpClient( + HttpAsyncClientBuilder httpClientBuilder) { + return httpClientBuilder.setSSLContext(sslContext); + } + }); +``` + +The following is an example of setting up the client to trust the CA that has signed the certificate that Elasticsearch is using, when that CA certificate is available as a PEM encoded file. + +```java +Path caCertificatePath = Paths.get("/path/to/ca.crt"); +CertificateFactory factory = + CertificateFactory.getInstance("X.509"); +Certificate trustedCa; +try (InputStream is = Files.newInputStream(caCertificatePath)) { + trustedCa = factory.generateCertificate(is); +} +KeyStore trustStore = KeyStore.getInstance("pkcs12"); +trustStore.load(null, null); +trustStore.setCertificateEntry("ca", trustedCa); +SSLContextBuilder sslContextBuilder = SSLContexts.custom() + .loadTrustMaterial(trustStore, null); +final SSLContext sslContext = sslContextBuilder.build(); +RestClient.builder( + new HttpHost("localhost", 9200, "https")) + .setHttpClientConfigCallback(new HttpClientConfigCallback() { + @Override + public HttpAsyncClientBuilder customizeHttpClient( + HttpAsyncClientBuilder httpClientBuilder) { + return httpClientBuilder.setSSLContext(sslContext); + } + }); +``` + +When Elasticsearch is configured to require client TLS authentication, for example when a PKI realm is configured, the client needs to provide a client certificate during the TLS handshake in order to authenticate. The following is an example of setting up the client for TLS authentication with a certificate and a private key that are stored in a PKCS#12 keystore. + +```java +Path trustStorePath = Paths.get("/path/to/your/truststore.p12"); +Path keyStorePath = Paths.get("/path/to/your/keystore.p12"); +KeyStore trustStore = KeyStore.getInstance("pkcs12"); +KeyStore keyStore = KeyStore.getInstance("pkcs12"); +try (InputStream is = Files.newInputStream(trustStorePath)) { + trustStore.load(is, trustStorePass.toCharArray()); +} +try (InputStream is = Files.newInputStream(keyStorePath)) { + keyStore.load(is, keyStorePass.toCharArray()); +} +SSLContextBuilder sslBuilder = SSLContexts.custom() + .loadTrustMaterial(trustStore, null) + .loadKeyMaterial(keyStore, keyStorePass.toCharArray()); +final SSLContext sslContext = sslBuilder.build(); +RestClientBuilder builder = RestClient.builder( + new HttpHost("localhost", 9200, "https")) + .setHttpClientConfigCallback(new HttpClientConfigCallback() { + @Override + public HttpAsyncClientBuilder customizeHttpClient( + HttpAsyncClientBuilder httpClientBuilder) { + return httpClientBuilder.setSSLContext(sslContext); + } + }); +``` + +If the client certificate and key are not available in a keystore but rather as PEM encoded files, you cannot use them directly to build an SSLContext. You must rely on external libraries to parse the PEM key into a PrivateKey instance. Alternatively, you can use external tools to build a keystore from your PEM files, as shown in the following example: + +``` +openssl pkcs12 -export -in client.crt -inkey private_key.pem \ + -name "client" -out client.p12 +``` + +If no explicit configuration is provided, the [system default configuration](https://docs.oracle.com/javase/7/docs/technotes/guides/security/jsse/JSSERefGuide.md#CustomizingStores) will be used. + diff --git a/docs/reference/_license.md b/docs/reference/_license.md new file mode 100644 index 000000000..42b8bb6fc --- /dev/null +++ b/docs/reference/_license.md @@ -0,0 +1,16 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/_license.html +--- + +# License [_license] + +Copyright 2013-2019 Elasticsearch + +Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + +``` +http://www.apache.org/licenses/LICENSE-2.0 +``` +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + diff --git a/docs/reference/_maven_repository.md b/docs/reference/_maven_repository.md new file mode 100644 index 000000000..2f5324972 --- /dev/null +++ b/docs/reference/_maven_repository.md @@ -0,0 +1,35 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/_maven_repository.html +--- + +# Maven Repository [_maven_repository] + +The REST client sniffer is subject to the same release cycle as Elasticsearch. Replace the version with the desired sniffer version, first released with `5.0.0-alpha4`. There is no relation between the sniffer version and the Elasticsearch version that the client can communicate with. Sniffer supports fetching the nodes list from Elasticsearch 2.x and onwards. + +If you are looking for a SNAPSHOT version, the Elastic Maven Snapshot repository is available at [https://snapshots.elastic.co/maven/](https://snapshots.elastic.co/maven/). + +## Maven configuration [_maven_configuration] + +Here is how you can configure the dependency using maven as a dependency manager. Add the following to your `pom.xml` file: + +```xml + + org.elasticsearch.client + elasticsearch-rest-client-sniffer + 9.0.0-beta1 + +``` + + +## Gradle configuration [_gradle_configuration] + +Here is how you can configure the dependency using gradle as a dependency manager. Add the following to your `build.gradle` file: + +```groovy +dependencies { + compile 'org.elasticsearch.client:elasticsearch-rest-client-sniffer:9.0.0-beta1' +} +``` + + diff --git a/docs/reference/_node_selector.md b/docs/reference/_node_selector.md new file mode 100644 index 000000000..1cd0f3408 --- /dev/null +++ b/docs/reference/_node_selector.md @@ -0,0 +1,50 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/_node_selector.html +--- + +# Node selector [_node_selector] + +The client sends each request to one of the configured nodes in round-robin fashion. Nodes can optionally be filtered through a node selector that needs to be provided when initializing the client. This is useful when sniffing is enabled, in case no dedicated master nodes should be hit by HTTP requests. For each request the client will run the eventually configured node selector to filter the node candidates, then select the next one in the list out of the remaining ones. + +```java +RestClientBuilder builder = RestClient.builder( + new HttpHost("localhost", 9200, "http")); +builder.setNodeSelector(new NodeSelector() { <1> + @Override + public void select(Iterable nodes) { + /* + * Prefer any node that belongs to rack_one. If none is around + * we will go to another rack till it's time to try and revive + * some of the nodes that belong to rack_one. + */ + boolean foundOne = false; + for (Node node : nodes) { + String rackId = node.getAttributes().get("rack_id").get(0); + if ("rack_one".equals(rackId)) { + foundOne = true; + break; + } + } + if (foundOne) { + Iterator nodesIt = nodes.iterator(); + while (nodesIt.hasNext()) { + Node node = nodesIt.next(); + String rackId = node.getAttributes().get("rack_id").get(0); + if ("rack_one".equals(rackId) == false) { + nodesIt.remove(); + } + } + } + } +}); +``` + +1. Set an allocation aware node selector that allows to pick a node in the local rack if any available, otherwise go to any other node in any rack. It acts as a preference rather than a strict requirement, given that it goes to another rack if none of the local nodes are available, rather than returning no nodes in such case which would make the client forcibly revive a local node whenever none of the nodes from the preferred rack is available. + + +::::{warning} +Node selectors that do not consistently select the same set of nodes will make round-robin behaviour unpredictable and possibly unfair. The preference example above is fine as it reasons about availability of nodes which already affects the predictability of round-robin. Node selection should not depend on other external factors or round-robin will not work properly. +:::: + + diff --git a/docs/reference/_number_of_threads.md b/docs/reference/_number_of_threads.md new file mode 100644 index 000000000..318c2d407 --- /dev/null +++ b/docs/reference/_number_of_threads.md @@ -0,0 +1,24 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/_number_of_threads.html +--- + +# Number of threads [_number_of_threads] + +The Apache Http Async Client starts by default one dispatcher thread, and a number of worker threads used by the connection manager, as many as the number of locally detected processors (depending on what `Runtime.getRuntime().availableProcessors()` returns). The number of threads can be modified as follows: + +```java +RestClientBuilder builder = RestClient.builder( + new HttpHost("localhost", 9200)) + .setHttpClientConfigCallback(new HttpClientConfigCallback() { + @Override + public HttpAsyncClientBuilder customizeHttpClient( + HttpAsyncClientBuilder httpClientBuilder) { + return httpClientBuilder.setDefaultIOReactorConfig( + IOReactorConfig.custom() + .setIoThreadCount(1) + .build()); + } + }); +``` + diff --git a/docs/reference/_other_authentication_methods.md b/docs/reference/_other_authentication_methods.md new file mode 100644 index 000000000..ef3e88fb0 --- /dev/null +++ b/docs/reference/_other_authentication_methods.md @@ -0,0 +1,41 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/_other_authentication_methods.html +--- + +# Other authentication methods [_other_authentication_methods] + +## Elasticsearch Token Service tokens [_elasticsearch_token_service_tokens] + +If you want the client to authenticate with an Elasticsearch access token, set the relevant HTTP request header. If the client makes requests on behalf of a single user only, you can set the necessary `Authorization` header as a default header as shown in the following example: + +```java +RestClientBuilder builder = RestClient.builder( + new HttpHost("localhost", 9200, "http")); +Header[] defaultHeaders = + new Header[]{new BasicHeader("Authorization", + "Bearer u6iuAxZ0RG1Kcm5jVFI4eU4tZU9aVFEwT2F3")}; +builder.setDefaultHeaders(defaultHeaders); +``` + + +## Elasticsearch API keys [_elasticsearch_api_keys] + +If you want the client to authenticate with an Elasticsearch API key, set the relevant HTTP request header. If the client makes requests on behalf of a single user only, you can set the necessary `Authorization` header as a default header as shown in the following example: + +```java +String apiKeyId = "uqlEyn8B_gQ_jlvwDIvM"; +String apiKeySecret = "HxHWk2m4RN-V_qg9cDpuX"; +String apiKeyAuth = + Base64.getEncoder().encodeToString( + (apiKeyId + ":" + apiKeySecret) + .getBytes(StandardCharsets.UTF_8)); +RestClientBuilder builder = RestClient.builder( + new HttpHost("localhost", 9200, "http")); +Header[] defaultHeaders = + new Header[]{new BasicHeader("Authorization", + "ApiKey " + apiKeyAuth)}; +builder.setDefaultHeaders(defaultHeaders); +``` + + diff --git a/docs/reference/_others.md b/docs/reference/_others.md new file mode 100644 index 000000000..6232fb867 --- /dev/null +++ b/docs/reference/_others.md @@ -0,0 +1,14 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/_others.html +--- + +# Others [_others] + +For any other required configuration needed, the Apache HttpAsyncClient docs should be consulted: [https://hc.apache.org/httpcomponents-asyncclient-4.1.x/](https://hc.apache.org/httpcomponents-asyncclient-4.1.x/) . + +::::{note} +If your application runs under the security manager you might be subject to the JVM default policies of caching positive hostname resolutions indefinitely and negative hostname resolutions for ten seconds. If the resolved addresses of the hosts to which you are connecting the client to vary with time then you might want to modify the default JVM behavior. These can be modified by adding [`networkaddress.cache.ttl=`](https://docs.oracle.com/javase/8/docs/technotes/guides/net/properties.md) and [`networkaddress.cache.negative.ttl=`](https://docs.oracle.com/javase/8/docs/technotes/guides/net/properties.md) to your [Java security policy](https://docs.oracle.com/javase/8/docs/technotes/guides/security/PolicyFiles.md). +:::: + + diff --git a/docs/reference/_timeouts.md b/docs/reference/_timeouts.md new file mode 100644 index 000000000..b361207a9 --- /dev/null +++ b/docs/reference/_timeouts.md @@ -0,0 +1,36 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/_timeouts.html +--- + +# Timeouts [_timeouts] + +Configuring requests timeouts can be done by providing an instance of `RequestConfigCallback` while building the `RestClient` through its builder. The interface has one method that receives an instance of [`org.apache.http.client.config.RequestConfig.Builder`](https://hc.apache.org/httpcomponents-client-4.5.x/current/httpclient/apidocs/org/apache/http/client/config/RequestConfig.Builder.html) as an argument and has the same return type. The request config builder can be modified and then returned. In the following example we increase the connect timeout (defaults to 1 second) and the socket timeout (defaults to 30 seconds). + +```java +RestClientBuilder builder = RestClient.builder( + new HttpHost("localhost", 9200)) + .setRequestConfigCallback( + new RestClientBuilder.RequestConfigCallback() { + @Override + public RequestConfig.Builder customizeRequestConfig( + RequestConfig.Builder requestConfigBuilder) { + return requestConfigBuilder + .setConnectTimeout(5000) + .setSocketTimeout(60000); + } + }); +``` + +Timeouts also can be set per request with RequestOptions, which overrides RestClient customizeRequestConfig. + +```java +RequestConfig requestConfig = RequestConfig.custom() + .setConnectTimeout(5000) + .setSocketTimeout(60000) + .build(); +RequestOptions options = RequestOptions.DEFAULT.toBuilder() + .setRequestConfig(requestConfig) + .build(); +``` + diff --git a/docs/reference/_usage.md b/docs/reference/_usage.md new file mode 100644 index 000000000..d38511e87 --- /dev/null +++ b/docs/reference/_usage.md @@ -0,0 +1,100 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/_usage.html +--- + +# Usage [_usage] + +Once a `RestClient` instance has been created as shown in [Initialization](/reference/java-rest-low-usage-initialization.md), a `Sniffer` can be associated to it. The `Sniffer` will make use of the provided `RestClient` to periodically (every 5 minutes by default) fetch the list of current nodes from the cluster and update them by calling `RestClient#setNodes`. + +```java +RestClient restClient = RestClient.builder( + new HttpHost("localhost", 9200, "http")) + .build(); +Sniffer sniffer = Sniffer.builder(restClient).build(); +``` + +It is important to close the `Sniffer` so that its background thread gets properly shutdown and all of its resources are released. The `Sniffer` object should have the same lifecycle as the `RestClient` and get closed right before the client: + +```java +sniffer.close(); +restClient.close(); +``` + +The `Sniffer` updates the nodes by default every 5 minutes. This interval can be customized by providing it (in milliseconds) as follows: + +```java +RestClient restClient = RestClient.builder( + new HttpHost("localhost", 9200, "http")) + .build(); +Sniffer sniffer = Sniffer.builder(restClient) + .setSniffIntervalMillis(60000).build(); +``` + +It is also possible to enable sniffing on failure, meaning that after each failure the nodes list gets updated straightaway rather than at the following ordinary sniffing round. In this case a `SniffOnFailureListener` needs to be created at first and provided at `RestClient` creation. Also once the `Sniffer` is later created, it needs to be associated with that same `SniffOnFailureListener` instance, which will be notified at each failure and use the `Sniffer` to perform the additional sniffing round as described. + +```java +SniffOnFailureListener sniffOnFailureListener = + new SniffOnFailureListener(); +RestClient restClient = RestClient.builder( + new HttpHost("localhost", 9200)) + .setFailureListener(sniffOnFailureListener) <1> + .build(); +Sniffer sniffer = Sniffer.builder(restClient) + .setSniffAfterFailureDelayMillis(30000) <2> + .build(); +sniffOnFailureListener.setSniffer(sniffer); <3> +``` + +1. Set the failure listener to the `RestClient` instance +2. When sniffing on failure, not only do the nodes get updated after each failure, but an additional sniffing round is also scheduled sooner than usual, by default one minute after the failure, assuming that things will go back to normal and we want to detect that as soon as possible. Said interval can be customized at `Sniffer` creation time through the `setSniffAfterFailureDelayMillis` method. Note that this last configuration parameter has no effect in case sniffing on failure is not enabled like explained above. +3. Set the `Sniffer` instance to the failure listener + + +The Elasticsearch Nodes Info api doesn’t return the protocol to use when connecting to the nodes but only their `host:port` key-pair, hence `http` is used by default. In case `https` should be used instead, the `ElasticsearchNodesSniffer` instance has to be manually created and provided as follows: + +```java +RestClient restClient = RestClient.builder( + new HttpHost("localhost", 9200, "http")) + .build(); +NodesSniffer nodesSniffer = new ElasticsearchNodesSniffer( + restClient, + ElasticsearchNodesSniffer.DEFAULT_SNIFF_REQUEST_TIMEOUT, + ElasticsearchNodesSniffer.Scheme.HTTPS); +Sniffer sniffer = Sniffer.builder(restClient) + .setNodesSniffer(nodesSniffer).build(); +``` + +In the same way it is also possible to customize the `sniffRequestTimeout`, which defaults to one second. That is the `timeout` parameter provided as a query string parameter when calling the Nodes Info api, so that when the timeout expires on the server side, a valid response is still returned although it may contain only a subset of the nodes that are part of the cluster, the ones that have responded until then. + +```java +RestClient restClient = RestClient.builder( + new HttpHost("localhost", 9200, "http")) + .build(); +NodesSniffer nodesSniffer = new ElasticsearchNodesSniffer( + restClient, + TimeUnit.SECONDS.toMillis(5), + ElasticsearchNodesSniffer.Scheme.HTTP); +Sniffer sniffer = Sniffer.builder(restClient) + .setNodesSniffer(nodesSniffer).build(); +``` + +Also, a custom `NodesSniffer` implementation can be provided for advanced use cases that may require fetching the nodes from external sources rather than from Elasticsearch: + +```java +RestClient restClient = RestClient.builder( + new HttpHost("localhost", 9200, "http")) + .build(); +NodesSniffer nodesSniffer = new NodesSniffer() { + @Override + public List sniff() throws IOException { + return null; <1> + } + }; +Sniffer sniffer = Sniffer.builder(restClient) + .setNodesSniffer(nodesSniffer).build(); +``` + +1. Fetch the hosts from the external source + + diff --git a/docs/reference/aggregations.md b/docs/reference/aggregations.md new file mode 100644 index 000000000..a711e35b4 --- /dev/null +++ b/docs/reference/aggregations.md @@ -0,0 +1,73 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/aggregations.html +--- + +# Aggregations [aggregations] + +An aggregation summarizes your data as metrics, statistics, or other analytics. + +::::{note} +See the [{{es}} documentation](elasticsearch://reference/aggregations/index.md) for a full explanation of aggregations. +:::: + + + +## A simple aggregation [_a_simple_aggregation] + +In the example below we run an aggregation that creates a price histogram from a product index, for the products whose name match a user-provided text. To achieve this, we use a search request that has a query (explained in [Searching for documents](/reference/searching.md)) and an aggregation definition. + +This example is an analytics-type aggregation where we do not want to use the matching documents. A general pattern for search requests used for analytics is to set the result `size` to zero and the target class for search results to `Void`. + +If that same aggregation was used for to display products and the price histogram as drill-down facets, we would have set `size` to a non-zero value and used `Product` as the target class to process the results. + +```java +String searchText = "bike"; + +Query query = MatchQuery.of(m -> m + .field("name") + .query(searchText) +)._toQuery(); + +SearchResponse response = esClient.search(b -> b + .index("products") + .size(0) <1> + .query(query) <2> + .aggregations("price-histogram", a -> a <3> + .histogram(h -> h <4> + .field("price") + .interval(50.0) + ) + ), + Void.class <5> +); +``` + +1. Set the number of matching documents to zero as we only use the price histogram. +2. Set the query that fill filter the products on which to run the aggregation +3. Create an aggregation named "price-histogram". You can add as many named aggregations as needed. +4. Select the `histogram` aggregation variant. +5. We do not care about matches (`size` is set to zero), using `Void` will ignore any document in the response. + + +The response contains an aggregation result for each aggregation in the request. + +```java +List buckets = response.aggregations() + .get("price-histogram") <1> + .histogram() <2> + .buckets().array(); <3> + +for (HistogramBucket bucket: buckets) { + logger.info("There are " + bucket.docCount() + + " bikes under " + bucket.key()); +} +``` + +1. Get the results for the "price-histogram" aggregation. +2. Cast it down to the `histogram` variant results. This has to be consistent with the aggregation definition. +3. Buckets can be expressed as arrays or maps. This casts down to the array variant (the default). + + +The source code for the examples above can be found in the [Java API Client tests](https://github.com/elastic/elasticsearch-java/tree/master/java-client/src/test/java/co/elastic/clients/documentation). + diff --git a/docs/reference/api-conventions.md b/docs/reference/api-conventions.md new file mode 100644 index 000000000..629a150cc --- /dev/null +++ b/docs/reference/api-conventions.md @@ -0,0 +1,28 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/api-conventions.html +--- + +# API conventions [api-conventions] + +The Java API Client uses a very consistent code structure, using modern code patterns that make complex requests easier to write and complex responses easier to process. The sections below explain these in details. + +* [Package structure and namespace clients](/reference/package-structure.md) +* [Method naming conventions](/reference/method-naming.md) +* [Blocking and asynchronous clients](/reference/blocking-async.md) +* [Building API objects](/reference/building-objects.md) +* [Lists and maps](/reference/lists-maps.md) +* [Variant types](/reference/variant-types.md) +* [Object life cycles and thread safety](/reference/object-lifecycles.md) +* [Creating API objects from JSON data](/reference/loading-json.md) +* [Exceptions](/reference/exception-conventions.md) + + + + + + + + + + diff --git a/docs/reference/blocking-async.md b/docs/reference/blocking-async.md new file mode 100644 index 000000000..d7456d3b3 --- /dev/null +++ b/docs/reference/blocking-async.md @@ -0,0 +1,40 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/blocking-and-async.html +--- + +# Blocking and asynchronous clients [blocking-and-async] + +API clients come in two flavors: blocking and asynchronous. All methods on asynchronous clients return a standard `CompletableFuture`. + +Both flavors can be used at the same time depending on your needs, sharing the same transport object: + +```java +ElasticsearchTransport transport = ... + +// Synchronous blocking client +ElasticsearchClient client = new ElasticsearchClient(transport); + +if (client.exists(b -> b.index("products").id("foo")).value()) { + logger.info("product exists"); +} + +// Asynchronous non-blocking client +ElasticsearchAsyncClient asyncClient = + new ElasticsearchAsyncClient(transport); + +asyncClient + .exists(b -> b.index("products").id("foo")) + .whenComplete((response, exception) -> { + if (exception != null) { + logger.error("Failed to index", exception); + } else { + logger.info("Product exists"); + } + }); +``` + +Although we won’t go in deeper details on asynchronous programming in Java, remember to handle failures of asynchronous tasks. It’s easy to overlook them and have errors go unnoticed. + +The source code for the examples above can be found in the [Java API Client tests](https://github.com/elastic/elasticsearch-java/tree/master/java-client/src/test/java/co/elastic/clients/documentation). + diff --git a/docs/reference/breaking-changes-policy.md b/docs/reference/breaking-changes-policy.md new file mode 100644 index 000000000..91afce486 --- /dev/null +++ b/docs/reference/breaking-changes-policy.md @@ -0,0 +1,35 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/breaking-changes-policy.html +--- + +# Breaking changes policy [breaking-changes-policy] + +The Java API Client source code is generated from a [formal specification of the Elasticsearch API](https://github.com/elastic/elasticsearch-specification). This API specification is large, and although it is tested against hundreds of Elasticsearch test files, it may have discrepancies with the actual API that result in issues in the Java API Client. + +Fixing these discrepancies in the API specification results in code changes in the Java API Client, and some of these changes can require code updates in your applications. + +This section explains how these breaking changes are considered for inclusion in Java API Client releases. + + +## Breaking changes in patch releases [_breaking_changes_in_patch_releases] + +Some issues in the API specification are properties that have an incorrect type, such as a `long` that should be a `string`, or a required property that is actually optional. These issues can cause the Java API Client to not work properly or even throw exceptions. + +When a specification issue is discovered and resolved, it may require code updates in applications using the Java API Client. Such breaking changes are considered acceptable, *even in patch releases* (e.g. 7.17.0 → 7.17.1), as they introduce stability to APIs that may otherwise be unusable. + + +## Breaking changes in minor releases [_breaking_changes_in_minor_releases] + +Along with these bug fixes, the API specification is constantly refined, more precise type definitions are introduced to improve developer comfort and remove ambiguities. The specification of often-used APIs is fairly mature, so these changes happen generally on less often used APIs. These changes can also cause breaking changes requiring code updates which are considered *acceptable in minor releases* (e.g. 8.0 → 8.1). + + +## Breaking changes in major releases [_breaking_changes_in_major_releases] + +Major releases (e.g. 7.x → 8.x) can include larger refactorings of the API specification and the framework underlying the Java API Client. These refactorings are considered carefully and done only when they unlock new important features or new developments. + + +## Elasticsearch API stability guarantees [_elasticsearch_api_stability_guarantees] + +All Elasticsearch APIs have stability indicators, which imply potential changes. If an API is `stable` only additional non-breaking changes are added. In case of `experimental` APIs, breaking changes can be introduced any time, which means that these changes, will also be reflected in the Java API Client. + diff --git a/docs/reference/building-objects.md b/docs/reference/building-objects.md new file mode 100644 index 000000000..8222060f9 --- /dev/null +++ b/docs/reference/building-objects.md @@ -0,0 +1,103 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/building-objects.html +--- + +# Building API objects [building-objects] + + +## Builder objects [_builder_objects] + +All data types in the Java API Client are immutable. Object creation uses the [builder pattern](https://www.informit.com/articles/article.aspx?p=1216151&seqNum=2) that was popularized in **Effective Java** in 2008. + +```java +ElasticsearchClient client = ... +CreateIndexResponse createResponse = client.indices().create( + new CreateIndexRequest.Builder() + .index("my-index") + .aliases("foo", + new Alias.Builder().isWriteIndex(true).build() + ) + .build() +); +``` + +Note that a builder should not be reused after its `build()` method has been called. + + +## Builder lambda expressions [_builder_lambda_expressions] + +Although this works nicely, having to instantiate builder classes and call the `build()` method is a bit verbose. So every property setter in the Java API Client also accepts a lambda expression that takes a newly created builder as a parameter and returns a populated builder. The snippet above can also be written as: + +```java +ElasticsearchClient client = ... +CreateIndexResponse createResponse = client.indices() + .create(createIndexBuilder -> createIndexBuilder + .index("my-index") + .aliases("foo", aliasBuilder -> aliasBuilder + .isWriteIndex(true) + ) + ); +``` + +This approach allows for much more concise code, and also avoids importing classes (and even remembering their names) since types are inferred from the method parameter signature. + +Note in the above example that builder variables are only used to start a chain of property setters. The names of these variables are therefore unimportant and can be shortened to improve readability: + +```java +ElasticsearchClient client = ... +CreateIndexResponse createResponse = client.indices() + .create(c -> c + .index("my-index") + .aliases("foo", a -> a + .isWriteIndex(true) + ) + ); +``` + +Builder lambdas become particularly useful with complex nested queries like the one below, taken from the [intervals query API documentation](elasticsearch://reference/query-languages/query-dsl/query-dsl-intervals-query.md). + +This example also highlights a useful naming convention for builder parameters in deeply nested structures. For lambda expressions with a single argument, Kotlin provides the implicit `it` parameter and Scala allows use of `_`. This can be approximated in Java by using an underscore or a single letter prefix followed by a number representing the depth level (i.e. `_0`, `_1`, or `b0`, `b1` and so on). Not only does this remove the need to create throw-away variable names, but it also improves code readability. Correct indentation also allows the structure of the query to stand out. + +```java +ElasticsearchClient client = ... +SearchResponse results = client + .search(b0 -> b0 + .query(b1 -> b1 + .intervals(b2 -> b2 + .field("my_text") + .allOf(b3 -> b3 + .ordered(true) + .intervals(b4 -> b4 + .match(b5 -> b5 + .query("my favorite food") + .maxGaps(0) + .ordered(true) + ) + ) + .intervals(b4 -> b4 + .anyOf(b5 -> b5 + .intervals(b6 -> b6 + .match(b7 -> b7 + .query("hot water") + ) + ) + .intervals(b6 -> b6 + .match(b7 -> b7 + .query("cold porridge") + ) + ) + ) + ) + ) + ) + ), + SomeApplicationData.class <1> +); +``` + +1. Search results will be mapped to `SomeApplicationData` instances to be readily available to the application. + + +The source code for the examples above can be found in the [Java API Client tests](https://github.com/elastic/elasticsearch-java/tree/master/java-client/src/test/java/co/elastic/clients/documentation). + diff --git a/docs/reference/connecting.md b/docs/reference/connecting.md new file mode 100644 index 000000000..0974a6bd7 --- /dev/null +++ b/docs/reference/connecting.md @@ -0,0 +1,186 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/connecting.html +--- + +# Connecting [connecting] + +The Java API Client is structured around three main components: + +* **API client classes**. These provide strongly typed data structures and methods for {{es}} APIs. Since the {{es}} API is large, it is structured in feature groups (also called “namespaces”), each having its own client class. {{es}} core features are implemented in the `ElasticsearchClient` class. +* **A JSON object mapper**. This maps your application classes to JSON and seamlessly integrates them with the API client. +* **A transport layer implementation**. This is where all HTTP request handling takes place. + +This code snippet creates and wires together these three components: + +```java +// URL and API key +String serverUrl = "https://localhost:9200"; +String apiKey = "VnVhQ2ZHY0JDZGJrU..."; + +// Create the low-level client +RestClient restClient = RestClient + .builder(HttpHost.create(serverUrl)) + .setDefaultHeaders(new Header[]{ + new BasicHeader("Authorization", "ApiKey " + apiKey) + }) + .build(); + +// Create the transport with a Jackson mapper +ElasticsearchTransport transport = new RestClientTransport( + restClient, new JacksonJsonpMapper()); + +// And create the API client +ElasticsearchClient esClient = new ElasticsearchClient(transport); + +// Use the client... + +// Close the client, also closing the underlying transport object and network connections. +esClient.close(); +``` + +Authentication is managed by the [Java Low Level REST Client](/reference/java-low-level-rest-client.md). For further details on configuring authentication, refer to [its documentation](/reference/_basic_authentication.md). + + +## Your first request [_your_first_request] + +The code snippet below searches all items from a “product” index whose name matches “bicycle” and return them as instances of a `Product` application class. + +It illustrates the use of fluent functional builders to write search queries as concise DSL-like code. This pattern is explained in more detail in [*API conventions*](/reference/api-conventions.md). + +```java +SearchResponse search = esClient.search(s -> s + .index("products") + .query(q -> q + .term(t -> t + .field("name") + .value(v -> v.stringValue("bicycle")) + )), + Product.class); + +for (Hit hit: search.hits().hits()) { + processProduct(hit.source()); +} +``` + + +## Using a secure connection [using-a-secure-connection] + +The [Java Low Level REST Client](/reference/java-low-level-rest-client.md) documentation explains how to set up encrypted communications in detail. + +In self-managed installations, Elasticsearch will start with security features like authentication and TLS enabled. To connect to the Elasticsearch cluster you’ll need to configure the Java API Client to use HTTPS with the generated CA certificate in order to make requests successfully. + +When you start Elasticsearch for the first time you’ll see a distinct block like the one below in the output from Elasticsearch (you may have to scroll up if it’s been a while): + +```xml +-> Elasticsearch security features have been automatically configured! +-> Authentication is enabled and cluster connections are encrypted. + +-> Password for the elastic user (reset with `bin/elasticsearch-reset-password -u elastic`): + lhQpLELkjkrawaBoaz0Q + +-> HTTP CA certificate SHA-256 fingerprint: + a52dd93511e8c6045e21f16654b77c9ee0f34aea26d9f40320b531c474676228 +... +``` + +Note down the elastic user password and HTTP CA fingerprint for the next sections. In the examples below they will be stored in the variables `password` and `fingerprint` respectively. + +Depending on the context, you have two options for verifying the HTTPS connection: either verifying with the CA certificate itself or using the CA certificate fingerprint. For both cases, the Java API Client’s `TransportUtils` class provides convenience methods to easily create an `SSLContext`. + + +### Verifying HTTPS with a certificate fingerprint [_verifying_https_with_a_certificate_fingerprint] + +This method of verifying the HTTPS connection uses the certificate fingerprint value noted down earlier. + +```java +String fingerprint = ""; + +SSLContext sslContext = TransportUtils + .sslContextFromCaFingerprint(fingerprint); <1> + +BasicCredentialsProvider credsProv = new BasicCredentialsProvider(); <2> +credsProv.setCredentials( + AuthScope.ANY, new UsernamePasswordCredentials(login, password) +); + +RestClient restClient = RestClient + .builder(new HttpHost(host, port, "https")) <3> + .setHttpClientConfigCallback(hc -> hc + .setSSLContext(sslContext) <4> + .setDefaultCredentialsProvider(credsProv) + ) + .build(); + +// Create the transport and the API client +ElasticsearchTransport transport = new RestClientTransport(restClient, new JacksonJsonpMapper()); +ElasticsearchClient esClient = new ElasticsearchClient(transport); + +// Use the client... + +// Close the client, also closing the underlying transport object and network connections. +esClient.close(); +``` + +1. Create an `SSLContext` with the certificate fingerprint. +2. Set up authentication. +3. Do not forget to set the protocol to `https`! +4. Configure the http client with the SSL and authentication configurations. + + +Note that the certificate fingerprint can also be calculated using `openssl x509` with the certificate file: + +```bash +openssl x509 -fingerprint -sha256 -noout -in /path/to/http_ca.crt +``` + +If you don’t have access to the generated CA file from Elasticsearch you can use the following script to output the root CA fingerprint of the Elasticsearch instance with `openssl s_client`: + +```bash +openssl s_client -connect localhost:9200 -servername localhost -showcerts /dev/null \ + | openssl x509 -fingerprint -sha256 -noout -in /dev/stdin +``` + + +### Verifying HTTPS with a CA certificate [_verifying_https_with_a_ca_certificate] + +The generated root CA certificate can be found in the `certs` directory in your Elasticsearch config location. If you’re running Elasticsearch in Docker there is [additional documentation](docs-content://deploy-manage/deploy/self-managed/install-elasticsearch-with-docker.md) for retrieving the CA certificate. + +Once you have made the `http_ca.crt` file available to your application, you can use it to set up the client: + +```java +File certFile = new File("/path/to/http_ca.crt"); + +SSLContext sslContext = TransportUtils + .sslContextFromHttpCaCrt(certFile); <1> + +BasicCredentialsProvider credsProv = new BasicCredentialsProvider(); <2> +credsProv.setCredentials( + AuthScope.ANY, new UsernamePasswordCredentials(login, password) +); + +RestClient restClient = RestClient + .builder(new HttpHost(host, port, "https")) <3> + .setHttpClientConfigCallback(hc -> hc + .setSSLContext(sslContext) <4> + .setDefaultCredentialsProvider(credsProv) + ) + .build(); + +// Create the transport and the API client +ElasticsearchTransport transport = new RestClientTransport(restClient, new JacksonJsonpMapper()); +ElasticsearchClient esClient = new ElasticsearchClient(transport); + +// Use the client... + +// Close the client, also closing the underlying transport object and network connections. +esClient.close(); +``` + +1. Create an `SSLContext` with the `http_ca.crt` file. +2. Set up authentication. +3. Do not forget to set the protocol to `https`! +4. Configure the http client with the SSL and authentication configurations. + + +The source code for the examples above can be found in the [Java API Client tests](https://github.com/elastic/elasticsearch-java/tree/master/java-client/src/test/java/co/elastic/clients/documentation). diff --git a/docs/reference/esql.md b/docs/reference/esql.md new file mode 100644 index 000000000..274aaf3af --- /dev/null +++ b/docs/reference/esql.md @@ -0,0 +1,94 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/esql.html +--- + +# ES|QL in the Java client [esql] + +This page helps you understand and use [ES|QL](docs-content://explore-analyze/query-filter/languages/esql.md) in the Java client. + +There are two ways to use ES|QL in the Java API Client: + +* Use the Elasticsearch [ES|QL API](https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-esql) directly: This is the most flexible approach, but it’s also the most complex because you must handle results in their raw form. You can choose the precise format of results, such as JSON, CSV, or text. +* Use ES|QL mapping helpers: These mappers take care of parsing the raw response into something readily usable by the application. Several mappers are available for different use cases, such as object mapping, cursor traversal of results, and dataframes. You can also define your own mapper for specific use cases. + + +## How to use the ES|QL API [esql-how-to] + +The [ES|QL query API](https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-esql) allows you to specify how results should be returned. You can choose a [response format](docs-content://explore-analyze/query-filter/languages/esql-rest.md#esql-rest-format) such as CSV, text, or JSON, then fine-tune it with parameters like column separators and locale. + +Because the response varies widely depending on the format, the Java API Client has a BinaryData object you can use according to the format specified in the request. + +The following example gets ES|QL results as CSV and parses them: + +```java +String queryAuthor = + """ + from books + | where author == "Isaac Asimov" + | sort year desc + | limit 10 + """; + +BinaryResponse response = client.esql().query(q -> q + .format("csv") + .delimiter(",") + .query(queryAuthor)); + +String result = new BufferedReader(new InputStreamReader(response.content())) + .lines().collect(Collectors.joining("\n")); +``` + + +## Consume ES|QL results [esql-consume-results] + +The previous example showed that although the raw ES|QL API offers maximum flexibility, additional work is required in order to make use of the result data. + +To simplify things, try working with these three main representations of ES|QL results (each with its own mapping helper): + +* **Objects**, where each row in the results is mapped to an object from your application domain. This is similar to what ORMs (object relational mappers) commonly do. + + ```java + List queryRes = (List) client.esql().query(ObjectsEsqlAdapter.of(Book.class), queryAuthor); + ``` + +* **Cursors**, where you scan the results row by row and access the data using column names. This is similar to database access libraries. + + ```java + ResultSet resultSet = client.esql().query(ResultSetEsqlAdapter.INSTANCE, queryAuthor); + ``` + + + +## Define your own mapping [esql-custom-mapping] + +Although the mappers provided by the Java API Client cover many use cases, your application might require a custom mapping. You can write your own mapper and use it in a similar way as the built-in ones. + +Note that mappers are meant to provide a more usable representation of ES|QL results—not to process the result data. Data processing should be based on the output of a result mapper. + +Here’s an example mapper that returns a simple column-oriented representation of the data: + +```java +public class CustomStringAdapter extends EsqlAdapterBase { + + public static final CustomStringAdapter INSTANCE = new CustomStringAdapter(); + + @Override + public String format() { + return "json"; + } + + @Override + public boolean columnar() { + return true; + } + + @Override + public String deserialize(ApiClient client, QueryRequest request, + BinaryResponse response) + throws IOException { + return new BufferedReader(new InputStreamReader(response.content())) + .lines().collect(Collectors.joining("\n")); + } +} +``` diff --git a/docs/reference/exception-conventions.md b/docs/reference/exception-conventions.md new file mode 100644 index 000000000..711d25400 --- /dev/null +++ b/docs/reference/exception-conventions.md @@ -0,0 +1,12 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/exception-conventions.html +--- + +# Exceptions [exception-conventions] + +Client methods can throw two kinds of exceptions: + +* Requests that were received by the {{es}} server but that were rejected (validation error, server internal timeout exceeded, etc) will produce an `ElasticsearchException`. This exception contains details about the error, provided by {{es}}. +* Requests that failed to reach the server (network error, server unavailable, etc) will produce a `TransportException`. That exception’s cause is the exception thrown by the lower-level implementation. In the case of the `RestClientTransport` it will be a `ResponseException` that contains the low level HTTP response. + diff --git a/docs/reference/external-resources.md b/docs/reference/external-resources.md new file mode 100644 index 000000000..86f059f50 --- /dev/null +++ b/docs/reference/external-resources.md @@ -0,0 +1,11 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/external-resources.html +--- + +# External resources [external-resources] + +There is some material related to the Java API Client available outside this website that provides additional information or different perspectives on the library. + +You can find a community-maintained list of external resources in the [Java API Client GitHub repository](https://github.com/elastic/elasticsearch-java/tree/main/docs/external-resources.md). + diff --git a/docs/reference/getting-started.md b/docs/reference/getting-started.md new file mode 100644 index 000000000..e365d854d --- /dev/null +++ b/docs/reference/getting-started.md @@ -0,0 +1,211 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/getting-started-java.html +--- + +# Getting started [getting-started-java] + +This page guides you through the installation process of the Java client, shows you how to instantiate the client, and how to perform basic Elasticsearch operations with it. + + +### Requirements [_requirements] + +* Java 8 or later. +* A JSON object mapping library to allow seamless integration of your application classes with the Elasticsearch API. The examples below show usage with Jackson. + + +### Installation [_installation] + + +#### Installation in a Gradle project by using Jackson [_installation_in_a_gradle_project_by_using_jackson] + +```groovy +dependencies { + implementation 'co.elastic.clients:elasticsearch-java:9.0.0-beta1' +} +``` + + +#### Installation in a Maven project by using Jackson [_installation_in_a_maven_project_by_using_jackson] + +In the `pom.xml` of your project, add the following repository definition and dependencies: + +```xml + + + + + co.elastic.clients + elasticsearch-java + 9.0.0-beta1 + + + + +``` + +Refer to the [Installation](/reference/installation.md) page to learn more. + + +### Connecting [_connecting] + +You can connect to the Elastic Cloud using an API key and the Elasticsearch endpoint. + +```java +// URL and API key +String serverUrl = "https://localhost:9200"; +String apiKey = "VnVhQ2ZHY0JDZGJrU..."; + +// Create the low-level client +RestClient restClient = RestClient + .builder(HttpHost.create(serverUrl)) + .setDefaultHeaders(new Header[]{ + new BasicHeader("Authorization", "ApiKey " + apiKey) + }) + .build(); + +// Create the transport with a Jackson mapper +ElasticsearchTransport transport = new RestClientTransport( + restClient, new JacksonJsonpMapper()); + +// And create the API client +ElasticsearchClient esClient = new ElasticsearchClient(transport); + +// Use the client... + +// Close the client, also closing the underlying transport object and network connections. +esClient.close(); +``` + +Your Elasticsearch endpoint can be found on the **My deployment** page of your deployment: + +:::{image} images/es-endpoint.jpg +:alt: Finding Elasticsearch endpoint +::: + +You can generate an API key on the **Management** page under Security. + +:::{image} images/create-api-key.png +:alt: Create API key +::: + +For other connection options, refer to the [Connecting](/reference/connecting.md) section. + + +### Operations [_operations] + +Time to use Elasticsearch! This section walks you through the basic, and most important, operations of Elasticsearch. For more operations and more advanced examples, refer to the [*Using the Java API Client*](/reference/using-java-api-client.md) page. + + +#### Creating an index [_creating_an_index] + +This is how you create the `product` index: + +```java +esClient.indices().create(c -> c + .index("products") +); +``` + + +#### Indexing documents [_indexing_documents] + +This is a simple way of indexing a document, here a `Product` application object: + +```java +Product product = new Product("bk-1", "City bike", 123.0); + +IndexResponse response = esClient.index(i -> i + .index("products") + .id(product.getSku()) + .document(product) +); + +logger.info("Indexed with version " + response.version()); +``` + + +#### Getting documents [_getting_documents] + +You can get documents by using the following code: + +```java +GetResponse response = esClient.get(g -> g + .index("products") <1> + .id("bk-1"), + Product.class <2> +); + +if (response.found()) { + Product product = response.source(); + logger.info("Product name " + product.getName()); +} else { + logger.info ("Product not found"); +} +``` + +1. The get request, with the index name and identifier. +2. The target class, here `Product`. + + + +#### Searching documents [_searching_documents] + +This is how you can create a single match query with the Java client: + +```java +String searchText = "bike"; + +SearchResponse response = esClient.search(s -> s + .index("products") + .query(q -> q + .match(t -> t + .field("name") + .query(searchText) + ) + ), + Product.class +); +``` + + +#### Updating documents [_updating_documents] + +This is how you can update a document, for example to add a new field: + +```java +Product product = new Product("bk-1", "City bike", 123.0); + +esClient.update(u -> u + .index("products") + .id("bk-1") + .upsert(product), + Product.class +); +``` + + +#### Deleting documents [_deleting_documents] + +```java +esClient.delete(d -> d.index("products").id("bk-1")); +``` + + +#### Deleting an index [_deleting_an_index] + +```java +esClient.indices().delete(d -> d + .index("products") +); +``` + + +## Examples [_examples] + +The [examples](https://github.com/elastic/elasticsearch-java/tree/main/examples) folder in the Github repository contains full working examples showing how to set up and use the client. + + +## Further reading [_further_reading] + +* Learn more about the [*API conventions*](/reference/api-conventions.md) of the Java client. diff --git a/docs/images/create-api-key.png b/docs/reference/images/create-api-key.png similarity index 100% rename from docs/images/create-api-key.png rename to docs/reference/images/create-api-key.png diff --git a/docs/images/es-endpoint.jpg b/docs/reference/images/es-endpoint.jpg similarity index 100% rename from docs/images/es-endpoint.jpg rename to docs/reference/images/es-endpoint.jpg diff --git a/docs/images/otel-waterfall-instrumented-without-http.jpg b/docs/reference/images/otel-waterfall-instrumented-without-http.jpg similarity index 100% rename from docs/images/otel-waterfall-instrumented-without-http.jpg rename to docs/reference/images/otel-waterfall-instrumented-without-http.jpg diff --git a/docs/images/otel-waterfall-instrumented.jpg b/docs/reference/images/otel-waterfall-instrumented.jpg similarity index 100% rename from docs/images/otel-waterfall-instrumented.jpg rename to docs/reference/images/otel-waterfall-instrumented.jpg diff --git a/docs/images/otel-waterfall-retries.jpg b/docs/reference/images/otel-waterfall-retries.jpg similarity index 100% rename from docs/images/otel-waterfall-retries.jpg rename to docs/reference/images/otel-waterfall-retries.jpg diff --git a/docs/reference/index.md b/docs/reference/index.md new file mode 100644 index 000000000..8f9fdc876 --- /dev/null +++ b/docs/reference/index.md @@ -0,0 +1,30 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/index.html + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/introduction.html +--- + +# Java [introduction] + +This is the documentation for the official Java API Client for {{es}}. The client provides strongly typed requests and responses for all {{es}} APIs. + + +## Features [_features] + +* Strongly typed requests and responses for all {{es}} APIs. +* Blocking and asynchronous versions of all APIs. +* Use of fluent builders and functional patterns to allow writing concise yet readable code when creating complex nested structures. +* Seamless integration of application classes by using an object mapper such as Jackson or any JSON-B implementation. +* Delegates protocol handling to an http client such as the [Java Low Level REST Client](/reference/java-low-level-rest-client.md) that takes care of all transport-level concerns: HTTP connection pooling, retries, node discovery, and so on. + + +## Elasticsearch server compatibility policy [_elasticsearch_server_compatibility_policy] + +The {{es}} Java client is forward compatible; meaning that the client supports communicating with greater or equal minor versions of {{es}} without breaking. It does not mean that the client automatically supports new features of newer {{es}} versions; it is only possible after a release of a new client version. For example, a 8.12 client version won’t automatically support the new features of the 8.13 version of {{es}}, the 8.13 client version is required for that. {{es}} language clients are only backwards compatible with default distributions and without guarantees made. + +| Elasticsearch Version | Elasticsearch-Java Branch | Supported | +| --- | --- | --- | +| main | main | | +| 8.x | 8.x | 8.x | +| 7.x | 7.x | 7.17 | + diff --git a/docs/reference/indexing-bulk.md b/docs/reference/indexing-bulk.md new file mode 100644 index 000000000..0b3eb882d --- /dev/null +++ b/docs/reference/indexing-bulk.md @@ -0,0 +1,199 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/indexing-bulk.html +--- + +# Bulk: indexing multiple documents [indexing-bulk] + +Bulk requests allow sending multiple document-related operations to {{es}} in one request. When you have multiple documents to ingest, this is more efficient than sending each document with a separate request. + +A bulk request can contain several kinds of operations: + +* create a document, indexing it after ensuring it doesn’t already exist, +* index a document, creating it if needed and replacing it if it exists, +* update a document that already exists in place, either with a script or a partial document, +* delete a document. + +::::{note} +See the [{{es}} API documentation](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-bulk) for a full explanation of bulk requests. +:::: + + + +## Indexing application objects [_indexing_application_objects] + +A `BulkRequest` contains a collection of operations, each operation being a [type with several variants](/reference/variant-types.md). To create this request, it is convenient to use a builder object for the main request, and the fluent DSL for each operation. + +The example below shows how to index a list or application objects. + +```java +List products = fetchProducts(); + +BulkRequest.Builder br = new BulkRequest.Builder(); + +for (Product product : products) { + br.operations(op -> op <1> + .index(idx -> idx <2> + .index("products") <3> + .id(product.getSku()) + .document(product) + ) + ); +} + +BulkResponse result = esClient.bulk(br.build()); + +// Log errors, if any +if (result.errors()) { + logger.error("Bulk had errors"); + for (BulkResponseItem item: result.items()) { + if (item.error() != null) { + logger.error(item.error().reason()); + } + } +} +``` + +1. Adds an operation (remember that [list properties are additive](/reference/lists-maps.md)). `op` is is a builder for `BulkOperation` which is a [variant type](/reference/variant-types.md). This type has `index`, `create`, `update` and `delete` variants. +2. Selects the `index` operation variant, `idx` is a builder for `IndexOperation`. +3. Sets the properties for the index operation, similar to [single document indexing](/reference/indexing.md): index name, identifier and document. + + + +## Indexing raw JSON data [indexing-raw-json-data] + +The `document` property of a bulk index request can be any object that can be serialized to JSON using your Elasticsearch client’s JSON mapper. However, data that is ingested in bulk is often available as JSON text (e.g. files on disk), and parsing this JSON just to re-serialize it to send the bulk request would be a waste of resources. So documents in bulk operations can also be of type `BinaryData` that are sent verbatim (without parsing) to the {{es}} server. + +In the example below we will use the Java API Client’s `BinaryData` to read json files from a log directory and send them in a bulk request. + +```java +// List json log files in the log directory +File[] logFiles = logDir.listFiles( + file -> file.getName().matches("log-.*\\.json") +); + +BulkRequest.Builder br = new BulkRequest.Builder(); + +for (File file: logFiles) { + FileInputStream input = new FileInputStream(file); + BinaryData data = BinaryData.of(IOUtils.toByteArray(input), ContentType.APPLICATION_JSON); + + br.operations(op -> op + .index(idx -> idx + .index("logs") + .document(data) + ) + ); +} +``` + + +## Streaming ingestion with the Bulk Ingester [_streaming_ingestion_with_the_bulk_ingester] + +The `BulkIngester` simplifies the usage of the Bulk API by providing a utility class that allows index/update/delete operations to be transparently grouped in bulk requests. You only have to `add()` bulk operations to the ingester and it will take care of grouping and sending them in bulk according to its configuration. + +The ingester will send a bulk request when one of the following criteria is met: + +* the number of operations exceeds a maximum (defaults to 1000) +* the bulk request size in bytes exceeds a maximum (defaults to 5 MiB) +* a delay since the last request has expired (periodic flush, no default) + +Additionally, you can define a maximum number of concurrent request waiting to be executed by {{es}} (defaults to 1). When that maximum is reached and the maximum number of operations have been collected, adding a new operation to the indexer will block. This is avoids overloading the {{es}} server by putting backpressure on the client application. + +```java +BulkIngester ingester = BulkIngester.of(b -> b + .client(esClient) <1> + .maxOperations(100) <2> + .flushInterval(1, TimeUnit.SECONDS) <3> +); + +for (File file: logFiles) { + FileInputStream input = new FileInputStream(file); + BinaryData data = BinaryData.of(IOUtils.toByteArray(input), ContentType.APPLICATION_JSON); + + ingester.add(op -> op <4> + .index(idx -> idx + .index("logs") + .document(data) + ) + ); +} + +ingester.close(); <5> +``` + +1. Sets the {{es}} client used to send bulk requests. +2. Sets the maximum number of operations to collect before sending a bulk request. +3. Sets the flush interval. +4. Adds a bulk operation to the ingester. +5. Closes the ingester to flush the pending operations and release resources. + + +Additionally, the bulk ingester accepts a listener so that your application can be notified of bulk requests that are sent and their result. To allow correlating bulk operations to application context, the `add()` method optionally accepts a `context` parameter. The type of this context parameter is used as the generic parameter of the `BulkIngester` object. You may have noticed the `Void` type in `BulkIngester` above: this is because we did not register a listener, and therefore did not care about context values. + +The following example shows how you can use context values to implement a bulk ingestion listener: as previously it sends JSON log files in bulk, but tracks bulk request errors and failed operations. When an operation fails, depending on the error type you may want to re-add it to the ingester. + +```java +BulkListener listener = new BulkListener() { <1> + @Override + public void beforeBulk(long executionId, BulkRequest request, List contexts) { + } + + @Override + public void afterBulk(long executionId, BulkRequest request, List contexts, BulkResponse response) { + // The request was accepted, but may contain failed items. + // The "context" list gives the file name for each bulk item. + logger.debug("Bulk request " + executionId + " completed"); + for (int i = 0; i < contexts.size(); i++) { + BulkResponseItem item = response.items().get(i); + if (item.error() != null) { + // Inspect the failure cause + logger.error("Failed to index file " + contexts.get(i) + " - " + item.error().reason()); + } + } + } + + @Override + public void afterBulk(long executionId, BulkRequest request, List contexts, Throwable failure) { + // The request could not be sent + logger.debug("Bulk request " + executionId + " failed", failure); + } +}; + +BulkIngester ingester = BulkIngester.of(b -> b + .client(esClient) + .maxOperations(100) + .flushInterval(1, TimeUnit.SECONDS) + .listener(listener) <2> +); + +for (File file: logFiles) { + FileInputStream input = new FileInputStream(file); + BinaryData data = BinaryData.of(IOUtils.toByteArray(input), ContentType.APPLICATION_JSON); + + ingester.add(op -> op + .index(idx -> idx + .index("logs") + .document(data) + ), + file.getName() <3> + ); +} + +ingester.close(); +``` + +1. Creates a listener where context values are strings for the ingested file name. +2. Registers the listener on the bulk ingester. +3. Sets the file name as the context value for a bulk operation. + + +The bulk ingest also exposes statistic information that allows monitoring the ingestion process and tune its configuration: + +* number of operations added, +* number of calls to `add()` that were blocked because the maximum number of concurrent requests was reached (contention), +* number of bulk requests sent, +* number of bulk requests that were blocked because the maximum number of concurrent requests was reached. + +The source code for the examples above can be found in the [Java API Client tests](https://github.com/elastic/elasticsearch-java/tree/master/java-client/src/test/java/co/elastic/clients/documentation). + diff --git a/docs/reference/indexing.md b/docs/reference/indexing.md new file mode 100644 index 000000000..f95d91fac --- /dev/null +++ b/docs/reference/indexing.md @@ -0,0 +1,114 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/indexing.html +--- + +# Indexing single documents [indexing] + +The Java API Client offers several ways to index data: you can provide application objects that will be automatically mapped to JSON, or you can provide raw JSON data. Using application objects is more suited to applications with a well-defined domain model, whereas raw JSON is more suited to logging use cases with semi-structured data. + +In the examples below we use a `Product` domain object that has `sku`, `name` and `price` properties. + +::::{note} +See the [{{es}} API documentation](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-create) for a full explanation of index requests. +:::: + + + +## Using the fluent DSL [_using_the_fluent_dsl] + +The most direct way to build requests is using the fluent DSL. In the example below we index a product description in the `products` index, using the product’s SKU as the document identifier in the index. The `product` object will be mapped to JSON using the object mapper configured on the {{es}} client. + +```java +Product product = new Product("bk-1", "City bike", 123.0); + +IndexResponse response = esClient.index(i -> i + .index("products") + .id(product.getSku()) + .document(product) +); + +logger.info("Indexed with version " + response.version()); +``` + +You can also assign objects created with the DSL to variables. Java API Client classes have a static `of()` method for this, that creates an object with the DSL syntax. + +```java +Product product = new Product("bk-1", "City bike", 123.0); + +IndexRequest request = IndexRequest.of(i -> i + .index("products") + .id(product.getSku()) + .document(product) +); + +IndexResponse response = esClient.index(request); + +logger.info("Indexed with version " + response.version()); +``` + + +## Using classic builders [_using_classic_builders] + +If you’re more used to the classic builder pattern, it is also available. Builder objects are used under the hood by the fluent DSL syntax. + +```java +Product product = new Product("bk-1", "City bike", 123.0); + +IndexRequest.Builder indexReqBuilder = new IndexRequest.Builder<>(); +indexReqBuilder.index("product"); +indexReqBuilder.id(product.getSku()); +indexReqBuilder.document(product); + +IndexResponse response = esClient.index(indexReqBuilder.build()); + +logger.info("Indexed with version " + response.version()); +``` + + +## Using the asynchronous client [_using_the_asynchronous_client] + +The examples above used the synchronous {{es}} client. All {{es}} APIs are also available in the asynchronous client, using the same request and response types. See also [Blocking and asynchronous clients](/reference/blocking-async.md) for additional details. + +```java +ElasticsearchAsyncClient esAsyncClient = new ElasticsearchAsyncClient(transport); + +Product product = new Product("bk-1", "City bike", 123.0); + +esAsyncClient.index(i -> i + .index("products") + .id(product.getSku()) + .document(product) +).whenComplete((response, exception) -> { + if (exception != null) { + logger.error("Failed to index", exception); + } else { + logger.info("Indexed with version " + response.version()); + } +}); +``` + + +## Using raw JSON data [_using_raw_json_data] + +When the data you want to index comes from external sources, having to create domain objects may be cumbersome or outright impossible with semi-structured data. + +You can index data from an arbitrary source using `withJson()`. Using this method will read the source and use it for the index request’s `document` property. See [Creating API objects from JSON data](/reference/loading-json.md) for additional details. + +```java +Reader input = new StringReader( + "{'@timestamp': '2022-04-08T13:55:32Z', 'level': 'warn', 'message': 'Some log message'}" + .replace('\'', '"')); + +IndexRequest request = IndexRequest.of(i -> i + .index("logs") + .withJson(input) +); + +IndexResponse response = esClient.index(request); + +logger.info("Indexed with version " + response.version()); +``` + +The source code for the examples above can be found in the [Java API Client tests](https://github.com/elastic/elasticsearch-java/tree/master/java-client/src/test/java/co/elastic/clients/documentation). + diff --git a/docs/reference/installation.md b/docs/reference/installation.md new file mode 100644 index 000000000..dacc9767d --- /dev/null +++ b/docs/reference/installation.md @@ -0,0 +1,81 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/installation.html +--- + +# Installation [installation] + +Requirements: + +* Java 8 or later. +* A JSON object mapping library to allow seamless integration of your application classes with the Elasticsearch API. The Java client has support for [Jackson](https://github.com/FasterXML/jackson) or a [JSON-B](https://github.com/eclipse-ee4j/jsonb-api) library like [Eclipse Yasson](https://github.com/eclipse-ee4j/yasson). + +Releases are hosted on [Maven Central](https://search.maven.org/search?q=g:co.elastic.clients). If you are looking for a SNAPSHOT version, the Elastic Maven Snapshot repository is available at [https://snapshots.elastic.co/maven/](https://snapshots.elastic.co/maven/). + + +## Installation in a Gradle project by using Jackson [gradle] + +```groovy +dependencies { + implementation 'co.elastic.clients:elasticsearch-java:9.0.0-beta1' +} +``` + + +## Installation in a Maven project by using Jackson [maven] + +In the `pom.xml` of your project, add the following repository definition and dependencies: + +```xml + + + + + co.elastic.clients + elasticsearch-java + 9.0.0-beta1 + + + + +``` + + +## If you get ClassNotFoundException: jakarta.json.spi.JsonProvider [class-not-found-jsonprovider] + +It may happen that after setting up the dependencies, your application fails with `ClassNotFoundException: jakarta.json.spi.JsonProvider`. + +If this happens, you have to explicitly add the `jakarta.json:jakarta.json-api:2.0.1` dependency. + +```groovy +dependencies { + ... + implementation 'jakarta.json:jakarta.json-api:2.0.1' +} +``` + +```xml + + + ... + + jakarta.json + jakarta.json-api + 2.0.1 + + + + +``` + +**Why is this needed?** + +Some frameworks like Spring Boot or Helidon come with their Gradle and Maven plugins or their Maven BOM files to ease development and dependency management. These plugins and BOM define the versions to use for a number of well-known libraries. + +One of these libraries can be `jakarta.json:json-api` that defines the standard Java JSON API. In version `1.x` this library used the `javax.json` package, while in version `2.x` it uses the `jakarta.json` package after [the transition from JavaEE to JakartaEE](https://blogs.oracle.com/javamagazine/post/transition-from-java-ee-to-jakarta-ee). + +The Java API Client depends on version `2.0.1` of this library, in order to use the newer and future-proof `jakarta.json` package. But some build plugins and BOMs override the Java API Client’s dependency to use version `1.x` in the older `javax.json` namespace, resulting in `ClassNotFoundException: jakarta.json.spi.JsonProvider`. + +Adding the correct version as top-level project dependency solves the problem. + +If your application also requires `javax.json` you can add the `javax.json:javax.json-api:1.1.4` dependency, which is equivalent to `jakarta.json:jakarta.json-api:1.1.6`. diff --git a/docs/reference/java-low-level-rest-client.md b/docs/reference/java-low-level-rest-client.md new file mode 100644 index 000000000..05e7eeea2 --- /dev/null +++ b/docs/reference/java-low-level-rest-client.md @@ -0,0 +1,17 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/java-rest-low.html +--- + +# Java Low Level REST Client [java-rest-low] + +The low-level client’s features include: + +* minimal dependencies +* load balancing across all available nodes +* failover in case of node failures and upon specific response codes +* failed connection penalization (whether a failed node is retried depends on how many consecutive times it failed; the more failed attempts the longer the client will wait before trying that same node again) +* persistent connections +* trace logging of requests and responses +* optional automatic [discovery of cluster nodes](/reference/sniffer.md) + diff --git a/docs/reference/java-rest-low-config.md b/docs/reference/java-rest-low-config.md new file mode 100644 index 000000000..52574079d --- /dev/null +++ b/docs/reference/java-rest-low-config.md @@ -0,0 +1,16 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/java-rest-low-config.html +--- + +# Common configuration [java-rest-low-config] + +As explained in [Initialization](/reference/java-rest-low-usage-initialization.md), the `RestClientBuilder` supports providing both a `RequestConfigCallback` and an `HttpClientConfigCallback` which allow for any customization that the Apache Async Http Client exposes. Those callbacks make it possible to modify some specific behaviour of the client without overriding every other default configuration that the `RestClient` is initialized with. This section describes some common scenarios that require additional configuration for the low-level Java REST Client. + + + + + + + + diff --git a/docs/reference/java-rest-low-javadoc.md b/docs/reference/java-rest-low-javadoc.md new file mode 100644 index 000000000..e80307d97 --- /dev/null +++ b/docs/reference/java-rest-low-javadoc.md @@ -0,0 +1,9 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/java-rest-low-javadoc.html +--- + +# Javadoc [java-rest-low-javadoc] + +The javadoc for the low level REST client can be found at [https://snapshots.elastic.co/javadoc/org/elasticsearch/client/elasticsearch-rest-client/9.0.0-beta1-SNAPSHOT/index.html](https://snapshots.elastic.co/javadoc/org/elasticsearch/client/elasticsearch-rest-client/9.0.0-beta1-SNAPSHOT/index.md). + diff --git a/docs/reference/java-rest-low-usage-dependencies.md b/docs/reference/java-rest-low-usage-dependencies.md new file mode 100644 index 000000000..3bc944a11 --- /dev/null +++ b/docs/reference/java-rest-low-usage-dependencies.md @@ -0,0 +1,16 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/java-rest-low-usage-dependencies.html +--- + +# Dependencies [java-rest-low-usage-dependencies] + +The low-level Java REST client internally uses the [Apache Http Async Client](https://hc.apache.org/httpcomponents-asyncclient-4.1.x/) to send http requests. It depends on the following artifacts, namely the async http client and its own transitive dependencies: + +* org.apache.httpcomponents:httpasyncclient +* org.apache.httpcomponents:httpcore-nio +* org.apache.httpcomponents:httpclient +* org.apache.httpcomponents:httpcore +* commons-codec:commons-codec +* commons-logging:commons-logging + diff --git a/docs/reference/java-rest-low-usage-initialization.md b/docs/reference/java-rest-low-usage-initialization.md new file mode 100644 index 000000000..b4f946f66 --- /dev/null +++ b/docs/reference/java-rest-low-usage-initialization.md @@ -0,0 +1,88 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/java-rest-low-usage-initialization.html +--- + +# Initialization [java-rest-low-usage-initialization] + +A `RestClient` instance can be built through the corresponding `RestClientBuilder` class, created via `RestClient#builder(HttpHost...)` static method. The only required argument is one or more hosts that the client will communicate with, provided as instances of [HttpHost](https://hc.apache.org/httpcomponents-core-4.4.x/current/httpcore/apidocs/org/apache/http/HttpHost.html) as follows: + +```java +RestClient restClient = RestClient.builder( + new HttpHost("localhost", 9200, "http"), + new HttpHost("localhost", 9201, "http")).build(); +``` + +The `RestClient` class is thread-safe and ideally has the same lifecycle as the application that uses it. It is important that it gets closed when no longer needed so that all the resources used by it get properly released, as well as the underlying http client instance and its threads: + +```java +restClient.close(); +``` + +`RestClientBuilder` also allows to optionally set the following configuration parameters while building the `RestClient` instance: + +```java +RestClientBuilder builder = RestClient.builder( + new HttpHost("localhost", 9200, "http")); +Header[] defaultHeaders = new Header[]{new BasicHeader("header", "value")}; +builder.setDefaultHeaders(defaultHeaders); <1> +``` + +1. Set the default headers that need to be sent with each request, to prevent having to specify them with each single request + + +```java +RestClientBuilder builder = RestClient.builder( + new HttpHost("localhost", 9200, "http")); +builder.setFailureListener(new RestClient.FailureListener() { + @Override + public void onFailure(Node node) { + <1> + } +}); +``` + +1. Set a listener that gets notified every time a node fails, in case actions need to be taken. Used internally when sniffing on failure is enabled. + + +```java +RestClientBuilder builder = RestClient.builder( + new HttpHost("localhost", 9200, "http")); +builder.setNodeSelector(NodeSelector.SKIP_DEDICATED_MASTERS); <1> +``` + +1. Set the node selector to be used to filter the nodes the client will send requests to among the ones that are set to the client itself. This is useful for instance to prevent sending requests to dedicated master nodes when sniffing is enabled. By default the client sends requests to every configured node. + + +```java +RestClientBuilder builder = RestClient.builder( + new HttpHost("localhost", 9200, "http")); +builder.setRequestConfigCallback( + new RestClientBuilder.RequestConfigCallback() { + @Override + public RequestConfig.Builder customizeRequestConfig( + RequestConfig.Builder requestConfigBuilder) { + return requestConfigBuilder.setSocketTimeout(10000); <1> + } + }); +``` + +1. Set a callback that allows to modify the default request configuration (e.g. request timeouts, authentication, or anything that the [`org.apache.http.client.config.RequestConfig.Builder`](https://hc.apache.org/httpcomponents-client-4.5.x/current/httpclient/apidocs/org/apache/http/client/config/RequestConfig.Builder.html) allows to set) + + +```java +RestClientBuilder builder = RestClient.builder( + new HttpHost("localhost", 9200, "http")); +builder.setHttpClientConfigCallback(new HttpClientConfigCallback() { + @Override + public HttpAsyncClientBuilder customizeHttpClient( + HttpAsyncClientBuilder httpClientBuilder) { + return httpClientBuilder.setProxy( + new HttpHost("proxy", 9000, "http")); <1> + } + }); +``` + +1. Set a callback that allows to modify the http client configuration (e.g. encrypted communication over ssl, or anything that the [`org.apache.http.impl.nio.client.HttpAsyncClientBuilder`](https://hc.apache.org/httpcomponents-asyncclient-4.1.x/current/httpasyncclient/apidocs/org/apache/http/impl/nio/client/HttpAsyncClientBuilder.html) allows to set) + + diff --git a/docs/reference/java-rest-low-usage-logging.md b/docs/reference/java-rest-low-usage-logging.md new file mode 100644 index 000000000..5f65fa0e8 --- /dev/null +++ b/docs/reference/java-rest-low-usage-logging.md @@ -0,0 +1,59 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/java-rest-low-usage-logging.html +--- + +# Logging [java-rest-low-usage-logging] + +The Java REST client uses the same logging library that the Apache Async Http Client uses: [Apache Commons Logging](https://commons.apache.org/proper/commons-logging/), which comes with support for a number of popular logging implementations. The java packages to enable logging for are `org.elasticsearch.client` for the client itself and `org.elasticsearch.client.sniffer` for the sniffer. + +The request tracer logging can also be enabled to log every request and corresponding response in curl format. That comes handy when debugging, for instance in case a request needs to be manually executed to check whether it still yields the same response as it did. Enable trace logging for the `tracer` package to have such log lines printed out. Do note that this type of logging is expensive and should not be enabled at all times in production environments, but rather temporarily used only when needed. + +## Logback [_logback] + +### Trace Logs [_trace_logs] + +In order to enable trace logs for logback, we have to use [jcl-over-slf4j bridging module](https://www.slf4j.org/legacy.html#jclOverSLF4J). + +1. Add the following to your Gradle setting: + + ```groovy + dependencies { + implementation('org.slf4j:slf4j-api:1.8.0-beta2') + implementation('ch.qos.logback:logback-classic:1.3.0-alpha4') + implementation('org.slf4j:jcl-over-slf4j:1.8.0-beta2') + } + ``` + +2. Exclude `commons-logging.jar`: + + ```groovy + dependencies { + configurations.all { + exclude group: "commons-logging", module: "commons-logging" + } + } + ``` + +3. Add a tracer logger in Logback configuration: + + ```xml + + + + ``` + + + +### RestClient Debug Logs [_restclient_debug_logs] + +To enable debug logs for `RestClient` class, add the following to your Logback configuration: + +```xml + + + +``` + + + diff --git a/docs/reference/java-rest-low-usage-maven.md b/docs/reference/java-rest-low-usage-maven.md new file mode 100644 index 000000000..e6c97b5df --- /dev/null +++ b/docs/reference/java-rest-low-usage-maven.md @@ -0,0 +1,37 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/java-rest-low-usage-maven.html +--- + +# Maven Repository [java-rest-low-usage-maven] + +The low-level Java REST client is hosted on [Maven Central](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.elasticsearch.client%22). The minimum Java version required is `1.8`. + +The low-level REST client is subject to the same release cycle as Elasticsearch. Replace the version with the desired client version, first released with `5.0.0-alpha4`. There is no relation between the client version and the Elasticsearch version that the client can communicate with. The low-level REST client is compatible with all Elasticsearch versions. + +If you are looking for a SNAPSHOT version, the Elastic Maven Snapshot repository is available at [https://snapshots.elastic.co/maven/](https://snapshots.elastic.co/maven/). + +## Maven configuration [java-rest-low-usage-maven-maven] + +Here is how you can configure the dependency using maven as a dependency manager. Add the following to your `pom.xml` file: + +```xml + + org.elasticsearch.client + elasticsearch-rest-client + 9.0.0-beta1 + +``` + + +## Gradle configuration [java-rest-low-usage-maven-gradle] + +Here is how you can configure the dependency using gradle as a dependency manager. Add the following to your `build.gradle` file: + +```groovy +dependencies { + compile 'org.elasticsearch.client:elasticsearch-rest-client:9.0.0-beta1' +} +``` + + diff --git a/docs/reference/java-rest-low-usage-requests.md b/docs/reference/java-rest-low-usage-requests.md new file mode 100644 index 000000000..0bf474b6f --- /dev/null +++ b/docs/reference/java-rest-low-usage-requests.md @@ -0,0 +1,179 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/java-rest-low-usage-requests.html +--- + +# Performing requests [java-rest-low-usage-requests] + +Once the `RestClient` has been created, requests can be sent by calling either `performRequest` or `performRequestAsync`. `performRequest` is synchronous and will block the calling thread and return the `Response` when the request is successful or throw an exception if it fails. `performRequestAsync` is asynchronous and accepts a `ResponseListener` argument that it calls with a `Response` when the request is successful or with an `Exception` if it fails. + +This is synchronous: + +```java +Request request = new Request( + "GET", <1> + "/"); <2> +Response response = restClient.performRequest(request); +``` + +1. The HTTP method (`GET`, `POST`, `HEAD`, etc) +2. The endpoint on the server + + +And this is asynchronous: + +```java +Request request = new Request( + "GET", <1> + "/"); <2> +Cancellable cancellable = restClient.performRequestAsync(request, + new ResponseListener() { + @Override + public void onSuccess(Response response) { + <3> + } + + @Override + public void onFailure(Exception exception) { + <4> + } +}); +``` + +1. The HTTP method (`GET`, `POST`, `HEAD`, etc) +2. The endpoint on the server +3. Handle the response +4. Handle the failure + + +You can add request parameters to the request object: + +```java +request.addParameter("pretty", "true"); +``` + +You can set the body of the request to any `HttpEntity`: + +```java +request.setEntity(new NStringEntity( + "{\"json\":\"text\"}", + ContentType.APPLICATION_JSON)); +``` + +::::{important} +The `ContentType` specified for the `HttpEntity` is important because it will be used to set the `Content-Type` header so that Elasticsearch can properly parse the content. +:::: + + +You can also set it to a `String` which will default to a `ContentType` of `application/json`. + +```java +request.setJsonEntity("{\"json\":\"text\"}"); +``` + +## RequestOptions [java-rest-low-usage-request-options] + +The `RequestOptions` class holds parts of the request that should be shared between many requests in the same application. You can make a singleton instance and share it between all requests: + +```java +private static final RequestOptions COMMON_OPTIONS; +static { + RequestOptions.Builder builder = RequestOptions.DEFAULT.toBuilder(); + builder.addHeader("Authorization", "Bearer " + TOKEN); <1> + builder.setHttpAsyncResponseConsumerFactory( <2> + new HttpAsyncResponseConsumerFactory + .HeapBufferedResponseConsumerFactory(30 * 1024 * 1024 * 1024)); + COMMON_OPTIONS = builder.build(); +} +``` + +1. Add any headers needed by all requests. +2. Customize the response consumer. + + +`addHeader` is for headers that are required for authorization or to work with a proxy in front of Elasticsearch. There is no need to set the `Content-Type` header because the client will automatically set that from the `HttpEntity` attached to the request. + +You can set the `NodeSelector` which controls which nodes will receive requests. `NodeSelector.SKIP_DEDICATED_MASTERS` is a good choice. + +You can also customize the response consumer used to buffer the asynchronous responses. The default consumer will buffer up to 100MB of response on the JVM heap. If the response is larger then the request will fail. You could, for example, lower the maximum size which might be useful if you are running in a heap constrained environment like the example above. + +Once you’ve created the singleton you can use it when making requests: + +```java +request.setOptions(COMMON_OPTIONS); +``` + +You can also customize these options on a per request basis. For example, this adds an extra header: + +```java +RequestOptions.Builder options = COMMON_OPTIONS.toBuilder(); +options.addHeader("cats", "knock things off of other things"); +request.setOptions(options); +``` + + +## Multiple parallel asynchronous actions [_multiple_parallel_asynchronous_actions] + +The client is quite happy to execute many actions in parallel. The following example indexes many documents in parallel. In a real world scenario you’d probably want to use the `_bulk` API instead, but the example is illustrative. + +```java +final CountDownLatch latch = new CountDownLatch(documents.length); +for (int i = 0; i < documents.length; i++) { + Request request = new Request("PUT", "/posts/doc/" + i); + //let's assume that the documents are stored in an HttpEntity array + request.setEntity(documents[i]); + restClient.performRequestAsync( + request, + new ResponseListener() { + @Override + public void onSuccess(Response response) { + <1> + latch.countDown(); + } + + @Override + public void onFailure(Exception exception) { + <2> + latch.countDown(); + } + } + ); +} +latch.await(); +``` + +1. Process the returned response +2. Handle the returned exception, due to communication error or a response with status code that indicates an error + + + +## Cancelling asynchronous requests [_cancelling_asynchronous_requests] + +The `performRequestAsync` method returns a `Cancellable` that exposes a single public method called `cancel`. Such method can be called to cancel the on-going request. Cancelling a request will result in aborting the http request through the underlying http client. On the server side, this does not automatically translate to the execution of that request being cancelled, which needs to be specifically implemented in the API itself. + +The use of the `Cancellable` instance is optional and you can safely ignore this if you don’t need it. A typical usecase for this would be using this together with frameworks like Rx Java or the Kotlin’s `suspendCancellableCoRoutine`. Cancelling no longer needed requests is a good way to avoid putting unnecessary load on Elasticsearch. + +```java +Request request = new Request("GET", "/posts/_search"); +Cancellable cancellable = restClient.performRequestAsync( + request, + new ResponseListener() { + @Override + public void onSuccess(Response response) { + <1> + } + + @Override + public void onFailure(Exception exception) { + <2> + } + } +); +cancellable.cancel(); +``` + +1. Process the returned response, in case it was ready before the request got cancelled +2. Handle the returned exception, which will most likely be a `CancellationException` as the request got cancelled + + + diff --git a/docs/reference/java-rest-low-usage-responses.md b/docs/reference/java-rest-low-usage-responses.md new file mode 100644 index 000000000..dcf22186f --- /dev/null +++ b/docs/reference/java-rest-low-usage-responses.md @@ -0,0 +1,41 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/java-rest-low-usage-responses.html +--- + +# Reading responses [java-rest-low-usage-responses] + +The `Response` object, either returned by the synchronous `performRequest` methods or received as an argument in `ResponseListener#onSuccess(Response)`, wraps the response object returned by the http client and exposes some additional information. + +```java +Response response = restClient.performRequest(new Request("GET", "/")); +RequestLine requestLine = response.getRequestLine(); <1> +HttpHost host = response.getHost(); <2> +int statusCode = response.getStatusLine().getStatusCode(); <3> +Header[] headers = response.getHeaders(); <4> +String responseBody = EntityUtils.toString(response.getEntity()); <5> +``` + +1. Information about the performed request +2. The host that returned the response +3. The response status line, from which you can for instance retrieve the status code +4. The response headers, which can also be retrieved by name though `getHeader(String)` +5. The response body enclosed in an [`org.apache.http.HttpEntity`](https://hc.apache.org/httpcomponents-core-4.4.x/current/httpcore/apidocs/org/apache/http/HttpEntity.html) object + + +When performing a request, an exception is thrown (or received as an argument in `ResponseListener#onFailure(Exception)` in the following scenarios: + +`IOException` +: communication problem (e.g. SocketTimeoutException) + +`ResponseException` +: a response was returned, but its status code indicated an error (not `2xx`). A `ResponseException` originates from a valid http response, hence it exposes its corresponding `Response` object which gives access to the returned response. + +::::{note} +A `ResponseException` is **not** thrown for `HEAD` requests that return a `404` status code because it is an expected `HEAD` response that simply denotes that the resource is not found. All other HTTP methods (e.g., `GET`) throw a `ResponseException` for `404` responses unless the `ignore` parameter contains `404`. `ignore` is a special client parameter that doesn’t get sent to Elasticsearch and contains a comma separated list of error status codes. It allows to control whether some error status code should be treated as an expected response rather than as an exception. This is useful for instance with the get api as it can return `404` when the document is missing, in which case the response body will not contain an error but rather the usual get api response, just without the document as it was not found. +:::: + + +Note that the low-level client doesn’t expose any helper for json marshalling and un-marshalling. Users are free to use the library that they prefer for that purpose. + +The underlying Apache Async Http Client ships with different [`org.apache.http.HttpEntity`](https://hc.apache.org/httpcomponents-core-4.4.x/current/httpcore/apidocs/org/apache/http/HttpEntity.html) implementations that allow to provide the request body in different formats (stream, byte array, string etc.). As for reading the response body, the `HttpEntity#getContent` method comes handy which returns an `InputStream` reading from the previously buffered response body. As an alternative, it is possible to provide a custom [`org.apache.http.nio.protocol.HttpAsyncResponseConsumer`](https://hc.apache.org/httpcomponents-core-4.4.x/current/httpcore-nio/apidocs/org/apache/http/nio/protocol/HttpAsyncResponseConsumer.html) that controls how bytes are read and buffered. diff --git a/docs/reference/java-rest-low-usage-shading.md b/docs/reference/java-rest-low-usage-shading.md new file mode 100644 index 000000000..20507a697 --- /dev/null +++ b/docs/reference/java-rest-low-usage-shading.md @@ -0,0 +1,68 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/java-rest-low-usage-shading.html +--- + +# Shading [java-rest-low-usage-shading] + +In order to avoid version conflicts, the dependencies can be shaded and packaged within the client in a single JAR file (sometimes called an "uber JAR" or "fat JAR"). Shading a dependency consists of taking its content (resources files and Java class files) and renaming some of its packages before putting them in the same JAR file as the low-level Java REST client. Shading a JAR can be accomplished by 3rd-party plugins for Gradle and Maven. + +Be advised that shading a JAR also has implications. Shading the Commons Logging layer, for instance, means that 3rd-party logging backends need to be shaded as well. + +## Maven configuration [java-rest-low-usage-shading-maven] + +Here is a configuration using the Maven [Shade](https://maven.apache.org/plugins/maven-shade-plugin/index.html) plugin. Add the following to your `pom.xml` file: + +```xml + + + + org.apache.maven.plugins + maven-shade-plugin + 3.1.0 + + + package + shade + + + + org.apache.http + hidden.org.apache.http + + + org.apache.logging + hidden.org.apache.logging + + + org.apache.commons.codec + hidden.org.apache.commons.codec + + + org.apache.commons.logging + hidden.org.apache.commons.logging + + + + + + + + +``` + + +## Gradle configuration [java-rest-low-usage-shading-gradle] + +Here is a configuration using the Gradle [ShadowJar](https://github.com/johnrengelman/shadow) plugin. Add the following to your `build.gradle` file: + +```groovy +shadowJar { + relocate 'org.apache.http', 'hidden.org.apache.http' + relocate 'org.apache.logging', 'hidden.org.apache.logging' + relocate 'org.apache.commons.codec', 'hidden.org.apache.commons.codec' + relocate 'org.apache.commons.logging', 'hidden.org.apache.commons.logging' +} +``` + + diff --git a/docs/reference/java-rest-low-usage.md b/docs/reference/java-rest-low-usage.md new file mode 100644 index 000000000..8c87b0d4e --- /dev/null +++ b/docs/reference/java-rest-low-usage.md @@ -0,0 +1,17 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/java-rest-low-usage.html +--- + +# Getting started [java-rest-low-usage] + +This section describes how to get started with the low-level REST client from getting the artifact to using it in an application. + + + + + + + + + diff --git a/docs/reference/java-rest-sniffer-javadoc.md b/docs/reference/java-rest-sniffer-javadoc.md new file mode 100644 index 000000000..a24c16f1c --- /dev/null +++ b/docs/reference/java-rest-sniffer-javadoc.md @@ -0,0 +1,9 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/java-rest-sniffer-javadoc.html +--- + +# Javadoc [java-rest-sniffer-javadoc] + +The javadoc for the REST client sniffer can be found at [https://snapshots.elastic.co/javadoc/org/elasticsearch/client/elasticsearch-rest-client-sniffer/9.0.0-beta1-SNAPSHOT/index.html](https://snapshots.elastic.co/javadoc/org/elasticsearch/client/elasticsearch-rest-client-sniffer/9.0.0-beta1-SNAPSHOT/index.md). + diff --git a/docs/reference/javadoc-source-code.md b/docs/reference/javadoc-source-code.md new file mode 100644 index 000000000..abcdd4183 --- /dev/null +++ b/docs/reference/javadoc-source-code.md @@ -0,0 +1,11 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/java-client-javadoc.html +--- + +# Javadoc and source code [java-client-javadoc] + +The javadoc for the Java API Client can be found at [https://snapshots.elastic.co/javadoc/co/elastic/clients/elasticsearch-java/9.0.0-beta1-SNAPSHOT/index.html](https://snapshots.elastic.co/javadoc/co/elastic/clients/elasticsearch-java/9.0.0-beta1-SNAPSHOT/index.md). + +The source code is at [https://github.com/elastic/elasticsearch-java/](https://github.com/elastic/elasticsearch-java/) and is licensed under the Apache 2.0 License. + diff --git a/docs/reference/lists-maps.md b/docs/reference/lists-maps.md new file mode 100644 index 000000000..b31308fd3 --- /dev/null +++ b/docs/reference/lists-maps.md @@ -0,0 +1,77 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/lists-and-maps.html +--- + +# Lists and maps [lists-and-maps] + + +## Additive builder setters [_additive_builder_setters] + +Properties of type `List` and `Map` are exposed by object builders as a set of overloaded additive-only methods that *update* the property value, by appending to lists and adding new entries to maps (or replacing existing ones). + +Object builders create immutable objects, and this also applies to list and map properties that are made immutable at object construction time. + +```java +// Prepare a list of index names +List names = Arrays.asList("idx-a", "idx-b", "idx-c"); + +// Prepare cardinality aggregations for fields "foo" and "bar" +Map cardinalities = new HashMap<>(); +cardinalities.put("foo-count", Aggregation.of(a -> a.cardinality(c -> c.field("foo")))); +cardinalities.put("bar-count", Aggregation.of(a -> a.cardinality(c -> c.field("bar")))); + +// Prepare an aggregation that computes the average of the "size" field +final Aggregation avgSize = Aggregation.of(a -> a.avg(v -> v.field("size"))); + +SearchRequest search = SearchRequest.of(r -> r + // Index list: + // - add all elements of a list + .index(names) + // - add a single element + .index("idx-d") + // - add a vararg list of elements + .index("idx-e", "idx-f", "idx-g") + + // Sort order list: add elements defined by builder lambdas + .sort(s -> s.field(f -> f.field("foo").order(SortOrder.Asc))) + .sort(s -> s.field(f -> f.field("bar").order(SortOrder.Desc))) + + // Aggregation map: + // - add all entries of an existing map + .aggregations(cardinalities) + // - add a key/value entry + .aggregations("avg-size", avgSize) + // - add a key/value defined by a builder lambda + .aggregations("price-histogram", + a -> a.histogram(h -> h.field("price"))) +); +``` + + +## List and map values are never `null` [_list_and_map_values_are_never_null] + +The {{es}} API has a lot of optional properties. For single-valued properties, the Java API Client represents missing optional values as `null`. Applications therefore have to null-check optional values before using them. + +For lists and maps however, applications often only care about whether they’re empty or not, or even just iterate on their content. Using `null` values is then cumbersome. To avoid this, Java API Client collection properties are never `null`, and missing optional collections are returned as an empty collection. + +If you ever need to distinguish between a missing (undefined) optional collection and an effectively-empty collection returned by {{es}}, the `ApiTypeHelper` class provides a utility method to distinguish them: + +```java +NodeStatistics stats = NodeStatistics.of(b -> b + .total(1) + .failed(0) + .successful(1) +); + +// The `failures` list was not provided. +// - it's not null +assertNotNull(stats.failures()); +// - it's empty +assertEquals(0, stats.failures().size()); +// - and if needed we can know it was actually not defined +assertFalse(ApiTypeHelper.isDefined(stats.failures())); +``` + +The source code for the examples above can be found in the [Java API Client tests](https://github.com/elastic/elasticsearch-java/tree/master/java-client/src/test/java/co/elastic/clients/documentation). + diff --git a/docs/reference/loading-json.md b/docs/reference/loading-json.md new file mode 100644 index 000000000..4a4227528 --- /dev/null +++ b/docs/reference/loading-json.md @@ -0,0 +1,171 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/loading-json.html +--- + +# Creating API objects from JSON data [loading-json] + +A common workflow during application development with Elasticsearch is to use the Kibana Developer Console to interactively prepare and test queries, aggregations, index mappings and other complex API calls. This results in working JSON snippets that you may want to use in your application. + +As translating these JSON snippets to Java code can be time-consuming and error-prone, most of the data classes in the Java API Client can be loaded from JSON text: object builders have `withJson()` methods that populate the builder from raw JSON. This also allows you to combine dynamically loaded JSON with programmatic construction of objects. + +Under the hood, the `withJson()` methods call the object’s deserializer. The JSON text’s structure and value types therefore have to be correct for the target data structure. Using `withJson()` keeps the strong typing guarantees of the Java API Client. + + +## Examples [_examples_2] + + +### Loading an index definition from a resource file [_loading_an_index_definition_from_a_resource_file] + +Consider a resource file `some-index.json` containing an index definition: + +```json +{ + "mappings": { + "properties": { + "field1": { "type": "text" } + } + } +} +``` + +You can create an index from that definition as follows: + +```java +InputStream input = this.getClass() + .getResourceAsStream("some-index.json"); <1> + +CreateIndexRequest req = CreateIndexRequest.of(b -> b + .index("some-index") + .withJson(input) <2> +); + +boolean created = client.indices().create(req).acknowledged(); +``` + +1. open an input stream for the JSON resource file. +2. populate the index creation request with the resource file contents. + + + +### Ingesting documents from JSON files [_ingesting_documents_from_json_files] + +Similarly, you can read documents to be stored in {{es}} from data files: + +```java +FileReader file = new FileReader(new File(dataDir, "document-1.json")); + +IndexRequest req; <1> + +req = IndexRequest.of(b -> b + .index("some-index") + .withJson(file) +); + +client.index(req); +``` + +1. when calling `withJson()` on data structures that have generic type parameters, these generic types will be considered to be `JsonData`. + + + +### Creating a search request combining JSON and programmatic construction [_creating_a_search_request_combining_json_and_programmatic_construction] + +You can combine `withJson()` with regular calls to setter methods. The example below loads the query part of a search request from a `String` and programmatically adds an aggregation. + +```java +Reader queryJson = new StringReader( + "{" + + " \"query\": {" + + " \"range\": {" + + " \"@timestamp\": {" + + " \"gt\": \"now-1w\"" + + " }" + + " }" + + " }" + + "}"); + +SearchRequest aggRequest = SearchRequest.of(b -> b + .withJson(queryJson) <1> + .aggregations("max-cpu", a1 -> a1 <2> + .dateHistogram(h -> h + .field("@timestamp") + .calendarInterval(CalendarInterval.Hour) + ) + .aggregations("max", a2 -> a2 + .max(m -> m.field("host.cpu.usage")) + ) + ) + .size(0) +); + +Map aggs = client + .search(aggRequest, Void.class) <3> + .aggregations(); +``` + +1. loads the query from the JSON string. +2. adds the aggregation. +3. since this is an aggregation we don’t care about result documents and set their target class to `Void`, meaning they will just be ignored. Note that setting `size` to zero actually prevents any document from being returned. + + + +### Creating a search request from multiple JSON snippets [_creating_a_search_request_from_multiple_json_snippets] + +The `withJson()` methods are partial deserializers: the properties loaded from the JSON will set property values or replace the previous ones, but will not reset other properties not found in the JSON input. You can use this to combine multiple JSON snippets to build complex search requests. In the example below, we combine separate definitions of a query that selects some documents and an aggregation that is run on the results of this query. + +```java +Reader queryJson = new StringReader( + "{" + + " \"query\": {" + + " \"range\": {" + + " \"@timestamp\": {" + + " \"gt\": \"now-1w\"" + + " }" + + " }" + + " }," + + " \"size\": 100" + <1> + "}"); + +Reader aggregationJson = new StringReader( + "{" + + " \"size\": 0, " + <2> + " \"aggregations\": {" + + " \"hours\": {" + + " \"date_histogram\": {" + + " \"field\": \"@timestamp\"," + + " \"interval\": \"hour\"" + + " }," + + " \"aggregations\": {" + + " \"max-cpu\": {" + + " \"max\": {" + + " \"field\": \"host.cpu.usage\"" + + " }" + + " }" + + " }" + + " }" + + " }" + + "}"); + +SearchRequest aggRequest = SearchRequest.of(b -> b + .withJson(queryJson) <3> + .withJson(aggregationJson) <4> + .ignoreUnavailable(true) <5> +); + +Map aggs = client + .search(aggRequest, Void.class) + .aggregations(); +``` + +1. set max number of returned document to 100 for queries. +2. we do not want any matching document in aggregations. +3. loads the query part of the request. +4. loads the aggregation part of the request (overwrites `size` from the query). +5. additional request properties set programmatically. + + +Notice that order matters when the JSON snippets have some common properties: just as when setting property values programmatically, the last value that is set for a property overwrites the previous one. + +The source code for the examples above can be found in the [Java API Client tests](https://github.com/elastic/elasticsearch-java/tree/master/java-client/src/test/java/co/elastic/clients/documentation). + diff --git a/docs/reference/method-naming.md b/docs/reference/method-naming.md new file mode 100644 index 000000000..77dfb4941 --- /dev/null +++ b/docs/reference/method-naming.md @@ -0,0 +1,12 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/method-naming.html +--- + +# Method naming conventions [method-naming] + +Classes in the Java API Client contain two kinds of methods and properties: + +* Methods and properties that are part of the API, such as `ElasticsearchClient.search()` or `SearchResponse.maxScore()`. They are derived from their respective names in the {{es}} JSON API using the standard Java `camelCaseNaming` convention. +* Methods and properties that are part of the framework on which the Java API Client is built, such as `Query._kind()`. These methods and properties are prefixed with an underscore to both avoid any naming conflicts with API names, and as an easy way to distinguish the API from the framework. + diff --git a/docs/reference/migrate-hlrc.md b/docs/reference/migrate-hlrc.md new file mode 100644 index 000000000..66ab070e7 --- /dev/null +++ b/docs/reference/migrate-hlrc.md @@ -0,0 +1,74 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/migrate-hlrc.html +--- + +# Migrating from the High Level Rest Client [migrate-hlrc] + +The {{es}} Java API Client is an entirely new client library that has no relation to the older High Level Rest Client (HLRC). This was a deliberate choice to provide a library that is independent from the {{es}} server code and that provides a very consistent and easier to use API for all {{es}} features. + +Migrating from the HLRC therefore requires some code rewrite in your application. This transition can however happen progressively as the two client libraries can coexist in a single application with no operational overhead. + + +## Compatibility mode: using a 7.17 client with {{es}} 8.x [_compatibility_mode_using_a_7_17_client_with_es_8_x] + +The HLRC version `7.17` can be used with {{es}} version `8.x` by enabling HLRC’s compatibility mode (see code sample below). In this mode HLRC sends additional headers that instruct {{es}} `8.x` to behave like a `7.x` server. + +The Java API Client doesn’t need this setting as compatibility mode is always enabled. + +You can use the HLRC version `7.x` with the Java API Client version `8.x`: + +```groovy +dependencies { + implementation 'co.elastic.clients:elasticsearch-java:9.0.0-beta1' + implementation 'org.elasticsearch.client:elasticsearch-rest-high-level-client:7.17.4' + // other dependencies <1> +} +``` + +1. See [Installation](/reference/installation.md) + + + +## Using the same http client with the HLRC and the Java API Client [_using_the_same_http_client_with_the_hlrc_and_the_java_api_client] + +To avoid any operational overhead during the transition phase where an application would use both the HLRC and the new Java API Client, both clients can share the same Low Level Rest Client, which is the network layer that manages all connections, round-robin strategies, node sniffing, and so on. + +The code below shows how to initialize both clients with the same HTTP client: + +```java +// Create the low-level client +RestClient httpClient = RestClient.builder( + new HttpHost("localhost", 9200) +).build(); + +// Create the HLRC +RestHighLevelClient hlrc = new RestHighLevelClientBuilder(httpClient) + .setApiCompatibilityMode(true) <1> + .build(); + +// Create the Java API Client with the same low level client +ElasticsearchTransport transport = new RestClientTransport( + httpClient, + new JacksonJsonpMapper() +); + +ElasticsearchClient esClient = new ElasticsearchClient(transport); + +// hlrc and esClient share the same httpClient +``` + +1. Enables compatibility mode that allows HLRC `7.17` to work with {{es}} `8.x`. + + + +## Transition strategies [_transition_strategies] + +There are different ways you can start transitioning away from the HLRC in your application code. + +For example: + +* keep the existing code as-is and use the new Java API Client for new features in your application, then later migrate the existing code, +* rewrite the parts of your application where the new Java API Client is much easier to use than that of the HLRC, like everything related to search, +* rewrite those parts where you need to map application objects to/from JSON, by leveraging the tight integration of the new Java API Client with JSON object mappers. + diff --git a/docs/reference/object-lifecycles.md b/docs/reference/object-lifecycles.md new file mode 100644 index 000000000..ca5554306 --- /dev/null +++ b/docs/reference/object-lifecycles.md @@ -0,0 +1,23 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/object-lifecycles.html +--- + +# Object life cycles and thread safety [object-lifecycles] + +There are five kinds of objects in the Java API Client with different life cycles: + +**Object mapper** +: Stateless and thread-safe, but can be costly to create. It’s usually a singleton that is created at application startup and used to create the transport. + +**Transport** +: Thread-safe, holds network resources through the underlying HTTP client. A transport object is associated with an {{es}} cluster and has to be explicitly closed to release the underlying resources such as network connections. + +**Clients** +: Immutable, stateless and thread-safe. These are very lightweight objects that just wrap a transport and provide API endpoints as methods. Closing a client closes the underlying transport. + +**Builders** +: Mutable, non thread-safe. Builders are transient objects that should not be reused after calling `build()`. + +**Requests & other API objects** +: Immutable, thread-safe. If your application uses the same request or same parts of a request over and over, these objects can be prepared in advance and reused across multiple calls over multiple clients with different transports. diff --git a/docs/reference/opentelemetry.md b/docs/reference/opentelemetry.md new file mode 100644 index 000000000..723e5d173 --- /dev/null +++ b/docs/reference/opentelemetry.md @@ -0,0 +1,111 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/opentelemetry.html +--- + +# Using OpenTelemetry [opentelemetry] + +You can use [OpenTelemetry](https://opentelemetry.io/) to monitor the performance and behavior of your {{es}} requests through the Java API Client. The Java API Client comes with built-in OpenTelemetry instrumentation that emits [distributed tracing spans](docs-content://solutions/observability/apps/traces-2.md) by default. With that, applications [instrumented with OpenTelemetry](https://opentelemetry.io/docs/instrumentation/java/manual/) or running the [OpenTelemetry Java Agent](https://opentelemetry.io/docs/instrumentation/java/automatic/) are inherently enriched with additional spans that contain insightful information about the execution of the {{es}} requests. + +The native instrumentation in the Java API Client follows the [OpenTelemetry Semantic Conventions for {{es}}](https://opentelemetry.io/docs/specs/semconv/database/elasticsearch/). In particular, the instrumentation in the client covers the logical layer of {{es}} requests. A single span per request is created that is processed by the service through the Java API Client. The following image shows a trace that records the handling of three different {{es}} requests: an `index`, `get` and a search `request`: + +:::{image} images/otel-waterfall-instrumented-without-http.jpg +:alt: Distributed trace with {{es}} spans +:class: screenshot +::: + +Usually, OpenTelemetry agents and auto-instrumentation modules come with instrumentation support for HTTP-level communication. In this case, in addition to the logical {{es}} client requests, spans will be captured for the physical HTTP requests emitted by the client. The following image shows a trace with both, {{es}} spans (in blue) and the corresponding HTTP-level spans (in red): + +:::{image} images/otel-waterfall-instrumented.jpg +:alt: Distributed trace with {{es}} and HTTP spans +:class: screenshot +::: + +Advanced Java API Client behavior such as nodes round-robin and request retries are revealed through the combination of logical {{es}} spans and the physical HTTP spans. The following example shows an `index` request in a scenario with two {{es}} nodes: + +:::{image} images/otel-waterfall-retries.jpg +:alt: Distributed trace with request retries +:class: screenshot +::: + +The first node is unavailable and results in an HTTP error, while the retry to the second node succeeds. Both HTTP requests are subsumed by the logical {{es}} request span (in blue). + + +## Setup the OpenTelemetry instrumentation [_setup_the_opentelemetry_instrumentation] + +When using the [OpenTelemetry Java SDK manually](https://opentelemetry.io/docs/instrumentation/java/manual) or using the [OpenTelemetry Java Agent](https://opentelemetry.io/docs/instrumentation/java/automatic/), the Java API Client’s OpenTelemetry instrumentation is enabled by default and uses the *globally* registered OpenTelemetry SDK instance (i.e. `GlobalOpenTelemetry`). So, if you don’t use a custom, local OpenTelemetry SDK instance, there is no explicit setup required to use the Java API Client’s OpenTelemetry instrumentation. + + +### Using a custom OpenTelemetry instance [_using_a_custom_opentelemetry_instance] + +In case you are using [manual OpenTelemetry instrumentation](https://opentelemetry.io/docs/instrumentation/java/manual/#example) with a custom OpenTelemetry SDK instance that is *not registered globally*, you can create the Java API Client using a custom OpenTelemetry instance. The following code snippet shows an example of using a custom OpenTelemetry instance. + +```java +// URL and API key +String serverUrl = "https://localhost:9200"; +String apiKey = "VnVhQ2ZHY0JDZGJrU..."; + +// Create the low-level client +RestClient restClient = RestClient + .builder(HttpHost.create(serverUrl)) + .setDefaultHeaders(new Header[]{ + new BasicHeader("Authorization", "ApiKey " + apiKey) + }) + .build(); +// Create and configure custom OpenTelemetry instance +OpenTelemetry customOtel = OpenTelemetrySdk.builder().build(); + +// Create Instrumentation instance using the custom OpenTelemetry instance +// Second constructor argument allows to enable/disable search body capturing +OpenTelemetryForElasticsearch esOtelInstrumentation = + new OpenTelemetryForElasticsearch(customOtel, false); + +// Create the transport with the custom Instrumentation instance +ElasticsearchTransport transport = new RestClientTransport( + restClient, new JacksonJsonpMapper(), null, esOtelInstrumentation +); + +// And create the API client +ElasticsearchClient esClient = new ElasticsearchClient(transport); + +// Use the client... + +// Close the client, also closing the underlying transport object and network connections. +esClient.close(); +``` + + +## Configuring the OpenTelemetry instrumentation [_configuring_the_opentelemetry_instrumentation] + +You can configure the OpenTelemetry instrumentation either through Java System properties or Environment Variables. The following configuration options are available. + + +### Enable / Disable the OpenTelemetry instrumentation [opentelemetry-config-enable] + +With this configuration option you can enable (default) or disable the built-in OpenTelemetry instrumentation. + +**Default:** `true` + +| | | +| --- | --- | +| Java System Property | `otel.instrumentation.elasticsearch.enabled` | +| Environment Variable | `OTEL_INSTRUMENTATION_ELASTICSEARCH_ENABLED` | + + +### Capture search request bodies [_capture_search_request_bodies] + +Per default, the built-in OpenTelemetry instrumentation does not capture request bodies due to data privacy considerations. You can use this option to enable capturing of search queries from the the request bodies of {{es}} search requests in case you wish to gather this information regardless. + +**Default:** `false` + +| | | +| --- | --- | +| Java System Property | `otel.instrumentation.elasticsearch.capture-search-query` | +| Environment Variable | `OTEL_INSTRUMENTATION_ELASTICSEARCH_CAPTURE_SEARCH_QUERY` | + + +## Overhead [_overhead] + +The OpenTelemetry instrumentation (as any other monitoring approach) may come with a little overhead on CPU, memory and/or latency. The overhead may only occur when the instrumentation is enabled (default) and an OpenTelemetry SDK (or an OpenTelemetry Agent) is active in the target application. In case that either the instrumentation is disabled or no OpenTelemetry SDK (or OpenTelemetry Agent) is active with the target application, there is no monitoring overhead expected when using the client. + +Even when the instrumentation is enabled and is being actively used (by an OpenTelemetry SDK), in the vast majority of cases the overhead is very small and negligible. In edge cases in which there is a noticable overhead the [instrumentation can be explicitly disabled](#opentelemetry-config-enable) to eliminate any potential overhead effect of the instrumentation. diff --git a/docs/reference/package-structure.md b/docs/reference/package-structure.md new file mode 100644 index 000000000..48bed9ba9 --- /dev/null +++ b/docs/reference/package-structure.md @@ -0,0 +1,23 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/package-structure.html +--- + +# Package structure and namespace clients [package-structure] + +The {{es}} API is large and is organized into feature groups, as can be seen in the [{{es}} API documentation](elasticsearch://reference/elasticsearch/rest-apis/index.md). + +The Java API Client follows this structure: feature groups are called “namespaces”, and each namespace is located in a subpackage of `co.elastic.clients.elasticsearch`. + +Each of the namespace clients can be accessed from the top level {{es}} client. The only exceptions are the “search” and “document” APIs which are located in the `core` subpackage and can be accessed on the main {{es}} client object. + +The snippet below shows how to use the indices namespace client to create an index (the lambda syntax is explained in [Building API objects](/reference/building-objects.md)): + +```java +// Create the "products" index +ElasticsearchClient client = ... +client.indices().create(c -> c.index("products")); +``` + +Namespace clients are very lightweight objects that can be created on the fly. + diff --git a/docs/reference/reading.md b/docs/reference/reading.md new file mode 100644 index 000000000..e6f27305b --- /dev/null +++ b/docs/reference/reading.md @@ -0,0 +1,71 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/reading.html +--- + +# Reading documents by id [reading] + +Elasticsearch is all about search, but you may also want to access documents directly, knowing their identifier. The "get" request is meant for this. + +::::{note} +See the [{{es}} API documentation](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-get) for a full explanation of get requests. +:::: + + + +## Reading a domain object [_reading_a_domain_object] + +The example below reads the document with identifier `bk-1` from the `products` index. + +The `get` request has two parameters: + +* the first parameter is the actual request, built below with the fluent DSL +* the second parameter is the class we want the document’s JSON to be mapped to. + +```java +GetResponse response = esClient.get(g -> g + .index("products") <1> + .id("bk-1"), + Product.class <2> +); + +if (response.found()) { + Product product = response.source(); + logger.info("Product name " + product.getName()); +} else { + logger.info ("Product not found"); +} +``` + +1. The get request, with the index name and identifier. +2. The target class, here `Product`. + + + +## Reading raw JSON [_reading_raw_json] + +When your index contains semi-structured data or if you don’t have a domain object definition, you can also read the document as raw JSON data. + +Raw JSON data is just another class that you can use as the result type for the get request. In the example below we use Jackson’s `ObjectNode`. We could also have used any JSON representation that can be deserialized by the JSON mapper associated to the `ElasticsearchClient`. + +```java +GetResponse response = esClient.get(g -> g + .index("products") + .id("bk-1"), + ObjectNode.class <1> +); + +if (response.found()) { + ObjectNode json = response.source(); + String name = json.get("name").asText(); + logger.info("Product name " + name); +} else { + logger.info("Product not found"); +} +``` + +1. The target class is a raw JSON object. + + +The source code for the examples above can be found in the [Java API Client tests](https://github.com/elastic/elasticsearch-java/tree/master/java-client/src/test/java/co/elastic/clients/documentation). + diff --git a/docs/reference/release-highlights.md b/docs/reference/release-highlights.md new file mode 100644 index 000000000..645fcf83e --- /dev/null +++ b/docs/reference/release-highlights.md @@ -0,0 +1,11 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/release-highlights.html +--- + +# Release highlights [release-highlights] + +These are the important new features and changes in minor releases. Every release also updates the Java API Client to the latest [API specification](https://github.com/elastic/elasticsearch-specification). This includes new APIs and bug fixes in the specification of existing APIs. + +For a list of detailed changes, including bug fixes, please see the [GitHub project realease notes](https://github.com/elastic/elasticsearch-java/releases). + diff --git a/docs/reference/searching.md b/docs/reference/searching.md new file mode 100644 index 000000000..f2eb732d1 --- /dev/null +++ b/docs/reference/searching.md @@ -0,0 +1,158 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/searching.html +--- + +# Searching for documents [searching] + +Indexed documents are available for search in near real-time. + +::::{note} +See the {{es}} documentation for a full explanation of search requests: [search your data](docs-content://solutions/search/querying-for-search.md), [the query DSL](docs-content://solutions/search/querying-for-search.md), and [search APIs](https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-search). +:::: + + + +## Simple search query [_simple_search_query] + +There are many types of search queries that can be combined. We will start with the simple text match query, searching for bikes in the `products` index. + +The search result has a `hits` properties that contains the documents that matched the query along with information about the total number of matches that exist in the index. + +The total value comes with a relation that indicates if the total is exact (`eq` — equal) or approximate (`gte` — greater than or equal). + +Each returned document comes with its relevance score and additional information about its location in the index. + +```java +String searchText = "bike"; + +SearchResponse response = esClient.search(s -> s + .index("products") <1> + .query(q -> q <2> + .match(t -> t <3> + .field("name") <4> + .query(searchText) + ) + ), + Product.class <5> +); + +TotalHits total = response.hits().total(); +boolean isExactResult = total.relation() == TotalHitsRelation.Eq; + +if (isExactResult) { + logger.info("There are " + total.value() + " results"); +} else { + logger.info("There are more than " + total.value() + " results"); +} + +List> hits = response.hits().hits(); +for (Hit hit: hits) { + Product product = hit.source(); + logger.info("Found product " + product.getSku() + ", score " + hit.score()); +} +``` + +1. Name of the index we want to search. +2. The query part of the search request (a search request can also have other components like [aggregations](/reference/aggregations.md)). +3. Choose a query variant among the many available. We choose here the match query (full text search). +4. Configure the match query: we search for a term in the `name` field. +5. The target class for the matching documents. We use `Product` here, just like in [get request](/reference/reading.md) examples. + + +Similarly to [get](/reference/reading.md) operations, you can fetch documents matching your query as raw JSON by using a corresponding target class instead of `Product`, like JSON-P’s `JsonValue` or Jackson’s `ObjectNode`. + + +## Nested search queries [_nested_search_queries] + +{{es}} allows individual queries to be combined to build more complex search requests. In the example below we will search for bikes with a maximum price of 200. + +```java +String searchText = "bike"; +double maxPrice = 200.0; + +// Search by product name +Query byName = MatchQuery.of(m -> m <1> + .field("name") + .query(searchText) +)._toQuery(); <2> + +// Search by max price +Query byMaxPrice = RangeQuery.of(r -> r + .number(n -> n + .field("price") + .gte(maxPrice)) <3> +)._toQuery(); + +// Combine name and price queries to search the product index +SearchResponse response = esClient.search(s -> s + .index("products") + .query(q -> q + .bool(b -> b <4> + .must(byName) <5> + .must(byMaxPrice) + ) + ), + Product.class +); + +List> hits = response.hits().hits(); +for (Hit hit: hits) { + Product product = hit.source(); + logger.info("Found product " + product.getSku() + ", score " + hit.score()); +} +``` + +1. We’re creating the queries for individual criteria separately. +2. A `MatchQuery` is a query *variant* that we have to turn into the `Query` *union type*. See [variant types](/reference/variant-types.md) for additional details. +3. {{es}} range query accepts a large range of value types. We create here a JSON representation of the maximum price. +4. The search query is a boolean query that combines the text search and max price queries. +5. Both queries are added as `must` as we want results to match all criteria. + + + +## Templated search [_templated_search] + +A search template is a stored search that you can run with different variables. Search templates let you change your searches without modifying your application code. + +Before running a template search, you first have to create the template. This is a stored script that returns the search request body, and is usually defined as a Mustache template. This stored script can be created outside the application, and also with the Java API Client: + +```java +// Create a script +esClient.putScript(r -> r + .id("query-script") <1> + .script(s -> s + .lang("mustache") + .source("{\"query\":{\"match\":{\"{{field}}\":\"{{value}}\"}}}") + )); +``` + +1. Identifier of the template script to create. + + +To use the search template, use the `searchTemplate` method to refer to the script and provide values for its parameters: + +```java +SearchTemplateResponse response = esClient.searchTemplate(r -> r + .index("some-index") + .id("query-script") <1> + .params("field", JsonData.of("some-field")) <2> + .params("value", JsonData.of("some-data")), + Product.class +); + +List> hits = response.hits().hits(); +for (Hit hit: hits) { + Product product = hit.source(); + logger.info("Found product " + product.getSku() + ", score " + hit.score()); +} +``` + +1. Identifier of the template script to use. +2. Template parameter values. + + +For more in-depth information, see the [{{es}} search template documentation](docs-content://solutions/search/search-templates.md). + +The source code for the examples above can be found in the [Java API Client tests](https://github.com/elastic/elasticsearch-java/tree/master/java-client/src/test/java/co/elastic/clients/documentation). + diff --git a/docs/reference/setup.md b/docs/reference/setup.md new file mode 100644 index 000000000..55bb77419 --- /dev/null +++ b/docs/reference/setup.md @@ -0,0 +1,17 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/_setup.html +--- + +# Setup [_setup] + +* [Installation](/reference/installation.md) +* [Connecting](/reference/connecting.md) +* [Migrating from the High Level Rest Client](/reference/migrate-hlrc.md) +* [Using OpenTelemetry](/reference/opentelemetry.md) +* [Java Low Level REST Client](/reference/java-low-level-rest-client.md) + + + + + diff --git a/docs/reference/sniffer.md b/docs/reference/sniffer.md new file mode 100644 index 000000000..cbb67a7f4 --- /dev/null +++ b/docs/reference/sniffer.md @@ -0,0 +1,14 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/sniffer.html +--- + +# Sniffer [sniffer] + +Minimal library that allows to automatically discover nodes from a running Elasticsearch cluster and set them to an existing `RestClient` instance. It retrieves by default the nodes that belong to the cluster using the Nodes Info api and uses jackson to parse the obtained json response. + +Compatible with Elasticsearch 2.x and onwards. + + + + diff --git a/docs/reference/toc.yml b/docs/reference/toc.yml new file mode 100644 index 000000000..282c0f690 --- /dev/null +++ b/docs/reference/toc.yml @@ -0,0 +1,59 @@ +toc: + - file: index.md + - file: getting-started.md + - file: setup.md + children: + - file: installation.md + - file: connecting.md + - file: migrate-hlrc.md + - file: opentelemetry.md + - file: api-conventions.md + children: + - file: package-structure.md + - file: method-naming.md + - file: blocking-async.md + - file: building-objects.md + - file: lists-maps.md + - file: variant-types.md + - file: object-lifecycles.md + - file: loading-json.md + - file: exception-conventions.md + - file: using-java-api-client.md + children: + - file: esql.md + - file: indexing.md + - file: indexing-bulk.md + - file: reading.md + - file: searching.md + - file: aggregations.md + - file: javadoc-source-code.md + - file: external-resources.md + - file: java-low-level-rest-client.md + children: + - file: java-rest-low-usage.md + children: + - file: java-rest-low-javadoc.md + - file: java-rest-low-usage-maven.md + - file: java-rest-low-usage-dependencies.md + - file: java-rest-low-usage-shading.md + - file: java-rest-low-usage-initialization.md + - file: java-rest-low-usage-requests.md + - file: java-rest-low-usage-responses.md + - file: java-rest-low-usage-logging.md + - file: java-rest-low-config.md + children: + - file: _timeouts.md + - file: _number_of_threads.md + - file: _basic_authentication.md + - file: _other_authentication_methods.md + - file: _encrypted_communication.md + - file: _others.md + - file: _node_selector.md + - file: sniffer.md + children: + - file: java-rest-sniffer-javadoc.md + - file: _maven_repository.md + - file: _usage.md + - file: breaking-changes-policy.md + - file: release-highlights.md + - file: _license.md \ No newline at end of file diff --git a/docs/reference/using-java-api-client.md b/docs/reference/using-java-api-client.md new file mode 100644 index 000000000..6eac73b84 --- /dev/null +++ b/docs/reference/using-java-api-client.md @@ -0,0 +1,31 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/usage.html +--- + +# Using the Java API client [usage] + +The sections below provide tutorials on the most frequently used and some less obvious features of {{es}}. + +For a full reference, see the [Elasticsearch documentation](docs-content://get-started/index.md) and in particular the [REST APIs](elasticsearch://reference/elasticsearch/rest-apis/index.md) section. The Java API Client follows closely the JSON structures described there, using the [Java API conventions](/reference/api-conventions.md). + +If you’re new to Elasticsearch, make sure also to read [Elasticsearch’s quick start](docs-content://solutions/search/get-started.md) that provides a good introduction. + +* [ES|QL in the Java client](/reference/esql.md) +* [Indexing single documents](/reference/indexing.md) +* [Bulk: indexing multiple documents](/reference/indexing-bulk.md) +* [Reading documents by id](/reference/reading.md) +* [Searching for documents](/reference/searching.md) +* [Aggregations](/reference/aggregations.md) + +::::{note} +This is still a work in progress, more sections will be added in the near future. +:::: + + + + + + + + diff --git a/docs/reference/variant-types.md b/docs/reference/variant-types.md new file mode 100644 index 000000000..9540ac463 --- /dev/null +++ b/docs/reference/variant-types.md @@ -0,0 +1,176 @@ +--- +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/variant-types.html +--- + +# Variant types [variant-types] + +The {{es}} API has a lot of variant types: queries, aggregations, field mappings, analyzers, and so on. Finding the correct class name in such large collections can be challenging. + +The Java API Client builders make this easy: the builders for variant types, such as `Query`, have methods for each of the available implementations. We’ve seen this in action above with `intervals` (a kind of query) and `allOf`, `match` and `anyOf` (various kinds of intervals). + +This is because variant objects in the Java API Client are implementations of a “tagged union”: they contain the identifier (or tag) of the variant they hold and the value for that variant. For example, a `Query` object can contain an `IntervalsQuery` with tag `intervals`, a `TermQuery` with tag `term`, and so on. This approach allows writing fluent code where you can let the IDE completion features guide you to build and navigate complex nested structures: + +Variant builders have setter methods for every available implementation. They use the same conventions as regular properties and accept both a builder lambda expression and a ready-made object of the actual type of the variant. Here’s an example to build a term query: + +```java +Query query = new Query.Builder() + .term(t -> t <1> + .field("name") <2> + .value(v -> v.stringValue("foo")) + ) + .build(); <3> +``` + +1. Choose the `term` variant to build a term query. +2. Build the terms query with a builder lambda expression. +3. Build the `Query` that now holds a `TermQuery` object of kind `term`. + + +Variant objects have getter methods for every available implementation. These methods check that the object actually holds a variant of that kind and return the value downcasted to the correct type. They throw an `IllegalStateException` otherwise. This approach allows writing fluent code to traverse variants. + +```java +assertEquals("foo", query.term().value().stringValue()); +``` + +Variant objects also provide information on the variant kind they currently hold: + +* with `is` methods for each of the variant kinds: `isTerm()`, `isIntervals()`, `isFuzzy()`, etc. +* with a nested `Kind` enumeration that defines all variant kinds. + +This information can then be used to navigate down into specific variants after checking their actual kind: + +```java +if (query.isTerm()) { <1> + doSomething(query.term()); +} + +switch(query._kind()) { <2> + case Term: + doSomething(query.term()); + break; + case Intervals: + doSomething(query.intervals()); + break; + default: + doSomething(query._kind(), query._get()); <3> +} +``` + +1. Test if the variant is of a specific kind. +2. Test a larger set of variant kinds. +3. Get the kind and value held by the variant object. + + + +## Custom extensions provided by {{es}} plugins [variant-types-custom] + +{{es}} accepts plugins that can extend the available variants for a number of types. This includes queries, aggregations, text analyzers and tokenizers, ingest processors, etc. + +The Java API Client classes for these types accept a `_custom` variant in addition to the builtin ones. This allows you to use these plugin-defined extensions by providing arbitrary JSON in requests, and also receive arbitrary JSON produced by the plugins in responses. + +In the examples below we use a hypothetical plugin that adds a `sphere-distance` aggregation that groups documents containing 3D coordinates according to their distance to a reference location. + +To create a custom aggregation, use the `_custom()` aggregation type and provide its identifier, defined by the plugin, and parameters. The parameters can be any object or value that can be serialized to JSON. In the example below we use a simple map: + +```java +Map params = new HashMap<>(); <1> +params.put("interval", 10); +params.put("scale", "log"); +params.put("origin", new Double[]{145.0, 12.5, 1649.0}); + +SearchRequest request = SearchRequest.of(r -> r + .index("stars") + .aggregations("neighbors", agg -> agg + ._custom("sphere-distance", params) <2> + ) +); +``` + +1. Parameters for the custom aggregation. +2. Create a custom aggregation named `neighbors` of kind `sphere-distance` with its parameters. + + +The results of custom variants are returned as raw JSON represented by a `JsonData` object. You can then traverse the JSON tree to get the data. Since this is not always convenient, you can also define classes that represent that JSON data and deserialize them from the raw JSON. + +Traversing the JSON tree: + +```java +SearchResponse response = esClient.search(request, Void.class); <1> + +JsonData neighbors = response + .aggregations().get("neighbors") + ._custom(); <2> + +JsonArray buckets = neighbors.toJson() <3> + .asJsonObject() + .getJsonArray("buckets"); + +for (JsonValue item : buckets) { + JsonObject bucket = item.asJsonObject(); + double key = bucket.getJsonNumber("key").doubleValue(); + double docCount = bucket.getJsonNumber("doc_count").longValue(); + doSomething(key, docCount); +} +``` + +1. Use `Void` if you’re only interested in aggregation results, not search hits (see also [Aggregations](/reference/aggregations.md)). +2. Get the `neighbors` aggregation result as custom JSON result. +3. Traverse the JSON tree to extract the result data. + + +Using a class that represents the custom aggregation results: + +```java +SearchResponse response = esClient.search(request, Void.class); + +SphereDistanceAggregate neighbors = response + .aggregations().get("neighbors") + ._custom() + .to(SphereDistanceAggregate.class); <1> + +for (Bucket bucket : neighbors.buckets()) { + doSomething(bucket.key(), bucket.docCount()); +} +``` + +1. Deserialize the custom JSON to a dedicated `SphereDistanceAggregate` class. + + +Where `SphereDistanceAggregate` can be defined as follows: + +```java +public static class SphereDistanceAggregate { + private final List buckets; + @JsonCreator + public SphereDistanceAggregate( + @JsonProperty("buckets") List buckets + ) { + this.buckets = buckets; + } + public List buckets() { + return buckets; + }; +} + +public static class Bucket { + private final double key; + private final double docCount; + @JsonCreator + public Bucket( + @JsonProperty("key") double key, + @JsonProperty("doc_count") double docCount) { + this.key = key; + this.docCount = docCount; + } + public double key() { + return key; + } + public double docCount() { + return docCount; + } +} +``` + +The source code for the examples above can be found in the [Java API Client tests](https://github.com/elastic/elasticsearch-java/tree/master/java-client/src/test/java/co/elastic/clients/documentation). + diff --git a/docs/release-notes/breaking-change-policy.asciidoc b/docs/release-notes/breaking-change-policy.asciidoc deleted file mode 100644 index 60974e598..000000000 --- a/docs/release-notes/breaking-change-policy.asciidoc +++ /dev/null @@ -1,30 +0,0 @@ -[[breaking-changes-policy]] -=== Breaking changes policy - -The {java-client} source code is generated from a https://github.com/elastic/elasticsearch-specification[formal specification of the Elasticsearch API]. This API specification is large, and although it is tested against hundreds of Elasticsearch test files, it may have discrepancies with the actual API that result in issues in the {java-client}. - -Fixing these discrepancies in the API specification results in code changes in the {java-client}, and some of these changes can require code updates in your applications. - -This section explains how these breaking changes are considered for inclusion in {java-client} releases. - -[discrete] -==== Breaking changes in patch releases - -Some issues in the API specification are properties that have an incorrect type, such as a `long` that should be a `string`, or a required property that is actually optional. These issues can cause the {java-client} to not work properly or even throw exceptions. - -When a specification issue is discovered and resolved, it may require code updates in applications using the {java-client}. Such breaking changes are considered acceptable, _even in patch releases_ (e.g. 7.17.0 -> 7.17.1), as they introduce stability to APIs that may otherwise be unusable. - -[discrete] -==== Breaking changes in minor releases - -Along with these bug fixes, the API specification is constantly refined, more precise type definitions are introduced to improve developer comfort and remove ambiguities. The specification of often-used APIs is fairly mature, so these changes happen generally on less often used APIs. These changes can also cause breaking changes requiring code updates which are considered _acceptable in minor releases_ (e.g. 8.0 -> 8.1). - -[discrete] -==== Breaking changes in major releases - -Major releases (e.g. 7.x -> 8.x) can include larger refactorings of the API specification and the framework underlying the {java-client}. These refactorings are considered carefully and done only when they unlock new important features or new developments. - -[discrete] -==== Elasticsearch API stability guarantees - -All Elasticsearch APIs have stability indicators, which imply potential changes. If an API is `stable` only additional non-breaking changes are added. In case of `experimental` APIs, breaking changes can be introduced any time, which means that these changes, will also be reflected in the {java-client}. diff --git a/docs/release-notes/breaking-changes.md b/docs/release-notes/breaking-changes.md new file mode 100644 index 000000000..c8f965290 --- /dev/null +++ b/docs/release-notes/breaking-changes.md @@ -0,0 +1,47 @@ +--- +navigation_title: "Breaking changes" +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/breaking-changes-policy.html +--- + +# Elasticsearch Java Client breaking changes [elasticsearch-java-client-breaking-changes] +Breaking changes can impact your Elastic applications, potentially disrupting normal operations. Before you upgrade, carefully review the Elasticsearch Java 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). + +## Breaking changes policy [elasticsearch-java-client-breaking-changes-policy] +The Java API Client source code is generated from a [formal specification of the Elasticsearch API](https://github.com/elastic/elasticsearch-specification). This API specification is large, and although it is tested against hundreds of Elasticsearch test files, it may have discrepancies with the actual API that result in issues in the Java API Client. + +Fixing these discrepancies in the API specification results in code changes in the Java API Client, and some of these changes can require code updates in your applications. + +This section explains how these breaking changes are considered for inclusion in Java API Client releases. + +### Breaking changes in patch releases [elasticsearch-java-client-breaking-changes-patch-releases] +Some issues in the API specification are properties that have an incorrect type, such as a `long` that should be a `string`, or a required property that is actually optional. These issues can cause the Java API Client to not work properly or even throw exceptions. + +When a specification issue is discovered and resolved, it may require code updates in applications using the Java API Client. Such breaking changes are considered acceptable, *even in patch releases* (e.g. 7.17.0 → 7.17.1), as they introduce stability to APIs that may otherwise be unusable. + +### Breaking changes in minor releases [elasticsearch-java-client-breaking-changes-minor-releases] +Along with these bug fixes, the API specification is constantly refined, more precise type definitions are introduced to improve developer comfort and remove ambiguities. The specification of often-used APIs is fairly mature, so these changes happen generally on less often used APIs. These changes can also cause breaking changes requiring code updates which are considered *acceptable in minor releases* (e.g. 8.0 → 8.1). + +### Breaking changes in major releases [elasticsearch-java-client-breaking-changes-major-releases] +Major releases (e.g. 7.x → 8.x) can include larger refactorings of the API specification and the framework underlying the Java API Client. These refactorings are considered carefully and done only when they unlock new important features or new developments. + +### Elasticsearch API stability guarantees [elasticsearch-java-client-api-stability-guarantees] +All Elasticsearch APIs have stability indicators, which imply potential changes. If an API is `stable` only additional non-breaking changes are added. In case of `experimental` APIs, breaking changes can be introduced any time, which means that these changes, will also be reflected in the Java API Client. + +% ## Next version [elasticsearch-java-client-versionnext-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. +% :::: + +% ## 9.0.0 [elasticsearch-java-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 diff --git a/docs/release-notes/deprecations.md b/docs/release-notes/deprecations.md new file mode 100644 index 000000000..e8cf68db2 --- /dev/null +++ b/docs/release-notes/deprecations.md @@ -0,0 +1,25 @@ +--- +navigation_title: "Deprecations" +--- +# Elasticsearch Java Client deprecations [elasticsearch-java-client-deprecations] +Over time, certain Elastic functionality becomes outdated and is replaced or removed. To help with the transition, Elastic deprecates functionality for a period before removal, giving you time to update your applications. + +Review the deprecated functionality for Elasticsearch Java Client. While deprecations have no immediate impact, we strongly encourage you update your implementation after you upgrade. To learn how to upgrade, check out [Upgrade](docs-content://deploy-manage/upgrade.md). + +% ## Next version + +% ::::{dropdown} Deprecation title +% Description of the deprecation. +% For more information, check [PR #](PR link). +% **Impact**
Impact of deprecation. +% **Action**
Steps for mitigating deprecation impact. +% :::: + +% ## 9.0.0 [elasticsearch-java-client-900-deprecations] + +% ::::{dropdown} Deprecation title +% Description of the deprecation. +% For more information, check [PR #](PR link). +% **Impact**
Impact of deprecation. +% **Action**
Steps for mitigating deprecation impact. +% :::: \ No newline at end of file diff --git a/docs/release-notes/index.asciidoc b/docs/release-notes/index.asciidoc deleted file mode 100644 index 01cd8b2cb..000000000 --- a/docs/release-notes/index.asciidoc +++ /dev/null @@ -1,9 +0,0 @@ -[[release_notes]] -== Release notes - -* <> -* <> - -include::breaking-change-policy.asciidoc[] -include::release-highlights.asciidoc[] - diff --git a/docs/release-notes/index.md b/docs/release-notes/index.md new file mode 100644 index 000000000..7ab8b0050 --- /dev/null +++ b/docs/release-notes/index.md @@ -0,0 +1,27 @@ +--- +navigation_title: "Elasticsearch Java Client" +mapped_pages: + - https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/release_notes.html +--- + +# Elasticsearch Java Client release notes [elasticsearch-java-client-release-notes] + +Review the changes, fixes, and more in each version of Elasticsearch Java 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. + +% ## version.next [felasticsearch-java-client-next-release-notes] + +% ### Features and enhancements [elasticsearch-java-client-next-features-enhancements] +% * + +% ### Fixes [elasticsearch-java-client-next-fixes] +% * + +## 9.0.0 [elasticsearch-java-client-900-release-notes] + +### Features and enhancements [elasticsearch-java-client-900-features-enhancements] + +### Fixes [elasticsearch-java-client-900-fixes] \ No newline at end of file diff --git a/docs/release-notes/known-issues.md b/docs/release-notes/known-issues.md new file mode 100644 index 000000000..de523e426 --- /dev/null +++ b/docs/release-notes/known-issues.md @@ -0,0 +1,20 @@ +--- +navigation_title: "Known issues" + +--- + +# Elasticsearch Java Client known issues [elasticsearch-java-client-known-issues] + +% Use the following template to add entries to this page. + +% :::{dropdown} Title of known issue +% **Details** +% On [Month/Day/Year], a known issue was discovered that [description of known issue]. + +% **Workaround** +% Workaround description. + +% **Resolved** +% On [Month/Day/Year], this issue was resolved. + +::: \ No newline at end of file diff --git a/docs/release-notes/release-highlights.asciidoc b/docs/release-notes/release-highlights.asciidoc deleted file mode 100644 index f76a6c1c8..000000000 --- a/docs/release-notes/release-highlights.asciidoc +++ /dev/null @@ -1,135 +0,0 @@ -[[release-highlights]] -=== Release highlights - -These are the important new features and changes in minor releases. Every release also updates the {java-client} to the latest https://github.com/elastic/elasticsearch-specification[API specification]. This includes new APIs and bug fixes in the specification of existing APIs. - -For a list of detailed changes, including bug fixes, please see the https://github.com/elastic/elasticsearch-java/releases[GitHub project realease notes]. - -[discrete] -==== Version 8.16 -* `ElasticsearchClient` is now `Closeable`. Closing a client object also closes the underlying transport - https://github.com/elastic/elasticsearch-java/pull/851[#851] - -[discrete] -==== Version 8.15 - -* New https://www.elastic.co/guide/en/elasticsearch/reference/current/connector-apis.html[Connector API] available -* Fixed bug in BulkIngester - https://github.com/elastic/elasticsearch-java/pull/830[#830] -* Various bug fixes, among which are https://github.com/elastic/elasticsearch-java/pull/844[#844], https://github.com/elastic/elasticsearch-java/pull/847[#847] -* Changed builders for queries that use generic types, for example: - -** Old RangeQuery: -+ -[source,java] ----- -RangeQuery ra = RangeQuery.of(r -> r // no distinction between various types (date, term, number) - .field("day") - .gte(JsonData.of("2024-06-20")) // must use custom json for fields because there's no defined type - .lte(JsonData.of("2024-07-05")) - .boost(1.0F) - .format("yyyy-MM-dd") - .relation(RangeRelation.Contains)); ----- -+ -** New RangeQuery: -+ -[source,java] ----- -RangeQuery ra = RangeQuery.of(r -> r - .date(d -> d // choose query type before - .field("day") - .gte("20-06-24") // field now only accepts valid type for the specified query - .lte("20-07-24") - .boost(1.0F) - .format("yyyy-MM-dd") - .relation(RangeRelation.Contains))); ----- - -[discrete] -==== Version 8.14 -* No new feature. - -[discrete] -==== Version 8.13 - -* Add ES|QL helpers - https://github.com/elastic/elasticsearch-java/pull/763[#763] -* Add an example SpringBoot application - https://github.com/elastic/elasticsearch-java/pull/737[#737] - -[discrete] -==== Version 8.12 - -* No new feature. - -[discrete] -==== Version 8.11 - -* No new feature. - -[discrete] -==== Version 8.10 - -* Add instrumentation API and native OpenTelemetry implementation - https://github.com/elastic/elasticsearch-java/pull/588[#588], <> - -[discrete] -==== Version 8.9 - -* Refactor RestClientTransport to allow using other http client libraries - https://github.com/elastic/elasticsearch-java/pull/584[#584] - -[discrete] -==== Version 8.8 - -* Throw a TransportException when an error response cannot be parsed - https://github.com/elastic/elasticsearch-java/pull/579[#579] -* Speed up URL path encoding and remove dependency on httpclient - https://github.com/elastic/elasticsearch-java/pull/576[#576] -* Add buffered lookahead and JsonData implementation for Jackson - https://github.com/elastic/elasticsearch-java/pull/489[#489], https://github.com/elastic/elasticsearch-java/pull/567[#567] -* Expose additional BulkIngester metrics - https://github.com/elastic/elasticsearch-java/pull/513[#513] -* Allow unparsed binary data to be used for ingestion - https://github.com/elastic/elasticsearch-java/pull/508[#508] - -[discrete] -==== Version 8.7 - -* Add `BulkIngester` helper - https://github.com/elastic/elasticsearch-java/pull/474[#474], https://github.com/elastic/elasticsearch-java/pull/513[#513], <> -* Allow unparsed binary data to be used for ingestion - https://github.com/elastic/elasticsearch-java/pull/508[#508], <> -* Add convenience method `BooleanQuery.hasClauses()` - https://github.com/elastic/elasticsearch-java/pull/525[#525] - - -[discrete] -==== Version 8.6 - -* Allow using `java.lang.reflect.Type` in addition to `java.lang.Class` to define application types for deserialization - https://github.com/elastic/elasticsearch-java/pull/438[#438] -* Add buffered lookahead for Jackson to speed up union deserialization - https://github.com/elastic/elasticsearch-java/pull/489[#489] -* Cache the result of `JsonProvider.provider()` - https://github.com/elastic/elasticsearch-java/pull/485[#485] - -[discrete] -==== Version 8.5 - -* Add support for API endpoints that return binary content, such as the Vector tile API - https://github.com/elastic/elasticsearch-java/pull/434[#434] -* Add support for <> - https://github.com/elastic/elasticsearch-java/pull/370[#370], https://github.com/elastic/elasticsearch-java/pull/371[#371] -* Add SSL setup helper class and <> - https://github.com/elastic/elasticsearch-java/pull/371[#390] - -[discrete] -==== Version 8.4 - -* Add troubleshooting documentation on <> - https://github.com/elastic/elasticsearch-java/pull/301[#301] -* Allow <>. This is useful in scenarios where the Java application is used as a proxy and the responses are sent back to its client - https://github.com/elastic/elasticsearch-java/pull/316[#316] - -[discrete] -==== Version 8.3 - -* Add `toString()` implementation to all value classes - https://github.com/elastic/elasticsearch-java/pull/269[#269] - -[discrete] -==== Version 8.2 - -* Add <> to all builder classes - https://github.com/elastic/elasticsearch-java/pull/316[#200] -* Add troubleshooting docs for <> - https://github.com/elastic/elasticsearch-java/pull/215[#215] -* Improve JSON mapping errors by adding location and property path in the exception message - https://github.com/elastic/elasticsearch-java/pull/237[#237] - -[discrete] -==== Version 8.1 - -* Add documentation for <> with {es} 8.x - https://github.com/elastic/elasticsearch-java/pull/230[#230] - -[discrete] -==== Version 8.0 - -* Change the JSON-P implementation from Glassfish to Parsson - https://github.com/elastic/elasticsearch-java/pull/63[#63] -* Accept `null` values in lists - https://github.com/elastic/elasticsearch-java/pull/68[#68] diff --git a/docs/release-notes/toc.yml b/docs/release-notes/toc.yml new file mode 100644 index 000000000..a41006794 --- /dev/null +++ b/docs/release-notes/toc.yml @@ -0,0 +1,5 @@ +toc: + - file: index.md + - file: known-issues.md + - file: breaking-changes.md + - file: deprecations.md \ No newline at end of file diff --git a/docs/setup/connecting.asciidoc b/docs/setup/connecting.asciidoc deleted file mode 100644 index 71b13867b..000000000 --- a/docs/setup/connecting.asciidoc +++ /dev/null @@ -1,112 +0,0 @@ -[[connecting]] -=== Connecting - -The {java-client} is structured around three main components: - -* **API client classes**. These provide strongly typed data structures and -methods for {es} APIs. Since the {es} API is large, it is structured in feature -groups (also called “namespaces”), each having its own client class. {es} core -features are implemented in the `ElasticsearchClient` class. -* **A JSON object mapper**. This maps your application classes to JSON and -seamlessly integrates them with the API client. -* **A transport layer implementation**. This is where all HTTP request handling -takes place. - -This code snippet creates and wires together these three components: - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/getting_started/ConnectingTest.java[create-client] --------------------------------------------------- - -Authentication is managed by the <>. For further details on -configuring authentication, refer to -{java-api-client}/_basic_authentication.html[its documentation]. - -[discrete] -==== Your first request - -The code snippet below searches all items from a “product” index whose name -matches “bicycle” and return them as instances of a `Product` application class. - -It illustrates the use of fluent functional builders to write search queries as -concise DSL-like code. This pattern is explained in more detail in -<>. - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/getting_started/ConnectingTest.java[first-request] --------------------------------------------------- - -[discrete] -[[using-a-secure-connection]] -==== Using a secure connection - -The <> documentation explains how to set up encrypted communications in detail. - -In self-managed installations, Elasticsearch will start with security features like authentication and TLS enabled. To connect to the Elasticsearch cluster you’ll need to configure the {java-client} to use HTTPS with the generated CA certificate in order to make requests successfully. - -When you start Elasticsearch for the first time you’ll see a distinct block like the one below in the output from Elasticsearch (you may have to scroll up if it’s been a while): - -["source","xml"] ----------------------------------------------------------------- --> Elasticsearch security features have been automatically configured! --> Authentication is enabled and cluster connections are encrypted. - --> Password for the elastic user (reset with `bin/elasticsearch-reset-password -u elastic`): - lhQpLELkjkrawaBoaz0Q - --> HTTP CA certificate SHA-256 fingerprint: - a52dd93511e8c6045e21f16654b77c9ee0f34aea26d9f40320b531c474676228 -... ----------------------------------------------------------------- - -Note down the elastic user password and HTTP CA fingerprint for the next sections. In the examples below they will be stored in the variables `password` and `fingerprint` respectively. - -Depending on the context, you have two options for verifying the HTTPS connection: either verifying with the CA certificate itself or using the CA certificate fingerprint. For both cases, the {java-client}'s `TransportUtils` class provides convenience methods to easily create an `SSLContext`. - -[discrete] -===== Verifying HTTPS with a certificate fingerprint - -This method of verifying the HTTPS connection uses the certificate fingerprint value noted down earlier. - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/getting_started/ConnectingTest.java[create-secure-client-fingerprint] --------------------------------------------------- -<1> Create an `SSLContext` with the certificate fingerprint. -<2> Set up authentication. -<3> Do not forget to set the protocol to `https`! -<4> Configure the http client with the SSL and authentication configurations. - -Note that the certificate fingerprint can also be calculated using `openssl x509` with the certificate file: -["source","bash"] --------------------------------------------------- -openssl x509 -fingerprint -sha256 -noout -in /path/to/http_ca.crt --------------------------------------------------- - -If you don’t have access to the generated CA file from Elasticsearch you can use the following script to output the root CA fingerprint of the Elasticsearch instance with `openssl s_client`: - -["source","bash"] --------------------------------------------------- -openssl s_client -connect localhost:9200 -servername localhost -showcerts /dev/null \ - | openssl x509 -fingerprint -sha256 -noout -in /dev/stdin --------------------------------------------------- - -[discrete] -===== Verifying HTTPS with a CA certificate - -The generated root CA certificate can be found in the `certs` directory in your Elasticsearch config location. If you’re running Elasticsearch in Docker there is {es-docs}/docker.html[additional documentation] for retrieving the CA certificate. - -Once you have made the `http_ca.crt` file available to your application, you can use it to set up the client: - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/getting_started/ConnectingTest.java[create-secure-client-cert] --------------------------------------------------- -<1> Create an `SSLContext` with the `http_ca.crt` file. -<2> Set up authentication. -<3> Do not forget to set the protocol to `https`! -<4> Configure the http client with the SSL and authentication configurations. - -{doc-tests-blurb} diff --git a/docs/setup/index.asciidoc b/docs/setup/index.asciidoc deleted file mode 100644 index c7a47f6e0..000000000 --- a/docs/setup/index.asciidoc +++ /dev/null @@ -1,14 +0,0 @@ -== Setup - -* <> -* <> -* <> -* <> -* <> - -include::installation.asciidoc[] -include::connecting.asciidoc[] -include::migrate-hlrc.asciidoc[] -include::open-telemetry.asciidoc[] - -// include::low-level.asciidoc[leveloffset=+2] diff --git a/docs/setup/installation.asciidoc b/docs/setup/installation.asciidoc deleted file mode 100644 index 5fbd4460f..000000000 --- a/docs/setup/installation.asciidoc +++ /dev/null @@ -1,104 +0,0 @@ -[[installation]] -=== Installation - -Requirements: - -* Java 8 or later. -* A JSON object mapping library to allow seamless integration of - your application classes with the Elasticsearch API. The Java client has - support for https://github.com/FasterXML/jackson[Jackson] or a - https://github.com/eclipse-ee4j/jsonb-api[JSON-B] library like - https://github.com/eclipse-ee4j/yasson[Eclipse Yasson]. - - -Releases are hosted on -https://search.maven.org/search?q=g:co.elastic.clients[Maven Central]. If you -are looking for a SNAPSHOT version, the Elastic Maven Snapshot repository is -available at https://snapshots.elastic.co/maven/. - - -[discrete] -[[gradle]] -==== Installation in a Gradle project by using Jackson - -["source","groovy",subs="attributes+"] --------------------------------------------------- -dependencies { - implementation 'co.elastic.clients:elasticsearch-java:{version}' - implementation 'com.fasterxml.jackson.core:jackson-databind:2.17.0' -} --------------------------------------------------- - -[discrete] -[[maven]] -==== Installation in a Maven project by using Jackson - -In the `pom.xml` of your project, add the following repository definition and -dependencies: - -["source","xml",subs="attributes+"] --------------------------------------------------- - - - - - co.elastic.clients - elasticsearch-java - {version} - - - - com.fasterxml.jackson.core - jackson-databind - 2.17.0 - - - - --------------------------------------------------- - - -[discrete] -[[class-not-found-jsonprovider]] -==== If you get ClassNotFoundException: jakarta.json.spi.JsonProvider - -It may happen that after setting up the dependencies, your application fails with `ClassNotFoundException: jakarta.json.spi.JsonProvider`. - -If this happens, you have to explicitly add the `jakarta.json:jakarta.json-api:2.0.1` dependency. - -.Gradle: -["source","groovy",subs="attributes+"] --------------------------------------------------- -dependencies { - ... - implementation 'jakarta.json:jakarta.json-api:2.0.1' -} --------------------------------------------------- - -.Maven: -["source","xml",subs="attributes+"] --------------------------------------------------- - - - ... - - jakarta.json - jakarta.json-api - 2.0.1 - - - - --------------------------------------------------- - -**Why is this needed?** - -Some frameworks like Spring Boot or Helidon come with their Gradle and Maven plugins or their Maven BOM files to ease development and dependency management. These plugins and BOM define the versions to use for a number of well-known libraries. - -One of these libraries can be `jakarta.json:json-api` that defines the standard Java JSON API. In version `1.x` this library used the `javax.json` package, while in version `2.x` it uses the `jakarta.json` package after https://blogs.oracle.com/javamagazine/post/transition-from-java-ee-to-jakarta-ee[the transition from JavaEE to JakartaEE]. - -The {java-client} depends on version `2.0.1` of this library, in order to use the newer and future-proof `jakarta.json` package. But some build plugins and BOMs override the {java-client}'s dependency to use version `1.x` in the older `javax.json` namespace, resulting in `ClassNotFoundException: jakarta.json.spi.JsonProvider`. - -Adding the correct version as top-level project dependency solves the problem. - -If your application also requires `javax.json` you can add the `javax.json:javax.json-api:1.1.4` dependency, which is equivalent to `jakarta.json:jakarta.json-api:1.1.6`. diff --git a/docs/setup/migrate-hlrc.asciidoc b/docs/setup/migrate-hlrc.asciidoc deleted file mode 100644 index b37c65be1..000000000 --- a/docs/setup/migrate-hlrc.asciidoc +++ /dev/null @@ -1,65 +0,0 @@ -[[migrate-hlrc]] -=== Migrating from the High Level Rest Client - -The {es} Java API Client is an entirely new client library that has no relation -to the older High Level Rest Client (HLRC). This was a deliberate choice to -provide a library that is independent from the {es} server code and that -provides a very consistent and easier to use API for all {es} features. - -Migrating from the HLRC therefore requires some code rewrite in your -application. This transition can however happen progressively as the two client -libraries can coexist in a single application with no operational overhead. - -[discrete] -==== Compatibility mode: using a 7.17 client with {es} 8.x -The HLRC version `7.17` can be used with {es} version `8.x` by enabling -HLRC's compatibility mode (see code sample below). In this mode HLRC sends -additional headers that instruct {es} `8.x` to behave like a `7.x` server. - -The {java-client} doesn't need this setting as compatibility mode is always -enabled. - -You can use the HLRC version `7.x` with the {java-client} version `8.x`: - -["source","groovy",subs="attributes+"] --------------------------------------------------- -dependencies { - implementation 'co.elastic.clients:elasticsearch-java:{version}' - implementation 'org.elasticsearch.client:elasticsearch-rest-high-level-client:7.17.4' - // other dependencies <1> -} --------------------------------------------------- -<1> See <> - -[discrete] -==== Using the same http client with the HLRC and the Java API Client - -To avoid any operational overhead during the transition phase where an -application would use both the HLRC and the new Java API Client, both clients -can share the same Low Level Rest Client, which is the network layer that -manages all connections, round-robin strategies, node sniffing, and so on. - -The code below shows how to initialize both clients with the same HTTP client: - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/getting_started/MigrateHlrcTest.java[migrate] --------------------------------------------------- -<1> Enables compatibility mode that allows HLRC `7.17` to work with {es} `8.x`. - -[discrete] -==== Transition strategies - -There are different ways you can start transitioning away from the HLRC in your -application code. - -For example: - -* keep the existing code as-is and use the new Java API Client for new features - in your application, then later migrate the existing code, -* rewrite the parts of your application where the new Java API Client is much - easier to use than that of the HLRC, like everything related to search, -* rewrite those parts where you need to map application objects to/from JSON, by - leveraging the tight integration of the new Java API Client with JSON object - mappers. - diff --git a/docs/setup/open-telemetry.asciidoc b/docs/setup/open-telemetry.asciidoc deleted file mode 100644 index dd34fe8f0..000000000 --- a/docs/setup/open-telemetry.asciidoc +++ /dev/null @@ -1,73 +0,0 @@ -[[opentelemetry]] -=== Using OpenTelemetry - -You can use https://opentelemetry.io/[OpenTelemetry] to monitor the performance and behavior of your Elasticsearch requests through the Java API Client. -The Java API Client comes with built-in OpenTelemetry instrumentation that emits https://www.elastic.co/guide/en/apm/guide/current/apm-distributed-tracing.html[distributed tracing spans] by default. -With that, applications https://opentelemetry.io/docs/instrumentation/java/manual/[instrumented with OpenTelemetry] or running the https://opentelemetry.io/docs/instrumentation/java/automatic/[OpenTelemetry Java Agent] are inherently enriched with additional spans that contain insightful information about the execution of the Elasticsearch requests. - -The native instrumentation in the Java API Client follows the https://opentelemetry.io/docs/specs/semconv/database/elasticsearch/[OpenTelemetry Semantic Conventions for Elasticsearch]. In particular, the instrumentation in the client covers the logical Elasticsearch request layer, thus, creates a single span per request the service executes against the Java API Client. The following image shows a resulting trace in which three different Elasticsearch requests are executed, i.e. an `index`, `get` and a search `request`: - -[role="screenshot"] -image::images/otel-waterfall-instrumented-without-http.jpg[alt="Distributed trace with Elasticsearch spans",align="center"] - -Usually, OpenTelemetry agents and auto-instrumentation modules come with instrumentation support for HTTP-level communication. In this case, in addition to the logical Elasticsearch client requests, spans will be captured for the physical HTTP requests emitted by the client. The following image shows a trace with both, Elasticsearch spans (in blue) and the corresponding HTTP-level spans (in red): - -[role="screenshot"] -image::images/otel-waterfall-instrumented.jpg[alt="Distributed trace with Elasticsearch and HTTP spans",align="center"] - -Advanced Java API Client behavior such as nodes round-robin and request retries are revealed through the combination of logical Elasticsearch spans and the physical HTTP spans. The following example shows an `index` request in a scenario with two Elasticsearch nodes: - -[role="screenshot"] -image::images/otel-waterfall-retries.jpg[alt="Distributed trace with request retries",align="center"] - -The first node is unavailable and results in an HTTP error, while the retry to the second node succeeds. Both HTTP requests are subsumed by the logical Elasticsearch request span (in blue). - -[discrete] -==== Setup the OpenTelemetry instrumentation -When using the https://opentelemetry.io/docs/instrumentation/java/manual[OpenTelemetry Java SDK manually] or using the https://opentelemetry.io/docs/instrumentation/java/automatic/[OpenTelemetry Java Agent], the Java API Client's OpenTelemetry instrumentation is enabled by default and uses the _globally_ registered OpenTelemetry SDK instance (i.e. `GlobalOpenTelemetry`). So, if you don't use a custom, local OpenTelemetry SDK instance, there is no explicit setup required to use the Java API Client's OpenTelemetry instrumentation. - -[discrete] -===== Using a custom OpenTelemetry instance -In case you are using https://opentelemetry.io/docs/instrumentation/java/manual/#example[manual OpenTelemetry instrumentation] with a custom OpenTelemetry SDK instance that is _not registered globally_, you can create the Java API Client using a custom OpenTelemetry instance. The following code snippet shows an example of using a custom OpenTelemetry instance. - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/getting_started/ConnectingTest.java[create-client-otel] --------------------------------------------------- - -[discrete] -==== Configuring the OpenTelemetry instrumentation - -You can configure the OpenTelemetry instrumentation either through Java System properties or Environment Variables. -The following configuration options are available. - -[discrete] -[[opentelemetry-config-enable]] -===== Enable / Disable the OpenTelemetry instrumentation - -With this configuration option you can enable (default) or disable the built-in OpenTelemetry instrumentation. - -**Default:** `true` - -|============ -| Java System Property | `otel.instrumentation.elasticsearch.enabled` -| Environment Variable | `OTEL_INSTRUMENTATION_ELASTICSEARCH_ENABLED` -|============ - -[discrete] -===== Capture search request bodies - -Per default, the built-in OpenTelemetry instrumentation does not capture request bodies because of data privacy reasons. You can use this option to enable capturing of search queries from the the request bodies of Elasticsearch search requests in case you wish to capture this information, regardless. - -**Default:** `false` - -|============ -| Java System Property | `otel.instrumentation.elasticsearch.capture-search-query` -| Environment Variable | `OTEL_INSTRUMENTATION_ELASTICSEARCH_CAPTURE_SEARCH_QUERY` -|============ - -[discrete] -==== Overhead -The OpenTelemetry instrumentation (as any other monitoring approach) may come with a little overhead on CPU, memory and/or latency. The overhead may only occur when the instrumentation is enabled (default) and an OpenTelemetry SDK (or an OpenTelemetry Agent) is active in the target application. In case that either the instrumentation is disabled or no OpenTelemetry SDK (or OpenTelemetry Agent) is active with the target application, there is no monitoring overhead expected when using the client. - -Even when the instrumentation is enabled and is being actively used (by an OpenTelemetry SDK), in the vast majority of cases the overhead is very small and negligible. In edge cases in which there is a noticable overhead the <> to eliminate any potential overhead effect of the instrumentation. diff --git a/docs/troubleshooting/index.asciidoc b/docs/troubleshooting/index.asciidoc deleted file mode 100644 index 0fb11a41d..000000000 --- a/docs/troubleshooting/index.asciidoc +++ /dev/null @@ -1,29 +0,0 @@ -[[troubleshooting]] -== Troubleshooting - -// * <> -// * <> - -[discrete] -=== Exceptions - -* <> -* <> -* <> - -[discrete] -=== Miscellaneous - -* <> - -// [[debugging]] -// === Debugging - -//[[deprecation-warnings]] -// === Elasticsearch deprecation warnings - -include::missing-required-property.asciidoc[] -include::no-such-method-request-options.asciidoc[] -include::io-reactor-errors.asciidoc[] - -include::serialize-without-typed-keys.asciidoc[] diff --git a/docs/troubleshooting/io-reactor-errors.asciidoc b/docs/troubleshooting/io-reactor-errors.asciidoc deleted file mode 100644 index 8146646ff..000000000 --- a/docs/troubleshooting/io-reactor-errors.asciidoc +++ /dev/null @@ -1,33 +0,0 @@ -[[io-reactor-errors]] -=== Apache http-client I/O reactor errors - -Sending requests can sometimes fail with one of the following errors, coming from the Apache http-client library: - -* `Request cannot be executed; I/O reactor status: STOPPED` -* `I/O reactor terminated abnormally` -* `I/O reactor has been shut down` - -The I/O Reactor is the internal event loop in the http client library. It can terminate when an application callback throws an `Error`, like an `OutOfMemoryError` or a `StackOverflowError`. Remember that `Error` is different from a regular `Exception` and – https://docs.oracle.com/javase/8/docs/api/?java/lang/Error.html[quoting the Java documentation] – _indicates serious problems that a reasonable application should not try to catch_. - -In the context of the Elasticsearch Java clients, this can happen on two occasions: - -* the application calls the low level `RestClient` directly, using the asynchronous `performRequestAsync` method, and an `Error` is thrown in the `ResponseListener` provided by the application. -* an `OutOfMemoryError` happens while buffering the body of an http response. - -In the first case, it is the application's responsibility to catch `Error` in its `ResponseListener` and decide what to do when these errors happen. - -The second case is taken care of in the {java-client} since version 8.12: the error is wrapped in a `RuntimeException` that is reported to the application. - -In previous versions of the {java-client}, you can copy/paste the `SafeResponseConsumer` class in your project and initialize the `RestClientTransport` as follows: - -["source","java"] ------- -RestClient restClient = ... -JsonpMapper mapper = ... -RestClientOptions options = new RestClientOptions( - SafeResponseConsumer.DEFAULT_REQUEST_OPTIONS -); -RestClientTransport transport = new RestClientTransport( - restClient, mapper, options -); ------- diff --git a/docs/troubleshooting/missing-required-property.asciidoc b/docs/troubleshooting/missing-required-property.asciidoc deleted file mode 100644 index a338b35d1..000000000 --- a/docs/troubleshooting/missing-required-property.asciidoc +++ /dev/null @@ -1,38 +0,0 @@ -[[missing-required-property]] -=== `MissingRequiredPropertyException` in a response - -The {java-client} distinguishes optional and required properties. Optional properties are marked with the `@Nullable` annotation. - -When an API object is built and a required property hasn't been set, a `MissingRequiredPropertyException` is thrown. This applies both to request object built by your application and to response objects returned by Elasticsearch, so that you can be assured that a property that does not have the `@Nullable` annotation will never be `null`. - -However, there may be bugs in the https://github.com/elastic/elasticsearch-specification[Elasticsearch API specification] where a response object's property is incorrectly required, leading to a `MissingRequiredPropertyException` when deserializing a response. If this happens, here's how you can work around it: - -* Make sure you use the latest release of the {java-client}. The issue may already have been fixed. -* If the issue is still present on the latest version, https://github.com/elastic/elasticsearch-java/issues/new/choose[open an issue] so that we can fix it in the next release. Please help us to improve the {java-client}. -* Temporarily disable required property checks for the offending request: - -WARNING: This is a workaround. Do not consider this as a permanent solution, and please https://github.com/elastic/elasticsearch-java/issues/new/choose[open an issue] so that the problem can be fixed in a future release. - -["source","java"] --------------------------------------------------- - ApiTypeHelper.DANGEROUS_disableRequiredPropertiesCheck(true); - SomeRequest request = SomeRequest.of(...); - SomeResponse response = esClient.someApi(request); - ApiTypeHelper.DANGEROUS_disableRequiredPropertiesCheck(false); - // Do something with response -} --------------------------------------------------- - -The `DANGEROUS_disableRequiredPropertiesCheck` method disables required property checks on the current thread, and for response deserialization in asynchronous requests. As its name implies, it is dangerous as it removes the guarantees of properties that are not `@Nullable`. This is a temporary workaround until the issue is fixed. - -Note that the result of this method is an `AutoCloseable` object that resets required property checks to its previous setting. You can therefore use it in a try-with-resource block as follows: - -["source","java"] --------------------------------------------------- -try (ApiTypeHelper.DisabledChecksHandle h = - ApiTypeHelper.DANGEROUS_disableRequiredPropertiesCheck(true)) { - SomeRequest request = SomeRequest.of(...); - SomeResponse response = esClient.someApi(request); - // Do something with response -} --------------------------------------------------- diff --git a/docs/troubleshooting/no-such-method-request-options.asciidoc b/docs/troubleshooting/no-such-method-request-options.asciidoc deleted file mode 100644 index 942f79588..000000000 --- a/docs/troubleshooting/no-such-method-request-options.asciidoc +++ /dev/null @@ -1,36 +0,0 @@ - -[[no-such-method-request-options]] -=== `NoSuchMethodError RequestOptions$Builder.removeHeader` when creating a client - -In certain contexts you may encounter an error when creating the `ElasticsearchClient` saying that the method `RequestOptions$Builder.removeHeader` does not exist: - -["source","java"] --------------------------------------------------- -java.lang.NoSuchMethodError: 'org.elasticsearch.client.RequestOptions$Builder org.elasticsearch.client.RequestOptions$Builder.removeHeader(java.lang.String)' --------------------------------------------------- - -This method was introduced in `elasticsearch-rest-client` version 7.16.0. The error happens because your project is using an older version of this dependency. - -This happens in particular when the project is using the https://docs.spring.io/spring-boot/docs/current/maven-plugin/reference/htmlsingle/[Spring Boot Maven Plugin], as this plugin https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot-dependencies/build.gradle[defines versions for commonly used libraries], including `elasticsearch-rest-client`. Depending on the version of Spring Boot used in the project, that version may be outdated. - -To solve this issue, you have to add the `elasticsearch-rest-client` dependency explicitly in your project, with the same version as `elasticsearch-java` (see also <>). - -Using Gradle: - -["source","groovy",subs="attributes+"] --------------------------------------------------- -implementation 'org.elasticsearch.client:elasticsearch-rest-client:{version}' --------------------------------------------------- - - -Using Maven: - -["source","xml",subs="attributes+"] --------------------------------------------------- - - org.elasticsearch.client - elasticsearch-rest-client - {version} - --------------------------------------------------- - diff --git a/docs/troubleshooting/serialize-without-typed-keys.asciidoc b/docs/troubleshooting/serialize-without-typed-keys.asciidoc deleted file mode 100644 index 0d39c178d..000000000 --- a/docs/troubleshooting/serialize-without-typed-keys.asciidoc +++ /dev/null @@ -1,24 +0,0 @@ -[[serialize-without-typed-keys]] -=== Serializing aggregations and suggestions without typed keys - -{es} search requests accept a `typed_key` parameter that allow returning type information along with the name in aggregation and suggestion results (see the {es-docs}/search-aggregations.html#return-agg-type[aggregations documentation] for additional details). - -The {java-client} always adds this parameter to search requests, as type information is needed to know the concrete class that should be used to deserialize aggregation and suggestion results. - -Symmetrically, the {java-client} also serializes aggregation and suggestion results using this `typed_keys` format, so that it can correctly deserialize the results of its own serialization. - -["source","java"] --------------------------------------------------- -ElasticsearchClient esClient = ... -include-tagged::{doc-tests-src}/troubleshooting/TroubleShootingTests.java[aggregation-typed-keys] --------------------------------------------------- - -However, in some use cases serializing objects in the `typed_keys` format may not be desirable, for example when the {java-client} is used in an application that acts as a front-end to other services that expect the default format for aggregations and suggestions. - -You can disable `typed_keys` serialization by setting the `JsonpMapperFeatures.SERIALIZE_TYPED_KEYS` attribute to `false` on your mapper object: - -["source","java"] --------------------------------------------------- -ElasticsearchClient esClient = ... -include-tagged::{doc-tests-src}/troubleshooting/TroubleShootingTests.java[aggregation-no-typed-keys] --------------------------------------------------- diff --git a/docs/usage/aggregations.asciidoc b/docs/usage/aggregations.asciidoc deleted file mode 100644 index 51c64b341..000000000 --- a/docs/usage/aggregations.asciidoc +++ /dev/null @@ -1,40 +0,0 @@ -[[aggregations]] -=== Aggregations - -An aggregation summarizes your data as metrics, statistics, or other analytics. - -NOTE: See the {es-docs}/search-aggregations.html[{es} documentation] for a full explanation of aggregations. - -[discrete] -==== A simple aggregation - -In the example below we run an aggregation that creates a price histogram from a product index, for the products whose name match a user-provided text. To achieve this, we use a search request that has a query (explained in <>) and an aggregation definition. - -This example is an analytics-type aggregation where we do not want to use the matching documents. A general pattern for search requests used for analytics is to set the result `size` to zero and the target class for search results to `Void`. - -If that same aggregation was used for to display products and the price histogram as drill-down facets, we would have set `size` to a non-zero value and used `Product` as the target class to process the results. - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/usage/AggregationsTest.java[price-histo-request] --------------------------------------------------- -<1> Set the number of matching documents to zero as we only use the price histogram. -<2> Set the query that fill filter the products on which to run the aggregation -<3> Create an aggregation named "price-histogram". You can add as many named aggregations as needed. -<4> Select the `histogram` aggregation variant. -<5> We do not care about matches (`size` is set to zero), using `Void` will ignore any document in the response. - -The response contains an aggregation result for each aggregation in the request. - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/usage/AggregationsTest.java[price-histo-response] --------------------------------------------------- -<1> Get the results for the "price-histogram" aggregation. -<2> Cast it down to the `histogram` variant results. This has to be consistent with the aggregation definition. -<3> Buckets can be expressed as arrays or maps. This casts down to the array variant (the default). - - -// TODO: nested aggregations - -{doc-tests-blurb} diff --git a/docs/usage/esql.asciidoc b/docs/usage/esql.asciidoc deleted file mode 100644 index 865eba69a..000000000 --- a/docs/usage/esql.asciidoc +++ /dev/null @@ -1,131 +0,0 @@ -[[esql]] -=== ES|QL in the Java client - -This page helps you understand and use {ref}/esql.html[ES|QL] in the -Java client. - -There are two ways to use ES|QL in the {java-client}: - -* Use the Elasticsearch {es-docs}/esql-apis.html[ES|QL API] directly: This -is the most flexible approach, but it's also the most complex because you must handle -results in their raw form. You can choose the precise format of results, -such as JSON, CSV, or text. -* Use ES|QL mapping helpers: These mappers take care of parsing the raw -response into something readily usable by the application. Several mappers are -available for different use cases, such as object mapping, cursor -traversal of results, and dataframes. You can also define your own mapper for specific -use cases. - - - -[discrete] -[[esql-how-to]] -==== How to use the ES|QL API - -The {es-docs}/esql-query-api.html[ES|QL query API] allows you to specify how -results should be returned. You can choose a -{es-docs}/esql-rest.html#esql-rest-format[response format] such as CSV, text, or -JSON, then fine-tune it with parameters like column separators -and locale. - -Because the response varies widely depending on the format, the -{java-client} has a BinaryData object you can use according to the -format specified in the request. - -The following example gets ES|QL results as CSV and parses them: - -[source,java] ------------------------------------- -String queryAuthor = - """ - from books - | where author == "Isaac Asimov" - | sort year desc - | limit 10 - """; - -BinaryResponse response = client.esql().query(q -> q - .format("csv") - .delimiter(",") - .query(queryAuthor)); - -String result = new BufferedReader(new InputStreamReader(response.content())) - .lines().collect(Collectors.joining("\n")); ------------------------------------- - - -[discrete] -[[esql-consume-results]] -==== Consume ES|QL results - -The previous example showed that although the raw ES|QL API offers maximum -flexibility, additional work is required in order to make use of the -result data. - -To simplify things, try working with these three main representations of ES|QL -results (each with its own mapping helper): - -* **Objects**, where each row in the results is mapped to an object from your -application domain. This is similar to what ORMs (object relational mappers) -commonly do. -+ --- - -[source,java] ------------------------------------- -List queryRes = (List) client.esql().query(ObjectsEsqlAdapter.of(Book.class), queryAuthor); - ------------------------------------- --- -* **Cursors**, where you scan the results row by row and access the data using -column names. This is similar to database access libraries. -+ --- -[source,java] ------------------------------------- -ResultSet resultSet = client.esql().query(ResultSetEsqlAdapter.INSTANCE, queryAuthor); ------------------------------------- --- - - -[discrete] -[[esql-custom-mapping]] -==== Define your own mapping - -Although the mappers provided by the {java-client} cover many use cases, your -application might require a custom mapping. -You can write your own mapper and use it in a similar way as the -built-in ones. - -Note that mappers are meant to provide a more usable representation of ES|QL -results—not to process the result data. Data processing should be based on -the output of a result mapper. - -Here's an example mapper that returns a simple column-oriented -representation of the data: - -[source,java] ------------------------------------- -public class CustomStringAdapter extends EsqlAdapterBase { - - public static final CustomStringAdapter INSTANCE = new CustomStringAdapter(); - - @Override - public String format() { - return "json"; - } - - @Override - public boolean columnar() { - return true; - } - - @Override - public String deserialize(ApiClient client, QueryRequest request, - BinaryResponse response) - throws IOException { - return new BufferedReader(new InputStreamReader(response.content())) - .lines().collect(Collectors.joining("\n")); - } -} ------------------------------------- diff --git a/docs/usage/index.asciidoc b/docs/usage/index.asciidoc deleted file mode 100644 index 854ef8ab4..000000000 --- a/docs/usage/index.asciidoc +++ /dev/null @@ -1,33 +0,0 @@ -[[usage]] -== Using the Java API Client - -The sections below provide tutorials on the most frequently used and some less obvious features of {es}. - -For a full reference, see the {es-docs}/[Elasticsearch documentation] and in particular the {es-docs}/rest-apis.html[REST APIs] section. The {java-client} follows closely the JSON structures described there, using the <>. - -If you're new to Elasticsearch, make sure also to read {es-docs}/getting-started.html[Elasticsearch's quick start] that provides a good introduction. - -* <> -* <> -* <> -* <> -* <> -* <> - -//// -* <> -//// - -NOTE: This is still a work in progress, more sections will be added in the near future. - -include::esql.asciidoc[] -include::indexing.asciidoc[] -include::indexing-bulk.asciidoc[] -include::reading.asciidoc[] -include::searching.asciidoc[] -include::aggregations.asciidoc[] - -//// -include::indices.asciidoc[] -//// - diff --git a/docs/usage/indexing-bulk.asciidoc b/docs/usage/indexing-bulk.asciidoc deleted file mode 100644 index b289ed6d0..000000000 --- a/docs/usage/indexing-bulk.asciidoc +++ /dev/null @@ -1,91 +0,0 @@ -[[indexing-bulk]] -=== Bulk: indexing multiple documents - -Bulk requests allow sending multiple document-related operations to {es} in one request. When you have multiple documents to ingest, this is more efficient than sending each document with a separate request. - -A bulk request can contain several kinds of operations: - -* create a document, indexing it after ensuring it doesn't already exist, -* index a document, creating it if needed and replacing it if it exists, -* update a document that already exists in place, either with a script or a partial document, -* delete a document. - -NOTE: See the {es-docs}/docs-bulk.html[{es} API documentation] for a full explanation of bulk requests. - -[discrete] -==== Indexing application objects - -A `BulkRequest` contains a collection of operations, each operation being a <>. To create this request, it is convenient to use a builder object for the main request, and the fluent DSL for each operation. - -The example below shows how to index a list or application objects. - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/usage/IndexingBulkTest.java[bulk-objects] --------------------------------------------------- -<1> Adds an operation (remember that <>). `op` is is a builder for `BulkOperation` which is a <>. This type has `index`, `create`, `update` and `delete` variants. -<2> Selects the `index` operation variant, `idx` is a builder for `IndexOperation`. -<3> Sets the properties for the index operation, similar to <>: index name, identifier and document. - -[discrete] -[[indexing-raw-json-data]] -==== Indexing raw JSON data - -The `document` property of a bulk index request can be any object that can be serialized to JSON using your Elasticsearch client's JSON mapper. However, data that is ingested in bulk is often available as JSON text (e.g. files on disk), and parsing this JSON just to re-serialize it to send the bulk request would be a waste of resources. So documents in bulk operations can also be of type `BinaryData` that are sent verbatim (without parsing) to the {es} server. - -In the example below we will use the {java-client}'s `BinaryData` to read json files from a log directory and send them in a bulk request. - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/usage/IndexingBulkTest.java[bulk-json] --------------------------------------------------- - -[discrete] -==== Streaming ingestion with the Bulk Ingester - -The `BulkIngester` simplifies the usage of the Bulk API by providing a utility class that allows index/update/delete operations to be transparently grouped in bulk requests. You only have to `add()` bulk operations to the ingester and -it will take care of grouping and sending them in bulk according to its configuration. - -The ingester will send a bulk request when one of the following criteria is met: - -- the number of operations exceeds a maximum (defaults to 1000) -- the bulk request size in bytes exceeds a maximum (defaults to 5 MiB) -- a delay since the last request has expired (periodic flush, no default) - -Additionally, you can define a maximum number of concurrent request waiting to be executed by {es} (defaults to 1). When that maximum is reached and the maximum number of operations have been collected, adding a new operation to the indexer will block. This is avoids overloading the {es} server by putting backpressure on the client application. - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/usage/IndexingBulkTest.java[bulk-ingester-setup] --------------------------------------------------- -<1> Sets the {es} client used to send bulk requests. -<2> Sets the maximum number of operations to collect before sending a bulk request. -<3> Sets the flush interval. -<4> Adds a bulk operation to the ingester. -<5> Closes the ingester to flush the pending operations and release resources. - -Additionally, the bulk ingester accepts a listener so that your application can be notified of bulk requests that are -sent and their result. To allow correlating bulk operations to application context, the `add()` method optionally -accepts a `context` parameter. The type of this context parameter is used as the generic parameter of the `BulkIngester` -object. You may have noticed the `Void` type in `BulkIngester` above: this is because we did not register a listener, -and therefore did not care about context values. - -The following example shows how you can use context values to implement a bulk ingestion listener: as previously it -sends JSON log files in bulk, but tracks bulk request errors and failed operations. When an operation fails, depending on the error type you may want to re-add it to the ingester. - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/usage/IndexingBulkTest.java[bulk-ingester-context] --------------------------------------------------- -<1> Creates a listener where context values are strings for the ingested file name. -<2> Registers the listener on the bulk ingester. -<3> Sets the file name as the context value for a bulk operation. - -The bulk ingest also exposes statistic information that allows monitoring the ingestion process and tune its configuration: - -- number of operations added, -- number of calls to `add()` that were blocked because the maximum number of concurrent requests was reached (contention), -- number of bulk requests sent, -- number of bulk requests that were blocked because the maximum number of concurrent requests was reached. - -{doc-tests-blurb} diff --git a/docs/usage/indexing.asciidoc b/docs/usage/indexing.asciidoc deleted file mode 100644 index f6bc7446a..000000000 --- a/docs/usage/indexing.asciidoc +++ /dev/null @@ -1,61 +0,0 @@ -[[indexing]] -=== Indexing single documents - -The {java-client} offers several ways to index data: you can provide application objects that will be automatically mapped to JSON, or you can provide raw JSON data. Using application objects is more suited to applications with a well-defined domain model, whereas raw JSON is more suited to logging use cases with semi-structured data. - -In the examples below we use a `Product` domain object that has `sku`, `name` and `price` properties. - -NOTE: See the {es-docs}/docs-index_.html[{es} API documentation] for a full explanation of index requests. - -[discrete] -==== Using the fluent DSL - -The most direct way to build requests is using the fluent DSL. In the example below we index a product description in the `products` index, using the product's SKU as the document identifier in the index. The `product` object will be mapped to JSON using the object mapper configured on the {es} client. - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/usage/IndexingTest.java[single-doc-dsl] --------------------------------------------------- - -You can also assign objects created with the DSL to variables. {java-client} classes have a static `of()` method for this, that creates an object with the DSL syntax. - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/usage/IndexingTest.java[single-doc-dsl-of] --------------------------------------------------- - -[discrete] -==== Using classic builders - -If you're more used to the classic builder pattern, it is also available. Builder objects are used under the hood by the fluent DSL syntax. - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/usage/IndexingTest.java[single-doc-builder] --------------------------------------------------- - -[discrete] -==== Using the asynchronous client - -The examples above used the synchronous {es} client. All {es} APIs are also available in the asynchronous client, using the same request and response types. See also <> for additional details. - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/usage/IndexingTest.java[single-doc-dsl-async] --------------------------------------------------- - -[discrete] -==== Using raw JSON data - -When the data you want to index comes from external sources, having to create domain objects may be cumbersome or outright impossible with semi-structured data. - -You can index data from an arbitrary source using `withJson()`. Using this method will read the source and use it for the index request's `document` property. See <> for additional details. - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/usage/IndexingTest.java[single-doc-json] --------------------------------------------------- - -// TODO: Add an example with version conflict detection - -{doc-tests-blurb} diff --git a/docs/usage/indices.asciidoc b/docs/usage/indices.asciidoc deleted file mode 100644 index f5416f7e9..000000000 --- a/docs/usage/indices.asciidoc +++ /dev/null @@ -1,4 +0,0 @@ -[[indices]] -=== Creating and managing indices - -TBD diff --git a/docs/usage/reading.asciidoc b/docs/usage/reading.asciidoc deleted file mode 100644 index ab47662f3..000000000 --- a/docs/usage/reading.asciidoc +++ /dev/null @@ -1,40 +0,0 @@ -[[reading]] -=== Reading documents by id - -Elasticsearch is all about search, but you may also want to access documents directly, knowing their identifier. The "get" request is meant for this. - -NOTE: See the {es-docs}/docs-get.html[{es} API documentation] for a full explanation of get requests. - -[discrete] -==== Reading a domain object - -The example below reads the document with identifier `bk-1` from the `products` index. - -The `get` request has two parameters: - -* the first parameter is the actual request, built below with the fluent DSL -* the second parameter is the class we want the document's JSON to be mapped to. - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/usage/ReadingTest.java[get-by-id] --------------------------------------------------- -<1> The get request, with the index name and identifier. -<2> The target class, here `Product`. - -[discrete] -==== Reading raw JSON - -When your index contains semi-structured data or if you don't have a domain object definition, you can also read the document as raw JSON data. - -Raw JSON data is just another class that you can use as the result type for the get request. In the example below we use Jackson's `ObjectNode`. We could also have used any JSON representation that can be deserialized by the JSON mapper associated to the `ElasticsearchClient`. - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/usage/ReadingTest.java[get-by-id-json] --------------------------------------------------- -<1> The target class is a raw JSON object. - -{doc-tests-blurb} - - diff --git a/docs/usage/searching.asciidoc b/docs/usage/searching.asciidoc deleted file mode 100644 index c87ff3e75..000000000 --- a/docs/usage/searching.asciidoc +++ /dev/null @@ -1,71 +0,0 @@ -[[searching]] -=== Searching for documents - -Indexed documents are available for search in near real-time. - -NOTE: See the {es} documentation for a full explanation of search requests: {es-docs}/search-your-data.html[search your data], {es-docs}/search-your-data.html[the query DSL], and {es-docs}/search.html[search APIs]. - -[discrete] -==== Simple search query - -There are many types of search queries that can be combined. We will start with the simple text match query, searching for bikes in the `products` index. - -The search result has a `hits` properties that contains the documents that matched the query along with information about the total number of matches that exist in the index. - -The total value comes with a relation that indicates if the total is exact (`eq` -- equal) or approximate (`gte` -- greater than or equal). - -Each returned document comes with its relevance score and additional information about its location in the index. - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/usage/SearchingTest.java[search-simple] --------------------------------------------------- -<1> Name of the index we want to search. -<2> The query part of the search request (a search request can also have other components like <>). -<3> Choose a query variant among the many available. We choose here the match query (full text search). -<4> Configure the match query: we search for a term in the `name` field. -<5> The target class for the matching documents. We use `Product` here, just like in <> examples. - -Similarly to <> operations, you can fetch documents matching your query as raw JSON by using a corresponding target class instead of `Product`, like JSON-P's `JsonValue` or Jackson's `ObjectNode`. - -[discrete] -==== Nested search queries - -{es} allows individual queries to be combined to build more complex search requests. In the example below we will search for bikes with a maximum price of 200. - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/usage/SearchingTest.java[search-nested] --------------------------------------------------- -<1> We're creating the queries for individual criteria separately. -<2> A `MatchQuery` is a query _variant_ that we have to turn into the `Query` _union type_. See <> for additional details. -<3> {es} range query accepts a large range of value types. We create here a JSON representation of the maximum price. -<4> The search query is a boolean query that combines the text search and max price queries. -<5> Both queries are added as `must` as we want results to match all criteria. - -[discrete] -==== Templated search - -A search template is a stored search that you can run with different variables. Search templates let you change your searches without modifying your application code. - -Before running a template search, you first have to create the template. This is a stored script that returns the search request body, and is usually defined as a Mustache template. This stored script can be created outside the application, and also with the {java-client}: - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/usage/SearchingTest.java[search-template-script] --------------------------------------------------- -<1> Identifier of the template script to create. - -To use the search template, use the `searchTemplate` method to refer to the script and provide values for its parameters: - -["source","java"] --------------------------------------------------- -include-tagged::{doc-tests-src}/usage/SearchingTest.java[search-template-query] --------------------------------------------------- -<1> Identifier of the template script to use. -<2> Template parameter values. - -For more in-depth information, see the {es-docs}/search-template.html[{es} search template documentation]. - - -{doc-tests-blurb} diff --git a/example-transports/src/test/java/co/elastic/clients/transport/rest_client/RestTransportClientTest.java b/example-transports/src/test/java/co/elastic/clients/transport/rest_client/RestTransportClientTest.java index fe0866652..446965cbe 100644 --- a/example-transports/src/test/java/co/elastic/clients/transport/rest_client/RestTransportClientTest.java +++ b/example-transports/src/test/java/co/elastic/clients/transport/rest_client/RestTransportClientTest.java @@ -20,20 +20,21 @@ package co.elastic.clients.transport.rest_client; import co.elastic.clients.transport.TransportHttpClientTest; +import co.elastic.clients.transport.rest5_client.Rest5ClientHttpClient; import org.apache.http.HttpHost; import org.elasticsearch.client.RestClient; -public class RestTransportClientTest extends TransportHttpClientTest { +public class RestTransportClientTest extends TransportHttpClientTest { public RestTransportClientTest() { super(createClient()); } - private static RestClientHttpClient createClient() { + private static Rest5ClientHttpClient createClient() { RestClient restClient = RestClient.builder( new HttpHost(server.getAddress().getAddress(), server.getAddress().getPort(), "http") ).build(); - return new RestClientHttpClient(restClient); + return new Rest5ClientHttpClient(restClient); } } diff --git a/examples/esql-article/src/main/java/co/elastic/clients/esql/article/EsqlArticle.java b/examples/esql-article/src/main/java/co/elastic/clients/esql/article/EsqlArticle.java index 97dddaa3b..e73af8fac 100644 --- a/examples/esql-article/src/main/java/co/elastic/clients/esql/article/EsqlArticle.java +++ b/examples/esql-article/src/main/java/co/elastic/clients/esql/article/EsqlArticle.java @@ -38,140 +38,148 @@ import org.apache.http.message.BasicHeader; import org.elasticsearch.client.RestClient; -import java.io.FileInputStream; -import java.io.FileReader; import java.io.IOException; -import java.nio.file.Path; -import java.nio.file.Paths; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; import java.sql.ResultSet; import java.sql.SQLException; import java.time.Duration; import java.time.Instant; import java.util.List; -import java.util.Properties; import java.util.stream.Collectors; public class EsqlArticle { - public static void main(String[] args) throws IOException, SQLException { - String dir = System.getProperty("user.dir"); - Properties prop = new Properties(); - Path path = Paths.get(dir, "examples", "esql-article", "src", "main", "resources", "application" + - ".conf"); - prop.load(new FileInputStream(path.toString())); + public static void main(String[] args) throws IOException, SQLException, InterruptedException { - String serverUrl = prop.getProperty("server-url"); - String apiKey = prop.getProperty("api-key"); - String csvPath = prop.getProperty("csv-file"); + String serverUrl = System.getenv("server-url"); + String apiKey = System.getenv("api-key"); + String booksUrl = "https://raw.githubusercontent" + + ".com/elastic/elasticsearch-php-examples/main/examples/ESQL/data/books.csv"; - RestClient restClient = RestClient + try (RestClient restClient = RestClient .builder(HttpHost.create(serverUrl)) .setDefaultHeaders(new Header[]{ new BasicHeader("Authorization", "ApiKey " + apiKey) }) - .build(); - - ObjectMapper mapper = JsonMapper.builder() - .build(); - - JacksonJsonpMapper jsonpMapper = new JacksonJsonpMapper(mapper); - - ElasticsearchTransport transport = new RestClientTransport( - restClient, jsonpMapper); - - ElasticsearchClient client = new ElasticsearchClient(transport); - - if (!client.indices().exists(ex -> ex.index("books")).value()) { - client.indices() - .create(c -> c - .index("books") - .mappings(mp -> mp - .properties("title", p -> p.text(t -> t)) - .properties("description", p -> p.text(t -> t)) - .properties("author", p -> p.text(t -> t)) - .properties("year", p -> p.short_(s -> s)) - .properties("publisher", p -> p.text(t -> t)) - .properties("ratings", p -> p.halfFloat(hf -> hf)) - )); - } + .build()) { + + ObjectMapper mapper = JsonMapper.builder() + .build(); + + JacksonJsonpMapper jsonpMapper = new JacksonJsonpMapper(mapper); + + ElasticsearchTransport transport = new RestClientTransport( + restClient, jsonpMapper); + + ElasticsearchClient client = new ElasticsearchClient(transport); - Instant start = Instant.now(); - System.out.println("Starting BulkIndexer... \n"); - - CsvMapper csvMapper = new CsvMapper(); - CsvSchema schema = CsvSchema.builder() - .addColumn("title") // same order as in the csv - .addColumn("description") - .addColumn("author") - .addColumn("year") - .addColumn("publisher") - .addColumn("ratings") - .setColumnSeparator(';') - .setSkipFirstDataRow(true) - .build(); - - MappingIterator it = csvMapper - .readerFor(Book.class) - .with(schema) - .readValues(new FileReader(csvPath)); - - BulkIngester ingester = BulkIngester.of(bi -> bi - .client(client) - .maxConcurrentRequests(20) - .maxOperations(5000)); - - boolean hasNext = true; - - while (hasNext) { - try { - Book book = it.nextValue(); - ingester.add(BulkOperation.of(b -> b - .index(i -> i + if (!client.indices().exists(ex -> ex.index("books")).value()) { + client.indices() + .create(c -> c .index("books") - .document(book)))); - hasNext = it.hasNextValue(); - } catch (JsonParseException | InvalidFormatException e) { - // ignore malformed data + .mappings(mp -> mp + .properties("title", p -> p.text(t -> t)) + .properties("description", p -> p.text(t -> t)) + .properties("author", p -> p.text(t -> t)) + .properties("year", p -> p.short_(s -> s)) + .properties("publisher", p -> p.text(t -> t)) + .properties("ratings", p -> p.halfFloat(hf -> hf)) + )); } - } - ingester.close(); + Instant start = Instant.now(); + System.out.println("Starting BulkIndexer... \n"); + + CsvMapper csvMapper = new CsvMapper(); + CsvSchema schema = CsvSchema.builder() + .addColumn("title") // same order as in the csv + .addColumn("description") + .addColumn("author") + .addColumn("year") + .addColumn("publisher") + .addColumn("ratings") + .setColumnSeparator(';') + .setSkipFirstDataRow(true) + .build(); + + HttpClient httpClient = HttpClient.newHttpClient(); + HttpRequest request = HttpRequest.newBuilder() + .uri(URI.create(booksUrl)) + .build(); + + HttpResponse response = httpClient.send(request, + HttpResponse.BodyHandlers.ofInputStream()); + InputStream csvContentStream = response.body(); + + MappingIterator it = csvMapper + .readerFor(Book.class) + .with(schema) + .readValues(new InputStreamReader(csvContentStream)); + + BulkIngester ingester = BulkIngester.of(bi -> bi + .client(client) + .maxConcurrentRequests(20) + .maxOperations(5000)); + + boolean hasNext = true; + + while (hasNext) { + try { + Book book = it.nextValue(); + ingester.add(BulkOperation.of(b -> b + .index(i -> i + .index("books") + .document(book)))); + hasNext = it.hasNextValue(); + } catch (JsonParseException | InvalidFormatException e) { + // ignore malformed data + } + } - client.indices().refresh(); + ingester.close(); - Instant end = Instant.now(); + client.indices().refresh(); - System.out.println("Finished in: " + Duration.between(start, end).toMillis() + "\n"); + Instant end = Instant.now(); - String queryAuthor = - """ - from books - | where author == "Isaac Asimov" - | sort year desc - | limit 10 - """; + System.out.println("Finished in: " + Duration.between(start, end).toMillis() + "\n"); - List queryRes = (List) client.esql().query(ObjectsEsqlAdapter.of(Book.class), queryAuthor); + String queryAuthor = + """ + from books + | where author == "Isaac Asimov" + | sort year desc + | limit 10 + """; - System.out.println("~~~\nObject result author:\n" + queryRes.stream().map(Book::title).collect(Collectors.joining("\n"))); + List queryRes = (List) client.esql().query(ObjectsEsqlAdapter.of(Book.class), + queryAuthor); - ResultSet resultSet = client.esql().query(ResultSetEsqlAdapter.INSTANCE, queryAuthor); + System.out.println("~~~\nObject result author:\n" + queryRes.stream().map(Book::title).collect(Collectors.joining("\n"))); - System.out.println("~~~\nResultSet result author:"); - while (resultSet.next()) { - System.out.println(resultSet.getString("title")); - } + try (ResultSet resultSet = client.esql().query(ResultSetEsqlAdapter.INSTANCE, queryAuthor)) { + System.out.println("~~~\nResultSet result author:"); + while (resultSet.next()) { + System.out.println(resultSet.getString("title")); + } + } - String queryPublisher = - """ - from books - | where publisher == "Penguin" - | sort ratings desc - | limit 10 - | sort title asc - """; - - queryRes = (List) client.esql().query(ObjectsEsqlAdapter.of(Book.class), queryPublisher); - System.out.println("~~~\nObject result publisher:\n" + queryRes.stream().map(Book::title).collect(Collectors.joining("\n"))); + String queryPublisher = + """ + from books + | where publisher == "Penguin" + | sort ratings desc + | limit 10 + | sort title asc + """; + + queryRes = (List) client.esql().query(ObjectsEsqlAdapter.of(Book.class), queryPublisher); + System.out.println("~~~\nObject result publisher:\n" + queryRes.stream().map(Book::title).collect(Collectors.joining("\n"))); + } } } diff --git a/examples/esql-article/src/main/resources/application.conf b/examples/esql-article/src/main/resources/application.conf deleted file mode 100644 index fa70bd046..000000000 --- a/examples/esql-article/src/main/resources/application.conf +++ /dev/null @@ -1,3 +0,0 @@ -server-url=elasticsearch-server-url -api-key=elasticsearch-api-key -csv-file=/path/to/your/csv/books.csv diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c02..249e5832f 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ae04661ee..2733ed5dc 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 4f906e0c8..a69d9cb6c 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,101 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index ac1b06f93..53a6b238d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/java-client-serverless/README.md b/java-client-serverless/README.md deleted file mode 100644 index a0f239151..000000000 --- a/java-client-serverless/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# Java API client for the Elasticsearch Serverless Service. - -A flavor of the Java API client for the upcoming [Elasticsearch Serverless Service](https://www.elastic.co/search-labs/stateless-your-new-state-of-find-with-elasticsearch). - - -The major difference is that Elasticsearch Serverless will abstract all infrastructure concerns from users, and as such has a reduced API surface. This new flavor of the Elasticsearch Java API client uses the same base framework and same package names as the "regular" client, but with a reduced number of APIs. - -It is meant for users who want to ensure their code will work on the current Elasticsearch and the upcoming Serverless flavor. - -## Usage - -In the initial preview phase, this new flavor of the Java API client is published on the [GitHub project's Maven repository](https://github.com/elastic/elasticsearch-java/packages/1934787). - -To install it, you need to add this repository to your project. This requires to authenticate to GitHub with an application token. Example with Gradle: - -``` -repositories { - maven { - name = "GitHubElasticsearchJava" - url = uri("https://maven.pkg.github.com/elastic/elasticsearch-java") - // See https://docs.gradle.org/current/samples/sample_publishing_credentials.html - credentials(PasswordCredentials::class) - } -} - -dependencies { - implementation("co.elastic.clients", "elasticsearch-java-serverless", "1.0.0-20231031-SNAPSHOT") -} -``` - -## Implementation details - -This project is parallel to [java-client](../java-client). The Java packages that are common to both projects are shared using symbolic links from this project to [java-client](../java-client). This ensures minimal disruption in the code layout and build system while avoiding code duplication. - -In the future, the Java API client will be split into different modules, and there will be parent modules for the two flavors with dependencies on child modules. - - - - diff --git a/java-client-serverless/build.gradle.kts b/java-client-serverless/build.gradle.kts deleted file mode 100644 index 25ee24d90..000000000 --- a/java-client-serverless/build.gradle.kts +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import com.github.jk1.license.ProjectData -import com.github.jk1.license.render.LicenseDataCollector -import com.github.jk1.license.render.ReportRenderer -import java.io.File -import java.io.FileWriter - -plugins { - java - `java-library` - checkstyle - `maven-publish` - signing - id("com.github.jk1.dependency-license-report") version "2.2" - id("de.thetaphi.forbiddenapis") version "3.4" -} - -checkstyle { - toolVersion = "10.16.0" -} - -version = (File(project.rootDir, "config/version-serverless.txt").readText().trim() + "-SNAPSHOT") - -signing { - sign(publishing.publications) -} - -java { - targetCompatibility = JavaVersion.VERSION_1_8 - sourceCompatibility = JavaVersion.VERSION_1_8 - - withJavadocJar() - withSourcesJar() -} - -sourceSets { - main { - java.srcDir("src/main-flavored/java") - } -} - -forbiddenApis { - signaturesFiles = files(File(rootProject.projectDir, "config/forbidden-apis.txt")) - suppressAnnotations = setOf("co.elastic.clients.util.AllowForbiddenApis") -} - -tasks.forbiddenApisMain { - bundledSignatures = setOf("jdk-system-out") -} - -tasks.getByName("processResources") { - eachFile { - if (name != "apis.json") { - // Only process main source-set resources (test files are large) - expand( - "version" to version, - "git_revision" to (if (rootProject.extra.has("gitHashFull")) rootProject.extra["gitHashFull"] else "unknown") - ) - } - } -} - -tasks.withType { - useJUnitPlatform() -} - -tasks.withType { - doFirst { - if (rootProject.extra.has("gitHashFull")) { - val jar = this as Jar - jar.manifest.attributes["X-Git-Revision"] = rootProject.extra["gitHashFull"] - jar.manifest.attributes["X-Git-Commit-Time"] = rootProject.extra["gitCommitTime"] - } else { - throw GradleException("No git information available") - } - } - - manifest { - attributes["Implementation-Title"] = "Elasticsearch Java client (Serverless edition)" - attributes["Implementation-Vendor"] = "Elastic" - attributes["Implementation-URL"] = "https://github.com/elastic/elasticsearch-java/" - attributes["Build-Date"] = rootProject.extra["buildTime"] - } - - metaInf { - from("../LICENSE.txt") - from("../NOTICE.txt") - } -} - -tasks.withType { - val opt = options as StandardJavadocDocletOptions - // Gradle calls javadoc with a list of file and not a path. This prevents doc-files from being copied. - opt.addStringOption("sourcepath", project.projectDir.path + "/src/main/java") - opt.docFilesSubDirs(true) - opt.addBooleanOption("Xdoclint:-missing", true) - - doLast { - // Javadoc adds its decoration to html doc files, including quite some JS. This slows down the api spec - // redirector that doesn't need it. So overwrite the target file with the original one. - val specFile = "co/elastic/clients/elasticsearch/doc-files/api-spec.html" - val source = File(project.projectDir, "src/main/java/" + specFile) - val target = File(project.projectDir, "build/docs/javadoc/" + specFile) - source.copyTo(target, overwrite = true) - } -} - - -publishing { - repositories { - maven { - // See https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry - // and https://docs.gradle.org/current/samples/sample_publishing_credentials.html - name = "ESJavaGithubPackages" - url = uri("https://maven.pkg.github.com/elastic/elasticsearch-java") - credentials(PasswordCredentials::class) - } - - maven { - name = "Build" - url = uri("${rootProject.buildDir}/repository") - } - - maven { - name = "MavenCentralSnapshot" - setUrl("https://s01.oss.sonatype.org/content/repositories/snapshots/") - credentials { - username = providers.gradleProperty("ossrhUsername").getOrNull() - password = providers.gradleProperty("ossrhPassword").getOrNull() - } - } - } - - publications { - register("maven") { - from(components["java"]) - pom { - name.set("Elasticsearch Java API Client (Serverless edition)") - artifactId = "elasticsearch-java-serverless" - description.set("Java API Client for Elasticsearch Serverless") - url.set("https://github.com/elastic/elasticsearch-java/") - licenses { - license { - name.set("The Apache Software License, Version 2.0") - url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") - } - } - developers { - developer { - name.set("Elastic") - url.set("https://www.elastic.co") - inceptionYear.set("2020") - } - } - scm { - connection.set("scm:git:https://github.com/elastic/elasticsearch-java.git") - developerConnection.set("scm:git:ssh://git@github.com:elastic/elasticsearch-java.git") - url.set("https://github.com/elastic/elasticsearch-java/") - } - -// Fixed version in Serverless. -// withXml { -// // Set the version of dependencies of the org.elasticsearch.client group to the one that we are building. -// // Since the unified release process releases everything at once, this ensures all published artifacts depend -// // on the exact same version. This assumes of course that the binary API and the behavior of these dependencies -// // are the same as the one used in the dependency section below. -// val xPathFactory = javax.xml.xpath.XPathFactory.newInstance() -// val depSelector = xPathFactory.newXPath() -// .compile("/project/dependencies/dependency[groupId/text() = 'org.elasticsearch.client']") -// val versionSelector = xPathFactory.newXPath().compile("version") -// -// var foundVersion = false; -// -// val deps = depSelector.evaluate(asElement().ownerDocument, javax.xml.xpath.XPathConstants.NODESET) -// as org.w3c.dom.NodeList -// -// for (i in 0 until deps.length) { -// val dep = deps.item(i) -// val version = versionSelector.evaluate(dep, javax.xml.xpath.XPathConstants.NODE) as org.w3c.dom.Element -// foundVersion = true; -// version.textContent = project.version.toString() -// } -// -// if (!foundVersion) { -// throw GradleException("Could not find a 'org.elasticsearch.client' to update dependency version in the POM.") -// } -// } - } - } - } -} - -dependencies { - val elasticsearchVersion = "8.10.0" - val jacksonVersion = "2.17.0" - val openTelemetryVersion = "1.29.0" - - // Apache 2.0 - // https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-low.html - api("org.elasticsearch.client", "elasticsearch-rest-client", elasticsearchVersion) - - // Apache 2.0 - // https://search.maven.org/artifact/com.google.code.findbugs/jsr305 - api("com.google.code.findbugs:jsr305:3.0.2") - - // EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - // https://github.com/eclipse-ee4j/jsonp - api("jakarta.json:jakarta.json-api:2.0.1") - - // Needed even if using Jackson to have an implementation of the Jsonp object model - // EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - // https://github.com/eclipse-ee4j/parsson - api("org.eclipse.parsson:parsson:1.0.5") - - // OpenTelemetry API for native instrumentation of the client. - // Apache 2.0 - // https://github.com/open-telemetry/opentelemetry-java - implementation("io.opentelemetry", "opentelemetry-api", openTelemetryVersion) - // Use it once it's stable (see Instrumentation.java). Limited to tests for now. - testImplementation("io.opentelemetry", "opentelemetry-semconv", "$openTelemetryVersion-alpha") - - // EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - // https://github.com/eclipse-ee4j/jsonb-api - compileOnly("jakarta.json.bind", "jakarta.json.bind-api", "2.0.0") - testImplementation("jakarta.json.bind", "jakarta.json.bind-api", "2.0.0") - - // Apache 2.0 - // https://github.com/FasterXML/jackson - compileOnly("com.fasterxml.jackson.core", "jackson-core", jacksonVersion) - compileOnly("com.fasterxml.jackson.core", "jackson-databind", jacksonVersion) - testImplementation("com.fasterxml.jackson.core", "jackson-core", jacksonVersion) - testImplementation("com.fasterxml.jackson.core", "jackson-databind", jacksonVersion) - - // EPL-2.0 OR BSD-3-Clause - // https://eclipse-ee4j.github.io/yasson/ - testImplementation("org.eclipse", "yasson", "2.0.4") { - // Exclude Glassfish as we use Parsson (basically Glassfish renamed in the Jakarta namespace). - exclude(group = "org.glassfish", module = "jakarta.json") - } - - // Apache-2.0 - testImplementation("commons-io:commons-io:2.11.0") - - // EPL-2.0 - // https://junit.org/junit5/ - testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.2") - - // MIT - // https://github.com/classgraph/classgraph - testImplementation("io.github.classgraph:classgraph:4.8.147") - - // MIT - // https://www.testcontainers.org/ - testImplementation("org.testcontainers", "testcontainers", "1.17.3") - testImplementation("org.testcontainers", "elasticsearch", "1.17.3") - // updating transitive dependency from testcontainers - testImplementation("org.apache.commons","commons-compress","1.26.1") - - testImplementation("io.opentelemetry", "opentelemetry-sdk", openTelemetryVersion) -} - - -licenseReport { - renderers = arrayOf(SpdxReporter(File(rootProject.buildDir, "release/dependencies.csv"))) - excludeGroups = arrayOf("org.elasticsearch.client") -} - -class SpdxReporter(val dest: File) : ReportRenderer { - // License names to their SPDX identifier - val spdxIds = mapOf( - "The Apache License, Version 2.0" to "Apache-2.0", - "Apache License, Version 2.0" to "Apache-2.0", - "The Apache Software License, Version 2.0" to "Apache-2.0", - "BSD Zero Clause License" to "0BSD", - "Eclipse Public License 2.0" to "EPL-2.0", - "Eclipse Public License v. 2.0" to "EPL-2.0", - "Eclipse Public License - v 2.0" to "EPL-2.0", - "GNU General Public License, version 2 with the GNU Classpath Exception" to "GPL-2.0 WITH Classpath-exception-2.0", - "COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0" to "CDDL-1.0" - ) - - private fun quote(str: String): String { - return if (str.contains(',') || str.contains("\"")) { - "\"" + str.replace("\"", "\"\"") + "\"" - } else { - str - } - } - - override fun render(data: ProjectData?) { - dest.parentFile.mkdirs() - FileWriter(dest).use { out -> - out.append("name,url,version,revision,license\n") - data?.allDependencies?.forEach { dep -> - - val depVersion = dep.version - val depName = dep.group + ":" + dep.name - - val info = LicenseDataCollector.multiModuleLicenseInfo(dep) - val depUrl = info.moduleUrls.first() - - val licenseIds = info.licenses.mapNotNull { license -> - license.name?.let { - checkNotNull(spdxIds[it]) { "No SPDX identifier for $license" } - } - }.toSet() - - // Combine multiple licenses. - // See https://spdx.github.io/spdx-spec/appendix-IV-SPDX-license-expressions/#composite-license-expressions - val licenseId = licenseIds.joinToString(" OR ") - - out.append("${quote(depName)},${quote(depUrl)},${quote(depVersion)},,${quote(licenseId)}\n") - } - } - } -} diff --git a/java-client-serverless/docs/getting-started.mdx b/java-client-serverless/docs/getting-started.mdx deleted file mode 100644 index 89c731088..000000000 --- a/java-client-serverless/docs/getting-started.mdx +++ /dev/null @@ -1,166 +0,0 @@ ---- -id: gettingStartedServerlessJava -slug: /serverless-java/docs/getting-started -title: Getting started with the Serverless Java client -description: This page contains quickstart information about the Serverless Java client. -date: 2023-06-27 -tags: ['serverless','Java client','docs', 'getting started', 'Java'] ---- - -This page guides you through the installation process of the Serverless Java -client, shows you how to instantiate the client, and how to perform basic -Elasticsearch operations with it. - -## Requirements - -* Java 8 or later. -* A JSON object mapping library to allow seamless integration of -your application classes with the Elasticsearch API. The examples below -show usage with Jackson. - -## Installation - -You can add the Elasticsearch Serverless Java client to your Java project using either Gradle or Maven. - -### Using Gradle - -```groovy -dependencies { - implementation 'co.elastic.clients:elasticsearch-java-serverless:1.0.0-20231031' - implementation 'com.fasterxml.jackson.core:jackson-databind:2.17.0' -} -``` - -### Using Maven - -In the `pom.xml` of your project, add the following dependencies: - -```xml - - - - - co.elastic.clients - elasticsearch-java-serverless - 1.0.0-20231031 - - - - com.fasterxml.jackson.core - jackson-databind - 2.17.0 - - - - -``` - -## Instantiate a client - -You can connect to the Elasticsearch Service using an API key and the Elasticsearch endpoint: - -```java -// URL and API key -String serverUrl = "https://...elastic.cloud"; -String apiKey = "VnVhQ2ZHY0JDZGJrU..."; - -// Create the low-level client -RestClient restClient = RestClient - .builder(HttpHost.create(serverUrl)) - .setDefaultHeaders(new Header[]{ - new BasicHeader("Authorization", "ApiKey " + apiKey) - }) - .build(); - -// Create the transport with a Jackson mapper -ElasticsearchTransport transport = new RestClientTransport( - restClient, new JacksonJsonpMapper()); - -// And create the API client -ElasticsearchClient esClient = new ElasticsearchClient(transport); -``` - -You can find the Elasticsearch endpoint on the Cloud deployment management page. - - - -You can create a new API Key under **Stack Management** > **Security**: - - - - -## Using the API - -After you instantiated a client with your API key and Elasticsearch endpoint, -you can start ingesting documents into the Elasticsearch Service. - - -### Creating an index and ingesting documents - -You can call the `bulk` API with a body parameter, an array of hashes that -define the action, and a document. - -The following is an example of indexing a document, here a `Product` application object -in the `products` index: - -```java -Product product = new Product("bk-1", "City bike", 123.0); - -IndexResponse response = esClient.index(i -> i - .index("products") - .id(product.getSku()) - .document(product) -); - -logger.info("Indexed with version " + response.version()); -``` - -### Searching - -Now that some data is available, you can search your documents using the -**Search API**: - -```java -String searchText = "bike"; - -SearchResponse response = esClient.search(s -> s - .index("products") - .query(q -> q - .match(t -> t - .field("name") - .query(searchText) - ) - ), - Product.class -); -``` - -A few things to note in the above example: -* the search query is built using a hierarchy of lambda expressions that closely follows the - Elasticsearch JSON API. Lambda expressions allows you to be guided by your IDE's autocompletion, without - having to import (or even know!) the actual classes representing a query. -* The last parameter `Product.class` instructs the client to return results as `Product` application objects - instead of raw JSON. - -### Updating - -You can update your documents using the Update API: - -```java -Product product = new Product("bk-1", "City bike", 123.0); - -esClient.update(u -> u - .index("products") - .id("bk-1") - .upsert(product), - Product.class -); -``` - -### Delete - -You can also delete documents: - -```java -esClient.delete(d -> d.index("products").id("bk-1")); -``` diff --git a/java-client-serverless/docs/images/copy-endpoint.gif b/java-client-serverless/docs/images/copy-endpoint.gif deleted file mode 100644 index af2883dfd..000000000 Binary files a/java-client-serverless/docs/images/copy-endpoint.gif and /dev/null differ diff --git a/java-client-serverless/docs/images/setup-api-key.gif b/java-client-serverless/docs/images/setup-api-key.gif deleted file mode 100644 index f638ef6bb..000000000 Binary files a/java-client-serverless/docs/images/setup-api-key.gif and /dev/null differ diff --git a/java-client-serverless/docs/index.mdx b/java-client-serverless/docs/index.mdx deleted file mode 100644 index e69de29bb..000000000 diff --git a/java-client-serverless/src/main-flavored/java/co/elastic/clients/transport/VersionInfo.java b/java-client-serverless/src/main-flavored/java/co/elastic/clients/transport/VersionInfo.java deleted file mode 100644 index affd910c4..000000000 --- a/java-client-serverless/src/main-flavored/java/co/elastic/clients/transport/VersionInfo.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.transport; - -// Package private -class VersionInfo { - static final String FLAVOR = "serverless"; - static final String VERSION = "1.0.0+20231031"; -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/ApiClient.java b/java-client-serverless/src/main/java/co/elastic/clients/ApiClient.java deleted file mode 120000 index 0e884fbdb..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/ApiClient.java +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../java-client/src/main/java/co/elastic/clients/ApiClient.java \ No newline at end of file diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchAsyncClient.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchAsyncClient.java deleted file mode 100644 index d17c58377..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchAsyncClient.java +++ /dev/null @@ -1,1976 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch; - -import co.elastic.clients.ApiClient; -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch.async_search.ElasticsearchAsyncSearchAsyncClient; -import co.elastic.clients.elasticsearch.cat.ElasticsearchCatAsyncClient; -import co.elastic.clients.elasticsearch.cluster.ElasticsearchClusterAsyncClient; -import co.elastic.clients.elasticsearch.connector.ElasticsearchConnectorAsyncClient; -import co.elastic.clients.elasticsearch.core.BulkRequest; -import co.elastic.clients.elasticsearch.core.BulkResponse; -import co.elastic.clients.elasticsearch.core.ClearScrollRequest; -import co.elastic.clients.elasticsearch.core.ClearScrollResponse; -import co.elastic.clients.elasticsearch.core.ClosePointInTimeRequest; -import co.elastic.clients.elasticsearch.core.ClosePointInTimeResponse; -import co.elastic.clients.elasticsearch.core.CountRequest; -import co.elastic.clients.elasticsearch.core.CountResponse; -import co.elastic.clients.elasticsearch.core.CreateRequest; -import co.elastic.clients.elasticsearch.core.CreateResponse; -import co.elastic.clients.elasticsearch.core.DeleteByQueryRequest; -import co.elastic.clients.elasticsearch.core.DeleteByQueryResponse; -import co.elastic.clients.elasticsearch.core.DeleteRequest; -import co.elastic.clients.elasticsearch.core.DeleteResponse; -import co.elastic.clients.elasticsearch.core.DeleteScriptRequest; -import co.elastic.clients.elasticsearch.core.DeleteScriptResponse; -import co.elastic.clients.elasticsearch.core.ExistsRequest; -import co.elastic.clients.elasticsearch.core.ExistsSourceRequest; -import co.elastic.clients.elasticsearch.core.ExplainRequest; -import co.elastic.clients.elasticsearch.core.ExplainResponse; -import co.elastic.clients.elasticsearch.core.FieldCapsRequest; -import co.elastic.clients.elasticsearch.core.FieldCapsResponse; -import co.elastic.clients.elasticsearch.core.GetRequest; -import co.elastic.clients.elasticsearch.core.GetResponse; -import co.elastic.clients.elasticsearch.core.GetScriptRequest; -import co.elastic.clients.elasticsearch.core.GetScriptResponse; -import co.elastic.clients.elasticsearch.core.GetSourceRequest; -import co.elastic.clients.elasticsearch.core.GetSourceResponse; -import co.elastic.clients.elasticsearch.core.IndexRequest; -import co.elastic.clients.elasticsearch.core.IndexResponse; -import co.elastic.clients.elasticsearch.core.InfoRequest; -import co.elastic.clients.elasticsearch.core.InfoResponse; -import co.elastic.clients.elasticsearch.core.MgetRequest; -import co.elastic.clients.elasticsearch.core.MgetResponse; -import co.elastic.clients.elasticsearch.core.MsearchRequest; -import co.elastic.clients.elasticsearch.core.MsearchResponse; -import co.elastic.clients.elasticsearch.core.MsearchTemplateRequest; -import co.elastic.clients.elasticsearch.core.MsearchTemplateResponse; -import co.elastic.clients.elasticsearch.core.MtermvectorsRequest; -import co.elastic.clients.elasticsearch.core.MtermvectorsResponse; -import co.elastic.clients.elasticsearch.core.OpenPointInTimeRequest; -import co.elastic.clients.elasticsearch.core.OpenPointInTimeResponse; -import co.elastic.clients.elasticsearch.core.PingRequest; -import co.elastic.clients.elasticsearch.core.PutScriptRequest; -import co.elastic.clients.elasticsearch.core.PutScriptResponse; -import co.elastic.clients.elasticsearch.core.RankEvalRequest; -import co.elastic.clients.elasticsearch.core.RankEvalResponse; -import co.elastic.clients.elasticsearch.core.ReindexRequest; -import co.elastic.clients.elasticsearch.core.ReindexResponse; -import co.elastic.clients.elasticsearch.core.RenderSearchTemplateRequest; -import co.elastic.clients.elasticsearch.core.RenderSearchTemplateResponse; -import co.elastic.clients.elasticsearch.core.ScriptsPainlessExecuteRequest; -import co.elastic.clients.elasticsearch.core.ScriptsPainlessExecuteResponse; -import co.elastic.clients.elasticsearch.core.ScrollRequest; -import co.elastic.clients.elasticsearch.core.ScrollResponse; -import co.elastic.clients.elasticsearch.core.SearchMvtRequest; -import co.elastic.clients.elasticsearch.core.SearchRequest; -import co.elastic.clients.elasticsearch.core.SearchResponse; -import co.elastic.clients.elasticsearch.core.SearchTemplateRequest; -import co.elastic.clients.elasticsearch.core.SearchTemplateResponse; -import co.elastic.clients.elasticsearch.core.TermsEnumRequest; -import co.elastic.clients.elasticsearch.core.TermsEnumResponse; -import co.elastic.clients.elasticsearch.core.TermvectorsRequest; -import co.elastic.clients.elasticsearch.core.TermvectorsResponse; -import co.elastic.clients.elasticsearch.core.UpdateByQueryRequest; -import co.elastic.clients.elasticsearch.core.UpdateByQueryResponse; -import co.elastic.clients.elasticsearch.core.UpdateRequest; -import co.elastic.clients.elasticsearch.core.UpdateResponse; -import co.elastic.clients.elasticsearch.enrich.ElasticsearchEnrichAsyncClient; -import co.elastic.clients.elasticsearch.eql.ElasticsearchEqlAsyncClient; -import co.elastic.clients.elasticsearch.esql.ElasticsearchEsqlAsyncClient; -import co.elastic.clients.elasticsearch.graph.ElasticsearchGraphAsyncClient; -import co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesAsyncClient; -import co.elastic.clients.elasticsearch.inference.ElasticsearchInferenceAsyncClient; -import co.elastic.clients.elasticsearch.ingest.ElasticsearchIngestAsyncClient; -import co.elastic.clients.elasticsearch.license.ElasticsearchLicenseAsyncClient; -import co.elastic.clients.elasticsearch.logstash.ElasticsearchLogstashAsyncClient; -import co.elastic.clients.elasticsearch.ml.ElasticsearchMlAsyncClient; -import co.elastic.clients.elasticsearch.query_rules.ElasticsearchQueryRulesAsyncClient; -import co.elastic.clients.elasticsearch.search_application.ElasticsearchSearchApplicationAsyncClient; -import co.elastic.clients.elasticsearch.security.ElasticsearchSecurityAsyncClient; -import co.elastic.clients.elasticsearch.sql.ElasticsearchSqlAsyncClient; -import co.elastic.clients.elasticsearch.synonyms.ElasticsearchSynonymsAsyncClient; -import co.elastic.clients.elasticsearch.tasks.ElasticsearchTasksAsyncClient; -import co.elastic.clients.elasticsearch.transform.ElasticsearchTransformAsyncClient; -import co.elastic.clients.transport.ElasticsearchTransport; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.JsonEndpoint; -import co.elastic.clients.transport.Transport; -import co.elastic.clients.transport.TransportOptions; -import co.elastic.clients.transport.endpoints.BinaryResponse; -import co.elastic.clients.transport.endpoints.BooleanResponse; -import co.elastic.clients.transport.endpoints.EndpointWithResponseMapperAttr; -import co.elastic.clients.util.ObjectBuilder; -import java.lang.reflect.Type; -import java.util.concurrent.CompletableFuture; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Client for the namespace. - */ -public class ElasticsearchAsyncClient extends ApiClient { - - public ElasticsearchAsyncClient(ElasticsearchTransport transport) { - super(transport, null); - } - - public ElasticsearchAsyncClient(ElasticsearchTransport transport, @Nullable TransportOptions transportOptions) { - super(transport, transportOptions); - } - - @Override - public ElasticsearchAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) { - return new ElasticsearchAsyncClient(this.transport, transportOptions); - } - - // ----- Child clients - - public ElasticsearchAsyncSearchAsyncClient asyncSearch() { - return new ElasticsearchAsyncSearchAsyncClient(this.transport, this.transportOptions); - } - - public ElasticsearchCatAsyncClient cat() { - return new ElasticsearchCatAsyncClient(this.transport, this.transportOptions); - } - - public ElasticsearchClusterAsyncClient cluster() { - return new ElasticsearchClusterAsyncClient(this.transport, this.transportOptions); - } - - public ElasticsearchConnectorAsyncClient connector() { - return new ElasticsearchConnectorAsyncClient(this.transport, this.transportOptions); - } - - public ElasticsearchEnrichAsyncClient enrich() { - return new ElasticsearchEnrichAsyncClient(this.transport, this.transportOptions); - } - - public ElasticsearchEqlAsyncClient eql() { - return new ElasticsearchEqlAsyncClient(this.transport, this.transportOptions); - } - - public ElasticsearchEsqlAsyncClient esql() { - return new ElasticsearchEsqlAsyncClient(this.transport, this.transportOptions); - } - - public ElasticsearchGraphAsyncClient graph() { - return new ElasticsearchGraphAsyncClient(this.transport, this.transportOptions); - } - - public ElasticsearchIndicesAsyncClient indices() { - return new ElasticsearchIndicesAsyncClient(this.transport, this.transportOptions); - } - - public ElasticsearchInferenceAsyncClient inference() { - return new ElasticsearchInferenceAsyncClient(this.transport, this.transportOptions); - } - - public ElasticsearchIngestAsyncClient ingest() { - return new ElasticsearchIngestAsyncClient(this.transport, this.transportOptions); - } - - public ElasticsearchLicenseAsyncClient license() { - return new ElasticsearchLicenseAsyncClient(this.transport, this.transportOptions); - } - - public ElasticsearchLogstashAsyncClient logstash() { - return new ElasticsearchLogstashAsyncClient(this.transport, this.transportOptions); - } - - public ElasticsearchMlAsyncClient ml() { - return new ElasticsearchMlAsyncClient(this.transport, this.transportOptions); - } - - public ElasticsearchQueryRulesAsyncClient queryRules() { - return new ElasticsearchQueryRulesAsyncClient(this.transport, this.transportOptions); - } - - public ElasticsearchSearchApplicationAsyncClient searchApplication() { - return new ElasticsearchSearchApplicationAsyncClient(this.transport, this.transportOptions); - } - - public ElasticsearchSecurityAsyncClient security() { - return new ElasticsearchSecurityAsyncClient(this.transport, this.transportOptions); - } - - public ElasticsearchSqlAsyncClient sql() { - return new ElasticsearchSqlAsyncClient(this.transport, this.transportOptions); - } - - public ElasticsearchSynonymsAsyncClient synonyms() { - return new ElasticsearchSynonymsAsyncClient(this.transport, this.transportOptions); - } - - public ElasticsearchTasksAsyncClient tasks() { - return new ElasticsearchTasksAsyncClient(this.transport, this.transportOptions); - } - - public ElasticsearchTransformAsyncClient transform() { - return new ElasticsearchTransformAsyncClient(this.transport, this.transportOptions); - } - - // ----- Endpoint: bulk - - /** - * Bulk index or delete documents. Performs multiple indexing or delete - * operations in a single API call. This reduces overhead and can greatly - * increase indexing speed. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture bulk(BulkRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) BulkRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Bulk index or delete documents. Performs multiple indexing or delete - * operations in a single API call. This reduces overhead and can greatly - * increase indexing speed. - * - * @param fn - * a function that initializes a builder to create the - * {@link BulkRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture bulk(Function> fn) { - return bulk(fn.apply(new BulkRequest.Builder()).build()); - } - - /** - * Bulk index or delete documents. Performs multiple indexing or delete - * operations in a single API call. This reduces overhead and can greatly - * increase indexing speed. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture bulk() { - return this.transport.performRequestAsync(new BulkRequest.Builder().build(), BulkRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: clear_scroll - - /** - * Clears the search context and results for a scrolling search. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture clearScroll(ClearScrollRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) ClearScrollRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Clears the search context and results for a scrolling search. - * - * @param fn - * a function that initializes a builder to create the - * {@link ClearScrollRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture clearScroll( - Function> fn) { - return clearScroll(fn.apply(new ClearScrollRequest.Builder()).build()); - } - - /** - * Clears the search context and results for a scrolling search. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture clearScroll() { - return this.transport.performRequestAsync(new ClearScrollRequest.Builder().build(), - ClearScrollRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: close_point_in_time - - /** - * Closes a point-in-time. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture closePointInTime(ClosePointInTimeRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) ClosePointInTimeRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Closes a point-in-time. - * - * @param fn - * a function that initializes a builder to create the - * {@link ClosePointInTimeRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture closePointInTime( - Function> fn) { - return closePointInTime(fn.apply(new ClosePointInTimeRequest.Builder()).build()); - } - - // ----- Endpoint: count - - /** - * Returns number of documents matching a query. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture count(CountRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) CountRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns number of documents matching a query. - * - * @param fn - * a function that initializes a builder to create the - * {@link CountRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture count( - Function> fn) { - return count(fn.apply(new CountRequest.Builder()).build()); - } - - /** - * Returns number of documents matching a query. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture count() { - return this.transport.performRequestAsync(new CountRequest.Builder().build(), CountRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: create - - /** - * Index a document. Adds a JSON document to the specified data stream or index - * and makes it searchable. If the target is an index and the document already - * exists, the request updates the document and increments its version. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture create(CreateRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint, CreateResponse, ErrorResponse> endpoint = (JsonEndpoint, CreateResponse, ErrorResponse>) CreateRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Index a document. Adds a JSON document to the specified data stream or index - * and makes it searchable. If the target is an index and the document already - * exists, the request updates the document and increments its version. - * - * @param fn - * a function that initializes a builder to create the - * {@link CreateRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture create( - Function, ObjectBuilder>> fn) { - return create(fn.apply(new CreateRequest.Builder()).build()); - } - - // ----- Endpoint: delete - - /** - * Delete a document. Removes a JSON document from the specified index. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture delete(DeleteRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) DeleteRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Delete a document. Removes a JSON document from the specified index. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture delete( - Function> fn) { - return delete(fn.apply(new DeleteRequest.Builder()).build()); - } - - // ----- Endpoint: delete_by_query - - /** - * Delete documents. Deletes documents that match the specified query. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture deleteByQuery(DeleteByQueryRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) DeleteByQueryRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Delete documents. Deletes documents that match the specified query. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteByQueryRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture deleteByQuery( - Function> fn) { - return deleteByQuery(fn.apply(new DeleteByQueryRequest.Builder()).build()); - } - - // ----- Endpoint: delete_script - - /** - * Delete a script or search template. Deletes a stored script or search - * template. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture deleteScript(DeleteScriptRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) DeleteScriptRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Delete a script or search template. Deletes a stored script or search - * template. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteScriptRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture deleteScript( - Function> fn) { - return deleteScript(fn.apply(new DeleteScriptRequest.Builder()).build()); - } - - // ----- Endpoint: exists - - /** - * Check a document. Checks if a specified document exists. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture exists(ExistsRequest request) { - @SuppressWarnings("unchecked") - Endpoint endpoint = (Endpoint) ExistsRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Check a document. Checks if a specified document exists. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExistsRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture exists( - Function> fn) { - return exists(fn.apply(new ExistsRequest.Builder()).build()); - } - - // ----- Endpoint: exists_source - - /** - * Check for a document source. Checks if a document's _source is - * stored. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture existsSource(ExistsSourceRequest request) { - @SuppressWarnings("unchecked") - Endpoint endpoint = (Endpoint) ExistsSourceRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Check for a document source. Checks if a document's _source is - * stored. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExistsSourceRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture existsSource( - Function> fn) { - return existsSource(fn.apply(new ExistsSourceRequest.Builder()).build()); - } - - // ----- Endpoint: explain - - /** - * Explain a document match result. Returns information about why a specific - * document matches, or doesn’t match, a query. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> explain(ExplainRequest request, - Class tDocumentClass) { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) ExplainRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.explain.Response.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Explain a document match result. Returns information about why a specific - * document matches, or doesn’t match, a query. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExplainRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> explain( - Function> fn, Class tDocumentClass) { - return explain(fn.apply(new ExplainRequest.Builder()).build(), tDocumentClass); - } - - /** - * Explain a document match result. Returns information about why a specific - * document matches, or doesn’t match, a query. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> explain(ExplainRequest request, - Type tDocumentType) { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) ExplainRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.explain.Response.TDocument", getDeserializer(tDocumentType)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Explain a document match result. Returns information about why a specific - * document matches, or doesn’t match, a query. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExplainRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> explain( - Function> fn, Type tDocumentType) { - return explain(fn.apply(new ExplainRequest.Builder()).build(), tDocumentType); - } - - // ----- Endpoint: field_caps - - /** - * The field capabilities API returns the information about the capabilities of - * fields among multiple indices. The field capabilities API returns runtime - * fields like any other field. For example, a runtime field with a type of - * keyword is returned as any other field that belongs to the - * keyword family. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture fieldCaps(FieldCapsRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) FieldCapsRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * The field capabilities API returns the information about the capabilities of - * fields among multiple indices. The field capabilities API returns runtime - * fields like any other field. For example, a runtime field with a type of - * keyword is returned as any other field that belongs to the - * keyword family. - * - * @param fn - * a function that initializes a builder to create the - * {@link FieldCapsRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture fieldCaps( - Function> fn) { - return fieldCaps(fn.apply(new FieldCapsRequest.Builder()).build()); - } - - /** - * The field capabilities API returns the information about the capabilities of - * fields among multiple indices. The field capabilities API returns runtime - * fields like any other field. For example, a runtime field with a type of - * keyword is returned as any other field that belongs to the - * keyword family. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture fieldCaps() { - return this.transport.performRequestAsync(new FieldCapsRequest.Builder().build(), FieldCapsRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: get - - /** - * Get a document by its ID. Retrieves the document with the specified ID from - * an index. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> get(GetRequest request, - Class tDocumentClass) { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) GetRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.get.Response.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Get a document by its ID. Retrieves the document with the specified ID from - * an index. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> get( - Function> fn, Class tDocumentClass) { - return get(fn.apply(new GetRequest.Builder()).build(), tDocumentClass); - } - - /** - * Get a document by its ID. Retrieves the document with the specified ID from - * an index. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> get(GetRequest request, Type tDocumentType) { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) GetRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.get.Response.TDocument", getDeserializer(tDocumentType)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Get a document by its ID. Retrieves the document with the specified ID from - * an index. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> get( - Function> fn, Type tDocumentType) { - return get(fn.apply(new GetRequest.Builder()).build(), tDocumentType); - } - - // ----- Endpoint: get_script - - /** - * Get a script or search template. Retrieves a stored script or search - * template. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture getScript(GetScriptRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) GetScriptRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Get a script or search template. Retrieves a stored script or search - * template. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetScriptRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture getScript( - Function> fn) { - return getScript(fn.apply(new GetScriptRequest.Builder()).build()); - } - - // ----- Endpoint: get_source - - /** - * Get a document's source. Returns the source of a document. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> getSource(GetSourceRequest request, - Class tDocumentClass) { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) GetSourceRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.get_source.Response.TDocument", - getDeserializer(tDocumentClass)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Get a document's source. Returns the source of a document. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetSourceRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> getSource( - Function> fn, Class tDocumentClass) { - return getSource(fn.apply(new GetSourceRequest.Builder()).build(), tDocumentClass); - } - - /** - * Get a document's source. Returns the source of a document. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> getSource(GetSourceRequest request, - Type tDocumentType) { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) GetSourceRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.get_source.Response.TDocument", - getDeserializer(tDocumentType)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Get a document's source. Returns the source of a document. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetSourceRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> getSource( - Function> fn, Type tDocumentType) { - return getSource(fn.apply(new GetSourceRequest.Builder()).build(), tDocumentType); - } - - // ----- Endpoint: index - - /** - * Index a document. Adds a JSON document to the specified data stream or index - * and makes it searchable. If the target is an index and the document already - * exists, the request updates the document and increments its version. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture index(IndexRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint, IndexResponse, ErrorResponse> endpoint = (JsonEndpoint, IndexResponse, ErrorResponse>) IndexRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Index a document. Adds a JSON document to the specified data stream or index - * and makes it searchable. If the target is an index and the document already - * exists, the request updates the document and increments its version. - * - * @param fn - * a function that initializes a builder to create the - * {@link IndexRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture index( - Function, ObjectBuilder>> fn) { - return index(fn.apply(new IndexRequest.Builder()).build()); - } - - // ----- Endpoint: info - - /** - * Get cluster info. Returns basic information about the cluster. - * - * @see Documentation - * on elastic.co - */ - public CompletableFuture info() { - return this.transport.performRequestAsync(InfoRequest._INSTANCE, InfoRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: mget - - /** - * Allows to get multiple documents in one request. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> mget(MgetRequest request, - Class tDocumentClass) { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) MgetRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.mget.Response.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Allows to get multiple documents in one request. - * - * @param fn - * a function that initializes a builder to create the - * {@link MgetRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> mget( - Function> fn, Class tDocumentClass) { - return mget(fn.apply(new MgetRequest.Builder()).build(), tDocumentClass); - } - - /** - * Allows to get multiple documents in one request. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> mget(MgetRequest request, Type tDocumentType) { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) MgetRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.mget.Response.TDocument", getDeserializer(tDocumentType)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Allows to get multiple documents in one request. - * - * @param fn - * a function that initializes a builder to create the - * {@link MgetRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> mget( - Function> fn, Type tDocumentType) { - return mget(fn.apply(new MgetRequest.Builder()).build(), tDocumentType); - } - - // ----- Endpoint: msearch - - /** - * Allows to execute several search operations in one request. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> msearch(MsearchRequest request, - Class tDocumentClass) { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) MsearchRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.msearch.Response.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Allows to execute several search operations in one request. - * - * @param fn - * a function that initializes a builder to create the - * {@link MsearchRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> msearch( - Function> fn, Class tDocumentClass) { - return msearch(fn.apply(new MsearchRequest.Builder()).build(), tDocumentClass); - } - - /** - * Allows to execute several search operations in one request. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> msearch(MsearchRequest request, - Type tDocumentType) { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) MsearchRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.msearch.Response.TDocument", getDeserializer(tDocumentType)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Allows to execute several search operations in one request. - * - * @param fn - * a function that initializes a builder to create the - * {@link MsearchRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> msearch( - Function> fn, Type tDocumentType) { - return msearch(fn.apply(new MsearchRequest.Builder()).build(), tDocumentType); - } - - // ----- Endpoint: msearch_template - - /** - * Runs multiple templated searches with a single request. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> msearchTemplate( - MsearchTemplateRequest request, Class tDocumentClass) { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) MsearchTemplateRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.msearch_template.Response.TDocument", - getDeserializer(tDocumentClass)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Runs multiple templated searches with a single request. - * - * @param fn - * a function that initializes a builder to create the - * {@link MsearchTemplateRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> msearchTemplate( - Function> fn, - Class tDocumentClass) { - return msearchTemplate(fn.apply(new MsearchTemplateRequest.Builder()).build(), tDocumentClass); - } - - /** - * Runs multiple templated searches with a single request. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> msearchTemplate( - MsearchTemplateRequest request, Type tDocumentType) { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) MsearchTemplateRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.msearch_template.Response.TDocument", - getDeserializer(tDocumentType)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Runs multiple templated searches with a single request. - * - * @param fn - * a function that initializes a builder to create the - * {@link MsearchTemplateRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> msearchTemplate( - Function> fn, Type tDocumentType) { - return msearchTemplate(fn.apply(new MsearchTemplateRequest.Builder()).build(), tDocumentType); - } - - // ----- Endpoint: mtermvectors - - /** - * Returns multiple termvectors in one request. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture mtermvectors(MtermvectorsRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) MtermvectorsRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns multiple termvectors in one request. - * - * @param fn - * a function that initializes a builder to create the - * {@link MtermvectorsRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture mtermvectors( - Function> fn) { - return mtermvectors(fn.apply(new MtermvectorsRequest.Builder()).build()); - } - - /** - * Returns multiple termvectors in one request. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture mtermvectors() { - return this.transport.performRequestAsync(new MtermvectorsRequest.Builder().build(), - MtermvectorsRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: open_point_in_time - - /** - * A search request by default executes 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. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture openPointInTime(OpenPointInTimeRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) OpenPointInTimeRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * A search request by default executes 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. - * - * @param fn - * a function that initializes a builder to create the - * {@link OpenPointInTimeRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture openPointInTime( - Function> fn) { - return openPointInTime(fn.apply(new OpenPointInTimeRequest.Builder()).build()); - } - - // ----- Endpoint: ping - - /** - * Ping the cluster. Returns whether the cluster is running. - * - * @see Documentation - * on elastic.co - */ - public CompletableFuture ping() { - return this.transport.performRequestAsync(PingRequest._INSTANCE, PingRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: put_script - - /** - * Create or update a script or search template. Creates or updates a stored - * script or search template. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture putScript(PutScriptRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) PutScriptRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Create or update a script or search template. Creates or updates a stored - * script or search template. - * - * @param fn - * a function that initializes a builder to create the - * {@link PutScriptRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture putScript( - Function> fn) { - return putScript(fn.apply(new PutScriptRequest.Builder()).build()); - } - - // ----- Endpoint: rank_eval - - /** - * Enables you to evaluate the quality of ranked search results over a set of - * typical search queries. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture rankEval(RankEvalRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) RankEvalRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Enables you to evaluate the quality of ranked search results over a set of - * typical search queries. - * - * @param fn - * a function that initializes a builder to create the - * {@link RankEvalRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture rankEval( - Function> fn) { - return rankEval(fn.apply(new RankEvalRequest.Builder()).build()); - } - - // ----- Endpoint: reindex - - /** - * Reindex documents. Copies documents from a source to a destination. 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. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture reindex(ReindexRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) ReindexRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Reindex documents. Copies documents from a source to a destination. 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. - * - * @param fn - * a function that initializes a builder to create the - * {@link ReindexRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture reindex( - Function> fn) { - return reindex(fn.apply(new ReindexRequest.Builder()).build()); - } - - // ----- Endpoint: render_search_template - - /** - * Renders a search template as a search request body. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture renderSearchTemplate(RenderSearchTemplateRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) RenderSearchTemplateRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Renders a search template as a search request body. - * - * @param fn - * a function that initializes a builder to create the - * {@link RenderSearchTemplateRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture renderSearchTemplate( - Function> fn) { - return renderSearchTemplate(fn.apply(new RenderSearchTemplateRequest.Builder()).build()); - } - - /** - * Renders a search template as a search request body. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture renderSearchTemplate() { - return this.transport.performRequestAsync(new RenderSearchTemplateRequest.Builder().build(), - RenderSearchTemplateRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: scripts_painless_execute - - /** - * Run a script. Runs a script and returns a result. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> scriptsPainlessExecute( - ScriptsPainlessExecuteRequest request, Class tResultClass) { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) ScriptsPainlessExecuteRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.scripts_painless_execute.Response.TResult", - getDeserializer(tResultClass)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Run a script. Runs a script and returns a result. - * - * @param fn - * a function that initializes a builder to create the - * {@link ScriptsPainlessExecuteRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> scriptsPainlessExecute( - Function> fn, - Class tResultClass) { - return scriptsPainlessExecute(fn.apply(new ScriptsPainlessExecuteRequest.Builder()).build(), tResultClass); - } - - /** - * Run a script. Runs a script and returns a result. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> scriptsPainlessExecute( - ScriptsPainlessExecuteRequest request, Type tResultType) { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) ScriptsPainlessExecuteRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.scripts_painless_execute.Response.TResult", - getDeserializer(tResultType)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Run a script. Runs a script and returns a result. - * - * @param fn - * a function that initializes a builder to create the - * {@link ScriptsPainlessExecuteRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> scriptsPainlessExecute( - Function> fn, - Type tResultType) { - return scriptsPainlessExecute(fn.apply(new ScriptsPainlessExecuteRequest.Builder()).build(), tResultType); - } - - // ----- Endpoint: scroll - - /** - * Allows to retrieve a large numbers of results from a single search request. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> scroll(ScrollRequest request, - Class tDocumentClass) { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) ScrollRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.scroll.Response.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Allows to retrieve a large numbers of results from a single search request. - * - * @param fn - * a function that initializes a builder to create the - * {@link ScrollRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> scroll( - Function> fn, Class tDocumentClass) { - return scroll(fn.apply(new ScrollRequest.Builder()).build(), tDocumentClass); - } - - /** - * Allows to retrieve a large numbers of results from a single search request. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> scroll(ScrollRequest request, Type tDocumentType) { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) ScrollRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.scroll.Response.TDocument", getDeserializer(tDocumentType)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Allows to retrieve a large numbers of results from a single search request. - * - * @param fn - * a function that initializes a builder to create the - * {@link ScrollRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> scroll( - Function> fn, Type tDocumentType) { - return scroll(fn.apply(new ScrollRequest.Builder()).build(), tDocumentType); - } - - // ----- Endpoint: search - - /** - * Returns 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. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> search(SearchRequest request, - Class tDocumentClass) { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) SearchRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.search.Response.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns 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. - * - * @param fn - * a function that initializes a builder to create the - * {@link SearchRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> search( - Function> fn, Class tDocumentClass) { - return search(fn.apply(new SearchRequest.Builder()).build(), tDocumentClass); - } - - /** - * Returns 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. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> search(SearchRequest request, Type tDocumentType) { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) SearchRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.search.Response.TDocument", getDeserializer(tDocumentType)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns 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. - * - * @param fn - * a function that initializes a builder to create the - * {@link SearchRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> search( - Function> fn, Type tDocumentType) { - return search(fn.apply(new SearchRequest.Builder()).build(), tDocumentType); - } - - // ----- Endpoint: search_mvt - - /** - * Search a vector tile. Searches a vector tile for geospatial values. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture searchMvt(SearchMvtRequest request) { - @SuppressWarnings("unchecked") - Endpoint endpoint = (Endpoint) SearchMvtRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Search a vector tile. Searches a vector tile for geospatial values. - * - * @param fn - * a function that initializes a builder to create the - * {@link SearchMvtRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture searchMvt( - Function> fn) { - return searchMvt(fn.apply(new SearchMvtRequest.Builder()).build()); - } - - // ----- Endpoint: search_template - - /** - * Runs a search with a search template. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> searchTemplate( - SearchTemplateRequest request, Class tDocumentClass) { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) SearchTemplateRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.search_template.Response.TDocument", - getDeserializer(tDocumentClass)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Runs a search with a search template. - * - * @param fn - * a function that initializes a builder to create the - * {@link SearchTemplateRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> searchTemplate( - Function> fn, - Class tDocumentClass) { - return searchTemplate(fn.apply(new SearchTemplateRequest.Builder()).build(), tDocumentClass); - } - - /** - * Runs a search with a search template. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> searchTemplate( - SearchTemplateRequest request, Type tDocumentType) { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) SearchTemplateRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.search_template.Response.TDocument", - getDeserializer(tDocumentType)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Runs a search with a search template. - * - * @param fn - * a function that initializes a builder to create the - * {@link SearchTemplateRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> searchTemplate( - Function> fn, Type tDocumentType) { - return searchTemplate(fn.apply(new SearchTemplateRequest.Builder()).build(), tDocumentType); - } - - // ----- Endpoint: terms_enum - - /** - * The terms enum API can be used to discover terms in the index that begin with - * the provided string. It is designed for low-latency look-ups used in - * auto-complete scenarios. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture termsEnum(TermsEnumRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) TermsEnumRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * The terms enum API can be used to discover terms in the index that begin with - * the provided string. It is designed for low-latency look-ups used in - * auto-complete scenarios. - * - * @param fn - * a function that initializes a builder to create the - * {@link TermsEnumRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture termsEnum( - Function> fn) { - return termsEnum(fn.apply(new TermsEnumRequest.Builder()).build()); - } - - // ----- Endpoint: termvectors - - /** - * Get term vector information. Returns information and statistics about terms - * in the fields of a particular document. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture termvectors(TermvectorsRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint, TermvectorsResponse, ErrorResponse> endpoint = (JsonEndpoint, TermvectorsResponse, ErrorResponse>) TermvectorsRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Get term vector information. Returns information and statistics about terms - * in the fields of a particular document. - * - * @param fn - * a function that initializes a builder to create the - * {@link TermvectorsRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture termvectors( - Function, ObjectBuilder>> fn) { - return termvectors(fn.apply(new TermvectorsRequest.Builder()).build()); - } - - // ----- Endpoint: update - - /** - * Update a document. Updates a document by running a script or passing a - * partial document. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> update( - UpdateRequest request, Class tDocumentClass) { - @SuppressWarnings("unchecked") - JsonEndpoint, UpdateResponse, ErrorResponse> endpoint = (JsonEndpoint, UpdateResponse, ErrorResponse>) UpdateRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.update.Response.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Update a document. Updates a document by running a script or passing a - * partial document. - * - * @param fn - * a function that initializes a builder to create the - * {@link UpdateRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> update( - Function, ObjectBuilder>> fn, - Class tDocumentClass) { - return update(fn.apply(new UpdateRequest.Builder()).build(), tDocumentClass); - } - - /** - * Update a document. Updates a document by running a script or passing a - * partial document. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> update( - UpdateRequest request, Type tDocumentType) { - @SuppressWarnings("unchecked") - JsonEndpoint, UpdateResponse, ErrorResponse> endpoint = (JsonEndpoint, UpdateResponse, ErrorResponse>) UpdateRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.update.Response.TDocument", getDeserializer(tDocumentType)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Update a document. Updates a document by running a script or passing a - * partial document. - * - * @param fn - * a function that initializes a builder to create the - * {@link UpdateRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> update( - Function, ObjectBuilder>> fn, - Type tDocumentType) { - return update(fn.apply(new UpdateRequest.Builder()).build(), tDocumentType); - } - - // ----- Endpoint: update_by_query - - /** - * 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. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture updateByQuery(UpdateByQueryRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) UpdateByQueryRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * 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. - * - * @param fn - * a function that initializes a builder to create the - * {@link UpdateByQueryRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture updateByQuery( - Function> fn) { - return updateByQuery(fn.apply(new UpdateByQueryRequest.Builder()).build()); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchClient.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchClient.java deleted file mode 100644 index 63ece3e8c..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchClient.java +++ /dev/null @@ -1,2016 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch; - -import co.elastic.clients.ApiClient; -import co.elastic.clients.elasticsearch._types.ElasticsearchException; -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch.async_search.ElasticsearchAsyncSearchClient; -import co.elastic.clients.elasticsearch.cat.ElasticsearchCatClient; -import co.elastic.clients.elasticsearch.cluster.ElasticsearchClusterClient; -import co.elastic.clients.elasticsearch.connector.ElasticsearchConnectorClient; -import co.elastic.clients.elasticsearch.core.BulkRequest; -import co.elastic.clients.elasticsearch.core.BulkResponse; -import co.elastic.clients.elasticsearch.core.ClearScrollRequest; -import co.elastic.clients.elasticsearch.core.ClearScrollResponse; -import co.elastic.clients.elasticsearch.core.ClosePointInTimeRequest; -import co.elastic.clients.elasticsearch.core.ClosePointInTimeResponse; -import co.elastic.clients.elasticsearch.core.CountRequest; -import co.elastic.clients.elasticsearch.core.CountResponse; -import co.elastic.clients.elasticsearch.core.CreateRequest; -import co.elastic.clients.elasticsearch.core.CreateResponse; -import co.elastic.clients.elasticsearch.core.DeleteByQueryRequest; -import co.elastic.clients.elasticsearch.core.DeleteByQueryResponse; -import co.elastic.clients.elasticsearch.core.DeleteRequest; -import co.elastic.clients.elasticsearch.core.DeleteResponse; -import co.elastic.clients.elasticsearch.core.DeleteScriptRequest; -import co.elastic.clients.elasticsearch.core.DeleteScriptResponse; -import co.elastic.clients.elasticsearch.core.ExistsRequest; -import co.elastic.clients.elasticsearch.core.ExistsSourceRequest; -import co.elastic.clients.elasticsearch.core.ExplainRequest; -import co.elastic.clients.elasticsearch.core.ExplainResponse; -import co.elastic.clients.elasticsearch.core.FieldCapsRequest; -import co.elastic.clients.elasticsearch.core.FieldCapsResponse; -import co.elastic.clients.elasticsearch.core.GetRequest; -import co.elastic.clients.elasticsearch.core.GetResponse; -import co.elastic.clients.elasticsearch.core.GetScriptRequest; -import co.elastic.clients.elasticsearch.core.GetScriptResponse; -import co.elastic.clients.elasticsearch.core.GetSourceRequest; -import co.elastic.clients.elasticsearch.core.GetSourceResponse; -import co.elastic.clients.elasticsearch.core.IndexRequest; -import co.elastic.clients.elasticsearch.core.IndexResponse; -import co.elastic.clients.elasticsearch.core.InfoRequest; -import co.elastic.clients.elasticsearch.core.InfoResponse; -import co.elastic.clients.elasticsearch.core.MgetRequest; -import co.elastic.clients.elasticsearch.core.MgetResponse; -import co.elastic.clients.elasticsearch.core.MsearchRequest; -import co.elastic.clients.elasticsearch.core.MsearchResponse; -import co.elastic.clients.elasticsearch.core.MsearchTemplateRequest; -import co.elastic.clients.elasticsearch.core.MsearchTemplateResponse; -import co.elastic.clients.elasticsearch.core.MtermvectorsRequest; -import co.elastic.clients.elasticsearch.core.MtermvectorsResponse; -import co.elastic.clients.elasticsearch.core.OpenPointInTimeRequest; -import co.elastic.clients.elasticsearch.core.OpenPointInTimeResponse; -import co.elastic.clients.elasticsearch.core.PingRequest; -import co.elastic.clients.elasticsearch.core.PutScriptRequest; -import co.elastic.clients.elasticsearch.core.PutScriptResponse; -import co.elastic.clients.elasticsearch.core.RankEvalRequest; -import co.elastic.clients.elasticsearch.core.RankEvalResponse; -import co.elastic.clients.elasticsearch.core.ReindexRequest; -import co.elastic.clients.elasticsearch.core.ReindexResponse; -import co.elastic.clients.elasticsearch.core.RenderSearchTemplateRequest; -import co.elastic.clients.elasticsearch.core.RenderSearchTemplateResponse; -import co.elastic.clients.elasticsearch.core.ScriptsPainlessExecuteRequest; -import co.elastic.clients.elasticsearch.core.ScriptsPainlessExecuteResponse; -import co.elastic.clients.elasticsearch.core.ScrollRequest; -import co.elastic.clients.elasticsearch.core.ScrollResponse; -import co.elastic.clients.elasticsearch.core.SearchMvtRequest; -import co.elastic.clients.elasticsearch.core.SearchRequest; -import co.elastic.clients.elasticsearch.core.SearchResponse; -import co.elastic.clients.elasticsearch.core.SearchTemplateRequest; -import co.elastic.clients.elasticsearch.core.SearchTemplateResponse; -import co.elastic.clients.elasticsearch.core.TermsEnumRequest; -import co.elastic.clients.elasticsearch.core.TermsEnumResponse; -import co.elastic.clients.elasticsearch.core.TermvectorsRequest; -import co.elastic.clients.elasticsearch.core.TermvectorsResponse; -import co.elastic.clients.elasticsearch.core.UpdateByQueryRequest; -import co.elastic.clients.elasticsearch.core.UpdateByQueryResponse; -import co.elastic.clients.elasticsearch.core.UpdateRequest; -import co.elastic.clients.elasticsearch.core.UpdateResponse; -import co.elastic.clients.elasticsearch.enrich.ElasticsearchEnrichClient; -import co.elastic.clients.elasticsearch.eql.ElasticsearchEqlClient; -import co.elastic.clients.elasticsearch.esql.ElasticsearchEsqlClient; -import co.elastic.clients.elasticsearch.graph.ElasticsearchGraphClient; -import co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient; -import co.elastic.clients.elasticsearch.inference.ElasticsearchInferenceClient; -import co.elastic.clients.elasticsearch.ingest.ElasticsearchIngestClient; -import co.elastic.clients.elasticsearch.license.ElasticsearchLicenseClient; -import co.elastic.clients.elasticsearch.logstash.ElasticsearchLogstashClient; -import co.elastic.clients.elasticsearch.ml.ElasticsearchMlClient; -import co.elastic.clients.elasticsearch.query_rules.ElasticsearchQueryRulesClient; -import co.elastic.clients.elasticsearch.search_application.ElasticsearchSearchApplicationClient; -import co.elastic.clients.elasticsearch.security.ElasticsearchSecurityClient; -import co.elastic.clients.elasticsearch.sql.ElasticsearchSqlClient; -import co.elastic.clients.elasticsearch.synonyms.ElasticsearchSynonymsClient; -import co.elastic.clients.elasticsearch.tasks.ElasticsearchTasksClient; -import co.elastic.clients.elasticsearch.transform.ElasticsearchTransformClient; -import co.elastic.clients.transport.ElasticsearchTransport; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.JsonEndpoint; -import co.elastic.clients.transport.Transport; -import co.elastic.clients.transport.TransportOptions; -import co.elastic.clients.transport.endpoints.BinaryResponse; -import co.elastic.clients.transport.endpoints.BooleanResponse; -import co.elastic.clients.transport.endpoints.EndpointWithResponseMapperAttr; -import co.elastic.clients.util.ObjectBuilder; -import java.io.IOException; -import java.lang.reflect.Type; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Client for the namespace. - */ -public class ElasticsearchClient extends ApiClient { - - public ElasticsearchClient(ElasticsearchTransport transport) { - super(transport, null); - } - - public ElasticsearchClient(ElasticsearchTransport transport, @Nullable TransportOptions transportOptions) { - super(transport, transportOptions); - } - - @Override - public ElasticsearchClient withTransportOptions(@Nullable TransportOptions transportOptions) { - return new ElasticsearchClient(this.transport, transportOptions); - } - - // ----- Child clients - - public ElasticsearchAsyncSearchClient asyncSearch() { - return new ElasticsearchAsyncSearchClient(this.transport, this.transportOptions); - } - - public ElasticsearchCatClient cat() { - return new ElasticsearchCatClient(this.transport, this.transportOptions); - } - - public ElasticsearchClusterClient cluster() { - return new ElasticsearchClusterClient(this.transport, this.transportOptions); - } - - public ElasticsearchConnectorClient connector() { - return new ElasticsearchConnectorClient(this.transport, this.transportOptions); - } - - public ElasticsearchEnrichClient enrich() { - return new ElasticsearchEnrichClient(this.transport, this.transportOptions); - } - - public ElasticsearchEqlClient eql() { - return new ElasticsearchEqlClient(this.transport, this.transportOptions); - } - - public ElasticsearchEsqlClient esql() { - return new ElasticsearchEsqlClient(this.transport, this.transportOptions); - } - - public ElasticsearchGraphClient graph() { - return new ElasticsearchGraphClient(this.transport, this.transportOptions); - } - - public ElasticsearchIndicesClient indices() { - return new ElasticsearchIndicesClient(this.transport, this.transportOptions); - } - - public ElasticsearchInferenceClient inference() { - return new ElasticsearchInferenceClient(this.transport, this.transportOptions); - } - - public ElasticsearchIngestClient ingest() { - return new ElasticsearchIngestClient(this.transport, this.transportOptions); - } - - public ElasticsearchLicenseClient license() { - return new ElasticsearchLicenseClient(this.transport, this.transportOptions); - } - - public ElasticsearchLogstashClient logstash() { - return new ElasticsearchLogstashClient(this.transport, this.transportOptions); - } - - public ElasticsearchMlClient ml() { - return new ElasticsearchMlClient(this.transport, this.transportOptions); - } - - public ElasticsearchQueryRulesClient queryRules() { - return new ElasticsearchQueryRulesClient(this.transport, this.transportOptions); - } - - public ElasticsearchSearchApplicationClient searchApplication() { - return new ElasticsearchSearchApplicationClient(this.transport, this.transportOptions); - } - - public ElasticsearchSecurityClient security() { - return new ElasticsearchSecurityClient(this.transport, this.transportOptions); - } - - public ElasticsearchSqlClient sql() { - return new ElasticsearchSqlClient(this.transport, this.transportOptions); - } - - public ElasticsearchSynonymsClient synonyms() { - return new ElasticsearchSynonymsClient(this.transport, this.transportOptions); - } - - public ElasticsearchTasksClient tasks() { - return new ElasticsearchTasksClient(this.transport, this.transportOptions); - } - - public ElasticsearchTransformClient transform() { - return new ElasticsearchTransformClient(this.transport, this.transportOptions); - } - - // ----- Endpoint: bulk - - /** - * Bulk index or delete documents. Performs multiple indexing or delete - * operations in a single API call. This reduces overhead and can greatly - * increase indexing speed. - * - * @see Documentation - * on elastic.co - */ - - public BulkResponse bulk(BulkRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) BulkRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Bulk index or delete documents. Performs multiple indexing or delete - * operations in a single API call. This reduces overhead and can greatly - * increase indexing speed. - * - * @param fn - * a function that initializes a builder to create the - * {@link BulkRequest} - * @see Documentation - * on elastic.co - */ - - public final BulkResponse bulk(Function> fn) - throws IOException, ElasticsearchException { - return bulk(fn.apply(new BulkRequest.Builder()).build()); - } - - /** - * Bulk index or delete documents. Performs multiple indexing or delete - * operations in a single API call. This reduces overhead and can greatly - * increase indexing speed. - * - * @see Documentation - * on elastic.co - */ - - public BulkResponse bulk() throws IOException, ElasticsearchException { - return this.transport.performRequest(new BulkRequest.Builder().build(), BulkRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: clear_scroll - - /** - * Clears the search context and results for a scrolling search. - * - * @see Documentation - * on elastic.co - */ - - public ClearScrollResponse clearScroll(ClearScrollRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) ClearScrollRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Clears the search context and results for a scrolling search. - * - * @param fn - * a function that initializes a builder to create the - * {@link ClearScrollRequest} - * @see Documentation - * on elastic.co - */ - - public final ClearScrollResponse clearScroll( - Function> fn) - throws IOException, ElasticsearchException { - return clearScroll(fn.apply(new ClearScrollRequest.Builder()).build()); - } - - /** - * Clears the search context and results for a scrolling search. - * - * @see Documentation - * on elastic.co - */ - - public ClearScrollResponse clearScroll() throws IOException, ElasticsearchException { - return this.transport.performRequest(new ClearScrollRequest.Builder().build(), ClearScrollRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: close_point_in_time - - /** - * Closes a point-in-time. - * - * @see Documentation - * on elastic.co - */ - - public ClosePointInTimeResponse closePointInTime(ClosePointInTimeRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) ClosePointInTimeRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Closes a point-in-time. - * - * @param fn - * a function that initializes a builder to create the - * {@link ClosePointInTimeRequest} - * @see Documentation - * on elastic.co - */ - - public final ClosePointInTimeResponse closePointInTime( - Function> fn) - throws IOException, ElasticsearchException { - return closePointInTime(fn.apply(new ClosePointInTimeRequest.Builder()).build()); - } - - // ----- Endpoint: count - - /** - * Returns number of documents matching a query. - * - * @see Documentation - * on elastic.co - */ - - public CountResponse count(CountRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) CountRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns number of documents matching a query. - * - * @param fn - * a function that initializes a builder to create the - * {@link CountRequest} - * @see Documentation - * on elastic.co - */ - - public final CountResponse count(Function> fn) - throws IOException, ElasticsearchException { - return count(fn.apply(new CountRequest.Builder()).build()); - } - - /** - * Returns number of documents matching a query. - * - * @see Documentation - * on elastic.co - */ - - public CountResponse count() throws IOException, ElasticsearchException { - return this.transport.performRequest(new CountRequest.Builder().build(), CountRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: create - - /** - * Index a document. Adds a JSON document to the specified data stream or index - * and makes it searchable. If the target is an index and the document already - * exists, the request updates the document and increments its version. - * - * @see Documentation - * on elastic.co - */ - - public CreateResponse create(CreateRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, CreateResponse, ErrorResponse> endpoint = (JsonEndpoint, CreateResponse, ErrorResponse>) CreateRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Index a document. Adds a JSON document to the specified data stream or index - * and makes it searchable. If the target is an index and the document already - * exists, the request updates the document and increments its version. - * - * @param fn - * a function that initializes a builder to create the - * {@link CreateRequest} - * @see Documentation - * on elastic.co - */ - - public final CreateResponse create( - Function, ObjectBuilder>> fn) - throws IOException, ElasticsearchException { - return create(fn.apply(new CreateRequest.Builder()).build()); - } - - // ----- Endpoint: delete - - /** - * Delete a document. Removes a JSON document from the specified index. - * - * @see Documentation - * on elastic.co - */ - - public DeleteResponse delete(DeleteRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) DeleteRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Delete a document. Removes a JSON document from the specified index. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteRequest} - * @see Documentation - * on elastic.co - */ - - public final DeleteResponse delete(Function> fn) - throws IOException, ElasticsearchException { - return delete(fn.apply(new DeleteRequest.Builder()).build()); - } - - // ----- Endpoint: delete_by_query - - /** - * Delete documents. Deletes documents that match the specified query. - * - * @see Documentation - * on elastic.co - */ - - public DeleteByQueryResponse deleteByQuery(DeleteByQueryRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) DeleteByQueryRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Delete documents. Deletes documents that match the specified query. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteByQueryRequest} - * @see Documentation - * on elastic.co - */ - - public final DeleteByQueryResponse deleteByQuery( - Function> fn) - throws IOException, ElasticsearchException { - return deleteByQuery(fn.apply(new DeleteByQueryRequest.Builder()).build()); - } - - // ----- Endpoint: delete_script - - /** - * Delete a script or search template. Deletes a stored script or search - * template. - * - * @see Documentation - * on elastic.co - */ - - public DeleteScriptResponse deleteScript(DeleteScriptRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) DeleteScriptRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Delete a script or search template. Deletes a stored script or search - * template. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteScriptRequest} - * @see Documentation - * on elastic.co - */ - - public final DeleteScriptResponse deleteScript( - Function> fn) - throws IOException, ElasticsearchException { - return deleteScript(fn.apply(new DeleteScriptRequest.Builder()).build()); - } - - // ----- Endpoint: exists - - /** - * Check a document. Checks if a specified document exists. - * - * @see Documentation - * on elastic.co - */ - - public BooleanResponse exists(ExistsRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - Endpoint endpoint = (Endpoint) ExistsRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Check a document. Checks if a specified document exists. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExistsRequest} - * @see Documentation - * on elastic.co - */ - - public final BooleanResponse exists(Function> fn) - throws IOException, ElasticsearchException { - return exists(fn.apply(new ExistsRequest.Builder()).build()); - } - - // ----- Endpoint: exists_source - - /** - * Check for a document source. Checks if a document's _source is - * stored. - * - * @see Documentation - * on elastic.co - */ - - public BooleanResponse existsSource(ExistsSourceRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - Endpoint endpoint = (Endpoint) ExistsSourceRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Check for a document source. Checks if a document's _source is - * stored. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExistsSourceRequest} - * @see Documentation - * on elastic.co - */ - - public final BooleanResponse existsSource( - Function> fn) - throws IOException, ElasticsearchException { - return existsSource(fn.apply(new ExistsSourceRequest.Builder()).build()); - } - - // ----- Endpoint: explain - - /** - * Explain a document match result. Returns information about why a specific - * document matches, or doesn’t match, a query. - * - * @see Documentation - * on elastic.co - */ - - public ExplainResponse explain(ExplainRequest request, Class tDocumentClass) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) ExplainRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.explain.Response.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Explain a document match result. Returns information about why a specific - * document matches, or doesn’t match, a query. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExplainRequest} - * @see Documentation - * on elastic.co - */ - - public final ExplainResponse explain( - Function> fn, Class tDocumentClass) - throws IOException, ElasticsearchException { - return explain(fn.apply(new ExplainRequest.Builder()).build(), tDocumentClass); - } - - /** - * Explain a document match result. Returns information about why a specific - * document matches, or doesn’t match, a query. - * - * @see Documentation - * on elastic.co - */ - - public ExplainResponse explain(ExplainRequest request, Type tDocumentType) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) ExplainRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.explain.Response.TDocument", getDeserializer(tDocumentType)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Explain a document match result. Returns information about why a specific - * document matches, or doesn’t match, a query. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExplainRequest} - * @see Documentation - * on elastic.co - */ - - public final ExplainResponse explain( - Function> fn, Type tDocumentType) - throws IOException, ElasticsearchException { - return explain(fn.apply(new ExplainRequest.Builder()).build(), tDocumentType); - } - - // ----- Endpoint: field_caps - - /** - * The field capabilities API returns the information about the capabilities of - * fields among multiple indices. The field capabilities API returns runtime - * fields like any other field. For example, a runtime field with a type of - * keyword is returned as any other field that belongs to the - * keyword family. - * - * @see Documentation - * on elastic.co - */ - - public FieldCapsResponse fieldCaps(FieldCapsRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) FieldCapsRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * The field capabilities API returns the information about the capabilities of - * fields among multiple indices. The field capabilities API returns runtime - * fields like any other field. For example, a runtime field with a type of - * keyword is returned as any other field that belongs to the - * keyword family. - * - * @param fn - * a function that initializes a builder to create the - * {@link FieldCapsRequest} - * @see Documentation - * on elastic.co - */ - - public final FieldCapsResponse fieldCaps(Function> fn) - throws IOException, ElasticsearchException { - return fieldCaps(fn.apply(new FieldCapsRequest.Builder()).build()); - } - - /** - * The field capabilities API returns the information about the capabilities of - * fields among multiple indices. The field capabilities API returns runtime - * fields like any other field. For example, a runtime field with a type of - * keyword is returned as any other field that belongs to the - * keyword family. - * - * @see Documentation - * on elastic.co - */ - - public FieldCapsResponse fieldCaps() throws IOException, ElasticsearchException { - return this.transport.performRequest(new FieldCapsRequest.Builder().build(), FieldCapsRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: get - - /** - * Get a document by its ID. Retrieves the document with the specified ID from - * an index. - * - * @see Documentation - * on elastic.co - */ - - public GetResponse get(GetRequest request, Class tDocumentClass) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) GetRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.get.Response.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Get a document by its ID. Retrieves the document with the specified ID from - * an index. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetRequest} - * @see Documentation - * on elastic.co - */ - - public final GetResponse get(Function> fn, - Class tDocumentClass) throws IOException, ElasticsearchException { - return get(fn.apply(new GetRequest.Builder()).build(), tDocumentClass); - } - - /** - * Get a document by its ID. Retrieves the document with the specified ID from - * an index. - * - * @see Documentation - * on elastic.co - */ - - public GetResponse get(GetRequest request, Type tDocumentType) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) GetRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.get.Response.TDocument", getDeserializer(tDocumentType)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Get a document by its ID. Retrieves the document with the specified ID from - * an index. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetRequest} - * @see Documentation - * on elastic.co - */ - - public final GetResponse get(Function> fn, - Type tDocumentType) throws IOException, ElasticsearchException { - return get(fn.apply(new GetRequest.Builder()).build(), tDocumentType); - } - - // ----- Endpoint: get_script - - /** - * Get a script or search template. Retrieves a stored script or search - * template. - * - * @see Documentation - * on elastic.co - */ - - public GetScriptResponse getScript(GetScriptRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) GetScriptRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Get a script or search template. Retrieves a stored script or search - * template. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetScriptRequest} - * @see Documentation - * on elastic.co - */ - - public final GetScriptResponse getScript(Function> fn) - throws IOException, ElasticsearchException { - return getScript(fn.apply(new GetScriptRequest.Builder()).build()); - } - - // ----- Endpoint: get_source - - /** - * Get a document's source. Returns the source of a document. - * - * @see Documentation - * on elastic.co - */ - - public GetSourceResponse getSource(GetSourceRequest request, Class tDocumentClass) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) GetSourceRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.get_source.Response.TDocument", - getDeserializer(tDocumentClass)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Get a document's source. Returns the source of a document. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetSourceRequest} - * @see Documentation - * on elastic.co - */ - - public final GetSourceResponse getSource( - Function> fn, Class tDocumentClass) - throws IOException, ElasticsearchException { - return getSource(fn.apply(new GetSourceRequest.Builder()).build(), tDocumentClass); - } - - /** - * Get a document's source. Returns the source of a document. - * - * @see Documentation - * on elastic.co - */ - - public GetSourceResponse getSource(GetSourceRequest request, Type tDocumentType) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) GetSourceRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.get_source.Response.TDocument", - getDeserializer(tDocumentType)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Get a document's source. Returns the source of a document. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetSourceRequest} - * @see Documentation - * on elastic.co - */ - - public final GetSourceResponse getSource( - Function> fn, Type tDocumentType) - throws IOException, ElasticsearchException { - return getSource(fn.apply(new GetSourceRequest.Builder()).build(), tDocumentType); - } - - // ----- Endpoint: index - - /** - * Index a document. Adds a JSON document to the specified data stream or index - * and makes it searchable. If the target is an index and the document already - * exists, the request updates the document and increments its version. - * - * @see Documentation - * on elastic.co - */ - - public IndexResponse index(IndexRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, IndexResponse, ErrorResponse> endpoint = (JsonEndpoint, IndexResponse, ErrorResponse>) IndexRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Index a document. Adds a JSON document to the specified data stream or index - * and makes it searchable. If the target is an index and the document already - * exists, the request updates the document and increments its version. - * - * @param fn - * a function that initializes a builder to create the - * {@link IndexRequest} - * @see Documentation - * on elastic.co - */ - - public final IndexResponse index( - Function, ObjectBuilder>> fn) - throws IOException, ElasticsearchException { - return index(fn.apply(new IndexRequest.Builder()).build()); - } - - // ----- Endpoint: info - - /** - * Get cluster info. Returns basic information about the cluster. - * - * @see Documentation - * on elastic.co - */ - public InfoResponse info() throws IOException, ElasticsearchException { - return this.transport.performRequest(InfoRequest._INSTANCE, InfoRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: mget - - /** - * Allows to get multiple documents in one request. - * - * @see Documentation - * on elastic.co - */ - - public MgetResponse mget(MgetRequest request, Class tDocumentClass) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) MgetRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.mget.Response.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Allows to get multiple documents in one request. - * - * @param fn - * a function that initializes a builder to create the - * {@link MgetRequest} - * @see Documentation - * on elastic.co - */ - - public final MgetResponse mget(Function> fn, - Class tDocumentClass) throws IOException, ElasticsearchException { - return mget(fn.apply(new MgetRequest.Builder()).build(), tDocumentClass); - } - - /** - * Allows to get multiple documents in one request. - * - * @see Documentation - * on elastic.co - */ - - public MgetResponse mget(MgetRequest request, Type tDocumentType) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) MgetRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.mget.Response.TDocument", getDeserializer(tDocumentType)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Allows to get multiple documents in one request. - * - * @param fn - * a function that initializes a builder to create the - * {@link MgetRequest} - * @see Documentation - * on elastic.co - */ - - public final MgetResponse mget(Function> fn, - Type tDocumentType) throws IOException, ElasticsearchException { - return mget(fn.apply(new MgetRequest.Builder()).build(), tDocumentType); - } - - // ----- Endpoint: msearch - - /** - * Allows to execute several search operations in one request. - * - * @see Documentation - * on elastic.co - */ - - public MsearchResponse msearch(MsearchRequest request, Class tDocumentClass) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) MsearchRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.msearch.Response.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Allows to execute several search operations in one request. - * - * @param fn - * a function that initializes a builder to create the - * {@link MsearchRequest} - * @see Documentation - * on elastic.co - */ - - public final MsearchResponse msearch( - Function> fn, Class tDocumentClass) - throws IOException, ElasticsearchException { - return msearch(fn.apply(new MsearchRequest.Builder()).build(), tDocumentClass); - } - - /** - * Allows to execute several search operations in one request. - * - * @see Documentation - * on elastic.co - */ - - public MsearchResponse msearch(MsearchRequest request, Type tDocumentType) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) MsearchRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.msearch.Response.TDocument", getDeserializer(tDocumentType)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Allows to execute several search operations in one request. - * - * @param fn - * a function that initializes a builder to create the - * {@link MsearchRequest} - * @see Documentation - * on elastic.co - */ - - public final MsearchResponse msearch( - Function> fn, Type tDocumentType) - throws IOException, ElasticsearchException { - return msearch(fn.apply(new MsearchRequest.Builder()).build(), tDocumentType); - } - - // ----- Endpoint: msearch_template - - /** - * Runs multiple templated searches with a single request. - * - * @see Documentation - * on elastic.co - */ - - public MsearchTemplateResponse msearchTemplate(MsearchTemplateRequest request, - Class tDocumentClass) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) MsearchTemplateRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.msearch_template.Response.TDocument", - getDeserializer(tDocumentClass)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Runs multiple templated searches with a single request. - * - * @param fn - * a function that initializes a builder to create the - * {@link MsearchTemplateRequest} - * @see Documentation - * on elastic.co - */ - - public final MsearchTemplateResponse msearchTemplate( - Function> fn, - Class tDocumentClass) throws IOException, ElasticsearchException { - return msearchTemplate(fn.apply(new MsearchTemplateRequest.Builder()).build(), tDocumentClass); - } - - /** - * Runs multiple templated searches with a single request. - * - * @see Documentation - * on elastic.co - */ - - public MsearchTemplateResponse msearchTemplate(MsearchTemplateRequest request, - Type tDocumentType) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) MsearchTemplateRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.msearch_template.Response.TDocument", - getDeserializer(tDocumentType)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Runs multiple templated searches with a single request. - * - * @param fn - * a function that initializes a builder to create the - * {@link MsearchTemplateRequest} - * @see Documentation - * on elastic.co - */ - - public final MsearchTemplateResponse msearchTemplate( - Function> fn, Type tDocumentType) - throws IOException, ElasticsearchException { - return msearchTemplate(fn.apply(new MsearchTemplateRequest.Builder()).build(), tDocumentType); - } - - // ----- Endpoint: mtermvectors - - /** - * Returns multiple termvectors in one request. - * - * @see Documentation - * on elastic.co - */ - - public MtermvectorsResponse mtermvectors(MtermvectorsRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) MtermvectorsRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns multiple termvectors in one request. - * - * @param fn - * a function that initializes a builder to create the - * {@link MtermvectorsRequest} - * @see Documentation - * on elastic.co - */ - - public final MtermvectorsResponse mtermvectors( - Function> fn) - throws IOException, ElasticsearchException { - return mtermvectors(fn.apply(new MtermvectorsRequest.Builder()).build()); - } - - /** - * Returns multiple termvectors in one request. - * - * @see Documentation - * on elastic.co - */ - - public MtermvectorsResponse mtermvectors() throws IOException, ElasticsearchException { - return this.transport.performRequest(new MtermvectorsRequest.Builder().build(), MtermvectorsRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: open_point_in_time - - /** - * A search request by default executes 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. - * - * @see Documentation - * on elastic.co - */ - - public OpenPointInTimeResponse openPointInTime(OpenPointInTimeRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) OpenPointInTimeRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * A search request by default executes 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. - * - * @param fn - * a function that initializes a builder to create the - * {@link OpenPointInTimeRequest} - * @see Documentation - * on elastic.co - */ - - public final OpenPointInTimeResponse openPointInTime( - Function> fn) - throws IOException, ElasticsearchException { - return openPointInTime(fn.apply(new OpenPointInTimeRequest.Builder()).build()); - } - - // ----- Endpoint: ping - - /** - * Ping the cluster. Returns whether the cluster is running. - * - * @see Documentation - * on elastic.co - */ - public BooleanResponse ping() throws IOException, ElasticsearchException { - return this.transport.performRequest(PingRequest._INSTANCE, PingRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: put_script - - /** - * Create or update a script or search template. Creates or updates a stored - * script or search template. - * - * @see Documentation - * on elastic.co - */ - - public PutScriptResponse putScript(PutScriptRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) PutScriptRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Create or update a script or search template. Creates or updates a stored - * script or search template. - * - * @param fn - * a function that initializes a builder to create the - * {@link PutScriptRequest} - * @see Documentation - * on elastic.co - */ - - public final PutScriptResponse putScript(Function> fn) - throws IOException, ElasticsearchException { - return putScript(fn.apply(new PutScriptRequest.Builder()).build()); - } - - // ----- Endpoint: rank_eval - - /** - * Enables you to evaluate the quality of ranked search results over a set of - * typical search queries. - * - * @see Documentation - * on elastic.co - */ - - public RankEvalResponse rankEval(RankEvalRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) RankEvalRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Enables you to evaluate the quality of ranked search results over a set of - * typical search queries. - * - * @param fn - * a function that initializes a builder to create the - * {@link RankEvalRequest} - * @see Documentation - * on elastic.co - */ - - public final RankEvalResponse rankEval(Function> fn) - throws IOException, ElasticsearchException { - return rankEval(fn.apply(new RankEvalRequest.Builder()).build()); - } - - // ----- Endpoint: reindex - - /** - * Reindex documents. Copies documents from a source to a destination. 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. - * - * @see Documentation - * on elastic.co - */ - - public ReindexResponse reindex(ReindexRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) ReindexRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Reindex documents. Copies documents from a source to a destination. 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. - * - * @param fn - * a function that initializes a builder to create the - * {@link ReindexRequest} - * @see Documentation - * on elastic.co - */ - - public final ReindexResponse reindex(Function> fn) - throws IOException, ElasticsearchException { - return reindex(fn.apply(new ReindexRequest.Builder()).build()); - } - - // ----- Endpoint: render_search_template - - /** - * Renders a search template as a search request body. - * - * @see Documentation - * on elastic.co - */ - - public RenderSearchTemplateResponse renderSearchTemplate(RenderSearchTemplateRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) RenderSearchTemplateRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Renders a search template as a search request body. - * - * @param fn - * a function that initializes a builder to create the - * {@link RenderSearchTemplateRequest} - * @see Documentation - * on elastic.co - */ - - public final RenderSearchTemplateResponse renderSearchTemplate( - Function> fn) - throws IOException, ElasticsearchException { - return renderSearchTemplate(fn.apply(new RenderSearchTemplateRequest.Builder()).build()); - } - - /** - * Renders a search template as a search request body. - * - * @see Documentation - * on elastic.co - */ - - public RenderSearchTemplateResponse renderSearchTemplate() throws IOException, ElasticsearchException { - return this.transport.performRequest(new RenderSearchTemplateRequest.Builder().build(), - RenderSearchTemplateRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: scripts_painless_execute - - /** - * Run a script. Runs a script and returns a result. - * - * @see Documentation - * on elastic.co - */ - - public ScriptsPainlessExecuteResponse scriptsPainlessExecute( - ScriptsPainlessExecuteRequest request, Class tResultClass) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) ScriptsPainlessExecuteRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.scripts_painless_execute.Response.TResult", - getDeserializer(tResultClass)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Run a script. Runs a script and returns a result. - * - * @param fn - * a function that initializes a builder to create the - * {@link ScriptsPainlessExecuteRequest} - * @see Documentation - * on elastic.co - */ - - public final ScriptsPainlessExecuteResponse scriptsPainlessExecute( - Function> fn, - Class tResultClass) throws IOException, ElasticsearchException { - return scriptsPainlessExecute(fn.apply(new ScriptsPainlessExecuteRequest.Builder()).build(), tResultClass); - } - - /** - * Run a script. Runs a script and returns a result. - * - * @see Documentation - * on elastic.co - */ - - public ScriptsPainlessExecuteResponse scriptsPainlessExecute( - ScriptsPainlessExecuteRequest request, Type tResultType) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) ScriptsPainlessExecuteRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.scripts_painless_execute.Response.TResult", - getDeserializer(tResultType)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Run a script. Runs a script and returns a result. - * - * @param fn - * a function that initializes a builder to create the - * {@link ScriptsPainlessExecuteRequest} - * @see Documentation - * on elastic.co - */ - - public final ScriptsPainlessExecuteResponse scriptsPainlessExecute( - Function> fn, - Type tResultType) throws IOException, ElasticsearchException { - return scriptsPainlessExecute(fn.apply(new ScriptsPainlessExecuteRequest.Builder()).build(), tResultType); - } - - // ----- Endpoint: scroll - - /** - * Allows to retrieve a large numbers of results from a single search request. - * - * @see Documentation - * on elastic.co - */ - - public ScrollResponse scroll(ScrollRequest request, Class tDocumentClass) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) ScrollRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.scroll.Response.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Allows to retrieve a large numbers of results from a single search request. - * - * @param fn - * a function that initializes a builder to create the - * {@link ScrollRequest} - * @see Documentation - * on elastic.co - */ - - public final ScrollResponse scroll( - Function> fn, Class tDocumentClass) - throws IOException, ElasticsearchException { - return scroll(fn.apply(new ScrollRequest.Builder()).build(), tDocumentClass); - } - - /** - * Allows to retrieve a large numbers of results from a single search request. - * - * @see Documentation - * on elastic.co - */ - - public ScrollResponse scroll(ScrollRequest request, Type tDocumentType) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) ScrollRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.scroll.Response.TDocument", getDeserializer(tDocumentType)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Allows to retrieve a large numbers of results from a single search request. - * - * @param fn - * a function that initializes a builder to create the - * {@link ScrollRequest} - * @see Documentation - * on elastic.co - */ - - public final ScrollResponse scroll( - Function> fn, Type tDocumentType) - throws IOException, ElasticsearchException { - return scroll(fn.apply(new ScrollRequest.Builder()).build(), tDocumentType); - } - - // ----- Endpoint: search - - /** - * Returns 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. - * - * @see Documentation - * on elastic.co - */ - - public SearchResponse search(SearchRequest request, Class tDocumentClass) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) SearchRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.search.Response.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns 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. - * - * @param fn - * a function that initializes a builder to create the - * {@link SearchRequest} - * @see Documentation - * on elastic.co - */ - - public final SearchResponse search( - Function> fn, Class tDocumentClass) - throws IOException, ElasticsearchException { - return search(fn.apply(new SearchRequest.Builder()).build(), tDocumentClass); - } - - /** - * Returns 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. - * - * @see Documentation - * on elastic.co - */ - - public SearchResponse search(SearchRequest request, Type tDocumentType) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) SearchRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.search.Response.TDocument", getDeserializer(tDocumentType)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns 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. - * - * @param fn - * a function that initializes a builder to create the - * {@link SearchRequest} - * @see Documentation - * on elastic.co - */ - - public final SearchResponse search( - Function> fn, Type tDocumentType) - throws IOException, ElasticsearchException { - return search(fn.apply(new SearchRequest.Builder()).build(), tDocumentType); - } - - // ----- Endpoint: search_mvt - - /** - * Search a vector tile. Searches a vector tile for geospatial values. - * - * @see Documentation - * on elastic.co - */ - - public BinaryResponse searchMvt(SearchMvtRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - Endpoint endpoint = (Endpoint) SearchMvtRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Search a vector tile. Searches a vector tile for geospatial values. - * - * @param fn - * a function that initializes a builder to create the - * {@link SearchMvtRequest} - * @see Documentation - * on elastic.co - */ - - public final BinaryResponse searchMvt(Function> fn) - throws IOException, ElasticsearchException { - return searchMvt(fn.apply(new SearchMvtRequest.Builder()).build()); - } - - // ----- Endpoint: search_template - - /** - * Runs a search with a search template. - * - * @see Documentation - * on elastic.co - */ - - public SearchTemplateResponse searchTemplate(SearchTemplateRequest request, - Class tDocumentClass) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) SearchTemplateRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.search_template.Response.TDocument", - getDeserializer(tDocumentClass)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Runs a search with a search template. - * - * @param fn - * a function that initializes a builder to create the - * {@link SearchTemplateRequest} - * @see Documentation - * on elastic.co - */ - - public final SearchTemplateResponse searchTemplate( - Function> fn, - Class tDocumentClass) throws IOException, ElasticsearchException { - return searchTemplate(fn.apply(new SearchTemplateRequest.Builder()).build(), tDocumentClass); - } - - /** - * Runs a search with a search template. - * - * @see Documentation - * on elastic.co - */ - - public SearchTemplateResponse searchTemplate(SearchTemplateRequest request, - Type tDocumentType) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) SearchTemplateRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.search_template.Response.TDocument", - getDeserializer(tDocumentType)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Runs a search with a search template. - * - * @param fn - * a function that initializes a builder to create the - * {@link SearchTemplateRequest} - * @see Documentation - * on elastic.co - */ - - public final SearchTemplateResponse searchTemplate( - Function> fn, Type tDocumentType) - throws IOException, ElasticsearchException { - return searchTemplate(fn.apply(new SearchTemplateRequest.Builder()).build(), tDocumentType); - } - - // ----- Endpoint: terms_enum - - /** - * The terms enum API can be used to discover terms in the index that begin with - * the provided string. It is designed for low-latency look-ups used in - * auto-complete scenarios. - * - * @see Documentation - * on elastic.co - */ - - public TermsEnumResponse termsEnum(TermsEnumRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) TermsEnumRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * The terms enum API can be used to discover terms in the index that begin with - * the provided string. It is designed for low-latency look-ups used in - * auto-complete scenarios. - * - * @param fn - * a function that initializes a builder to create the - * {@link TermsEnumRequest} - * @see Documentation - * on elastic.co - */ - - public final TermsEnumResponse termsEnum(Function> fn) - throws IOException, ElasticsearchException { - return termsEnum(fn.apply(new TermsEnumRequest.Builder()).build()); - } - - // ----- Endpoint: termvectors - - /** - * Get term vector information. Returns information and statistics about terms - * in the fields of a particular document. - * - * @see Documentation - * on elastic.co - */ - - public TermvectorsResponse termvectors(TermvectorsRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, TermvectorsResponse, ErrorResponse> endpoint = (JsonEndpoint, TermvectorsResponse, ErrorResponse>) TermvectorsRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Get term vector information. Returns information and statistics about terms - * in the fields of a particular document. - * - * @param fn - * a function that initializes a builder to create the - * {@link TermvectorsRequest} - * @see Documentation - * on elastic.co - */ - - public final TermvectorsResponse termvectors( - Function, ObjectBuilder>> fn) - throws IOException, ElasticsearchException { - return termvectors(fn.apply(new TermvectorsRequest.Builder()).build()); - } - - // ----- Endpoint: update - - /** - * Update a document. Updates a document by running a script or passing a - * partial document. - * - * @see Documentation - * on elastic.co - */ - - public UpdateResponse update( - UpdateRequest request, Class tDocumentClass) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, UpdateResponse, ErrorResponse> endpoint = (JsonEndpoint, UpdateResponse, ErrorResponse>) UpdateRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.update.Response.TDocument", getDeserializer(tDocumentClass)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Update a document. Updates a document by running a script or passing a - * partial document. - * - * @param fn - * a function that initializes a builder to create the - * {@link UpdateRequest} - * @see Documentation - * on elastic.co - */ - - public final UpdateResponse update( - Function, ObjectBuilder>> fn, - Class tDocumentClass) throws IOException, ElasticsearchException { - return update(fn.apply(new UpdateRequest.Builder()).build(), tDocumentClass); - } - - /** - * Update a document. Updates a document by running a script or passing a - * partial document. - * - * @see Documentation - * on elastic.co - */ - - public UpdateResponse update( - UpdateRequest request, Type tDocumentType) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, UpdateResponse, ErrorResponse> endpoint = (JsonEndpoint, UpdateResponse, ErrorResponse>) UpdateRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:_global.update.Response.TDocument", getDeserializer(tDocumentType)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Update a document. Updates a document by running a script or passing a - * partial document. - * - * @param fn - * a function that initializes a builder to create the - * {@link UpdateRequest} - * @see Documentation - * on elastic.co - */ - - public final UpdateResponse update( - Function, ObjectBuilder>> fn, - Type tDocumentType) throws IOException, ElasticsearchException { - return update(fn.apply(new UpdateRequest.Builder()).build(), tDocumentType); - } - - // ----- Endpoint: update_by_query - - /** - * 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. - * - * @see Documentation - * on elastic.co - */ - - public UpdateByQueryResponse updateByQuery(UpdateByQueryRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) UpdateByQueryRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * 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. - * - * @param fn - * a function that initializes a builder to create the - * {@link UpdateByQueryRequest} - * @see Documentation - * on elastic.co - */ - - public final UpdateByQueryResponse updateByQuery( - Function> fn) - throws IOException, ElasticsearchException { - return updateByQuery(fn.apply(new UpdateByQueryRequest.Builder()).build()); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_helpers b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_helpers deleted file mode 120000 index e85ed36e5..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_helpers +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../java-client/src/main/java/co/elastic/clients/elasticsearch/_helpers \ No newline at end of file diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/AcknowledgedResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/AcknowledgedResponse.java deleted file mode 100644 index 82efd08d4..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/AcknowledgedResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -/** - * Base interface for responses that are acknowledged by the server - */ -public interface AcknowledgedResponse { - boolean acknowledged(); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/AcknowledgedResponseBase.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/AcknowledgedResponseBase.java deleted file mode 100644 index 13cb50641..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/AcknowledgedResponseBase.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.util.Objects; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.AcknowledgedResponseBase - -/** - * - * @see API - * specification - */ - -public abstract class AcknowledgedResponseBase implements AcknowledgedResponse, JsonpSerializable { - private final boolean acknowledged; - - // --------------------------------------------------------------------------------------------- - - protected AcknowledgedResponseBase(AbstractBuilder builder) { - - this.acknowledged = ApiTypeHelper.requireNonNull(builder.acknowledged, this, "acknowledged"); - - } - - /** - * Required - For a successful response, this value is always true. On failure, - * an exception is returned instead. - *

- * API name: {@code acknowledged} - */ - public final boolean acknowledged() { - return this.acknowledged; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("acknowledged"); - generator.write(this.acknowledged); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - public abstract static class AbstractBuilder> - extends - WithJsonObjectBuilderBase { - private Boolean acknowledged; - - /** - * Required - For a successful response, this value is always true. On failure, - * an exception is returned instead. - *

- * API name: {@code acknowledged} - */ - public final BuilderT acknowledged(boolean value) { - this.acknowledged = value; - return self(); - } - - protected abstract BuilderT self(); - - } - - // --------------------------------------------------------------------------------------------- - protected static > void setupAcknowledgedResponseBaseDeserializer( - ObjectDeserializer op) { - - op.add(AbstractBuilder::acknowledged, JsonpDeserializer.booleanDeserializer(), "acknowledged"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/BulkIndexByScrollFailure.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/BulkIndexByScrollFailure.java deleted file mode 100644 index 90dfec471..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/BulkIndexByScrollFailure.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Integer; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.BulkIndexByScrollFailure - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class BulkIndexByScrollFailure implements JsonpSerializable { - private final ErrorCause cause; - - private final String id; - - private final String index; - - private final int status; - - private final String type; - - // --------------------------------------------------------------------------------------------- - - private BulkIndexByScrollFailure(Builder builder) { - - this.cause = ApiTypeHelper.requireNonNull(builder.cause, this, "cause"); - this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); - this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); - this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); - this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - - } - - public static BulkIndexByScrollFailure of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code cause} - */ - public final ErrorCause cause() { - return this.cause; - } - - /** - * Required - API name: {@code id} - */ - public final String id() { - return this.id; - } - - /** - * Required - API name: {@code index} - */ - public final String index() { - return this.index; - } - - /** - * Required - API name: {@code status} - */ - public final int status() { - return this.status; - } - - /** - * Required - API name: {@code type} - */ - public final String type() { - return this.type; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("cause"); - this.cause.serialize(generator, mapper); - - generator.writeKey("id"); - generator.write(this.id); - - generator.writeKey("index"); - generator.write(this.index); - - generator.writeKey("status"); - generator.write(this.status); - - generator.writeKey("type"); - generator.write(this.type); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link BulkIndexByScrollFailure}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private ErrorCause cause; - - private String id; - - private String index; - - private Integer status; - - private String type; - - /** - * Required - API name: {@code cause} - */ - public final Builder cause(ErrorCause value) { - this.cause = value; - return this; - } - - /** - * Required - API name: {@code cause} - */ - public final Builder cause(Function> fn) { - return this.cause(fn.apply(new ErrorCause.Builder()).build()); - } - - /** - * Required - API name: {@code id} - */ - public final Builder id(String value) { - this.id = value; - return this; - } - - /** - * Required - API name: {@code index} - */ - public final Builder index(String value) { - this.index = value; - return this; - } - - /** - * Required - API name: {@code status} - */ - public final Builder status(int value) { - this.status = value; - return this; - } - - /** - * Required - API name: {@code type} - */ - public final Builder type(String value) { - this.type = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link BulkIndexByScrollFailure}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public BulkIndexByScrollFailure build() { - _checkSingleUse(); - - return new BulkIndexByScrollFailure(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link BulkIndexByScrollFailure} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, BulkIndexByScrollFailure::setupBulkIndexByScrollFailureDeserializer); - - protected static void setupBulkIndexByScrollFailureDeserializer( - ObjectDeserializer op) { - - op.add(Builder::cause, ErrorCause._DESERIALIZER, "cause"); - op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); - op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); - op.add(Builder::status, JsonpDeserializer.integerDeserializer(), "status"); - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Bytes.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Bytes.java deleted file mode 100644 index 86c5b4c26..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Bytes.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API specification - */ -@JsonpDeserializable -public enum Bytes implements JsonEnum { - Bytes("b"), - - KiloBytes("kb"), - - MegaBytes("mb"), - - GigaBytes("gb"), - - TeraBytes("tb"), - - PetaBytes("pb"), - - ; - - private final String jsonValue; - - Bytes(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Bytes.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterDetails.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterDetails.java deleted file mode 100644 index d7991c598..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterDetails.java +++ /dev/null @@ -1,322 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Long; -import java.lang.String; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.ClusterDetails - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class ClusterDetails implements JsonpSerializable { - private final ClusterSearchStatus status; - - private final String indices; - - @Nullable - private final Long took; - - private final boolean timedOut; - - @Nullable - private final ShardStatistics shards; - - private final List failures; - - // --------------------------------------------------------------------------------------------- - - private ClusterDetails(Builder builder) { - - this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); - this.indices = ApiTypeHelper.requireNonNull(builder.indices, this, "indices"); - this.took = builder.took; - this.timedOut = ApiTypeHelper.requireNonNull(builder.timedOut, this, "timedOut"); - this.shards = builder.shards; - this.failures = ApiTypeHelper.unmodifiable(builder.failures); - - } - - public static ClusterDetails of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code status} - */ - public final ClusterSearchStatus status() { - return this.status; - } - - /** - * Required - API name: {@code indices} - */ - public final String indices() { - return this.indices; - } - - /** - * API name: {@code took} - */ - @Nullable - public final Long took() { - return this.took; - } - - /** - * Required - API name: {@code timed_out} - */ - public final boolean timedOut() { - return this.timedOut; - } - - /** - * API name: {@code _shards} - */ - @Nullable - public final ShardStatistics shards() { - return this.shards; - } - - /** - * API name: {@code failures} - */ - public final List failures() { - return this.failures; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("status"); - this.status.serialize(generator, mapper); - generator.writeKey("indices"); - generator.write(this.indices); - - if (this.took != null) { - generator.writeKey("took"); - generator.write(this.took); - - } - generator.writeKey("timed_out"); - generator.write(this.timedOut); - - if (this.shards != null) { - generator.writeKey("_shards"); - this.shards.serialize(generator, mapper); - - } - if (ApiTypeHelper.isDefined(this.failures)) { - generator.writeKey("failures"); - generator.writeStartArray(); - for (ShardFailure item0 : this.failures) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ClusterDetails}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private ClusterSearchStatus status; - - private String indices; - - @Nullable - private Long took; - - private Boolean timedOut; - - @Nullable - private ShardStatistics shards; - - @Nullable - private List failures; - - /** - * Required - API name: {@code status} - */ - public final Builder status(ClusterSearchStatus value) { - this.status = value; - return this; - } - - /** - * Required - API name: {@code indices} - */ - public final Builder indices(String value) { - this.indices = value; - return this; - } - - /** - * API name: {@code took} - */ - public final Builder took(@Nullable Long value) { - this.took = value; - return this; - } - - /** - * Required - API name: {@code timed_out} - */ - public final Builder timedOut(boolean value) { - this.timedOut = value; - return this; - } - - /** - * API name: {@code _shards} - */ - public final Builder shards(@Nullable ShardStatistics value) { - this.shards = value; - return this; - } - - /** - * API name: {@code _shards} - */ - public final Builder shards(Function> fn) { - return this.shards(fn.apply(new ShardStatistics.Builder()).build()); - } - - /** - * API name: {@code failures} - *

- * Adds all elements of list to failures. - */ - public final Builder failures(List list) { - this.failures = _listAddAll(this.failures, list); - return this; - } - - /** - * API name: {@code failures} - *

- * Adds one or more values to failures. - */ - public final Builder failures(ShardFailure value, ShardFailure... values) { - this.failures = _listAdd(this.failures, value, values); - return this; - } - - /** - * API name: {@code failures} - *

- * Adds a value to failures using a builder lambda. - */ - public final Builder failures(Function> fn) { - return failures(fn.apply(new ShardFailure.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ClusterDetails}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ClusterDetails build() { - _checkSingleUse(); - - return new ClusterDetails(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ClusterDetails} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - ClusterDetails::setupClusterDetailsDeserializer); - - protected static void setupClusterDetailsDeserializer(ObjectDeserializer op) { - - op.add(Builder::status, ClusterSearchStatus._DESERIALIZER, "status"); - op.add(Builder::indices, JsonpDeserializer.stringDeserializer(), "indices"); - op.add(Builder::took, JsonpDeserializer.longDeserializer(), "took"); - op.add(Builder::timedOut, JsonpDeserializer.booleanDeserializer(), "timed_out"); - op.add(Builder::shards, ShardStatistics._DESERIALIZER, "_shards"); - op.add(Builder::failures, JsonpDeserializer.arrayDeserializer(ShardFailure._DESERIALIZER), "failures"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterInfoTarget.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterInfoTarget.java deleted file mode 100644 index 586d2ca64..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterInfoTarget.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum ClusterInfoTarget implements JsonEnum { - All("_all"), - - Http("http"), - - Ingest("ingest"), - - ThreadPool("thread_pool"), - - Script("script"), - - ; - - private final String jsonValue; - - ClusterInfoTarget(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - ClusterInfoTarget.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterSearchStatus.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterSearchStatus.java deleted file mode 100644 index 2ba0d100d..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterSearchStatus.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum ClusterSearchStatus implements JsonEnum { - Running("running"), - - Successful("successful"), - - Partial("partial"), - - Skipped("skipped"), - - Failed("failed"), - - ; - - private final String jsonValue; - - ClusterSearchStatus(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - ClusterSearchStatus.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterStatistics.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterStatistics.java deleted file mode 100644 index 40c028dcf..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterStatistics.java +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Integer; -import java.lang.String; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.ClusterStatistics - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class ClusterStatistics implements JsonpSerializable { - private final int skipped; - - private final int successful; - - private final int total; - - private final int running; - - private final int partial; - - private final int failed; - - private final Map details; - - // --------------------------------------------------------------------------------------------- - - private ClusterStatistics(Builder builder) { - - this.skipped = ApiTypeHelper.requireNonNull(builder.skipped, this, "skipped"); - this.successful = ApiTypeHelper.requireNonNull(builder.successful, this, "successful"); - this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); - this.running = ApiTypeHelper.requireNonNull(builder.running, this, "running"); - this.partial = ApiTypeHelper.requireNonNull(builder.partial, this, "partial"); - this.failed = ApiTypeHelper.requireNonNull(builder.failed, this, "failed"); - this.details = ApiTypeHelper.unmodifiable(builder.details); - - } - - public static ClusterStatistics of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code skipped} - */ - public final int skipped() { - return this.skipped; - } - - /** - * Required - API name: {@code successful} - */ - public final int successful() { - return this.successful; - } - - /** - * Required - API name: {@code total} - */ - public final int total() { - return this.total; - } - - /** - * Required - API name: {@code running} - */ - public final int running() { - return this.running; - } - - /** - * Required - API name: {@code partial} - */ - public final int partial() { - return this.partial; - } - - /** - * Required - API name: {@code failed} - */ - public final int failed() { - return this.failed; - } - - /** - * API name: {@code details} - */ - public final Map details() { - return this.details; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("skipped"); - generator.write(this.skipped); - - generator.writeKey("successful"); - generator.write(this.successful); - - generator.writeKey("total"); - generator.write(this.total); - - generator.writeKey("running"); - generator.write(this.running); - - generator.writeKey("partial"); - generator.write(this.partial); - - generator.writeKey("failed"); - generator.write(this.failed); - - if (ApiTypeHelper.isDefined(this.details)) { - generator.writeKey("details"); - generator.writeStartObject(); - for (Map.Entry item0 : this.details.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ClusterStatistics}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Integer skipped; - - private Integer successful; - - private Integer total; - - private Integer running; - - private Integer partial; - - private Integer failed; - - @Nullable - private Map details; - - /** - * Required - API name: {@code skipped} - */ - public final Builder skipped(int value) { - this.skipped = value; - return this; - } - - /** - * Required - API name: {@code successful} - */ - public final Builder successful(int value) { - this.successful = value; - return this; - } - - /** - * Required - API name: {@code total} - */ - public final Builder total(int value) { - this.total = value; - return this; - } - - /** - * Required - API name: {@code running} - */ - public final Builder running(int value) { - this.running = value; - return this; - } - - /** - * Required - API name: {@code partial} - */ - public final Builder partial(int value) { - this.partial = value; - return this; - } - - /** - * Required - API name: {@code failed} - */ - public final Builder failed(int value) { - this.failed = value; - return this; - } - - /** - * API name: {@code details} - *

- * Adds all entries of map to details. - */ - public final Builder details(Map map) { - this.details = _mapPutAll(this.details, map); - return this; - } - - /** - * API name: {@code details} - *

- * Adds an entry to details. - */ - public final Builder details(String key, ClusterDetails value) { - this.details = _mapPut(this.details, key, value); - return this; - } - - /** - * API name: {@code details} - *

- * Adds an entry to details using a builder lambda. - */ - public final Builder details(String key, Function> fn) { - return details(key, fn.apply(new ClusterDetails.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ClusterStatistics}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ClusterStatistics build() { - _checkSingleUse(); - - return new ClusterStatistics(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ClusterStatistics} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, ClusterStatistics::setupClusterStatisticsDeserializer); - - protected static void setupClusterStatisticsDeserializer(ObjectDeserializer op) { - - op.add(Builder::skipped, JsonpDeserializer.integerDeserializer(), "skipped"); - op.add(Builder::successful, JsonpDeserializer.integerDeserializer(), "successful"); - op.add(Builder::total, JsonpDeserializer.integerDeserializer(), "total"); - op.add(Builder::running, JsonpDeserializer.integerDeserializer(), "running"); - op.add(Builder::partial, JsonpDeserializer.integerDeserializer(), "partial"); - op.add(Builder::failed, JsonpDeserializer.integerDeserializer(), "failed"); - op.add(Builder::details, JsonpDeserializer.stringMapDeserializer(ClusterDetails._DESERIALIZER), "details"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Conflicts.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Conflicts.java deleted file mode 100644 index 2e580abea..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Conflicts.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum Conflicts implements JsonEnum { - /** - * Stop reindexing if there are conflicts. - */ - Abort("abort"), - - /** - * Continue reindexing even if there are conflicts. - */ - Proceed("proceed"), - - ; - - private final String jsonValue; - - Conflicts(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - Conflicts.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/CoordsGeoBounds.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/CoordsGeoBounds.java deleted file mode 100644 index 031fab42e..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/CoordsGeoBounds.java +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Double; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.CoordsGeoBounds - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class CoordsGeoBounds implements JsonpSerializable { - private final double top; - - private final double bottom; - - private final double left; - - private final double right; - - // --------------------------------------------------------------------------------------------- - - private CoordsGeoBounds(Builder builder) { - - this.top = ApiTypeHelper.requireNonNull(builder.top, this, "top"); - this.bottom = ApiTypeHelper.requireNonNull(builder.bottom, this, "bottom"); - this.left = ApiTypeHelper.requireNonNull(builder.left, this, "left"); - this.right = ApiTypeHelper.requireNonNull(builder.right, this, "right"); - - } - - public static CoordsGeoBounds of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code top} - */ - public final double top() { - return this.top; - } - - /** - * Required - API name: {@code bottom} - */ - public final double bottom() { - return this.bottom; - } - - /** - * Required - API name: {@code left} - */ - public final double left() { - return this.left; - } - - /** - * Required - API name: {@code right} - */ - public final double right() { - return this.right; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("top"); - generator.write(this.top); - - generator.writeKey("bottom"); - generator.write(this.bottom); - - generator.writeKey("left"); - generator.write(this.left); - - generator.writeKey("right"); - generator.write(this.right); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link CoordsGeoBounds}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Double top; - - private Double bottom; - - private Double left; - - private Double right; - - /** - * Required - API name: {@code top} - */ - public final Builder top(double value) { - this.top = value; - return this; - } - - /** - * Required - API name: {@code bottom} - */ - public final Builder bottom(double value) { - this.bottom = value; - return this; - } - - /** - * Required - API name: {@code left} - */ - public final Builder left(double value) { - this.left = value; - return this; - } - - /** - * Required - API name: {@code right} - */ - public final Builder right(double value) { - this.right = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link CoordsGeoBounds}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public CoordsGeoBounds build() { - _checkSingleUse(); - - return new CoordsGeoBounds(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link CoordsGeoBounds} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - CoordsGeoBounds::setupCoordsGeoBoundsDeserializer); - - protected static void setupCoordsGeoBoundsDeserializer(ObjectDeserializer op) { - - op.add(Builder::top, JsonpDeserializer.doubleDeserializer(), "top"); - op.add(Builder::bottom, JsonpDeserializer.doubleDeserializer(), "bottom"); - op.add(Builder::left, JsonpDeserializer.doubleDeserializer(), "left"); - op.add(Builder::right, JsonpDeserializer.doubleDeserializer(), "right"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/DFIIndependenceMeasure.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/DFIIndependenceMeasure.java deleted file mode 100644 index 71bc959d4..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/DFIIndependenceMeasure.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum DFIIndependenceMeasure implements JsonEnum { - Standardized("standardized"), - - Saturated("saturated"), - - Chisquared("chisquared"), - - ; - - private final String jsonValue; - - DFIIndependenceMeasure(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - DFIIndependenceMeasure.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/DFRAfterEffect.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/DFRAfterEffect.java deleted file mode 100644 index b5004f87b..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/DFRAfterEffect.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum DFRAfterEffect implements JsonEnum { - No("no"), - - B("b"), - - L("l"), - - ; - - private final String jsonValue; - - DFRAfterEffect(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - DFRAfterEffect.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/DFRBasicModel.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/DFRBasicModel.java deleted file mode 100644 index 83d456825..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/DFRBasicModel.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum DFRBasicModel implements JsonEnum { - Be("be"), - - D("d"), - - G("g"), - - If("if"), - - In("in"), - - Ine("ine"), - - P("p"), - - ; - - private final String jsonValue; - - DFRBasicModel(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - DFRBasicModel.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/DistanceUnit.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/DistanceUnit.java deleted file mode 100644 index a6b908b9b..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/DistanceUnit.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum DistanceUnit implements JsonEnum { - Inches("in"), - - Feet("ft"), - - Yards("yd"), - - Miles("mi"), - - NauticMiles("nmi"), - - Kilometers("km"), - - Meters("m"), - - Centimeters("cm"), - - Millimeters("mm"), - - ; - - private final String jsonValue; - - DistanceUnit(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - DistanceUnit.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ElasticsearchException.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ElasticsearchException.java deleted file mode 100644 index bad5ca106..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ElasticsearchException.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.transport.http.TransportHttpClient; - -import javax.annotation.Nullable; - -/** - * Exception thrown by API client methods when Elasticsearch could not accept or - * process a request. - *

- * The {@link #error()} contains the error's type and reason along with - * additional details that depend on the error type and the API endpoint that - * was called. - */ -public class ElasticsearchException extends RuntimeException { - - private final ErrorResponse response; - private final String endpointId; - @Nullable - private final TransportHttpClient.Response httpResponse; - - public ElasticsearchException(String endpointId, ErrorResponse response, - @Nullable TransportHttpClient.Response httpResponse) { - super("[" + endpointId + "] failed: [" + response.error().type() + "] " + response.error().reason()); - this.response = response; - this.endpointId = endpointId; - this.httpResponse = httpResponse; - } - - public ElasticsearchException(String endpointId, ErrorResponse response) { - this(endpointId, response, null); - } - - /** - * Identifier of the API endpoint that failed to be called. - */ - public String endpointId() { - return this.endpointId; - } - - /** - * The error response sent by Elasticsearch - */ - public ErrorResponse response() { - return this.response; - } - - /** - * The cause of the error. Shortcut for {@code response().error()}. - */ - public ErrorCause error() { - return this.response.error(); - } - - /** - * Status code returned by Elasticsearch. Shortcut for - * {@code response().status()}. - */ - public int status() { - return this.response.status(); - } - - /** - * The underlying http response, if available. - */ - @Nullable - public TransportHttpClient.Response httpResponse() { - return this.httpResponse; - } -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ElasticsearchVersionInfo.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ElasticsearchVersionInfo.java deleted file mode 100644 index ac2c58313..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ElasticsearchVersionInfo.java +++ /dev/null @@ -1,353 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.DateTime; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.ElasticsearchVersionInfo - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class ElasticsearchVersionInfo implements JsonpSerializable { - private final DateTime buildDate; - - private final String buildFlavor; - - private final String buildHash; - - private final boolean buildSnapshot; - - private final String buildType; - - private final String luceneVersion; - - private final String minimumIndexCompatibilityVersion; - - private final String minimumWireCompatibilityVersion; - - private final String number; - - // --------------------------------------------------------------------------------------------- - - private ElasticsearchVersionInfo(Builder builder) { - - this.buildDate = ApiTypeHelper.requireNonNull(builder.buildDate, this, "buildDate"); - this.buildFlavor = ApiTypeHelper.requireNonNull(builder.buildFlavor, this, "buildFlavor"); - this.buildHash = ApiTypeHelper.requireNonNull(builder.buildHash, this, "buildHash"); - this.buildSnapshot = ApiTypeHelper.requireNonNull(builder.buildSnapshot, this, "buildSnapshot"); - this.buildType = ApiTypeHelper.requireNonNull(builder.buildType, this, "buildType"); - this.luceneVersion = ApiTypeHelper.requireNonNull(builder.luceneVersion, this, "luceneVersion"); - this.minimumIndexCompatibilityVersion = ApiTypeHelper.requireNonNull(builder.minimumIndexCompatibilityVersion, - this, "minimumIndexCompatibilityVersion"); - this.minimumWireCompatibilityVersion = ApiTypeHelper.requireNonNull(builder.minimumWireCompatibilityVersion, - this, "minimumWireCompatibilityVersion"); - this.number = ApiTypeHelper.requireNonNull(builder.number, this, "number"); - - } - - public static ElasticsearchVersionInfo of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code build_date} - */ - public final DateTime buildDate() { - return this.buildDate; - } - - /** - * Required - API name: {@code build_flavor} - */ - public final String buildFlavor() { - return this.buildFlavor; - } - - /** - * Required - API name: {@code build_hash} - */ - public final String buildHash() { - return this.buildHash; - } - - /** - * Required - API name: {@code build_snapshot} - */ - public final boolean buildSnapshot() { - return this.buildSnapshot; - } - - /** - * Required - API name: {@code build_type} - */ - public final String buildType() { - return this.buildType; - } - - /** - * Required - API name: {@code lucene_version} - */ - public final String luceneVersion() { - return this.luceneVersion; - } - - /** - * Required - API name: {@code minimum_index_compatibility_version} - */ - public final String minimumIndexCompatibilityVersion() { - return this.minimumIndexCompatibilityVersion; - } - - /** - * Required - API name: {@code minimum_wire_compatibility_version} - */ - public final String minimumWireCompatibilityVersion() { - return this.minimumWireCompatibilityVersion; - } - - /** - * Required - API name: {@code number} - */ - public final String number() { - return this.number; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("build_date"); - this.buildDate.serialize(generator, mapper); - generator.writeKey("build_flavor"); - generator.write(this.buildFlavor); - - generator.writeKey("build_hash"); - generator.write(this.buildHash); - - generator.writeKey("build_snapshot"); - generator.write(this.buildSnapshot); - - generator.writeKey("build_type"); - generator.write(this.buildType); - - generator.writeKey("lucene_version"); - generator.write(this.luceneVersion); - - generator.writeKey("minimum_index_compatibility_version"); - generator.write(this.minimumIndexCompatibilityVersion); - - generator.writeKey("minimum_wire_compatibility_version"); - generator.write(this.minimumWireCompatibilityVersion); - - generator.writeKey("number"); - generator.write(this.number); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ElasticsearchVersionInfo}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private DateTime buildDate; - - private String buildFlavor; - - private String buildHash; - - private Boolean buildSnapshot; - - private String buildType; - - private String luceneVersion; - - private String minimumIndexCompatibilityVersion; - - private String minimumWireCompatibilityVersion; - - private String number; - - /** - * Required - API name: {@code build_date} - */ - public final Builder buildDate(DateTime value) { - this.buildDate = value; - return this; - } - - /** - * Required - API name: {@code build_flavor} - */ - public final Builder buildFlavor(String value) { - this.buildFlavor = value; - return this; - } - - /** - * Required - API name: {@code build_hash} - */ - public final Builder buildHash(String value) { - this.buildHash = value; - return this; - } - - /** - * Required - API name: {@code build_snapshot} - */ - public final Builder buildSnapshot(boolean value) { - this.buildSnapshot = value; - return this; - } - - /** - * Required - API name: {@code build_type} - */ - public final Builder buildType(String value) { - this.buildType = value; - return this; - } - - /** - * Required - API name: {@code lucene_version} - */ - public final Builder luceneVersion(String value) { - this.luceneVersion = value; - return this; - } - - /** - * Required - API name: {@code minimum_index_compatibility_version} - */ - public final Builder minimumIndexCompatibilityVersion(String value) { - this.minimumIndexCompatibilityVersion = value; - return this; - } - - /** - * Required - API name: {@code minimum_wire_compatibility_version} - */ - public final Builder minimumWireCompatibilityVersion(String value) { - this.minimumWireCompatibilityVersion = value; - return this; - } - - /** - * Required - API name: {@code number} - */ - public final Builder number(String value) { - this.number = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ElasticsearchVersionInfo}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ElasticsearchVersionInfo build() { - _checkSingleUse(); - - return new ElasticsearchVersionInfo(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ElasticsearchVersionInfo} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, ElasticsearchVersionInfo::setupElasticsearchVersionInfoDeserializer); - - protected static void setupElasticsearchVersionInfoDeserializer( - ObjectDeserializer op) { - - op.add(Builder::buildDate, DateTime._DESERIALIZER, "build_date"); - op.add(Builder::buildFlavor, JsonpDeserializer.stringDeserializer(), "build_flavor"); - op.add(Builder::buildHash, JsonpDeserializer.stringDeserializer(), "build_hash"); - op.add(Builder::buildSnapshot, JsonpDeserializer.booleanDeserializer(), "build_snapshot"); - op.add(Builder::buildType, JsonpDeserializer.stringDeserializer(), "build_type"); - op.add(Builder::luceneVersion, JsonpDeserializer.stringDeserializer(), "lucene_version"); - op.add(Builder::minimumIndexCompatibilityVersion, JsonpDeserializer.stringDeserializer(), - "minimum_index_compatibility_version"); - op.add(Builder::minimumWireCompatibilityVersion, JsonpDeserializer.stringDeserializer(), - "minimum_wire_compatibility_version"); - op.add(Builder::number, JsonpDeserializer.stringDeserializer(), "number"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/EmptyObject.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/EmptyObject.java deleted file mode 100644 index c0b97a9a9..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/EmptyObject.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * For empty Class assignments - * - * @see API - * specification - */ -@JsonpDeserializable -public class EmptyObject implements JsonpSerializable { - - public static final class Builder implements ObjectBuilder { - @Override - public EmptyObject build() { - return EmptyObject._INSTANCE; - } - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - generator.writeEnd(); - } - - /** - * Singleton instance for empty class {@link EmptyObject}. - */ - public static final EmptyObject _INSTANCE = new EmptyObject(); - - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer - .emptyObject(EmptyObject._INSTANCE); - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ErrorCause.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ErrorCause.java deleted file mode 100644 index 4a9156c7d..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ErrorCause.java +++ /dev/null @@ -1,425 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonData; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.ErrorCause - -/** - * Cause and details about a request failure. This class defines the properties - * common to all error types. Additional details are also provided, that depend - * on the error type. - * - * @see API - * specification - */ -@JsonpDeserializable -public class ErrorCause implements JsonpSerializable { - private final Map metadata; - - @Nullable - private final String type; - - @Nullable - private final String reason; - - @Nullable - private final String stackTrace; - - @Nullable - private final ErrorCause causedBy; - - private final List rootCause; - - private final List suppressed; - - // --------------------------------------------------------------------------------------------- - - private ErrorCause(Builder builder) { - - this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); - - this.type = builder.type; - this.reason = builder.reason; - this.stackTrace = builder.stackTrace; - this.causedBy = builder.causedBy; - this.rootCause = ApiTypeHelper.unmodifiable(builder.rootCause); - this.suppressed = ApiTypeHelper.unmodifiable(builder.suppressed); - - } - - public static ErrorCause of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Additional details about the error - */ - public final Map metadata() { - return this.metadata; - } - - /** - * The type of error - *

- * API name: {@code type} - */ - @Nullable - public final String type() { - return this.type; - } - - /** - * A human-readable explanation of the error, in english - *

- * API name: {@code reason} - */ - @Nullable - public final String reason() { - return this.reason; - } - - /** - * The server stack trace. Present only if the error_trace=true - * parameter was sent with the request. - *

- * API name: {@code stack_trace} - */ - @Nullable - public final String stackTrace() { - return this.stackTrace; - } - - /** - * API name: {@code caused_by} - */ - @Nullable - public final ErrorCause causedBy() { - return this.causedBy; - } - - /** - * API name: {@code root_cause} - */ - public final List rootCause() { - return this.rootCause; - } - - /** - * API name: {@code suppressed} - */ - public final List suppressed() { - return this.suppressed; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - for (Map.Entry item0 : this.metadata.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - - if (this.type != null) { - generator.writeKey("type"); - generator.write(this.type); - - } - if (this.reason != null) { - generator.writeKey("reason"); - generator.write(this.reason); - - } - if (this.stackTrace != null) { - generator.writeKey("stack_trace"); - generator.write(this.stackTrace); - - } - if (this.causedBy != null) { - generator.writeKey("caused_by"); - this.causedBy.serialize(generator, mapper); - - } - if (ApiTypeHelper.isDefined(this.rootCause)) { - generator.writeKey("root_cause"); - generator.writeStartArray(); - for (ErrorCause item0 : this.rootCause) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.suppressed)) { - generator.writeKey("suppressed"); - generator.writeStartArray(); - for (ErrorCause item0 : this.suppressed) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ErrorCause}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private Map metadata = new HashMap<>(); - - /** - * Additional details about the error - *

- * Adds all entries of map to metadata. - */ - public final Builder metadata(Map map) { - this.metadata = _mapPutAll(this.metadata, map); - return this; - } - - /** - * Additional details about the error - *

- * Adds an entry to metadata. - */ - public final Builder metadata(String key, JsonData value) { - this.metadata = _mapPut(this.metadata, key, value); - return this; - } - - @Nullable - private String type; - - @Nullable - private String reason; - - @Nullable - private String stackTrace; - - @Nullable - private ErrorCause causedBy; - - @Nullable - private List rootCause; - - @Nullable - private List suppressed; - - /** - * The type of error - *

- * API name: {@code type} - */ - public final Builder type(@Nullable String value) { - this.type = value; - return this; - } - - /** - * A human-readable explanation of the error, in english - *

- * API name: {@code reason} - */ - public final Builder reason(@Nullable String value) { - this.reason = value; - return this; - } - - /** - * The server stack trace. Present only if the error_trace=true - * parameter was sent with the request. - *

- * API name: {@code stack_trace} - */ - public final Builder stackTrace(@Nullable String value) { - this.stackTrace = value; - return this; - } - - /** - * API name: {@code caused_by} - */ - public final Builder causedBy(@Nullable ErrorCause value) { - this.causedBy = value; - return this; - } - - /** - * API name: {@code caused_by} - */ - public final Builder causedBy(Function> fn) { - return this.causedBy(fn.apply(new ErrorCause.Builder()).build()); - } - - /** - * API name: {@code root_cause} - *

- * Adds all elements of list to rootCause. - */ - public final Builder rootCause(List list) { - this.rootCause = _listAddAll(this.rootCause, list); - return this; - } - - /** - * API name: {@code root_cause} - *

- * Adds one or more values to rootCause. - */ - public final Builder rootCause(ErrorCause value, ErrorCause... values) { - this.rootCause = _listAdd(this.rootCause, value, values); - return this; - } - - /** - * API name: {@code root_cause} - *

- * Adds a value to rootCause using a builder lambda. - */ - public final Builder rootCause(Function> fn) { - return rootCause(fn.apply(new ErrorCause.Builder()).build()); - } - - /** - * API name: {@code suppressed} - *

- * Adds all elements of list to suppressed. - */ - public final Builder suppressed(List list) { - this.suppressed = _listAddAll(this.suppressed, list); - return this; - } - - /** - * API name: {@code suppressed} - *

- * Adds one or more values to suppressed. - */ - public final Builder suppressed(ErrorCause value, ErrorCause... values) { - this.suppressed = _listAdd(this.suppressed, value, values); - return this; - } - - /** - * API name: {@code suppressed} - *

- * Adds a value to suppressed using a builder lambda. - */ - public final Builder suppressed(Function> fn) { - return suppressed(fn.apply(new ErrorCause.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ErrorCause}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ErrorCause build() { - _checkSingleUse(); - - return new ErrorCause(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ErrorCause} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - ErrorCause::setupErrorCauseDeserializer); - - protected static void setupErrorCauseDeserializer(ObjectDeserializer op) { - - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); - op.add(Builder::reason, JsonpDeserializer.stringDeserializer(), "reason"); - op.add(Builder::stackTrace, JsonpDeserializer.stringDeserializer(), "stack_trace"); - op.add(Builder::causedBy, ErrorCause._DESERIALIZER, "caused_by"); - op.add(Builder::rootCause, JsonpDeserializer.arrayDeserializer(ErrorCause._DESERIALIZER), "root_cause"); - op.add(Builder::suppressed, JsonpDeserializer.arrayDeserializer(ErrorCause._DESERIALIZER), "suppressed"); - - op.setUnknownFieldHandler((builder, name, parser, mapper) -> { - builder.metadata(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); - }); - op.shortcutProperty("reason"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ErrorResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ErrorResponse.java deleted file mode 100644 index aa9bdfcbc..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ErrorResponse.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Integer; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.ErrorResponseBase - -/** - * The response returned by Elasticsearch when request execution did not - * succeed. - * - * @see API - * specification - */ -@JsonpDeserializable -public class ErrorResponse implements JsonpSerializable { - private final ErrorCause error; - - private final int status; - - // --------------------------------------------------------------------------------------------- - - private ErrorResponse(Builder builder) { - - this.error = ApiTypeHelper.requireNonNull(builder.error, this, "error"); - this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); - - } - - public static ErrorResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code error} - */ - public final ErrorCause error() { - return this.error; - } - - /** - * Required - API name: {@code status} - */ - public final int status() { - return this.status; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("error"); - this.error.serialize(generator, mapper); - - generator.writeKey("status"); - generator.write(this.status); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ErrorResponse}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private ErrorCause error; - - private Integer status; - - /** - * Required - API name: {@code error} - */ - public final Builder error(ErrorCause value) { - this.error = value; - return this; - } - - /** - * Required - API name: {@code error} - */ - public final Builder error(Function> fn) { - return this.error(fn.apply(new ErrorCause.Builder()).build()); - } - - /** - * Required - API name: {@code status} - */ - public final Builder status(int value) { - this.status = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ErrorResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ErrorResponse build() { - _checkSingleUse(); - - return new ErrorResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ErrorResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - ErrorResponse::setupErrorResponseDeserializer); - - protected static void setupErrorResponseDeserializer(ObjectDeserializer op) { - - op.add(Builder::error, ErrorCause._DESERIALIZER, "error"); - op.add(Builder::status, JsonpDeserializer.integerDeserializer(), "status"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ExpandWildcard.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ExpandWildcard.java deleted file mode 100644 index 29e214ce6..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ExpandWildcard.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum ExpandWildcard implements JsonEnum { - /** - * Match any data stream or index, including hidden ones. - */ - All("all"), - - /** - * Match open, non-hidden indices. Also matches any non-hidden data stream. - */ - Open("open"), - - /** - * Match closed, non-hidden indices. Also matches any non-hidden data stream. - * Data streams cannot be closed. - */ - Closed("closed"), - - /** - * Match hidden data streams and hidden indices. Must be combined with open, - * closed, or both. - */ - Hidden("hidden"), - - /** - * Wildcard expressions are not accepted. - */ - None("none"), - - ; - - private final String jsonValue; - - ExpandWildcard(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - ExpandWildcard.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/FieldSort.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/FieldSort.java deleted file mode 100644 index a0b377a02..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/FieldSort.java +++ /dev/null @@ -1,404 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.elasticsearch._types.mapping.FieldType; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.FieldSort - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class FieldSort implements JsonpSerializable { - // Single key dictionary - private final String field; - - @Nullable - private final FieldValue missing; - - @Nullable - private final SortMode mode; - - @Nullable - private final NestedSortValue nested; - - @Nullable - private final SortOrder order; - - @Nullable - private final FieldType unmappedType; - - @Nullable - private final FieldSortNumericType numericType; - - @Nullable - private final String format; - - // --------------------------------------------------------------------------------------------- - - private FieldSort(Builder builder) { - - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - - this.missing = builder.missing; - this.mode = builder.mode; - this.nested = builder.nested; - this.order = builder.order; - this.unmappedType = builder.unmappedType; - this.numericType = builder.numericType; - this.format = builder.format; - - } - - public static FieldSort of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - The target field - */ - public final String field() { - return this.field; - } - - /** - * API name: {@code missing} - */ - @Nullable - public final FieldValue missing() { - return this.missing; - } - - /** - * API name: {@code mode} - */ - @Nullable - public final SortMode mode() { - return this.mode; - } - - /** - * API name: {@code nested} - */ - @Nullable - public final NestedSortValue nested() { - return this.nested; - } - - /** - * API name: {@code order} - */ - @Nullable - public final SortOrder order() { - return this.order; - } - - /** - * API name: {@code unmapped_type} - */ - @Nullable - public final FieldType unmappedType() { - return this.unmappedType; - } - - /** - * API name: {@code numeric_type} - */ - @Nullable - public final FieldSortNumericType numericType() { - return this.numericType; - } - - /** - * API name: {@code format} - */ - @Nullable - public final String format() { - return this.format; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(this.field); - - if (this.missing != null) { - generator.writeKey("missing"); - this.missing.serialize(generator, mapper); - - } - if (this.mode != null) { - generator.writeKey("mode"); - this.mode.serialize(generator, mapper); - } - if (this.nested != null) { - generator.writeKey("nested"); - this.nested.serialize(generator, mapper); - - } - if (this.order != null) { - generator.writeKey("order"); - this.order.serialize(generator, mapper); - } - if (this.unmappedType != null) { - generator.writeKey("unmapped_type"); - this.unmappedType.serialize(generator, mapper); - } - if (this.numericType != null) { - generator.writeKey("numeric_type"); - this.numericType.serialize(generator, mapper); - } - if (this.format != null) { - generator.writeKey("format"); - generator.write(this.format); - - } - - generator.writeEnd(); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link FieldSort}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private String field; - - /** - * Required - The target field - */ - public final Builder field(String value) { - this.field = value; - return this; - } - - @Nullable - private FieldValue missing; - - @Nullable - private SortMode mode; - - @Nullable - private NestedSortValue nested; - - @Nullable - private SortOrder order; - - @Nullable - private FieldType unmappedType; - - @Nullable - private FieldSortNumericType numericType; - - @Nullable - private String format; - - /** - * API name: {@code missing} - */ - public final Builder missing(@Nullable FieldValue value) { - this.missing = value; - return this; - } - - /** - * API name: {@code missing} - */ - public final Builder missing(Function> fn) { - return this.missing(fn.apply(new FieldValue.Builder()).build()); - } - - /** - * API name: {@code missing} - */ - public final Builder missing(String value) { - this.missing = FieldValue.of(value); - return this; - } - - /** - * API name: {@code missing} - */ - public final Builder missing(long value) { - this.missing = FieldValue.of(value); - return this; - } - - /** - * API name: {@code missing} - */ - public final Builder missing(double value) { - this.missing = FieldValue.of(value); - return this; - } - - /** - * API name: {@code missing} - */ - public final Builder missing(boolean value) { - this.missing = FieldValue.of(value); - return this; - } - - /** - * API name: {@code mode} - */ - public final Builder mode(@Nullable SortMode value) { - this.mode = value; - return this; - } - - /** - * API name: {@code nested} - */ - public final Builder nested(@Nullable NestedSortValue value) { - this.nested = value; - return this; - } - - /** - * API name: {@code nested} - */ - public final Builder nested(Function> fn) { - return this.nested(fn.apply(new NestedSortValue.Builder()).build()); - } - - /** - * API name: {@code order} - */ - public final Builder order(@Nullable SortOrder value) { - this.order = value; - return this; - } - - /** - * API name: {@code unmapped_type} - */ - public final Builder unmappedType(@Nullable FieldType value) { - this.unmappedType = value; - return this; - } - - /** - * API name: {@code numeric_type} - */ - public final Builder numericType(@Nullable FieldSortNumericType value) { - this.numericType = value; - return this; - } - - /** - * API name: {@code format} - */ - public final Builder format(@Nullable String value) { - this.format = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link FieldSort}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public FieldSort build() { - _checkSingleUse(); - - return new FieldSort(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link FieldSort} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - FieldSort::setupFieldSortDeserializer); - - protected static void setupFieldSortDeserializer(ObjectDeserializer op) { - - op.add(Builder::missing, FieldValue._DESERIALIZER, "missing"); - op.add(Builder::mode, SortMode._DESERIALIZER, "mode"); - op.add(Builder::nested, NestedSortValue._DESERIALIZER, "nested"); - op.add(Builder::order, SortOrder._DESERIALIZER, "order"); - op.add(Builder::unmappedType, FieldType._DESERIALIZER, "unmapped_type"); - op.add(Builder::numericType, FieldSortNumericType._DESERIALIZER, "numeric_type"); - op.add(Builder::format, JsonpDeserializer.stringDeserializer(), "format"); - - op.setKey(Builder::field, JsonpDeserializer.stringDeserializer()); - op.shortcutProperty("order"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/FieldSortNumericType.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/FieldSortNumericType.java deleted file mode 100644 index a1117ce30..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/FieldSortNumericType.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum FieldSortNumericType implements JsonEnum { - Long("long"), - - Double("double"), - - Date("date"), - - DateNanos("date_nanos"), - - ; - - private final String jsonValue; - - FieldSortNumericType(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - FieldSortNumericType.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/FieldValue.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/FieldValue.java deleted file mode 100644 index 289399e10..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/FieldValue.java +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -//---------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------- - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonData; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.ObjectBuilderBase; -import co.elastic.clients.util.TaggedUnion; -import co.elastic.clients.util.TaggedUnionUtils; -import jakarta.json.stream.JsonGenerator; -import jakarta.json.stream.JsonParser; - -import java.lang.Boolean; -import java.lang.Double; -import java.lang.Long; -import java.lang.Object; -import java.lang.String; -import java.util.EnumSet; -import java.util.function.Consumer; - -// typedef: _types.FieldValue - -@JsonpDeserializable -public class FieldValue implements TaggedUnion, JsonpSerializable { - - public static FieldValue of(long value) { - return new FieldValue(Kind.Long, value); - } - - public static FieldValue of(double value) { - return new FieldValue(Kind.Double, value); - } - - public static FieldValue of(boolean value) { - return value ? TRUE : FALSE; - } - - public static FieldValue of(String value) { - return new FieldValue(Kind.String, value); - } - - public static FieldValue of(JsonData value) { - return new FieldValue(Kind.Any, value); - } - - public static FieldValue of(Object value) { - return of(JsonData.of(value)); - } - - public static final FieldValue NULL = new FieldValue(Kind.Null, null); - public static final FieldValue TRUE = new FieldValue(Kind.Boolean, Boolean.TRUE); - public static final FieldValue FALSE = new FieldValue(Kind.Boolean, Boolean.FALSE); - - public enum Kind { - Double, Long, Boolean, String, Null, Any - } - - private final Kind _kind; - private final Object _value; - - @Override - public final Kind _kind() { - return _kind; - } - - @Override - public final Object _get() { - return _value; - } - - public String _toJsonString() { - switch (_kind) { - case Double : - return String.valueOf(this.doubleValue()); - case Long : - return String.valueOf(this.longValue()); - case Boolean : - return String.valueOf(this.booleanValue()); - case String : - return this.stringValue(); - case Null : - return "null"; - case Any : - throw new IllegalStateException("Composite field value cannot be formatted as a string"); - - default : - throw new IllegalStateException("Unknown kind " + _kind); - } - } - - private FieldValue(Builder builder) { - this(builder._kind, builder._value); - } - - private FieldValue(Kind kind, Object value) { - this._kind = ApiTypeHelper.requireNonNull(kind, this, ""); - this._value = kind == Kind.Null ? null : ApiTypeHelper.requireNonNull(value, this, ""); - } - - public static FieldValue of(Consumer fn) { - Builder builder = new Builder(); - fn.accept(builder); - return builder.build(); - } - - /** - * Is this variant instance of kind {@code double}? - */ - public boolean isDouble() { - return _kind == Kind.Double; - } - - /** - * Get the {@code double} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code double} kind. - */ - public double doubleValue() { - return TaggedUnionUtils.get(this, Kind.Double); - } - - /** - * Is this variant instance of kind {@code long}? - */ - public boolean isLong() { - return _kind == Kind.Long; - } - - /** - * Get the {@code long} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code long} kind. - */ - public long longValue() { - return TaggedUnionUtils.get(this, Kind.Long); - } - - /** - * Is this variant instance of kind {@code boolean}? - */ - public boolean isBoolean() { - return _kind == Kind.Boolean; - } - - /** - * Get the {@code boolean} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code boolean} kind. - */ - public boolean booleanValue() { - return TaggedUnionUtils.get(this, Kind.Boolean); - } - - /** - * Is this variant instance of kind {@code string}? - */ - public boolean isString() { - return _kind == Kind.String; - } - - /** - * Get the {@code string} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code string} kind. - */ - public String stringValue() { - return TaggedUnionUtils.get(this, Kind.String); - } - - /** - * Is this variant instance of kind {@code any}? - */ - public boolean isAny() { - return _kind == Kind.Any; - } - - /** - * Get the {@code any} variant value, used to represent non-scalar values (i.e. - * objects and arrays) - * - * @throws IllegalStateException - * if the current variant is not of the {@code string} kind. - */ - public JsonData anyValue() { - return TaggedUnionUtils.get(this, Kind.Any); - } - - /** - * Is this variant instance of kind {@code null}? - */ - public boolean isNull() { - return _kind == Kind.Null; - } - - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - switch (_kind) { - case Double : - generator.write(((Double) this._value)); - break; - case Long : - generator.write(((Long) this._value)); - break; - case Boolean : - generator.write(((Boolean) this._value)); - break; - case String : - generator.write(((String) this._value)); - break; - case Null : - generator.writeNull(); - break; - case Any : - ((JsonData) this._value).serialize(generator, mapper); - break; - } - } - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Kind _kind; - private Object _value; - - public ObjectBuilder doubleValue(double v) { - this._kind = Kind.Double; - this._value = v; - return this; - } - - public ObjectBuilder longValue(long v) { - this._kind = Kind.Long; - this._value = v; - return this; - } - - public ObjectBuilder booleanValue(boolean v) { - this._kind = Kind.Boolean; - this._value = v; - return this; - } - - public ObjectBuilder stringValue(String v) { - this._kind = Kind.String; - this._value = v; - return this; - } - - public ObjectBuilder anyValue(JsonData v) { - this._kind = Kind.Any; - this._value = v; - return this; - } - - public ObjectBuilder nullValue() { - this._kind = Kind.Null; - this._value = null; - return this; - } - - public FieldValue build() { - _checkSingleUse(); - return new FieldValue(this); - } - } - - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer - .lazy(() -> JsonpDeserializer.of(EnumSet.of(JsonParser.Event.VALUE_STRING, JsonParser.Event.VALUE_NUMBER, - JsonParser.Event.VALUE_NULL, JsonParser.Event.VALUE_TRUE, JsonParser.Event.VALUE_FALSE, - JsonParser.Event.START_OBJECT, JsonParser.Event.START_ARRAY), (parser, mapper, event) -> { - switch (event) { - case VALUE_NULL : - return NULL; - case VALUE_STRING : - return FieldValue.of(parser.getString()); - case VALUE_TRUE : - return FieldValue.of(true); - case VALUE_FALSE : - return FieldValue.of(false); - case VALUE_NUMBER : - if (parser.isIntegralNumber()) { - return FieldValue.of(parser.getLong()); - } else { - return FieldValue.of(parser.getBigDecimal().doubleValue()); - } - case START_OBJECT : - case START_ARRAY : - return FieldValue.of(JsonData.of(parser.getValue())); - } - return null; - })); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoBounds.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoBounds.java deleted file mode 100644 index 514b2f8b5..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoBounds.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.json.UnionDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.ObjectBuilderBase; -import co.elastic.clients.util.TaggedUnion; -import co.elastic.clients.util.TaggedUnionUtils; -import jakarta.json.stream.JsonGenerator; -import java.lang.Object; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.GeoBounds - -/** - * A geo bounding box. It can be represented in various ways: - *

    - *
  • as 4 top/bottom/left/right coordinates
  • - *
  • as 2 top_left / bottom_right points
  • - *
  • as 2 top_right / bottom_left points
  • - *
  • as a WKT bounding box
  • - *
- * - * @see API - * specification - */ -@JsonpDeserializable -public class GeoBounds implements TaggedUnion, JsonpSerializable { - - public enum Kind { - Coords, Tlbr, Trbl, Wkt - - } - - private final Kind _kind; - private final Object _value; - - @Override - public final Kind _kind() { - return _kind; - } - - @Override - public final Object _get() { - return _value; - } - - private GeoBounds(Kind kind, Object value) { - this._kind = kind; - this._value = value; - } - - private GeoBounds(Builder builder) { - - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - - } - - public static GeoBounds of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Is this variant instance of kind {@code coords}? - */ - public boolean isCoords() { - return _kind == Kind.Coords; - } - - /** - * Get the {@code coords} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code coords} kind. - */ - public CoordsGeoBounds coords() { - return TaggedUnionUtils.get(this, Kind.Coords); - } - - /** - * Is this variant instance of kind {@code tlbr}? - */ - public boolean isTlbr() { - return _kind == Kind.Tlbr; - } - - /** - * Get the {@code tlbr} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code tlbr} kind. - */ - public TopLeftBottomRightGeoBounds tlbr() { - return TaggedUnionUtils.get(this, Kind.Tlbr); - } - - /** - * Is this variant instance of kind {@code trbl}? - */ - public boolean isTrbl() { - return _kind == Kind.Trbl; - } - - /** - * Get the {@code trbl} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code trbl} kind. - */ - public TopRightBottomLeftGeoBounds trbl() { - return TaggedUnionUtils.get(this, Kind.Trbl); - } - - /** - * Is this variant instance of kind {@code wkt}? - */ - public boolean isWkt() { - return _kind == Kind.Wkt; - } - - /** - * Get the {@code wkt} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code wkt} kind. - */ - public WktGeoBounds wkt() { - return TaggedUnionUtils.get(this, Kind.Wkt); - } - - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - if (_value instanceof JsonpSerializable) { - ((JsonpSerializable) _value).serialize(generator, mapper); - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Kind _kind; - private Object _value; - - public ObjectBuilder coords(CoordsGeoBounds v) { - this._kind = Kind.Coords; - this._value = v; - return this; - } - - public ObjectBuilder coords(Function> fn) { - return this.coords(fn.apply(new CoordsGeoBounds.Builder()).build()); - } - - public ObjectBuilder tlbr(TopLeftBottomRightGeoBounds v) { - this._kind = Kind.Tlbr; - this._value = v; - return this; - } - - public ObjectBuilder tlbr( - Function> fn) { - return this.tlbr(fn.apply(new TopLeftBottomRightGeoBounds.Builder()).build()); - } - - public ObjectBuilder trbl(TopRightBottomLeftGeoBounds v) { - this._kind = Kind.Trbl; - this._value = v; - return this; - } - - public ObjectBuilder trbl( - Function> fn) { - return this.trbl(fn.apply(new TopRightBottomLeftGeoBounds.Builder()).build()); - } - - public ObjectBuilder wkt(WktGeoBounds v) { - this._kind = Kind.Wkt; - this._value = v; - return this; - } - - public ObjectBuilder wkt(Function> fn) { - return this.wkt(fn.apply(new WktGeoBounds.Builder()).build()); - } - - public GeoBounds build() { - _checkSingleUse(); - return new GeoBounds(this); - } - - } - - private static JsonpDeserializer buildGeoBoundsDeserializer() { - return new UnionDeserializer.Builder(GeoBounds::new, false) - .addMember(Kind.Coords, CoordsGeoBounds._DESERIALIZER) - .addMember(Kind.Tlbr, TopLeftBottomRightGeoBounds._DESERIALIZER) - .addMember(Kind.Trbl, TopRightBottomLeftGeoBounds._DESERIALIZER) - .addMember(Kind.Wkt, WktGeoBounds._DESERIALIZER).build(); - } - - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer - .lazy(GeoBounds::buildGeoBoundsDeserializer); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoBoundsBuilders.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoBoundsBuilders.java deleted file mode 100644 index c1b3f2e30..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoBoundsBuilders.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.util.ObjectBuilder; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Builders for {@link GeoBounds} variants. - */ -public class GeoBoundsBuilders { - private GeoBoundsBuilders() { - } - - /** - * Creates a builder for the {@link CoordsGeoBounds coords} {@code GeoBounds} - * variant. - */ - public static CoordsGeoBounds.Builder coords() { - return new CoordsGeoBounds.Builder(); - } - - /** - * Creates a builder for the {@link TopLeftBottomRightGeoBounds tlbr} - * {@code GeoBounds} variant. - */ - public static TopLeftBottomRightGeoBounds.Builder tlbr() { - return new TopLeftBottomRightGeoBounds.Builder(); - } - - /** - * Creates a builder for the {@link TopRightBottomLeftGeoBounds trbl} - * {@code GeoBounds} variant. - */ - public static TopRightBottomLeftGeoBounds.Builder trbl() { - return new TopRightBottomLeftGeoBounds.Builder(); - } - - /** - * Creates a builder for the {@link WktGeoBounds wkt} {@code GeoBounds} variant. - */ - public static WktGeoBounds.Builder wkt() { - return new WktGeoBounds.Builder(); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoDistanceSort.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoDistanceSort.java deleted file mode 100644 index 88626e8cf..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoDistanceSort.java +++ /dev/null @@ -1,386 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.GeoDistanceSort - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class GeoDistanceSort implements SortOptionsVariant, JsonpSerializable { - private final String field; - - private final List location; - - @Nullable - private final SortMode mode; - - @Nullable - private final GeoDistanceType distanceType; - - @Nullable - private final Boolean ignoreUnmapped; - - @Nullable - private final SortOrder order; - - @Nullable - private final DistanceUnit unit; - - @Nullable - private final NestedSortValue nested; - - // --------------------------------------------------------------------------------------------- - - private GeoDistanceSort(Builder builder) { - - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - this.location = ApiTypeHelper.unmodifiableRequired(builder.location, this, "location"); - - this.mode = builder.mode; - this.distanceType = builder.distanceType; - this.ignoreUnmapped = builder.ignoreUnmapped; - this.order = builder.order; - this.unit = builder.unit; - this.nested = builder.nested; - - } - - public static GeoDistanceSort of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * SortOptions variant kind. - */ - @Override - public SortOptions.Kind _sortOptionsKind() { - return SortOptions.Kind.GeoDistance; - } - - /** - * Required - - */ - public final String field() { - return this.field; - } - - /** - * Required - - */ - public final List location() { - return this.location; - } - - /** - * API name: {@code mode} - */ - @Nullable - public final SortMode mode() { - return this.mode; - } - - /** - * API name: {@code distance_type} - */ - @Nullable - public final GeoDistanceType distanceType() { - return this.distanceType; - } - - /** - * API name: {@code ignore_unmapped} - */ - @Nullable - public final Boolean ignoreUnmapped() { - return this.ignoreUnmapped; - } - - /** - * API name: {@code order} - */ - @Nullable - public final SortOrder order() { - return this.order; - } - - /** - * API name: {@code unit} - */ - @Nullable - public final DistanceUnit unit() { - return this.unit; - } - - /** - * API name: {@code nested} - */ - @Nullable - public final NestedSortValue nested() { - return this.nested; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey(this.field); - generator.writeStartArray(); - for (GeoLocation item0 : this.location) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - if (this.mode != null) { - generator.writeKey("mode"); - this.mode.serialize(generator, mapper); - } - if (this.distanceType != null) { - generator.writeKey("distance_type"); - this.distanceType.serialize(generator, mapper); - } - if (this.ignoreUnmapped != null) { - generator.writeKey("ignore_unmapped"); - generator.write(this.ignoreUnmapped); - - } - if (this.order != null) { - generator.writeKey("order"); - this.order.serialize(generator, mapper); - } - if (this.unit != null) { - generator.writeKey("unit"); - this.unit.serialize(generator, mapper); - } - if (this.nested != null) { - generator.writeKey("nested"); - this.nested.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GeoDistanceSort}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private String field; - - private List location; - - /** - * Required - - */ - public final Builder field(String value) { - this.field = value; - return this; - } - - /** - * Required - Adds all elements of list to location. - */ - public final Builder location(List list) { - this.location = _listAddAll(this.location, list); - return this; - } - - /** - * Required - Adds one or more values to location. - */ - public final Builder location(GeoLocation value, GeoLocation... values) { - this.location = _listAdd(this.location, value, values); - return this; - } - - /** - * Required - Adds a value to location using a builder lambda. - */ - public final Builder location(Function> fn) { - return location(fn.apply(new GeoLocation.Builder()).build()); - } - - @Nullable - private SortMode mode; - - @Nullable - private GeoDistanceType distanceType; - - @Nullable - private Boolean ignoreUnmapped; - - @Nullable - private SortOrder order; - - @Nullable - private DistanceUnit unit; - - @Nullable - private NestedSortValue nested; - - /** - * API name: {@code mode} - */ - public final Builder mode(@Nullable SortMode value) { - this.mode = value; - return this; - } - - /** - * API name: {@code distance_type} - */ - public final Builder distanceType(@Nullable GeoDistanceType value) { - this.distanceType = value; - return this; - } - - /** - * API name: {@code ignore_unmapped} - */ - public final Builder ignoreUnmapped(@Nullable Boolean value) { - this.ignoreUnmapped = value; - return this; - } - - /** - * API name: {@code order} - */ - public final Builder order(@Nullable SortOrder value) { - this.order = value; - return this; - } - - /** - * API name: {@code unit} - */ - public final Builder unit(@Nullable DistanceUnit value) { - this.unit = value; - return this; - } - - /** - * API name: {@code nested} - */ - public final Builder nested(@Nullable NestedSortValue value) { - this.nested = value; - return this; - } - - /** - * API name: {@code nested} - */ - public final Builder nested(Function> fn) { - return this.nested(fn.apply(new NestedSortValue.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link GeoDistanceSort}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GeoDistanceSort build() { - _checkSingleUse(); - - return new GeoDistanceSort(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link GeoDistanceSort} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - GeoDistanceSort::setupGeoDistanceSortDeserializer); - - protected static void setupGeoDistanceSortDeserializer(ObjectDeserializer op) { - - op.add(Builder::mode, SortMode._DESERIALIZER, "mode"); - op.add(Builder::distanceType, GeoDistanceType._DESERIALIZER, "distance_type"); - op.add(Builder::ignoreUnmapped, JsonpDeserializer.booleanDeserializer(), "ignore_unmapped"); - op.add(Builder::order, SortOrder._DESERIALIZER, "order"); - op.add(Builder::unit, DistanceUnit._DESERIALIZER, "unit"); - op.add(Builder::nested, NestedSortValue._DESERIALIZER, "nested"); - - op.setUnknownFieldHandler((builder, name, parser, mapper) -> { - builder.field(name); - builder.location( - JsonpDeserializer.arrayDeserializer(GeoLocation._DESERIALIZER).deserialize(parser, mapper)); - }); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoDistanceType.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoDistanceType.java deleted file mode 100644 index 7bae7004c..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoDistanceType.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum GeoDistanceType implements JsonEnum { - /** - * The arc calculation is the most accurate. - */ - Arc("arc"), - - /** - * The plane calculation is faster but less accurate. - */ - Plane("plane"), - - ; - - private final String jsonValue; - - GeoDistanceType(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - GeoDistanceType.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoHashLocation.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoHashLocation.java deleted file mode 100644 index 262704160..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoHashLocation.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.GeoHashLocation - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class GeoHashLocation implements JsonpSerializable { - private final String geohash; - - // --------------------------------------------------------------------------------------------- - - private GeoHashLocation(Builder builder) { - - this.geohash = ApiTypeHelper.requireNonNull(builder.geohash, this, "geohash"); - - } - - public static GeoHashLocation of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code geohash} - */ - public final String geohash() { - return this.geohash; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("geohash"); - generator.write(this.geohash); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GeoHashLocation}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private String geohash; - - /** - * Required - API name: {@code geohash} - */ - public final Builder geohash(String value) { - this.geohash = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link GeoHashLocation}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GeoHashLocation build() { - _checkSingleUse(); - - return new GeoHashLocation(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link GeoHashLocation} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - GeoHashLocation::setupGeoHashLocationDeserializer); - - protected static void setupGeoHashLocationDeserializer(ObjectDeserializer op) { - - op.add(Builder::geohash, JsonpDeserializer.stringDeserializer(), "geohash"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoHashPrecision.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoHashPrecision.java deleted file mode 100644 index a0661a79d..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoHashPrecision.java +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.json.UnionDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.ObjectBuilderBase; -import co.elastic.clients.util.TaggedUnion; -import co.elastic.clients.util.TaggedUnionUtils; -import jakarta.json.stream.JsonGenerator; -import java.lang.Number; -import java.lang.Object; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.GeoHashPrecision - -/** - * A precision that can be expressed as a geohash length between 1 and 12, or a - * distance measure like "1km", "10m". - * - * @see API - * specification - */ -@JsonpDeserializable -public class GeoHashPrecision implements TaggedUnion, JsonpSerializable { - - public enum Kind { - GeohashLength, Distance - - } - - private final Kind _kind; - private final Object _value; - - @Override - public final Kind _kind() { - return _kind; - } - - @Override - public final Object _get() { - return _value; - } - - private GeoHashPrecision(Kind kind, Object value) { - this._kind = kind; - this._value = value; - } - - public String _toJsonString() { - switch (_kind) { - case GeohashLength : - return this.geohashLength().toString(); - case Distance : - return this.distance(); - - default : - throw new IllegalStateException("Unknown kind " + _kind); - } - } - - private GeoHashPrecision(Builder builder) { - - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - - } - - public static GeoHashPrecision of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Is this variant instance of kind {@code geohash_length}? - */ - public boolean isGeohashLength() { - return _kind == Kind.GeohashLength; - } - - /** - * Get the {@code geohash_length} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code geohash_length} kind. - */ - public Number geohashLength() { - return TaggedUnionUtils.get(this, Kind.GeohashLength); - } - - /** - * Is this variant instance of kind {@code distance}? - */ - public boolean isDistance() { - return _kind == Kind.Distance; - } - - /** - * Get the {@code distance} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code distance} kind. - */ - public String distance() { - return TaggedUnionUtils.get(this, Kind.Distance); - } - - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - if (_value instanceof JsonpSerializable) { - ((JsonpSerializable) _value).serialize(generator, mapper); - } else { - switch (_kind) { - case GeohashLength : - generator.write(((Number) this._value).doubleValue()); - - break; - case Distance : - generator.write(((String) this._value)); - - break; - } - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Kind _kind; - private Object _value; - - public ObjectBuilder geohashLength(Number v) { - this._kind = Kind.GeohashLength; - this._value = v; - return this; - } - - public ObjectBuilder distance(String v) { - this._kind = Kind.Distance; - this._value = v; - return this; - } - - public GeoHashPrecision build() { - _checkSingleUse(); - return new GeoHashPrecision(this); - } - - } - - private static JsonpDeserializer buildGeoHashPrecisionDeserializer() { - return new UnionDeserializer.Builder(GeoHashPrecision::new, false) - .addMember(Kind.GeohashLength, JsonpDeserializer.numberDeserializer()) - .addMember(Kind.Distance, JsonpDeserializer.stringDeserializer()).build(); - } - - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer - .lazy(GeoHashPrecision::buildGeoHashPrecisionDeserializer); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoHashPrecisionBuilders.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoHashPrecisionBuilders.java deleted file mode 100644 index cb2a78226..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoHashPrecisionBuilders.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.util.ObjectBuilder; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Builders for {@link GeoHashPrecision} variants. - *

- * Variants geohash_length, distance are not available - * here as they don't have a dedicated class. Use {@link GeoHashPrecision}'s - * builder for these. - * - */ -public class GeoHashPrecisionBuilders { - private GeoHashPrecisionBuilders() { - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoLine.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoLine.java deleted file mode 100644 index 9c5f892ba..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoLine.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Double; -import java.lang.String; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.GeoLine - -/** - * A GeoJson GeoLine. - * - * @see API - * specification - */ -@JsonpDeserializable -public class GeoLine implements JsonpSerializable { - private final String type; - - private final List> coordinates; - - // --------------------------------------------------------------------------------------------- - - private GeoLine(Builder builder) { - - this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - this.coordinates = ApiTypeHelper.unmodifiableRequired(builder.coordinates, this, "coordinates"); - - } - - public static GeoLine of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Always "LineString" - *

- * API name: {@code type} - */ - public final String type() { - return this.type; - } - - /** - * Required - Array of [lon, lat] coordinates - *

- * API name: {@code coordinates} - */ - public final List> coordinates() { - return this.coordinates; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("type"); - generator.write(this.type); - - if (ApiTypeHelper.isDefined(this.coordinates)) { - generator.writeKey("coordinates"); - generator.writeStartArray(); - for (List item0 : this.coordinates) { - generator.writeStartArray(); - if (item0 != null) { - for (Double item1 : item0) { - generator.write(item1); - - } - } - generator.writeEnd(); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GeoLine}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private String type; - - private List> coordinates; - - /** - * Required - Always "LineString" - *

- * API name: {@code type} - */ - public final Builder type(String value) { - this.type = value; - return this; - } - - /** - * Required - Array of [lon, lat] coordinates - *

- * API name: {@code coordinates} - *

- * Adds all elements of list to coordinates. - */ - public final Builder coordinates(List> list) { - this.coordinates = _listAddAll(this.coordinates, list); - return this; - } - - /** - * Required - Array of [lon, lat] coordinates - *

- * API name: {@code coordinates} - *

- * Adds one or more values to coordinates. - */ - public final Builder coordinates(List value, List... values) { - this.coordinates = _listAdd(this.coordinates, value, values); - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link GeoLine}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GeoLine build() { - _checkSingleUse(); - - return new GeoLine(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link GeoLine} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - GeoLine::setupGeoLineDeserializer); - - protected static void setupGeoLineDeserializer(ObjectDeserializer op) { - - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); - op.add(Builder::coordinates, JsonpDeserializer.arrayDeserializer( - JsonpDeserializer.arrayDeserializer(JsonpDeserializer.doubleDeserializer())), "coordinates"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoLocation.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoLocation.java deleted file mode 100644 index 5b59638a3..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoLocation.java +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.json.UnionDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.ObjectBuilderBase; -import co.elastic.clients.util.TaggedUnion; -import co.elastic.clients.util.TaggedUnionUtils; -import jakarta.json.stream.JsonGenerator; -import java.lang.Double; -import java.lang.Object; -import java.lang.String; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.GeoLocation - -/** - * A latitude/longitude as a 2 dimensional point. It can be represented in - * various ways: - *

    - *
  • as a {lat, long} object
  • - *
  • as a geo hash value
  • - *
  • as a [lon, lat] array
  • - *
  • as a string in "<lat>, <lon>" or WKT - * point formats
  • - *
- * - * @see API - * specification - */ -@JsonpDeserializable -public class GeoLocation implements TaggedUnion, JsonpSerializable { - - public enum Kind { - Coords, Geohash, Latlon, Text - - } - - private final Kind _kind; - private final Object _value; - - @Override - public final Kind _kind() { - return _kind; - } - - @Override - public final Object _get() { - return _value; - } - - private GeoLocation(Kind kind, Object value) { - this._kind = kind; - this._value = value; - } - - private GeoLocation(Builder builder) { - - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - - } - - public static GeoLocation of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Is this variant instance of kind {@code coords}? - */ - public boolean isCoords() { - return _kind == Kind.Coords; - } - - /** - * Get the {@code coords} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code coords} kind. - */ - public List coords() { - return TaggedUnionUtils.get(this, Kind.Coords); - } - - /** - * Is this variant instance of kind {@code geohash}? - */ - public boolean isGeohash() { - return _kind == Kind.Geohash; - } - - /** - * Get the {@code geohash} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code geohash} kind. - */ - public GeoHashLocation geohash() { - return TaggedUnionUtils.get(this, Kind.Geohash); - } - - /** - * Is this variant instance of kind {@code latlon}? - */ - public boolean isLatlon() { - return _kind == Kind.Latlon; - } - - /** - * Get the {@code latlon} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code latlon} kind. - */ - public LatLonGeoLocation latlon() { - return TaggedUnionUtils.get(this, Kind.Latlon); - } - - /** - * Is this variant instance of kind {@code text}? - */ - public boolean isText() { - return _kind == Kind.Text; - } - - /** - * Get the {@code text} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code text} kind. - */ - public String text() { - return TaggedUnionUtils.get(this, Kind.Text); - } - - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - if (_value instanceof JsonpSerializable) { - ((JsonpSerializable) _value).serialize(generator, mapper); - } else { - switch (_kind) { - case Coords : - generator.writeStartArray(); - for (Double item0 : ((List) this._value)) { - generator.write(item0); - - } - generator.writeEnd(); - - break; - case Text : - generator.write(((String) this._value)); - - break; - } - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Kind _kind; - private Object _value; - - public ObjectBuilder coords(List v) { - this._kind = Kind.Coords; - this._value = v; - return this; - } - - public ObjectBuilder geohash(GeoHashLocation v) { - this._kind = Kind.Geohash; - this._value = v; - return this; - } - - public ObjectBuilder geohash( - Function> fn) { - return this.geohash(fn.apply(new GeoHashLocation.Builder()).build()); - } - - public ObjectBuilder latlon(LatLonGeoLocation v) { - this._kind = Kind.Latlon; - this._value = v; - return this; - } - - public ObjectBuilder latlon( - Function> fn) { - return this.latlon(fn.apply(new LatLonGeoLocation.Builder()).build()); - } - - public ObjectBuilder text(String v) { - this._kind = Kind.Text; - this._value = v; - return this; - } - - public GeoLocation build() { - _checkSingleUse(); - return new GeoLocation(this); - } - - } - - private static JsonpDeserializer buildGeoLocationDeserializer() { - return new UnionDeserializer.Builder(GeoLocation::new, false) - .addMember(Kind.Coords, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.doubleDeserializer())) - .addMember(Kind.Geohash, GeoHashLocation._DESERIALIZER) - .addMember(Kind.Latlon, LatLonGeoLocation._DESERIALIZER) - .addMember(Kind.Text, JsonpDeserializer.stringDeserializer()).build(); - } - - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer - .lazy(GeoLocation::buildGeoLocationDeserializer); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoLocationBuilders.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoLocationBuilders.java deleted file mode 100644 index 2a6abee76..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoLocationBuilders.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.util.ObjectBuilder; -import java.lang.Double; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Builders for {@link GeoLocation} variants. - *

- * Variants coords, text are not available here as - * they don't have a dedicated class. Use {@link GeoLocation}'s builder for - * these. - * - */ -public class GeoLocationBuilders { - private GeoLocationBuilders() { - } - - /** - * Creates a builder for the {@link GeoHashLocation geohash} {@code GeoLocation} - * variant. - */ - public static GeoHashLocation.Builder geohash() { - return new GeoHashLocation.Builder(); - } - - /** - * Creates a builder for the {@link LatLonGeoLocation latlon} - * {@code GeoLocation} variant. - */ - public static LatLonGeoLocation.Builder latlon() { - return new LatLonGeoLocation.Builder(); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoShapeRelation.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoShapeRelation.java deleted file mode 100644 index 4e43da4a9..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/GeoShapeRelation.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum GeoShapeRelation implements JsonEnum { - /** - * Return all documents whose geo_shape or geo_point - * field intersects the query geometry. - */ - Intersects("intersects"), - - /** - * Return all documents whose geo_shape or geo_point - * field has nothing in common with the query geometry. - */ - Disjoint("disjoint"), - - /** - * Return all documents whose geo_shape or geo_point - * field is within the query geometry. Line geometries are not supported. - */ - Within("within"), - - /** - * Return all documents whose geo_shape or geo_point - * field contains the query geometry. - */ - Contains("contains"), - - ; - - private final String jsonValue; - - GeoShapeRelation(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - GeoShapeRelation.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/HealthStatus.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/HealthStatus.java deleted file mode 100644 index 60b09e818..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/HealthStatus.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum HealthStatus implements JsonEnum { - /** - * All shards are assigned. - */ - Green("green", "GREEN"), - - /** - * 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. - */ - Yellow("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. - */ - Red("red", "RED"), - - ; - - private final String jsonValue; - private final String[] aliases; - - HealthStatus(String jsonValue, String... aliases) { - this.jsonValue = jsonValue; - this.aliases = aliases; - } - - public String jsonValue() { - return this.jsonValue; - } - - public String[] aliases() { - return this.aliases; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - HealthStatus.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/IBDistribution.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/IBDistribution.java deleted file mode 100644 index e8c0f5283..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/IBDistribution.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum IBDistribution implements JsonEnum { - Ll("ll"), - - Spl("spl"), - - ; - - private final String jsonValue; - - IBDistribution(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - IBDistribution.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/IBLambda.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/IBLambda.java deleted file mode 100644 index 1ed99e56e..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/IBLambda.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum IBLambda implements JsonEnum { - Df("df"), - - Ttf("ttf"), - - ; - - private final String jsonValue; - - IBLambda(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(IBLambda.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/IndicesOptions.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/IndicesOptions.java deleted file mode 100644 index 1bb5d1a6b..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/IndicesOptions.java +++ /dev/null @@ -1,301 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.IndicesOptions - -/** - * 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. - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndicesOptions implements JsonpSerializable { - @Nullable - private final Boolean allowNoIndices; - - private final List expandWildcards; - - @Nullable - private final Boolean ignoreUnavailable; - - @Nullable - private final Boolean ignoreThrottled; - - // --------------------------------------------------------------------------------------------- - - private IndicesOptions(Builder builder) { - - this.allowNoIndices = builder.allowNoIndices; - this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); - this.ignoreUnavailable = builder.ignoreUnavailable; - this.ignoreThrottled = builder.ignoreThrottled; - - } - - public static IndicesOptions of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code allow_no_indices} - */ - @Nullable - public final Boolean allowNoIndices() { - return this.allowNoIndices; - } - - /** - * 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. - *

- * API name: {@code expand_wildcards} - */ - public final List expandWildcards() { - return this.expandWildcards; - } - - /** - * If true, missing or closed indices are not included in the response. - *

- * API name: {@code ignore_unavailable} - */ - @Nullable - public final Boolean ignoreUnavailable() { - return this.ignoreUnavailable; - } - - /** - * If true, concrete, expanded or aliased indices are ignored when frozen. - *

- * API name: {@code ignore_throttled} - */ - @Nullable - public final Boolean ignoreThrottled() { - return this.ignoreThrottled; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.allowNoIndices != null) { - generator.writeKey("allow_no_indices"); - generator.write(this.allowNoIndices); - - } - if (ApiTypeHelper.isDefined(this.expandWildcards)) { - generator.writeKey("expand_wildcards"); - generator.writeStartArray(); - for (ExpandWildcard item0 : this.expandWildcards) { - item0.serialize(generator, mapper); - } - generator.writeEnd(); - - } - if (this.ignoreUnavailable != null) { - generator.writeKey("ignore_unavailable"); - generator.write(this.ignoreUnavailable); - - } - if (this.ignoreThrottled != null) { - generator.writeKey("ignore_throttled"); - generator.write(this.ignoreThrottled); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndicesOptions}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private Boolean allowNoIndices; - - @Nullable - private List expandWildcards; - - @Nullable - private Boolean ignoreUnavailable; - - @Nullable - private Boolean ignoreThrottled; - - /** - * 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. - *

- * API name: {@code allow_no_indices} - */ - public final Builder allowNoIndices(@Nullable Boolean value) { - this.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. - *

- * API name: {@code expand_wildcards} - *

- * Adds all elements of list to expandWildcards. - */ - public final Builder expandWildcards(List list) { - this.expandWildcards = _listAddAll(this.expandWildcards, list); - 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. - *

- * API name: {@code expand_wildcards} - *

- * Adds one or more values to expandWildcards. - */ - public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { - this.expandWildcards = _listAdd(this.expandWildcards, value, values); - return this; - } - - /** - * If true, missing or closed indices are not included in the response. - *

- * API name: {@code ignore_unavailable} - */ - public final Builder ignoreUnavailable(@Nullable Boolean value) { - this.ignoreUnavailable = value; - return this; - } - - /** - * If true, concrete, expanded or aliased indices are ignored when frozen. - *

- * API name: {@code ignore_throttled} - */ - public final Builder ignoreThrottled(@Nullable Boolean value) { - this.ignoreThrottled = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndicesOptions}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndicesOptions build() { - _checkSingleUse(); - - return new IndicesOptions(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndicesOptions} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - IndicesOptions::setupIndicesOptionsDeserializer); - - protected static void setupIndicesOptionsDeserializer(ObjectDeserializer op) { - - op.add(Builder::allowNoIndices, JsonpDeserializer.booleanDeserializer(), "allow_no_indices"); - op.add(Builder::expandWildcards, JsonpDeserializer.arrayDeserializer(ExpandWildcard._DESERIALIZER), - "expand_wildcards"); - op.add(Builder::ignoreUnavailable, JsonpDeserializer.booleanDeserializer(), "ignore_unavailable"); - op.add(Builder::ignoreThrottled, JsonpDeserializer.booleanDeserializer(), "ignore_throttled"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/IndicesResponseBase.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/IndicesResponseBase.java deleted file mode 100644 index 3ab0d7365..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/IndicesResponseBase.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.IndicesResponseBase - -/** - * - * @see API - * specification - */ - -public abstract class IndicesResponseBase extends AcknowledgedResponseBase { - @Nullable - private final ShardStatistics shards; - - // --------------------------------------------------------------------------------------------- - - protected IndicesResponseBase(AbstractBuilder builder) { - super(builder); - - this.shards = builder.shards; - - } - - /** - * API name: {@code _shards} - */ - @Nullable - public final ShardStatistics shards() { - return this.shards; - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - super.serializeInternal(generator, mapper); - if (this.shards != null) { - generator.writeKey("_shards"); - this.shards.serialize(generator, mapper); - - } - - } - - public abstract static class AbstractBuilder> - extends - AcknowledgedResponseBase.AbstractBuilder { - @Nullable - private ShardStatistics shards; - - /** - * API name: {@code _shards} - */ - public final BuilderT shards(@Nullable ShardStatistics value) { - this.shards = value; - return self(); - } - - /** - * API name: {@code _shards} - */ - public final BuilderT shards(Function> fn) { - return this.shards(fn.apply(new ShardStatistics.Builder()).build()); - } - - } - - // --------------------------------------------------------------------------------------------- - protected static > void setupIndicesResponseBaseDeserializer( - ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - op.add(AbstractBuilder::shards, ShardStatistics._DESERIALIZER, "_shards"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/InlineGet.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/InlineGet.java deleted file mode 100644 index 85e6f102c..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/InlineGet.java +++ /dev/null @@ -1,398 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonData; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpSerializer; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.NamedDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Long; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.function.Supplier; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.InlineGet - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class InlineGet implements JsonpSerializable { - private final Map metadata; - - private final Map fields; - - private final boolean found; - - @Nullable - private final Long seqNo; - - @Nullable - private final Long primaryTerm; - - @Nullable - private final String routing; - - @Nullable - private final TDocument source; - - @Nullable - private final JsonpSerializer tDocumentSerializer; - - // --------------------------------------------------------------------------------------------- - - private InlineGet(Builder builder) { - - this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); - - this.fields = ApiTypeHelper.unmodifiable(builder.fields); - this.found = ApiTypeHelper.requireNonNull(builder.found, this, "found"); - this.seqNo = builder.seqNo; - this.primaryTerm = builder.primaryTerm; - this.routing = builder.routing; - this.source = builder.source; - this.tDocumentSerializer = builder.tDocumentSerializer; - - } - - public static InlineGet of( - Function, ObjectBuilder>> fn) { - return fn.apply(new Builder<>()).build(); - } - - /** - * Document metadata - */ - public final Map metadata() { - return this.metadata; - } - - /** - * API name: {@code fields} - */ - public final Map fields() { - return this.fields; - } - - /** - * Required - API name: {@code found} - */ - public final boolean found() { - return this.found; - } - - /** - * API name: {@code _seq_no} - */ - @Nullable - public final Long seqNo() { - return this.seqNo; - } - - /** - * API name: {@code _primary_term} - */ - @Nullable - public final Long primaryTerm() { - return this.primaryTerm; - } - - /** - * API name: {@code _routing} - */ - @Nullable - public final String routing() { - return this.routing; - } - - /** - * API name: {@code _source} - */ - @Nullable - public final TDocument source() { - return this.source; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - for (Map.Entry item0 : this.metadata.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - - if (ApiTypeHelper.isDefined(this.fields)) { - generator.writeKey("fields"); - generator.writeStartObject(); - for (Map.Entry item0 : this.fields.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - generator.writeKey("found"); - generator.write(this.found); - - if (this.seqNo != null) { - generator.writeKey("_seq_no"); - generator.write(this.seqNo); - - } - if (this.primaryTerm != null) { - generator.writeKey("_primary_term"); - generator.write(this.primaryTerm); - - } - if (this.routing != null) { - generator.writeKey("_routing"); - generator.write(this.routing); - - } - if (this.source != null) { - generator.writeKey("_source"); - JsonpUtils.serialize(this.source, generator, tDocumentSerializer, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link InlineGet}. - */ - - public static class Builder extends WithJsonObjectBuilderBase> - implements - ObjectBuilder> { - @Nullable - private Map metadata = new HashMap<>(); - - /** - * Document metadata - *

- * Adds all entries of map to metadata. - */ - public final Builder metadata(Map map) { - this.metadata = _mapPutAll(this.metadata, map); - return this; - } - - /** - * Document metadata - *

- * Adds an entry to metadata. - */ - public final Builder metadata(String key, JsonData value) { - this.metadata = _mapPut(this.metadata, key, value); - return this; - } - - @Nullable - private Map fields; - - private Boolean found; - - @Nullable - private Long seqNo; - - @Nullable - private Long primaryTerm; - - @Nullable - private String routing; - - @Nullable - private TDocument source; - - @Nullable - private JsonpSerializer tDocumentSerializer; - - /** - * API name: {@code fields} - *

- * Adds all entries of map to fields. - */ - public final Builder fields(Map map) { - this.fields = _mapPutAll(this.fields, map); - return this; - } - - /** - * API name: {@code fields} - *

- * Adds an entry to fields. - */ - public final Builder fields(String key, JsonData value) { - this.fields = _mapPut(this.fields, key, value); - return this; - } - - /** - * Required - API name: {@code found} - */ - public final Builder found(boolean value) { - this.found = value; - return this; - } - - /** - * API name: {@code _seq_no} - */ - public final Builder seqNo(@Nullable Long value) { - this.seqNo = value; - return this; - } - - /** - * API name: {@code _primary_term} - */ - public final Builder primaryTerm(@Nullable Long value) { - this.primaryTerm = value; - return this; - } - - /** - * API name: {@code _routing} - */ - public final Builder routing(@Nullable String value) { - this.routing = value; - return this; - } - - /** - * API name: {@code _source} - */ - public final Builder source(@Nullable TDocument value) { - this.source = value; - return this; - } - - /** - * Serializer for TDocument. If not set, an attempt will be made to find a - * serializer from the JSON context. - */ - public final Builder tDocumentSerializer(@Nullable JsonpSerializer value) { - this.tDocumentSerializer = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link InlineGet}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public InlineGet build() { - _checkSingleUse(); - - return new InlineGet(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Create a JSON deserializer for InlineGet - */ - public static JsonpDeserializer> createInlineGetDeserializer( - JsonpDeserializer tDocumentDeserializer) { - return ObjectBuilderDeserializer.createForObject((Supplier>) Builder::new, - op -> InlineGet.setupInlineGetDeserializer(op, tDocumentDeserializer)); - }; - - /** - * Json deserializer for {@link InlineGet} based on named deserializers provided - * by the calling {@code JsonMapper}. - */ - public static final JsonpDeserializer> _DESERIALIZER = JsonpDeserializer - .lazy(() -> createInlineGetDeserializer( - new NamedDeserializer<>("co.elastic.clients:Deserializer:_types.InlineGet.TDocument"))); - - protected static void setupInlineGetDeserializer(ObjectDeserializer> op, - JsonpDeserializer tDocumentDeserializer) { - - op.add(Builder::fields, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "fields"); - op.add(Builder::found, JsonpDeserializer.booleanDeserializer(), "found"); - op.add(Builder::seqNo, JsonpDeserializer.longDeserializer(), "_seq_no"); - op.add(Builder::primaryTerm, JsonpDeserializer.longDeserializer(), "_primary_term"); - op.add(Builder::routing, JsonpDeserializer.stringDeserializer(), "_routing"); - op.add(Builder::source, tDocumentDeserializer, "_source"); - - op.setUnknownFieldHandler((builder, name, parser, mapper) -> { - builder.metadata(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); - }); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/KnnQuery.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/KnnQuery.java deleted file mode 100644 index 66ebb9d8c..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/KnnQuery.java +++ /dev/null @@ -1,414 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.elasticsearch._types.query_dsl.Query; -import co.elastic.clients.elasticsearch._types.query_dsl.QueryBase; -import co.elastic.clients.elasticsearch._types.query_dsl.QueryVariant; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Float; -import java.lang.Integer; -import java.lang.String; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.KnnQuery - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class KnnQuery extends QueryBase implements QueryVariant { - private final String field; - - private final List queryVector; - - @Nullable - private final QueryVectorBuilder queryVectorBuilder; - - @Nullable - private final Integer numCandidates; - - @Nullable - private final Integer k; - - private final List filter; - - @Nullable - private final Float similarity; - - // --------------------------------------------------------------------------------------------- - - private KnnQuery(Builder builder) { - super(builder); - - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - this.queryVector = ApiTypeHelper.unmodifiable(builder.queryVector); - this.queryVectorBuilder = builder.queryVectorBuilder; - this.numCandidates = builder.numCandidates; - this.k = builder.k; - this.filter = ApiTypeHelper.unmodifiable(builder.filter); - this.similarity = builder.similarity; - - } - - public static KnnQuery of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Query variant kind. - */ - @Override - public Query.Kind _queryKind() { - return Query.Kind.Knn; - } - - /** - * Required - The name of the vector field to search against - *

- * API name: {@code field} - */ - public final String field() { - return this.field; - } - - /** - * The query vector - *

- * API name: {@code query_vector} - */ - public final List queryVector() { - return this.queryVector; - } - - /** - * The query vector builder. You must provide a query_vector_builder or - * query_vector, but not both. - *

- * API name: {@code query_vector_builder} - */ - @Nullable - public final QueryVectorBuilder queryVectorBuilder() { - return this.queryVectorBuilder; - } - - /** - * The number of nearest neighbor candidates to consider per shard - *

- * API name: {@code num_candidates} - */ - @Nullable - public final Integer numCandidates() { - return this.numCandidates; - } - - /** - * The final number of nearest neighbors to return as top hits - *

- * API name: {@code k} - */ - @Nullable - public final Integer k() { - return this.k; - } - - /** - * Filters for the kNN search query - *

- * API name: {@code filter} - */ - public final List filter() { - return this.filter; - } - - /** - * The minimum similarity for a vector to be considered a match - *

- * API name: {@code similarity} - */ - @Nullable - public final Float similarity() { - return this.similarity; - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - super.serializeInternal(generator, mapper); - generator.writeKey("field"); - generator.write(this.field); - - if (ApiTypeHelper.isDefined(this.queryVector)) { - generator.writeKey("query_vector"); - generator.writeStartArray(); - for (Float item0 : this.queryVector) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (this.queryVectorBuilder != null) { - generator.writeKey("query_vector_builder"); - this.queryVectorBuilder.serialize(generator, mapper); - - } - if (this.numCandidates != null) { - generator.writeKey("num_candidates"); - generator.write(this.numCandidates); - - } - if (this.k != null) { - generator.writeKey("k"); - generator.write(this.k); - - } - if (ApiTypeHelper.isDefined(this.filter)) { - generator.writeKey("filter"); - generator.writeStartArray(); - for (Query item0 : this.filter) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.similarity != null) { - generator.writeKey("similarity"); - generator.write(this.similarity); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link KnnQuery}. - */ - - public static class Builder extends QueryBase.AbstractBuilder implements ObjectBuilder { - private String field; - - @Nullable - private List queryVector; - - @Nullable - private QueryVectorBuilder queryVectorBuilder; - - @Nullable - private Integer numCandidates; - - @Nullable - private Integer k; - - @Nullable - private List filter; - - @Nullable - private Float similarity; - - /** - * Required - The name of the vector field to search against - *

- * API name: {@code field} - */ - public final Builder field(String value) { - this.field = value; - return this; - } - - /** - * The query vector - *

- * API name: {@code query_vector} - *

- * Adds all elements of list to queryVector. - */ - public final Builder queryVector(List list) { - this.queryVector = _listAddAll(this.queryVector, list); - return this; - } - - /** - * The query vector - *

- * API name: {@code query_vector} - *

- * Adds one or more values to queryVector. - */ - public final Builder queryVector(Float value, Float... values) { - this.queryVector = _listAdd(this.queryVector, value, values); - return this; - } - - /** - * The query vector builder. You must provide a query_vector_builder or - * query_vector, but not both. - *

- * API name: {@code query_vector_builder} - */ - public final Builder queryVectorBuilder(@Nullable QueryVectorBuilder value) { - this.queryVectorBuilder = value; - return this; - } - - /** - * The query vector builder. You must provide a query_vector_builder or - * query_vector, but not both. - *

- * API name: {@code query_vector_builder} - */ - public final Builder queryVectorBuilder( - Function> fn) { - return this.queryVectorBuilder(fn.apply(new QueryVectorBuilder.Builder()).build()); - } - - /** - * The number of nearest neighbor candidates to consider per shard - *

- * API name: {@code num_candidates} - */ - public final Builder numCandidates(@Nullable Integer value) { - this.numCandidates = value; - return this; - } - - /** - * The final number of nearest neighbors to return as top hits - *

- * API name: {@code k} - */ - public final Builder k(@Nullable Integer value) { - this.k = value; - return this; - } - - /** - * Filters for the kNN search query - *

- * API name: {@code filter} - *

- * Adds all elements of list to filter. - */ - public final Builder filter(List list) { - this.filter = _listAddAll(this.filter, list); - return this; - } - - /** - * Filters for the kNN search query - *

- * API name: {@code filter} - *

- * Adds one or more values to filter. - */ - public final Builder filter(Query value, Query... values) { - this.filter = _listAdd(this.filter, value, values); - return this; - } - - /** - * Filters for the kNN search query - *

- * API name: {@code filter} - *

- * Adds a value to filter using a builder lambda. - */ - public final Builder filter(Function> fn) { - return filter(fn.apply(new Query.Builder()).build()); - } - - /** - * The minimum similarity for a vector to be considered a match - *

- * API name: {@code similarity} - */ - public final Builder similarity(@Nullable Float value) { - this.similarity = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link KnnQuery}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public KnnQuery build() { - _checkSingleUse(); - - return new KnnQuery(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link KnnQuery} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - KnnQuery::setupKnnQueryDeserializer); - - protected static void setupKnnQueryDeserializer(ObjectDeserializer op) { - QueryBase.setupQueryBaseDeserializer(op); - op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); - op.add(Builder::queryVector, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.floatDeserializer()), - "query_vector"); - op.add(Builder::queryVectorBuilder, QueryVectorBuilder._DESERIALIZER, "query_vector_builder"); - op.add(Builder::numCandidates, JsonpDeserializer.integerDeserializer(), "num_candidates"); - op.add(Builder::k, JsonpDeserializer.integerDeserializer(), "k"); - op.add(Builder::filter, JsonpDeserializer.arrayDeserializer(Query._DESERIALIZER), "filter"); - op.add(Builder::similarity, JsonpDeserializer.floatDeserializer(), "similarity"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/KnnRetriever.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/KnnRetriever.java deleted file mode 100644 index ab29ddb82..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/KnnRetriever.java +++ /dev/null @@ -1,343 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Float; -import java.lang.Integer; -import java.lang.String; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.KnnRetriever - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class KnnRetriever extends RetrieverBase implements RetrieverVariant { - private final String field; - - private final List queryVector; - - @Nullable - private final QueryVectorBuilder queryVectorBuilder; - - private final int k; - - private final int numCandidates; - - @Nullable - private final Float similarity; - - // --------------------------------------------------------------------------------------------- - - private KnnRetriever(Builder builder) { - super(builder); - - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - this.queryVector = ApiTypeHelper.unmodifiable(builder.queryVector); - this.queryVectorBuilder = builder.queryVectorBuilder; - this.k = ApiTypeHelper.requireNonNull(builder.k, this, "k"); - this.numCandidates = ApiTypeHelper.requireNonNull(builder.numCandidates, this, "numCandidates"); - this.similarity = builder.similarity; - - } - - public static KnnRetriever of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Retriever variant kind. - */ - @Override - public Retriever.Kind _retrieverKind() { - return Retriever.Kind.Knn; - } - - /** - * Required - The name of the vector field to search against. - *

- * API name: {@code field} - */ - public final String field() { - return this.field; - } - - /** - * 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. - *

- * API name: {@code query_vector} - */ - public final List queryVector() { - return this.queryVector; - } - - /** - * Defines a model to build a query vector. - *

- * API name: {@code query_vector_builder} - */ - @Nullable - public final QueryVectorBuilder queryVectorBuilder() { - return this.queryVectorBuilder; - } - - /** - * Required - Number of nearest neighbors to return as top hits. - *

- * API name: {@code k} - */ - public final int k() { - return this.k; - } - - /** - * Required - Number of nearest neighbor candidates to consider per shard. - *

- * API name: {@code num_candidates} - */ - public final int numCandidates() { - return this.numCandidates; - } - - /** - * The minimum similarity required for a document to be considered a match. - *

- * API name: {@code similarity} - */ - @Nullable - public final Float similarity() { - return this.similarity; - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - super.serializeInternal(generator, mapper); - generator.writeKey("field"); - generator.write(this.field); - - if (ApiTypeHelper.isDefined(this.queryVector)) { - generator.writeKey("query_vector"); - generator.writeStartArray(); - for (Float item0 : this.queryVector) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (this.queryVectorBuilder != null) { - generator.writeKey("query_vector_builder"); - this.queryVectorBuilder.serialize(generator, mapper); - - } - generator.writeKey("k"); - generator.write(this.k); - - generator.writeKey("num_candidates"); - generator.write(this.numCandidates); - - if (this.similarity != null) { - generator.writeKey("similarity"); - generator.write(this.similarity); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link KnnRetriever}. - */ - - public static class Builder extends RetrieverBase.AbstractBuilder implements ObjectBuilder { - private String field; - - @Nullable - private List queryVector; - - @Nullable - private QueryVectorBuilder queryVectorBuilder; - - private Integer k; - - private Integer numCandidates; - - @Nullable - private Float similarity; - - /** - * Required - The name of the vector field to search against. - *

- * API name: {@code field} - */ - public final Builder field(String value) { - this.field = value; - return this; - } - - /** - * 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. - *

- * API name: {@code query_vector} - *

- * Adds all elements of list to queryVector. - */ - public final Builder queryVector(List list) { - this.queryVector = _listAddAll(this.queryVector, list); - return this; - } - - /** - * 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. - *

- * API name: {@code query_vector} - *

- * Adds one or more values to queryVector. - */ - public final Builder queryVector(Float value, Float... values) { - this.queryVector = _listAdd(this.queryVector, value, values); - return this; - } - - /** - * Defines a model to build a query vector. - *

- * API name: {@code query_vector_builder} - */ - public final Builder queryVectorBuilder(@Nullable QueryVectorBuilder value) { - this.queryVectorBuilder = value; - return this; - } - - /** - * Defines a model to build a query vector. - *

- * API name: {@code query_vector_builder} - */ - public final Builder queryVectorBuilder( - Function> fn) { - return this.queryVectorBuilder(fn.apply(new QueryVectorBuilder.Builder()).build()); - } - - /** - * Required - Number of nearest neighbors to return as top hits. - *

- * API name: {@code k} - */ - public final Builder k(int value) { - this.k = value; - return this; - } - - /** - * Required - Number of nearest neighbor candidates to consider per shard. - *

- * API name: {@code num_candidates} - */ - public final Builder numCandidates(int value) { - this.numCandidates = value; - return this; - } - - /** - * The minimum similarity required for a document to be considered a match. - *

- * API name: {@code similarity} - */ - public final Builder similarity(@Nullable Float value) { - this.similarity = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link KnnRetriever}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public KnnRetriever build() { - _checkSingleUse(); - - return new KnnRetriever(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link KnnRetriever} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - KnnRetriever::setupKnnRetrieverDeserializer); - - protected static void setupKnnRetrieverDeserializer(ObjectDeserializer op) { - RetrieverBase.setupRetrieverBaseDeserializer(op); - op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); - op.add(Builder::queryVector, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.floatDeserializer()), - "query_vector"); - op.add(Builder::queryVectorBuilder, QueryVectorBuilder._DESERIALIZER, "query_vector_builder"); - op.add(Builder::k, JsonpDeserializer.integerDeserializer(), "k"); - op.add(Builder::numCandidates, JsonpDeserializer.integerDeserializer(), "num_candidates"); - op.add(Builder::similarity, JsonpDeserializer.floatDeserializer(), "similarity"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/KnnSearch.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/KnnSearch.java deleted file mode 100644 index 3a1184c25..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/KnnSearch.java +++ /dev/null @@ -1,495 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.elasticsearch._types.query_dsl.Query; -import co.elastic.clients.elasticsearch.core.search.InnerHits; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Float; -import java.lang.Integer; -import java.lang.String; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.KnnSearch - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class KnnSearch implements JsonpSerializable { - private final String field; - - private final List queryVector; - - @Nullable - private final QueryVectorBuilder queryVectorBuilder; - - @Nullable - private final Integer k; - - @Nullable - private final Integer numCandidates; - - @Nullable - private final Float boost; - - private final List filter; - - @Nullable - private final Float similarity; - - @Nullable - private final InnerHits innerHits; - - // --------------------------------------------------------------------------------------------- - - private KnnSearch(Builder builder) { - - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - this.queryVector = ApiTypeHelper.unmodifiable(builder.queryVector); - this.queryVectorBuilder = builder.queryVectorBuilder; - this.k = builder.k; - this.numCandidates = builder.numCandidates; - this.boost = builder.boost; - this.filter = ApiTypeHelper.unmodifiable(builder.filter); - this.similarity = builder.similarity; - this.innerHits = builder.innerHits; - - } - - public static KnnSearch of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - The name of the vector field to search against - *

- * API name: {@code field} - */ - public final String field() { - return this.field; - } - - /** - * The query vector - *

- * API name: {@code query_vector} - */ - public final List queryVector() { - return this.queryVector; - } - - /** - * The query vector builder. You must provide a query_vector_builder or - * query_vector, but not both. - *

- * API name: {@code query_vector_builder} - */ - @Nullable - public final QueryVectorBuilder queryVectorBuilder() { - return this.queryVectorBuilder; - } - - /** - * The final number of nearest neighbors to return as top hits - *

- * API name: {@code k} - */ - @Nullable - public final Integer k() { - return this.k; - } - - /** - * The number of nearest neighbor candidates to consider per shard - *

- * API name: {@code num_candidates} - */ - @Nullable - public final Integer numCandidates() { - return this.numCandidates; - } - - /** - * Boost value to apply to kNN scores - *

- * API name: {@code boost} - */ - @Nullable - public final Float boost() { - return this.boost; - } - - /** - * Filters for the kNN search query - *

- * API name: {@code filter} - */ - public final List filter() { - return this.filter; - } - - /** - * The minimum similarity for a vector to be considered a match - *

- * API name: {@code similarity} - */ - @Nullable - public final Float similarity() { - return this.similarity; - } - - /** - * If defined, each search hit will contain inner hits. - *

- * API name: {@code inner_hits} - */ - @Nullable - public final InnerHits innerHits() { - return this.innerHits; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("field"); - generator.write(this.field); - - if (ApiTypeHelper.isDefined(this.queryVector)) { - generator.writeKey("query_vector"); - generator.writeStartArray(); - for (Float item0 : this.queryVector) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (this.queryVectorBuilder != null) { - generator.writeKey("query_vector_builder"); - this.queryVectorBuilder.serialize(generator, mapper); - - } - if (this.k != null) { - generator.writeKey("k"); - generator.write(this.k); - - } - if (this.numCandidates != null) { - generator.writeKey("num_candidates"); - generator.write(this.numCandidates); - - } - if (this.boost != null) { - generator.writeKey("boost"); - generator.write(this.boost); - - } - if (ApiTypeHelper.isDefined(this.filter)) { - generator.writeKey("filter"); - generator.writeStartArray(); - for (Query item0 : this.filter) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.similarity != null) { - generator.writeKey("similarity"); - generator.write(this.similarity); - - } - if (this.innerHits != null) { - generator.writeKey("inner_hits"); - this.innerHits.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link KnnSearch}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private String field; - - @Nullable - private List queryVector; - - @Nullable - private QueryVectorBuilder queryVectorBuilder; - - @Nullable - private Integer k; - - @Nullable - private Integer numCandidates; - - @Nullable - private Float boost; - - @Nullable - private List filter; - - @Nullable - private Float similarity; - - @Nullable - private InnerHits innerHits; - - /** - * Required - The name of the vector field to search against - *

- * API name: {@code field} - */ - public final Builder field(String value) { - this.field = value; - return this; - } - - /** - * The query vector - *

- * API name: {@code query_vector} - *

- * Adds all elements of list to queryVector. - */ - public final Builder queryVector(List list) { - this.queryVector = _listAddAll(this.queryVector, list); - return this; - } - - /** - * The query vector - *

- * API name: {@code query_vector} - *

- * Adds one or more values to queryVector. - */ - public final Builder queryVector(Float value, Float... values) { - this.queryVector = _listAdd(this.queryVector, value, values); - return this; - } - - /** - * The query vector builder. You must provide a query_vector_builder or - * query_vector, but not both. - *

- * API name: {@code query_vector_builder} - */ - public final Builder queryVectorBuilder(@Nullable QueryVectorBuilder value) { - this.queryVectorBuilder = value; - return this; - } - - /** - * The query vector builder. You must provide a query_vector_builder or - * query_vector, but not both. - *

- * API name: {@code query_vector_builder} - */ - public final Builder queryVectorBuilder( - Function> fn) { - return this.queryVectorBuilder(fn.apply(new QueryVectorBuilder.Builder()).build()); - } - - /** - * The final number of nearest neighbors to return as top hits - *

- * API name: {@code k} - */ - public final Builder k(@Nullable Integer value) { - this.k = value; - return this; - } - - /** - * The number of nearest neighbor candidates to consider per shard - *

- * API name: {@code num_candidates} - */ - public final Builder numCandidates(@Nullable Integer value) { - this.numCandidates = value; - return this; - } - - /** - * Boost value to apply to kNN scores - *

- * API name: {@code boost} - */ - public final Builder boost(@Nullable Float value) { - this.boost = value; - return this; - } - - /** - * Filters for the kNN search query - *

- * API name: {@code filter} - *

- * Adds all elements of list to filter. - */ - public final Builder filter(List list) { - this.filter = _listAddAll(this.filter, list); - return this; - } - - /** - * Filters for the kNN search query - *

- * API name: {@code filter} - *

- * Adds one or more values to filter. - */ - public final Builder filter(Query value, Query... values) { - this.filter = _listAdd(this.filter, value, values); - return this; - } - - /** - * Filters for the kNN search query - *

- * API name: {@code filter} - *

- * Adds a value to filter using a builder lambda. - */ - public final Builder filter(Function> fn) { - return filter(fn.apply(new Query.Builder()).build()); - } - - /** - * The minimum similarity for a vector to be considered a match - *

- * API name: {@code similarity} - */ - public final Builder similarity(@Nullable Float value) { - this.similarity = value; - return this; - } - - /** - * If defined, each search hit will contain inner hits. - *

- * API name: {@code inner_hits} - */ - public final Builder innerHits(@Nullable InnerHits value) { - this.innerHits = value; - return this; - } - - /** - * If defined, each search hit will contain inner hits. - *

- * API name: {@code inner_hits} - */ - public final Builder innerHits(Function> fn) { - return this.innerHits(fn.apply(new InnerHits.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link KnnSearch}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public KnnSearch build() { - _checkSingleUse(); - - return new KnnSearch(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link KnnSearch} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - KnnSearch::setupKnnSearchDeserializer); - - protected static void setupKnnSearchDeserializer(ObjectDeserializer op) { - - op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); - op.add(Builder::queryVector, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.floatDeserializer()), - "query_vector"); - op.add(Builder::queryVectorBuilder, QueryVectorBuilder._DESERIALIZER, "query_vector_builder"); - op.add(Builder::k, JsonpDeserializer.integerDeserializer(), "k"); - op.add(Builder::numCandidates, JsonpDeserializer.integerDeserializer(), "num_candidates"); - op.add(Builder::boost, JsonpDeserializer.floatDeserializer(), "boost"); - op.add(Builder::filter, JsonpDeserializer.arrayDeserializer(Query._DESERIALIZER), "filter"); - op.add(Builder::similarity, JsonpDeserializer.floatDeserializer(), "similarity"); - op.add(Builder::innerHits, InnerHits._DESERIALIZER, "inner_hits"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/LatLonGeoLocation.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/LatLonGeoLocation.java deleted file mode 100644 index a291a5622..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/LatLonGeoLocation.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Double; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.LatLonGeoLocation - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class LatLonGeoLocation implements JsonpSerializable { - private final double lat; - - private final double lon; - - // --------------------------------------------------------------------------------------------- - - private LatLonGeoLocation(Builder builder) { - - this.lat = ApiTypeHelper.requireNonNull(builder.lat, this, "lat"); - this.lon = ApiTypeHelper.requireNonNull(builder.lon, this, "lon"); - - } - - public static LatLonGeoLocation of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Latitude - *

- * API name: {@code lat} - */ - public final double lat() { - return this.lat; - } - - /** - * Required - Longitude - *

- * API name: {@code lon} - */ - public final double lon() { - return this.lon; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("lat"); - generator.write(this.lat); - - generator.writeKey("lon"); - generator.write(this.lon); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link LatLonGeoLocation}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Double lat; - - private Double lon; - - /** - * Required - Latitude - *

- * API name: {@code lat} - */ - public final Builder lat(double value) { - this.lat = value; - return this; - } - - /** - * Required - Longitude - *

- * API name: {@code lon} - */ - public final Builder lon(double value) { - this.lon = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link LatLonGeoLocation}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public LatLonGeoLocation build() { - _checkSingleUse(); - - return new LatLonGeoLocation(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link LatLonGeoLocation} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, LatLonGeoLocation::setupLatLonGeoLocationDeserializer); - - protected static void setupLatLonGeoLocationDeserializer(ObjectDeserializer op) { - - op.add(Builder::lat, JsonpDeserializer.doubleDeserializer(), "lat"); - op.add(Builder::lon, JsonpDeserializer.doubleDeserializer(), "lon"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/NestedSortValue.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/NestedSortValue.java deleted file mode 100644 index 32c09c21a..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/NestedSortValue.java +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.elasticsearch._types.query_dsl.Query; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Integer; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.NestedSortValue - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class NestedSortValue implements JsonpSerializable { - @Nullable - private final Query filter; - - @Nullable - private final Integer maxChildren; - - @Nullable - private final NestedSortValue nested; - - private final String path; - - // --------------------------------------------------------------------------------------------- - - private NestedSortValue(Builder builder) { - - this.filter = builder.filter; - this.maxChildren = builder.maxChildren; - this.nested = builder.nested; - this.path = ApiTypeHelper.requireNonNull(builder.path, this, "path"); - - } - - public static NestedSortValue of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code filter} - */ - @Nullable - public final Query filter() { - return this.filter; - } - - /** - * API name: {@code max_children} - */ - @Nullable - public final Integer maxChildren() { - return this.maxChildren; - } - - /** - * API name: {@code nested} - */ - @Nullable - public final NestedSortValue nested() { - return this.nested; - } - - /** - * Required - API name: {@code path} - */ - public final String path() { - return this.path; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.filter != null) { - generator.writeKey("filter"); - this.filter.serialize(generator, mapper); - - } - if (this.maxChildren != null) { - generator.writeKey("max_children"); - generator.write(this.maxChildren); - - } - if (this.nested != null) { - generator.writeKey("nested"); - this.nested.serialize(generator, mapper); - - } - generator.writeKey("path"); - generator.write(this.path); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link NestedSortValue}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private Query filter; - - @Nullable - private Integer maxChildren; - - @Nullable - private NestedSortValue nested; - - private String path; - - /** - * API name: {@code filter} - */ - public final Builder filter(@Nullable Query value) { - this.filter = value; - return this; - } - - /** - * API name: {@code filter} - */ - public final Builder filter(Function> fn) { - return this.filter(fn.apply(new Query.Builder()).build()); - } - - /** - * API name: {@code max_children} - */ - public final Builder maxChildren(@Nullable Integer value) { - this.maxChildren = value; - return this; - } - - /** - * API name: {@code nested} - */ - public final Builder nested(@Nullable NestedSortValue value) { - this.nested = value; - return this; - } - - /** - * API name: {@code nested} - */ - public final Builder nested(Function> fn) { - return this.nested(fn.apply(new NestedSortValue.Builder()).build()); - } - - /** - * Required - API name: {@code path} - */ - public final Builder path(String value) { - this.path = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link NestedSortValue}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public NestedSortValue build() { - _checkSingleUse(); - - return new NestedSortValue(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link NestedSortValue} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - NestedSortValue::setupNestedSortValueDeserializer); - - protected static void setupNestedSortValueDeserializer(ObjectDeserializer op) { - - op.add(Builder::filter, Query._DESERIALIZER, "filter"); - op.add(Builder::maxChildren, JsonpDeserializer.integerDeserializer(), "max_children"); - op.add(Builder::nested, NestedSortValue._DESERIALIZER, "nested"); - op.add(Builder::path, JsonpDeserializer.stringDeserializer(), "path"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Normalization.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Normalization.java deleted file mode 100644 index 9531b9b02..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Normalization.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum Normalization implements JsonEnum { - No("no"), - - H1("h1"), - - H2("h2"), - - H3("h3"), - - Z("z"), - - ; - - private final String jsonValue; - - Normalization(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - Normalization.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/OpType.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/OpType.java deleted file mode 100644 index 563769454..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/OpType.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API specification - */ -@JsonpDeserializable -public enum OpType implements JsonEnum { - /** - * Overwrite any documents that already exist. - */ - Index("index"), - - /** - * Only index documents that do not already exist. - */ - Create("create"), - - ; - - private final String jsonValue; - - OpType(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(OpType.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/QueryVectorBuilder.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/QueryVectorBuilder.java deleted file mode 100644 index 808b04c57..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/QueryVectorBuilder.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.TaggedUnion; -import co.elastic.clients.util.TaggedUnionUtils; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Object; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.QueryVectorBuilder - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class QueryVectorBuilder implements TaggedUnion, JsonpSerializable { - - /** - * {@link QueryVectorBuilder} variant kinds. - * - * @see API - * specification - */ - - public enum Kind implements JsonEnum { - TextEmbedding("text_embedding"), - - ; - - private final String jsonValue; - - Kind(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - } - - private final Kind _kind; - private final Object _value; - - @Override - public final Kind _kind() { - return _kind; - } - - @Override - public final Object _get() { - return _value; - } - - public QueryVectorBuilder(QueryVectorBuilderVariant value) { - - this._kind = ApiTypeHelper.requireNonNull(value._queryVectorBuilderKind(), this, ""); - this._value = ApiTypeHelper.requireNonNull(value, this, ""); - - } - - private QueryVectorBuilder(Builder builder) { - - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - - } - - public static QueryVectorBuilder of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Is this variant instance of kind {@code text_embedding}? - */ - public boolean isTextEmbedding() { - return _kind == Kind.TextEmbedding; - } - - /** - * Get the {@code text_embedding} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code text_embedding} kind. - */ - public TextEmbedding textEmbedding() { - return TaggedUnionUtils.get(this, Kind.TextEmbedding); - } - - @Override - @SuppressWarnings("unchecked") - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeStartObject(); - - generator.writeKey(_kind.jsonValue()); - if (_value instanceof JsonpSerializable) { - ((JsonpSerializable) _value).serialize(generator, mapper); - } - - generator.writeEnd(); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private Kind _kind; - private Object _value; - - @Override - protected Builder self() { - return this; - } - public ObjectBuilder textEmbedding(TextEmbedding v) { - this._kind = Kind.TextEmbedding; - this._value = v; - return this; - } - - public ObjectBuilder textEmbedding( - Function> fn) { - return this.textEmbedding(fn.apply(new TextEmbedding.Builder()).build()); - } - - public QueryVectorBuilder build() { - _checkSingleUse(); - return new QueryVectorBuilder(this); - } - - } - - protected static void setupQueryVectorBuilderDeserializer(ObjectDeserializer op) { - - op.add(Builder::textEmbedding, TextEmbedding._DESERIALIZER, "text_embedding"); - - } - - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, QueryVectorBuilder::setupQueryVectorBuilderDeserializer, Builder::build); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/QueryVectorBuilderBuilders.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/QueryVectorBuilderBuilders.java deleted file mode 100644 index 521debc0c..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/QueryVectorBuilderBuilders.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.util.ObjectBuilder; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Builders for {@link QueryVectorBuilder} variants. - */ -public class QueryVectorBuilderBuilders { - private QueryVectorBuilderBuilders() { - } - - /** - * Creates a builder for the {@link TextEmbedding text_embedding} - * {@code QueryVectorBuilder} variant. - */ - public static TextEmbedding.Builder textEmbedding() { - return new TextEmbedding.Builder(); - } - - /** - * Creates a QueryVectorBuilder of the {@link TextEmbedding text_embedding} - * {@code QueryVectorBuilder} variant. - */ - public static QueryVectorBuilder textEmbedding(Function> fn) { - QueryVectorBuilder.Builder builder = new QueryVectorBuilder.Builder(); - builder.textEmbedding(fn.apply(new TextEmbedding.Builder()).build()); - return builder.build(); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/QueryVectorBuilderVariant.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/QueryVectorBuilderVariant.java deleted file mode 100644 index ac17ab51e..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/QueryVectorBuilderVariant.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Base interface for {@link QueryVectorBuilder} variants. - */ -public interface QueryVectorBuilderVariant { - - QueryVectorBuilder.Kind _queryVectorBuilderKind(); - - default QueryVectorBuilder _toQueryVectorBuilder() { - return new QueryVectorBuilder(this); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RRFRetriever.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RRFRetriever.java deleted file mode 100644 index a828554de..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RRFRetriever.java +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Integer; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.RRFRetriever - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class RRFRetriever extends RetrieverBase implements RetrieverVariant { - private final List retrievers; - - @Nullable - private final Integer rankConstant; - - @Nullable - private final Integer rankWindowSize; - - // --------------------------------------------------------------------------------------------- - - private RRFRetriever(Builder builder) { - super(builder); - - this.retrievers = ApiTypeHelper.unmodifiableRequired(builder.retrievers, this, "retrievers"); - this.rankConstant = builder.rankConstant; - this.rankWindowSize = builder.rankWindowSize; - - } - - public static RRFRetriever of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Retriever variant kind. - */ - @Override - public Retriever.Kind _retrieverKind() { - return Retriever.Kind.Rrf; - } - - /** - * Required - A list of child retrievers to specify which sets of returned top - * documents will have the RRF formula applied to them. - *

- * API name: {@code retrievers} - */ - public final List retrievers() { - return this.retrievers; - } - - /** - * This value determines how much influence documents in individual result sets - * per query have over the final ranked result set. - *

- * API name: {@code rank_constant} - */ - @Nullable - public final Integer rankConstant() { - return this.rankConstant; - } - - /** - * This value determines the size of the individual result sets per query. - *

- * API name: {@code rank_window_size} - */ - @Nullable - public final Integer rankWindowSize() { - return this.rankWindowSize; - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - super.serializeInternal(generator, mapper); - if (ApiTypeHelper.isDefined(this.retrievers)) { - generator.writeKey("retrievers"); - generator.writeStartArray(); - for (Retriever item0 : this.retrievers) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.rankConstant != null) { - generator.writeKey("rank_constant"); - generator.write(this.rankConstant); - - } - if (this.rankWindowSize != null) { - generator.writeKey("rank_window_size"); - generator.write(this.rankWindowSize); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link RRFRetriever}. - */ - - public static class Builder extends RetrieverBase.AbstractBuilder implements ObjectBuilder { - private List retrievers; - - @Nullable - private Integer rankConstant; - - @Nullable - private Integer rankWindowSize; - - /** - * Required - A list of child retrievers to specify which sets of returned top - * documents will have the RRF formula applied to them. - *

- * API name: {@code retrievers} - *

- * Adds all elements of list to retrievers. - */ - public final Builder retrievers(List list) { - this.retrievers = _listAddAll(this.retrievers, list); - return this; - } - - /** - * Required - A list of child retrievers to specify which sets of returned top - * documents will have the RRF formula applied to them. - *

- * API name: {@code retrievers} - *

- * Adds one or more values to retrievers. - */ - public final Builder retrievers(Retriever value, Retriever... values) { - this.retrievers = _listAdd(this.retrievers, value, values); - return this; - } - - /** - * Required - A list of child retrievers to specify which sets of returned top - * documents will have the RRF formula applied to them. - *

- * API name: {@code retrievers} - *

- * Adds a value to retrievers using a builder lambda. - */ - public final Builder retrievers(Function> fn) { - return retrievers(fn.apply(new Retriever.Builder()).build()); - } - - /** - * This value determines how much influence documents in individual result sets - * per query have over the final ranked result set. - *

- * API name: {@code rank_constant} - */ - public final Builder rankConstant(@Nullable Integer value) { - this.rankConstant = value; - return this; - } - - /** - * This value determines the size of the individual result sets per query. - *

- * API name: {@code rank_window_size} - */ - public final Builder rankWindowSize(@Nullable Integer value) { - this.rankWindowSize = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link RRFRetriever}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public RRFRetriever build() { - _checkSingleUse(); - - return new RRFRetriever(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link RRFRetriever} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - RRFRetriever::setupRRFRetrieverDeserializer); - - protected static void setupRRFRetrieverDeserializer(ObjectDeserializer op) { - RetrieverBase.setupRetrieverBaseDeserializer(op); - op.add(Builder::retrievers, JsonpDeserializer.arrayDeserializer(Retriever._DESERIALIZER), "retrievers"); - op.add(Builder::rankConstant, JsonpDeserializer.integerDeserializer(), "rank_constant"); - op.add(Builder::rankWindowSize, JsonpDeserializer.integerDeserializer(), "rank_window_size"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Rank.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Rank.java deleted file mode 100644 index b1dbca7c3..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Rank.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.TaggedUnion; -import co.elastic.clients.util.TaggedUnionUtils; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Object; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.RankContainer - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class Rank implements TaggedUnion, JsonpSerializable { - - /** - * {@link Rank} variant kinds. - * - * @see API - * specification - */ - - public enum Kind implements JsonEnum { - Rrf("rrf"), - - ; - - private final String jsonValue; - - Kind(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - } - - private final Kind _kind; - private final Object _value; - - @Override - public final Kind _kind() { - return _kind; - } - - @Override - public final Object _get() { - return _value; - } - - public Rank(RankVariant value) { - - this._kind = ApiTypeHelper.requireNonNull(value._rankKind(), this, ""); - this._value = ApiTypeHelper.requireNonNull(value, this, ""); - - } - - private Rank(Builder builder) { - - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - - } - - public static Rank of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Is this variant instance of kind {@code rrf}? - */ - public boolean isRrf() { - return _kind == Kind.Rrf; - } - - /** - * Get the {@code rrf} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code rrf} kind. - */ - public RrfRank rrf() { - return TaggedUnionUtils.get(this, Kind.Rrf); - } - - @Override - @SuppressWarnings("unchecked") - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeStartObject(); - - generator.writeKey(_kind.jsonValue()); - if (_value instanceof JsonpSerializable) { - ((JsonpSerializable) _value).serialize(generator, mapper); - } - - generator.writeEnd(); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Kind _kind; - private Object _value; - - @Override - protected Builder self() { - return this; - } - public ObjectBuilder rrf(RrfRank v) { - this._kind = Kind.Rrf; - this._value = v; - return this; - } - - public ObjectBuilder rrf(Function> fn) { - return this.rrf(fn.apply(new RrfRank.Builder()).build()); - } - - public Rank build() { - _checkSingleUse(); - return new Rank(this); - } - - } - - protected static void setupRankDeserializer(ObjectDeserializer op) { - - op.add(Builder::rrf, RrfRank._DESERIALIZER, "rrf"); - - } - - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - Rank::setupRankDeserializer, Builder::build); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RankBase.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RankBase.java deleted file mode 100644 index 53880c72a..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RankBase.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.RankBase - -/** - * - * @see API - * specification - */ - -public abstract class RankBase { - public RankBase() { - } - - public abstract static class AbstractBuilder> - extends - WithJsonObjectBuilderBase { - protected abstract BuilderT self(); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RankBuilders.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RankBuilders.java deleted file mode 100644 index 6e2200c4b..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RankBuilders.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.util.ObjectBuilder; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Builders for {@link Rank} variants. - */ -public class RankBuilders { - private RankBuilders() { - } - - /** - * Creates a builder for the {@link RrfRank rrf} {@code Rank} variant. - */ - public static RrfRank.Builder rrf() { - return new RrfRank.Builder(); - } - - /** - * Creates a Rank of the {@link RrfRank rrf} {@code Rank} variant. - */ - public static Rank rrf(Function> fn) { - Rank.Builder builder = new Rank.Builder(); - builder.rrf(fn.apply(new RrfRank.Builder()).build()); - return builder.build(); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RankVariant.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RankVariant.java deleted file mode 100644 index 296815a42..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RankVariant.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Base interface for {@link Rank} variants. - */ -public interface RankVariant { - - Rank.Kind _rankKind(); - - default Rank _toRank() { - return new Rank(this); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Refresh.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Refresh.java deleted file mode 100644 index 3543cfa5e..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Refresh.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import jakarta.json.stream.JsonGenerator; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum Refresh implements JsonEnum { - True("true"), - - False("false"), - - WaitFor("wait_for"), - - ; - - private final String jsonValue; - - Refresh(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - @Override - public void serialize(JsonGenerator generator, JsonpMapper params) { - if (this == Refresh.True) { - generator.write(true); - } else if (this == Refresh.False) { - generator.write(false); - } else { - generator.write(jsonValue()); - } - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer.AllowingBooleans<>( - Refresh.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RequestBase.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RequestBase.java deleted file mode 100644 index 81ae1f3f7..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RequestBase.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.util.Map; -import java.util.Objects; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.RequestBase - -/** - * - * @see API - * specification - */ - -public abstract class RequestBase { - public RequestBase() { - } - - public abstract static class AbstractBuilder> - extends - WithJsonObjectBuilderBase { - protected abstract BuilderT self(); - - } - - @Override - public String toString() { - - StringBuilder sb = new StringBuilder(this.getClass().getSimpleName()).append(": "); - - try { - @SuppressWarnings("unchecked") - Endpoint endpoint = (Endpoint) this.getClass() - .getDeclaredField("_ENDPOINT").get(null); - - sb.append(endpoint.method(this)).append(" ").append(endpoint.requestUrl(this)); - - Map params = endpoint.queryParameters(this); - String delim = "?"; - for (Map.Entry param : params.entrySet()) { - sb.append(delim); - delim = "&"; - sb.append(param.getKey()).append("=").append(URLEncoder.encode(param.getValue(), "UTF-8")); - } - - } catch (NoSuchFieldException | IllegalAccessException e) { - // No endpoint, ignore - } catch (UnsupportedEncodingException e) { - // Should not happen (UTF-8 is builtin) - } - - if (this instanceof JsonpSerializable) { - sb.append(' '); - JsonpUtils.toString((JsonpSerializable) this, sb); - } - - return sb.toString(); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Result.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Result.java deleted file mode 100644 index 04a2b6c32..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Result.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API specification - */ -@JsonpDeserializable -public enum Result implements JsonEnum { - Created("created"), - - Updated("updated"), - - Deleted("deleted"), - - NotFound("not_found"), - - NoOp("noop"), - - ; - - private final String jsonValue; - - Result(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Result.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Retries.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Retries.java deleted file mode 100644 index d81d2dc77..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Retries.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Long; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.Retries - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class Retries implements JsonpSerializable { - private final long bulk; - - private final long search; - - // --------------------------------------------------------------------------------------------- - - private Retries(Builder builder) { - - this.bulk = ApiTypeHelper.requireNonNull(builder.bulk, this, "bulk"); - this.search = ApiTypeHelper.requireNonNull(builder.search, this, "search"); - - } - - public static Retries of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code bulk} - */ - public final long bulk() { - return this.bulk; - } - - /** - * Required - API name: {@code search} - */ - public final long search() { - return this.search; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("bulk"); - generator.write(this.bulk); - - generator.writeKey("search"); - generator.write(this.search); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link Retries}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Long bulk; - - private Long search; - - /** - * Required - API name: {@code bulk} - */ - public final Builder bulk(long value) { - this.bulk = value; - return this; - } - - /** - * Required - API name: {@code search} - */ - public final Builder search(long value) { - this.search = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link Retries}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public Retries build() { - _checkSingleUse(); - - return new Retries(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link Retries} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - Retries::setupRetriesDeserializer); - - protected static void setupRetriesDeserializer(ObjectDeserializer op) { - - op.add(Builder::bulk, JsonpDeserializer.longDeserializer(), "bulk"); - op.add(Builder::search, JsonpDeserializer.longDeserializer(), "search"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Retriever.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Retriever.java deleted file mode 100644 index 478fdc197..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Retriever.java +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.TaggedUnion; -import co.elastic.clients.util.TaggedUnionUtils; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Object; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.RetrieverContainer - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class Retriever implements TaggedUnion, JsonpSerializable { - - /** - * {@link Retriever} variant kinds. - * - * @see API - * specification - */ - - public enum Kind implements JsonEnum { - Standard("standard"), - - Knn("knn"), - - Rrf("rrf"), - - ; - - private final String jsonValue; - - Kind(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - } - - private final Kind _kind; - private final Object _value; - - @Override - public final Kind _kind() { - return _kind; - } - - @Override - public final Object _get() { - return _value; - } - - public Retriever(RetrieverVariant value) { - - this._kind = ApiTypeHelper.requireNonNull(value._retrieverKind(), this, ""); - this._value = ApiTypeHelper.requireNonNull(value, this, ""); - - } - - private Retriever(Builder builder) { - - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - - } - - public static Retriever of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Is this variant instance of kind {@code standard}? - */ - public boolean isStandard() { - return _kind == Kind.Standard; - } - - /** - * Get the {@code standard} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code standard} kind. - */ - public StandardRetriever standard() { - return TaggedUnionUtils.get(this, Kind.Standard); - } - - /** - * Is this variant instance of kind {@code knn}? - */ - public boolean isKnn() { - return _kind == Kind.Knn; - } - - /** - * Get the {@code knn} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code knn} kind. - */ - public KnnRetriever knn() { - return TaggedUnionUtils.get(this, Kind.Knn); - } - - /** - * Is this variant instance of kind {@code rrf}? - */ - public boolean isRrf() { - return _kind == Kind.Rrf; - } - - /** - * Get the {@code rrf} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code rrf} kind. - */ - public RRFRetriever rrf() { - return TaggedUnionUtils.get(this, Kind.Rrf); - } - - @Override - @SuppressWarnings("unchecked") - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeStartObject(); - - generator.writeKey(_kind.jsonValue()); - if (_value instanceof JsonpSerializable) { - ((JsonpSerializable) _value).serialize(generator, mapper); - } - - generator.writeEnd(); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Kind _kind; - private Object _value; - - @Override - protected Builder self() { - return this; - } - public ObjectBuilder standard(StandardRetriever v) { - this._kind = Kind.Standard; - this._value = v; - return this; - } - - public ObjectBuilder standard( - Function> fn) { - return this.standard(fn.apply(new StandardRetriever.Builder()).build()); - } - - public ObjectBuilder knn(KnnRetriever v) { - this._kind = Kind.Knn; - this._value = v; - return this; - } - - public ObjectBuilder knn(Function> fn) { - return this.knn(fn.apply(new KnnRetriever.Builder()).build()); - } - - public ObjectBuilder rrf(RRFRetriever v) { - this._kind = Kind.Rrf; - this._value = v; - return this; - } - - public ObjectBuilder rrf(Function> fn) { - return this.rrf(fn.apply(new RRFRetriever.Builder()).build()); - } - - public Retriever build() { - _checkSingleUse(); - return new Retriever(this); - } - - } - - protected static void setupRetrieverDeserializer(ObjectDeserializer op) { - - op.add(Builder::standard, StandardRetriever._DESERIALIZER, "standard"); - op.add(Builder::knn, KnnRetriever._DESERIALIZER, "knn"); - op.add(Builder::rrf, RRFRetriever._DESERIALIZER, "rrf"); - - } - - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - Retriever::setupRetrieverDeserializer, Builder::build); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RetrieverBase.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RetrieverBase.java deleted file mode 100644 index 6ceefd82f..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RetrieverBase.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.elasticsearch._types.query_dsl.Query; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.RetrieverBase - -/** - * - * @see API - * specification - */ - -public abstract class RetrieverBase implements JsonpSerializable { - private final List filter; - - // --------------------------------------------------------------------------------------------- - - protected RetrieverBase(AbstractBuilder builder) { - - this.filter = ApiTypeHelper.unmodifiable(builder.filter); - - } - - /** - * Query to filter the documents that can match. - *

- * API name: {@code filter} - */ - public final List filter() { - return this.filter; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.filter)) { - generator.writeKey("filter"); - generator.writeStartArray(); - for (Query item0 : this.filter) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - public abstract static class AbstractBuilder> - extends - WithJsonObjectBuilderBase { - @Nullable - private List filter; - - /** - * Query to filter the documents that can match. - *

- * API name: {@code filter} - *

- * Adds all elements of list to filter. - */ - public final BuilderT filter(List list) { - this.filter = _listAddAll(this.filter, list); - return self(); - } - - /** - * Query to filter the documents that can match. - *

- * API name: {@code filter} - *

- * Adds one or more values to filter. - */ - public final BuilderT filter(Query value, Query... values) { - this.filter = _listAdd(this.filter, value, values); - return self(); - } - - /** - * Query to filter the documents that can match. - *

- * API name: {@code filter} - *

- * Adds a value to filter using a builder lambda. - */ - public final BuilderT filter(Function> fn) { - return filter(fn.apply(new Query.Builder()).build()); - } - - protected abstract BuilderT self(); - - } - - // --------------------------------------------------------------------------------------------- - protected static > void setupRetrieverBaseDeserializer( - ObjectDeserializer op) { - - op.add(AbstractBuilder::filter, JsonpDeserializer.arrayDeserializer(Query._DESERIALIZER), "filter"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RetrieverBuilders.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RetrieverBuilders.java deleted file mode 100644 index 5a3625e40..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RetrieverBuilders.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.util.ObjectBuilder; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Builders for {@link Retriever} variants. - */ -public class RetrieverBuilders { - private RetrieverBuilders() { - } - - /** - * Creates a builder for the {@link StandardRetriever standard} - * {@code Retriever} variant. - */ - public static StandardRetriever.Builder standard() { - return new StandardRetriever.Builder(); - } - - /** - * Creates a Retriever of the {@link StandardRetriever standard} - * {@code Retriever} variant. - */ - public static Retriever standard(Function> fn) { - Retriever.Builder builder = new Retriever.Builder(); - builder.standard(fn.apply(new StandardRetriever.Builder()).build()); - return builder.build(); - } - - /** - * Creates a builder for the {@link KnnRetriever knn} {@code Retriever} variant. - */ - public static KnnRetriever.Builder knn() { - return new KnnRetriever.Builder(); - } - - /** - * Creates a Retriever of the {@link KnnRetriever knn} {@code Retriever} - * variant. - */ - public static Retriever knn(Function> fn) { - Retriever.Builder builder = new Retriever.Builder(); - builder.knn(fn.apply(new KnnRetriever.Builder()).build()); - return builder.build(); - } - - /** - * Creates a builder for the {@link RRFRetriever rrf} {@code Retriever} variant. - */ - public static RRFRetriever.Builder rrf() { - return new RRFRetriever.Builder(); - } - - /** - * Creates a Retriever of the {@link RRFRetriever rrf} {@code Retriever} - * variant. - */ - public static Retriever rrf(Function> fn) { - Retriever.Builder builder = new Retriever.Builder(); - builder.rrf(fn.apply(new RRFRetriever.Builder()).build()); - return builder.build(); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RetrieverVariant.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RetrieverVariant.java deleted file mode 100644 index d220f68c3..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RetrieverVariant.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Base interface for {@link Retriever} variants. - */ -public interface RetrieverVariant { - - Retriever.Kind _retrieverKind(); - - default Retriever _toRetriever() { - return new Retriever(this); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RrfRank.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RrfRank.java deleted file mode 100644 index 16fcd137c..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/RrfRank.java +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Long; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.RrfRank - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class RrfRank extends RankBase implements RankVariant, JsonpSerializable { - @Nullable - private final Long rankConstant; - - @Nullable - private final Long rankWindowSize; - - // --------------------------------------------------------------------------------------------- - - private RrfRank(Builder builder) { - - this.rankConstant = builder.rankConstant; - this.rankWindowSize = builder.rankWindowSize; - - } - - public static RrfRank of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Rank variant kind. - */ - @Override - public Rank.Kind _rankKind() { - return Rank.Kind.Rrf; - } - - /** - * How much influence documents in individual result sets per query have over - * the final ranked result set - *

- * API name: {@code rank_constant} - */ - @Nullable - public final Long rankConstant() { - return this.rankConstant; - } - - /** - * Size of the individual result sets per query - *

- * API name: {@code rank_window_size} - */ - @Nullable - public final Long rankWindowSize() { - return this.rankWindowSize; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.rankConstant != null) { - generator.writeKey("rank_constant"); - generator.write(this.rankConstant); - - } - if (this.rankWindowSize != null) { - generator.writeKey("rank_window_size"); - generator.write(this.rankWindowSize); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link RrfRank}. - */ - - public static class Builder extends RankBase.AbstractBuilder implements ObjectBuilder { - @Nullable - private Long rankConstant; - - @Nullable - private Long rankWindowSize; - - /** - * How much influence documents in individual result sets per query have over - * the final ranked result set - *

- * API name: {@code rank_constant} - */ - public final Builder rankConstant(@Nullable Long value) { - this.rankConstant = value; - return this; - } - - /** - * Size of the individual result sets per query - *

- * API name: {@code rank_window_size} - */ - public final Builder rankWindowSize(@Nullable Long value) { - this.rankWindowSize = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link RrfRank}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public RrfRank build() { - _checkSingleUse(); - - return new RrfRank(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link RrfRank} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - RrfRank::setupRrfRankDeserializer); - - protected static void setupRrfRankDeserializer(ObjectDeserializer op) { - - op.add(Builder::rankConstant, JsonpDeserializer.longDeserializer(), "rank_constant"); - op.add(Builder::rankWindowSize, JsonpDeserializer.longDeserializer(), "rank_window_size"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ScoreSort.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ScoreSort.java deleted file mode 100644 index d5f8567b9..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/ScoreSort.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.ScoreSort - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class ScoreSort implements SortOptionsVariant, JsonpSerializable { - @Nullable - private final SortOrder order; - - // --------------------------------------------------------------------------------------------- - - private ScoreSort(Builder builder) { - - this.order = builder.order; - - } - - public static ScoreSort of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * SortOptions variant kind. - */ - @Override - public SortOptions.Kind _sortOptionsKind() { - return SortOptions.Kind.Doc; - } - - /** - * API name: {@code order} - */ - @Nullable - public final SortOrder order() { - return this.order; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.order != null) { - generator.writeKey("order"); - this.order.serialize(generator, mapper); - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ScoreSort}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private SortOrder order; - - /** - * API name: {@code order} - */ - public final Builder order(@Nullable SortOrder value) { - this.order = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ScoreSort}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ScoreSort build() { - _checkSingleUse(); - - return new ScoreSort(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ScoreSort} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - ScoreSort::setupScoreSortDeserializer); - - protected static void setupScoreSortDeserializer(ObjectDeserializer op) { - - op.add(Builder::order, SortOrder._DESERIALIZER, "order"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Script.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Script.java deleted file mode 100644 index 8bd09962b..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/_types/Script.java +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch._types; - -import co.elastic.clients.elasticsearch._types.query_dsl.IntervalsFilter; -import co.elastic.clients.elasticsearch._types.query_dsl.IntervalsFilterVariant; -import co.elastic.clients.json.JsonData; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: _types.Script - -/** - * - * @see API specification - */ -@JsonpDeserializable -public class Script implements IntervalsFilterVariant, JsonpSerializable { - @Nullable - private final String source; - - @Nullable - private final String id; - - private final Map params; - - @Nullable - private final String lang; - - private final Map options; - - // --------------------------------------------------------------------------------------------- - - private Script(Builder builder) { - - this.source = builder.source; - this.id = builder.id; - this.params = ApiTypeHelper.unmodifiable(builder.params); - this.lang = builder.lang; - this.options = ApiTypeHelper.unmodifiable(builder.options); - - } - - public static Script of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * IntervalsFilter variant kind. - */ - @Override - public IntervalsFilter.Kind _intervalsFilterKind() { - return IntervalsFilter.Kind.Script; - } - - /** - * The script source. - *

- * API name: {@code source} - */ - @Nullable - public final String source() { - return this.source; - } - - /** - * The id for a stored script. - *

- * API name: {@code id} - */ - @Nullable - public final String id() { - return this.id; - } - - /** - * Specifies any named parameters that are passed into the script as variables. - * Use parameters instead of hard-coded values to decrease compile time. - *

- * API name: {@code params} - */ - public final Map params() { - return this.params; - } - - /** - * Specifies the language the script is written in. - *

- * API name: {@code lang} - */ - @Nullable - public final String lang() { - return this.lang; - } - - /** - * API name: {@code options} - */ - public final Map options() { - return this.options; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.source != null) { - generator.writeKey("source"); - generator.write(this.source); - - } - if (this.id != null) { - generator.writeKey("id"); - generator.write(this.id); - - } - if (ApiTypeHelper.isDefined(this.params)) { - generator.writeKey("params"); - generator.writeStartObject(); - for (Map.Entry item0 : this.params.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.lang != null) { - generator.writeKey("lang"); - generator.write(this.lang); - - } - if (ApiTypeHelper.isDefined(this.options)) { - generator.writeKey("options"); - generator.writeStartObject(); - for (Map.Entry item0 : this.options.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link Script}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder - - - Please see the Elasticsearch API specification. - - diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/DeletePolicyRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/DeletePolicyRequest.java deleted file mode 100644 index 28832bdab..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/DeletePolicyRequest.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.enrich; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: enrich.delete_policy.Request - -/** - * Delete an enrich policy. Deletes an existing enrich policy and its enrich - * index. - * - * @see API - * specification - */ - -public class DeletePolicyRequest extends RequestBase { - private final String name; - - // --------------------------------------------------------------------------------------------- - - private DeletePolicyRequest(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - - } - - public static DeletePolicyRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Enrich policy to delete. - *

- * API name: {@code name} - */ - public final String name() { - return this.name; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DeletePolicyRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - private String name; - - /** - * Required - Enrich policy to delete. - *

- * API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DeletePolicyRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DeletePolicyRequest build() { - _checkSingleUse(); - - return new DeletePolicyRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code enrich.delete_policy}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/enrich.delete_policy", - - // Request method - request -> { - return "DELETE"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_enrich"); - buf.append("/policy"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - params.put("name", request.name); - } - return params; - }, - - // Request parameters - request -> { - return Collections.emptyMap(); - - }, SimpleEndpoint.emptyMap(), false, DeletePolicyResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/DeletePolicyResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/DeletePolicyResponse.java deleted file mode 100644 index 0f6dd91bd..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/DeletePolicyResponse.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.enrich; - -import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: enrich.delete_policy.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class DeletePolicyResponse extends AcknowledgedResponseBase { - // --------------------------------------------------------------------------------------------- - - private DeletePolicyResponse(Builder builder) { - super(builder); - - } - - public static DeletePolicyResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DeletePolicyResponse}. - */ - - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder - implements - ObjectBuilder { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DeletePolicyResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DeletePolicyResponse build() { - _checkSingleUse(); - - return new DeletePolicyResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DeletePolicyResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, DeletePolicyResponse::setupDeletePolicyResponseDeserializer); - - protected static void setupDeletePolicyResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/ElasticsearchEnrichAsyncClient.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/ElasticsearchEnrichAsyncClient.java deleted file mode 100644 index c624e1a58..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/ElasticsearchEnrichAsyncClient.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.enrich; - -import co.elastic.clients.ApiClient; -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.transport.ElasticsearchTransport; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.JsonEndpoint; -import co.elastic.clients.transport.Transport; -import co.elastic.clients.transport.TransportOptions; -import co.elastic.clients.util.ObjectBuilder; -import java.util.concurrent.CompletableFuture; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Client for the enrich namespace. - */ -public class ElasticsearchEnrichAsyncClient extends ApiClient { - - public ElasticsearchEnrichAsyncClient(ElasticsearchTransport transport) { - super(transport, null); - } - - public ElasticsearchEnrichAsyncClient(ElasticsearchTransport transport, - @Nullable TransportOptions transportOptions) { - super(transport, transportOptions); - } - - @Override - public ElasticsearchEnrichAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) { - return new ElasticsearchEnrichAsyncClient(this.transport, transportOptions); - } - - // ----- Endpoint: enrich.delete_policy - - /** - * Delete an enrich policy. Deletes an existing enrich policy and its enrich - * index. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture deletePolicy(DeletePolicyRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) DeletePolicyRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Delete an enrich policy. Deletes an existing enrich policy and its enrich - * index. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeletePolicyRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture deletePolicy( - Function> fn) { - return deletePolicy(fn.apply(new DeletePolicyRequest.Builder()).build()); - } - - // ----- Endpoint: enrich.execute_policy - - /** - * Creates the enrich index for an existing enrich policy. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture executePolicy(ExecutePolicyRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) ExecutePolicyRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Creates the enrich index for an existing enrich policy. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExecutePolicyRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture executePolicy( - Function> fn) { - return executePolicy(fn.apply(new ExecutePolicyRequest.Builder()).build()); - } - - // ----- Endpoint: enrich.get_policy - - /** - * Get an enrich policy. Returns information about an enrich policy. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture getPolicy(GetPolicyRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) GetPolicyRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Get an enrich policy. Returns information about an enrich policy. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetPolicyRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture getPolicy( - Function> fn) { - return getPolicy(fn.apply(new GetPolicyRequest.Builder()).build()); - } - - /** - * Get an enrich policy. Returns information about an enrich policy. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture getPolicy() { - return this.transport.performRequestAsync(new GetPolicyRequest.Builder().build(), GetPolicyRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: enrich.put_policy - - /** - * Create an enrich policy. Creates an enrich policy. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture putPolicy(PutPolicyRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) PutPolicyRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Create an enrich policy. Creates an enrich policy. - * - * @param fn - * a function that initializes a builder to create the - * {@link PutPolicyRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture putPolicy( - Function> fn) { - return putPolicy(fn.apply(new PutPolicyRequest.Builder()).build()); - } - - // ----- Endpoint: enrich.stats - - /** - * Get enrich stats. Returns enrich coordinator statistics and information about - * enrich policies that are currently executing. - * - * @see Documentation - * on elastic.co - */ - public CompletableFuture stats() { - return this.transport.performRequestAsync(EnrichStatsRequest._INSTANCE, EnrichStatsRequest._ENDPOINT, - this.transportOptions); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/ElasticsearchEnrichClient.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/ElasticsearchEnrichClient.java deleted file mode 100644 index 3201966b0..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/ElasticsearchEnrichClient.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.enrich; - -import co.elastic.clients.ApiClient; -import co.elastic.clients.elasticsearch._types.ElasticsearchException; -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.transport.ElasticsearchTransport; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.JsonEndpoint; -import co.elastic.clients.transport.Transport; -import co.elastic.clients.transport.TransportOptions; -import co.elastic.clients.util.ObjectBuilder; -import java.io.IOException; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Client for the enrich namespace. - */ -public class ElasticsearchEnrichClient extends ApiClient { - - public ElasticsearchEnrichClient(ElasticsearchTransport transport) { - super(transport, null); - } - - public ElasticsearchEnrichClient(ElasticsearchTransport transport, @Nullable TransportOptions transportOptions) { - super(transport, transportOptions); - } - - @Override - public ElasticsearchEnrichClient withTransportOptions(@Nullable TransportOptions transportOptions) { - return new ElasticsearchEnrichClient(this.transport, transportOptions); - } - - // ----- Endpoint: enrich.delete_policy - - /** - * Delete an enrich policy. Deletes an existing enrich policy and its enrich - * index. - * - * @see Documentation - * on elastic.co - */ - - public DeletePolicyResponse deletePolicy(DeletePolicyRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) DeletePolicyRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Delete an enrich policy. Deletes an existing enrich policy and its enrich - * index. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeletePolicyRequest} - * @see Documentation - * on elastic.co - */ - - public final DeletePolicyResponse deletePolicy( - Function> fn) - throws IOException, ElasticsearchException { - return deletePolicy(fn.apply(new DeletePolicyRequest.Builder()).build()); - } - - // ----- Endpoint: enrich.execute_policy - - /** - * Creates the enrich index for an existing enrich policy. - * - * @see Documentation - * on elastic.co - */ - - public ExecutePolicyResponse executePolicy(ExecutePolicyRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) ExecutePolicyRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Creates the enrich index for an existing enrich policy. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExecutePolicyRequest} - * @see Documentation - * on elastic.co - */ - - public final ExecutePolicyResponse executePolicy( - Function> fn) - throws IOException, ElasticsearchException { - return executePolicy(fn.apply(new ExecutePolicyRequest.Builder()).build()); - } - - // ----- Endpoint: enrich.get_policy - - /** - * Get an enrich policy. Returns information about an enrich policy. - * - * @see Documentation - * on elastic.co - */ - - public GetPolicyResponse getPolicy(GetPolicyRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) GetPolicyRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Get an enrich policy. Returns information about an enrich policy. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetPolicyRequest} - * @see Documentation - * on elastic.co - */ - - public final GetPolicyResponse getPolicy(Function> fn) - throws IOException, ElasticsearchException { - return getPolicy(fn.apply(new GetPolicyRequest.Builder()).build()); - } - - /** - * Get an enrich policy. Returns information about an enrich policy. - * - * @see Documentation - * on elastic.co - */ - - public GetPolicyResponse getPolicy() throws IOException, ElasticsearchException { - return this.transport.performRequest(new GetPolicyRequest.Builder().build(), GetPolicyRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: enrich.put_policy - - /** - * Create an enrich policy. Creates an enrich policy. - * - * @see Documentation - * on elastic.co - */ - - public PutPolicyResponse putPolicy(PutPolicyRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) PutPolicyRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Create an enrich policy. Creates an enrich policy. - * - * @param fn - * a function that initializes a builder to create the - * {@link PutPolicyRequest} - * @see Documentation - * on elastic.co - */ - - public final PutPolicyResponse putPolicy(Function> fn) - throws IOException, ElasticsearchException { - return putPolicy(fn.apply(new PutPolicyRequest.Builder()).build()); - } - - // ----- Endpoint: enrich.stats - - /** - * Get enrich stats. Returns enrich coordinator statistics and information about - * enrich policies that are currently executing. - * - * @see Documentation - * on elastic.co - */ - public EnrichStatsResponse stats() throws IOException, ElasticsearchException { - return this.transport.performRequest(EnrichStatsRequest._INSTANCE, EnrichStatsRequest._ENDPOINT, - this.transportOptions); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/EnrichPolicy.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/EnrichPolicy.java deleted file mode 100644 index 9030036ee..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/EnrichPolicy.java +++ /dev/null @@ -1,338 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.enrich; - -import co.elastic.clients.elasticsearch._types.query_dsl.Query; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: enrich._types.Policy - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class EnrichPolicy implements JsonpSerializable { - private final List enrichFields; - - private final List indices; - - private final String matchField; - - @Nullable - private final Query query; - - @Nullable - private final String name; - - @Nullable - private final String elasticsearchVersion; - - // --------------------------------------------------------------------------------------------- - - private EnrichPolicy(Builder builder) { - - this.enrichFields = ApiTypeHelper.unmodifiableRequired(builder.enrichFields, this, "enrichFields"); - this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices"); - this.matchField = ApiTypeHelper.requireNonNull(builder.matchField, this, "matchField"); - this.query = builder.query; - this.name = builder.name; - this.elasticsearchVersion = builder.elasticsearchVersion; - - } - - public static EnrichPolicy of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code enrich_fields} - */ - public final List enrichFields() { - return this.enrichFields; - } - - /** - * Required - API name: {@code indices} - */ - public final List indices() { - return this.indices; - } - - /** - * Required - API name: {@code match_field} - */ - public final String matchField() { - return this.matchField; - } - - /** - * API name: {@code query} - */ - @Nullable - public final Query query() { - return this.query; - } - - /** - * API name: {@code name} - */ - @Nullable - public final String name() { - return this.name; - } - - /** - * API name: {@code elasticsearch_version} - */ - @Nullable - public final String elasticsearchVersion() { - return this.elasticsearchVersion; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.enrichFields)) { - generator.writeKey("enrich_fields"); - generator.writeStartArray(); - for (String item0 : this.enrichFields) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.indices)) { - generator.writeKey("indices"); - generator.writeStartArray(); - for (String item0 : this.indices) { - generator.write(item0); - - } - generator.writeEnd(); - - } - generator.writeKey("match_field"); - generator.write(this.matchField); - - if (this.query != null) { - generator.writeKey("query"); - this.query.serialize(generator, mapper); - - } - if (this.name != null) { - generator.writeKey("name"); - generator.write(this.name); - - } - if (this.elasticsearchVersion != null) { - generator.writeKey("elasticsearch_version"); - generator.write(this.elasticsearchVersion); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link EnrichPolicy}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private List enrichFields; - - private List indices; - - private String matchField; - - @Nullable - private Query query; - - @Nullable - private String name; - - @Nullable - private String elasticsearchVersion; - - /** - * Required - API name: {@code enrich_fields} - *

- * Adds all elements of list to enrichFields. - */ - public final Builder enrichFields(List list) { - this.enrichFields = _listAddAll(this.enrichFields, list); - return this; - } - - /** - * Required - API name: {@code enrich_fields} - *

- * Adds one or more values to enrichFields. - */ - public final Builder enrichFields(String value, String... values) { - this.enrichFields = _listAdd(this.enrichFields, value, values); - return this; - } - - /** - * Required - API name: {@code indices} - *

- * Adds all elements of list to indices. - */ - public final Builder indices(List list) { - this.indices = _listAddAll(this.indices, list); - return this; - } - - /** - * Required - API name: {@code indices} - *

- * Adds one or more values to indices. - */ - public final Builder indices(String value, String... values) { - this.indices = _listAdd(this.indices, value, values); - return this; - } - - /** - * Required - API name: {@code match_field} - */ - public final Builder matchField(String value) { - this.matchField = value; - return this; - } - - /** - * API name: {@code query} - */ - public final Builder query(@Nullable Query value) { - this.query = value; - return this; - } - - /** - * API name: {@code query} - */ - public final Builder query(Function> fn) { - return this.query(fn.apply(new Query.Builder()).build()); - } - - /** - * API name: {@code name} - */ - public final Builder name(@Nullable String value) { - this.name = value; - return this; - } - - /** - * API name: {@code elasticsearch_version} - */ - public final Builder elasticsearchVersion(@Nullable String value) { - this.elasticsearchVersion = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link EnrichPolicy}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public EnrichPolicy build() { - _checkSingleUse(); - - return new EnrichPolicy(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link EnrichPolicy} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - EnrichPolicy::setupEnrichPolicyDeserializer); - - protected static void setupEnrichPolicyDeserializer(ObjectDeserializer op) { - - op.add(Builder::enrichFields, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "enrich_fields"); - op.add(Builder::indices, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "indices"); - op.add(Builder::matchField, JsonpDeserializer.stringDeserializer(), "match_field"); - op.add(Builder::query, Query._DESERIALIZER, "query"); - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::elasticsearchVersion, JsonpDeserializer.stringDeserializer(), "elasticsearch_version"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/EnrichPolicyType.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/EnrichPolicyType.java deleted file mode 100644 index 65510d96c..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/EnrichPolicyType.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.enrich; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum EnrichPolicyType implements JsonEnum { - GeoMatch("geo_match"), - - Match("match"), - - Range("range"), - - ; - - private final String jsonValue; - - EnrichPolicyType(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - EnrichPolicyType.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/EnrichStatsRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/EnrichStatsRequest.java deleted file mode 100644 index 4415912ef..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/EnrichStatsRequest.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.enrich; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Collections; -import java.util.Objects; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: enrich.stats.Request - -/** - * Get enrich stats. Returns enrich coordinator statistics and information about - * enrich policies that are currently executing. - * - * @see API - * specification - */ - -public class EnrichStatsRequest extends RequestBase { - public EnrichStatsRequest() { - } - - /** - * Singleton instance for {@link EnrichStatsRequest}. - */ - public static final EnrichStatsRequest _INSTANCE = new EnrichStatsRequest(); - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code enrich.stats}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/enrich.stats", - - // Request method - request -> { - return "GET"; - - }, - - // Request path - request -> { - return "/_enrich/_stats"; - - }, - - // Path parameters - request -> { - return Collections.emptyMap(); - }, - - // Request parameters - request -> { - return Collections.emptyMap(); - - }, SimpleEndpoint.emptyMap(), false, EnrichStatsResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/EnrichStatsResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/EnrichStatsResponse.java deleted file mode 100644 index 5bb010144..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/EnrichStatsResponse.java +++ /dev/null @@ -1,331 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.enrich; - -import co.elastic.clients.elasticsearch.enrich.stats.CacheStats; -import co.elastic.clients.elasticsearch.enrich.stats.CoordinatorStats; -import co.elastic.clients.elasticsearch.enrich.stats.ExecutingPolicy; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: enrich.stats.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class EnrichStatsResponse implements JsonpSerializable { - private final List coordinatorStats; - - private final List executingPolicies; - - private final List cacheStats; - - // --------------------------------------------------------------------------------------------- - - private EnrichStatsResponse(Builder builder) { - - this.coordinatorStats = ApiTypeHelper.unmodifiableRequired(builder.coordinatorStats, this, "coordinatorStats"); - this.executingPolicies = ApiTypeHelper.unmodifiableRequired(builder.executingPolicies, this, - "executingPolicies"); - this.cacheStats = ApiTypeHelper.unmodifiable(builder.cacheStats); - - } - - public static EnrichStatsResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Objects containing information about each coordinating ingest node - * for configured enrich processors. - *

- * API name: {@code coordinator_stats} - */ - public final List coordinatorStats() { - return this.coordinatorStats; - } - - /** - * Required - Objects containing information about each enrich policy that is - * currently executing. - *

- * API name: {@code executing_policies} - */ - public final List executingPolicies() { - return this.executingPolicies; - } - - /** - * Objects containing information about the enrich cache stats on each ingest - * node. - *

- * API name: {@code cache_stats} - */ - public final List cacheStats() { - return this.cacheStats; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.coordinatorStats)) { - generator.writeKey("coordinator_stats"); - generator.writeStartArray(); - for (CoordinatorStats item0 : this.coordinatorStats) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.executingPolicies)) { - generator.writeKey("executing_policies"); - generator.writeStartArray(); - for (ExecutingPolicy item0 : this.executingPolicies) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.cacheStats)) { - generator.writeKey("cache_stats"); - generator.writeStartArray(); - for (CacheStats item0 : this.cacheStats) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link EnrichStatsResponse}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private List coordinatorStats; - - private List executingPolicies; - - @Nullable - private List cacheStats; - - /** - * Required - Objects containing information about each coordinating ingest node - * for configured enrich processors. - *

- * API name: {@code coordinator_stats} - *

- * Adds all elements of list to coordinatorStats. - */ - public final Builder coordinatorStats(List list) { - this.coordinatorStats = _listAddAll(this.coordinatorStats, list); - return this; - } - - /** - * Required - Objects containing information about each coordinating ingest node - * for configured enrich processors. - *

- * API name: {@code coordinator_stats} - *

- * Adds one or more values to coordinatorStats. - */ - public final Builder coordinatorStats(CoordinatorStats value, CoordinatorStats... values) { - this.coordinatorStats = _listAdd(this.coordinatorStats, value, values); - return this; - } - - /** - * Required - Objects containing information about each coordinating ingest node - * for configured enrich processors. - *

- * API name: {@code coordinator_stats} - *

- * Adds a value to coordinatorStats using a builder lambda. - */ - public final Builder coordinatorStats(Function> fn) { - return coordinatorStats(fn.apply(new CoordinatorStats.Builder()).build()); - } - - /** - * Required - Objects containing information about each enrich policy that is - * currently executing. - *

- * API name: {@code executing_policies} - *

- * Adds all elements of list to executingPolicies. - */ - public final Builder executingPolicies(List list) { - this.executingPolicies = _listAddAll(this.executingPolicies, list); - return this; - } - - /** - * Required - Objects containing information about each enrich policy that is - * currently executing. - *

- * API name: {@code executing_policies} - *

- * Adds one or more values to executingPolicies. - */ - public final Builder executingPolicies(ExecutingPolicy value, ExecutingPolicy... values) { - this.executingPolicies = _listAdd(this.executingPolicies, value, values); - return this; - } - - /** - * Required - Objects containing information about each enrich policy that is - * currently executing. - *

- * API name: {@code executing_policies} - *

- * Adds a value to executingPolicies using a builder lambda. - */ - public final Builder executingPolicies(Function> fn) { - return executingPolicies(fn.apply(new ExecutingPolicy.Builder()).build()); - } - - /** - * Objects containing information about the enrich cache stats on each ingest - * node. - *

- * API name: {@code cache_stats} - *

- * Adds all elements of list to cacheStats. - */ - public final Builder cacheStats(List list) { - this.cacheStats = _listAddAll(this.cacheStats, list); - return this; - } - - /** - * Objects containing information about the enrich cache stats on each ingest - * node. - *

- * API name: {@code cache_stats} - *

- * Adds one or more values to cacheStats. - */ - public final Builder cacheStats(CacheStats value, CacheStats... values) { - this.cacheStats = _listAdd(this.cacheStats, value, values); - return this; - } - - /** - * Objects containing information about the enrich cache stats on each ingest - * node. - *

- * API name: {@code cache_stats} - *

- * Adds a value to cacheStats using a builder lambda. - */ - public final Builder cacheStats(Function> fn) { - return cacheStats(fn.apply(new CacheStats.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link EnrichStatsResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public EnrichStatsResponse build() { - _checkSingleUse(); - - return new EnrichStatsResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link EnrichStatsResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, EnrichStatsResponse::setupEnrichStatsResponseDeserializer); - - protected static void setupEnrichStatsResponseDeserializer(ObjectDeserializer op) { - - op.add(Builder::coordinatorStats, JsonpDeserializer.arrayDeserializer(CoordinatorStats._DESERIALIZER), - "coordinator_stats"); - op.add(Builder::executingPolicies, JsonpDeserializer.arrayDeserializer(ExecutingPolicy._DESERIALIZER), - "executing_policies"); - op.add(Builder::cacheStats, JsonpDeserializer.arrayDeserializer(CacheStats._DESERIALIZER), "cache_stats"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/EnrichSummary.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/EnrichSummary.java deleted file mode 100644 index d87db06e6..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/EnrichSummary.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.enrich; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.Pair; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: enrich._types.Summary - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class EnrichSummary implements JsonpSerializable { - private final Pair config; - - // --------------------------------------------------------------------------------------------- - - private EnrichSummary(Builder builder) { - - this.config = ApiTypeHelper.requireNonNull(builder.config, this, "config"); - - } - - public static EnrichSummary of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code config} - */ - public final Pair config() { - return this.config; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("config"); - generator.writeStartObject(); - generator.writeKey(this.config.key().jsonValue()); - this.config.value().serialize(generator, mapper); - - generator.writeEnd(); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link EnrichSummary}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Pair config; - - /** - * Required - API name: {@code config} - */ - public final Builder config(Pair value) { - this.config = value; - return this; - } - - /** - * Required - API name: {@code config} - */ - public Builder config(EnrichPolicyType key, EnrichPolicy value) { - this.config = new Pair(key, value); - return this; - } - - /** - * Required - API name: {@code config} - */ - public Builder config(EnrichPolicyType key, Function> fn) { - return this.config(key, fn.apply(new EnrichPolicy.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link EnrichSummary}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public EnrichSummary build() { - _checkSingleUse(); - - return new EnrichSummary(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link EnrichSummary} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - EnrichSummary::setupEnrichSummaryDeserializer); - - protected static void setupEnrichSummaryDeserializer(ObjectDeserializer op) { - - op.add(Builder::config, - Pair.deserializer((k) -> EnrichPolicyType._DESERIALIZER.parse(k), EnrichPolicy._DESERIALIZER), - "config"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/ExecutePolicyRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/ExecutePolicyRequest.java deleted file mode 100644 index 1623ad63c..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/ExecutePolicyRequest.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.enrich; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: enrich.execute_policy.Request - -/** - * Creates the enrich index for an existing enrich policy. - * - * @see API - * specification - */ - -public class ExecutePolicyRequest extends RequestBase { - private final String name; - - @Nullable - private final Boolean waitForCompletion; - - // --------------------------------------------------------------------------------------------- - - private ExecutePolicyRequest(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.waitForCompletion = builder.waitForCompletion; - - } - - public static ExecutePolicyRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Enrich policy to execute. - *

- * API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * If true, the request blocks other enrich policy execution - * requests until complete. - *

- * API name: {@code wait_for_completion} - */ - @Nullable - public final Boolean waitForCompletion() { - return this.waitForCompletion; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ExecutePolicyRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - private String name; - - @Nullable - private Boolean waitForCompletion; - - /** - * Required - Enrich policy to execute. - *

- * API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * If true, the request blocks other enrich policy execution - * requests until complete. - *

- * API name: {@code wait_for_completion} - */ - public final Builder waitForCompletion(@Nullable Boolean value) { - this.waitForCompletion = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ExecutePolicyRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ExecutePolicyRequest build() { - _checkSingleUse(); - - return new ExecutePolicyRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code enrich.execute_policy}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/enrich.execute_policy", - - // Request method - request -> { - return "PUT"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_enrich"); - buf.append("/policy"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); - buf.append("/_execute"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - params.put("name", request.name); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.waitForCompletion != null) { - params.put("wait_for_completion", String.valueOf(request.waitForCompletion)); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, ExecutePolicyResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/ExecutePolicyResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/ExecutePolicyResponse.java deleted file mode 100644 index f489217df..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/ExecutePolicyResponse.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.enrich; - -import co.elastic.clients.elasticsearch.enrich.execute_policy.ExecuteEnrichPolicyStatus; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: enrich.execute_policy.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class ExecutePolicyResponse implements JsonpSerializable { - @Nullable - private final ExecuteEnrichPolicyStatus status; - - @Nullable - private final String taskId; - - // --------------------------------------------------------------------------------------------- - - private ExecutePolicyResponse(Builder builder) { - - this.status = builder.status; - this.taskId = builder.taskId; - - } - - public static ExecutePolicyResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code status} - */ - @Nullable - public final ExecuteEnrichPolicyStatus status() { - return this.status; - } - - /** - * API name: {@code task_id} - */ - @Nullable - public final String taskId() { - return this.taskId; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.status != null) { - generator.writeKey("status"); - this.status.serialize(generator, mapper); - - } - if (this.taskId != null) { - generator.writeKey("task_id"); - generator.write(this.taskId); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ExecutePolicyResponse}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private ExecuteEnrichPolicyStatus status; - - @Nullable - private String taskId; - - /** - * API name: {@code status} - */ - public final Builder status(@Nullable ExecuteEnrichPolicyStatus value) { - this.status = value; - return this; - } - - /** - * API name: {@code status} - */ - public final Builder status( - Function> fn) { - return this.status(fn.apply(new ExecuteEnrichPolicyStatus.Builder()).build()); - } - - /** - * API name: {@code task_id} - */ - public final Builder taskId(@Nullable String value) { - this.taskId = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ExecutePolicyResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ExecutePolicyResponse build() { - _checkSingleUse(); - - return new ExecutePolicyResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ExecutePolicyResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, ExecutePolicyResponse::setupExecutePolicyResponseDeserializer); - - protected static void setupExecutePolicyResponseDeserializer(ObjectDeserializer op) { - - op.add(Builder::status, ExecuteEnrichPolicyStatus._DESERIALIZER, "status"); - op.add(Builder::taskId, JsonpDeserializer.stringDeserializer(), "task_id"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/GetPolicyRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/GetPolicyRequest.java deleted file mode 100644 index c7f0bc30a..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/GetPolicyRequest.java +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.enrich; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: enrich.get_policy.Request - -/** - * Get an enrich policy. Returns information about an enrich policy. - * - * @see API - * specification - */ - -public class GetPolicyRequest extends RequestBase { - private final List name; - - // --------------------------------------------------------------------------------------------- - - private GetPolicyRequest(Builder builder) { - - this.name = ApiTypeHelper.unmodifiable(builder.name); - - } - - public static GetPolicyRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Comma-separated list of enrich policy names used to limit the request. To - * return information for all enrich policies, omit this parameter. - *

- * API name: {@code name} - */ - public final List name() { - return this.name; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GetPolicyRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private List name; - - /** - * Comma-separated list of enrich policy names used to limit the request. To - * return information for all enrich policies, omit this parameter. - *

- * API name: {@code name} - *

- * Adds all elements of list to name. - */ - public final Builder name(List list) { - this.name = _listAddAll(this.name, list); - return this; - } - - /** - * Comma-separated list of enrich policy names used to limit the request. To - * return information for all enrich policies, omit this parameter. - *

- * API name: {@code name} - *

- * Adds one or more values to name. - */ - public final Builder name(String value, String... values) { - this.name = _listAdd(this.name, value, values); - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link GetPolicyRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GetPolicyRequest build() { - _checkSingleUse(); - - return new GetPolicyRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code enrich.get_policy}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/enrich.get_policy", - - // Request method - request -> { - return "GET"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - if (ApiTypeHelper.isDefined(request.name())) - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_enrich"); - buf.append("/policy"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); - return buf.toString(); - } - if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_enrich"); - buf.append("/policy"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - - int propsSet = 0; - - if (ApiTypeHelper.isDefined(request.name())) - propsSet |= _name; - - if (propsSet == (_name)) { - params.put("name", request.name.stream().map(v -> v).collect(Collectors.joining(","))); - } - if (propsSet == 0) { - } - return params; - }, - - // Request parameters - request -> { - return Collections.emptyMap(); - - }, SimpleEndpoint.emptyMap(), false, GetPolicyResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/GetPolicyResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/GetPolicyResponse.java deleted file mode 100644 index 1f87d2cc0..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/GetPolicyResponse.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.enrich; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: enrich.get_policy.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class GetPolicyResponse implements JsonpSerializable { - private final List policies; - - // --------------------------------------------------------------------------------------------- - - private GetPolicyResponse(Builder builder) { - - this.policies = ApiTypeHelper.unmodifiableRequired(builder.policies, this, "policies"); - - } - - public static GetPolicyResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code policies} - */ - public final List policies() { - return this.policies; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.policies)) { - generator.writeKey("policies"); - generator.writeStartArray(); - for (EnrichSummary item0 : this.policies) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GetPolicyResponse}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private List policies; - - /** - * Required - API name: {@code policies} - *

- * Adds all elements of list to policies. - */ - public final Builder policies(List list) { - this.policies = _listAddAll(this.policies, list); - return this; - } - - /** - * Required - API name: {@code policies} - *

- * Adds one or more values to policies. - */ - public final Builder policies(EnrichSummary value, EnrichSummary... values) { - this.policies = _listAdd(this.policies, value, values); - return this; - } - - /** - * Required - API name: {@code policies} - *

- * Adds a value to policies using a builder lambda. - */ - public final Builder policies(Function> fn) { - return policies(fn.apply(new EnrichSummary.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link GetPolicyResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GetPolicyResponse build() { - _checkSingleUse(); - - return new GetPolicyResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link GetPolicyResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, GetPolicyResponse::setupGetPolicyResponseDeserializer); - - protected static void setupGetPolicyResponseDeserializer(ObjectDeserializer op) { - - op.add(Builder::policies, JsonpDeserializer.arrayDeserializer(EnrichSummary._DESERIALIZER), "policies"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/PutPolicyRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/PutPolicyRequest.java deleted file mode 100644 index c7382272b..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/PutPolicyRequest.java +++ /dev/null @@ -1,343 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.enrich; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: enrich.put_policy.Request - -/** - * Create an enrich policy. Creates an enrich policy. - * - * @see API - * specification - */ -@JsonpDeserializable -public class PutPolicyRequest extends RequestBase implements JsonpSerializable { - @Nullable - private final EnrichPolicy geoMatch; - - @Nullable - private final EnrichPolicy match; - - private final String name; - - @Nullable - private final EnrichPolicy range; - - // --------------------------------------------------------------------------------------------- - - private PutPolicyRequest(Builder builder) { - - this.geoMatch = builder.geoMatch; - this.match = builder.match; - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.range = builder.range; - - } - - public static PutPolicyRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Matches enrich data to incoming documents based on a geo_shape - * query. - *

- * API name: {@code geo_match} - */ - @Nullable - public final EnrichPolicy geoMatch() { - return this.geoMatch; - } - - /** - * Matches enrich data to incoming documents based on a term query. - *

- * API name: {@code match} - */ - @Nullable - public final EnrichPolicy match() { - return this.match; - } - - /** - * Required - Name of the enrich policy to create or update. - *

- * API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Matches a number, date, or IP address in incoming documents to a range in the - * enrich index based on a term query. - *

- * API name: {@code range} - */ - @Nullable - public final EnrichPolicy range() { - return this.range; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.geoMatch != null) { - generator.writeKey("geo_match"); - this.geoMatch.serialize(generator, mapper); - - } - if (this.match != null) { - generator.writeKey("match"); - this.match.serialize(generator, mapper); - - } - if (this.range != null) { - generator.writeKey("range"); - this.range.serialize(generator, mapper); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link PutPolicyRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private EnrichPolicy geoMatch; - - @Nullable - private EnrichPolicy match; - - private String name; - - @Nullable - private EnrichPolicy range; - - /** - * Matches enrich data to incoming documents based on a geo_shape - * query. - *

- * API name: {@code geo_match} - */ - public final Builder geoMatch(@Nullable EnrichPolicy value) { - this.geoMatch = value; - return this; - } - - /** - * Matches enrich data to incoming documents based on a geo_shape - * query. - *

- * API name: {@code geo_match} - */ - public final Builder geoMatch(Function> fn) { - return this.geoMatch(fn.apply(new EnrichPolicy.Builder()).build()); - } - - /** - * Matches enrich data to incoming documents based on a term query. - *

- * API name: {@code match} - */ - public final Builder match(@Nullable EnrichPolicy value) { - this.match = value; - return this; - } - - /** - * Matches enrich data to incoming documents based on a term query. - *

- * API name: {@code match} - */ - public final Builder match(Function> fn) { - return this.match(fn.apply(new EnrichPolicy.Builder()).build()); - } - - /** - * Required - Name of the enrich policy to create or update. - *

- * API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * Matches a number, date, or IP address in incoming documents to a range in the - * enrich index based on a term query. - *

- * API name: {@code range} - */ - public final Builder range(@Nullable EnrichPolicy value) { - this.range = value; - return this; - } - - /** - * Matches a number, date, or IP address in incoming documents to a range in the - * enrich index based on a term query. - *

- * API name: {@code range} - */ - public final Builder range(Function> fn) { - return this.range(fn.apply(new EnrichPolicy.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link PutPolicyRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public PutPolicyRequest build() { - _checkSingleUse(); - - return new PutPolicyRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link PutPolicyRequest} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - PutPolicyRequest::setupPutPolicyRequestDeserializer); - - protected static void setupPutPolicyRequestDeserializer(ObjectDeserializer op) { - - op.add(Builder::geoMatch, EnrichPolicy._DESERIALIZER, "geo_match"); - op.add(Builder::match, EnrichPolicy._DESERIALIZER, "match"); - op.add(Builder::range, EnrichPolicy._DESERIALIZER, "range"); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code enrich.put_policy}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/enrich.put_policy", - - // Request method - request -> { - return "PUT"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_enrich"); - buf.append("/policy"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - params.put("name", request.name); - } - return params; - }, - - // Request parameters - request -> { - return Collections.emptyMap(); - - }, SimpleEndpoint.emptyMap(), true, PutPolicyResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/PutPolicyResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/PutPolicyResponse.java deleted file mode 100644 index dc1f57db4..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/PutPolicyResponse.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.enrich; - -import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: enrich.put_policy.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class PutPolicyResponse extends AcknowledgedResponseBase { - // --------------------------------------------------------------------------------------------- - - private PutPolicyResponse(Builder builder) { - super(builder); - - } - - public static PutPolicyResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link PutPolicyResponse}. - */ - - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder - implements - ObjectBuilder { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link PutPolicyResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public PutPolicyResponse build() { - _checkSingleUse(); - - return new PutPolicyResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link PutPolicyResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, PutPolicyResponse::setupPutPolicyResponseDeserializer); - - protected static void setupPutPolicyResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/execute_policy/EnrichPolicyPhase.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/execute_policy/EnrichPolicyPhase.java deleted file mode 100644 index afe15042b..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/execute_policy/EnrichPolicyPhase.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.enrich.execute_policy; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum EnrichPolicyPhase implements JsonEnum { - Scheduled("SCHEDULED"), - - Running("RUNNING"), - - Complete("COMPLETE"), - - Failed("FAILED"), - - ; - - private final String jsonValue; - - EnrichPolicyPhase(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - EnrichPolicyPhase.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/execute_policy/ExecuteEnrichPolicyStatus.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/execute_policy/ExecuteEnrichPolicyStatus.java deleted file mode 100644 index 189a538f6..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/execute_policy/ExecuteEnrichPolicyStatus.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.enrich.execute_policy; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: enrich.execute_policy.ExecuteEnrichPolicyStatus - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class ExecuteEnrichPolicyStatus implements JsonpSerializable { - private final EnrichPolicyPhase phase; - - // --------------------------------------------------------------------------------------------- - - private ExecuteEnrichPolicyStatus(Builder builder) { - - this.phase = ApiTypeHelper.requireNonNull(builder.phase, this, "phase"); - - } - - public static ExecuteEnrichPolicyStatus of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code phase} - */ - public final EnrichPolicyPhase phase() { - return this.phase; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("phase"); - this.phase.serialize(generator, mapper); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ExecuteEnrichPolicyStatus}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private EnrichPolicyPhase phase; - - /** - * Required - API name: {@code phase} - */ - public final Builder phase(EnrichPolicyPhase value) { - this.phase = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ExecuteEnrichPolicyStatus}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ExecuteEnrichPolicyStatus build() { - _checkSingleUse(); - - return new ExecuteEnrichPolicyStatus(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ExecuteEnrichPolicyStatus} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, ExecuteEnrichPolicyStatus::setupExecuteEnrichPolicyStatusDeserializer); - - protected static void setupExecuteEnrichPolicyStatusDeserializer( - ObjectDeserializer op) { - - op.add(Builder::phase, EnrichPolicyPhase._DESERIALIZER, "phase"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/stats/CacheStats.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/stats/CacheStats.java deleted file mode 100644 index 61ad1fe41..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/stats/CacheStats.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.enrich.stats; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Integer; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: enrich.stats.CacheStats - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class CacheStats implements JsonpSerializable { - private final String nodeId; - - private final int count; - - private final int hits; - - private final int misses; - - private final int evictions; - - // --------------------------------------------------------------------------------------------- - - private CacheStats(Builder builder) { - - this.nodeId = ApiTypeHelper.requireNonNull(builder.nodeId, this, "nodeId"); - this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); - this.hits = ApiTypeHelper.requireNonNull(builder.hits, this, "hits"); - this.misses = ApiTypeHelper.requireNonNull(builder.misses, this, "misses"); - this.evictions = ApiTypeHelper.requireNonNull(builder.evictions, this, "evictions"); - - } - - public static CacheStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code node_id} - */ - public final String nodeId() { - return this.nodeId; - } - - /** - * Required - API name: {@code count} - */ - public final int count() { - return this.count; - } - - /** - * Required - API name: {@code hits} - */ - public final int hits() { - return this.hits; - } - - /** - * Required - API name: {@code misses} - */ - public final int misses() { - return this.misses; - } - - /** - * Required - API name: {@code evictions} - */ - public final int evictions() { - return this.evictions; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("node_id"); - generator.write(this.nodeId); - - generator.writeKey("count"); - generator.write(this.count); - - generator.writeKey("hits"); - generator.write(this.hits); - - generator.writeKey("misses"); - generator.write(this.misses); - - generator.writeKey("evictions"); - generator.write(this.evictions); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link CacheStats}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private String nodeId; - - private Integer count; - - private Integer hits; - - private Integer misses; - - private Integer evictions; - - /** - * Required - API name: {@code node_id} - */ - public final Builder nodeId(String value) { - this.nodeId = value; - return this; - } - - /** - * Required - API name: {@code count} - */ - public final Builder count(int value) { - this.count = value; - return this; - } - - /** - * Required - API name: {@code hits} - */ - public final Builder hits(int value) { - this.hits = value; - return this; - } - - /** - * Required - API name: {@code misses} - */ - public final Builder misses(int value) { - this.misses = value; - return this; - } - - /** - * Required - API name: {@code evictions} - */ - public final Builder evictions(int value) { - this.evictions = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link CacheStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public CacheStats build() { - _checkSingleUse(); - - return new CacheStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link CacheStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - CacheStats::setupCacheStatsDeserializer); - - protected static void setupCacheStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::nodeId, JsonpDeserializer.stringDeserializer(), "node_id"); - op.add(Builder::count, JsonpDeserializer.integerDeserializer(), "count"); - op.add(Builder::hits, JsonpDeserializer.integerDeserializer(), "hits"); - op.add(Builder::misses, JsonpDeserializer.integerDeserializer(), "misses"); - op.add(Builder::evictions, JsonpDeserializer.integerDeserializer(), "evictions"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/stats/CoordinatorStats.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/stats/CoordinatorStats.java deleted file mode 100644 index f6df3a720..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/stats/CoordinatorStats.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.enrich.stats; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Integer; -import java.lang.Long; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: enrich.stats.CoordinatorStats - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class CoordinatorStats implements JsonpSerializable { - private final long executedSearchesTotal; - - private final String nodeId; - - private final int queueSize; - - private final int remoteRequestsCurrent; - - private final long remoteRequestsTotal; - - // --------------------------------------------------------------------------------------------- - - private CoordinatorStats(Builder builder) { - - this.executedSearchesTotal = ApiTypeHelper.requireNonNull(builder.executedSearchesTotal, this, - "executedSearchesTotal"); - this.nodeId = ApiTypeHelper.requireNonNull(builder.nodeId, this, "nodeId"); - this.queueSize = ApiTypeHelper.requireNonNull(builder.queueSize, this, "queueSize"); - this.remoteRequestsCurrent = ApiTypeHelper.requireNonNull(builder.remoteRequestsCurrent, this, - "remoteRequestsCurrent"); - this.remoteRequestsTotal = ApiTypeHelper.requireNonNull(builder.remoteRequestsTotal, this, - "remoteRequestsTotal"); - - } - - public static CoordinatorStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code executed_searches_total} - */ - public final long executedSearchesTotal() { - return this.executedSearchesTotal; - } - - /** - * Required - API name: {@code node_id} - */ - public final String nodeId() { - return this.nodeId; - } - - /** - * Required - API name: {@code queue_size} - */ - public final int queueSize() { - return this.queueSize; - } - - /** - * Required - API name: {@code remote_requests_current} - */ - public final int remoteRequestsCurrent() { - return this.remoteRequestsCurrent; - } - - /** - * Required - API name: {@code remote_requests_total} - */ - public final long remoteRequestsTotal() { - return this.remoteRequestsTotal; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("executed_searches_total"); - generator.write(this.executedSearchesTotal); - - generator.writeKey("node_id"); - generator.write(this.nodeId); - - generator.writeKey("queue_size"); - generator.write(this.queueSize); - - generator.writeKey("remote_requests_current"); - generator.write(this.remoteRequestsCurrent); - - generator.writeKey("remote_requests_total"); - generator.write(this.remoteRequestsTotal); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link CoordinatorStats}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Long executedSearchesTotal; - - private String nodeId; - - private Integer queueSize; - - private Integer remoteRequestsCurrent; - - private Long remoteRequestsTotal; - - /** - * Required - API name: {@code executed_searches_total} - */ - public final Builder executedSearchesTotal(long value) { - this.executedSearchesTotal = value; - return this; - } - - /** - * Required - API name: {@code node_id} - */ - public final Builder nodeId(String value) { - this.nodeId = value; - return this; - } - - /** - * Required - API name: {@code queue_size} - */ - public final Builder queueSize(int value) { - this.queueSize = value; - return this; - } - - /** - * Required - API name: {@code remote_requests_current} - */ - public final Builder remoteRequestsCurrent(int value) { - this.remoteRequestsCurrent = value; - return this; - } - - /** - * Required - API name: {@code remote_requests_total} - */ - public final Builder remoteRequestsTotal(long value) { - this.remoteRequestsTotal = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link CoordinatorStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public CoordinatorStats build() { - _checkSingleUse(); - - return new CoordinatorStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link CoordinatorStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - CoordinatorStats::setupCoordinatorStatsDeserializer); - - protected static void setupCoordinatorStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::executedSearchesTotal, JsonpDeserializer.longDeserializer(), "executed_searches_total"); - op.add(Builder::nodeId, JsonpDeserializer.stringDeserializer(), "node_id"); - op.add(Builder::queueSize, JsonpDeserializer.integerDeserializer(), "queue_size"); - op.add(Builder::remoteRequestsCurrent, JsonpDeserializer.integerDeserializer(), "remote_requests_current"); - op.add(Builder::remoteRequestsTotal, JsonpDeserializer.longDeserializer(), "remote_requests_total"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/stats/ExecutingPolicy.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/stats/ExecutingPolicy.java deleted file mode 100644 index 78efa6763..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/enrich/stats/ExecutingPolicy.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.enrich.stats; - -import co.elastic.clients.elasticsearch.tasks.TaskInfo; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: enrich.stats.ExecutingPolicy - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class ExecutingPolicy implements JsonpSerializable { - private final String name; - - private final TaskInfo task; - - // --------------------------------------------------------------------------------------------- - - private ExecutingPolicy(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.task = ApiTypeHelper.requireNonNull(builder.task, this, "task"); - - } - - public static ExecutingPolicy of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Required - API name: {@code task} - */ - public final TaskInfo task() { - return this.task; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("name"); - generator.write(this.name); - - generator.writeKey("task"); - this.task.serialize(generator, mapper); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ExecutingPolicy}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private String name; - - private TaskInfo task; - - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * Required - API name: {@code task} - */ - public final Builder task(TaskInfo value) { - this.task = value; - return this; - } - - /** - * Required - API name: {@code task} - */ - public final Builder task(Function> fn) { - return this.task(fn.apply(new TaskInfo.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ExecutingPolicy}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ExecutingPolicy build() { - _checkSingleUse(); - - return new ExecutingPolicy(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ExecutingPolicy} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - ExecutingPolicy::setupExecutingPolicyDeserializer); - - protected static void setupExecutingPolicyDeserializer(ObjectDeserializer op) { - - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::task, TaskInfo._DESERIALIZER, "task"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/ElasticsearchEqlAsyncClient.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/ElasticsearchEqlAsyncClient.java deleted file mode 100644 index 9af457c16..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/ElasticsearchEqlAsyncClient.java +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.eql; - -import co.elastic.clients.ApiClient; -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.transport.ElasticsearchTransport; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.JsonEndpoint; -import co.elastic.clients.transport.Transport; -import co.elastic.clients.transport.TransportOptions; -import co.elastic.clients.transport.endpoints.EndpointWithResponseMapperAttr; -import co.elastic.clients.util.ObjectBuilder; -import java.lang.reflect.Type; -import java.util.concurrent.CompletableFuture; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Client for the eql namespace. - */ -public class ElasticsearchEqlAsyncClient extends ApiClient { - - public ElasticsearchEqlAsyncClient(ElasticsearchTransport transport) { - super(transport, null); - } - - public ElasticsearchEqlAsyncClient(ElasticsearchTransport transport, @Nullable TransportOptions transportOptions) { - super(transport, transportOptions); - } - - @Override - public ElasticsearchEqlAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) { - return new ElasticsearchEqlAsyncClient(this.transport, transportOptions); - } - - // ----- Endpoint: eql.delete - - /** - * Deletes an async EQL search or a stored synchronous EQL search. The API also - * deletes results for the search. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture delete(EqlDeleteRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) EqlDeleteRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Deletes an async EQL search or a stored synchronous EQL search. The API also - * deletes results for the search. - * - * @param fn - * a function that initializes a builder to create the - * {@link EqlDeleteRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture delete( - Function> fn) { - return delete(fn.apply(new EqlDeleteRequest.Builder()).build()); - } - - // ----- Endpoint: eql.get - - /** - * Returns the current status and available results for an async EQL search or a - * stored synchronous EQL search. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> get(EqlGetRequest request, Class tEventClass) { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) EqlGetRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:eql.get.Response.TEvent", getDeserializer(tEventClass)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns the current status and available results for an async EQL search or a - * stored synchronous EQL search. - * - * @param fn - * a function that initializes a builder to create the - * {@link EqlGetRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> get( - Function> fn, Class tEventClass) { - return get(fn.apply(new EqlGetRequest.Builder()).build(), tEventClass); - } - - /** - * Returns the current status and available results for an async EQL search or a - * stored synchronous EQL search. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> get(EqlGetRequest request, Type tEventType) { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) EqlGetRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:eql.get.Response.TEvent", getDeserializer(tEventType)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns the current status and available results for an async EQL search or a - * stored synchronous EQL search. - * - * @param fn - * a function that initializes a builder to create the - * {@link EqlGetRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> get( - Function> fn, Type tEventType) { - return get(fn.apply(new EqlGetRequest.Builder()).build(), tEventType); - } - - // ----- Endpoint: eql.get_status - - /** - * Returns the current status for an async EQL search or a stored synchronous - * EQL search without returning results. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture getStatus(GetEqlStatusRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) GetEqlStatusRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns the current status for an async EQL search or a stored synchronous - * EQL search without returning results. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetEqlStatusRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture getStatus( - Function> fn) { - return getStatus(fn.apply(new GetEqlStatusRequest.Builder()).build()); - } - - // ----- Endpoint: eql.search - - /** - * Returns results matching a query expressed in Event Query Language (EQL) - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> search(EqlSearchRequest request, - Class tEventClass) { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) EqlSearchRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:eql.search.Response.TEvent", getDeserializer(tEventClass)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns results matching a query expressed in Event Query Language (EQL) - * - * @param fn - * a function that initializes a builder to create the - * {@link EqlSearchRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> search( - Function> fn, Class tEventClass) { - return search(fn.apply(new EqlSearchRequest.Builder()).build(), tEventClass); - } - - /** - * Returns results matching a query expressed in Event Query Language (EQL) - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture> search(EqlSearchRequest request, Type tEventType) { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) EqlSearchRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:eql.search.Response.TEvent", getDeserializer(tEventType)); - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns results matching a query expressed in Event Query Language (EQL) - * - * @param fn - * a function that initializes a builder to create the - * {@link EqlSearchRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture> search( - Function> fn, Type tEventType) { - return search(fn.apply(new EqlSearchRequest.Builder()).build(), tEventType); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/ElasticsearchEqlClient.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/ElasticsearchEqlClient.java deleted file mode 100644 index 5de6aa5b6..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/ElasticsearchEqlClient.java +++ /dev/null @@ -1,287 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.eql; - -import co.elastic.clients.ApiClient; -import co.elastic.clients.elasticsearch._types.ElasticsearchException; -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.transport.ElasticsearchTransport; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.JsonEndpoint; -import co.elastic.clients.transport.Transport; -import co.elastic.clients.transport.TransportOptions; -import co.elastic.clients.transport.endpoints.EndpointWithResponseMapperAttr; -import co.elastic.clients.util.ObjectBuilder; -import java.io.IOException; -import java.lang.reflect.Type; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Client for the eql namespace. - */ -public class ElasticsearchEqlClient extends ApiClient { - - public ElasticsearchEqlClient(ElasticsearchTransport transport) { - super(transport, null); - } - - public ElasticsearchEqlClient(ElasticsearchTransport transport, @Nullable TransportOptions transportOptions) { - super(transport, transportOptions); - } - - @Override - public ElasticsearchEqlClient withTransportOptions(@Nullable TransportOptions transportOptions) { - return new ElasticsearchEqlClient(this.transport, transportOptions); - } - - // ----- Endpoint: eql.delete - - /** - * Deletes an async EQL search or a stored synchronous EQL search. The API also - * deletes results for the search. - * - * @see Documentation - * on elastic.co - */ - - public EqlDeleteResponse delete(EqlDeleteRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) EqlDeleteRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Deletes an async EQL search or a stored synchronous EQL search. The API also - * deletes results for the search. - * - * @param fn - * a function that initializes a builder to create the - * {@link EqlDeleteRequest} - * @see Documentation - * on elastic.co - */ - - public final EqlDeleteResponse delete(Function> fn) - throws IOException, ElasticsearchException { - return delete(fn.apply(new EqlDeleteRequest.Builder()).build()); - } - - // ----- Endpoint: eql.get - - /** - * Returns the current status and available results for an async EQL search or a - * stored synchronous EQL search. - * - * @see Documentation - * on elastic.co - */ - - public EqlGetResponse get(EqlGetRequest request, Class tEventClass) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) EqlGetRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:eql.get.Response.TEvent", getDeserializer(tEventClass)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns the current status and available results for an async EQL search or a - * stored synchronous EQL search. - * - * @param fn - * a function that initializes a builder to create the - * {@link EqlGetRequest} - * @see Documentation - * on elastic.co - */ - - public final EqlGetResponse get(Function> fn, - Class tEventClass) throws IOException, ElasticsearchException { - return get(fn.apply(new EqlGetRequest.Builder()).build(), tEventClass); - } - - /** - * Returns the current status and available results for an async EQL search or a - * stored synchronous EQL search. - * - * @see Documentation - * on elastic.co - */ - - public EqlGetResponse get(EqlGetRequest request, Type tEventType) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) EqlGetRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:eql.get.Response.TEvent", getDeserializer(tEventType)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns the current status and available results for an async EQL search or a - * stored synchronous EQL search. - * - * @param fn - * a function that initializes a builder to create the - * {@link EqlGetRequest} - * @see Documentation - * on elastic.co - */ - - public final EqlGetResponse get(Function> fn, - Type tEventType) throws IOException, ElasticsearchException { - return get(fn.apply(new EqlGetRequest.Builder()).build(), tEventType); - } - - // ----- Endpoint: eql.get_status - - /** - * Returns the current status for an async EQL search or a stored synchronous - * EQL search without returning results. - * - * @see Documentation - * on elastic.co - */ - - public GetEqlStatusResponse getStatus(GetEqlStatusRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) GetEqlStatusRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns the current status for an async EQL search or a stored synchronous - * EQL search without returning results. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetEqlStatusRequest} - * @see Documentation - * on elastic.co - */ - - public final GetEqlStatusResponse getStatus( - Function> fn) - throws IOException, ElasticsearchException { - return getStatus(fn.apply(new GetEqlStatusRequest.Builder()).build()); - } - - // ----- Endpoint: eql.search - - /** - * Returns results matching a query expressed in Event Query Language (EQL) - * - * @see Documentation - * on elastic.co - */ - - public EqlSearchResponse search(EqlSearchRequest request, Class tEventClass) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) EqlSearchRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:eql.search.Response.TEvent", getDeserializer(tEventClass)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns results matching a query expressed in Event Query Language (EQL) - * - * @param fn - * a function that initializes a builder to create the - * {@link EqlSearchRequest} - * @see Documentation - * on elastic.co - */ - - public final EqlSearchResponse search( - Function> fn, Class tEventClass) - throws IOException, ElasticsearchException { - return search(fn.apply(new EqlSearchRequest.Builder()).build(), tEventClass); - } - - /** - * Returns results matching a query expressed in Event Query Language (EQL) - * - * @see Documentation - * on elastic.co - */ - - public EqlSearchResponse search(EqlSearchRequest request, Type tEventType) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) EqlSearchRequest._ENDPOINT; - endpoint = new EndpointWithResponseMapperAttr<>(endpoint, - "co.elastic.clients:Deserializer:eql.search.Response.TEvent", getDeserializer(tEventType)); - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns results matching a query expressed in Event Query Language (EQL) - * - * @param fn - * a function that initializes a builder to create the - * {@link EqlSearchRequest} - * @see Documentation - * on elastic.co - */ - - public final EqlSearchResponse search( - Function> fn, Type tEventType) - throws IOException, ElasticsearchException { - return search(fn.apply(new EqlSearchRequest.Builder()).build(), tEventType); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/EqlDeleteRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/EqlDeleteRequest.java deleted file mode 100644 index 79d4e352a..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/EqlDeleteRequest.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.eql; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: eql.delete.Request - -/** - * Deletes an async EQL search or a stored synchronous EQL search. The API also - * deletes results for the search. - * - * @see API - * specification - */ - -public class EqlDeleteRequest extends RequestBase { - private final String id; - - // --------------------------------------------------------------------------------------------- - - private EqlDeleteRequest(Builder builder) { - - this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); - - } - - public static EqlDeleteRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - 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. - *

- * API name: {@code id} - */ - public final String id() { - return this.id; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link EqlDeleteRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - private String id; - - /** - * Required - 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. - *

- * API name: {@code id} - */ - public final Builder id(String value) { - this.id = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link EqlDeleteRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public EqlDeleteRequest build() { - _checkSingleUse(); - - return new EqlDeleteRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code eql.delete}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/eql.delete", - - // Request method - request -> { - return "DELETE"; - - }, - - // Request path - request -> { - final int _id = 1 << 0; - - int propsSet = 0; - - propsSet |= _id; - - if (propsSet == (_id)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_eql"); - buf.append("/search"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.id, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _id = 1 << 0; - - int propsSet = 0; - - propsSet |= _id; - - if (propsSet == (_id)) { - params.put("id", request.id); - } - return params; - }, - - // Request parameters - request -> { - return Collections.emptyMap(); - - }, SimpleEndpoint.emptyMap(), false, EqlDeleteResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/EqlDeleteResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/EqlDeleteResponse.java deleted file mode 100644 index 21106c574..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/EqlDeleteResponse.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.eql; - -import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: eql.delete.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class EqlDeleteResponse extends AcknowledgedResponseBase { - // --------------------------------------------------------------------------------------------- - - private EqlDeleteResponse(Builder builder) { - super(builder); - - } - - public static EqlDeleteResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link EqlDeleteResponse}. - */ - - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder - implements - ObjectBuilder { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link EqlDeleteResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public EqlDeleteResponse build() { - _checkSingleUse(); - - return new EqlDeleteResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link EqlDeleteResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, EqlDeleteResponse::setupEqlDeleteResponseDeserializer); - - protected static void setupEqlDeleteResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/EqlGetRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/EqlGetRequest.java deleted file mode 100644 index dfb379ee1..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/EqlGetRequest.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.eql; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: eql.get.Request - -/** - * Returns the current status and available results for an async EQL search or a - * stored synchronous EQL search. - * - * @see API - * specification - */ - -public class EqlGetRequest extends RequestBase { - private final String id; - - @Nullable - private final Time keepAlive; - - @Nullable - private final Time waitForCompletionTimeout; - - // --------------------------------------------------------------------------------------------- - - private EqlGetRequest(Builder builder) { - - this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); - this.keepAlive = builder.keepAlive; - this.waitForCompletionTimeout = builder.waitForCompletionTimeout; - - } - - public static EqlGetRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Identifier for the search. - *

- * API name: {@code id} - */ - public final String id() { - return this.id; - } - - /** - * 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. - *

- * API name: {@code keep_alive} - */ - @Nullable - public final Time keepAlive() { - return this.keepAlive; - } - - /** - * Timeout duration to wait for the request to finish. Defaults to no timeout, - * meaning the request waits for complete search results. - *

- * API name: {@code wait_for_completion_timeout} - */ - @Nullable - public final Time waitForCompletionTimeout() { - return this.waitForCompletionTimeout; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link EqlGetRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { - private String id; - - @Nullable - private Time keepAlive; - - @Nullable - private Time waitForCompletionTimeout; - - /** - * Required - Identifier for the search. - *

- * API name: {@code id} - */ - public final Builder id(String value) { - this.id = value; - return this; - } - - /** - * 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. - *

- * API name: {@code keep_alive} - */ - public final Builder keepAlive(@Nullable Time value) { - this.keepAlive = value; - return this; - } - - /** - * 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. - *

- * API name: {@code keep_alive} - */ - public final Builder keepAlive(Function> fn) { - return this.keepAlive(fn.apply(new Time.Builder()).build()); - } - - /** - * Timeout duration to wait for the request to finish. Defaults to no timeout, - * meaning the request waits for complete search results. - *

- * API name: {@code wait_for_completion_timeout} - */ - public final Builder waitForCompletionTimeout(@Nullable Time value) { - this.waitForCompletionTimeout = value; - return this; - } - - /** - * Timeout duration to wait for the request to finish. Defaults to no timeout, - * meaning the request waits for complete search results. - *

- * API name: {@code wait_for_completion_timeout} - */ - public final Builder waitForCompletionTimeout(Function> fn) { - return this.waitForCompletionTimeout(fn.apply(new Time.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link EqlGetRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public EqlGetRequest build() { - _checkSingleUse(); - - return new EqlGetRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code eql.get}". - */ - public static final SimpleEndpoint _ENDPOINT = new SimpleEndpoint<>("es/eql.get", - - // Request method - request -> { - return "GET"; - - }, - - // Request path - request -> { - final int _id = 1 << 0; - - int propsSet = 0; - - propsSet |= _id; - - if (propsSet == (_id)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_eql"); - buf.append("/search"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.id, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _id = 1 << 0; - - int propsSet = 0; - - propsSet |= _id; - - if (propsSet == (_id)) { - params.put("id", request.id); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.keepAlive != null) { - params.put("keep_alive", request.keepAlive._toJsonString()); - } - if (request.waitForCompletionTimeout != null) { - params.put("wait_for_completion_timeout", request.waitForCompletionTimeout._toJsonString()); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, EqlGetResponse._DESERIALIZER); - - /** - * Create an "{@code eql.get}" endpoint. - */ - public static Endpoint, ErrorResponse> createGetEndpoint( - JsonpDeserializer tEventDeserializer) { - return _ENDPOINT.withResponseDeserializer(EqlGetResponse.createEqlGetResponseDeserializer(tEventDeserializer)); - } -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/EqlGetResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/EqlGetResponse.java deleted file mode 100644 index e06025629..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/EqlGetResponse.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.eql; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.NamedDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import java.util.function.Supplier; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: eql.get.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class EqlGetResponse extends EqlSearchResponseBase { - // --------------------------------------------------------------------------------------------- - - private EqlGetResponse(Builder builder) { - super(builder); - - } - - public static EqlGetResponse of( - Function, ObjectBuilder>> fn) { - return fn.apply(new Builder<>()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link EqlGetResponse}. - */ - - public static class Builder extends EqlSearchResponseBase.AbstractBuilder> - implements - ObjectBuilder> { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link EqlGetResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public EqlGetResponse build() { - _checkSingleUse(); - - return new EqlGetResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Create a JSON deserializer for EqlGetResponse - */ - public static JsonpDeserializer> createEqlGetResponseDeserializer( - JsonpDeserializer tEventDeserializer) { - return ObjectBuilderDeserializer.createForObject((Supplier>) Builder::new, - op -> EqlGetResponse.setupEqlGetResponseDeserializer(op, tEventDeserializer)); - }; - - /** - * Json deserializer for {@link EqlGetResponse} based on named deserializers - * provided by the calling {@code JsonMapper}. - */ - public static final JsonpDeserializer> _DESERIALIZER = JsonpDeserializer - .lazy(() -> createEqlGetResponseDeserializer( - new NamedDeserializer<>("co.elastic.clients:Deserializer:eql.get.Response.TEvent"))); - - protected static void setupEqlGetResponseDeserializer( - ObjectDeserializer> op, JsonpDeserializer tEventDeserializer) { - EqlSearchResponseBase.setupEqlSearchResponseBaseDeserializer(op, tEventDeserializer); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/EqlHits.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/EqlHits.java deleted file mode 100644 index b1731fb74..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/EqlHits.java +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.eql; - -import co.elastic.clients.elasticsearch.core.search.TotalHits; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpSerializer; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.NamedDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import java.util.function.Supplier; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: eql._types.EqlHits - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class EqlHits implements JsonpSerializable { - @Nullable - private final TotalHits total; - - private final List> events; - - private final List> sequences; - - @Nullable - private final JsonpSerializer tEventSerializer; - - // --------------------------------------------------------------------------------------------- - - private EqlHits(Builder builder) { - - this.total = builder.total; - this.events = ApiTypeHelper.unmodifiable(builder.events); - this.sequences = ApiTypeHelper.unmodifiable(builder.sequences); - this.tEventSerializer = builder.tEventSerializer; - - } - - public static EqlHits of(Function, ObjectBuilder>> fn) { - return fn.apply(new Builder<>()).build(); - } - - /** - * Metadata about the number of matching events or sequences. - *

- * API name: {@code total} - */ - @Nullable - public final TotalHits total() { - return this.total; - } - - /** - * Contains events matching the query. Each object represents a matching event. - *

- * API name: {@code events} - */ - public final List> events() { - return this.events; - } - - /** - * Contains event sequences matching the query. Each object represents a - * matching sequence. This parameter is only returned for EQL queries containing - * a sequence. - *

- * API name: {@code sequences} - */ - public final List> sequences() { - return this.sequences; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.total != null) { - generator.writeKey("total"); - this.total.serialize(generator, mapper); - - } - if (ApiTypeHelper.isDefined(this.events)) { - generator.writeKey("events"); - generator.writeStartArray(); - for (HitsEvent item0 : this.events) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.sequences)) { - generator.writeKey("sequences"); - generator.writeStartArray(); - for (HitsSequence item0 : this.sequences) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link EqlHits}. - */ - - public static class Builder extends WithJsonObjectBuilderBase> - implements - ObjectBuilder> { - @Nullable - private TotalHits total; - - @Nullable - private List> events; - - @Nullable - private List> sequences; - - @Nullable - private JsonpSerializer tEventSerializer; - - /** - * Metadata about the number of matching events or sequences. - *

- * API name: {@code total} - */ - public final Builder total(@Nullable TotalHits value) { - this.total = value; - return this; - } - - /** - * Metadata about the number of matching events or sequences. - *

- * API name: {@code total} - */ - public final Builder total(Function> fn) { - return this.total(fn.apply(new TotalHits.Builder()).build()); - } - - /** - * Contains events matching the query. Each object represents a matching event. - *

- * API name: {@code events} - *

- * Adds all elements of list to events. - */ - public final Builder events(List> list) { - this.events = _listAddAll(this.events, list); - return this; - } - - /** - * Contains events matching the query. Each object represents a matching event. - *

- * API name: {@code events} - *

- * Adds one or more values to events. - */ - public final Builder events(HitsEvent value, HitsEvent... values) { - this.events = _listAdd(this.events, value, values); - return this; - } - - /** - * Contains events matching the query. Each object represents a matching event. - *

- * API name: {@code events} - *

- * Adds a value to events using a builder lambda. - */ - public final Builder events(Function, ObjectBuilder>> fn) { - return events(fn.apply(new HitsEvent.Builder()).build()); - } - - /** - * Contains event sequences matching the query. Each object represents a - * matching sequence. This parameter is only returned for EQL queries containing - * a sequence. - *

- * API name: {@code sequences} - *

- * Adds all elements of list to sequences. - */ - public final Builder sequences(List> list) { - this.sequences = _listAddAll(this.sequences, list); - return this; - } - - /** - * Contains event sequences matching the query. Each object represents a - * matching sequence. This parameter is only returned for EQL queries containing - * a sequence. - *

- * API name: {@code sequences} - *

- * Adds one or more values to sequences. - */ - public final Builder sequences(HitsSequence value, HitsSequence... values) { - this.sequences = _listAdd(this.sequences, value, values); - return this; - } - - /** - * Contains event sequences matching the query. Each object represents a - * matching sequence. This parameter is only returned for EQL queries containing - * a sequence. - *

- * API name: {@code sequences} - *

- * Adds a value to sequences using a builder lambda. - */ - public final Builder sequences( - Function, ObjectBuilder>> fn) { - return sequences(fn.apply(new HitsSequence.Builder()).build()); - } - - /** - * Serializer for TEvent. If not set, an attempt will be made to find a - * serializer from the JSON context. - */ - public final Builder tEventSerializer(@Nullable JsonpSerializer value) { - this.tEventSerializer = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link EqlHits}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public EqlHits build() { - _checkSingleUse(); - - return new EqlHits(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Create a JSON deserializer for EqlHits - */ - public static JsonpDeserializer> createEqlHitsDeserializer( - JsonpDeserializer tEventDeserializer) { - return ObjectBuilderDeserializer.createForObject((Supplier>) Builder::new, - op -> EqlHits.setupEqlHitsDeserializer(op, tEventDeserializer)); - }; - - /** - * Json deserializer for {@link EqlHits} based on named deserializers provided - * by the calling {@code JsonMapper}. - */ - public static final JsonpDeserializer> _DESERIALIZER = JsonpDeserializer - .lazy(() -> createEqlHitsDeserializer( - new NamedDeserializer<>("co.elastic.clients:Deserializer:eql._types.EqlHits.TEvent"))); - - protected static void setupEqlHitsDeserializer(ObjectDeserializer> op, - JsonpDeserializer tEventDeserializer) { - - op.add(Builder::total, TotalHits._DESERIALIZER, "total"); - op.add(Builder::events, - JsonpDeserializer.arrayDeserializer(HitsEvent.createHitsEventDeserializer(tEventDeserializer)), - "events"); - op.add(Builder::sequences, - JsonpDeserializer.arrayDeserializer(HitsSequence.createHitsSequenceDeserializer(tEventDeserializer)), - "sequences"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/EqlSearchRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/EqlSearchRequest.java deleted file mode 100644 index 4002a1336..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/EqlSearchRequest.java +++ /dev/null @@ -1,875 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.eql; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.ExpandWildcard; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.elasticsearch._types.mapping.RuntimeField; -import co.elastic.clients.elasticsearch._types.query_dsl.FieldAndFormat; -import co.elastic.clients.elasticsearch._types.query_dsl.Query; -import co.elastic.clients.elasticsearch.eql.search.ResultPosition; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Number; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: eql.search.Request - -/** - * Returns results matching a query expressed in Event Query Language (EQL) - * - * @see API - * specification - */ -@JsonpDeserializable -public class EqlSearchRequest extends RequestBase implements JsonpSerializable { - @Nullable - private final Boolean allowNoIndices; - - @Nullable - private final Boolean caseSensitive; - - @Nullable - private final String eventCategoryField; - - private final List expandWildcards; - - @Nullable - private final Number fetchSize; - - private final List fields; - - private final List filter; - - @Nullable - private final Boolean ignoreUnavailable; - - private final List index; - - @Nullable - private final Time keepAlive; - - @Nullable - private final Boolean keepOnCompletion; - - private final String query; - - @Nullable - private final ResultPosition resultPosition; - - private final Map runtimeMappings; - - @Nullable - private final Number size; - - @Nullable - private final String tiebreakerField; - - @Nullable - private final String timestampField; - - @Nullable - private final Time waitForCompletionTimeout; - - // --------------------------------------------------------------------------------------------- - - private EqlSearchRequest(Builder builder) { - - this.allowNoIndices = builder.allowNoIndices; - this.caseSensitive = builder.caseSensitive; - this.eventCategoryField = builder.eventCategoryField; - this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); - this.fetchSize = builder.fetchSize; - this.fields = ApiTypeHelper.unmodifiable(builder.fields); - this.filter = ApiTypeHelper.unmodifiable(builder.filter); - this.ignoreUnavailable = builder.ignoreUnavailable; - this.index = ApiTypeHelper.unmodifiableRequired(builder.index, this, "index"); - this.keepAlive = builder.keepAlive; - this.keepOnCompletion = builder.keepOnCompletion; - this.query = ApiTypeHelper.requireNonNull(builder.query, this, "query"); - this.resultPosition = builder.resultPosition; - this.runtimeMappings = ApiTypeHelper.unmodifiable(builder.runtimeMappings); - this.size = builder.size; - this.tiebreakerField = builder.tiebreakerField; - this.timestampField = builder.timestampField; - this.waitForCompletionTimeout = builder.waitForCompletionTimeout; - - } - - public static EqlSearchRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code allow_no_indices} - */ - @Nullable - public final Boolean allowNoIndices() { - return this.allowNoIndices; - } - - /** - * API name: {@code case_sensitive} - */ - @Nullable - public final Boolean caseSensitive() { - return this.caseSensitive; - } - - /** - * Field containing the event classification, such as process, file, or network. - *

- * API name: {@code event_category_field} - */ - @Nullable - public final String eventCategoryField() { - return this.eventCategoryField; - } - - /** - * API name: {@code expand_wildcards} - */ - public final List expandWildcards() { - return this.expandWildcards; - } - - /** - * Maximum number of events to search at a time for sequence queries. - *

- * API name: {@code fetch_size} - */ - @Nullable - public final Number fetchSize() { - return this.fetchSize; - } - - /** - * Array of wildcard (*) patterns. The response returns values for field names - * matching these patterns in the fields property of each hit. - *

- * API name: {@code fields} - */ - public final List fields() { - return this.fields; - } - - /** - * Query, written in Query DSL, used to filter the events on which the EQL query - * runs. - *

- * API name: {@code filter} - */ - public final List filter() { - return this.filter; - } - - /** - * If true, missing or closed indices are not included in the response. - *

- * API name: {@code ignore_unavailable} - */ - @Nullable - public final Boolean ignoreUnavailable() { - return this.ignoreUnavailable; - } - - /** - * Required - The name of the index to scope the operation - *

- * API name: {@code index} - */ - public final List index() { - return this.index; - } - - /** - * API name: {@code keep_alive} - */ - @Nullable - public final Time keepAlive() { - return this.keepAlive; - } - - /** - * API name: {@code keep_on_completion} - */ - @Nullable - public final Boolean keepOnCompletion() { - return this.keepOnCompletion; - } - - /** - * Required - EQL query you wish to run. - *

- * API name: {@code query} - */ - public final String query() { - return this.query; - } - - /** - * API name: {@code result_position} - */ - @Nullable - public final ResultPosition resultPosition() { - return this.resultPosition; - } - - /** - * API name: {@code runtime_mappings} - */ - public final Map runtimeMappings() { - return this.runtimeMappings; - } - - /** - * For basic queries, the maximum number of matching events to return. Defaults - * to 10 - *

- * API name: {@code size} - */ - @Nullable - public final Number size() { - return this.size; - } - - /** - * Field used to sort hits with the same timestamp in ascending order - *

- * API name: {@code tiebreaker_field} - */ - @Nullable - public final String tiebreakerField() { - return this.tiebreakerField; - } - - /** - * Field containing event timestamp. Default "@timestamp" - *

- * API name: {@code timestamp_field} - */ - @Nullable - public final String timestampField() { - return this.timestampField; - } - - /** - * API name: {@code wait_for_completion_timeout} - */ - @Nullable - public final Time waitForCompletionTimeout() { - return this.waitForCompletionTimeout; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.caseSensitive != null) { - generator.writeKey("case_sensitive"); - generator.write(this.caseSensitive); - - } - if (this.eventCategoryField != null) { - generator.writeKey("event_category_field"); - generator.write(this.eventCategoryField); - - } - if (this.fetchSize != null) { - generator.writeKey("fetch_size"); - generator.write(this.fetchSize.doubleValue()); - - } - if (ApiTypeHelper.isDefined(this.fields)) { - generator.writeKey("fields"); - generator.writeStartArray(); - for (FieldAndFormat item0 : this.fields) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.filter)) { - generator.writeKey("filter"); - generator.writeStartArray(); - for (Query item0 : this.filter) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.keepAlive != null) { - generator.writeKey("keep_alive"); - this.keepAlive.serialize(generator, mapper); - - } - if (this.keepOnCompletion != null) { - generator.writeKey("keep_on_completion"); - generator.write(this.keepOnCompletion); - - } - generator.writeKey("query"); - generator.write(this.query); - - if (this.resultPosition != null) { - generator.writeKey("result_position"); - this.resultPosition.serialize(generator, mapper); - } - if (ApiTypeHelper.isDefined(this.runtimeMappings)) { - generator.writeKey("runtime_mappings"); - generator.writeStartObject(); - for (Map.Entry item0 : this.runtimeMappings.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.size != null) { - generator.writeKey("size"); - generator.write(this.size.doubleValue()); - - } - if (this.tiebreakerField != null) { - generator.writeKey("tiebreaker_field"); - generator.write(this.tiebreakerField); - - } - if (this.timestampField != null) { - generator.writeKey("timestamp_field"); - generator.write(this.timestampField); - - } - if (this.waitForCompletionTimeout != null) { - generator.writeKey("wait_for_completion_timeout"); - this.waitForCompletionTimeout.serialize(generator, mapper); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link EqlSearchRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private Boolean allowNoIndices; - - @Nullable - private Boolean caseSensitive; - - @Nullable - private String eventCategoryField; - - @Nullable - private List expandWildcards; - - @Nullable - private Number fetchSize; - - @Nullable - private List fields; - - @Nullable - private List filter; - - @Nullable - private Boolean ignoreUnavailable; - - private List index; - - @Nullable - private Time keepAlive; - - @Nullable - private Boolean keepOnCompletion; - - private String query; - - @Nullable - private ResultPosition resultPosition; - - @Nullable - private Map runtimeMappings; - - @Nullable - private Number size; - - @Nullable - private String tiebreakerField; - - @Nullable - private String timestampField; - - @Nullable - private Time waitForCompletionTimeout; - - /** - * API name: {@code allow_no_indices} - */ - public final Builder allowNoIndices(@Nullable Boolean value) { - this.allowNoIndices = value; - return this; - } - - /** - * API name: {@code case_sensitive} - */ - public final Builder caseSensitive(@Nullable Boolean value) { - this.caseSensitive = value; - return this; - } - - /** - * Field containing the event classification, such as process, file, or network. - *

- * API name: {@code event_category_field} - */ - public final Builder eventCategoryField(@Nullable String value) { - this.eventCategoryField = value; - return this; - } - - /** - * API name: {@code expand_wildcards} - *

- * Adds all elements of list to expandWildcards. - */ - public final Builder expandWildcards(List list) { - this.expandWildcards = _listAddAll(this.expandWildcards, list); - return this; - } - - /** - * API name: {@code expand_wildcards} - *

- * Adds one or more values to expandWildcards. - */ - public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { - this.expandWildcards = _listAdd(this.expandWildcards, value, values); - return this; - } - - /** - * Maximum number of events to search at a time for sequence queries. - *

- * API name: {@code fetch_size} - */ - public final Builder fetchSize(@Nullable Number value) { - this.fetchSize = value; - return this; - } - - /** - * Array of wildcard (*) patterns. The response returns values for field names - * matching these patterns in the fields property of each hit. - *

- * API name: {@code fields} - *

- * Adds all elements of list to fields. - */ - public final Builder fields(List list) { - this.fields = _listAddAll(this.fields, list); - return this; - } - - /** - * Array of wildcard (*) patterns. The response returns values for field names - * matching these patterns in the fields property of each hit. - *

- * API name: {@code fields} - *

- * Adds one or more values to fields. - */ - public final Builder fields(FieldAndFormat value, FieldAndFormat... values) { - this.fields = _listAdd(this.fields, value, values); - return this; - } - - /** - * Array of wildcard (*) patterns. The response returns values for field names - * matching these patterns in the fields property of each hit. - *

- * API name: {@code fields} - *

- * Adds a value to fields using a builder lambda. - */ - public final Builder fields(Function> fn) { - return fields(fn.apply(new FieldAndFormat.Builder()).build()); - } - - /** - * Query, written in Query DSL, used to filter the events on which the EQL query - * runs. - *

- * API name: {@code filter} - *

- * Adds all elements of list to filter. - */ - public final Builder filter(List list) { - this.filter = _listAddAll(this.filter, list); - return this; - } - - /** - * Query, written in Query DSL, used to filter the events on which the EQL query - * runs. - *

- * API name: {@code filter} - *

- * Adds one or more values to filter. - */ - public final Builder filter(Query value, Query... values) { - this.filter = _listAdd(this.filter, value, values); - return this; - } - - /** - * Query, written in Query DSL, used to filter the events on which the EQL query - * runs. - *

- * API name: {@code filter} - *

- * Adds a value to filter using a builder lambda. - */ - public final Builder filter(Function> fn) { - return filter(fn.apply(new Query.Builder()).build()); - } - - /** - * If true, missing or closed indices are not included in the response. - *

- * API name: {@code ignore_unavailable} - */ - public final Builder ignoreUnavailable(@Nullable Boolean value) { - this.ignoreUnavailable = value; - return this; - } - - /** - * Required - The name of the index to scope the operation - *

- * API name: {@code index} - *

- * Adds all elements of list to index. - */ - public final Builder index(List list) { - this.index = _listAddAll(this.index, list); - return this; - } - - /** - * Required - The name of the index to scope the operation - *

- * API name: {@code index} - *

- * Adds one or more values to index. - */ - public final Builder index(String value, String... values) { - this.index = _listAdd(this.index, value, values); - return this; - } - - /** - * API name: {@code keep_alive} - */ - public final Builder keepAlive(@Nullable Time value) { - this.keepAlive = value; - return this; - } - - /** - * API name: {@code keep_alive} - */ - public final Builder keepAlive(Function> fn) { - return this.keepAlive(fn.apply(new Time.Builder()).build()); - } - - /** - * API name: {@code keep_on_completion} - */ - public final Builder keepOnCompletion(@Nullable Boolean value) { - this.keepOnCompletion = value; - return this; - } - - /** - * Required - EQL query you wish to run. - *

- * API name: {@code query} - */ - public final Builder query(String value) { - this.query = value; - return this; - } - - /** - * API name: {@code result_position} - */ - public final Builder resultPosition(@Nullable ResultPosition value) { - this.resultPosition = value; - return this; - } - - /** - * API name: {@code runtime_mappings} - *

- * Adds all entries of map to runtimeMappings. - */ - public final Builder runtimeMappings(Map map) { - this.runtimeMappings = _mapPutAll(this.runtimeMappings, map); - return this; - } - - /** - * API name: {@code runtime_mappings} - *

- * Adds an entry to runtimeMappings. - */ - public final Builder runtimeMappings(String key, RuntimeField value) { - this.runtimeMappings = _mapPut(this.runtimeMappings, key, value); - return this; - } - - /** - * API name: {@code runtime_mappings} - *

- * Adds an entry to runtimeMappings using a builder lambda. - */ - public final Builder runtimeMappings(String key, - Function> fn) { - return runtimeMappings(key, fn.apply(new RuntimeField.Builder()).build()); - } - - /** - * For basic queries, the maximum number of matching events to return. Defaults - * to 10 - *

- * API name: {@code size} - */ - public final Builder size(@Nullable Number value) { - this.size = value; - return this; - } - - /** - * Field used to sort hits with the same timestamp in ascending order - *

- * API name: {@code tiebreaker_field} - */ - public final Builder tiebreakerField(@Nullable String value) { - this.tiebreakerField = value; - return this; - } - - /** - * Field containing event timestamp. Default "@timestamp" - *

- * API name: {@code timestamp_field} - */ - public final Builder timestampField(@Nullable String value) { - this.timestampField = value; - return this; - } - - /** - * API name: {@code wait_for_completion_timeout} - */ - public final Builder waitForCompletionTimeout(@Nullable Time value) { - this.waitForCompletionTimeout = value; - return this; - } - - /** - * API name: {@code wait_for_completion_timeout} - */ - public final Builder waitForCompletionTimeout(Function> fn) { - return this.waitForCompletionTimeout(fn.apply(new Time.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link EqlSearchRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public EqlSearchRequest build() { - _checkSingleUse(); - - return new EqlSearchRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link EqlSearchRequest} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - EqlSearchRequest::setupEqlSearchRequestDeserializer); - - protected static void setupEqlSearchRequestDeserializer(ObjectDeserializer op) { - - op.add(Builder::caseSensitive, JsonpDeserializer.booleanDeserializer(), "case_sensitive"); - op.add(Builder::eventCategoryField, JsonpDeserializer.stringDeserializer(), "event_category_field"); - op.add(Builder::fetchSize, JsonpDeserializer.numberDeserializer(), "fetch_size"); - op.add(Builder::fields, JsonpDeserializer.arrayDeserializer(FieldAndFormat._DESERIALIZER), "fields"); - op.add(Builder::filter, JsonpDeserializer.arrayDeserializer(Query._DESERIALIZER), "filter"); - op.add(Builder::keepAlive, Time._DESERIALIZER, "keep_alive"); - op.add(Builder::keepOnCompletion, JsonpDeserializer.booleanDeserializer(), "keep_on_completion"); - op.add(Builder::query, JsonpDeserializer.stringDeserializer(), "query"); - op.add(Builder::resultPosition, ResultPosition._DESERIALIZER, "result_position"); - op.add(Builder::runtimeMappings, JsonpDeserializer.stringMapDeserializer(RuntimeField._DESERIALIZER), - "runtime_mappings"); - op.add(Builder::size, JsonpDeserializer.numberDeserializer(), "size"); - op.add(Builder::tiebreakerField, JsonpDeserializer.stringDeserializer(), "tiebreaker_field"); - op.add(Builder::timestampField, JsonpDeserializer.stringDeserializer(), "timestamp_field"); - op.add(Builder::waitForCompletionTimeout, Time._DESERIALIZER, "wait_for_completion_timeout"); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code eql.search}". - */ - public static final SimpleEndpoint _ENDPOINT = new SimpleEndpoint<>("es/eql.search", - - // Request method - request -> { - return "POST"; - - }, - - // Request path - request -> { - final int _index = 1 << 0; - - int propsSet = 0; - - propsSet |= _index; - - if (propsSet == (_index)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_eql"); - buf.append("/search"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _index = 1 << 0; - - int propsSet = 0; - - propsSet |= _index; - - if (propsSet == (_index)) { - params.put("index", request.index.stream().map(v -> v).collect(Collectors.joining(","))); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (ApiTypeHelper.isDefined(request.expandWildcards)) { - params.put("expand_wildcards", - request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); - } - if (request.ignoreUnavailable != null) { - params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); - } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } - return params; - - }, SimpleEndpoint.emptyMap(), true, EqlSearchResponse._DESERIALIZER); - - /** - * Create an "{@code eql.search}" endpoint. - */ - public static Endpoint, ErrorResponse> createSearchEndpoint( - JsonpDeserializer tEventDeserializer) { - return _ENDPOINT - .withResponseDeserializer(EqlSearchResponse.createEqlSearchResponseDeserializer(tEventDeserializer)); - } -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/EqlSearchResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/EqlSearchResponse.java deleted file mode 100644 index 0ad7f4b8d..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/EqlSearchResponse.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.eql; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.NamedDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import java.util.function.Supplier; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: eql.search.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class EqlSearchResponse extends EqlSearchResponseBase { - // --------------------------------------------------------------------------------------------- - - private EqlSearchResponse(Builder builder) { - super(builder); - - } - - public static EqlSearchResponse of( - Function, ObjectBuilder>> fn) { - return fn.apply(new Builder<>()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link EqlSearchResponse}. - */ - - public static class Builder extends EqlSearchResponseBase.AbstractBuilder> - implements - ObjectBuilder> { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link EqlSearchResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public EqlSearchResponse build() { - _checkSingleUse(); - - return new EqlSearchResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Create a JSON deserializer for EqlSearchResponse - */ - public static JsonpDeserializer> createEqlSearchResponseDeserializer( - JsonpDeserializer tEventDeserializer) { - return ObjectBuilderDeserializer.createForObject((Supplier>) Builder::new, - op -> EqlSearchResponse.setupEqlSearchResponseDeserializer(op, tEventDeserializer)); - }; - - /** - * Json deserializer for {@link EqlSearchResponse} based on named deserializers - * provided by the calling {@code JsonMapper}. - */ - public static final JsonpDeserializer> _DESERIALIZER = JsonpDeserializer - .lazy(() -> createEqlSearchResponseDeserializer( - new NamedDeserializer<>("co.elastic.clients:Deserializer:eql.search.Response.TEvent"))); - - protected static void setupEqlSearchResponseDeserializer( - ObjectDeserializer> op, JsonpDeserializer tEventDeserializer) { - EqlSearchResponseBase.setupEqlSearchResponseBaseDeserializer(op, tEventDeserializer); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/EqlSearchResponseBase.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/EqlSearchResponseBase.java deleted file mode 100644 index 558bd99fd..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/EqlSearchResponseBase.java +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.eql; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpSerializer; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Long; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: eql._types.EqlSearchResponseBase - -/** - * - * @see API - * specification - */ - -public abstract class EqlSearchResponseBase implements JsonpSerializable { - @Nullable - private final String id; - - @Nullable - private final Boolean isPartial; - - @Nullable - private final Boolean isRunning; - - @Nullable - private final Long took; - - @Nullable - private final Boolean timedOut; - - private final EqlHits hits; - - @Nullable - private final JsonpSerializer tEventSerializer; - - // --------------------------------------------------------------------------------------------- - - protected EqlSearchResponseBase(AbstractBuilder builder) { - - this.id = builder.id; - this.isPartial = builder.isPartial; - this.isRunning = builder.isRunning; - this.took = builder.took; - this.timedOut = builder.timedOut; - this.hits = ApiTypeHelper.requireNonNull(builder.hits, this, "hits"); - this.tEventSerializer = builder.tEventSerializer; - - } - - /** - * Identifier for the search. - *

- * API name: {@code id} - */ - @Nullable - public final String id() { - return this.id; - } - - /** - * If true, the response does not contain complete search results. - *

- * API name: {@code is_partial} - */ - @Nullable - public final Boolean isPartial() { - return this.isPartial; - } - - /** - * If true, the search request is still executing. - *

- * API name: {@code is_running} - */ - @Nullable - public final Boolean isRunning() { - return this.isRunning; - } - - /** - * Milliseconds it took Elasticsearch to execute the request. - *

- * API name: {@code took} - */ - @Nullable - public final Long took() { - return this.took; - } - - /** - * If true, the request timed out before completion. - *

- * API name: {@code timed_out} - */ - @Nullable - public final Boolean timedOut() { - return this.timedOut; - } - - /** - * Required - Contains matching events and sequences. Also contains related - * metadata. - *

- * API name: {@code hits} - */ - public final EqlHits hits() { - return this.hits; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.id != null) { - generator.writeKey("id"); - generator.write(this.id); - - } - if (this.isPartial != null) { - generator.writeKey("is_partial"); - generator.write(this.isPartial); - - } - if (this.isRunning != null) { - generator.writeKey("is_running"); - generator.write(this.isRunning); - - } - if (this.took != null) { - generator.writeKey("took"); - generator.write(this.took); - - } - if (this.timedOut != null) { - generator.writeKey("timed_out"); - generator.write(this.timedOut); - - } - generator.writeKey("hits"); - this.hits.serialize(generator, mapper); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - public abstract static class AbstractBuilder> - extends - WithJsonObjectBuilderBase { - @Nullable - private String id; - - @Nullable - private Boolean isPartial; - - @Nullable - private Boolean isRunning; - - @Nullable - private Long took; - - @Nullable - private Boolean timedOut; - - private EqlHits hits; - - @Nullable - private JsonpSerializer tEventSerializer; - - /** - * Identifier for the search. - *

- * API name: {@code id} - */ - public final BuilderT id(@Nullable String value) { - this.id = value; - return self(); - } - - /** - * If true, the response does not contain complete search results. - *

- * API name: {@code is_partial} - */ - public final BuilderT isPartial(@Nullable Boolean value) { - this.isPartial = value; - return self(); - } - - /** - * If true, the search request is still executing. - *

- * API name: {@code is_running} - */ - public final BuilderT isRunning(@Nullable Boolean value) { - this.isRunning = value; - return self(); - } - - /** - * Milliseconds it took Elasticsearch to execute the request. - *

- * API name: {@code took} - */ - public final BuilderT took(@Nullable Long value) { - this.took = value; - return self(); - } - - /** - * If true, the request timed out before completion. - *

- * API name: {@code timed_out} - */ - public final BuilderT timedOut(@Nullable Boolean value) { - this.timedOut = value; - return self(); - } - - /** - * Required - Contains matching events and sequences. Also contains related - * metadata. - *

- * API name: {@code hits} - */ - public final BuilderT hits(EqlHits value) { - this.hits = value; - return self(); - } - - /** - * Required - Contains matching events and sequences. Also contains related - * metadata. - *

- * API name: {@code hits} - */ - public final BuilderT hits(Function, ObjectBuilder>> fn) { - return this.hits(fn.apply(new EqlHits.Builder()).build()); - } - - /** - * Serializer for TEvent. If not set, an attempt will be made to find a - * serializer from the JSON context. - */ - public final BuilderT tEventSerializer(@Nullable JsonpSerializer value) { - this.tEventSerializer = value; - return self(); - } - - protected abstract BuilderT self(); - - } - - // --------------------------------------------------------------------------------------------- - protected static > void setupEqlSearchResponseBaseDeserializer( - ObjectDeserializer op, JsonpDeserializer tEventDeserializer) { - - op.add(AbstractBuilder::id, JsonpDeserializer.stringDeserializer(), "id"); - op.add(AbstractBuilder::isPartial, JsonpDeserializer.booleanDeserializer(), "is_partial"); - op.add(AbstractBuilder::isRunning, JsonpDeserializer.booleanDeserializer(), "is_running"); - op.add(AbstractBuilder::took, JsonpDeserializer.longDeserializer(), "took"); - op.add(AbstractBuilder::timedOut, JsonpDeserializer.booleanDeserializer(), "timed_out"); - op.add(AbstractBuilder::hits, EqlHits.createEqlHitsDeserializer(tEventDeserializer), "hits"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/GetEqlStatusRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/GetEqlStatusRequest.java deleted file mode 100644 index 2d6aeec92..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/GetEqlStatusRequest.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.eql; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: eql.get_status.Request - -/** - * Returns the current status for an async EQL search or a stored synchronous - * EQL search without returning results. - * - * @see API - * specification - */ - -public class GetEqlStatusRequest extends RequestBase { - private final String id; - - // --------------------------------------------------------------------------------------------- - - private GetEqlStatusRequest(Builder builder) { - - this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); - - } - - public static GetEqlStatusRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Identifier for the search. - *

- * API name: {@code id} - */ - public final String id() { - return this.id; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GetEqlStatusRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - private String id; - - /** - * Required - Identifier for the search. - *

- * API name: {@code id} - */ - public final Builder id(String value) { - this.id = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link GetEqlStatusRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GetEqlStatusRequest build() { - _checkSingleUse(); - - return new GetEqlStatusRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code eql.get_status}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/eql.get_status", - - // Request method - request -> { - return "GET"; - - }, - - // Request path - request -> { - final int _id = 1 << 0; - - int propsSet = 0; - - propsSet |= _id; - - if (propsSet == (_id)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_eql"); - buf.append("/search"); - buf.append("/status"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.id, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _id = 1 << 0; - - int propsSet = 0; - - propsSet |= _id; - - if (propsSet == (_id)) { - params.put("id", request.id); - } - return params; - }, - - // Request parameters - request -> { - return Collections.emptyMap(); - - }, SimpleEndpoint.emptyMap(), false, GetEqlStatusResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/GetEqlStatusResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/GetEqlStatusResponse.java deleted file mode 100644 index 470814175..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/GetEqlStatusResponse.java +++ /dev/null @@ -1,332 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.eql; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Integer; -import java.lang.Long; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: eql.get_status.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class GetEqlStatusResponse implements JsonpSerializable { - private final String id; - - private final boolean isPartial; - - private final boolean isRunning; - - @Nullable - private final Long startTimeInMillis; - - @Nullable - private final Long expirationTimeInMillis; - - @Nullable - private final Integer completionStatus; - - // --------------------------------------------------------------------------------------------- - - private GetEqlStatusResponse(Builder builder) { - - this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); - this.isPartial = ApiTypeHelper.requireNonNull(builder.isPartial, this, "isPartial"); - this.isRunning = ApiTypeHelper.requireNonNull(builder.isRunning, this, "isRunning"); - this.startTimeInMillis = builder.startTimeInMillis; - this.expirationTimeInMillis = builder.expirationTimeInMillis; - this.completionStatus = builder.completionStatus; - - } - - public static GetEqlStatusResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Identifier for the search. - *

- * API name: {@code id} - */ - public final String id() { - return this.id; - } - - /** - * Required - If true, the search request is still executing. If false, the - * search is completed. - *

- * API name: {@code is_partial} - */ - public final boolean isPartial() { - return this.isPartial; - } - - /** - * Required - 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. - *

- * API name: {@code is_running} - */ - public final boolean isRunning() { - return this.isRunning; - } - - /** - * For a running search shows a timestamp when the eql search started, in - * milliseconds since the Unix epoch. - *

- * API name: {@code start_time_in_millis} - */ - @Nullable - public final Long startTimeInMillis() { - return this.startTimeInMillis; - } - - /** - * 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. - *

- * API name: {@code expiration_time_in_millis} - */ - @Nullable - public final Long expirationTimeInMillis() { - return this.expirationTimeInMillis; - } - - /** - * For a completed search shows the http status code of the completed search. - *

- * API name: {@code completion_status} - */ - @Nullable - public final Integer completionStatus() { - return this.completionStatus; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("id"); - generator.write(this.id); - - generator.writeKey("is_partial"); - generator.write(this.isPartial); - - generator.writeKey("is_running"); - generator.write(this.isRunning); - - if (this.startTimeInMillis != null) { - generator.writeKey("start_time_in_millis"); - generator.write(this.startTimeInMillis); - - } - if (this.expirationTimeInMillis != null) { - generator.writeKey("expiration_time_in_millis"); - generator.write(this.expirationTimeInMillis); - - } - if (this.completionStatus != null) { - generator.writeKey("completion_status"); - generator.write(this.completionStatus); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GetEqlStatusResponse}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private String id; - - private Boolean isPartial; - - private Boolean isRunning; - - @Nullable - private Long startTimeInMillis; - - @Nullable - private Long expirationTimeInMillis; - - @Nullable - private Integer completionStatus; - - /** - * Required - Identifier for the search. - *

- * API name: {@code id} - */ - public final Builder id(String value) { - this.id = value; - return this; - } - - /** - * Required - If true, the search request is still executing. If false, the - * search is completed. - *

- * API name: {@code is_partial} - */ - public final Builder isPartial(boolean value) { - this.isPartial = value; - return this; - } - - /** - * Required - 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. - *

- * API name: {@code is_running} - */ - public final Builder isRunning(boolean value) { - this.isRunning = value; - return this; - } - - /** - * For a running search shows a timestamp when the eql search started, in - * milliseconds since the Unix epoch. - *

- * API name: {@code start_time_in_millis} - */ - public final Builder startTimeInMillis(@Nullable Long value) { - this.startTimeInMillis = value; - return this; - } - - /** - * 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. - *

- * API name: {@code expiration_time_in_millis} - */ - public final Builder expirationTimeInMillis(@Nullable Long value) { - this.expirationTimeInMillis = value; - return this; - } - - /** - * For a completed search shows the http status code of the completed search. - *

- * API name: {@code completion_status} - */ - public final Builder completionStatus(@Nullable Integer value) { - this.completionStatus = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link GetEqlStatusResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GetEqlStatusResponse build() { - _checkSingleUse(); - - return new GetEqlStatusResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link GetEqlStatusResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, GetEqlStatusResponse::setupGetEqlStatusResponseDeserializer); - - protected static void setupGetEqlStatusResponseDeserializer(ObjectDeserializer op) { - - op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); - op.add(Builder::isPartial, JsonpDeserializer.booleanDeserializer(), "is_partial"); - op.add(Builder::isRunning, JsonpDeserializer.booleanDeserializer(), "is_running"); - op.add(Builder::startTimeInMillis, JsonpDeserializer.longDeserializer(), "start_time_in_millis"); - op.add(Builder::expirationTimeInMillis, JsonpDeserializer.longDeserializer(), "expiration_time_in_millis"); - op.add(Builder::completionStatus, JsonpDeserializer.integerDeserializer(), "completion_status"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/HitsEvent.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/HitsEvent.java deleted file mode 100644 index cc2b5bf01..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/HitsEvent.java +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.eql; - -import co.elastic.clients.json.JsonData; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpSerializer; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.NamedDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.function.Supplier; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: eql._types.HitsEvent - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class HitsEvent implements JsonpSerializable { - private final String index; - - private final String id; - - private final TEvent source; - - @Nullable - private final Boolean missing; - - private final Map> fields; - - @Nullable - private final JsonpSerializer tEventSerializer; - - // --------------------------------------------------------------------------------------------- - - private HitsEvent(Builder builder) { - - this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); - this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); - this.source = ApiTypeHelper.requireNonNull(builder.source, this, "source"); - this.missing = builder.missing; - this.fields = ApiTypeHelper.unmodifiable(builder.fields); - this.tEventSerializer = builder.tEventSerializer; - - } - - public static HitsEvent of(Function, ObjectBuilder>> fn) { - return fn.apply(new Builder<>()).build(); - } - - /** - * Required - Name of the index containing the event. - *

- * API name: {@code _index} - */ - public final String index() { - return this.index; - } - - /** - * Required - Unique identifier for the event. This ID is only unique within the - * index. - *

- * API name: {@code _id} - */ - public final String id() { - return this.id; - } - - /** - * Required - Original JSON body passed for the event at index time. - *

- * API name: {@code _source} - */ - public final TEvent source() { - return this.source; - } - - /** - * Set to true for events in a timespan-constrained sequence that - * do not meet a given condition. - *

- * API name: {@code missing} - */ - @Nullable - public final Boolean missing() { - return this.missing; - } - - /** - * API name: {@code fields} - */ - public final Map> fields() { - return this.fields; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("_index"); - generator.write(this.index); - - generator.writeKey("_id"); - generator.write(this.id); - - generator.writeKey("_source"); - JsonpUtils.serialize(this.source, generator, tEventSerializer, mapper); - - if (this.missing != null) { - generator.writeKey("missing"); - generator.write(this.missing); - - } - if (ApiTypeHelper.isDefined(this.fields)) { - generator.writeKey("fields"); - generator.writeStartObject(); - for (Map.Entry> item0 : this.fields.entrySet()) { - generator.writeKey(item0.getKey()); - generator.writeStartArray(); - if (item0.getValue() != null) { - for (JsonData item1 : item0.getValue()) { - item1.serialize(generator, mapper); - - } - } - generator.writeEnd(); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link HitsEvent}. - */ - - public static class Builder extends WithJsonObjectBuilderBase> - implements - ObjectBuilder> { - private String index; - - private String id; - - private TEvent source; - - @Nullable - private Boolean missing; - - @Nullable - private Map> fields; - - @Nullable - private JsonpSerializer tEventSerializer; - - /** - * Required - Name of the index containing the event. - *

- * API name: {@code _index} - */ - public final Builder index(String value) { - this.index = value; - return this; - } - - /** - * Required - Unique identifier for the event. This ID is only unique within the - * index. - *

- * API name: {@code _id} - */ - public final Builder id(String value) { - this.id = value; - return this; - } - - /** - * Required - Original JSON body passed for the event at index time. - *

- * API name: {@code _source} - */ - public final Builder source(TEvent value) { - this.source = value; - return this; - } - - /** - * Set to true for events in a timespan-constrained sequence that - * do not meet a given condition. - *

- * API name: {@code missing} - */ - public final Builder missing(@Nullable Boolean value) { - this.missing = value; - return this; - } - - /** - * API name: {@code fields} - *

- * Adds all entries of map to fields. - */ - public final Builder fields(Map> map) { - this.fields = _mapPutAll(this.fields, map); - return this; - } - - /** - * API name: {@code fields} - *

- * Adds an entry to fields. - */ - public final Builder fields(String key, List value) { - this.fields = _mapPut(this.fields, key, value); - return this; - } - - /** - * Serializer for TEvent. If not set, an attempt will be made to find a - * serializer from the JSON context. - */ - public final Builder tEventSerializer(@Nullable JsonpSerializer value) { - this.tEventSerializer = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link HitsEvent}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public HitsEvent build() { - _checkSingleUse(); - - return new HitsEvent(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Create a JSON deserializer for HitsEvent - */ - public static JsonpDeserializer> createHitsEventDeserializer( - JsonpDeserializer tEventDeserializer) { - return ObjectBuilderDeserializer.createForObject((Supplier>) Builder::new, - op -> HitsEvent.setupHitsEventDeserializer(op, tEventDeserializer)); - }; - - /** - * Json deserializer for {@link HitsEvent} based on named deserializers provided - * by the calling {@code JsonMapper}. - */ - public static final JsonpDeserializer> _DESERIALIZER = JsonpDeserializer - .lazy(() -> createHitsEventDeserializer( - new NamedDeserializer<>("co.elastic.clients:Deserializer:eql._types.HitsEvent.TEvent"))); - - protected static void setupHitsEventDeserializer(ObjectDeserializer> op, - JsonpDeserializer tEventDeserializer) { - - op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "_index"); - op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "_id"); - op.add(Builder::source, tEventDeserializer, "_source"); - op.add(Builder::missing, JsonpDeserializer.booleanDeserializer(), "missing"); - op.add(Builder::fields, - JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.arrayDeserializer(JsonData._DESERIALIZER)), - "fields"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/HitsSequence.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/HitsSequence.java deleted file mode 100644 index a5fc9e355..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/HitsSequence.java +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.eql; - -import co.elastic.clients.json.JsonData; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpSerializer; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.NamedDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import java.util.function.Supplier; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: eql._types.HitsSequence - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class HitsSequence implements JsonpSerializable { - private final List> events; - - private final List joinKeys; - - @Nullable - private final JsonpSerializer tEventSerializer; - - // --------------------------------------------------------------------------------------------- - - private HitsSequence(Builder builder) { - - this.events = ApiTypeHelper.unmodifiableRequired(builder.events, this, "events"); - this.joinKeys = ApiTypeHelper.unmodifiable(builder.joinKeys); - this.tEventSerializer = builder.tEventSerializer; - - } - - public static HitsSequence of(Function, ObjectBuilder>> fn) { - return fn.apply(new Builder<>()).build(); - } - - /** - * Required - Contains events matching the query. Each object represents a - * matching event. - *

- * API name: {@code events} - */ - public final List> events() { - return this.events; - } - - /** - * Shared field values used to constrain matches in the sequence. These are - * defined using the by keyword in the EQL query syntax. - *

- * API name: {@code join_keys} - */ - public final List joinKeys() { - return this.joinKeys; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.events)) { - generator.writeKey("events"); - generator.writeStartArray(); - for (HitsEvent item0 : this.events) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.joinKeys)) { - generator.writeKey("join_keys"); - generator.writeStartArray(); - for (JsonData item0 : this.joinKeys) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link HitsSequence}. - */ - - public static class Builder extends WithJsonObjectBuilderBase> - implements - ObjectBuilder> { - private List> events; - - @Nullable - private List joinKeys; - - @Nullable - private JsonpSerializer tEventSerializer; - - /** - * Required - Contains events matching the query. Each object represents a - * matching event. - *

- * API name: {@code events} - *

- * Adds all elements of list to events. - */ - public final Builder events(List> list) { - this.events = _listAddAll(this.events, list); - return this; - } - - /** - * Required - Contains events matching the query. Each object represents a - * matching event. - *

- * API name: {@code events} - *

- * Adds one or more values to events. - */ - public final Builder events(HitsEvent value, HitsEvent... values) { - this.events = _listAdd(this.events, value, values); - return this; - } - - /** - * Required - Contains events matching the query. Each object represents a - * matching event. - *

- * API name: {@code events} - *

- * Adds a value to events using a builder lambda. - */ - public final Builder events(Function, ObjectBuilder>> fn) { - return events(fn.apply(new HitsEvent.Builder()).build()); - } - - /** - * Shared field values used to constrain matches in the sequence. These are - * defined using the by keyword in the EQL query syntax. - *

- * API name: {@code join_keys} - *

- * Adds all elements of list to joinKeys. - */ - public final Builder joinKeys(List list) { - this.joinKeys = _listAddAll(this.joinKeys, list); - return this; - } - - /** - * Shared field values used to constrain matches in the sequence. These are - * defined using the by keyword in the EQL query syntax. - *

- * API name: {@code join_keys} - *

- * Adds one or more values to joinKeys. - */ - public final Builder joinKeys(JsonData value, JsonData... values) { - this.joinKeys = _listAdd(this.joinKeys, value, values); - return this; - } - - /** - * Serializer for TEvent. If not set, an attempt will be made to find a - * serializer from the JSON context. - */ - public final Builder tEventSerializer(@Nullable JsonpSerializer value) { - this.tEventSerializer = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link HitsSequence}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public HitsSequence build() { - _checkSingleUse(); - - return new HitsSequence(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Create a JSON deserializer for HitsSequence - */ - public static JsonpDeserializer> createHitsSequenceDeserializer( - JsonpDeserializer tEventDeserializer) { - return ObjectBuilderDeserializer.createForObject((Supplier>) Builder::new, - op -> HitsSequence.setupHitsSequenceDeserializer(op, tEventDeserializer)); - }; - - /** - * Json deserializer for {@link HitsSequence} based on named deserializers - * provided by the calling {@code JsonMapper}. - */ - public static final JsonpDeserializer> _DESERIALIZER = JsonpDeserializer - .lazy(() -> createHitsSequenceDeserializer( - new NamedDeserializer<>("co.elastic.clients:Deserializer:eql._types.HitsSequence.TEvent"))); - - protected static void setupHitsSequenceDeserializer(ObjectDeserializer> op, - JsonpDeserializer tEventDeserializer) { - - op.add(Builder::events, - JsonpDeserializer.arrayDeserializer(HitsEvent.createHitsEventDeserializer(tEventDeserializer)), - "events"); - op.add(Builder::joinKeys, JsonpDeserializer.arrayDeserializer(JsonData._DESERIALIZER), "join_keys"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/search/ResultPosition.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/search/ResultPosition.java deleted file mode 100644 index c67531c4e..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/eql/search/ResultPosition.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.eql.search; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum ResultPosition implements JsonEnum { - /** - * Return the most recent matches, similar to the Unix tail command. - */ - Tail("tail"), - - /** - * Return the earliest matches, similar to the Unix head command. - */ - Head("head"), - - ; - - private final String jsonValue; - - ResultPosition(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - ResultPosition.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/esql/ElasticsearchEsqlAsyncClient.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/esql/ElasticsearchEsqlAsyncClient.java deleted file mode 100644 index dac958485..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/esql/ElasticsearchEsqlAsyncClient.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.esql; - -import co.elastic.clients.ApiClient; -import co.elastic.clients.elasticsearch._helpers.esql.EsqlAdapter; -import co.elastic.clients.elasticsearch._helpers.esql.EsqlHelper; -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.transport.ElasticsearchTransport; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.JsonEndpoint; -import co.elastic.clients.transport.Transport; -import co.elastic.clients.transport.TransportOptions; -import co.elastic.clients.transport.endpoints.BinaryResponse; -import co.elastic.clients.util.ObjectBuilder; -import java.util.concurrent.CompletableFuture; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Client for the esql namespace. - */ -public class ElasticsearchEsqlAsyncClient extends ApiClient { - - public ElasticsearchEsqlAsyncClient(ElasticsearchTransport transport) { - super(transport, null); - } - - public ElasticsearchEsqlAsyncClient(ElasticsearchTransport transport, @Nullable TransportOptions transportOptions) { - super(transport, transportOptions); - } - - @Override - public ElasticsearchEsqlAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) { - return new ElasticsearchEsqlAsyncClient(this.transport, transportOptions); - } - - // ----- Endpoint: esql.query - - /** - * Executes an ES|QL request - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture query(QueryRequest request) { - @SuppressWarnings("unchecked") - Endpoint endpoint = (Endpoint) QueryRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Executes an ES|QL request - * - * @param fn - * a function that initializes a builder to create the - * {@link QueryRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture query( - Function> fn) { - return query(fn.apply(new QueryRequest.Builder()).build()); - } - - /** - * Executes an ES|QL request and adapts its result to a target type. - * - * @param adapter - * the ES|QL response adapter - * @param query - * the ES|QL query - * @param parameters - * values for query parameters, if any - */ - public final CompletableFuture query(EsqlAdapter adapter, String query, Object... parameters) { - return EsqlHelper.queryAsync(this, adapter, query, parameters); - } - - /** - * Executes an ES|QL request and adapts its result to a target type. - * - * @param adapter - * the ES|QL response adapter - * @param request - * the ES|QL request - */ - public final CompletableFuture query(EsqlAdapter adapter, QueryRequest request) { - return EsqlHelper.queryAsync(this, adapter, request); - } - - /** - * Executes an ES|QL request and adapts its result to a target type. - * - * @param adapter - * the ES|QL response adapter - * @param fn - * the ES|QL request builder - */ - public final CompletableFuture query(EsqlAdapter adapter, - Function> fn) { - return EsqlHelper.queryAsync(this, adapter, fn.apply(new QueryRequest.Builder()).build()); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/esql/ElasticsearchEsqlClient.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/esql/ElasticsearchEsqlClient.java deleted file mode 100644 index 434231f81..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/esql/ElasticsearchEsqlClient.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.esql; - -import co.elastic.clients.ApiClient; -import co.elastic.clients.elasticsearch._helpers.esql.EsqlAdapter; -import co.elastic.clients.elasticsearch._helpers.esql.EsqlHelper; -import co.elastic.clients.elasticsearch._types.ElasticsearchException; -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.transport.ElasticsearchTransport; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.JsonEndpoint; -import co.elastic.clients.transport.Transport; -import co.elastic.clients.transport.TransportOptions; -import co.elastic.clients.transport.endpoints.BinaryResponse; -import co.elastic.clients.util.ObjectBuilder; -import java.io.IOException; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Client for the esql namespace. - */ -public class ElasticsearchEsqlClient extends ApiClient { - - public ElasticsearchEsqlClient(ElasticsearchTransport transport) { - super(transport, null); - } - - public ElasticsearchEsqlClient(ElasticsearchTransport transport, @Nullable TransportOptions transportOptions) { - super(transport, transportOptions); - } - - @Override - public ElasticsearchEsqlClient withTransportOptions(@Nullable TransportOptions transportOptions) { - return new ElasticsearchEsqlClient(this.transport, transportOptions); - } - - // ----- Endpoint: esql.query - - /** - * Executes an ES|QL request - * - * @see Documentation - * on elastic.co - */ - - public BinaryResponse query(QueryRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - Endpoint endpoint = (Endpoint) QueryRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Executes an ES|QL request - * - * @param fn - * a function that initializes a builder to create the - * {@link QueryRequest} - * @see Documentation - * on elastic.co - */ - - public final BinaryResponse query(Function> fn) - throws IOException, ElasticsearchException { - return query(fn.apply(new QueryRequest.Builder()).build()); - } - - /** - * Executes an ES|QL request and adapts its result to a target type. - * - * @param adapter - * the ES|QL response adapter - * @param query - * the ES|QL query - * @param parameters - * values for query parameters, if any - */ - public final T query(EsqlAdapter adapter, String query, Object... parameters) - throws IOException, ElasticsearchException { - return EsqlHelper.query(this, adapter, query, parameters); - } - - /** - * Executes an ES|QL request and adapts its result to a target type. - * - * @param adapter - * the ES|QL response adapter - * @param request - * the ES|QL request - */ - public final T query(EsqlAdapter adapter, QueryRequest request) throws IOException, ElasticsearchException { - return EsqlHelper.query(this, adapter, request); - } - - /** - * Executes an ES|QL request and adapts its result to a target type. - * - * @param adapter - * the ES|QL response adapter - * @param fn - * the ES|QL request builder - */ - public final T query(EsqlAdapter adapter, Function> fn) - throws IOException, ElasticsearchException { - return query(adapter, fn.apply(new QueryRequest.Builder()).build()); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/esql/QueryRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/esql/QueryRequest.java deleted file mode 100644 index f9c7e3bf4..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/esql/QueryRequest.java +++ /dev/null @@ -1,659 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.esql; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.FieldValue; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.query_dsl.Query; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.BinaryEndpoint; -import co.elastic.clients.transport.endpoints.BinaryResponse; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: esql.query.Request - -/** - * Executes an ES|QL request - * - * @see API - * specification - */ -@JsonpDeserializable -public class QueryRequest extends RequestBase implements JsonpSerializable { - @Nullable - private final Boolean columnar; - - @Nullable - private final String delimiter; - - @Nullable - private final Boolean dropNullColumns; - - @Nullable - private final Query filter; - - @Nullable - private final String format; - - @Nullable - private final String locale; - - private final List params; - - @Nullable - private final Boolean profile; - - private final String query; - - private final Map> tables; - - // --------------------------------------------------------------------------------------------- - - private QueryRequest(Builder builder) { - - this.columnar = builder.columnar; - this.delimiter = builder.delimiter; - this.dropNullColumns = builder.dropNullColumns; - this.filter = builder.filter; - this.format = builder.format; - this.locale = builder.locale; - this.params = ApiTypeHelper.unmodifiable(builder.params); - this.profile = builder.profile; - this.query = ApiTypeHelper.requireNonNull(builder.query, this, "query"); - this.tables = ApiTypeHelper.unmodifiable(builder.tables); - - } - - public static QueryRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code columnar} - */ - @Nullable - public final Boolean columnar() { - return this.columnar; - } - - /** - * The character to use between values within a CSV row. Only valid for the CSV - * format. - *

- * API name: {@code delimiter} - */ - @Nullable - public final String delimiter() { - return this.delimiter; - } - - /** - * 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. - *

- * API name: {@code drop_null_columns} - */ - @Nullable - public final Boolean dropNullColumns() { - return this.dropNullColumns; - } - - /** - * Specify a Query DSL query in the filter parameter to filter the set of - * documents that an ES|QL query runs on. - *

- * API name: {@code filter} - */ - @Nullable - public final Query filter() { - return this.filter; - } - - /** - * A short version of the Accept header, e.g. json, yaml. - *

- * API name: {@code format} - */ - @Nullable - public final String format() { - return this.format; - } - - /** - * API name: {@code locale} - */ - @Nullable - public final String locale() { - return this.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. - *

- * API name: {@code params} - */ - public final List params() { - return this.params; - } - - /** - * If provided and true the response will include an extra - * profile object with information on how the query was executed. - * This information is for human debugging and its format can change at any time - * but it can give some insight into the performance of each part of the query. - *

- * API name: {@code profile} - */ - @Nullable - public final Boolean profile() { - return this.profile; - } - - /** - * Required - The ES|QL query API accepts an ES|QL query string in the query - * parameter, runs it, and returns the results. - *

- * API name: {@code query} - */ - public final String query() { - return this.query; - } - - /** - * Tables to use with the LOOKUP operation. The top level key is the table name - * and the next level key is the column name. - *

- * API name: {@code tables} - */ - public final Map> tables() { - return this.tables; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.columnar != null) { - generator.writeKey("columnar"); - generator.write(this.columnar); - - } - if (this.filter != null) { - generator.writeKey("filter"); - this.filter.serialize(generator, mapper); - - } - if (this.locale != null) { - generator.writeKey("locale"); - generator.write(this.locale); - - } - if (ApiTypeHelper.isDefined(this.params)) { - generator.writeKey("params"); - generator.writeStartArray(); - for (FieldValue item0 : this.params) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.profile != null) { - generator.writeKey("profile"); - generator.write(this.profile); - - } - generator.writeKey("query"); - generator.write(this.query); - - if (ApiTypeHelper.isDefined(this.tables)) { - generator.writeKey("tables"); - generator.writeStartObject(); - for (Map.Entry> item0 : this.tables.entrySet()) { - generator.writeKey(item0.getKey()); - generator.writeStartObject(); - if (item0.getValue() != null) { - for (Map.Entry item1 : item0.getValue().entrySet()) { - generator.writeKey(item1.getKey()); - item1.getValue().serialize(generator, mapper); - - } - } - generator.writeEnd(); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link QueryRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { - @Nullable - private Boolean columnar; - - @Nullable - private String delimiter; - - @Nullable - private Boolean dropNullColumns; - - @Nullable - private Query filter; - - @Nullable - private String format; - - @Nullable - private String locale; - - @Nullable - private List params; - - @Nullable - private Boolean profile; - - private String query; - - @Nullable - private Map> tables; - - /** - * 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. - *

- * API name: {@code columnar} - */ - public final Builder columnar(@Nullable Boolean value) { - this.columnar = value; - return this; - } - - /** - * The character to use between values within a CSV row. Only valid for the CSV - * format. - *

- * API name: {@code delimiter} - */ - public final Builder delimiter(@Nullable String value) { - this.delimiter = value; - return this; - } - - /** - * 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. - *

- * API name: {@code drop_null_columns} - */ - public final Builder dropNullColumns(@Nullable Boolean value) { - this.dropNullColumns = 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. - *

- * API name: {@code filter} - */ - public final Builder filter(@Nullable Query value) { - this.filter = 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. - *

- * API name: {@code filter} - */ - public final Builder filter(Function> fn) { - return this.filter(fn.apply(new Query.Builder()).build()); - } - - /** - * A short version of the Accept header, e.g. json, yaml. - *

- * API name: {@code format} - */ - public final Builder format(@Nullable String value) { - this.format = value; - return this; - } - - /** - * API name: {@code locale} - */ - public final Builder locale(@Nullable String value) { - this.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. - *

- * API name: {@code params} - *

- * Adds all elements of list to params. - */ - public final Builder params(List list) { - this.params = _listAddAll(this.params, list); - 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. - *

- * API name: {@code params} - *

- * Adds one or more values to params. - */ - public final Builder params(FieldValue value, FieldValue... values) { - this.params = _listAdd(this.params, value, values); - 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. - *

- * API name: {@code params} - *

- * Adds all passed values to params. - */ - public final Builder params(String value, String... values) { - this.params = _listAdd(this.params, FieldValue.of(value)); - List fieldValues = new ArrayList<>(); - for (String v : values) { - fieldValues.add(FieldValue.of(v)); - } - this.params = _listAddAll(this.params, fieldValues); - 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. - *

- * API name: {@code params} - *

- * Adds all passed values to params. - */ - public final Builder params(long value, long... values) { - this.params = _listAdd(this.params, FieldValue.of(value)); - List fieldValues = new ArrayList<>(); - for (long v : values) { - fieldValues.add(FieldValue.of(v)); - } - this.params = _listAddAll(this.params, fieldValues); - 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. - *

- * API name: {@code params} - *

- * Adds all passed values to params. - */ - public final Builder params(double value, double... values) { - this.params = _listAdd(this.params, FieldValue.of(value)); - List fieldValues = new ArrayList<>(); - for (double v : values) { - fieldValues.add(FieldValue.of(v)); - } - this.params = _listAddAll(this.params, fieldValues); - 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. - *

- * API name: {@code params} - *

- * Adds all passed values to params. - */ - public final Builder params(boolean value, boolean... values) { - this.params = _listAdd(this.params, FieldValue.of(value)); - List fieldValues = new ArrayList<>(); - for (boolean v : values) { - fieldValues.add(FieldValue.of(v)); - } - this.params = _listAddAll(this.params, fieldValues); - 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. - *

- * API name: {@code params} - *

- * Adds a value to params using a builder lambda. - */ - public final Builder params(Function> fn) { - return params(fn.apply(new FieldValue.Builder()).build()); - } - - /** - * If provided and true the response will include an extra - * profile object with information on how the query was executed. - * This information is for human debugging and its format can change at any time - * but it can give some insight into the performance of each part of the query. - *

- * API name: {@code profile} - */ - public final Builder profile(@Nullable Boolean value) { - this.profile = value; - return this; - } - - /** - * Required - The ES|QL query API accepts an ES|QL query string in the query - * parameter, runs it, and returns the results. - *

- * API name: {@code query} - */ - public final Builder query(String value) { - this.query = value; - return this; - } - - /** - * Tables to use with the LOOKUP operation. The top level key is the table name - * and the next level key is the column name. - *

- * API name: {@code tables} - *

- * Adds all entries of map to tables. - */ - public final Builder tables(Map> map) { - this.tables = _mapPutAll(this.tables, map); - return this; - } - - /** - * Tables to use with the LOOKUP operation. The top level key is the table name - * and the next level key is the column name. - *

- * API name: {@code tables} - *

- * Adds an entry to tables. - */ - public final Builder tables(String key, Map value) { - this.tables = _mapPut(this.tables, key, value); - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link QueryRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public QueryRequest build() { - _checkSingleUse(); - - return new QueryRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link QueryRequest} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - QueryRequest::setupQueryRequestDeserializer); - - protected static void setupQueryRequestDeserializer(ObjectDeserializer op) { - - op.add(Builder::columnar, JsonpDeserializer.booleanDeserializer(), "columnar"); - op.add(Builder::filter, Query._DESERIALIZER, "filter"); - op.add(Builder::locale, JsonpDeserializer.stringDeserializer(), "locale"); - op.add(Builder::params, JsonpDeserializer.arrayDeserializer(FieldValue._DESERIALIZER), "params"); - op.add(Builder::profile, JsonpDeserializer.booleanDeserializer(), "profile"); - op.add(Builder::query, JsonpDeserializer.stringDeserializer(), "query"); - op.add(Builder::tables, JsonpDeserializer - .stringMapDeserializer(JsonpDeserializer.stringMapDeserializer(TableValues._DESERIALIZER)), "tables"); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code esql.query}". - */ - public static final Endpoint _ENDPOINT = new BinaryEndpoint<>( - "es/esql.query", - - // Request method - request -> { - return "POST"; - - }, - - // Request path - request -> { - return "/_query"; - - }, - - // Path parameters - request -> { - return Collections.emptyMap(); - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.delimiter != null) { - params.put("delimiter", request.delimiter); - } - if (request.format != null) { - params.put("format", request.format); - } - if (request.dropNullColumns != null) { - params.put("drop_null_columns", String.valueOf(request.dropNullColumns)); - } - return params; - - }, SimpleEndpoint.emptyMap(), true, null); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/esql/TableValues.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/esql/TableValues.java deleted file mode 100644 index 78c10bca9..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/esql/TableValues.java +++ /dev/null @@ -1,343 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.esql; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.TaggedUnion; -import co.elastic.clients.util.TaggedUnionUtils; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Double; -import java.lang.Integer; -import java.lang.Long; -import java.lang.Object; -import java.lang.String; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: esql._types.TableValuesContainer - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class TableValues implements TaggedUnion, JsonpSerializable { - - /** - * {@link TableValues} variant kinds. - * - * @see API - * specification - */ - - public enum Kind implements JsonEnum { - Integer("integer"), - - Keyword("keyword"), - - Long("long"), - - Double("double"), - - ; - - private final String jsonValue; - - Kind(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - } - - private final Kind _kind; - private final Object _value; - - @Override - public final Kind _kind() { - return _kind; - } - - @Override - public final Object _get() { - return _value; - } - - public TableValues(TableValuesVariant value) { - - this._kind = ApiTypeHelper.requireNonNull(value._tableValuesKind(), this, ""); - this._value = ApiTypeHelper.requireNonNull(value, this, ""); - - } - - private TableValues(Builder builder) { - - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - - } - - public static TableValues of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Is this variant instance of kind {@code integer}? - */ - public boolean isInteger() { - return _kind == Kind.Integer; - } - - /** - * Get the {@code integer} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code integer} kind. - */ - public List> integer() { - return TaggedUnionUtils.get(this, Kind.Integer); - } - - /** - * Is this variant instance of kind {@code keyword}? - */ - public boolean isKeyword() { - return _kind == Kind.Keyword; - } - - /** - * Get the {@code keyword} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code keyword} kind. - */ - public List> keyword() { - return TaggedUnionUtils.get(this, Kind.Keyword); - } - - /** - * Is this variant instance of kind {@code long}? - */ - public boolean isLong() { - return _kind == Kind.Long; - } - - /** - * Get the {@code long} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code long} kind. - */ - public List> long_() { - return TaggedUnionUtils.get(this, Kind.Long); - } - - /** - * Is this variant instance of kind {@code double}? - */ - public boolean isDouble() { - return _kind == Kind.Double; - } - - /** - * Get the {@code double} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code double} kind. - */ - public List> double_() { - return TaggedUnionUtils.get(this, Kind.Double); - } - - @Override - @SuppressWarnings("unchecked") - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeStartObject(); - - generator.writeKey(_kind.jsonValue()); - if (_value instanceof JsonpSerializable) { - ((JsonpSerializable) _value).serialize(generator, mapper); - } else { - switch (_kind) { - case Integer : - generator.writeStartArray(); - for (List item0 : ((List>) this._value)) { - generator.writeStartArray(); - if (item0 != null) { - for (Integer item1 : item0) { - generator.write(item1); - - } - } - generator.writeEnd(); - - } - generator.writeEnd(); - - break; - case Keyword : - generator.writeStartArray(); - for (List item0 : ((List>) this._value)) { - generator.writeStartArray(); - if (item0 != null) { - for (String item1 : item0) { - generator.write(item1); - - } - } - generator.writeEnd(); - - } - generator.writeEnd(); - - break; - case Long : - generator.writeStartArray(); - for (List item0 : ((List>) this._value)) { - generator.writeStartArray(); - if (item0 != null) { - for (Long item1 : item0) { - generator.write(item1); - - } - } - generator.writeEnd(); - - } - generator.writeEnd(); - - break; - case Double : - generator.writeStartArray(); - for (List item0 : ((List>) this._value)) { - generator.writeStartArray(); - if (item0 != null) { - for (Double item1 : item0) { - generator.write(item1); - - } - } - generator.writeEnd(); - - } - generator.writeEnd(); - - break; - } - } - - generator.writeEnd(); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Kind _kind; - private Object _value; - - @Override - protected Builder self() { - return this; - } - public ObjectBuilder integer(List> v) { - this._kind = Kind.Integer; - this._value = v; - return this; - } - - public ObjectBuilder keyword(List> v) { - this._kind = Kind.Keyword; - this._value = v; - return this; - } - - public ObjectBuilder long_(List> v) { - this._kind = Kind.Long; - this._value = v; - return this; - } - - public ObjectBuilder double_(List> v) { - this._kind = Kind.Double; - this._value = v; - return this; - } - - public TableValues build() { - _checkSingleUse(); - return new TableValues(this); - } - - } - - protected static void setupTableValuesDeserializer(ObjectDeserializer op) { - - op.add(Builder::integer, JsonpDeserializer.arrayDeserializer( - JsonpDeserializer.arrayDeserializer(JsonpDeserializer.integerDeserializer())), "integer"); - op.add(Builder::keyword, JsonpDeserializer.arrayDeserializer( - JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer())), "keyword"); - op.add(Builder::long_, JsonpDeserializer - .arrayDeserializer(JsonpDeserializer.arrayDeserializer(JsonpDeserializer.longDeserializer())), "long"); - op.add(Builder::double_, JsonpDeserializer.arrayDeserializer( - JsonpDeserializer.arrayDeserializer(JsonpDeserializer.doubleDeserializer())), "double"); - - } - - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - TableValues::setupTableValuesDeserializer, Builder::build); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/esql/TableValuesBuilders.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/esql/TableValuesBuilders.java deleted file mode 100644 index 54f740e44..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/esql/TableValuesBuilders.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.esql; - -import co.elastic.clients.util.ObjectBuilder; -import java.lang.Double; -import java.lang.Integer; -import java.lang.Long; -import java.lang.String; -import java.util.List; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Builders for {@link TableValues} variants. - *

- * Variants integer, keyword, long, - * double are not available here as they don't have a dedicated - * class. Use {@link TableValues}'s builder for these. - * - */ -public class TableValuesBuilders { - private TableValuesBuilders() { - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/esql/TableValuesVariant.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/esql/TableValuesVariant.java deleted file mode 100644 index 7fc6bbd29..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/esql/TableValuesVariant.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.esql; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Base interface for {@link TableValues} variants. - */ -public interface TableValuesVariant { - - TableValues.Kind _tableValuesKind(); - - default TableValues _toTableValues() { - return new TableValues(this); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/Connection.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/Connection.java deleted file mode 100644 index 91c1fda17..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/Connection.java +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.graph; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Double; -import java.lang.Long; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: graph._types.Connection - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class Connection implements JsonpSerializable { - private final long docCount; - - private final long source; - - private final long target; - - private final double weight; - - // --------------------------------------------------------------------------------------------- - - private Connection(Builder builder) { - - this.docCount = ApiTypeHelper.requireNonNull(builder.docCount, this, "docCount"); - this.source = ApiTypeHelper.requireNonNull(builder.source, this, "source"); - this.target = ApiTypeHelper.requireNonNull(builder.target, this, "target"); - this.weight = ApiTypeHelper.requireNonNull(builder.weight, this, "weight"); - - } - - public static Connection of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code doc_count} - */ - public final long docCount() { - return this.docCount; - } - - /** - * Required - API name: {@code source} - */ - public final long source() { - return this.source; - } - - /** - * Required - API name: {@code target} - */ - public final long target() { - return this.target; - } - - /** - * Required - API name: {@code weight} - */ - public final double weight() { - return this.weight; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("doc_count"); - generator.write(this.docCount); - - generator.writeKey("source"); - generator.write(this.source); - - generator.writeKey("target"); - generator.write(this.target); - - generator.writeKey("weight"); - generator.write(this.weight); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link Connection}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Long docCount; - - private Long source; - - private Long target; - - private Double weight; - - /** - * Required - API name: {@code doc_count} - */ - public final Builder docCount(long value) { - this.docCount = value; - return this; - } - - /** - * Required - API name: {@code source} - */ - public final Builder source(long value) { - this.source = value; - return this; - } - - /** - * Required - API name: {@code target} - */ - public final Builder target(long value) { - this.target = value; - return this; - } - - /** - * Required - API name: {@code weight} - */ - public final Builder weight(double value) { - this.weight = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link Connection}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public Connection build() { - _checkSingleUse(); - - return new Connection(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link Connection} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - Connection::setupConnectionDeserializer); - - protected static void setupConnectionDeserializer(ObjectDeserializer op) { - - op.add(Builder::docCount, JsonpDeserializer.longDeserializer(), "doc_count"); - op.add(Builder::source, JsonpDeserializer.longDeserializer(), "source"); - op.add(Builder::target, JsonpDeserializer.longDeserializer(), "target"); - op.add(Builder::weight, JsonpDeserializer.doubleDeserializer(), "weight"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/ElasticsearchGraphAsyncClient.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/ElasticsearchGraphAsyncClient.java deleted file mode 100644 index 77b0c4230..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/ElasticsearchGraphAsyncClient.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.graph; - -import co.elastic.clients.ApiClient; -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.transport.ElasticsearchTransport; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.JsonEndpoint; -import co.elastic.clients.transport.Transport; -import co.elastic.clients.transport.TransportOptions; -import co.elastic.clients.util.ObjectBuilder; -import java.util.concurrent.CompletableFuture; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Client for the graph namespace. - */ -public class ElasticsearchGraphAsyncClient extends ApiClient { - - public ElasticsearchGraphAsyncClient(ElasticsearchTransport transport) { - super(transport, null); - } - - public ElasticsearchGraphAsyncClient(ElasticsearchTransport transport, - @Nullable TransportOptions transportOptions) { - super(transport, transportOptions); - } - - @Override - public ElasticsearchGraphAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) { - return new ElasticsearchGraphAsyncClient(this.transport, transportOptions); - } - - // ----- Endpoint: graph.explore - - /** - * Extracts and summarizes information about the documents and terms in an - * Elasticsearch data stream or index. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture explore(ExploreRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) ExploreRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Extracts and summarizes information about the documents and terms in an - * Elasticsearch data stream or index. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExploreRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture explore( - Function> fn) { - return explore(fn.apply(new ExploreRequest.Builder()).build()); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/ElasticsearchGraphClient.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/ElasticsearchGraphClient.java deleted file mode 100644 index af2acaf93..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/ElasticsearchGraphClient.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.graph; - -import co.elastic.clients.ApiClient; -import co.elastic.clients.elasticsearch._types.ElasticsearchException; -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.transport.ElasticsearchTransport; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.JsonEndpoint; -import co.elastic.clients.transport.Transport; -import co.elastic.clients.transport.TransportOptions; -import co.elastic.clients.util.ObjectBuilder; -import java.io.IOException; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Client for the graph namespace. - */ -public class ElasticsearchGraphClient extends ApiClient { - - public ElasticsearchGraphClient(ElasticsearchTransport transport) { - super(transport, null); - } - - public ElasticsearchGraphClient(ElasticsearchTransport transport, @Nullable TransportOptions transportOptions) { - super(transport, transportOptions); - } - - @Override - public ElasticsearchGraphClient withTransportOptions(@Nullable TransportOptions transportOptions) { - return new ElasticsearchGraphClient(this.transport, transportOptions); - } - - // ----- Endpoint: graph.explore - - /** - * Extracts and summarizes information about the documents and terms in an - * Elasticsearch data stream or index. - * - * @see Documentation - * on elastic.co - */ - - public ExploreResponse explore(ExploreRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) ExploreRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Extracts and summarizes information about the documents and terms in an - * Elasticsearch data stream or index. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExploreRequest} - * @see Documentation - * on elastic.co - */ - - public final ExploreResponse explore(Function> fn) - throws IOException, ElasticsearchException { - return explore(fn.apply(new ExploreRequest.Builder()).build()); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/ExploreControls.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/ExploreControls.java deleted file mode 100644 index 80534cc9d..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/ExploreControls.java +++ /dev/null @@ -1,306 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.graph; - -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Integer; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: graph._types.ExploreControls - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class ExploreControls implements JsonpSerializable { - @Nullable - private final SampleDiversity sampleDiversity; - - @Nullable - private final Integer sampleSize; - - @Nullable - private final Time timeout; - - private final boolean useSignificance; - - // --------------------------------------------------------------------------------------------- - - private ExploreControls(Builder builder) { - - this.sampleDiversity = builder.sampleDiversity; - this.sampleSize = builder.sampleSize; - this.timeout = builder.timeout; - this.useSignificance = ApiTypeHelper.requireNonNull(builder.useSignificance, this, "useSignificance"); - - } - - public static ExploreControls of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code sample_diversity} - */ - @Nullable - public final SampleDiversity sampleDiversity() { - return this.sampleDiversity; - } - - /** - * Each hop considers a sample of the best-matching documents on each shard. - * Using samples improves the speed of execution and keeps exploration focused - * on meaningfully-connected terms. Very small values (less than 50) might not - * provide sufficient weight-of-evidence to identify significant connections - * between terms. Very large sample sizes can dilute the quality of the results - * and increase execution times. - *

- * API name: {@code sample_size} - */ - @Nullable - public final Integer sampleSize() { - return this.sampleSize; - } - - /** - * The length of time in milliseconds after which exploration will be halted and - * the results gathered so far are returned. This timeout is honored on a - * best-effort basis. Execution might overrun this timeout if, for example, a - * long pause is encountered while FieldData is loaded for a field. - *

- * API name: {@code timeout} - */ - @Nullable - public final Time timeout() { - return this.timeout; - } - - /** - * Required - Filters associated terms so only those that are significantly - * associated with your query are included. - *

- * API name: {@code use_significance} - */ - public final boolean useSignificance() { - return this.useSignificance; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.sampleDiversity != null) { - generator.writeKey("sample_diversity"); - this.sampleDiversity.serialize(generator, mapper); - - } - if (this.sampleSize != null) { - generator.writeKey("sample_size"); - generator.write(this.sampleSize); - - } - if (this.timeout != null) { - generator.writeKey("timeout"); - this.timeout.serialize(generator, mapper); - - } - generator.writeKey("use_significance"); - generator.write(this.useSignificance); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ExploreControls}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private SampleDiversity sampleDiversity; - - @Nullable - private Integer sampleSize; - - @Nullable - private Time timeout; - - private Boolean useSignificance; - - /** - * 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. - *

- * API name: {@code sample_diversity} - */ - public final Builder sampleDiversity(@Nullable SampleDiversity value) { - this.sampleDiversity = value; - return this; - } - - /** - * 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. - *

- * API name: {@code sample_diversity} - */ - public final Builder sampleDiversity(Function> fn) { - return this.sampleDiversity(fn.apply(new SampleDiversity.Builder()).build()); - } - - /** - * Each hop considers a sample of the best-matching documents on each shard. - * Using samples improves the speed of execution and keeps exploration focused - * on meaningfully-connected terms. Very small values (less than 50) might not - * provide sufficient weight-of-evidence to identify significant connections - * between terms. Very large sample sizes can dilute the quality of the results - * and increase execution times. - *

- * API name: {@code sample_size} - */ - public final Builder sampleSize(@Nullable Integer value) { - this.sampleSize = value; - return this; - } - - /** - * The length of time in milliseconds after which exploration will be halted and - * the results gathered so far are returned. This timeout is honored on a - * best-effort basis. Execution might overrun this timeout if, for example, a - * long pause is encountered while FieldData is loaded for a field. - *

- * API name: {@code timeout} - */ - public final Builder timeout(@Nullable Time value) { - this.timeout = value; - return this; - } - - /** - * The length of time in milliseconds after which exploration will be halted and - * the results gathered so far are returned. This timeout is honored on a - * best-effort basis. Execution might overrun this timeout if, for example, a - * long pause is encountered while FieldData is loaded for a field. - *

- * API name: {@code timeout} - */ - public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Required - Filters associated terms so only those that are significantly - * associated with your query are included. - *

- * API name: {@code use_significance} - */ - public final Builder useSignificance(boolean value) { - this.useSignificance = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ExploreControls}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ExploreControls build() { - _checkSingleUse(); - - return new ExploreControls(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ExploreControls} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - ExploreControls::setupExploreControlsDeserializer); - - protected static void setupExploreControlsDeserializer(ObjectDeserializer op) { - - op.add(Builder::sampleDiversity, SampleDiversity._DESERIALIZER, "sample_diversity"); - op.add(Builder::sampleSize, JsonpDeserializer.integerDeserializer(), "sample_size"); - op.add(Builder::timeout, Time._DESERIALIZER, "timeout"); - op.add(Builder::useSignificance, JsonpDeserializer.booleanDeserializer(), "use_significance"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/ExploreRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/ExploreRequest.java deleted file mode 100644 index 601f88927..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/ExploreRequest.java +++ /dev/null @@ -1,500 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.graph; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.elasticsearch._types.query_dsl.Query; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: graph.explore.Request - -/** - * Extracts and summarizes information about the documents and terms in an - * Elasticsearch data stream or index. - * - * @see API - * specification - */ -@JsonpDeserializable -public class ExploreRequest extends RequestBase implements JsonpSerializable { - @Nullable - private final Hop connections; - - @Nullable - private final ExploreControls controls; - - private final List index; - - @Nullable - private final Query query; - - @Nullable - private final String routing; - - @Nullable - private final Time timeout; - - private final List vertices; - - // --------------------------------------------------------------------------------------------- - - private ExploreRequest(Builder builder) { - - this.connections = builder.connections; - this.controls = builder.controls; - this.index = ApiTypeHelper.unmodifiableRequired(builder.index, this, "index"); - this.query = builder.query; - this.routing = builder.routing; - this.timeout = builder.timeout; - this.vertices = ApiTypeHelper.unmodifiable(builder.vertices); - - } - - public static ExploreRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Specifies or more fields from which you want to extract terms that are - * associated with the specified vertices. - *

- * API name: {@code connections} - */ - @Nullable - public final Hop connections() { - return this.connections; - } - - /** - * Direct the Graph API how to build the graph. - *

- * API name: {@code controls} - */ - @Nullable - public final ExploreControls controls() { - return this.controls; - } - - /** - * Required - Name of the index. - *

- * API name: {@code index} - */ - public final List index() { - return this.index; - } - - /** - * A seed query that identifies the documents of interest. Can be any valid - * Elasticsearch query. - *

- * API name: {@code query} - */ - @Nullable - public final Query query() { - return this.query; - } - - /** - * Custom value used to route operations to a specific shard. - *

- * API name: {@code routing} - */ - @Nullable - public final String routing() { - return this.routing; - } - - /** - * 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. - *

- * API name: {@code timeout} - */ - @Nullable - public final Time timeout() { - return this.timeout; - } - - /** - * Specifies one or more fields that contain the terms you want to include in - * the graph as vertices. - *

- * API name: {@code vertices} - */ - public final List vertices() { - return this.vertices; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.connections != null) { - generator.writeKey("connections"); - this.connections.serialize(generator, mapper); - - } - if (this.controls != null) { - generator.writeKey("controls"); - this.controls.serialize(generator, mapper); - - } - if (this.query != null) { - generator.writeKey("query"); - this.query.serialize(generator, mapper); - - } - if (ApiTypeHelper.isDefined(this.vertices)) { - generator.writeKey("vertices"); - generator.writeStartArray(); - for (VertexDefinition item0 : this.vertices) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ExploreRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { - @Nullable - private Hop connections; - - @Nullable - private ExploreControls controls; - - private List index; - - @Nullable - private Query query; - - @Nullable - private String routing; - - @Nullable - private Time timeout; - - @Nullable - private List vertices; - - /** - * Specifies or more fields from which you want to extract terms that are - * associated with the specified vertices. - *

- * API name: {@code connections} - */ - public final Builder connections(@Nullable Hop value) { - this.connections = value; - return this; - } - - /** - * Specifies or more fields from which you want to extract terms that are - * associated with the specified vertices. - *

- * API name: {@code connections} - */ - public final Builder connections(Function> fn) { - return this.connections(fn.apply(new Hop.Builder()).build()); - } - - /** - * Direct the Graph API how to build the graph. - *

- * API name: {@code controls} - */ - public final Builder controls(@Nullable ExploreControls value) { - this.controls = value; - return this; - } - - /** - * Direct the Graph API how to build the graph. - *

- * API name: {@code controls} - */ - public final Builder controls(Function> fn) { - return this.controls(fn.apply(new ExploreControls.Builder()).build()); - } - - /** - * Required - Name of the index. - *

- * API name: {@code index} - *

- * Adds all elements of list to index. - */ - public final Builder index(List list) { - this.index = _listAddAll(this.index, list); - return this; - } - - /** - * Required - Name of the index. - *

- * API name: {@code index} - *

- * Adds one or more values to index. - */ - public final Builder index(String value, String... values) { - this.index = _listAdd(this.index, value, values); - return this; - } - - /** - * A seed query that identifies the documents of interest. Can be any valid - * Elasticsearch query. - *

- * API name: {@code query} - */ - public final Builder query(@Nullable Query value) { - this.query = value; - return this; - } - - /** - * A seed query that identifies the documents of interest. Can be any valid - * Elasticsearch query. - *

- * API name: {@code query} - */ - public final Builder query(Function> fn) { - return this.query(fn.apply(new Query.Builder()).build()); - } - - /** - * Custom value used to route operations to a specific shard. - *

- * API name: {@code routing} - */ - public final Builder routing(@Nullable String value) { - this.routing = 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. - *

- * API name: {@code timeout} - */ - public final Builder timeout(@Nullable Time value) { - this.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. - *

- * API name: {@code timeout} - */ - public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Specifies one or more fields that contain the terms you want to include in - * the graph as vertices. - *

- * API name: {@code vertices} - *

- * Adds all elements of list to vertices. - */ - public final Builder vertices(List list) { - this.vertices = _listAddAll(this.vertices, list); - return this; - } - - /** - * Specifies one or more fields that contain the terms you want to include in - * the graph as vertices. - *

- * API name: {@code vertices} - *

- * Adds one or more values to vertices. - */ - public final Builder vertices(VertexDefinition value, VertexDefinition... values) { - this.vertices = _listAdd(this.vertices, value, values); - return this; - } - - /** - * Specifies one or more fields that contain the terms you want to include in - * the graph as vertices. - *

- * API name: {@code vertices} - *

- * Adds a value to vertices using a builder lambda. - */ - public final Builder vertices(Function> fn) { - return vertices(fn.apply(new VertexDefinition.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ExploreRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ExploreRequest build() { - _checkSingleUse(); - - return new ExploreRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ExploreRequest} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - ExploreRequest::setupExploreRequestDeserializer); - - protected static void setupExploreRequestDeserializer(ObjectDeserializer op) { - - op.add(Builder::connections, Hop._DESERIALIZER, "connections"); - op.add(Builder::controls, ExploreControls._DESERIALIZER, "controls"); - op.add(Builder::query, Query._DESERIALIZER, "query"); - op.add(Builder::vertices, JsonpDeserializer.arrayDeserializer(VertexDefinition._DESERIALIZER), "vertices"); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code graph.explore}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/graph.explore", - - // Request method - request -> { - return "POST"; - - }, - - // Request path - request -> { - final int _index = 1 << 0; - - int propsSet = 0; - - propsSet |= _index; - - if (propsSet == (_index)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_graph"); - buf.append("/explore"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _index = 1 << 0; - - int propsSet = 0; - - propsSet |= _index; - - if (propsSet == (_index)) { - params.put("index", request.index.stream().map(v -> v).collect(Collectors.joining(","))); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.routing != null) { - params.put("routing", request.routing); - } - if (request.timeout != null) { - params.put("timeout", request.timeout._toJsonString()); - } - return params; - - }, SimpleEndpoint.emptyMap(), true, ExploreResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/ExploreResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/ExploreResponse.java deleted file mode 100644 index 0631b2350..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/ExploreResponse.java +++ /dev/null @@ -1,337 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.graph; - -import co.elastic.clients.elasticsearch._types.ShardFailure; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Long; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: graph.explore.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class ExploreResponse implements JsonpSerializable { - private final List connections; - - private final List failures; - - private final boolean timedOut; - - private final long took; - - private final List vertices; - - // --------------------------------------------------------------------------------------------- - - private ExploreResponse(Builder builder) { - - this.connections = ApiTypeHelper.unmodifiableRequired(builder.connections, this, "connections"); - this.failures = ApiTypeHelper.unmodifiableRequired(builder.failures, this, "failures"); - this.timedOut = ApiTypeHelper.requireNonNull(builder.timedOut, this, "timedOut"); - this.took = ApiTypeHelper.requireNonNull(builder.took, this, "took"); - this.vertices = ApiTypeHelper.unmodifiableRequired(builder.vertices, this, "vertices"); - - } - - public static ExploreResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code connections} - */ - public final List connections() { - return this.connections; - } - - /** - * Required - API name: {@code failures} - */ - public final List failures() { - return this.failures; - } - - /** - * Required - API name: {@code timed_out} - */ - public final boolean timedOut() { - return this.timedOut; - } - - /** - * Required - API name: {@code took} - */ - public final long took() { - return this.took; - } - - /** - * Required - API name: {@code vertices} - */ - public final List vertices() { - return this.vertices; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.connections)) { - generator.writeKey("connections"); - generator.writeStartArray(); - for (Connection item0 : this.connections) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.failures)) { - generator.writeKey("failures"); - generator.writeStartArray(); - for (ShardFailure item0 : this.failures) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - generator.writeKey("timed_out"); - generator.write(this.timedOut); - - generator.writeKey("took"); - generator.write(this.took); - - if (ApiTypeHelper.isDefined(this.vertices)) { - generator.writeKey("vertices"); - generator.writeStartArray(); - for (Vertex item0 : this.vertices) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ExploreResponse}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private List connections; - - private List failures; - - private Boolean timedOut; - - private Long took; - - private List vertices; - - /** - * Required - API name: {@code connections} - *

- * Adds all elements of list to connections. - */ - public final Builder connections(List list) { - this.connections = _listAddAll(this.connections, list); - return this; - } - - /** - * Required - API name: {@code connections} - *

- * Adds one or more values to connections. - */ - public final Builder connections(Connection value, Connection... values) { - this.connections = _listAdd(this.connections, value, values); - return this; - } - - /** - * Required - API name: {@code connections} - *

- * Adds a value to connections using a builder lambda. - */ - public final Builder connections(Function> fn) { - return connections(fn.apply(new Connection.Builder()).build()); - } - - /** - * Required - API name: {@code failures} - *

- * Adds all elements of list to failures. - */ - public final Builder failures(List list) { - this.failures = _listAddAll(this.failures, list); - return this; - } - - /** - * Required - API name: {@code failures} - *

- * Adds one or more values to failures. - */ - public final Builder failures(ShardFailure value, ShardFailure... values) { - this.failures = _listAdd(this.failures, value, values); - return this; - } - - /** - * Required - API name: {@code failures} - *

- * Adds a value to failures using a builder lambda. - */ - public final Builder failures(Function> fn) { - return failures(fn.apply(new ShardFailure.Builder()).build()); - } - - /** - * Required - API name: {@code timed_out} - */ - public final Builder timedOut(boolean value) { - this.timedOut = value; - return this; - } - - /** - * Required - API name: {@code took} - */ - public final Builder took(long value) { - this.took = value; - return this; - } - - /** - * Required - API name: {@code vertices} - *

- * Adds all elements of list to vertices. - */ - public final Builder vertices(List list) { - this.vertices = _listAddAll(this.vertices, list); - return this; - } - - /** - * Required - API name: {@code vertices} - *

- * Adds one or more values to vertices. - */ - public final Builder vertices(Vertex value, Vertex... values) { - this.vertices = _listAdd(this.vertices, value, values); - return this; - } - - /** - * Required - API name: {@code vertices} - *

- * Adds a value to vertices using a builder lambda. - */ - public final Builder vertices(Function> fn) { - return vertices(fn.apply(new Vertex.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ExploreResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ExploreResponse build() { - _checkSingleUse(); - - return new ExploreResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ExploreResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - ExploreResponse::setupExploreResponseDeserializer); - - protected static void setupExploreResponseDeserializer(ObjectDeserializer op) { - - op.add(Builder::connections, JsonpDeserializer.arrayDeserializer(Connection._DESERIALIZER), "connections"); - op.add(Builder::failures, JsonpDeserializer.arrayDeserializer(ShardFailure._DESERIALIZER), "failures"); - op.add(Builder::timedOut, JsonpDeserializer.booleanDeserializer(), "timed_out"); - op.add(Builder::took, JsonpDeserializer.longDeserializer(), "took"); - op.add(Builder::vertices, JsonpDeserializer.arrayDeserializer(Vertex._DESERIALIZER), "vertices"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/Hop.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/Hop.java deleted file mode 100644 index 8429c193a..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/Hop.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.graph; - -import co.elastic.clients.elasticsearch._types.query_dsl.Query; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: graph._types.Hop - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class Hop implements JsonpSerializable { - @Nullable - private final Hop connections; - - private final Query query; - - private final List vertices; - - // --------------------------------------------------------------------------------------------- - - private Hop(Builder builder) { - - this.connections = builder.connections; - this.query = ApiTypeHelper.requireNonNull(builder.query, this, "query"); - this.vertices = ApiTypeHelper.unmodifiableRequired(builder.vertices, this, "vertices"); - - } - - public static Hop of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Specifies one or more fields from which you want to extract terms that are - * associated with the specified vertices. - *

- * API name: {@code connections} - */ - @Nullable - public final Hop connections() { - return this.connections; - } - - /** - * Required - An optional guiding query that constrains the Graph API as it - * explores connected terms. - *

- * API name: {@code query} - */ - public final Query query() { - return this.query; - } - - /** - * Required - Contains the fields you are interested in. - *

- * API name: {@code vertices} - */ - public final List vertices() { - return this.vertices; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.connections != null) { - generator.writeKey("connections"); - this.connections.serialize(generator, mapper); - - } - generator.writeKey("query"); - this.query.serialize(generator, mapper); - - if (ApiTypeHelper.isDefined(this.vertices)) { - generator.writeKey("vertices"); - generator.writeStartArray(); - for (VertexDefinition item0 : this.vertices) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link Hop}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private Hop connections; - - private Query query; - - private List vertices; - - /** - * Specifies one or more fields from which you want to extract terms that are - * associated with the specified vertices. - *

- * API name: {@code connections} - */ - public final Builder connections(@Nullable Hop value) { - this.connections = value; - return this; - } - - /** - * Specifies one or more fields from which you want to extract terms that are - * associated with the specified vertices. - *

- * API name: {@code connections} - */ - public final Builder connections(Function> fn) { - return this.connections(fn.apply(new Hop.Builder()).build()); - } - - /** - * Required - An optional guiding query that constrains the Graph API as it - * explores connected terms. - *

- * API name: {@code query} - */ - public final Builder query(Query value) { - this.query = value; - return this; - } - - /** - * Required - An optional guiding query that constrains the Graph API as it - * explores connected terms. - *

- * API name: {@code query} - */ - public final Builder query(Function> fn) { - return this.query(fn.apply(new Query.Builder()).build()); - } - - /** - * Required - Contains the fields you are interested in. - *

- * API name: {@code vertices} - *

- * Adds all elements of list to vertices. - */ - public final Builder vertices(List list) { - this.vertices = _listAddAll(this.vertices, list); - return this; - } - - /** - * Required - Contains the fields you are interested in. - *

- * API name: {@code vertices} - *

- * Adds one or more values to vertices. - */ - public final Builder vertices(VertexDefinition value, VertexDefinition... values) { - this.vertices = _listAdd(this.vertices, value, values); - return this; - } - - /** - * Required - Contains the fields you are interested in. - *

- * API name: {@code vertices} - *

- * Adds a value to vertices using a builder lambda. - */ - public final Builder vertices(Function> fn) { - return vertices(fn.apply(new VertexDefinition.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link Hop}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public Hop build() { - _checkSingleUse(); - - return new Hop(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link Hop} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - Hop::setupHopDeserializer); - - protected static void setupHopDeserializer(ObjectDeserializer op) { - - op.add(Builder::connections, Hop._DESERIALIZER, "connections"); - op.add(Builder::query, Query._DESERIALIZER, "query"); - op.add(Builder::vertices, JsonpDeserializer.arrayDeserializer(VertexDefinition._DESERIALIZER), "vertices"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/SampleDiversity.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/SampleDiversity.java deleted file mode 100644 index f4f61e711..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/SampleDiversity.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.graph; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Integer; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: graph._types.SampleDiversity - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class SampleDiversity implements JsonpSerializable { - private final String field; - - private final int maxDocsPerValue; - - // --------------------------------------------------------------------------------------------- - - private SampleDiversity(Builder builder) { - - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - this.maxDocsPerValue = ApiTypeHelper.requireNonNull(builder.maxDocsPerValue, this, "maxDocsPerValue"); - - } - - public static SampleDiversity of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code field} - */ - public final String field() { - return this.field; - } - - /** - * Required - API name: {@code max_docs_per_value} - */ - public final int maxDocsPerValue() { - return this.maxDocsPerValue; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("field"); - generator.write(this.field); - - generator.writeKey("max_docs_per_value"); - generator.write(this.maxDocsPerValue); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SampleDiversity}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private String field; - - private Integer maxDocsPerValue; - - /** - * Required - API name: {@code field} - */ - public final Builder field(String value) { - this.field = value; - return this; - } - - /** - * Required - API name: {@code max_docs_per_value} - */ - public final Builder maxDocsPerValue(int value) { - this.maxDocsPerValue = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link SampleDiversity}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SampleDiversity build() { - _checkSingleUse(); - - return new SampleDiversity(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SampleDiversity} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - SampleDiversity::setupSampleDiversityDeserializer); - - protected static void setupSampleDiversityDeserializer(ObjectDeserializer op) { - - op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); - op.add(Builder::maxDocsPerValue, JsonpDeserializer.integerDeserializer(), "max_docs_per_value"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/Vertex.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/Vertex.java deleted file mode 100644 index 6322fcd31..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/Vertex.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.graph; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Double; -import java.lang.Long; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: graph._types.Vertex - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class Vertex implements JsonpSerializable { - private final long depth; - - private final String field; - - private final String term; - - private final double weight; - - // --------------------------------------------------------------------------------------------- - - private Vertex(Builder builder) { - - this.depth = ApiTypeHelper.requireNonNull(builder.depth, this, "depth"); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - this.term = ApiTypeHelper.requireNonNull(builder.term, this, "term"); - this.weight = ApiTypeHelper.requireNonNull(builder.weight, this, "weight"); - - } - - public static Vertex of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code depth} - */ - public final long depth() { - return this.depth; - } - - /** - * Required - API name: {@code field} - */ - public final String field() { - return this.field; - } - - /** - * Required - API name: {@code term} - */ - public final String term() { - return this.term; - } - - /** - * Required - API name: {@code weight} - */ - public final double weight() { - return this.weight; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("depth"); - generator.write(this.depth); - - generator.writeKey("field"); - generator.write(this.field); - - generator.writeKey("term"); - generator.write(this.term); - - generator.writeKey("weight"); - generator.write(this.weight); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link Vertex}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Long depth; - - private String field; - - private String term; - - private Double weight; - - /** - * Required - API name: {@code depth} - */ - public final Builder depth(long value) { - this.depth = value; - return this; - } - - /** - * Required - API name: {@code field} - */ - public final Builder field(String value) { - this.field = value; - return this; - } - - /** - * Required - API name: {@code term} - */ - public final Builder term(String value) { - this.term = value; - return this; - } - - /** - * Required - API name: {@code weight} - */ - public final Builder weight(double value) { - this.weight = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link Vertex}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public Vertex build() { - _checkSingleUse(); - - return new Vertex(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link Vertex} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - Vertex::setupVertexDeserializer); - - protected static void setupVertexDeserializer(ObjectDeserializer op) { - - op.add(Builder::depth, JsonpDeserializer.longDeserializer(), "depth"); - op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); - op.add(Builder::term, JsonpDeserializer.stringDeserializer(), "term"); - op.add(Builder::weight, JsonpDeserializer.doubleDeserializer(), "weight"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/VertexDefinition.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/VertexDefinition.java deleted file mode 100644 index f06ac89af..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/VertexDefinition.java +++ /dev/null @@ -1,382 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.graph; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Integer; -import java.lang.Long; -import java.lang.String; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: graph._types.VertexDefinition - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class VertexDefinition implements JsonpSerializable { - private final List exclude; - - private final String field; - - private final List include; - - @Nullable - private final Long minDocCount; - - @Nullable - private final Long shardMinDocCount; - - @Nullable - private final Integer size; - - // --------------------------------------------------------------------------------------------- - - private VertexDefinition(Builder builder) { - - this.exclude = ApiTypeHelper.unmodifiable(builder.exclude); - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - this.include = ApiTypeHelper.unmodifiable(builder.include); - this.minDocCount = builder.minDocCount; - this.shardMinDocCount = builder.shardMinDocCount; - this.size = builder.size; - - } - - public static VertexDefinition of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Prevents the specified terms from being included in the results. - *

- * API name: {@code exclude} - */ - public final List exclude() { - return this.exclude; - } - - /** - * Required - Identifies a field in the documents of interest. - *

- * API name: {@code field} - */ - public final String field() { - return this.field; - } - - /** - * Identifies the terms of interest that form the starting points from which you - * want to spider out. - *

- * API name: {@code include} - */ - public final List include() { - return this.include; - } - - /** - * Specifies how many documents must contain a pair of terms before it is - * considered to be a useful connection. This setting acts as a certainty - * threshold. - *

- * API name: {@code min_doc_count} - */ - @Nullable - public final Long minDocCount() { - return this.minDocCount; - } - - /** - * Controls how many documents on a particular shard have to contain a pair of - * terms before the connection is returned for global consideration. - *

- * API name: {@code shard_min_doc_count} - */ - @Nullable - public final Long shardMinDocCount() { - return this.shardMinDocCount; - } - - /** - * Specifies the maximum number of vertex terms returned for each field. - *

- * API name: {@code size} - */ - @Nullable - public final Integer size() { - return this.size; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.exclude)) { - generator.writeKey("exclude"); - generator.writeStartArray(); - for (String item0 : this.exclude) { - generator.write(item0); - - } - generator.writeEnd(); - - } - generator.writeKey("field"); - generator.write(this.field); - - if (ApiTypeHelper.isDefined(this.include)) { - generator.writeKey("include"); - generator.writeStartArray(); - for (VertexInclude item0 : this.include) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.minDocCount != null) { - generator.writeKey("min_doc_count"); - generator.write(this.minDocCount); - - } - if (this.shardMinDocCount != null) { - generator.writeKey("shard_min_doc_count"); - generator.write(this.shardMinDocCount); - - } - if (this.size != null) { - generator.writeKey("size"); - generator.write(this.size); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link VertexDefinition}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private List exclude; - - private String field; - - @Nullable - private List include; - - @Nullable - private Long minDocCount; - - @Nullable - private Long shardMinDocCount; - - @Nullable - private Integer size; - - /** - * Prevents the specified terms from being included in the results. - *

- * API name: {@code exclude} - *

- * Adds all elements of list to exclude. - */ - public final Builder exclude(List list) { - this.exclude = _listAddAll(this.exclude, list); - return this; - } - - /** - * Prevents the specified terms from being included in the results. - *

- * API name: {@code exclude} - *

- * Adds one or more values to exclude. - */ - public final Builder exclude(String value, String... values) { - this.exclude = _listAdd(this.exclude, value, values); - return this; - } - - /** - * Required - Identifies a field in the documents of interest. - *

- * API name: {@code field} - */ - public final Builder field(String value) { - this.field = value; - return this; - } - - /** - * Identifies the terms of interest that form the starting points from which you - * want to spider out. - *

- * API name: {@code include} - *

- * Adds all elements of list to include. - */ - public final Builder include(List list) { - this.include = _listAddAll(this.include, list); - return this; - } - - /** - * Identifies the terms of interest that form the starting points from which you - * want to spider out. - *

- * API name: {@code include} - *

- * Adds one or more values to include. - */ - public final Builder include(VertexInclude value, VertexInclude... values) { - this.include = _listAdd(this.include, value, values); - return this; - } - - /** - * Identifies the terms of interest that form the starting points from which you - * want to spider out. - *

- * API name: {@code include} - *

- * Adds a value to include using a builder lambda. - */ - public final Builder include(Function> fn) { - return include(fn.apply(new VertexInclude.Builder()).build()); - } - - /** - * Specifies how many documents must contain a pair of terms before it is - * considered to be a useful connection. This setting acts as a certainty - * threshold. - *

- * API name: {@code min_doc_count} - */ - public final Builder minDocCount(@Nullable Long value) { - this.minDocCount = value; - return this; - } - - /** - * Controls how many documents on a particular shard have to contain a pair of - * terms before the connection is returned for global consideration. - *

- * API name: {@code shard_min_doc_count} - */ - public final Builder shardMinDocCount(@Nullable Long value) { - this.shardMinDocCount = value; - return this; - } - - /** - * Specifies the maximum number of vertex terms returned for each field. - *

- * API name: {@code size} - */ - public final Builder size(@Nullable Integer value) { - this.size = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link VertexDefinition}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public VertexDefinition build() { - _checkSingleUse(); - - return new VertexDefinition(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link VertexDefinition} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - VertexDefinition::setupVertexDefinitionDeserializer); - - protected static void setupVertexDefinitionDeserializer(ObjectDeserializer op) { - - op.add(Builder::exclude, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "exclude"); - op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); - op.add(Builder::include, JsonpDeserializer.arrayDeserializer(VertexInclude._DESERIALIZER), "include"); - op.add(Builder::minDocCount, JsonpDeserializer.longDeserializer(), "min_doc_count"); - op.add(Builder::shardMinDocCount, JsonpDeserializer.longDeserializer(), "shard_min_doc_count"); - op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/VertexInclude.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/VertexInclude.java deleted file mode 100644 index 04c7203c5..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/graph/VertexInclude.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.graph; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Double; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: graph._types.VertexInclude - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class VertexInclude implements JsonpSerializable { - private final double boost; - - private final String term; - - // --------------------------------------------------------------------------------------------- - - private VertexInclude(Builder builder) { - - this.boost = ApiTypeHelper.requireNonNull(builder.boost, this, "boost"); - this.term = ApiTypeHelper.requireNonNull(builder.term, this, "term"); - - } - - public static VertexInclude of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code boost} - */ - public final double boost() { - return this.boost; - } - - /** - * Required - API name: {@code term} - */ - public final String term() { - return this.term; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("boost"); - generator.write(this.boost); - - generator.writeKey("term"); - generator.write(this.term); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link VertexInclude}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Double boost; - - private String term; - - /** - * Required - API name: {@code boost} - */ - public final Builder boost(double value) { - this.boost = value; - return this; - } - - /** - * Required - API name: {@code term} - */ - public final Builder term(String value) { - this.term = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link VertexInclude}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public VertexInclude build() { - _checkSingleUse(); - - return new VertexInclude(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link VertexInclude} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - VertexInclude::setupVertexIncludeDeserializer); - - protected static void setupVertexIncludeDeserializer(ObjectDeserializer op) { - - op.add(Builder::boost, JsonpDeserializer.doubleDeserializer(), "boost"); - op.add(Builder::term, JsonpDeserializer.stringDeserializer(), "term"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/AddBlockRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/AddBlockRequest.java deleted file mode 100644 index 575697586..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/AddBlockRequest.java +++ /dev/null @@ -1,407 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.ExpandWildcard; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.elasticsearch.indices.add_block.IndicesBlockOptions; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.add_block.Request - -/** - * Add an index block. Limits the operations allowed on an index by blocking - * specific operation types. - * - * @see API - * specification - */ - -public class AddBlockRequest extends RequestBase { - @Nullable - private final Boolean allowNoIndices; - - private final IndicesBlockOptions block; - - private final List expandWildcards; - - @Nullable - private final Boolean ignoreUnavailable; - - private final String index; - - @Nullable - private final Time masterTimeout; - - @Nullable - private final Time timeout; - - // --------------------------------------------------------------------------------------------- - - private AddBlockRequest(Builder builder) { - - this.allowNoIndices = builder.allowNoIndices; - this.block = ApiTypeHelper.requireNonNull(builder.block, this, "block"); - this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); - this.ignoreUnavailable = builder.ignoreUnavailable; - this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); - this.masterTimeout = builder.masterTimeout; - this.timeout = builder.timeout; - - } - - public static AddBlockRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) - *

- * API name: {@code allow_no_indices} - */ - @Nullable - public final Boolean allowNoIndices() { - return this.allowNoIndices; - } - - /** - * Required - The block to add (one of read, write, read_only or metadata) - *

- * API name: {@code block} - */ - public final IndicesBlockOptions block() { - return this.block; - } - - /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. - *

- * API name: {@code expand_wildcards} - */ - public final List expandWildcards() { - return this.expandWildcards; - } - - /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) - *

- * API name: {@code ignore_unavailable} - */ - @Nullable - public final Boolean ignoreUnavailable() { - return this.ignoreUnavailable; - } - - /** - * Required - A comma separated list of indices to add a block to - *

- * API name: {@code index} - */ - public final String index() { - return this.index; - } - - /** - * Specify timeout for connection to master - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * Explicit operation timeout - *

- * API name: {@code timeout} - */ - @Nullable - public final Time timeout() { - return this.timeout; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link AddBlockRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { - @Nullable - private Boolean allowNoIndices; - - private IndicesBlockOptions block; - - @Nullable - private List expandWildcards; - - @Nullable - private Boolean ignoreUnavailable; - - private String index; - - @Nullable - private Time masterTimeout; - - @Nullable - private Time timeout; - - /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) - *

- * API name: {@code allow_no_indices} - */ - public final Builder allowNoIndices(@Nullable Boolean value) { - this.allowNoIndices = value; - return this; - } - - /** - * Required - The block to add (one of read, write, read_only or metadata) - *

- * API name: {@code block} - */ - public final Builder block(IndicesBlockOptions value) { - this.block = value; - return this; - } - - /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. - *

- * API name: {@code expand_wildcards} - *

- * Adds all elements of list to expandWildcards. - */ - public final Builder expandWildcards(List list) { - this.expandWildcards = _listAddAll(this.expandWildcards, list); - return this; - } - - /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. - *

- * API name: {@code expand_wildcards} - *

- * Adds one or more values to expandWildcards. - */ - public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { - this.expandWildcards = _listAdd(this.expandWildcards, value, values); - return this; - } - - /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) - *

- * API name: {@code ignore_unavailable} - */ - public final Builder ignoreUnavailable(@Nullable Boolean value) { - this.ignoreUnavailable = value; - return this; - } - - /** - * Required - A comma separated list of indices to add a block to - *

- * API name: {@code index} - */ - public final Builder index(String value) { - this.index = value; - return this; - } - - /** - * Specify timeout for connection to master - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = value; - return this; - } - - /** - * Specify timeout for connection to master - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Explicit operation timeout - *

- * API name: {@code timeout} - */ - public final Builder timeout(@Nullable Time value) { - this.timeout = value; - return this; - } - - /** - * Explicit operation timeout - *

- * API name: {@code timeout} - */ - public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link AddBlockRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public AddBlockRequest build() { - _checkSingleUse(); - - return new AddBlockRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.add_block}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.add_block", - - // Request method - request -> { - return "PUT"; - - }, - - // Request path - request -> { - final int _index = 1 << 0; - final int _block = 1 << 1; - - int propsSet = 0; - - propsSet |= _index; - propsSet |= _block; - - if (propsSet == (_index | _block)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index, buf); - buf.append("/_block"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.block.jsonValue(), buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _index = 1 << 0; - final int _block = 1 << 1; - - int propsSet = 0; - - propsSet |= _index; - propsSet |= _block; - - if (propsSet == (_index | _block)) { - params.put("index", request.index); - params.put("block", request.block.jsonValue()); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (ApiTypeHelper.isDefined(request.expandWildcards)) { - params.put("expand_wildcards", - request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); - } - if (request.ignoreUnavailable != null) { - params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); - } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } - if (request.timeout != null) { - params.put("timeout", request.timeout._toJsonString()); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, AddBlockResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/AddBlockResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/AddBlockResponse.java deleted file mode 100644 index c25c87be1..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/AddBlockResponse.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.AcknowledgedResponse; -import co.elastic.clients.elasticsearch.indices.add_block.IndicesBlockStatus; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.add_block.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class AddBlockResponse implements AcknowledgedResponse, JsonpSerializable { - private final boolean acknowledged; - - private final boolean shardsAcknowledged; - - private final List indices; - - // --------------------------------------------------------------------------------------------- - - private AddBlockResponse(Builder builder) { - - this.acknowledged = ApiTypeHelper.requireNonNull(builder.acknowledged, this, "acknowledged"); - this.shardsAcknowledged = ApiTypeHelper.requireNonNull(builder.shardsAcknowledged, this, "shardsAcknowledged"); - this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices"); - - } - - public static AddBlockResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code acknowledged} - */ - public final boolean acknowledged() { - return this.acknowledged; - } - - /** - * Required - API name: {@code shards_acknowledged} - */ - public final boolean shardsAcknowledged() { - return this.shardsAcknowledged; - } - - /** - * Required - API name: {@code indices} - */ - public final List indices() { - return this.indices; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("acknowledged"); - generator.write(this.acknowledged); - - generator.writeKey("shards_acknowledged"); - generator.write(this.shardsAcknowledged); - - if (ApiTypeHelper.isDefined(this.indices)) { - generator.writeKey("indices"); - generator.writeStartArray(); - for (IndicesBlockStatus item0 : this.indices) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link AddBlockResponse}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Boolean acknowledged; - - private Boolean shardsAcknowledged; - - private List indices; - - /** - * Required - API name: {@code acknowledged} - */ - public final Builder acknowledged(boolean value) { - this.acknowledged = value; - return this; - } - - /** - * Required - API name: {@code shards_acknowledged} - */ - public final Builder shardsAcknowledged(boolean value) { - this.shardsAcknowledged = value; - return this; - } - - /** - * Required - API name: {@code indices} - *

- * Adds all elements of list to indices. - */ - public final Builder indices(List list) { - this.indices = _listAddAll(this.indices, list); - return this; - } - - /** - * Required - API name: {@code indices} - *

- * Adds one or more values to indices. - */ - public final Builder indices(IndicesBlockStatus value, IndicesBlockStatus... values) { - this.indices = _listAdd(this.indices, value, values); - return this; - } - - /** - * Required - API name: {@code indices} - *

- * Adds a value to indices using a builder lambda. - */ - public final Builder indices(Function> fn) { - return indices(fn.apply(new IndicesBlockStatus.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link AddBlockResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public AddBlockResponse build() { - _checkSingleUse(); - - return new AddBlockResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link AddBlockResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - AddBlockResponse::setupAddBlockResponseDeserializer); - - protected static void setupAddBlockResponseDeserializer(ObjectDeserializer op) { - - op.add(Builder::acknowledged, JsonpDeserializer.booleanDeserializer(), "acknowledged"); - op.add(Builder::shardsAcknowledged, JsonpDeserializer.booleanDeserializer(), "shards_acknowledged"); - op.add(Builder::indices, JsonpDeserializer.arrayDeserializer(IndicesBlockStatus._DESERIALIZER), "indices"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/Alias.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/Alias.java deleted file mode 100644 index 8c0790e01..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/Alias.java +++ /dev/null @@ -1,344 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.query_dsl.Query; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.Alias - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class Alias implements JsonpSerializable { - @Nullable - private final Query filter; - - @Nullable - private final String indexRouting; - - @Nullable - private final Boolean isHidden; - - @Nullable - private final Boolean isWriteIndex; - - @Nullable - private final String routing; - - @Nullable - private final String searchRouting; - - // --------------------------------------------------------------------------------------------- - - private Alias(Builder builder) { - - this.filter = builder.filter; - this.indexRouting = builder.indexRouting; - this.isHidden = builder.isHidden; - this.isWriteIndex = builder.isWriteIndex; - this.routing = builder.routing; - this.searchRouting = builder.searchRouting; - - } - - public static Alias of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Query used to limit documents the alias can access. - *

- * API name: {@code filter} - */ - @Nullable - public final Query filter() { - return this.filter; - } - - /** - * Value used to route indexing operations to a specific shard. If specified, - * this overwrites the routing value for indexing operations. - *

- * API name: {@code index_routing} - */ - @Nullable - public final String indexRouting() { - return this.indexRouting; - } - - /** - * If true, the alias is hidden. All indices for the alias must - * have the same is_hidden value. - *

- * API name: {@code is_hidden} - */ - @Nullable - public final Boolean isHidden() { - return this.isHidden; - } - - /** - * If true, the index is the write index for the alias. - *

- * API name: {@code is_write_index} - */ - @Nullable - public final Boolean isWriteIndex() { - return this.isWriteIndex; - } - - /** - * Value used to route indexing and search operations to a specific shard. - *

- * API name: {@code routing} - */ - @Nullable - public final String routing() { - return this.routing; - } - - /** - * Value used to route search operations to a specific shard. If specified, this - * overwrites the routing value for search operations. - *

- * API name: {@code search_routing} - */ - @Nullable - public final String searchRouting() { - return this.searchRouting; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.filter != null) { - generator.writeKey("filter"); - this.filter.serialize(generator, mapper); - - } - if (this.indexRouting != null) { - generator.writeKey("index_routing"); - generator.write(this.indexRouting); - - } - if (this.isHidden != null) { - generator.writeKey("is_hidden"); - generator.write(this.isHidden); - - } - if (this.isWriteIndex != null) { - generator.writeKey("is_write_index"); - generator.write(this.isWriteIndex); - - } - if (this.routing != null) { - generator.writeKey("routing"); - generator.write(this.routing); - - } - if (this.searchRouting != null) { - generator.writeKey("search_routing"); - generator.write(this.searchRouting); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link Alias}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private Query filter; - - @Nullable - private String indexRouting; - - @Nullable - private Boolean isHidden; - - @Nullable - private Boolean isWriteIndex; - - @Nullable - private String routing; - - @Nullable - private String searchRouting; - - /** - * Query used to limit documents the alias can access. - *

- * API name: {@code filter} - */ - public final Builder filter(@Nullable Query value) { - this.filter = value; - return this; - } - - /** - * Query used to limit documents the alias can access. - *

- * API name: {@code filter} - */ - public final Builder filter(Function> fn) { - return this.filter(fn.apply(new Query.Builder()).build()); - } - - /** - * Value used to route indexing operations to a specific shard. If specified, - * this overwrites the routing value for indexing operations. - *

- * API name: {@code index_routing} - */ - public final Builder indexRouting(@Nullable String value) { - this.indexRouting = value; - return this; - } - - /** - * If true, the alias is hidden. All indices for the alias must - * have the same is_hidden value. - *

- * API name: {@code is_hidden} - */ - public final Builder isHidden(@Nullable Boolean value) { - this.isHidden = value; - return this; - } - - /** - * If true, the index is the write index for the alias. - *

- * API name: {@code is_write_index} - */ - public final Builder isWriteIndex(@Nullable Boolean value) { - this.isWriteIndex = value; - return this; - } - - /** - * Value used to route indexing and search operations to a specific shard. - *

- * API name: {@code routing} - */ - public final Builder routing(@Nullable String value) { - this.routing = value; - return this; - } - - /** - * Value used to route search operations to a specific shard. If specified, this - * overwrites the routing value for search operations. - *

- * API name: {@code search_routing} - */ - public final Builder searchRouting(@Nullable String value) { - this.searchRouting = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link Alias}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public Alias build() { - _checkSingleUse(); - - return new Alias(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link Alias} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - Alias::setupAliasDeserializer); - - protected static void setupAliasDeserializer(ObjectDeserializer op) { - - op.add(Builder::filter, Query._DESERIALIZER, "filter"); - op.add(Builder::indexRouting, JsonpDeserializer.stringDeserializer(), "index_routing"); - op.add(Builder::isHidden, JsonpDeserializer.booleanDeserializer(), "is_hidden"); - op.add(Builder::isWriteIndex, JsonpDeserializer.booleanDeserializer(), "is_write_index"); - op.add(Builder::routing, JsonpDeserializer.stringDeserializer(), "routing"); - op.add(Builder::searchRouting, JsonpDeserializer.stringDeserializer(), "search_routing"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/AliasDefinition.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/AliasDefinition.java deleted file mode 100644 index 85365490e..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/AliasDefinition.java +++ /dev/null @@ -1,344 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.query_dsl.Query; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.AliasDefinition - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class AliasDefinition implements JsonpSerializable { - @Nullable - private final Query filter; - - @Nullable - private final String indexRouting; - - @Nullable - private final Boolean isWriteIndex; - - @Nullable - private final String routing; - - @Nullable - private final String searchRouting; - - @Nullable - private final Boolean isHidden; - - // --------------------------------------------------------------------------------------------- - - private AliasDefinition(Builder builder) { - - this.filter = builder.filter; - this.indexRouting = builder.indexRouting; - this.isWriteIndex = builder.isWriteIndex; - this.routing = builder.routing; - this.searchRouting = builder.searchRouting; - this.isHidden = builder.isHidden; - - } - - public static AliasDefinition of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Query used to limit documents the alias can access. - *

- * API name: {@code filter} - */ - @Nullable - public final Query filter() { - return this.filter; - } - - /** - * Value used to route indexing operations to a specific shard. If specified, - * this overwrites the routing value for indexing operations. - *

- * API name: {@code index_routing} - */ - @Nullable - public final String indexRouting() { - return this.indexRouting; - } - - /** - * If true, the index is the write index for the alias. - *

- * API name: {@code is_write_index} - */ - @Nullable - public final Boolean isWriteIndex() { - return this.isWriteIndex; - } - - /** - * Value used to route indexing and search operations to a specific shard. - *

- * API name: {@code routing} - */ - @Nullable - public final String routing() { - return this.routing; - } - - /** - * Value used to route search operations to a specific shard. If specified, this - * overwrites the routing value for search operations. - *

- * API name: {@code search_routing} - */ - @Nullable - public final String searchRouting() { - return this.searchRouting; - } - - /** - * If true, the alias is hidden. All indices for the alias must - * have the same is_hidden value. - *

- * API name: {@code is_hidden} - */ - @Nullable - public final Boolean isHidden() { - return this.isHidden; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.filter != null) { - generator.writeKey("filter"); - this.filter.serialize(generator, mapper); - - } - if (this.indexRouting != null) { - generator.writeKey("index_routing"); - generator.write(this.indexRouting); - - } - if (this.isWriteIndex != null) { - generator.writeKey("is_write_index"); - generator.write(this.isWriteIndex); - - } - if (this.routing != null) { - generator.writeKey("routing"); - generator.write(this.routing); - - } - if (this.searchRouting != null) { - generator.writeKey("search_routing"); - generator.write(this.searchRouting); - - } - if (this.isHidden != null) { - generator.writeKey("is_hidden"); - generator.write(this.isHidden); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link AliasDefinition}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private Query filter; - - @Nullable - private String indexRouting; - - @Nullable - private Boolean isWriteIndex; - - @Nullable - private String routing; - - @Nullable - private String searchRouting; - - @Nullable - private Boolean isHidden; - - /** - * Query used to limit documents the alias can access. - *

- * API name: {@code filter} - */ - public final Builder filter(@Nullable Query value) { - this.filter = value; - return this; - } - - /** - * Query used to limit documents the alias can access. - *

- * API name: {@code filter} - */ - public final Builder filter(Function> fn) { - return this.filter(fn.apply(new Query.Builder()).build()); - } - - /** - * Value used to route indexing operations to a specific shard. If specified, - * this overwrites the routing value for indexing operations. - *

- * API name: {@code index_routing} - */ - public final Builder indexRouting(@Nullable String value) { - this.indexRouting = value; - return this; - } - - /** - * If true, the index is the write index for the alias. - *

- * API name: {@code is_write_index} - */ - public final Builder isWriteIndex(@Nullable Boolean value) { - this.isWriteIndex = value; - return this; - } - - /** - * Value used to route indexing and search operations to a specific shard. - *

- * API name: {@code routing} - */ - public final Builder routing(@Nullable String value) { - this.routing = value; - return this; - } - - /** - * Value used to route search operations to a specific shard. If specified, this - * overwrites the routing value for search operations. - *

- * API name: {@code search_routing} - */ - public final Builder searchRouting(@Nullable String value) { - this.searchRouting = value; - return this; - } - - /** - * If true, the alias is hidden. All indices for the alias must - * have the same is_hidden value. - *

- * API name: {@code is_hidden} - */ - public final Builder isHidden(@Nullable Boolean value) { - this.isHidden = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link AliasDefinition}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public AliasDefinition build() { - _checkSingleUse(); - - return new AliasDefinition(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link AliasDefinition} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - AliasDefinition::setupAliasDefinitionDeserializer); - - protected static void setupAliasDefinitionDeserializer(ObjectDeserializer op) { - - op.add(Builder::filter, Query._DESERIALIZER, "filter"); - op.add(Builder::indexRouting, JsonpDeserializer.stringDeserializer(), "index_routing"); - op.add(Builder::isWriteIndex, JsonpDeserializer.booleanDeserializer(), "is_write_index"); - op.add(Builder::routing, JsonpDeserializer.stringDeserializer(), "routing"); - op.add(Builder::searchRouting, JsonpDeserializer.stringDeserializer(), "search_routing"); - op.add(Builder::isHidden, JsonpDeserializer.booleanDeserializer(), "is_hidden"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/AnalyzeRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/AnalyzeRequest.java deleted file mode 100644 index a53cc84ad..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/AnalyzeRequest.java +++ /dev/null @@ -1,646 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.analysis.CharFilter; -import co.elastic.clients.elasticsearch._types.analysis.TokenFilter; -import co.elastic.clients.elasticsearch._types.analysis.Tokenizer; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.analyze.Request - -/** - * Performs analysis on a text string and returns the resulting tokens. - * - * @see API - * specification - */ -@JsonpDeserializable -public class AnalyzeRequest extends RequestBase implements JsonpSerializable { - @Nullable - private final String analyzer; - - private final List attributes; - - private final List charFilter; - - @Nullable - private final Boolean explain; - - @Nullable - private final String field; - - private final List filter; - - @Nullable - private final String index; - - @Nullable - private final String normalizer; - - private final List text; - - @Nullable - private final Tokenizer tokenizer; - - // --------------------------------------------------------------------------------------------- - - private AnalyzeRequest(Builder builder) { - - this.analyzer = builder.analyzer; - this.attributes = ApiTypeHelper.unmodifiable(builder.attributes); - this.charFilter = ApiTypeHelper.unmodifiable(builder.charFilter); - this.explain = builder.explain; - this.field = builder.field; - this.filter = ApiTypeHelper.unmodifiable(builder.filter); - this.index = builder.index; - this.normalizer = builder.normalizer; - this.text = ApiTypeHelper.unmodifiable(builder.text); - this.tokenizer = builder.tokenizer; - - } - - public static AnalyzeRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code analyzer} - */ - @Nullable - public final String analyzer() { - return this.analyzer; - } - - /** - * Array of token attributes used to filter the output of the - * explain parameter. - *

- * API name: {@code attributes} - */ - public final List attributes() { - return this.attributes; - } - - /** - * Array of character filters used to preprocess characters before the - * tokenizer. - *

- * API name: {@code char_filter} - */ - public final List charFilter() { - return this.charFilter; - } - - /** - * If true, the response includes token attributes and additional - * details. - *

- * API name: {@code explain} - */ - @Nullable - public final Boolean explain() { - return this.explain; - } - - /** - * Field used to derive the analyzer. To use this parameter, you must specify an - * index. If specified, the analyzer parameter overrides this - * value. - *

- * API name: {@code field} - */ - @Nullable - public final String field() { - return this.field; - } - - /** - * Array of token filters used to apply after the tokenizer. - *

- * API name: {@code filter} - */ - public final List filter() { - return this.filter; - } - - /** - * 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. - *

- * API name: {@code index} - */ - @Nullable - public final String index() { - return this.index; - } - - /** - * Normalizer to use to convert text into a single token. - *

- * API name: {@code normalizer} - */ - @Nullable - public final String normalizer() { - return this.normalizer; - } - - /** - * Text to analyze. If an array of strings is provided, it is analyzed as a - * multi-value field. - *

- * API name: {@code text} - */ - public final List text() { - return this.text; - } - - /** - * Tokenizer to use to convert text into tokens. - *

- * API name: {@code tokenizer} - */ - @Nullable - public final Tokenizer tokenizer() { - return this.tokenizer; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.analyzer != null) { - generator.writeKey("analyzer"); - generator.write(this.analyzer); - - } - if (ApiTypeHelper.isDefined(this.attributes)) { - generator.writeKey("attributes"); - generator.writeStartArray(); - for (String item0 : this.attributes) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.charFilter)) { - generator.writeKey("char_filter"); - generator.writeStartArray(); - for (CharFilter item0 : this.charFilter) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.explain != null) { - generator.writeKey("explain"); - generator.write(this.explain); - - } - if (this.field != null) { - generator.writeKey("field"); - generator.write(this.field); - - } - if (ApiTypeHelper.isDefined(this.filter)) { - generator.writeKey("filter"); - generator.writeStartArray(); - for (TokenFilter item0 : this.filter) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.normalizer != null) { - generator.writeKey("normalizer"); - generator.write(this.normalizer); - - } - if (ApiTypeHelper.isDefined(this.text)) { - generator.writeKey("text"); - generator.writeStartArray(); - for (String item0 : this.text) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (this.tokenizer != null) { - generator.writeKey("tokenizer"); - this.tokenizer.serialize(generator, mapper); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link AnalyzeRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { - @Nullable - private String analyzer; - - @Nullable - private List attributes; - - @Nullable - private List charFilter; - - @Nullable - private Boolean explain; - - @Nullable - private String field; - - @Nullable - private List filter; - - @Nullable - private String index; - - @Nullable - private String normalizer; - - @Nullable - private List text; - - @Nullable - private Tokenizer tokenizer; - - /** - * 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. - *

- * API name: {@code analyzer} - */ - public final Builder analyzer(@Nullable String value) { - this.analyzer = value; - return this; - } - - /** - * Array of token attributes used to filter the output of the - * explain parameter. - *

- * API name: {@code attributes} - *

- * Adds all elements of list to attributes. - */ - public final Builder attributes(List list) { - this.attributes = _listAddAll(this.attributes, list); - return this; - } - - /** - * Array of token attributes used to filter the output of the - * explain parameter. - *

- * API name: {@code attributes} - *

- * Adds one or more values to attributes. - */ - public final Builder attributes(String value, String... values) { - this.attributes = _listAdd(this.attributes, value, values); - return this; - } - - /** - * Array of character filters used to preprocess characters before the - * tokenizer. - *

- * API name: {@code char_filter} - *

- * Adds all elements of list to charFilter. - */ - public final Builder charFilter(List list) { - this.charFilter = _listAddAll(this.charFilter, list); - return this; - } - - /** - * Array of character filters used to preprocess characters before the - * tokenizer. - *

- * API name: {@code char_filter} - *

- * Adds one or more values to charFilter. - */ - public final Builder charFilter(CharFilter value, CharFilter... values) { - this.charFilter = _listAdd(this.charFilter, value, values); - return this; - } - - /** - * Array of character filters used to preprocess characters before the - * tokenizer. - *

- * API name: {@code char_filter} - *

- * Adds a value to charFilter using a builder lambda. - */ - public final Builder charFilter(Function> fn) { - return charFilter(fn.apply(new CharFilter.Builder()).build()); - } - - /** - * If true, the response includes token attributes and additional - * details. - *

- * API name: {@code explain} - */ - public final Builder explain(@Nullable Boolean value) { - this.explain = 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. - *

- * API name: {@code field} - */ - public final Builder field(@Nullable String value) { - this.field = value; - return this; - } - - /** - * Array of token filters used to apply after the tokenizer. - *

- * API name: {@code filter} - *

- * Adds all elements of list to filter. - */ - public final Builder filter(List list) { - this.filter = _listAddAll(this.filter, list); - return this; - } - - /** - * Array of token filters used to apply after the tokenizer. - *

- * API name: {@code filter} - *

- * Adds one or more values to filter. - */ - public final Builder filter(TokenFilter value, TokenFilter... values) { - this.filter = _listAdd(this.filter, value, values); - return this; - } - - /** - * Array of token filters used to apply after the tokenizer. - *

- * API name: {@code filter} - *

- * Adds a value to filter using a builder lambda. - */ - public final Builder filter(Function> fn) { - return filter(fn.apply(new TokenFilter.Builder()).build()); - } - - /** - * 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. - *

- * API name: {@code index} - */ - public final Builder index(@Nullable String value) { - this.index = value; - return this; - } - - /** - * Normalizer to use to convert text into a single token. - *

- * API name: {@code normalizer} - */ - public final Builder normalizer(@Nullable String value) { - this.normalizer = value; - return this; - } - - /** - * Text to analyze. If an array of strings is provided, it is analyzed as a - * multi-value field. - *

- * API name: {@code text} - *

- * Adds all elements of list to text. - */ - public final Builder text(List list) { - this.text = _listAddAll(this.text, list); - return this; - } - - /** - * Text to analyze. If an array of strings is provided, it is analyzed as a - * multi-value field. - *

- * API name: {@code text} - *

- * Adds one or more values to text. - */ - public final Builder text(String value, String... values) { - this.text = _listAdd(this.text, value, values); - return this; - } - - /** - * Tokenizer to use to convert text into tokens. - *

- * API name: {@code tokenizer} - */ - public final Builder tokenizer(@Nullable Tokenizer value) { - this.tokenizer = value; - return this; - } - - /** - * Tokenizer to use to convert text into tokens. - *

- * API name: {@code tokenizer} - */ - public final Builder tokenizer(Function> fn) { - return this.tokenizer(fn.apply(new Tokenizer.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link AnalyzeRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public AnalyzeRequest build() { - _checkSingleUse(); - - return new AnalyzeRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link AnalyzeRequest} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - AnalyzeRequest::setupAnalyzeRequestDeserializer); - - protected static void setupAnalyzeRequestDeserializer(ObjectDeserializer op) { - - op.add(Builder::analyzer, JsonpDeserializer.stringDeserializer(), "analyzer"); - op.add(Builder::attributes, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "attributes"); - op.add(Builder::charFilter, JsonpDeserializer.arrayDeserializer(CharFilter._DESERIALIZER), "char_filter"); - op.add(Builder::explain, JsonpDeserializer.booleanDeserializer(), "explain"); - op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); - op.add(Builder::filter, JsonpDeserializer.arrayDeserializer(TokenFilter._DESERIALIZER), "filter"); - op.add(Builder::normalizer, JsonpDeserializer.stringDeserializer(), "normalizer"); - op.add(Builder::text, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "text"); - op.add(Builder::tokenizer, Tokenizer._DESERIALIZER, "tokenizer"); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.analyze}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.analyze", - - // Request method - request -> { - return "POST"; - - }, - - // Request path - request -> { - final int _index = 1 << 0; - - int propsSet = 0; - - if (request.index() != null) - propsSet |= _index; - - if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_analyze"); - return buf.toString(); - } - if (propsSet == (_index)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index, buf); - buf.append("/_analyze"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _index = 1 << 0; - - int propsSet = 0; - - if (request.index() != null) - propsSet |= _index; - - if (propsSet == 0) { - } - if (propsSet == (_index)) { - params.put("index", request.index); - } - return params; - }, - - // Request parameters - request -> { - return Collections.emptyMap(); - - }, SimpleEndpoint.emptyMap(), true, AnalyzeResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/AnalyzeResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/AnalyzeResponse.java deleted file mode 100644 index dc61d9e70..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/AnalyzeResponse.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch.indices.analyze.AnalyzeDetail; -import co.elastic.clients.elasticsearch.indices.analyze.AnalyzeToken; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.analyze.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class AnalyzeResponse implements JsonpSerializable { - @Nullable - private final AnalyzeDetail detail; - - private final List tokens; - - // --------------------------------------------------------------------------------------------- - - private AnalyzeResponse(Builder builder) { - - this.detail = builder.detail; - this.tokens = ApiTypeHelper.unmodifiable(builder.tokens); - - } - - public static AnalyzeResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code detail} - */ - @Nullable - public final AnalyzeDetail detail() { - return this.detail; - } - - /** - * API name: {@code tokens} - */ - public final List tokens() { - return this.tokens; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.detail != null) { - generator.writeKey("detail"); - this.detail.serialize(generator, mapper); - - } - if (ApiTypeHelper.isDefined(this.tokens)) { - generator.writeKey("tokens"); - generator.writeStartArray(); - for (AnalyzeToken item0 : this.tokens) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link AnalyzeResponse}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private AnalyzeDetail detail; - - @Nullable - private List tokens; - - /** - * API name: {@code detail} - */ - public final Builder detail(@Nullable AnalyzeDetail value) { - this.detail = value; - return this; - } - - /** - * API name: {@code detail} - */ - public final Builder detail(Function> fn) { - return this.detail(fn.apply(new AnalyzeDetail.Builder()).build()); - } - - /** - * API name: {@code tokens} - *

- * Adds all elements of list to tokens. - */ - public final Builder tokens(List list) { - this.tokens = _listAddAll(this.tokens, list); - return this; - } - - /** - * API name: {@code tokens} - *

- * Adds one or more values to tokens. - */ - public final Builder tokens(AnalyzeToken value, AnalyzeToken... values) { - this.tokens = _listAdd(this.tokens, value, values); - return this; - } - - /** - * API name: {@code tokens} - *

- * Adds a value to tokens using a builder lambda. - */ - public final Builder tokens(Function> fn) { - return tokens(fn.apply(new AnalyzeToken.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link AnalyzeResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public AnalyzeResponse build() { - _checkSingleUse(); - - return new AnalyzeResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link AnalyzeResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - AnalyzeResponse::setupAnalyzeResponseDeserializer); - - protected static void setupAnalyzeResponseDeserializer(ObjectDeserializer op) { - - op.add(Builder::detail, AnalyzeDetail._DESERIALIZER, "detail"); - op.add(Builder::tokens, JsonpDeserializer.arrayDeserializer(AnalyzeToken._DESERIALIZER), "tokens"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/CacheQueries.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/CacheQueries.java deleted file mode 100644 index e8e882782..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/CacheQueries.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.CacheQueries - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class CacheQueries implements JsonpSerializable { - private final boolean enabled; - - // --------------------------------------------------------------------------------------------- - - private CacheQueries(Builder builder) { - - this.enabled = ApiTypeHelper.requireNonNull(builder.enabled, this, "enabled"); - - } - - public static CacheQueries of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code enabled} - */ - public final boolean enabled() { - return this.enabled; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("enabled"); - generator.write(this.enabled); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link CacheQueries}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Boolean enabled; - - /** - * Required - API name: {@code enabled} - */ - public final Builder enabled(boolean value) { - this.enabled = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link CacheQueries}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public CacheQueries build() { - _checkSingleUse(); - - return new CacheQueries(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link CacheQueries} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - CacheQueries::setupCacheQueriesDeserializer); - - protected static void setupCacheQueriesDeserializer(ObjectDeserializer op) { - - op.add(Builder::enabled, JsonpDeserializer.booleanDeserializer(), "enabled"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/CreateDataStreamRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/CreateDataStreamRequest.java deleted file mode 100644 index a93f1bbe0..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/CreateDataStreamRequest.java +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.create_data_stream.Request - -/** - * Create a data stream. Creates a data stream. You must have a matching index - * template with data stream enabled. - * - * @see API - * specification - */ - -public class CreateDataStreamRequest extends RequestBase { - @Nullable - private final Time masterTimeout; - - private final String name; - - @Nullable - private final Time timeout; - - // --------------------------------------------------------------------------------------------- - - private CreateDataStreamRequest(Builder builder) { - - this.masterTimeout = builder.masterTimeout; - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.timeout = builder.timeout; - - } - - public static CreateDataStreamRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * Required - 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. - *

- * API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. - *

- * API name: {@code timeout} - */ - @Nullable - public final Time timeout() { - return this.timeout; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link CreateDataStreamRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private Time masterTimeout; - - private String name; - - @Nullable - private Time 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Required - 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. - *

- * API name: {@code name} - */ - public final Builder name(String value) { - this.name = 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. - *

- * API name: {@code timeout} - */ - public final Builder timeout(@Nullable Time value) { - this.timeout = 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. - *

- * API name: {@code timeout} - */ - public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link CreateDataStreamRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public CreateDataStreamRequest build() { - _checkSingleUse(); - - return new CreateDataStreamRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.create_data_stream}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.create_data_stream", - - // Request method - request -> { - return "PUT"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_data_stream"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - params.put("name", request.name); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (request.timeout != null) { - params.put("timeout", request.timeout._toJsonString()); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, CreateDataStreamResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/CreateDataStreamResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/CreateDataStreamResponse.java deleted file mode 100644 index 9b5e2b043..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/CreateDataStreamResponse.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.create_data_stream.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class CreateDataStreamResponse extends AcknowledgedResponseBase { - // --------------------------------------------------------------------------------------------- - - private CreateDataStreamResponse(Builder builder) { - super(builder); - - } - - public static CreateDataStreamResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link CreateDataStreamResponse}. - */ - - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder - implements - ObjectBuilder { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link CreateDataStreamResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public CreateDataStreamResponse build() { - _checkSingleUse(); - - return new CreateDataStreamResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link CreateDataStreamResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, CreateDataStreamResponse::setupCreateDataStreamResponseDeserializer); - - protected static void setupCreateDataStreamResponseDeserializer( - ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/CreateIndexRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/CreateIndexRequest.java deleted file mode 100644 index 1a9e5011e..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/CreateIndexRequest.java +++ /dev/null @@ -1,503 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.elasticsearch._types.WaitForActiveShards; -import co.elastic.clients.elasticsearch._types.mapping.TypeMapping; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.create.Request - -/** - * Create an index. Creates a new index. - * - * @see API - * specification - */ -@JsonpDeserializable -public class CreateIndexRequest extends RequestBase implements JsonpSerializable { - private final Map aliases; - - private final String index; - - @Nullable - private final TypeMapping mappings; - - @Nullable - private final Time masterTimeout; - - @Nullable - private final IndexSettings settings; - - @Nullable - private final Time timeout; - - @Nullable - private final WaitForActiveShards waitForActiveShards; - - // --------------------------------------------------------------------------------------------- - - private CreateIndexRequest(Builder builder) { - - this.aliases = ApiTypeHelper.unmodifiable(builder.aliases); - this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); - this.mappings = builder.mappings; - this.masterTimeout = builder.masterTimeout; - this.settings = builder.settings; - this.timeout = builder.timeout; - this.waitForActiveShards = builder.waitForActiveShards; - - } - - public static CreateIndexRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Aliases for the index. - *

- * API name: {@code aliases} - */ - public final Map aliases() { - return this.aliases; - } - - /** - * Required - Name of the index you wish to create. - *

- * API name: {@code index} - */ - public final String index() { - return this.index; - } - - /** - * Mapping for fields in the index. If specified, this mapping can include: - *

    - *
  • Field names
  • - *
  • Field data types
  • - *
  • Mapping parameters
  • - *
- *

- * API name: {@code mappings} - */ - @Nullable - public final TypeMapping mappings() { - return this.mappings; - } - - /** - * 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. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * Configuration options for the index. - *

- * API name: {@code settings} - */ - @Nullable - public final IndexSettings settings() { - return this.settings; - } - - /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. - *

- * API name: {@code timeout} - */ - @Nullable - public final Time timeout() { - return this.timeout; - } - - /** - * 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). - *

- * API name: {@code wait_for_active_shards} - */ - @Nullable - public final WaitForActiveShards waitForActiveShards() { - return this.waitForActiveShards; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.aliases)) { - generator.writeKey("aliases"); - generator.writeStartObject(); - for (Map.Entry item0 : this.aliases.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.mappings != null) { - generator.writeKey("mappings"); - this.mappings.serialize(generator, mapper); - - } - if (this.settings != null) { - generator.writeKey("settings"); - this.settings.serialize(generator, mapper); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link CreateIndexRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private Map aliases; - - private String index; - - @Nullable - private TypeMapping mappings; - - @Nullable - private Time masterTimeout; - - @Nullable - private IndexSettings settings; - - @Nullable - private Time timeout; - - @Nullable - private WaitForActiveShards waitForActiveShards; - - /** - * Aliases for the index. - *

- * API name: {@code aliases} - *

- * Adds all entries of map to aliases. - */ - public final Builder aliases(Map map) { - this.aliases = _mapPutAll(this.aliases, map); - return this; - } - - /** - * Aliases for the index. - *

- * API name: {@code aliases} - *

- * Adds an entry to aliases. - */ - public final Builder aliases(String key, Alias value) { - this.aliases = _mapPut(this.aliases, key, value); - return this; - } - - /** - * Aliases for the index. - *

- * API name: {@code aliases} - *

- * Adds an entry to aliases using a builder lambda. - */ - public final Builder aliases(String key, Function> fn) { - return aliases(key, fn.apply(new Alias.Builder()).build()); - } - - /** - * Required - Name of the index you wish to create. - *

- * API name: {@code index} - */ - public final Builder index(String value) { - this.index = value; - return this; - } - - /** - * Mapping for fields in the index. If specified, this mapping can include: - *

    - *
  • Field names
  • - *
  • Field data types
  • - *
  • Mapping parameters
  • - *
- *

- * API name: {@code mappings} - */ - public final Builder mappings(@Nullable TypeMapping value) { - this.mappings = value; - return this; - } - - /** - * Mapping for fields in the index. If specified, this mapping can include: - *

    - *
  • Field names
  • - *
  • Field data types
  • - *
  • Mapping parameters
  • - *
- *

- * API name: {@code mappings} - */ - public final Builder mappings(Function> fn) { - return this.mappings(fn.apply(new TypeMapping.Builder()).build()); - } - - /** - * 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Configuration options for the index. - *

- * API name: {@code settings} - */ - public final Builder settings(@Nullable IndexSettings value) { - this.settings = value; - return this; - } - - /** - * Configuration options for the index. - *

- * API name: {@code settings} - */ - public final Builder settings(Function> fn) { - return this.settings(fn.apply(new IndexSettings.Builder()).build()); - } - - /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. - *

- * API name: {@code timeout} - */ - public final Builder timeout(@Nullable Time value) { - this.timeout = 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. - *

- * API name: {@code timeout} - */ - public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); - } - - /** - * 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). - *

- * API name: {@code wait_for_active_shards} - */ - public final Builder waitForActiveShards(@Nullable WaitForActiveShards value) { - this.waitForActiveShards = 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). - *

- * API name: {@code wait_for_active_shards} - */ - public final Builder waitForActiveShards( - Function> fn) { - return this.waitForActiveShards(fn.apply(new WaitForActiveShards.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link CreateIndexRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public CreateIndexRequest build() { - _checkSingleUse(); - - return new CreateIndexRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link CreateIndexRequest} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, CreateIndexRequest::setupCreateIndexRequestDeserializer); - - protected static void setupCreateIndexRequestDeserializer(ObjectDeserializer op) { - - op.add(Builder::aliases, JsonpDeserializer.stringMapDeserializer(Alias._DESERIALIZER), "aliases"); - op.add(Builder::mappings, TypeMapping._DESERIALIZER, "mappings"); - op.add(Builder::settings, IndexSettings._DESERIALIZER, "settings"); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.create}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.create", - - // Request method - request -> { - return "PUT"; - - }, - - // Request path - request -> { - final int _index = 1 << 0; - - int propsSet = 0; - - propsSet |= _index; - - if (propsSet == (_index)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _index = 1 << 0; - - int propsSet = 0; - - propsSet |= _index; - - if (propsSet == (_index)) { - params.put("index", request.index); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (request.waitForActiveShards != null) { - params.put("wait_for_active_shards", request.waitForActiveShards._toJsonString()); - } - if (request.timeout != null) { - params.put("timeout", request.timeout._toJsonString()); - } - return params; - - }, SimpleEndpoint.emptyMap(), true, CreateIndexResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/CreateIndexResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/CreateIndexResponse.java deleted file mode 100644 index 1eb6fe168..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/CreateIndexResponse.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.AcknowledgedResponse; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.create.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class CreateIndexResponse implements AcknowledgedResponse, JsonpSerializable { - private final String index; - - private final boolean shardsAcknowledged; - - private final boolean acknowledged; - - // --------------------------------------------------------------------------------------------- - - private CreateIndexResponse(Builder builder) { - - this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); - this.shardsAcknowledged = ApiTypeHelper.requireNonNull(builder.shardsAcknowledged, this, "shardsAcknowledged"); - this.acknowledged = ApiTypeHelper.requireNonNull(builder.acknowledged, this, "acknowledged"); - - } - - public static CreateIndexResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code index} - */ - public final String index() { - return this.index; - } - - /** - * Required - API name: {@code shards_acknowledged} - */ - public final boolean shardsAcknowledged() { - return this.shardsAcknowledged; - } - - /** - * Required - API name: {@code acknowledged} - */ - public final boolean acknowledged() { - return this.acknowledged; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("index"); - generator.write(this.index); - - generator.writeKey("shards_acknowledged"); - generator.write(this.shardsAcknowledged); - - generator.writeKey("acknowledged"); - generator.write(this.acknowledged); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link CreateIndexResponse}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private String index; - - private Boolean shardsAcknowledged; - - private Boolean acknowledged; - - /** - * Required - API name: {@code index} - */ - public final Builder index(String value) { - this.index = value; - return this; - } - - /** - * Required - API name: {@code shards_acknowledged} - */ - public final Builder shardsAcknowledged(boolean value) { - this.shardsAcknowledged = value; - return this; - } - - /** - * Required - API name: {@code acknowledged} - */ - public final Builder acknowledged(boolean value) { - this.acknowledged = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link CreateIndexResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public CreateIndexResponse build() { - _checkSingleUse(); - - return new CreateIndexResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link CreateIndexResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, CreateIndexResponse::setupCreateIndexResponseDeserializer); - - protected static void setupCreateIndexResponseDeserializer(ObjectDeserializer op) { - - op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); - op.add(Builder::shardsAcknowledged, JsonpDeserializer.booleanDeserializer(), "shards_acknowledged"); - op.add(Builder::acknowledged, JsonpDeserializer.booleanDeserializer(), "acknowledged"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStream.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStream.java deleted file mode 100644 index caedfe618..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStream.java +++ /dev/null @@ -1,775 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.HealthStatus; -import co.elastic.clients.json.JsonData; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Integer; -import java.lang.String; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.DataStream - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class DataStream implements JsonpSerializable { - private final Map meta; - - @Nullable - private final Boolean allowCustomRouting; - - @Nullable - private final FailureStore failureStore; - - private final int generation; - - private final boolean hidden; - - @Nullable - private final String ilmPolicy; - - private final ManagedBy nextGenerationManagedBy; - - private final boolean preferIlm; - - private final List indices; - - @Nullable - private final DataStreamLifecycleWithRollover lifecycle; - - private final String name; - - @Nullable - private final Boolean replicated; - - private final boolean rolloverOnWrite; - - private final HealthStatus status; - - @Nullable - private final Boolean system; - - private final String template; - - private final DataStreamTimestampField timestampField; - - // --------------------------------------------------------------------------------------------- - - private DataStream(Builder builder) { - - this.meta = ApiTypeHelper.unmodifiable(builder.meta); - this.allowCustomRouting = builder.allowCustomRouting; - this.failureStore = builder.failureStore; - this.generation = ApiTypeHelper.requireNonNull(builder.generation, this, "generation"); - this.hidden = ApiTypeHelper.requireNonNull(builder.hidden, this, "hidden"); - this.ilmPolicy = builder.ilmPolicy; - this.nextGenerationManagedBy = ApiTypeHelper.requireNonNull(builder.nextGenerationManagedBy, this, - "nextGenerationManagedBy"); - this.preferIlm = ApiTypeHelper.requireNonNull(builder.preferIlm, this, "preferIlm"); - this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices"); - this.lifecycle = builder.lifecycle; - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.replicated = builder.replicated; - this.rolloverOnWrite = ApiTypeHelper.requireNonNull(builder.rolloverOnWrite, this, "rolloverOnWrite"); - this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); - this.system = builder.system; - this.template = ApiTypeHelper.requireNonNull(builder.template, this, "template"); - this.timestampField = ApiTypeHelper.requireNonNull(builder.timestampField, this, "timestampField"); - - } - - public static DataStream of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Custom metadata for the stream, copied from the _meta object of - * the stream’s matching index template. If empty, the response omits this - * property. - *

- * API name: {@code _meta} - */ - public final Map meta() { - return this.meta; - } - - /** - * If true, the data stream allows custom routing on write request. - *

- * API name: {@code allow_custom_routing} - */ - @Nullable - public final Boolean allowCustomRouting() { - return this.allowCustomRouting; - } - - /** - * Information about failure store backing indices - *

- * API name: {@code failure_store} - */ - @Nullable - public final FailureStore failureStore() { - return this.failureStore; - } - - /** - * Required - Current generation for the data stream. This number acts as a - * cumulative count of the stream’s rollovers, starting at 1. - *

- * API name: {@code generation} - */ - public final int generation() { - return this.generation; - } - - /** - * Required - If true, the data stream is hidden. - *

- * API name: {@code hidden} - */ - public final boolean hidden() { - return this.hidden; - } - - /** - * Name of the current ILM lifecycle policy in the stream’s matching index - * template. This lifecycle policy is set in the - * index.lifecycle.name setting. If the template does not include a - * lifecycle policy, this property is not included in the response. 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. - *

- * API name: {@code ilm_policy} - */ - @Nullable - public final String ilmPolicy() { - return this.ilmPolicy; - } - - /** - * Required - Name of the lifecycle system that'll manage the next generation of - * the data stream. - *

- * API name: {@code next_generation_managed_by} - */ - public final ManagedBy nextGenerationManagedBy() { - return this.nextGenerationManagedBy; - } - - /** - * Required - Indicates if ILM should take precedence over DSL in case both are - * configured to managed this data stream. - *

- * API name: {@code prefer_ilm} - */ - public final boolean preferIlm() { - return this.preferIlm; - } - - /** - * Required - Array of objects containing information about the data stream’s - * backing indices. The last item in this array contains information about the - * stream’s current write index. - *

- * API name: {@code indices} - */ - public final List indices() { - return this.indices; - } - - /** - * Contains the configuration for the data stream lifecycle of this data stream. - *

- * API name: {@code lifecycle} - */ - @Nullable - public final DataStreamLifecycleWithRollover lifecycle() { - return this.lifecycle; - } - - /** - * Required - Name of the data stream. - *

- * API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * 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. - *

- * API name: {@code replicated} - */ - @Nullable - public final Boolean replicated() { - return this.replicated; - } - - /** - * Required - 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. - *

- * API name: {@code rollover_on_write} - */ - public final boolean rolloverOnWrite() { - return this.rolloverOnWrite; - } - - /** - * Required - Health status of the data stream. This health status is based on - * the state of the primary and replica shards of the stream’s backing indices. - *

- * API name: {@code status} - */ - public final HealthStatus status() { - return this.status; - } - - /** - * If true, the data stream is created and managed by an Elastic - * stack component and cannot be modified through normal user interaction. - *

- * API name: {@code system} - */ - @Nullable - public final Boolean system() { - return this.system; - } - - /** - * Required - Name of the index template used to create the data stream’s - * backing indices. The template’s index pattern must match the name of this - * data stream. - *

- * API name: {@code template} - */ - public final String template() { - return this.template; - } - - /** - * Required - Information about the @timestamp field in the data - * stream. - *

- * API name: {@code timestamp_field} - */ - public final DataStreamTimestampField timestampField() { - return this.timestampField; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.meta)) { - generator.writeKey("_meta"); - generator.writeStartObject(); - for (Map.Entry item0 : this.meta.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.allowCustomRouting != null) { - generator.writeKey("allow_custom_routing"); - generator.write(this.allowCustomRouting); - - } - if (this.failureStore != null) { - generator.writeKey("failure_store"); - this.failureStore.serialize(generator, mapper); - - } - generator.writeKey("generation"); - generator.write(this.generation); - - generator.writeKey("hidden"); - generator.write(this.hidden); - - if (this.ilmPolicy != null) { - generator.writeKey("ilm_policy"); - generator.write(this.ilmPolicy); - - } - generator.writeKey("next_generation_managed_by"); - this.nextGenerationManagedBy.serialize(generator, mapper); - generator.writeKey("prefer_ilm"); - generator.write(this.preferIlm); - - if (ApiTypeHelper.isDefined(this.indices)) { - generator.writeKey("indices"); - generator.writeStartArray(); - for (DataStreamIndex item0 : this.indices) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.lifecycle != null) { - generator.writeKey("lifecycle"); - this.lifecycle.serialize(generator, mapper); - - } - generator.writeKey("name"); - generator.write(this.name); - - if (this.replicated != null) { - generator.writeKey("replicated"); - generator.write(this.replicated); - - } - generator.writeKey("rollover_on_write"); - generator.write(this.rolloverOnWrite); - - generator.writeKey("status"); - this.status.serialize(generator, mapper); - if (this.system != null) { - generator.writeKey("system"); - generator.write(this.system); - - } - generator.writeKey("template"); - generator.write(this.template); - - generator.writeKey("timestamp_field"); - this.timestampField.serialize(generator, mapper); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DataStream}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private Map meta; - - @Nullable - private Boolean allowCustomRouting; - - @Nullable - private FailureStore failureStore; - - private Integer generation; - - private Boolean hidden; - - @Nullable - private String ilmPolicy; - - private ManagedBy nextGenerationManagedBy; - - private Boolean preferIlm; - - private List indices; - - @Nullable - private DataStreamLifecycleWithRollover lifecycle; - - private String name; - - @Nullable - private Boolean replicated; - - private Boolean rolloverOnWrite; - - private HealthStatus status; - - @Nullable - private Boolean system; - - private String template; - - private DataStreamTimestampField timestampField; - - /** - * Custom metadata for the stream, copied from the _meta object of - * the stream’s matching index template. If empty, the response omits this - * property. - *

- * API name: {@code _meta} - *

- * Adds all entries of map to meta. - */ - public final Builder meta(Map map) { - this.meta = _mapPutAll(this.meta, map); - return this; - } - - /** - * Custom metadata for the stream, copied from the _meta object of - * the stream’s matching index template. If empty, the response omits this - * property. - *

- * API name: {@code _meta} - *

- * Adds an entry to meta. - */ - public final Builder meta(String key, JsonData value) { - this.meta = _mapPut(this.meta, key, value); - return this; - } - - /** - * If true, the data stream allows custom routing on write request. - *

- * API name: {@code allow_custom_routing} - */ - public final Builder allowCustomRouting(@Nullable Boolean value) { - this.allowCustomRouting = value; - return this; - } - - /** - * Information about failure store backing indices - *

- * API name: {@code failure_store} - */ - public final Builder failureStore(@Nullable FailureStore value) { - this.failureStore = value; - return this; - } - - /** - * Information about failure store backing indices - *

- * API name: {@code failure_store} - */ - public final Builder failureStore(Function> fn) { - return this.failureStore(fn.apply(new FailureStore.Builder()).build()); - } - - /** - * Required - Current generation for the data stream. This number acts as a - * cumulative count of the stream’s rollovers, starting at 1. - *

- * API name: {@code generation} - */ - public final Builder generation(int value) { - this.generation = value; - return this; - } - - /** - * Required - If true, the data stream is hidden. - *

- * API name: {@code hidden} - */ - public final Builder hidden(boolean value) { - this.hidden = value; - return this; - } - - /** - * Name of the current ILM lifecycle policy in the stream’s matching index - * template. This lifecycle policy is set in the - * index.lifecycle.name setting. If the template does not include a - * lifecycle policy, this property is not included in the response. 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. - *

- * API name: {@code ilm_policy} - */ - public final Builder ilmPolicy(@Nullable String value) { - this.ilmPolicy = value; - return this; - } - - /** - * Required - Name of the lifecycle system that'll manage the next generation of - * the data stream. - *

- * API name: {@code next_generation_managed_by} - */ - public final Builder nextGenerationManagedBy(ManagedBy value) { - this.nextGenerationManagedBy = value; - return this; - } - - /** - * Required - Indicates if ILM should take precedence over DSL in case both are - * configured to managed this data stream. - *

- * API name: {@code prefer_ilm} - */ - public final Builder preferIlm(boolean value) { - this.preferIlm = value; - return this; - } - - /** - * Required - Array of objects containing information about the data stream’s - * backing indices. The last item in this array contains information about the - * stream’s current write index. - *

- * API name: {@code indices} - *

- * Adds all elements of list to indices. - */ - public final Builder indices(List list) { - this.indices = _listAddAll(this.indices, list); - return this; - } - - /** - * Required - Array of objects containing information about the data stream’s - * backing indices. The last item in this array contains information about the - * stream’s current write index. - *

- * API name: {@code indices} - *

- * Adds one or more values to indices. - */ - public final Builder indices(DataStreamIndex value, DataStreamIndex... values) { - this.indices = _listAdd(this.indices, value, values); - return this; - } - - /** - * Required - Array of objects containing information about the data stream’s - * backing indices. The last item in this array contains information about the - * stream’s current write index. - *

- * API name: {@code indices} - *

- * Adds a value to indices using a builder lambda. - */ - public final Builder indices(Function> fn) { - return indices(fn.apply(new DataStreamIndex.Builder()).build()); - } - - /** - * Contains the configuration for the data stream lifecycle of this data stream. - *

- * API name: {@code lifecycle} - */ - public final Builder lifecycle(@Nullable DataStreamLifecycleWithRollover value) { - this.lifecycle = value; - return this; - } - - /** - * Contains the configuration for the data stream lifecycle of this data stream. - *

- * API name: {@code lifecycle} - */ - public final Builder lifecycle( - Function> fn) { - return this.lifecycle(fn.apply(new DataStreamLifecycleWithRollover.Builder()).build()); - } - - /** - * Required - Name of the data stream. - *

- * API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * 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. - *

- * API name: {@code replicated} - */ - public final Builder replicated(@Nullable Boolean value) { - this.replicated = value; - return this; - } - - /** - * Required - 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. - *

- * API name: {@code rollover_on_write} - */ - public final Builder rolloverOnWrite(boolean value) { - this.rolloverOnWrite = value; - return this; - } - - /** - * Required - Health status of the data stream. This health status is based on - * the state of the primary and replica shards of the stream’s backing indices. - *

- * API name: {@code status} - */ - public final Builder status(HealthStatus value) { - this.status = value; - return this; - } - - /** - * If true, the data stream is created and managed by an Elastic - * stack component and cannot be modified through normal user interaction. - *

- * API name: {@code system} - */ - public final Builder system(@Nullable Boolean value) { - this.system = value; - return this; - } - - /** - * Required - Name of the index template used to create the data stream’s - * backing indices. The template’s index pattern must match the name of this - * data stream. - *

- * API name: {@code template} - */ - public final Builder template(String value) { - this.template = value; - return this; - } - - /** - * Required - Information about the @timestamp field in the data - * stream. - *

- * API name: {@code timestamp_field} - */ - public final Builder timestampField(DataStreamTimestampField value) { - this.timestampField = value; - return this; - } - - /** - * Required - Information about the @timestamp field in the data - * stream. - *

- * API name: {@code timestamp_field} - */ - public final Builder timestampField( - Function> fn) { - return this.timestampField(fn.apply(new DataStreamTimestampField.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DataStream}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DataStream build() { - _checkSingleUse(); - - return new DataStream(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DataStream} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - DataStream::setupDataStreamDeserializer); - - protected static void setupDataStreamDeserializer(ObjectDeserializer op) { - - op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta"); - op.add(Builder::allowCustomRouting, JsonpDeserializer.booleanDeserializer(), "allow_custom_routing"); - op.add(Builder::failureStore, FailureStore._DESERIALIZER, "failure_store"); - op.add(Builder::generation, JsonpDeserializer.integerDeserializer(), "generation"); - op.add(Builder::hidden, JsonpDeserializer.booleanDeserializer(), "hidden"); - op.add(Builder::ilmPolicy, JsonpDeserializer.stringDeserializer(), "ilm_policy"); - op.add(Builder::nextGenerationManagedBy, ManagedBy._DESERIALIZER, "next_generation_managed_by"); - op.add(Builder::preferIlm, JsonpDeserializer.booleanDeserializer(), "prefer_ilm"); - op.add(Builder::indices, JsonpDeserializer.arrayDeserializer(DataStreamIndex._DESERIALIZER), "indices"); - op.add(Builder::lifecycle, DataStreamLifecycleWithRollover._DESERIALIZER, "lifecycle"); - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::replicated, JsonpDeserializer.booleanDeserializer(), "replicated"); - op.add(Builder::rolloverOnWrite, JsonpDeserializer.booleanDeserializer(), "rollover_on_write"); - op.add(Builder::status, HealthStatus._DESERIALIZER, "status"); - op.add(Builder::system, JsonpDeserializer.booleanDeserializer(), "system"); - op.add(Builder::template, JsonpDeserializer.stringDeserializer(), "template"); - op.add(Builder::timestampField, DataStreamTimestampField._DESERIALIZER, "timestamp_field"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamIndex.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamIndex.java deleted file mode 100644 index 3e6e64506..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamIndex.java +++ /dev/null @@ -1,287 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.DataStreamIndex - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class DataStreamIndex implements JsonpSerializable { - private final String indexName; - - private final String indexUuid; - - @Nullable - private final String ilmPolicy; - - @Nullable - private final ManagedBy managedBy; - - @Nullable - private final Boolean preferIlm; - - // --------------------------------------------------------------------------------------------- - - private DataStreamIndex(Builder builder) { - - this.indexName = ApiTypeHelper.requireNonNull(builder.indexName, this, "indexName"); - this.indexUuid = ApiTypeHelper.requireNonNull(builder.indexUuid, this, "indexUuid"); - this.ilmPolicy = builder.ilmPolicy; - this.managedBy = builder.managedBy; - this.preferIlm = builder.preferIlm; - - } - - public static DataStreamIndex of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Name of the backing index. - *

- * API name: {@code index_name} - */ - public final String indexName() { - return this.indexName; - } - - /** - * Required - Universally unique identifier (UUID) for the index. - *

- * API name: {@code index_uuid} - */ - public final String indexUuid() { - return this.indexUuid; - } - - /** - * Name of the current ILM lifecycle policy configured for this backing index. - *

- * API name: {@code ilm_policy} - */ - @Nullable - public final String ilmPolicy() { - return this.ilmPolicy; - } - - /** - * Name of the lifecycle system that's currently managing this backing index. - *

- * API name: {@code managed_by} - */ - @Nullable - public final ManagedBy managedBy() { - return this.managedBy; - } - - /** - * Indicates if ILM should take precedence over DSL in case both are configured - * to manage this index. - *

- * API name: {@code prefer_ilm} - */ - @Nullable - public final Boolean preferIlm() { - return this.preferIlm; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("index_name"); - generator.write(this.indexName); - - generator.writeKey("index_uuid"); - generator.write(this.indexUuid); - - if (this.ilmPolicy != null) { - generator.writeKey("ilm_policy"); - generator.write(this.ilmPolicy); - - } - if (this.managedBy != null) { - generator.writeKey("managed_by"); - this.managedBy.serialize(generator, mapper); - } - if (this.preferIlm != null) { - generator.writeKey("prefer_ilm"); - generator.write(this.preferIlm); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DataStreamIndex}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private String indexName; - - private String indexUuid; - - @Nullable - private String ilmPolicy; - - @Nullable - private ManagedBy managedBy; - - @Nullable - private Boolean preferIlm; - - /** - * Required - Name of the backing index. - *

- * API name: {@code index_name} - */ - public final Builder indexName(String value) { - this.indexName = value; - return this; - } - - /** - * Required - Universally unique identifier (UUID) for the index. - *

- * API name: {@code index_uuid} - */ - public final Builder indexUuid(String value) { - this.indexUuid = value; - return this; - } - - /** - * Name of the current ILM lifecycle policy configured for this backing index. - *

- * API name: {@code ilm_policy} - */ - public final Builder ilmPolicy(@Nullable String value) { - this.ilmPolicy = value; - return this; - } - - /** - * Name of the lifecycle system that's currently managing this backing index. - *

- * API name: {@code managed_by} - */ - public final Builder managedBy(@Nullable ManagedBy value) { - this.managedBy = value; - return this; - } - - /** - * Indicates if ILM should take precedence over DSL in case both are configured - * to manage this index. - *

- * API name: {@code prefer_ilm} - */ - public final Builder preferIlm(@Nullable Boolean value) { - this.preferIlm = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DataStreamIndex}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DataStreamIndex build() { - _checkSingleUse(); - - return new DataStreamIndex(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DataStreamIndex} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - DataStreamIndex::setupDataStreamIndexDeserializer); - - protected static void setupDataStreamIndexDeserializer(ObjectDeserializer op) { - - op.add(Builder::indexName, JsonpDeserializer.stringDeserializer(), "index_name"); - op.add(Builder::indexUuid, JsonpDeserializer.stringDeserializer(), "index_uuid"); - op.add(Builder::ilmPolicy, JsonpDeserializer.stringDeserializer(), "ilm_policy"); - op.add(Builder::managedBy, ManagedBy._DESERIALIZER, "managed_by"); - op.add(Builder::preferIlm, JsonpDeserializer.booleanDeserializer(), "prefer_ilm"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamLifecycle.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamLifecycle.java deleted file mode 100644 index 7d8973e75..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamLifecycle.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.DataStreamLifecycle - -/** - * Data stream lifecycle denotes that a data stream is managed by the data - * stream lifecycle and contains the configuration. - * - * @see API - * specification - */ -@JsonpDeserializable -public class DataStreamLifecycle implements JsonpSerializable { - @Nullable - private final Time dataRetention; - - @Nullable - private final DataStreamLifecycleDownsampling downsampling; - - // --------------------------------------------------------------------------------------------- - - private DataStreamLifecycle(Builder builder) { - - this.dataRetention = builder.dataRetention; - this.downsampling = builder.downsampling; - - } - - public static DataStreamLifecycle of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code data_retention} - */ - @Nullable - public final Time dataRetention() { - return this.dataRetention; - } - - /** - * API name: {@code downsampling} - */ - @Nullable - public final DataStreamLifecycleDownsampling downsampling() { - return this.downsampling; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.dataRetention != null) { - generator.writeKey("data_retention"); - this.dataRetention.serialize(generator, mapper); - - } - if (this.downsampling != null) { - generator.writeKey("downsampling"); - this.downsampling.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DataStreamLifecycle}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Time dataRetention; - - @Nullable - private DataStreamLifecycleDownsampling downsampling; - - /** - * API name: {@code data_retention} - */ - public final Builder dataRetention(@Nullable Time value) { - this.dataRetention = value; - return this; - } - - /** - * API name: {@code data_retention} - */ - public final Builder dataRetention(Function> fn) { - return this.dataRetention(fn.apply(new Time.Builder()).build()); - } - - /** - * API name: {@code downsampling} - */ - public final Builder downsampling(@Nullable DataStreamLifecycleDownsampling value) { - this.downsampling = value; - return this; - } - - /** - * API name: {@code downsampling} - */ - public final Builder downsampling( - Function> fn) { - return this.downsampling(fn.apply(new DataStreamLifecycleDownsampling.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DataStreamLifecycle}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DataStreamLifecycle build() { - _checkSingleUse(); - - return new DataStreamLifecycle(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DataStreamLifecycle} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, DataStreamLifecycle::setupDataStreamLifecycleDeserializer); - - protected static void setupDataStreamLifecycleDeserializer(ObjectDeserializer op) { - - op.add(Builder::dataRetention, Time._DESERIALIZER, "data_retention"); - op.add(Builder::downsampling, DataStreamLifecycleDownsampling._DESERIALIZER, "downsampling"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamLifecycleDownsampling.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamLifecycleDownsampling.java deleted file mode 100644 index b1f5696c4..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamLifecycleDownsampling.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.DataStreamLifecycleDownsampling - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class DataStreamLifecycleDownsampling implements JsonpSerializable { - private final List rounds; - - // --------------------------------------------------------------------------------------------- - - private DataStreamLifecycleDownsampling(Builder builder) { - - this.rounds = ApiTypeHelper.unmodifiableRequired(builder.rounds, this, "rounds"); - - } - - public static DataStreamLifecycleDownsampling of( - Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - The list of downsampling rounds to execute as part of this - * downsampling configuration - *

- * API name: {@code rounds} - */ - public final List rounds() { - return this.rounds; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.rounds)) { - generator.writeKey("rounds"); - generator.writeStartArray(); - for (DownsamplingRound item0 : this.rounds) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DataStreamLifecycleDownsampling}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private List rounds; - - /** - * Required - The list of downsampling rounds to execute as part of this - * downsampling configuration - *

- * API name: {@code rounds} - *

- * Adds all elements of list to rounds. - */ - public final Builder rounds(List list) { - this.rounds = _listAddAll(this.rounds, list); - return this; - } - - /** - * Required - The list of downsampling rounds to execute as part of this - * downsampling configuration - *

- * API name: {@code rounds} - *

- * Adds one or more values to rounds. - */ - public final Builder rounds(DownsamplingRound value, DownsamplingRound... values) { - this.rounds = _listAdd(this.rounds, value, values); - return this; - } - - /** - * Required - The list of downsampling rounds to execute as part of this - * downsampling configuration - *

- * API name: {@code rounds} - *

- * Adds a value to rounds using a builder lambda. - */ - public final Builder rounds(Function> fn) { - return rounds(fn.apply(new DownsamplingRound.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DataStreamLifecycleDownsampling}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DataStreamLifecycleDownsampling build() { - _checkSingleUse(); - - return new DataStreamLifecycleDownsampling(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DataStreamLifecycleDownsampling} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, DataStreamLifecycleDownsampling::setupDataStreamLifecycleDownsamplingDeserializer); - - protected static void setupDataStreamLifecycleDownsamplingDeserializer( - ObjectDeserializer op) { - - op.add(Builder::rounds, JsonpDeserializer.arrayDeserializer(DownsamplingRound._DESERIALIZER), "rounds"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamLifecycleRolloverConditions.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamLifecycleRolloverConditions.java deleted file mode 100644 index 96605215d..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamLifecycleRolloverConditions.java +++ /dev/null @@ -1,434 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Long; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.DataStreamLifecycleRolloverConditions - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class DataStreamLifecycleRolloverConditions implements JsonpSerializable { - @Nullable - private final Time minAge; - - @Nullable - private final String maxAge; - - @Nullable - private final Long minDocs; - - @Nullable - private final Long maxDocs; - - @Nullable - private final String minSize; - - @Nullable - private final String maxSize; - - @Nullable - private final String minPrimaryShardSize; - - @Nullable - private final String maxPrimaryShardSize; - - @Nullable - private final Long minPrimaryShardDocs; - - @Nullable - private final Long maxPrimaryShardDocs; - - // --------------------------------------------------------------------------------------------- - - private DataStreamLifecycleRolloverConditions(Builder builder) { - - this.minAge = builder.minAge; - this.maxAge = builder.maxAge; - this.minDocs = builder.minDocs; - this.maxDocs = builder.maxDocs; - this.minSize = builder.minSize; - this.maxSize = builder.maxSize; - this.minPrimaryShardSize = builder.minPrimaryShardSize; - this.maxPrimaryShardSize = builder.maxPrimaryShardSize; - this.minPrimaryShardDocs = builder.minPrimaryShardDocs; - this.maxPrimaryShardDocs = builder.maxPrimaryShardDocs; - - } - - public static DataStreamLifecycleRolloverConditions of( - Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code min_age} - */ - @Nullable - public final Time minAge() { - return this.minAge; - } - - /** - * API name: {@code max_age} - */ - @Nullable - public final String maxAge() { - return this.maxAge; - } - - /** - * API name: {@code min_docs} - */ - @Nullable - public final Long minDocs() { - return this.minDocs; - } - - /** - * API name: {@code max_docs} - */ - @Nullable - public final Long maxDocs() { - return this.maxDocs; - } - - /** - * API name: {@code min_size} - */ - @Nullable - public final String minSize() { - return this.minSize; - } - - /** - * API name: {@code max_size} - */ - @Nullable - public final String maxSize() { - return this.maxSize; - } - - /** - * API name: {@code min_primary_shard_size} - */ - @Nullable - public final String minPrimaryShardSize() { - return this.minPrimaryShardSize; - } - - /** - * API name: {@code max_primary_shard_size} - */ - @Nullable - public final String maxPrimaryShardSize() { - return this.maxPrimaryShardSize; - } - - /** - * API name: {@code min_primary_shard_docs} - */ - @Nullable - public final Long minPrimaryShardDocs() { - return this.minPrimaryShardDocs; - } - - /** - * API name: {@code max_primary_shard_docs} - */ - @Nullable - public final Long maxPrimaryShardDocs() { - return this.maxPrimaryShardDocs; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.minAge != null) { - generator.writeKey("min_age"); - this.minAge.serialize(generator, mapper); - - } - if (this.maxAge != null) { - generator.writeKey("max_age"); - generator.write(this.maxAge); - - } - if (this.minDocs != null) { - generator.writeKey("min_docs"); - generator.write(this.minDocs); - - } - if (this.maxDocs != null) { - generator.writeKey("max_docs"); - generator.write(this.maxDocs); - - } - if (this.minSize != null) { - generator.writeKey("min_size"); - generator.write(this.minSize); - - } - if (this.maxSize != null) { - generator.writeKey("max_size"); - generator.write(this.maxSize); - - } - if (this.minPrimaryShardSize != null) { - generator.writeKey("min_primary_shard_size"); - generator.write(this.minPrimaryShardSize); - - } - if (this.maxPrimaryShardSize != null) { - generator.writeKey("max_primary_shard_size"); - generator.write(this.maxPrimaryShardSize); - - } - if (this.minPrimaryShardDocs != null) { - generator.writeKey("min_primary_shard_docs"); - generator.write(this.minPrimaryShardDocs); - - } - if (this.maxPrimaryShardDocs != null) { - generator.writeKey("max_primary_shard_docs"); - generator.write(this.maxPrimaryShardDocs); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DataStreamLifecycleRolloverConditions}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Time minAge; - - @Nullable - private String maxAge; - - @Nullable - private Long minDocs; - - @Nullable - private Long maxDocs; - - @Nullable - private String minSize; - - @Nullable - private String maxSize; - - @Nullable - private String minPrimaryShardSize; - - @Nullable - private String maxPrimaryShardSize; - - @Nullable - private Long minPrimaryShardDocs; - - @Nullable - private Long maxPrimaryShardDocs; - - /** - * API name: {@code min_age} - */ - public final Builder minAge(@Nullable Time value) { - this.minAge = value; - return this; - } - - /** - * API name: {@code min_age} - */ - public final Builder minAge(Function> fn) { - return this.minAge(fn.apply(new Time.Builder()).build()); - } - - /** - * API name: {@code max_age} - */ - public final Builder maxAge(@Nullable String value) { - this.maxAge = value; - return this; - } - - /** - * API name: {@code min_docs} - */ - public final Builder minDocs(@Nullable Long value) { - this.minDocs = value; - return this; - } - - /** - * API name: {@code max_docs} - */ - public final Builder maxDocs(@Nullable Long value) { - this.maxDocs = value; - return this; - } - - /** - * API name: {@code min_size} - */ - public final Builder minSize(@Nullable String value) { - this.minSize = value; - return this; - } - - /** - * API name: {@code max_size} - */ - public final Builder maxSize(@Nullable String value) { - this.maxSize = value; - return this; - } - - /** - * API name: {@code min_primary_shard_size} - */ - public final Builder minPrimaryShardSize(@Nullable String value) { - this.minPrimaryShardSize = value; - return this; - } - - /** - * API name: {@code max_primary_shard_size} - */ - public final Builder maxPrimaryShardSize(@Nullable String value) { - this.maxPrimaryShardSize = value; - return this; - } - - /** - * API name: {@code min_primary_shard_docs} - */ - public final Builder minPrimaryShardDocs(@Nullable Long value) { - this.minPrimaryShardDocs = value; - return this; - } - - /** - * API name: {@code max_primary_shard_docs} - */ - public final Builder maxPrimaryShardDocs(@Nullable Long value) { - this.maxPrimaryShardDocs = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DataStreamLifecycleRolloverConditions}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DataStreamLifecycleRolloverConditions build() { - _checkSingleUse(); - - return new DataStreamLifecycleRolloverConditions(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DataStreamLifecycleRolloverConditions} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, - DataStreamLifecycleRolloverConditions::setupDataStreamLifecycleRolloverConditionsDeserializer); - - protected static void setupDataStreamLifecycleRolloverConditionsDeserializer( - ObjectDeserializer op) { - - op.add(Builder::minAge, Time._DESERIALIZER, "min_age"); - op.add(Builder::maxAge, JsonpDeserializer.stringDeserializer(), "max_age"); - op.add(Builder::minDocs, JsonpDeserializer.longDeserializer(), "min_docs"); - op.add(Builder::maxDocs, JsonpDeserializer.longDeserializer(), "max_docs"); - op.add(Builder::minSize, JsonpDeserializer.stringDeserializer(), "min_size"); - op.add(Builder::maxSize, JsonpDeserializer.stringDeserializer(), "max_size"); - op.add(Builder::minPrimaryShardSize, JsonpDeserializer.stringDeserializer(), "min_primary_shard_size"); - op.add(Builder::maxPrimaryShardSize, JsonpDeserializer.stringDeserializer(), "max_primary_shard_size"); - op.add(Builder::minPrimaryShardDocs, JsonpDeserializer.longDeserializer(), "min_primary_shard_docs"); - op.add(Builder::maxPrimaryShardDocs, JsonpDeserializer.longDeserializer(), "max_primary_shard_docs"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamLifecycleWithRollover.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamLifecycleWithRollover.java deleted file mode 100644 index 14e94e6e1..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamLifecycleWithRollover.java +++ /dev/null @@ -1,291 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.DataStreamLifecycleWithRollover - -/** - * Data stream lifecycle with rollover can be used to display the configuration - * including the default rollover conditions, if asked. - * - * @see API - * specification - */ -@JsonpDeserializable -public class DataStreamLifecycleWithRollover implements JsonpSerializable { - @Nullable - private final Time dataRetention; - - @Nullable - private final DataStreamLifecycleDownsampling downsampling; - - @Nullable - private final DataStreamLifecycleRolloverConditions rollover; - - // --------------------------------------------------------------------------------------------- - - private DataStreamLifecycleWithRollover(Builder builder) { - - this.dataRetention = builder.dataRetention; - this.downsampling = builder.downsampling; - this.rollover = builder.rollover; - - } - - public static DataStreamLifecycleWithRollover of( - Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code data_retention} - */ - @Nullable - public final Time dataRetention() { - return this.dataRetention; - } - - /** - * The downsampling configuration to execute for the managed backing index after - * rollover. - *

- * API name: {@code downsampling} - */ - @Nullable - public final DataStreamLifecycleDownsampling downsampling() { - return this.downsampling; - } - - /** - * 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. - *

- * API name: {@code rollover} - */ - @Nullable - public final DataStreamLifecycleRolloverConditions rollover() { - return this.rollover; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.dataRetention != null) { - generator.writeKey("data_retention"); - this.dataRetention.serialize(generator, mapper); - - } - if (this.downsampling != null) { - generator.writeKey("downsampling"); - this.downsampling.serialize(generator, mapper); - - } - if (this.rollover != null) { - generator.writeKey("rollover"); - this.rollover.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DataStreamLifecycleWithRollover}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Time dataRetention; - - @Nullable - private DataStreamLifecycleDownsampling downsampling; - - @Nullable - private DataStreamLifecycleRolloverConditions rollover; - - /** - * 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. - *

- * API name: {@code data_retention} - */ - public final Builder dataRetention(@Nullable Time value) { - this.dataRetention = value; - return this; - } - - /** - * 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. - *

- * API name: {@code data_retention} - */ - public final Builder dataRetention(Function> fn) { - return this.dataRetention(fn.apply(new Time.Builder()).build()); - } - - /** - * The downsampling configuration to execute for the managed backing index after - * rollover. - *

- * API name: {@code downsampling} - */ - public final Builder downsampling(@Nullable DataStreamLifecycleDownsampling value) { - this.downsampling = value; - return this; - } - - /** - * The downsampling configuration to execute for the managed backing index after - * rollover. - *

- * API name: {@code downsampling} - */ - public final Builder downsampling( - Function> fn) { - return this.downsampling(fn.apply(new DataStreamLifecycleDownsampling.Builder()).build()); - } - - /** - * 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. - *

- * API name: {@code rollover} - */ - public final Builder rollover(@Nullable DataStreamLifecycleRolloverConditions value) { - this.rollover = value; - return this; - } - - /** - * 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. - *

- * API name: {@code rollover} - */ - public final Builder rollover( - Function> fn) { - return this.rollover(fn.apply(new DataStreamLifecycleRolloverConditions.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DataStreamLifecycleWithRollover}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DataStreamLifecycleWithRollover build() { - _checkSingleUse(); - - return new DataStreamLifecycleWithRollover(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DataStreamLifecycleWithRollover} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, DataStreamLifecycleWithRollover::setupDataStreamLifecycleWithRolloverDeserializer); - - protected static void setupDataStreamLifecycleWithRolloverDeserializer( - ObjectDeserializer op) { - - op.add(Builder::dataRetention, Time._DESERIALIZER, "data_retention"); - op.add(Builder::downsampling, DataStreamLifecycleDownsampling._DESERIALIZER, "downsampling"); - op.add(Builder::rollover, DataStreamLifecycleRolloverConditions._DESERIALIZER, "rollover"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamTimestampField.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamTimestampField.java deleted file mode 100644 index ae0ea8287..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamTimestampField.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.DataStreamTimestampField - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class DataStreamTimestampField implements JsonpSerializable { - private final String name; - - // --------------------------------------------------------------------------------------------- - - private DataStreamTimestampField(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - - } - - public static DataStreamTimestampField of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - 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. - *

- * API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("name"); - generator.write(this.name); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DataStreamTimestampField}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private String name; - - /** - * Required - 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. - *

- * API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DataStreamTimestampField}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DataStreamTimestampField build() { - _checkSingleUse(); - - return new DataStreamTimestampField(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DataStreamTimestampField} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, DataStreamTimestampField::setupDataStreamTimestampFieldDeserializer); - - protected static void setupDataStreamTimestampFieldDeserializer( - ObjectDeserializer op) { - - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamVisibility.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamVisibility.java deleted file mode 100644 index 9f562c19d..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamVisibility.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.DataStreamVisibility - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class DataStreamVisibility implements JsonpSerializable { - @Nullable - private final Boolean hidden; - - // --------------------------------------------------------------------------------------------- - - private DataStreamVisibility(Builder builder) { - - this.hidden = builder.hidden; - - } - - public static DataStreamVisibility of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code hidden} - */ - @Nullable - public final Boolean hidden() { - return this.hidden; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.hidden != null) { - generator.writeKey("hidden"); - generator.write(this.hidden); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DataStreamVisibility}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Boolean hidden; - - /** - * API name: {@code hidden} - */ - public final Builder hidden(@Nullable Boolean value) { - this.hidden = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DataStreamVisibility}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DataStreamVisibility build() { - _checkSingleUse(); - - return new DataStreamVisibility(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DataStreamVisibility} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, DataStreamVisibility::setupDataStreamVisibilityDeserializer); - - protected static void setupDataStreamVisibilityDeserializer(ObjectDeserializer op) { - - op.add(Builder::hidden, JsonpDeserializer.booleanDeserializer(), "hidden"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamsStatsRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamsStatsRequest.java deleted file mode 100644 index 04e7ed9f3..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamsStatsRequest.java +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.ExpandWildcard; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.data_streams_stats.Request - -/** - * Get data stream stats. Retrieves statistics for one or more data streams. - * - * @see API - * specification - */ - -public class DataStreamsStatsRequest extends RequestBase { - private final List expandWildcards; - - @Nullable - private final String name; - - // --------------------------------------------------------------------------------------------- - - private DataStreamsStatsRequest(Builder builder) { - - this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); - this.name = builder.name; - - } - - public static DataStreamsStatsRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Type of data stream that wildcard patterns can match. Supports - * comma-separated values, such as open,hidden. - *

- * API name: {@code expand_wildcards} - */ - public final List expandWildcards() { - return this.expandWildcards; - } - - /** - * 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 *. - *

- * API name: {@code name} - */ - @Nullable - public final String name() { - return this.name; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DataStreamsStatsRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private List expandWildcards; - - @Nullable - private String name; - - /** - * Type of data stream that wildcard patterns can match. Supports - * comma-separated values, such as open,hidden. - *

- * API name: {@code expand_wildcards} - *

- * Adds all elements of list to expandWildcards. - */ - public final Builder expandWildcards(List list) { - this.expandWildcards = _listAddAll(this.expandWildcards, list); - return this; - } - - /** - * Type of data stream that wildcard patterns can match. Supports - * comma-separated values, such as open,hidden. - *

- * API name: {@code expand_wildcards} - *

- * Adds one or more values to expandWildcards. - */ - public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { - this.expandWildcards = _listAdd(this.expandWildcards, value, values); - return this; - } - - /** - * 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 *. - *

- * API name: {@code name} - */ - public final Builder name(@Nullable String value) { - this.name = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DataStreamsStatsRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DataStreamsStatsRequest build() { - _checkSingleUse(); - - return new DataStreamsStatsRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.data_streams_stats}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.data_streams_stats", - - // Request method - request -> { - return "GET"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - if (request.name() != null) - propsSet |= _name; - - if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_data_stream"); - buf.append("/_stats"); - return buf.toString(); - } - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_data_stream"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); - buf.append("/_stats"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - - int propsSet = 0; - - if (request.name() != null) - propsSet |= _name; - - if (propsSet == 0) { - } - if (propsSet == (_name)) { - params.put("name", request.name); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (ApiTypeHelper.isDefined(request.expandWildcards)) { - params.put("expand_wildcards", - request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, DataStreamsStatsResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamsStatsResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamsStatsResponse.java deleted file mode 100644 index efd8a3023..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamsStatsResponse.java +++ /dev/null @@ -1,360 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ShardStatistics; -import co.elastic.clients.elasticsearch.indices.data_streams_stats.DataStreamsStatsItem; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Integer; -import java.lang.Long; -import java.lang.String; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.data_streams_stats.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class DataStreamsStatsResponse implements JsonpSerializable { - private final ShardStatistics shards; - - private final int backingIndices; - - private final int dataStreamCount; - - private final List dataStreams; - - @Nullable - private final String totalStoreSizes; - - private final long totalStoreSizeBytes; - - // --------------------------------------------------------------------------------------------- - - private DataStreamsStatsResponse(Builder builder) { - - this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards"); - this.backingIndices = ApiTypeHelper.requireNonNull(builder.backingIndices, this, "backingIndices"); - this.dataStreamCount = ApiTypeHelper.requireNonNull(builder.dataStreamCount, this, "dataStreamCount"); - this.dataStreams = ApiTypeHelper.unmodifiableRequired(builder.dataStreams, this, "dataStreams"); - this.totalStoreSizes = builder.totalStoreSizes; - this.totalStoreSizeBytes = ApiTypeHelper.requireNonNull(builder.totalStoreSizeBytes, this, - "totalStoreSizeBytes"); - - } - - public static DataStreamsStatsResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Contains information about shards that attempted to execute the - * request. - *

- * API name: {@code _shards} - */ - public final ShardStatistics shards() { - return this.shards; - } - - /** - * Required - Total number of backing indices for the selected data streams. - *

- * API name: {@code backing_indices} - */ - public final int backingIndices() { - return this.backingIndices; - } - - /** - * Required - Total number of selected data streams. - *

- * API name: {@code data_stream_count} - */ - public final int dataStreamCount() { - return this.dataStreamCount; - } - - /** - * Required - Contains statistics for the selected data streams. - *

- * API name: {@code data_streams} - */ - public final List dataStreams() { - return this.dataStreams; - } - - /** - * Total size of all shards for the selected data streams. This property is - * included only if the human query parameter is true - *

- * API name: {@code total_store_sizes} - */ - @Nullable - public final String totalStoreSizes() { - return this.totalStoreSizes; - } - - /** - * Required - Total size, in bytes, of all shards for the selected data streams. - *

- * API name: {@code total_store_size_bytes} - */ - public final long totalStoreSizeBytes() { - return this.totalStoreSizeBytes; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("_shards"); - this.shards.serialize(generator, mapper); - - generator.writeKey("backing_indices"); - generator.write(this.backingIndices); - - generator.writeKey("data_stream_count"); - generator.write(this.dataStreamCount); - - if (ApiTypeHelper.isDefined(this.dataStreams)) { - generator.writeKey("data_streams"); - generator.writeStartArray(); - for (DataStreamsStatsItem item0 : this.dataStreams) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.totalStoreSizes != null) { - generator.writeKey("total_store_sizes"); - generator.write(this.totalStoreSizes); - - } - generator.writeKey("total_store_size_bytes"); - generator.write(this.totalStoreSizeBytes); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DataStreamsStatsResponse}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private ShardStatistics shards; - - private Integer backingIndices; - - private Integer dataStreamCount; - - private List dataStreams; - - @Nullable - private String totalStoreSizes; - - private Long totalStoreSizeBytes; - - /** - * Required - Contains information about shards that attempted to execute the - * request. - *

- * API name: {@code _shards} - */ - public final Builder shards(ShardStatistics value) { - this.shards = value; - return this; - } - - /** - * Required - Contains information about shards that attempted to execute the - * request. - *

- * API name: {@code _shards} - */ - public final Builder shards(Function> fn) { - return this.shards(fn.apply(new ShardStatistics.Builder()).build()); - } - - /** - * Required - Total number of backing indices for the selected data streams. - *

- * API name: {@code backing_indices} - */ - public final Builder backingIndices(int value) { - this.backingIndices = value; - return this; - } - - /** - * Required - Total number of selected data streams. - *

- * API name: {@code data_stream_count} - */ - public final Builder dataStreamCount(int value) { - this.dataStreamCount = value; - return this; - } - - /** - * Required - Contains statistics for the selected data streams. - *

- * API name: {@code data_streams} - *

- * Adds all elements of list to dataStreams. - */ - public final Builder dataStreams(List list) { - this.dataStreams = _listAddAll(this.dataStreams, list); - return this; - } - - /** - * Required - Contains statistics for the selected data streams. - *

- * API name: {@code data_streams} - *

- * Adds one or more values to dataStreams. - */ - public final Builder dataStreams(DataStreamsStatsItem value, DataStreamsStatsItem... values) { - this.dataStreams = _listAdd(this.dataStreams, value, values); - return this; - } - - /** - * Required - Contains statistics for the selected data streams. - *

- * API name: {@code data_streams} - *

- * Adds a value to dataStreams using a builder lambda. - */ - public final Builder dataStreams( - Function> fn) { - return dataStreams(fn.apply(new DataStreamsStatsItem.Builder()).build()); - } - - /** - * Total size of all shards for the selected data streams. This property is - * included only if the human query parameter is true - *

- * API name: {@code total_store_sizes} - */ - public final Builder totalStoreSizes(@Nullable String value) { - this.totalStoreSizes = value; - return this; - } - - /** - * Required - Total size, in bytes, of all shards for the selected data streams. - *

- * API name: {@code total_store_size_bytes} - */ - public final Builder totalStoreSizeBytes(long value) { - this.totalStoreSizeBytes = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DataStreamsStatsResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DataStreamsStatsResponse build() { - _checkSingleUse(); - - return new DataStreamsStatsResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DataStreamsStatsResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, DataStreamsStatsResponse::setupDataStreamsStatsResponseDeserializer); - - protected static void setupDataStreamsStatsResponseDeserializer( - ObjectDeserializer op) { - - op.add(Builder::shards, ShardStatistics._DESERIALIZER, "_shards"); - op.add(Builder::backingIndices, JsonpDeserializer.integerDeserializer(), "backing_indices"); - op.add(Builder::dataStreamCount, JsonpDeserializer.integerDeserializer(), "data_stream_count"); - op.add(Builder::dataStreams, JsonpDeserializer.arrayDeserializer(DataStreamsStatsItem._DESERIALIZER), - "data_streams"); - op.add(Builder::totalStoreSizes, JsonpDeserializer.stringDeserializer(), "total_store_sizes"); - op.add(Builder::totalStoreSizeBytes, JsonpDeserializer.longDeserializer(), "total_store_size_bytes"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteAliasRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteAliasRequest.java deleted file mode 100644 index 711ef9bb2..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteAliasRequest.java +++ /dev/null @@ -1,349 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.delete_alias.Request - -/** - * Delete an alias. Removes a data stream or index from an alias. - * - * @see API - * specification - */ - -public class DeleteAliasRequest extends RequestBase { - private final List index; - - @Nullable - private final Time masterTimeout; - - private final List name; - - @Nullable - private final Time timeout; - - // --------------------------------------------------------------------------------------------- - - private DeleteAliasRequest(Builder builder) { - - this.index = ApiTypeHelper.unmodifiableRequired(builder.index, this, "index"); - this.masterTimeout = builder.masterTimeout; - this.name = ApiTypeHelper.unmodifiableRequired(builder.name, this, "name"); - this.timeout = builder.timeout; - - } - - public static DeleteAliasRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Comma-separated list of data streams or indices used to limit the - * request. Supports wildcards (*). - *

- * API name: {@code index} - */ - public final List index() { - return this.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. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * Required - Comma-separated list of aliases to remove. Supports wildcards - * (*). To remove all aliases, use * or - * _all. - *

- * API name: {@code name} - */ - public final List name() { - return this.name; - } - - /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. - *

- * API name: {@code timeout} - */ - @Nullable - public final Time timeout() { - return this.timeout; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DeleteAliasRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - private List index; - - @Nullable - private Time masterTimeout; - - private List name; - - @Nullable - private Time timeout; - - /** - * Required - Comma-separated list of data streams or indices used to limit the - * request. Supports wildcards (*). - *

- * API name: {@code index} - *

- * Adds all elements of list to index. - */ - public final Builder index(List list) { - this.index = _listAddAll(this.index, list); - return this; - } - - /** - * Required - Comma-separated list of data streams or indices used to limit the - * request. Supports wildcards (*). - *

- * API name: {@code index} - *

- * Adds one or more values to index. - */ - public final Builder index(String value, String... values) { - this.index = _listAdd(this.index, value, 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Required - Comma-separated list of aliases to remove. Supports wildcards - * (*). To remove all aliases, use * or - * _all. - *

- * API name: {@code name} - *

- * Adds all elements of list to name. - */ - public final Builder name(List list) { - this.name = _listAddAll(this.name, list); - return this; - } - - /** - * Required - Comma-separated list of aliases to remove. Supports wildcards - * (*). To remove all aliases, use * or - * _all. - *

- * API name: {@code name} - *

- * Adds one or more values to name. - */ - public final Builder name(String value, String... values) { - this.name = _listAdd(this.name, value, values); - return this; - } - - /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. - *

- * API name: {@code timeout} - */ - public final Builder timeout(@Nullable Time value) { - this.timeout = 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. - *

- * API name: {@code timeout} - */ - public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DeleteAliasRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DeleteAliasRequest build() { - _checkSingleUse(); - - return new DeleteAliasRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.delete_alias}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.delete_alias", - - // Request method - request -> { - return "DELETE"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - final int _index = 1 << 1; - - int propsSet = 0; - - propsSet |= _name; - propsSet |= _index; - - if (propsSet == (_index | _name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_alias"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); - return buf.toString(); - } - if (propsSet == (_index | _name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_aliases"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - final int _index = 1 << 1; - - int propsSet = 0; - - propsSet |= _name; - propsSet |= _index; - - if (propsSet == (_index | _name)) { - params.put("index", request.index.stream().map(v -> v).collect(Collectors.joining(","))); - params.put("name", request.name.stream().map(v -> v).collect(Collectors.joining(","))); - } - if (propsSet == (_index | _name)) { - params.put("index", request.index.stream().map(v -> v).collect(Collectors.joining(","))); - params.put("name", request.name.stream().map(v -> v).collect(Collectors.joining(","))); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (request.timeout != null) { - params.put("timeout", request.timeout._toJsonString()); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, DeleteAliasResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteAliasResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteAliasResponse.java deleted file mode 100644 index 1255191ab..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteAliasResponse.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.delete_alias.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class DeleteAliasResponse extends AcknowledgedResponseBase { - // --------------------------------------------------------------------------------------------- - - private DeleteAliasResponse(Builder builder) { - super(builder); - - } - - public static DeleteAliasResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DeleteAliasResponse}. - */ - - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder - implements - ObjectBuilder { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DeleteAliasResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DeleteAliasResponse build() { - _checkSingleUse(); - - return new DeleteAliasResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DeleteAliasResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, DeleteAliasResponse::setupDeleteAliasResponseDeserializer); - - protected static void setupDeleteAliasResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteDataLifecycleRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteDataLifecycleRequest.java deleted file mode 100644 index 806db4c28..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteDataLifecycleRequest.java +++ /dev/null @@ -1,329 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.ExpandWildcard; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.delete_data_lifecycle.Request - -/** - * Delete data stream lifecycles. Removes the data stream lifecycle from a data - * stream, rendering it not managed by the data stream lifecycle. - * - * @see API - * specification - */ - -public class DeleteDataLifecycleRequest extends RequestBase { - private final List expandWildcards; - - @Nullable - private final Time masterTimeout; - - private final List name; - - @Nullable - private final Time timeout; - - // --------------------------------------------------------------------------------------------- - - private DeleteDataLifecycleRequest(Builder builder) { - - this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); - this.masterTimeout = builder.masterTimeout; - this.name = ApiTypeHelper.unmodifiableRequired(builder.name, this, "name"); - this.timeout = builder.timeout; - - } - - public static DeleteDataLifecycleRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Whether wildcard expressions should get expanded to open or closed indices - * (default: open) - *

- * API name: {@code expand_wildcards} - */ - public final List expandWildcards() { - return this.expandWildcards; - } - - /** - * Specify timeout for connection to master - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * Required - A comma-separated list of data streams of which the data stream - * lifecycle will be deleted; use * to get all data streams - *

- * API name: {@code name} - */ - public final List name() { - return this.name; - } - - /** - * Explicit timestamp for the document - *

- * API name: {@code timeout} - */ - @Nullable - public final Time timeout() { - return this.timeout; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DeleteDataLifecycleRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private List expandWildcards; - - @Nullable - private Time masterTimeout; - - private List name; - - @Nullable - private Time timeout; - - /** - * Whether wildcard expressions should get expanded to open or closed indices - * (default: open) - *

- * API name: {@code expand_wildcards} - *

- * Adds all elements of list to expandWildcards. - */ - public final Builder expandWildcards(List list) { - this.expandWildcards = _listAddAll(this.expandWildcards, list); - return this; - } - - /** - * Whether wildcard expressions should get expanded to open or closed indices - * (default: open) - *

- * API name: {@code expand_wildcards} - *

- * Adds one or more values to expandWildcards. - */ - public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { - this.expandWildcards = _listAdd(this.expandWildcards, value, values); - return this; - } - - /** - * Specify timeout for connection to master - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = value; - return this; - } - - /** - * Specify timeout for connection to master - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Required - A comma-separated list of data streams of which the data stream - * lifecycle will be deleted; use * to get all data streams - *

- * API name: {@code name} - *

- * Adds all elements of list to name. - */ - public final Builder name(List list) { - this.name = _listAddAll(this.name, list); - return this; - } - - /** - * Required - A comma-separated list of data streams of which the data stream - * lifecycle will be deleted; use * to get all data streams - *

- * API name: {@code name} - *

- * Adds one or more values to name. - */ - public final Builder name(String value, String... values) { - this.name = _listAdd(this.name, value, values); - return this; - } - - /** - * Explicit timestamp for the document - *

- * API name: {@code timeout} - */ - public final Builder timeout(@Nullable Time value) { - this.timeout = value; - return this; - } - - /** - * Explicit timestamp for the document - *

- * API name: {@code timeout} - */ - public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DeleteDataLifecycleRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DeleteDataLifecycleRequest build() { - _checkSingleUse(); - - return new DeleteDataLifecycleRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.delete_data_lifecycle}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.delete_data_lifecycle", - - // Request method - request -> { - return "DELETE"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_data_stream"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_lifecycle"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - params.put("name", request.name.stream().map(v -> v).collect(Collectors.joining(","))); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (ApiTypeHelper.isDefined(request.expandWildcards)) { - params.put("expand_wildcards", - request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); - } - if (request.timeout != null) { - params.put("timeout", request.timeout._toJsonString()); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, DeleteDataLifecycleResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteDataLifecycleResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteDataLifecycleResponse.java deleted file mode 100644 index e1f782794..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteDataLifecycleResponse.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.delete_data_lifecycle.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class DeleteDataLifecycleResponse extends AcknowledgedResponseBase { - // --------------------------------------------------------------------------------------------- - - private DeleteDataLifecycleResponse(Builder builder) { - super(builder); - - } - - public static DeleteDataLifecycleResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DeleteDataLifecycleResponse}. - */ - - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder - implements - ObjectBuilder { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DeleteDataLifecycleResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DeleteDataLifecycleResponse build() { - _checkSingleUse(); - - return new DeleteDataLifecycleResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DeleteDataLifecycleResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, DeleteDataLifecycleResponse::setupDeleteDataLifecycleResponseDeserializer); - - protected static void setupDeleteDataLifecycleResponseDeserializer( - ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteDataStreamRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteDataStreamRequest.java deleted file mode 100644 index 4b048ef15..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteDataStreamRequest.java +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.ExpandWildcard; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.delete_data_stream.Request - -/** - * Delete data streams. Deletes one or more data streams and their backing - * indices. - * - * @see API - * specification - */ - -public class DeleteDataStreamRequest extends RequestBase { - private final List expandWildcards; - - @Nullable - private final Time masterTimeout; - - private final List name; - - // --------------------------------------------------------------------------------------------- - - private DeleteDataStreamRequest(Builder builder) { - - this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); - this.masterTimeout = builder.masterTimeout; - this.name = ApiTypeHelper.unmodifiableRequired(builder.name, this, "name"); - - } - - public static DeleteDataStreamRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Type of data stream that wildcard patterns can match. Supports - * comma-separated values,such as open,hidden. - *

- * API name: {@code expand_wildcards} - */ - public final List expandWildcards() { - return this.expandWildcards; - } - - /** - * 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. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * Required - Comma-separated list of data streams to delete. Wildcard - * (*) expressions are supported. - *

- * API name: {@code name} - */ - public final List name() { - return this.name; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DeleteDataStreamRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private List expandWildcards; - - @Nullable - private Time masterTimeout; - - private List name; - - /** - * Type of data stream that wildcard patterns can match. Supports - * comma-separated values,such as open,hidden. - *

- * API name: {@code expand_wildcards} - *

- * Adds all elements of list to expandWildcards. - */ - public final Builder expandWildcards(List list) { - this.expandWildcards = _listAddAll(this.expandWildcards, list); - return this; - } - - /** - * Type of data stream that wildcard patterns can match. Supports - * comma-separated values,such as open,hidden. - *

- * API name: {@code expand_wildcards} - *

- * Adds one or more values to expandWildcards. - */ - public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { - this.expandWildcards = _listAdd(this.expandWildcards, value, 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Required - Comma-separated list of data streams to delete. Wildcard - * (*) expressions are supported. - *

- * API name: {@code name} - *

- * Adds all elements of list to name. - */ - public final Builder name(List list) { - this.name = _listAddAll(this.name, list); - return this; - } - - /** - * Required - Comma-separated list of data streams to delete. Wildcard - * (*) expressions are supported. - *

- * API name: {@code name} - *

- * Adds one or more values to name. - */ - public final Builder name(String value, String... values) { - this.name = _listAdd(this.name, value, values); - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DeleteDataStreamRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DeleteDataStreamRequest build() { - _checkSingleUse(); - - return new DeleteDataStreamRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.delete_data_stream}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.delete_data_stream", - - // Request method - request -> { - return "DELETE"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_data_stream"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - params.put("name", request.name.stream().map(v -> v).collect(Collectors.joining(","))); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (ApiTypeHelper.isDefined(request.expandWildcards)) { - params.put("expand_wildcards", - request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, DeleteDataStreamResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteDataStreamResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteDataStreamResponse.java deleted file mode 100644 index a31ed5d30..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteDataStreamResponse.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.delete_data_stream.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class DeleteDataStreamResponse extends AcknowledgedResponseBase { - // --------------------------------------------------------------------------------------------- - - private DeleteDataStreamResponse(Builder builder) { - super(builder); - - } - - public static DeleteDataStreamResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DeleteDataStreamResponse}. - */ - - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder - implements - ObjectBuilder { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DeleteDataStreamResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DeleteDataStreamResponse build() { - _checkSingleUse(); - - return new DeleteDataStreamResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DeleteDataStreamResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, DeleteDataStreamResponse::setupDeleteDataStreamResponseDeserializer); - - protected static void setupDeleteDataStreamResponseDeserializer( - ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteIndexRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteIndexRequest.java deleted file mode 100644 index 65b550b03..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteIndexRequest.java +++ /dev/null @@ -1,421 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.ExpandWildcard; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.delete.Request - -/** - * Delete indices. Deletes one or more indices. - * - * @see API - * specification - */ - -public class DeleteIndexRequest extends RequestBase { - @Nullable - private final Boolean allowNoIndices; - - private final List expandWildcards; - - @Nullable - private final Boolean ignoreUnavailable; - - private final List index; - - @Nullable - private final Time masterTimeout; - - @Nullable - private final Time timeout; - - // --------------------------------------------------------------------------------------------- - - private DeleteIndexRequest(Builder builder) { - - this.allowNoIndices = builder.allowNoIndices; - this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); - this.ignoreUnavailable = builder.ignoreUnavailable; - this.index = ApiTypeHelper.unmodifiableRequired(builder.index, this, "index"); - this.masterTimeout = builder.masterTimeout; - this.timeout = builder.timeout; - - } - - public static DeleteIndexRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code allow_no_indices} - */ - @Nullable - public final Boolean allowNoIndices() { - return this.allowNoIndices; - } - - /** - * 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. - *

- * API name: {@code expand_wildcards} - */ - public final List expandWildcards() { - return this.expandWildcards; - } - - /** - * If false, the request returns an error if it targets a missing - * or closed index. - *

- * API name: {@code ignore_unavailable} - */ - @Nullable - public final Boolean ignoreUnavailable() { - return this.ignoreUnavailable; - } - - /** - * Required - 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. - *

- * API name: {@code index} - */ - public final List index() { - return this.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. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. - *

- * API name: {@code timeout} - */ - @Nullable - public final Time timeout() { - return this.timeout; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DeleteIndexRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private Boolean allowNoIndices; - - @Nullable - private List expandWildcards; - - @Nullable - private Boolean ignoreUnavailable; - - private List index; - - @Nullable - private Time masterTimeout; - - @Nullable - private Time timeout; - - /** - * 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. - *

- * API name: {@code allow_no_indices} - */ - public final Builder allowNoIndices(@Nullable Boolean value) { - this.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. - *

- * API name: {@code expand_wildcards} - *

- * Adds all elements of list to expandWildcards. - */ - public final Builder expandWildcards(List list) { - this.expandWildcards = _listAddAll(this.expandWildcards, list); - 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. - *

- * API name: {@code expand_wildcards} - *

- * Adds one or more values to expandWildcards. - */ - public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { - this.expandWildcards = _listAdd(this.expandWildcards, value, values); - return this; - } - - /** - * If false, the request returns an error if it targets a missing - * or closed index. - *

- * API name: {@code ignore_unavailable} - */ - public final Builder ignoreUnavailable(@Nullable Boolean value) { - this.ignoreUnavailable = value; - return this; - } - - /** - * Required - 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. - *

- * API name: {@code index} - *

- * Adds all elements of list to index. - */ - public final Builder index(List list) { - this.index = _listAddAll(this.index, list); - return this; - } - - /** - * Required - 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. - *

- * API name: {@code index} - *

- * Adds one or more values to index. - */ - public final Builder index(String value, String... values) { - this.index = _listAdd(this.index, value, 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. - *

- * API name: {@code timeout} - */ - public final Builder timeout(@Nullable Time value) { - this.timeout = 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. - *

- * API name: {@code timeout} - */ - public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DeleteIndexRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DeleteIndexRequest build() { - _checkSingleUse(); - - return new DeleteIndexRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.delete}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.delete", - - // Request method - request -> { - return "DELETE"; - - }, - - // Request path - request -> { - final int _index = 1 << 0; - - int propsSet = 0; - - propsSet |= _index; - - if (propsSet == (_index)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _index = 1 << 0; - - int propsSet = 0; - - propsSet |= _index; - - if (propsSet == (_index)) { - params.put("index", request.index.stream().map(v -> v).collect(Collectors.joining(","))); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (ApiTypeHelper.isDefined(request.expandWildcards)) { - params.put("expand_wildcards", - request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); - } - if (request.ignoreUnavailable != null) { - params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); - } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } - if (request.timeout != null) { - params.put("timeout", request.timeout._toJsonString()); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, DeleteIndexResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteIndexResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteIndexResponse.java deleted file mode 100644 index 9a982fd93..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteIndexResponse.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.IndicesResponseBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.delete.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class DeleteIndexResponse extends IndicesResponseBase { - // --------------------------------------------------------------------------------------------- - - private DeleteIndexResponse(Builder builder) { - super(builder); - - } - - public static DeleteIndexResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DeleteIndexResponse}. - */ - - public static class Builder extends IndicesResponseBase.AbstractBuilder - implements - ObjectBuilder { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DeleteIndexResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DeleteIndexResponse build() { - _checkSingleUse(); - - return new DeleteIndexResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DeleteIndexResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, DeleteIndexResponse::setupDeleteIndexResponseDeserializer); - - protected static void setupDeleteIndexResponseDeserializer(ObjectDeserializer op) { - IndicesResponseBase.setupIndicesResponseBaseDeserializer(op); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteIndexTemplateRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteIndexTemplateRequest.java deleted file mode 100644 index 95e207025..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteIndexTemplateRequest.java +++ /dev/null @@ -1,289 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.delete_index_template.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. - * - * @see API - * specification - */ - -public class DeleteIndexTemplateRequest extends RequestBase { - @Nullable - private final Time masterTimeout; - - private final List name; - - @Nullable - private final Time timeout; - - // --------------------------------------------------------------------------------------------- - - private DeleteIndexTemplateRequest(Builder builder) { - - this.masterTimeout = builder.masterTimeout; - this.name = ApiTypeHelper.unmodifiableRequired(builder.name, this, "name"); - this.timeout = builder.timeout; - - } - - public static DeleteIndexTemplateRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * Required - Comma-separated list of index template names used to limit the - * request. Wildcard (*) expressions are supported. - *

- * API name: {@code name} - */ - public final List name() { - return this.name; - } - - /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. - *

- * API name: {@code timeout} - */ - @Nullable - public final Time timeout() { - return this.timeout; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DeleteIndexTemplateRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private Time masterTimeout; - - private List name; - - @Nullable - private Time 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Required - Comma-separated list of index template names used to limit the - * request. Wildcard (*) expressions are supported. - *

- * API name: {@code name} - *

- * Adds all elements of list to name. - */ - public final Builder name(List list) { - this.name = _listAddAll(this.name, list); - return this; - } - - /** - * Required - Comma-separated list of index template names used to limit the - * request. Wildcard (*) expressions are supported. - *

- * API name: {@code name} - *

- * Adds one or more values to name. - */ - public final Builder name(String value, String... values) { - this.name = _listAdd(this.name, value, values); - return this; - } - - /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. - *

- * API name: {@code timeout} - */ - public final Builder timeout(@Nullable Time value) { - this.timeout = 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. - *

- * API name: {@code timeout} - */ - public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DeleteIndexTemplateRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DeleteIndexTemplateRequest build() { - _checkSingleUse(); - - return new DeleteIndexTemplateRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.delete_index_template}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.delete_index_template", - - // Request method - request -> { - return "DELETE"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_index_template"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - params.put("name", request.name.stream().map(v -> v).collect(Collectors.joining(","))); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (request.timeout != null) { - params.put("timeout", request.timeout._toJsonString()); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, DeleteIndexTemplateResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteIndexTemplateResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteIndexTemplateResponse.java deleted file mode 100644 index 521988450..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteIndexTemplateResponse.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.delete_index_template.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class DeleteIndexTemplateResponse extends AcknowledgedResponseBase { - // --------------------------------------------------------------------------------------------- - - private DeleteIndexTemplateResponse(Builder builder) { - super(builder); - - } - - public static DeleteIndexTemplateResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DeleteIndexTemplateResponse}. - */ - - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder - implements - ObjectBuilder { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DeleteIndexTemplateResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DeleteIndexTemplateResponse build() { - _checkSingleUse(); - - return new DeleteIndexTemplateResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DeleteIndexTemplateResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, DeleteIndexTemplateResponse::setupDeleteIndexTemplateResponseDeserializer); - - protected static void setupDeleteIndexTemplateResponseDeserializer( - ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DownsampleConfig.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DownsampleConfig.java deleted file mode 100644 index 0b9f04da8..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DownsampleConfig.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.DownsampleConfig - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class DownsampleConfig implements JsonpSerializable { - private final Time fixedInterval; - - // --------------------------------------------------------------------------------------------- - - private DownsampleConfig(Builder builder) { - - this.fixedInterval = ApiTypeHelper.requireNonNull(builder.fixedInterval, this, "fixedInterval"); - - } - - public static DownsampleConfig of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - The interval at which to aggregate the original time series index. - *

- * API name: {@code fixed_interval} - */ - public final Time fixedInterval() { - return this.fixedInterval; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("fixed_interval"); - this.fixedInterval.serialize(generator, mapper); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DownsampleConfig}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Time fixedInterval; - - /** - * Required - The interval at which to aggregate the original time series index. - *

- * API name: {@code fixed_interval} - */ - public final Builder fixedInterval(Time value) { - this.fixedInterval = value; - return this; - } - - /** - * Required - The interval at which to aggregate the original time series index. - *

- * API name: {@code fixed_interval} - */ - public final Builder fixedInterval(Function> fn) { - return this.fixedInterval(fn.apply(new Time.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DownsampleConfig}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DownsampleConfig build() { - _checkSingleUse(); - - return new DownsampleConfig(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DownsampleConfig} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - DownsampleConfig::setupDownsampleConfigDeserializer); - - protected static void setupDownsampleConfigDeserializer(ObjectDeserializer op) { - - op.add(Builder::fixedInterval, Time._DESERIALIZER, "fixed_interval"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DownsamplingRound.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DownsamplingRound.java deleted file mode 100644 index 047b3a94c..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/DownsamplingRound.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.DownsamplingRound - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class DownsamplingRound implements JsonpSerializable { - private final Time after; - - private final DownsampleConfig config; - - // --------------------------------------------------------------------------------------------- - - private DownsamplingRound(Builder builder) { - - this.after = ApiTypeHelper.requireNonNull(builder.after, this, "after"); - this.config = ApiTypeHelper.requireNonNull(builder.config, this, "config"); - - } - - public static DownsamplingRound of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - The duration since rollover when this downsampling round should - * execute - *

- * API name: {@code after} - */ - public final Time after() { - return this.after; - } - - /** - * Required - The downsample configuration to execute. - *

- * API name: {@code config} - */ - public final DownsampleConfig config() { - return this.config; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("after"); - this.after.serialize(generator, mapper); - - generator.writeKey("config"); - this.config.serialize(generator, mapper); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DownsamplingRound}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Time after; - - private DownsampleConfig config; - - /** - * Required - The duration since rollover when this downsampling round should - * execute - *

- * API name: {@code after} - */ - public final Builder after(Time value) { - this.after = value; - return this; - } - - /** - * Required - The duration since rollover when this downsampling round should - * execute - *

- * API name: {@code after} - */ - public final Builder after(Function> fn) { - return this.after(fn.apply(new Time.Builder()).build()); - } - - /** - * Required - The downsample configuration to execute. - *

- * API name: {@code config} - */ - public final Builder config(DownsampleConfig value) { - this.config = value; - return this; - } - - /** - * Required - The downsample configuration to execute. - *

- * API name: {@code config} - */ - public final Builder config(Function> fn) { - return this.config(fn.apply(new DownsampleConfig.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DownsamplingRound}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DownsamplingRound build() { - _checkSingleUse(); - - return new DownsamplingRound(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DownsamplingRound} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, DownsamplingRound::setupDownsamplingRoundDeserializer); - - protected static void setupDownsamplingRoundDeserializer(ObjectDeserializer op) { - - op.add(Builder::after, Time._DESERIALIZER, "after"); - op.add(Builder::config, DownsampleConfig._DESERIALIZER, "config"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesAsyncClient.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesAsyncClient.java deleted file mode 100644 index fe5ed34cb..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesAsyncClient.java +++ /dev/null @@ -1,1502 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.ApiClient; -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.transport.ElasticsearchTransport; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.JsonEndpoint; -import co.elastic.clients.transport.Transport; -import co.elastic.clients.transport.TransportOptions; -import co.elastic.clients.transport.endpoints.BooleanResponse; -import co.elastic.clients.util.ObjectBuilder; -import java.util.concurrent.CompletableFuture; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Client for the indices namespace. - */ -public class ElasticsearchIndicesAsyncClient - extends - ApiClient { - - public ElasticsearchIndicesAsyncClient(ElasticsearchTransport transport) { - super(transport, null); - } - - public ElasticsearchIndicesAsyncClient(ElasticsearchTransport transport, - @Nullable TransportOptions transportOptions) { - super(transport, transportOptions); - } - - @Override - public ElasticsearchIndicesAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) { - return new ElasticsearchIndicesAsyncClient(this.transport, transportOptions); - } - - // ----- Endpoint: indices.add_block - - /** - * Add an index block. Limits the operations allowed on an index by blocking - * specific operation types. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture addBlock(AddBlockRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) AddBlockRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Add an index block. Limits the operations allowed on an index by blocking - * specific operation types. - * - * @param fn - * a function that initializes a builder to create the - * {@link AddBlockRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture addBlock( - Function> fn) { - return addBlock(fn.apply(new AddBlockRequest.Builder()).build()); - } - - // ----- Endpoint: indices.analyze - - /** - * Performs analysis on a text string and returns the resulting tokens. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture analyze(AnalyzeRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) AnalyzeRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Performs analysis on a text string and returns the resulting tokens. - * - * @param fn - * a function that initializes a builder to create the - * {@link AnalyzeRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture analyze( - Function> fn) { - return analyze(fn.apply(new AnalyzeRequest.Builder()).build()); - } - - /** - * Performs analysis on a text string and returns the resulting tokens. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture analyze() { - return this.transport.performRequestAsync(new AnalyzeRequest.Builder().build(), AnalyzeRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: indices.create - - /** - * Create an index. Creates a new index. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture create(CreateIndexRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) CreateIndexRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Create an index. Creates a new index. - * - * @param fn - * a function that initializes a builder to create the - * {@link CreateIndexRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture create( - Function> fn) { - return create(fn.apply(new CreateIndexRequest.Builder()).build()); - } - - // ----- Endpoint: indices.create_data_stream - - /** - * Create a data stream. Creates a data stream. You must have a matching index - * template with data stream enabled. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture createDataStream(CreateDataStreamRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) CreateDataStreamRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Create a data stream. Creates a data stream. You must have a matching index - * template with data stream enabled. - * - * @param fn - * a function that initializes a builder to create the - * {@link CreateDataStreamRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture createDataStream( - Function> fn) { - return createDataStream(fn.apply(new CreateDataStreamRequest.Builder()).build()); - } - - // ----- Endpoint: indices.data_streams_stats - - /** - * Get data stream stats. Retrieves statistics for one or more data streams. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture dataStreamsStats(DataStreamsStatsRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) DataStreamsStatsRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Get data stream stats. Retrieves statistics for one or more data streams. - * - * @param fn - * a function that initializes a builder to create the - * {@link DataStreamsStatsRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture dataStreamsStats( - Function> fn) { - return dataStreamsStats(fn.apply(new DataStreamsStatsRequest.Builder()).build()); - } - - /** - * Get data stream stats. Retrieves statistics for one or more data streams. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture dataStreamsStats() { - return this.transport.performRequestAsync(new DataStreamsStatsRequest.Builder().build(), - DataStreamsStatsRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: indices.delete - - /** - * Delete indices. Deletes one or more indices. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture delete(DeleteIndexRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) DeleteIndexRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Delete indices. Deletes one or more indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteIndexRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture delete( - Function> fn) { - return delete(fn.apply(new DeleteIndexRequest.Builder()).build()); - } - - // ----- Endpoint: indices.delete_alias - - /** - * Delete an alias. Removes a data stream or index from an alias. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture deleteAlias(DeleteAliasRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) DeleteAliasRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Delete an alias. Removes a data stream or index from an alias. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteAliasRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture deleteAlias( - Function> fn) { - return deleteAlias(fn.apply(new DeleteAliasRequest.Builder()).build()); - } - - // ----- Endpoint: indices.delete_data_lifecycle - - /** - * Delete data stream lifecycles. Removes the data stream lifecycle from a data - * stream, rendering it not managed by the data stream lifecycle. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture deleteDataLifecycle(DeleteDataLifecycleRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) DeleteDataLifecycleRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Delete data stream lifecycles. Removes the data stream lifecycle from a data - * stream, rendering it not managed by the data stream lifecycle. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteDataLifecycleRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture deleteDataLifecycle( - Function> fn) { - return deleteDataLifecycle(fn.apply(new DeleteDataLifecycleRequest.Builder()).build()); - } - - // ----- Endpoint: indices.delete_data_stream - - /** - * Delete data streams. Deletes one or more data streams and their backing - * indices. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture deleteDataStream(DeleteDataStreamRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) DeleteDataStreamRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Delete data streams. Deletes one or more data streams and their backing - * indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteDataStreamRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture deleteDataStream( - Function> fn) { - return deleteDataStream(fn.apply(new DeleteDataStreamRequest.Builder()).build()); - } - - // ----- Endpoint: indices.delete_index_template - - /** - * 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. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture deleteIndexTemplate(DeleteIndexTemplateRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) DeleteIndexTemplateRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * 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. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteIndexTemplateRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture deleteIndexTemplate( - Function> fn) { - return deleteIndexTemplate(fn.apply(new DeleteIndexTemplateRequest.Builder()).build()); - } - - // ----- Endpoint: indices.exists - - /** - * Check indices. Checks if one or more indices, index aliases, or data streams - * exist. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture exists(ExistsRequest request) { - @SuppressWarnings("unchecked") - Endpoint endpoint = (Endpoint) ExistsRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Check indices. Checks if one or more indices, index aliases, or data streams - * exist. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExistsRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture exists( - Function> fn) { - return exists(fn.apply(new ExistsRequest.Builder()).build()); - } - - // ----- Endpoint: indices.exists_alias - - /** - * Check aliases. Checks if one or more data stream or index aliases exist. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture existsAlias(ExistsAliasRequest request) { - @SuppressWarnings("unchecked") - Endpoint endpoint = (Endpoint) ExistsAliasRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Check aliases. Checks if one or more data stream or index aliases exist. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExistsAliasRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture existsAlias( - Function> fn) { - return existsAlias(fn.apply(new ExistsAliasRequest.Builder()).build()); - } - - // ----- Endpoint: indices.exists_index_template - - /** - * Returns information about whether a particular index template exists. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture existsIndexTemplate(ExistsIndexTemplateRequest request) { - @SuppressWarnings("unchecked") - Endpoint endpoint = (Endpoint) ExistsIndexTemplateRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns information about whether a particular index template exists. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExistsIndexTemplateRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture existsIndexTemplate( - Function> fn) { - return existsIndexTemplate(fn.apply(new ExistsIndexTemplateRequest.Builder()).build()); - } - - // ----- Endpoint: indices.explain_data_lifecycle - - /** - * Get the status for a data stream lifecycle. Retrieves 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. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture explainDataLifecycle(ExplainDataLifecycleRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) ExplainDataLifecycleRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Get the status for a data stream lifecycle. Retrieves 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. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExplainDataLifecycleRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture explainDataLifecycle( - Function> fn) { - return explainDataLifecycle(fn.apply(new ExplainDataLifecycleRequest.Builder()).build()); - } - - // ----- Endpoint: indices.get - - /** - * Get index information. Returns information about one or more indices. For - * data streams, the API returns information about the stream’s backing indices. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture get(GetIndexRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) GetIndexRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Get index information. Returns information about one or more indices. For - * data streams, the API returns information about the stream’s backing indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetIndexRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture get( - Function> fn) { - return get(fn.apply(new GetIndexRequest.Builder()).build()); - } - - // ----- Endpoint: indices.get_alias - - /** - * Get aliases. Retrieves information for one or more data stream or index - * aliases. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture getAlias(GetAliasRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) GetAliasRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Get aliases. Retrieves information for one or more data stream or index - * aliases. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetAliasRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture getAlias( - Function> fn) { - return getAlias(fn.apply(new GetAliasRequest.Builder()).build()); - } - - /** - * Get aliases. Retrieves information for one or more data stream or index - * aliases. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture getAlias() { - return this.transport.performRequestAsync(new GetAliasRequest.Builder().build(), GetAliasRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: indices.get_data_lifecycle - - /** - * Get data stream lifecycles. Retrieves the data stream lifecycle configuration - * of one or more data streams. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture getDataLifecycle(GetDataLifecycleRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) GetDataLifecycleRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Get data stream lifecycles. Retrieves the data stream lifecycle configuration - * of one or more data streams. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetDataLifecycleRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture getDataLifecycle( - Function> fn) { - return getDataLifecycle(fn.apply(new GetDataLifecycleRequest.Builder()).build()); - } - - // ----- Endpoint: indices.get_data_stream - - /** - * Get data streams. Retrieves information about one or more data streams. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture getDataStream(GetDataStreamRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) GetDataStreamRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Get data streams. Retrieves information about one or more data streams. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetDataStreamRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture getDataStream( - Function> fn) { - return getDataStream(fn.apply(new GetDataStreamRequest.Builder()).build()); - } - - /** - * Get data streams. Retrieves information about one or more data streams. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture getDataStream() { - return this.transport.performRequestAsync(new GetDataStreamRequest.Builder().build(), - GetDataStreamRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: indices.get_index_template - - /** - * Get index templates. Returns information about one or more index templates. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture getIndexTemplate(GetIndexTemplateRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) GetIndexTemplateRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Get index templates. Returns information about one or more index templates. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetIndexTemplateRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture getIndexTemplate( - Function> fn) { - return getIndexTemplate(fn.apply(new GetIndexTemplateRequest.Builder()).build()); - } - - /** - * Get index templates. Returns information about one or more index templates. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture getIndexTemplate() { - return this.transport.performRequestAsync(new GetIndexTemplateRequest.Builder().build(), - GetIndexTemplateRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: indices.get_mapping - - /** - * Get mapping definitions. Retrieves mapping definitions for one or more - * indices. For data streams, the API retrieves mappings for the stream’s - * backing indices. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture getMapping(GetMappingRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) GetMappingRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Get mapping definitions. Retrieves mapping definitions for one or more - * indices. For data streams, the API retrieves mappings for the stream’s - * backing indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetMappingRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture getMapping( - Function> fn) { - return getMapping(fn.apply(new GetMappingRequest.Builder()).build()); - } - - /** - * Get mapping definitions. Retrieves mapping definitions for one or more - * indices. For data streams, the API retrieves mappings for the stream’s - * backing indices. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture getMapping() { - return this.transport.performRequestAsync(new GetMappingRequest.Builder().build(), GetMappingRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: indices.get_settings - - /** - * Get index settings. Returns setting information for one or more indices. For - * data streams, returns setting information for the stream’s backing indices. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture getSettings(GetIndicesSettingsRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) GetIndicesSettingsRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Get index settings. Returns setting information for one or more indices. For - * data streams, returns setting information for the stream’s backing indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetIndicesSettingsRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture getSettings( - Function> fn) { - return getSettings(fn.apply(new GetIndicesSettingsRequest.Builder()).build()); - } - - /** - * Get index settings. Returns setting information for one or more indices. For - * data streams, returns setting information for the stream’s backing indices. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture getSettings() { - return this.transport.performRequestAsync(new GetIndicesSettingsRequest.Builder().build(), - GetIndicesSettingsRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: indices.migrate_to_data_stream - - /** - * 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. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture migrateToDataStream(MigrateToDataStreamRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) MigrateToDataStreamRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * 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. - * - * @param fn - * a function that initializes a builder to create the - * {@link MigrateToDataStreamRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture migrateToDataStream( - Function> fn) { - return migrateToDataStream(fn.apply(new MigrateToDataStreamRequest.Builder()).build()); - } - - // ----- Endpoint: indices.modify_data_stream - - /** - * Update data streams. Performs one or more data stream modification actions in - * a single atomic operation. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture modifyDataStream(ModifyDataStreamRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) ModifyDataStreamRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Update data streams. Performs one or more data stream modification actions in - * a single atomic operation. - * - * @param fn - * a function that initializes a builder to create the - * {@link ModifyDataStreamRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture modifyDataStream( - Function> fn) { - return modifyDataStream(fn.apply(new ModifyDataStreamRequest.Builder()).build()); - } - - // ----- Endpoint: indices.put_alias - - /** - * Create or update an alias. Adds a data stream or index to an alias. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture putAlias(PutAliasRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) PutAliasRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Create or update an alias. Adds a data stream or index to an alias. - * - * @param fn - * a function that initializes a builder to create the - * {@link PutAliasRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture putAlias( - Function> fn) { - return putAlias(fn.apply(new PutAliasRequest.Builder()).build()); - } - - // ----- Endpoint: indices.put_data_lifecycle - - /** - * Update data stream lifecycles. Update the data stream lifecycle of the - * specified data streams. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture putDataLifecycle(PutDataLifecycleRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) PutDataLifecycleRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Update data stream lifecycles. Update the data stream lifecycle of the - * specified data streams. - * - * @param fn - * a function that initializes a builder to create the - * {@link PutDataLifecycleRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture putDataLifecycle( - Function> fn) { - return putDataLifecycle(fn.apply(new PutDataLifecycleRequest.Builder()).build()); - } - - // ----- Endpoint: indices.put_index_template - - /** - * Create or update an index template. Index templates define settings, - * mappings, and aliases that can be applied automatically to new indices. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture putIndexTemplate(PutIndexTemplateRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) PutIndexTemplateRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Create or update an index template. Index templates define settings, - * mappings, and aliases that can be applied automatically to new indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link PutIndexTemplateRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture putIndexTemplate( - Function> fn) { - return putIndexTemplate(fn.apply(new PutIndexTemplateRequest.Builder()).build()); - } - - // ----- Endpoint: indices.put_mapping - - /** - * Update field mappings. Adds new fields to an existing data stream or index. - * You can also use this API to change the search settings of existing fields. - * For data streams, these changes are applied to all backing indices by - * default. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture putMapping(PutMappingRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) PutMappingRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Update field mappings. Adds new fields to an existing data stream or index. - * You can also use this API to change the search settings of existing fields. - * For data streams, these changes are applied to all backing indices by - * default. - * - * @param fn - * a function that initializes a builder to create the - * {@link PutMappingRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture putMapping( - Function> fn) { - return putMapping(fn.apply(new PutMappingRequest.Builder()).build()); - } - - // ----- Endpoint: indices.put_settings - - /** - * Update index settings. Changes dynamic index settings in real time. For data - * streams, index setting changes are applied to all backing indices by default. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture putSettings(PutIndicesSettingsRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) PutIndicesSettingsRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Update index settings. Changes dynamic index settings in real time. For data - * streams, index setting changes are applied to all backing indices by default. - * - * @param fn - * a function that initializes a builder to create the - * {@link PutIndicesSettingsRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture putSettings( - Function> fn) { - return putSettings(fn.apply(new PutIndicesSettingsRequest.Builder()).build()); - } - - /** - * Update index settings. Changes dynamic index settings in real time. For data - * streams, index setting changes are applied to all backing indices by default. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture putSettings() { - return this.transport.performRequestAsync(new PutIndicesSettingsRequest.Builder().build(), - PutIndicesSettingsRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: indices.put_template - - /** - * Create or update an index template. Index templates define settings, - * mappings, and aliases that can be applied automatically to new indices. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture putTemplate(PutTemplateRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) PutTemplateRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Create or update an index template. Index templates define settings, - * mappings, and aliases that can be applied automatically to new indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link PutTemplateRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture putTemplate( - Function> fn) { - return putTemplate(fn.apply(new PutTemplateRequest.Builder()).build()); - } - - // ----- Endpoint: indices.refresh - - /** - * 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. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture refresh(RefreshRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) RefreshRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * 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. - * - * @param fn - * a function that initializes a builder to create the - * {@link RefreshRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture refresh( - Function> fn) { - return refresh(fn.apply(new RefreshRequest.Builder()).build()); - } - - /** - * 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. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture refresh() { - return this.transport.performRequestAsync(new RefreshRequest.Builder().build(), RefreshRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: indices.resolve_index - - /** - * Resolves the specified name(s) and/or index patterns for indices, aliases, - * and data streams. Multiple patterns and remote clusters are supported. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture resolveIndex(ResolveIndexRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) ResolveIndexRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Resolves the specified name(s) and/or index patterns for indices, aliases, - * and data streams. Multiple patterns and remote clusters are supported. - * - * @param fn - * a function that initializes a builder to create the - * {@link ResolveIndexRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture resolveIndex( - Function> fn) { - return resolveIndex(fn.apply(new ResolveIndexRequest.Builder()).build()); - } - - // ----- Endpoint: indices.rollover - - /** - * Roll over to a new index. Creates a new index for a data stream or index - * alias. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture rollover(RolloverRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) RolloverRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Roll over to a new index. Creates a new index for a data stream or index - * alias. - * - * @param fn - * a function that initializes a builder to create the - * {@link RolloverRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture rollover( - Function> fn) { - return rollover(fn.apply(new RolloverRequest.Builder()).build()); - } - - // ----- Endpoint: indices.simulate_index_template - - /** - * Simulate an index. Returns the index configuration that would be applied to - * the specified index from an existing index template. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture simulateIndexTemplate( - SimulateIndexTemplateRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) SimulateIndexTemplateRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Simulate an index. Returns the index configuration that would be applied to - * the specified index from an existing index template. - * - * @param fn - * a function that initializes a builder to create the - * {@link SimulateIndexTemplateRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture simulateIndexTemplate( - Function> fn) { - return simulateIndexTemplate(fn.apply(new SimulateIndexTemplateRequest.Builder()).build()); - } - - // ----- Endpoint: indices.simulate_template - - /** - * Simulate an index template. Returns the index configuration that would be - * applied by a particular index template. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture simulateTemplate(SimulateTemplateRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) SimulateTemplateRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Simulate an index template. Returns the index configuration that would be - * applied by a particular index template. - * - * @param fn - * a function that initializes a builder to create the - * {@link SimulateTemplateRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture simulateTemplate( - Function> fn) { - return simulateTemplate(fn.apply(new SimulateTemplateRequest.Builder()).build()); - } - - /** - * Simulate an index template. Returns the index configuration that would be - * applied by a particular index template. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture simulateTemplate() { - return this.transport.performRequestAsync(new SimulateTemplateRequest.Builder().build(), - SimulateTemplateRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: indices.update_aliases - - /** - * Create or update an alias. Adds a data stream or index to an alias. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture updateAliases(UpdateAliasesRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) UpdateAliasesRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Create or update an alias. Adds a data stream or index to an alias. - * - * @param fn - * a function that initializes a builder to create the - * {@link UpdateAliasesRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture updateAliases( - Function> fn) { - return updateAliases(fn.apply(new UpdateAliasesRequest.Builder()).build()); - } - - /** - * Create or update an alias. Adds a data stream or index to an alias. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture updateAliases() { - return this.transport.performRequestAsync(new UpdateAliasesRequest.Builder().build(), - UpdateAliasesRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: indices.validate_query - - /** - * Validate a query. Validates a query without running it. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture validateQuery(ValidateQueryRequest request) { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) ValidateQueryRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Validate a query. Validates a query without running it. - * - * @param fn - * a function that initializes a builder to create the - * {@link ValidateQueryRequest} - * @see Documentation - * on elastic.co - */ - - public final CompletableFuture validateQuery( - Function> fn) { - return validateQuery(fn.apply(new ValidateQueryRequest.Builder()).build()); - } - - /** - * Validate a query. Validates a query without running it. - * - * @see Documentation - * on elastic.co - */ - - public CompletableFuture validateQuery() { - return this.transport.performRequestAsync(new ValidateQueryRequest.Builder().build(), - ValidateQueryRequest._ENDPOINT, this.transportOptions); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesClient.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesClient.java deleted file mode 100644 index f9c544a6a..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesClient.java +++ /dev/null @@ -1,1542 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.ApiClient; -import co.elastic.clients.elasticsearch._types.ElasticsearchException; -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.transport.ElasticsearchTransport; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.JsonEndpoint; -import co.elastic.clients.transport.Transport; -import co.elastic.clients.transport.TransportOptions; -import co.elastic.clients.transport.endpoints.BooleanResponse; -import co.elastic.clients.util.ObjectBuilder; -import java.io.IOException; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Client for the indices namespace. - */ -public class ElasticsearchIndicesClient extends ApiClient { - - public ElasticsearchIndicesClient(ElasticsearchTransport transport) { - super(transport, null); - } - - public ElasticsearchIndicesClient(ElasticsearchTransport transport, @Nullable TransportOptions transportOptions) { - super(transport, transportOptions); - } - - @Override - public ElasticsearchIndicesClient withTransportOptions(@Nullable TransportOptions transportOptions) { - return new ElasticsearchIndicesClient(this.transport, transportOptions); - } - - // ----- Endpoint: indices.add_block - - /** - * Add an index block. Limits the operations allowed on an index by blocking - * specific operation types. - * - * @see Documentation - * on elastic.co - */ - - public AddBlockResponse addBlock(AddBlockRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) AddBlockRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Add an index block. Limits the operations allowed on an index by blocking - * specific operation types. - * - * @param fn - * a function that initializes a builder to create the - * {@link AddBlockRequest} - * @see Documentation - * on elastic.co - */ - - public final AddBlockResponse addBlock(Function> fn) - throws IOException, ElasticsearchException { - return addBlock(fn.apply(new AddBlockRequest.Builder()).build()); - } - - // ----- Endpoint: indices.analyze - - /** - * Performs analysis on a text string and returns the resulting tokens. - * - * @see Documentation - * on elastic.co - */ - - public AnalyzeResponse analyze(AnalyzeRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) AnalyzeRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Performs analysis on a text string and returns the resulting tokens. - * - * @param fn - * a function that initializes a builder to create the - * {@link AnalyzeRequest} - * @see Documentation - * on elastic.co - */ - - public final AnalyzeResponse analyze(Function> fn) - throws IOException, ElasticsearchException { - return analyze(fn.apply(new AnalyzeRequest.Builder()).build()); - } - - /** - * Performs analysis on a text string and returns the resulting tokens. - * - * @see Documentation - * on elastic.co - */ - - public AnalyzeResponse analyze() throws IOException, ElasticsearchException { - return this.transport.performRequest(new AnalyzeRequest.Builder().build(), AnalyzeRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: indices.create - - /** - * Create an index. Creates a new index. - * - * @see Documentation - * on elastic.co - */ - - public CreateIndexResponse create(CreateIndexRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) CreateIndexRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Create an index. Creates a new index. - * - * @param fn - * a function that initializes a builder to create the - * {@link CreateIndexRequest} - * @see Documentation - * on elastic.co - */ - - public final CreateIndexResponse create(Function> fn) - throws IOException, ElasticsearchException { - return create(fn.apply(new CreateIndexRequest.Builder()).build()); - } - - // ----- Endpoint: indices.create_data_stream - - /** - * Create a data stream. Creates a data stream. You must have a matching index - * template with data stream enabled. - * - * @see Documentation - * on elastic.co - */ - - public CreateDataStreamResponse createDataStream(CreateDataStreamRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) CreateDataStreamRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Create a data stream. Creates a data stream. You must have a matching index - * template with data stream enabled. - * - * @param fn - * a function that initializes a builder to create the - * {@link CreateDataStreamRequest} - * @see Documentation - * on elastic.co - */ - - public final CreateDataStreamResponse createDataStream( - Function> fn) - throws IOException, ElasticsearchException { - return createDataStream(fn.apply(new CreateDataStreamRequest.Builder()).build()); - } - - // ----- Endpoint: indices.data_streams_stats - - /** - * Get data stream stats. Retrieves statistics for one or more data streams. - * - * @see Documentation - * on elastic.co - */ - - public DataStreamsStatsResponse dataStreamsStats(DataStreamsStatsRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) DataStreamsStatsRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Get data stream stats. Retrieves statistics for one or more data streams. - * - * @param fn - * a function that initializes a builder to create the - * {@link DataStreamsStatsRequest} - * @see Documentation - * on elastic.co - */ - - public final DataStreamsStatsResponse dataStreamsStats( - Function> fn) - throws IOException, ElasticsearchException { - return dataStreamsStats(fn.apply(new DataStreamsStatsRequest.Builder()).build()); - } - - /** - * Get data stream stats. Retrieves statistics for one or more data streams. - * - * @see Documentation - * on elastic.co - */ - - public DataStreamsStatsResponse dataStreamsStats() throws IOException, ElasticsearchException { - return this.transport.performRequest(new DataStreamsStatsRequest.Builder().build(), - DataStreamsStatsRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: indices.delete - - /** - * Delete indices. Deletes one or more indices. - * - * @see Documentation - * on elastic.co - */ - - public DeleteIndexResponse delete(DeleteIndexRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) DeleteIndexRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Delete indices. Deletes one or more indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteIndexRequest} - * @see Documentation - * on elastic.co - */ - - public final DeleteIndexResponse delete(Function> fn) - throws IOException, ElasticsearchException { - return delete(fn.apply(new DeleteIndexRequest.Builder()).build()); - } - - // ----- Endpoint: indices.delete_alias - - /** - * Delete an alias. Removes a data stream or index from an alias. - * - * @see Documentation - * on elastic.co - */ - - public DeleteAliasResponse deleteAlias(DeleteAliasRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) DeleteAliasRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Delete an alias. Removes a data stream or index from an alias. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteAliasRequest} - * @see Documentation - * on elastic.co - */ - - public final DeleteAliasResponse deleteAlias( - Function> fn) - throws IOException, ElasticsearchException { - return deleteAlias(fn.apply(new DeleteAliasRequest.Builder()).build()); - } - - // ----- Endpoint: indices.delete_data_lifecycle - - /** - * Delete data stream lifecycles. Removes the data stream lifecycle from a data - * stream, rendering it not managed by the data stream lifecycle. - * - * @see Documentation - * on elastic.co - */ - - public DeleteDataLifecycleResponse deleteDataLifecycle(DeleteDataLifecycleRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) DeleteDataLifecycleRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Delete data stream lifecycles. Removes the data stream lifecycle from a data - * stream, rendering it not managed by the data stream lifecycle. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteDataLifecycleRequest} - * @see Documentation - * on elastic.co - */ - - public final DeleteDataLifecycleResponse deleteDataLifecycle( - Function> fn) - throws IOException, ElasticsearchException { - return deleteDataLifecycle(fn.apply(new DeleteDataLifecycleRequest.Builder()).build()); - } - - // ----- Endpoint: indices.delete_data_stream - - /** - * Delete data streams. Deletes one or more data streams and their backing - * indices. - * - * @see Documentation - * on elastic.co - */ - - public DeleteDataStreamResponse deleteDataStream(DeleteDataStreamRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) DeleteDataStreamRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Delete data streams. Deletes one or more data streams and their backing - * indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteDataStreamRequest} - * @see Documentation - * on elastic.co - */ - - public final DeleteDataStreamResponse deleteDataStream( - Function> fn) - throws IOException, ElasticsearchException { - return deleteDataStream(fn.apply(new DeleteDataStreamRequest.Builder()).build()); - } - - // ----- Endpoint: indices.delete_index_template - - /** - * 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. - * - * @see Documentation - * on elastic.co - */ - - public DeleteIndexTemplateResponse deleteIndexTemplate(DeleteIndexTemplateRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) DeleteIndexTemplateRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * 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. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteIndexTemplateRequest} - * @see Documentation - * on elastic.co - */ - - public final DeleteIndexTemplateResponse deleteIndexTemplate( - Function> fn) - throws IOException, ElasticsearchException { - return deleteIndexTemplate(fn.apply(new DeleteIndexTemplateRequest.Builder()).build()); - } - - // ----- Endpoint: indices.exists - - /** - * Check indices. Checks if one or more indices, index aliases, or data streams - * exist. - * - * @see Documentation - * on elastic.co - */ - - public BooleanResponse exists(ExistsRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - Endpoint endpoint = (Endpoint) ExistsRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Check indices. Checks if one or more indices, index aliases, or data streams - * exist. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExistsRequest} - * @see Documentation - * on elastic.co - */ - - public final BooleanResponse exists(Function> fn) - throws IOException, ElasticsearchException { - return exists(fn.apply(new ExistsRequest.Builder()).build()); - } - - // ----- Endpoint: indices.exists_alias - - /** - * Check aliases. Checks if one or more data stream or index aliases exist. - * - * @see Documentation - * on elastic.co - */ - - public BooleanResponse existsAlias(ExistsAliasRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - Endpoint endpoint = (Endpoint) ExistsAliasRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Check aliases. Checks if one or more data stream or index aliases exist. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExistsAliasRequest} - * @see Documentation - * on elastic.co - */ - - public final BooleanResponse existsAlias(Function> fn) - throws IOException, ElasticsearchException { - return existsAlias(fn.apply(new ExistsAliasRequest.Builder()).build()); - } - - // ----- Endpoint: indices.exists_index_template - - /** - * Returns information about whether a particular index template exists. - * - * @see Documentation - * on elastic.co - */ - - public BooleanResponse existsIndexTemplate(ExistsIndexTemplateRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - Endpoint endpoint = (Endpoint) ExistsIndexTemplateRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns information about whether a particular index template exists. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExistsIndexTemplateRequest} - * @see Documentation - * on elastic.co - */ - - public final BooleanResponse existsIndexTemplate( - Function> fn) - throws IOException, ElasticsearchException { - return existsIndexTemplate(fn.apply(new ExistsIndexTemplateRequest.Builder()).build()); - } - - // ----- Endpoint: indices.explain_data_lifecycle - - /** - * Get the status for a data stream lifecycle. Retrieves 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. - * - * @see Documentation - * on elastic.co - */ - - public ExplainDataLifecycleResponse explainDataLifecycle(ExplainDataLifecycleRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) ExplainDataLifecycleRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Get the status for a data stream lifecycle. Retrieves 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. - * - * @param fn - * a function that initializes a builder to create the - * {@link ExplainDataLifecycleRequest} - * @see Documentation - * on elastic.co - */ - - public final ExplainDataLifecycleResponse explainDataLifecycle( - Function> fn) - throws IOException, ElasticsearchException { - return explainDataLifecycle(fn.apply(new ExplainDataLifecycleRequest.Builder()).build()); - } - - // ----- Endpoint: indices.get - - /** - * Get index information. Returns information about one or more indices. For - * data streams, the API returns information about the stream’s backing indices. - * - * @see Documentation - * on elastic.co - */ - - public GetIndexResponse get(GetIndexRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) GetIndexRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Get index information. Returns information about one or more indices. For - * data streams, the API returns information about the stream’s backing indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetIndexRequest} - * @see Documentation - * on elastic.co - */ - - public final GetIndexResponse get(Function> fn) - throws IOException, ElasticsearchException { - return get(fn.apply(new GetIndexRequest.Builder()).build()); - } - - // ----- Endpoint: indices.get_alias - - /** - * Get aliases. Retrieves information for one or more data stream or index - * aliases. - * - * @see Documentation - * on elastic.co - */ - - public GetAliasResponse getAlias(GetAliasRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) GetAliasRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Get aliases. Retrieves information for one or more data stream or index - * aliases. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetAliasRequest} - * @see Documentation - * on elastic.co - */ - - public final GetAliasResponse getAlias(Function> fn) - throws IOException, ElasticsearchException { - return getAlias(fn.apply(new GetAliasRequest.Builder()).build()); - } - - /** - * Get aliases. Retrieves information for one or more data stream or index - * aliases. - * - * @see Documentation - * on elastic.co - */ - - public GetAliasResponse getAlias() throws IOException, ElasticsearchException { - return this.transport.performRequest(new GetAliasRequest.Builder().build(), GetAliasRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: indices.get_data_lifecycle - - /** - * Get data stream lifecycles. Retrieves the data stream lifecycle configuration - * of one or more data streams. - * - * @see Documentation - * on elastic.co - */ - - public GetDataLifecycleResponse getDataLifecycle(GetDataLifecycleRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) GetDataLifecycleRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Get data stream lifecycles. Retrieves the data stream lifecycle configuration - * of one or more data streams. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetDataLifecycleRequest} - * @see Documentation - * on elastic.co - */ - - public final GetDataLifecycleResponse getDataLifecycle( - Function> fn) - throws IOException, ElasticsearchException { - return getDataLifecycle(fn.apply(new GetDataLifecycleRequest.Builder()).build()); - } - - // ----- Endpoint: indices.get_data_stream - - /** - * Get data streams. Retrieves information about one or more data streams. - * - * @see Documentation - * on elastic.co - */ - - public GetDataStreamResponse getDataStream(GetDataStreamRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) GetDataStreamRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Get data streams. Retrieves information about one or more data streams. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetDataStreamRequest} - * @see Documentation - * on elastic.co - */ - - public final GetDataStreamResponse getDataStream( - Function> fn) - throws IOException, ElasticsearchException { - return getDataStream(fn.apply(new GetDataStreamRequest.Builder()).build()); - } - - /** - * Get data streams. Retrieves information about one or more data streams. - * - * @see Documentation - * on elastic.co - */ - - public GetDataStreamResponse getDataStream() throws IOException, ElasticsearchException { - return this.transport.performRequest(new GetDataStreamRequest.Builder().build(), GetDataStreamRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: indices.get_index_template - - /** - * Get index templates. Returns information about one or more index templates. - * - * @see Documentation - * on elastic.co - */ - - public GetIndexTemplateResponse getIndexTemplate(GetIndexTemplateRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) GetIndexTemplateRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Get index templates. Returns information about one or more index templates. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetIndexTemplateRequest} - * @see Documentation - * on elastic.co - */ - - public final GetIndexTemplateResponse getIndexTemplate( - Function> fn) - throws IOException, ElasticsearchException { - return getIndexTemplate(fn.apply(new GetIndexTemplateRequest.Builder()).build()); - } - - /** - * Get index templates. Returns information about one or more index templates. - * - * @see Documentation - * on elastic.co - */ - - public GetIndexTemplateResponse getIndexTemplate() throws IOException, ElasticsearchException { - return this.transport.performRequest(new GetIndexTemplateRequest.Builder().build(), - GetIndexTemplateRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: indices.get_mapping - - /** - * Get mapping definitions. Retrieves mapping definitions for one or more - * indices. For data streams, the API retrieves mappings for the stream’s - * backing indices. - * - * @see Documentation - * on elastic.co - */ - - public GetMappingResponse getMapping(GetMappingRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) GetMappingRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Get mapping definitions. Retrieves mapping definitions for one or more - * indices. For data streams, the API retrieves mappings for the stream’s - * backing indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetMappingRequest} - * @see Documentation - * on elastic.co - */ - - public final GetMappingResponse getMapping(Function> fn) - throws IOException, ElasticsearchException { - return getMapping(fn.apply(new GetMappingRequest.Builder()).build()); - } - - /** - * Get mapping definitions. Retrieves mapping definitions for one or more - * indices. For data streams, the API retrieves mappings for the stream’s - * backing indices. - * - * @see Documentation - * on elastic.co - */ - - public GetMappingResponse getMapping() throws IOException, ElasticsearchException { - return this.transport.performRequest(new GetMappingRequest.Builder().build(), GetMappingRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: indices.get_settings - - /** - * Get index settings. Returns setting information for one or more indices. For - * data streams, returns setting information for the stream’s backing indices. - * - * @see Documentation - * on elastic.co - */ - - public GetIndicesSettingsResponse getSettings(GetIndicesSettingsRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) GetIndicesSettingsRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Get index settings. Returns setting information for one or more indices. For - * data streams, returns setting information for the stream’s backing indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetIndicesSettingsRequest} - * @see Documentation - * on elastic.co - */ - - public final GetIndicesSettingsResponse getSettings( - Function> fn) - throws IOException, ElasticsearchException { - return getSettings(fn.apply(new GetIndicesSettingsRequest.Builder()).build()); - } - - /** - * Get index settings. Returns setting information for one or more indices. For - * data streams, returns setting information for the stream’s backing indices. - * - * @see Documentation - * on elastic.co - */ - - public GetIndicesSettingsResponse getSettings() throws IOException, ElasticsearchException { - return this.transport.performRequest(new GetIndicesSettingsRequest.Builder().build(), - GetIndicesSettingsRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: indices.migrate_to_data_stream - - /** - * 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. - * - * @see Documentation - * on elastic.co - */ - - public MigrateToDataStreamResponse migrateToDataStream(MigrateToDataStreamRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) MigrateToDataStreamRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * 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. - * - * @param fn - * a function that initializes a builder to create the - * {@link MigrateToDataStreamRequest} - * @see Documentation - * on elastic.co - */ - - public final MigrateToDataStreamResponse migrateToDataStream( - Function> fn) - throws IOException, ElasticsearchException { - return migrateToDataStream(fn.apply(new MigrateToDataStreamRequest.Builder()).build()); - } - - // ----- Endpoint: indices.modify_data_stream - - /** - * Update data streams. Performs one or more data stream modification actions in - * a single atomic operation. - * - * @see Documentation - * on elastic.co - */ - - public ModifyDataStreamResponse modifyDataStream(ModifyDataStreamRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) ModifyDataStreamRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Update data streams. Performs one or more data stream modification actions in - * a single atomic operation. - * - * @param fn - * a function that initializes a builder to create the - * {@link ModifyDataStreamRequest} - * @see Documentation - * on elastic.co - */ - - public final ModifyDataStreamResponse modifyDataStream( - Function> fn) - throws IOException, ElasticsearchException { - return modifyDataStream(fn.apply(new ModifyDataStreamRequest.Builder()).build()); - } - - // ----- Endpoint: indices.put_alias - - /** - * Create or update an alias. Adds a data stream or index to an alias. - * - * @see Documentation - * on elastic.co - */ - - public PutAliasResponse putAlias(PutAliasRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) PutAliasRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Create or update an alias. Adds a data stream or index to an alias. - * - * @param fn - * a function that initializes a builder to create the - * {@link PutAliasRequest} - * @see Documentation - * on elastic.co - */ - - public final PutAliasResponse putAlias(Function> fn) - throws IOException, ElasticsearchException { - return putAlias(fn.apply(new PutAliasRequest.Builder()).build()); - } - - // ----- Endpoint: indices.put_data_lifecycle - - /** - * Update data stream lifecycles. Update the data stream lifecycle of the - * specified data streams. - * - * @see Documentation - * on elastic.co - */ - - public PutDataLifecycleResponse putDataLifecycle(PutDataLifecycleRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) PutDataLifecycleRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Update data stream lifecycles. Update the data stream lifecycle of the - * specified data streams. - * - * @param fn - * a function that initializes a builder to create the - * {@link PutDataLifecycleRequest} - * @see Documentation - * on elastic.co - */ - - public final PutDataLifecycleResponse putDataLifecycle( - Function> fn) - throws IOException, ElasticsearchException { - return putDataLifecycle(fn.apply(new PutDataLifecycleRequest.Builder()).build()); - } - - // ----- Endpoint: indices.put_index_template - - /** - * Create or update an index template. Index templates define settings, - * mappings, and aliases that can be applied automatically to new indices. - * - * @see Documentation - * on elastic.co - */ - - public PutIndexTemplateResponse putIndexTemplate(PutIndexTemplateRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) PutIndexTemplateRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Create or update an index template. Index templates define settings, - * mappings, and aliases that can be applied automatically to new indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link PutIndexTemplateRequest} - * @see Documentation - * on elastic.co - */ - - public final PutIndexTemplateResponse putIndexTemplate( - Function> fn) - throws IOException, ElasticsearchException { - return putIndexTemplate(fn.apply(new PutIndexTemplateRequest.Builder()).build()); - } - - // ----- Endpoint: indices.put_mapping - - /** - * Update field mappings. Adds new fields to an existing data stream or index. - * You can also use this API to change the search settings of existing fields. - * For data streams, these changes are applied to all backing indices by - * default. - * - * @see Documentation - * on elastic.co - */ - - public PutMappingResponse putMapping(PutMappingRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) PutMappingRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Update field mappings. Adds new fields to an existing data stream or index. - * You can also use this API to change the search settings of existing fields. - * For data streams, these changes are applied to all backing indices by - * default. - * - * @param fn - * a function that initializes a builder to create the - * {@link PutMappingRequest} - * @see Documentation - * on elastic.co - */ - - public final PutMappingResponse putMapping(Function> fn) - throws IOException, ElasticsearchException { - return putMapping(fn.apply(new PutMappingRequest.Builder()).build()); - } - - // ----- Endpoint: indices.put_settings - - /** - * Update index settings. Changes dynamic index settings in real time. For data - * streams, index setting changes are applied to all backing indices by default. - * - * @see Documentation - * on elastic.co - */ - - public PutIndicesSettingsResponse putSettings(PutIndicesSettingsRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) PutIndicesSettingsRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Update index settings. Changes dynamic index settings in real time. For data - * streams, index setting changes are applied to all backing indices by default. - * - * @param fn - * a function that initializes a builder to create the - * {@link PutIndicesSettingsRequest} - * @see Documentation - * on elastic.co - */ - - public final PutIndicesSettingsResponse putSettings( - Function> fn) - throws IOException, ElasticsearchException { - return putSettings(fn.apply(new PutIndicesSettingsRequest.Builder()).build()); - } - - /** - * Update index settings. Changes dynamic index settings in real time. For data - * streams, index setting changes are applied to all backing indices by default. - * - * @see Documentation - * on elastic.co - */ - - public PutIndicesSettingsResponse putSettings() throws IOException, ElasticsearchException { - return this.transport.performRequest(new PutIndicesSettingsRequest.Builder().build(), - PutIndicesSettingsRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: indices.put_template - - /** - * Create or update an index template. Index templates define settings, - * mappings, and aliases that can be applied automatically to new indices. - * - * @see Documentation - * on elastic.co - */ - - public PutTemplateResponse putTemplate(PutTemplateRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) PutTemplateRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Create or update an index template. Index templates define settings, - * mappings, and aliases that can be applied automatically to new indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link PutTemplateRequest} - * @see Documentation - * on elastic.co - */ - - public final PutTemplateResponse putTemplate( - Function> fn) - throws IOException, ElasticsearchException { - return putTemplate(fn.apply(new PutTemplateRequest.Builder()).build()); - } - - // ----- Endpoint: indices.refresh - - /** - * 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. - * - * @see Documentation - * on elastic.co - */ - - public RefreshResponse refresh(RefreshRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) RefreshRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * 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. - * - * @param fn - * a function that initializes a builder to create the - * {@link RefreshRequest} - * @see Documentation - * on elastic.co - */ - - public final RefreshResponse refresh(Function> fn) - throws IOException, ElasticsearchException { - return refresh(fn.apply(new RefreshRequest.Builder()).build()); - } - - /** - * 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. - * - * @see Documentation - * on elastic.co - */ - - public RefreshResponse refresh() throws IOException, ElasticsearchException { - return this.transport.performRequest(new RefreshRequest.Builder().build(), RefreshRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: indices.resolve_index - - /** - * Resolves the specified name(s) and/or index patterns for indices, aliases, - * and data streams. Multiple patterns and remote clusters are supported. - * - * @see Documentation - * on elastic.co - */ - - public ResolveIndexResponse resolveIndex(ResolveIndexRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) ResolveIndexRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Resolves the specified name(s) and/or index patterns for indices, aliases, - * and data streams. Multiple patterns and remote clusters are supported. - * - * @param fn - * a function that initializes a builder to create the - * {@link ResolveIndexRequest} - * @see Documentation - * on elastic.co - */ - - public final ResolveIndexResponse resolveIndex( - Function> fn) - throws IOException, ElasticsearchException { - return resolveIndex(fn.apply(new ResolveIndexRequest.Builder()).build()); - } - - // ----- Endpoint: indices.rollover - - /** - * Roll over to a new index. Creates a new index for a data stream or index - * alias. - * - * @see Documentation - * on elastic.co - */ - - public RolloverResponse rollover(RolloverRequest request) throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) RolloverRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Roll over to a new index. Creates a new index for a data stream or index - * alias. - * - * @param fn - * a function that initializes a builder to create the - * {@link RolloverRequest} - * @see Documentation - * on elastic.co - */ - - public final RolloverResponse rollover(Function> fn) - throws IOException, ElasticsearchException { - return rollover(fn.apply(new RolloverRequest.Builder()).build()); - } - - // ----- Endpoint: indices.simulate_index_template - - /** - * Simulate an index. Returns the index configuration that would be applied to - * the specified index from an existing index template. - * - * @see Documentation - * on elastic.co - */ - - public SimulateIndexTemplateResponse simulateIndexTemplate(SimulateIndexTemplateRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) SimulateIndexTemplateRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Simulate an index. Returns the index configuration that would be applied to - * the specified index from an existing index template. - * - * @param fn - * a function that initializes a builder to create the - * {@link SimulateIndexTemplateRequest} - * @see Documentation - * on elastic.co - */ - - public final SimulateIndexTemplateResponse simulateIndexTemplate( - Function> fn) - throws IOException, ElasticsearchException { - return simulateIndexTemplate(fn.apply(new SimulateIndexTemplateRequest.Builder()).build()); - } - - // ----- Endpoint: indices.simulate_template - - /** - * Simulate an index template. Returns the index configuration that would be - * applied by a particular index template. - * - * @see Documentation - * on elastic.co - */ - - public SimulateTemplateResponse simulateTemplate(SimulateTemplateRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) SimulateTemplateRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Simulate an index template. Returns the index configuration that would be - * applied by a particular index template. - * - * @param fn - * a function that initializes a builder to create the - * {@link SimulateTemplateRequest} - * @see Documentation - * on elastic.co - */ - - public final SimulateTemplateResponse simulateTemplate( - Function> fn) - throws IOException, ElasticsearchException { - return simulateTemplate(fn.apply(new SimulateTemplateRequest.Builder()).build()); - } - - /** - * Simulate an index template. Returns the index configuration that would be - * applied by a particular index template. - * - * @see Documentation - * on elastic.co - */ - - public SimulateTemplateResponse simulateTemplate() throws IOException, ElasticsearchException { - return this.transport.performRequest(new SimulateTemplateRequest.Builder().build(), - SimulateTemplateRequest._ENDPOINT, this.transportOptions); - } - - // ----- Endpoint: indices.update_aliases - - /** - * Create or update an alias. Adds a data stream or index to an alias. - * - * @see Documentation - * on elastic.co - */ - - public UpdateAliasesResponse updateAliases(UpdateAliasesRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) UpdateAliasesRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Create or update an alias. Adds a data stream or index to an alias. - * - * @param fn - * a function that initializes a builder to create the - * {@link UpdateAliasesRequest} - * @see Documentation - * on elastic.co - */ - - public final UpdateAliasesResponse updateAliases( - Function> fn) - throws IOException, ElasticsearchException { - return updateAliases(fn.apply(new UpdateAliasesRequest.Builder()).build()); - } - - /** - * Create or update an alias. Adds a data stream or index to an alias. - * - * @see Documentation - * on elastic.co - */ - - public UpdateAliasesResponse updateAliases() throws IOException, ElasticsearchException { - return this.transport.performRequest(new UpdateAliasesRequest.Builder().build(), UpdateAliasesRequest._ENDPOINT, - this.transportOptions); - } - - // ----- Endpoint: indices.validate_query - - /** - * Validate a query. Validates a query without running it. - * - * @see Documentation - * on elastic.co - */ - - public ValidateQueryResponse validateQuery(ValidateQueryRequest request) - throws IOException, ElasticsearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) ValidateQueryRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Validate a query. Validates a query without running it. - * - * @param fn - * a function that initializes a builder to create the - * {@link ValidateQueryRequest} - * @see Documentation - * on elastic.co - */ - - public final ValidateQueryResponse validateQuery( - Function> fn) - throws IOException, ElasticsearchException { - return validateQuery(fn.apply(new ValidateQueryRequest.Builder()).build()); - } - - /** - * Validate a query. Validates a query without running it. - * - * @see Documentation - * on elastic.co - */ - - public ValidateQueryResponse validateQuery() throws IOException, ElasticsearchException { - return this.transport.performRequest(new ValidateQueryRequest.Builder().build(), ValidateQueryRequest._ENDPOINT, - this.transportOptions); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ExistsAliasRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ExistsAliasRequest.java deleted file mode 100644 index b86cd677b..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ExistsAliasRequest.java +++ /dev/null @@ -1,426 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.ExpandWildcard; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.BooleanEndpoint; -import co.elastic.clients.transport.endpoints.BooleanResponse; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.exists_alias.Request - -/** - * Check aliases. Checks if one or more data stream or index aliases exist. - * - * @see API - * specification - */ - -public class ExistsAliasRequest extends RequestBase { - @Nullable - private final Boolean allowNoIndices; - - private final List expandWildcards; - - @Nullable - private final Boolean ignoreUnavailable; - - private final List index; - - @Nullable - private final Boolean local; - - private final List name; - - // --------------------------------------------------------------------------------------------- - - private ExistsAliasRequest(Builder builder) { - - this.allowNoIndices = builder.allowNoIndices; - this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); - this.ignoreUnavailable = builder.ignoreUnavailable; - this.index = ApiTypeHelper.unmodifiable(builder.index); - this.local = builder.local; - this.name = ApiTypeHelper.unmodifiableRequired(builder.name, this, "name"); - - } - - public static ExistsAliasRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code allow_no_indices} - */ - @Nullable - public final Boolean allowNoIndices() { - return this.allowNoIndices; - } - - /** - * 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. - *

- * API name: {@code expand_wildcards} - */ - public final List expandWildcards() { - return this.expandWildcards; - } - - /** - * If false, requests that include a missing data stream or index - * in the target indices or data streams return an error. - *

- * API name: {@code ignore_unavailable} - */ - @Nullable - public final Boolean ignoreUnavailable() { - return this.ignoreUnavailable; - } - - /** - * 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. - *

- * API name: {@code index} - */ - public final List index() { - return this.index; - } - - /** - * If true, the request retrieves information from the local node - * only. - *

- * API name: {@code local} - */ - @Nullable - public final Boolean local() { - return this.local; - } - - /** - * Required - Comma-separated list of aliases to check. Supports wildcards - * (*). - *

- * API name: {@code name} - */ - public final List name() { - return this.name; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ExistsAliasRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private Boolean allowNoIndices; - - @Nullable - private List expandWildcards; - - @Nullable - private Boolean ignoreUnavailable; - - @Nullable - private List index; - - @Nullable - private Boolean local; - - private List name; - - /** - * 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. - *

- * API name: {@code allow_no_indices} - */ - public final Builder allowNoIndices(@Nullable Boolean value) { - this.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. - *

- * API name: {@code expand_wildcards} - *

- * Adds all elements of list to expandWildcards. - */ - public final Builder expandWildcards(List list) { - this.expandWildcards = _listAddAll(this.expandWildcards, list); - 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. - *

- * API name: {@code expand_wildcards} - *

- * Adds one or more values to expandWildcards. - */ - public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { - this.expandWildcards = _listAdd(this.expandWildcards, value, values); - return this; - } - - /** - * If false, requests that include a missing data stream or index - * in the target indices or data streams return an error. - *

- * API name: {@code ignore_unavailable} - */ - public final Builder ignoreUnavailable(@Nullable Boolean value) { - this.ignoreUnavailable = value; - return this; - } - - /** - * 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. - *

- * API name: {@code index} - *

- * Adds all elements of list to index. - */ - public final Builder index(List list) { - this.index = _listAddAll(this.index, list); - return this; - } - - /** - * 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. - *

- * API name: {@code index} - *

- * Adds one or more values to index. - */ - public final Builder index(String value, String... values) { - this.index = _listAdd(this.index, value, values); - return this; - } - - /** - * If true, the request retrieves information from the local node - * only. - *

- * API name: {@code local} - */ - public final Builder local(@Nullable Boolean value) { - this.local = value; - return this; - } - - /** - * Required - Comma-separated list of aliases to check. Supports wildcards - * (*). - *

- * API name: {@code name} - *

- * Adds all elements of list to name. - */ - public final Builder name(List list) { - this.name = _listAddAll(this.name, list); - return this; - } - - /** - * Required - Comma-separated list of aliases to check. Supports wildcards - * (*). - *

- * API name: {@code name} - *

- * Adds one or more values to name. - */ - public final Builder name(String value, String... values) { - this.name = _listAdd(this.name, value, values); - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ExistsAliasRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ExistsAliasRequest build() { - _checkSingleUse(); - - return new ExistsAliasRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.exists_alias}". - */ - public static final Endpoint _ENDPOINT = new BooleanEndpoint<>( - "es/indices.exists_alias", - - // Request method - request -> { - return "HEAD"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - final int _index = 1 << 1; - - int propsSet = 0; - - propsSet |= _name; - if (ApiTypeHelper.isDefined(request.index())) - propsSet |= _index; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_alias"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); - return buf.toString(); - } - if (propsSet == (_index | _name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_alias"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - final int _index = 1 << 1; - - int propsSet = 0; - - propsSet |= _name; - if (ApiTypeHelper.isDefined(request.index())) - propsSet |= _index; - - if (propsSet == (_name)) { - params.put("name", request.name.stream().map(v -> v).collect(Collectors.joining(","))); - } - if (propsSet == (_index | _name)) { - params.put("index", request.index.stream().map(v -> v).collect(Collectors.joining(","))); - params.put("name", request.name.stream().map(v -> v).collect(Collectors.joining(","))); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (ApiTypeHelper.isDefined(request.expandWildcards)) { - params.put("expand_wildcards", - request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); - } - if (request.ignoreUnavailable != null) { - params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); - } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } - if (request.local != null) { - params.put("local", String.valueOf(request.local)); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, null); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ExistsIndexTemplateRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ExistsIndexTemplateRequest.java deleted file mode 100644 index f204a6986..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ExistsIndexTemplateRequest.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.BooleanEndpoint; -import co.elastic.clients.transport.endpoints.BooleanResponse; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.exists_index_template.Request - -/** - * Returns information about whether a particular index template exists. - * - * @see API - * specification - */ - -public class ExistsIndexTemplateRequest extends RequestBase { - @Nullable - private final Time masterTimeout; - - private final String name; - - // --------------------------------------------------------------------------------------------- - - private ExistsIndexTemplateRequest(Builder builder) { - - this.masterTimeout = builder.masterTimeout; - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - - } - - public static ExistsIndexTemplateRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * Required - Comma-separated list of index template names used to limit the - * request. Wildcard (*) expressions are supported. - *

- * API name: {@code name} - */ - public final String name() { - return this.name; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ExistsIndexTemplateRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private Time masterTimeout; - - private String 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Required - Comma-separated list of index template names used to limit the - * request. Wildcard (*) expressions are supported. - *

- * API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ExistsIndexTemplateRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ExistsIndexTemplateRequest build() { - _checkSingleUse(); - - return new ExistsIndexTemplateRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.exists_index_template}". - */ - public static final Endpoint _ENDPOINT = new BooleanEndpoint<>( - "es/indices.exists_index_template", - - // Request method - request -> { - return "HEAD"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_index_template"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - params.put("name", request.name); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, null); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ExistsRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ExistsRequest.java deleted file mode 100644 index 1e11e63ea..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ExistsRequest.java +++ /dev/null @@ -1,420 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.ExpandWildcard; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.BooleanEndpoint; -import co.elastic.clients.transport.endpoints.BooleanResponse; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.exists.Request - -/** - * Check indices. Checks if one or more indices, index aliases, or data streams - * exist. - * - * @see API - * specification - */ - -public class ExistsRequest extends RequestBase { - @Nullable - private final Boolean allowNoIndices; - - private final List expandWildcards; - - @Nullable - private final Boolean flatSettings; - - @Nullable - private final Boolean ignoreUnavailable; - - @Nullable - private final Boolean includeDefaults; - - private final List index; - - @Nullable - private final Boolean local; - - // --------------------------------------------------------------------------------------------- - - private ExistsRequest(Builder builder) { - - this.allowNoIndices = builder.allowNoIndices; - this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); - this.flatSettings = builder.flatSettings; - this.ignoreUnavailable = builder.ignoreUnavailable; - this.includeDefaults = builder.includeDefaults; - this.index = ApiTypeHelper.unmodifiableRequired(builder.index, this, "index"); - this.local = builder.local; - - } - - public static ExistsRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code allow_no_indices} - */ - @Nullable - public final Boolean allowNoIndices() { - return this.allowNoIndices; - } - - /** - * 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. - *

- * API name: {@code expand_wildcards} - */ - public final List expandWildcards() { - return this.expandWildcards; - } - - /** - * If true, returns settings in flat format. - *

- * API name: {@code flat_settings} - */ - @Nullable - public final Boolean flatSettings() { - return this.flatSettings; - } - - /** - * If false, the request returns an error if it targets a missing - * or closed index. - *

- * API name: {@code ignore_unavailable} - */ - @Nullable - public final Boolean ignoreUnavailable() { - return this.ignoreUnavailable; - } - - /** - * If true, return all default settings in the response. - *

- * API name: {@code include_defaults} - */ - @Nullable - public final Boolean includeDefaults() { - return this.includeDefaults; - } - - /** - * Required - Comma-separated list of data streams, indices, and aliases. - * Supports wildcards (*). - *

- * API name: {@code index} - */ - public final List index() { - return this.index; - } - - /** - * If true, the request retrieves information from the local node - * only. - *

- * API name: {@code local} - */ - @Nullable - public final Boolean local() { - return this.local; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ExistsRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { - @Nullable - private Boolean allowNoIndices; - - @Nullable - private List expandWildcards; - - @Nullable - private Boolean flatSettings; - - @Nullable - private Boolean ignoreUnavailable; - - @Nullable - private Boolean includeDefaults; - - private List index; - - @Nullable - private Boolean 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. - *

- * API name: {@code allow_no_indices} - */ - public final Builder allowNoIndices(@Nullable Boolean value) { - this.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. - *

- * API name: {@code expand_wildcards} - *

- * Adds all elements of list to expandWildcards. - */ - public final Builder expandWildcards(List list) { - this.expandWildcards = _listAddAll(this.expandWildcards, list); - 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. - *

- * API name: {@code expand_wildcards} - *

- * Adds one or more values to expandWildcards. - */ - public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { - this.expandWildcards = _listAdd(this.expandWildcards, value, values); - return this; - } - - /** - * If true, returns settings in flat format. - *

- * API name: {@code flat_settings} - */ - public final Builder flatSettings(@Nullable Boolean value) { - this.flatSettings = value; - return this; - } - - /** - * If false, the request returns an error if it targets a missing - * or closed index. - *

- * API name: {@code ignore_unavailable} - */ - public final Builder ignoreUnavailable(@Nullable Boolean value) { - this.ignoreUnavailable = value; - return this; - } - - /** - * If true, return all default settings in the response. - *

- * API name: {@code include_defaults} - */ - public final Builder includeDefaults(@Nullable Boolean value) { - this.includeDefaults = value; - return this; - } - - /** - * Required - Comma-separated list of data streams, indices, and aliases. - * Supports wildcards (*). - *

- * API name: {@code index} - *

- * Adds all elements of list to index. - */ - public final Builder index(List list) { - this.index = _listAddAll(this.index, list); - return this; - } - - /** - * Required - Comma-separated list of data streams, indices, and aliases. - * Supports wildcards (*). - *

- * API name: {@code index} - *

- * Adds one or more values to index. - */ - public final Builder index(String value, String... values) { - this.index = _listAdd(this.index, value, values); - return this; - } - - /** - * If true, the request retrieves information from the local node - * only. - *

- * API name: {@code local} - */ - public final Builder local(@Nullable Boolean value) { - this.local = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ExistsRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ExistsRequest build() { - _checkSingleUse(); - - return new ExistsRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.exists}". - */ - public static final Endpoint _ENDPOINT = new BooleanEndpoint<>( - "es/indices.exists", - - // Request method - request -> { - return "HEAD"; - - }, - - // Request path - request -> { - final int _index = 1 << 0; - - int propsSet = 0; - - propsSet |= _index; - - if (propsSet == (_index)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _index = 1 << 0; - - int propsSet = 0; - - propsSet |= _index; - - if (propsSet == (_index)) { - params.put("index", request.index.stream().map(v -> v).collect(Collectors.joining(","))); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.flatSettings != null) { - params.put("flat_settings", String.valueOf(request.flatSettings)); - } - if (ApiTypeHelper.isDefined(request.expandWildcards)) { - params.put("expand_wildcards", - request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); - } - if (request.ignoreUnavailable != null) { - params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); - } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } - if (request.includeDefaults != null) { - params.put("include_defaults", String.valueOf(request.includeDefaults)); - } - if (request.local != null) { - params.put("local", String.valueOf(request.local)); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, null); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ExplainDataLifecycleRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ExplainDataLifecycleRequest.java deleted file mode 100644 index 1af1f6e3d..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ExplainDataLifecycleRequest.java +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.explain_data_lifecycle.Request - -/** - * Get the status for a data stream lifecycle. Retrieves 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. - * - * @see API - * specification - */ - -public class ExplainDataLifecycleRequest extends RequestBase { - @Nullable - private final Boolean includeDefaults; - - private final List index; - - @Nullable - private final Time masterTimeout; - - // --------------------------------------------------------------------------------------------- - - private ExplainDataLifecycleRequest(Builder builder) { - - this.includeDefaults = builder.includeDefaults; - this.index = ApiTypeHelper.unmodifiableRequired(builder.index, this, "index"); - this.masterTimeout = builder.masterTimeout; - - } - - public static ExplainDataLifecycleRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * indicates if the API should return the default values the system uses for the - * index's lifecycle - *

- * API name: {@code include_defaults} - */ - @Nullable - public final Boolean includeDefaults() { - return this.includeDefaults; - } - - /** - * Required - The name of the index to explain - *

- * API name: {@code index} - */ - public final List index() { - return this.index; - } - - /** - * Specify timeout for connection to master - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ExplainDataLifecycleRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private Boolean includeDefaults; - - private List index; - - @Nullable - private Time masterTimeout; - - /** - * indicates if the API should return the default values the system uses for the - * index's lifecycle - *

- * API name: {@code include_defaults} - */ - public final Builder includeDefaults(@Nullable Boolean value) { - this.includeDefaults = value; - return this; - } - - /** - * Required - The name of the index to explain - *

- * API name: {@code index} - *

- * Adds all elements of list to index. - */ - public final Builder index(List list) { - this.index = _listAddAll(this.index, list); - return this; - } - - /** - * Required - The name of the index to explain - *

- * API name: {@code index} - *

- * Adds one or more values to index. - */ - public final Builder index(String value, String... values) { - this.index = _listAdd(this.index, value, values); - return this; - } - - /** - * Specify timeout for connection to master - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = value; - return this; - } - - /** - * Specify timeout for connection to master - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ExplainDataLifecycleRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ExplainDataLifecycleRequest build() { - _checkSingleUse(); - - return new ExplainDataLifecycleRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.explain_data_lifecycle}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.explain_data_lifecycle", - - // Request method - request -> { - return "GET"; - - }, - - // Request path - request -> { - final int _index = 1 << 0; - - int propsSet = 0; - - propsSet |= _index; - - if (propsSet == (_index)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_lifecycle"); - buf.append("/explain"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _index = 1 << 0; - - int propsSet = 0; - - propsSet |= _index; - - if (propsSet == (_index)) { - params.put("index", request.index.stream().map(v -> v).collect(Collectors.joining(","))); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (request.includeDefaults != null) { - params.put("include_defaults", String.valueOf(request.includeDefaults)); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, ExplainDataLifecycleResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ExplainDataLifecycleResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ExplainDataLifecycleResponse.java deleted file mode 100644 index e8b06c9de..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ExplainDataLifecycleResponse.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch.indices.explain_data_lifecycle.DataStreamLifecycleExplain; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.explain_data_lifecycle.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class ExplainDataLifecycleResponse implements JsonpSerializable { - private final Map indices; - - // --------------------------------------------------------------------------------------------- - - private ExplainDataLifecycleResponse(Builder builder) { - - this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices"); - - } - - public static ExplainDataLifecycleResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code indices} - */ - public final Map indices() { - return this.indices; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.indices)) { - generator.writeKey("indices"); - generator.writeStartObject(); - for (Map.Entry item0 : this.indices.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ExplainDataLifecycleResponse}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private Map indices; - - /** - * Required - API name: {@code indices} - *

- * Adds all entries of map to indices. - */ - public final Builder indices(Map map) { - this.indices = _mapPutAll(this.indices, map); - return this; - } - - /** - * Required - API name: {@code indices} - *

- * Adds an entry to indices. - */ - public final Builder indices(String key, DataStreamLifecycleExplain value) { - this.indices = _mapPut(this.indices, key, value); - return this; - } - - /** - * Required - API name: {@code indices} - *

- * Adds an entry to indices using a builder lambda. - */ - public final Builder indices(String key, - Function> fn) { - return indices(key, fn.apply(new DataStreamLifecycleExplain.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ExplainDataLifecycleResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ExplainDataLifecycleResponse build() { - _checkSingleUse(); - - return new ExplainDataLifecycleResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ExplainDataLifecycleResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, ExplainDataLifecycleResponse::setupExplainDataLifecycleResponseDeserializer); - - protected static void setupExplainDataLifecycleResponseDeserializer( - ObjectDeserializer op) { - - op.add(Builder::indices, JsonpDeserializer.stringMapDeserializer(DataStreamLifecycleExplain._DESERIALIZER), - "indices"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/FailureStore.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/FailureStore.java deleted file mode 100644 index c43ae6b1c..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/FailureStore.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.FailureStore - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class FailureStore implements JsonpSerializable { - private final boolean enabled; - - private final List indices; - - private final boolean rolloverOnWrite; - - // --------------------------------------------------------------------------------------------- - - private FailureStore(Builder builder) { - - this.enabled = ApiTypeHelper.requireNonNull(builder.enabled, this, "enabled"); - this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices"); - this.rolloverOnWrite = ApiTypeHelper.requireNonNull(builder.rolloverOnWrite, this, "rolloverOnWrite"); - - } - - public static FailureStore of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code enabled} - */ - public final boolean enabled() { - return this.enabled; - } - - /** - * Required - API name: {@code indices} - */ - public final List indices() { - return this.indices; - } - - /** - * Required - API name: {@code rollover_on_write} - */ - public final boolean rolloverOnWrite() { - return this.rolloverOnWrite; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("enabled"); - generator.write(this.enabled); - - if (ApiTypeHelper.isDefined(this.indices)) { - generator.writeKey("indices"); - generator.writeStartArray(); - for (DataStreamIndex item0 : this.indices) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - generator.writeKey("rollover_on_write"); - generator.write(this.rolloverOnWrite); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link FailureStore}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Boolean enabled; - - private List indices; - - private Boolean rolloverOnWrite; - - /** - * Required - API name: {@code enabled} - */ - public final Builder enabled(boolean value) { - this.enabled = value; - return this; - } - - /** - * Required - API name: {@code indices} - *

- * Adds all elements of list to indices. - */ - public final Builder indices(List list) { - this.indices = _listAddAll(this.indices, list); - return this; - } - - /** - * Required - API name: {@code indices} - *

- * Adds one or more values to indices. - */ - public final Builder indices(DataStreamIndex value, DataStreamIndex... values) { - this.indices = _listAdd(this.indices, value, values); - return this; - } - - /** - * Required - API name: {@code indices} - *

- * Adds a value to indices using a builder lambda. - */ - public final Builder indices(Function> fn) { - return indices(fn.apply(new DataStreamIndex.Builder()).build()); - } - - /** - * Required - API name: {@code rollover_on_write} - */ - public final Builder rolloverOnWrite(boolean value) { - this.rolloverOnWrite = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link FailureStore}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public FailureStore build() { - _checkSingleUse(); - - return new FailureStore(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link FailureStore} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - FailureStore::setupFailureStoreDeserializer); - - protected static void setupFailureStoreDeserializer(ObjectDeserializer op) { - - op.add(Builder::enabled, JsonpDeserializer.booleanDeserializer(), "enabled"); - op.add(Builder::indices, JsonpDeserializer.arrayDeserializer(DataStreamIndex._DESERIALIZER), "indices"); - op.add(Builder::rolloverOnWrite, JsonpDeserializer.booleanDeserializer(), "rollover_on_write"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/FielddataFrequencyFilter.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/FielddataFrequencyFilter.java deleted file mode 100644 index f197b6bf0..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/FielddataFrequencyFilter.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Double; -import java.lang.Integer; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.FielddataFrequencyFilter - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class FielddataFrequencyFilter implements JsonpSerializable { - private final double max; - - private final double min; - - private final int minSegmentSize; - - // --------------------------------------------------------------------------------------------- - - private FielddataFrequencyFilter(Builder builder) { - - this.max = ApiTypeHelper.requireNonNull(builder.max, this, "max"); - this.min = ApiTypeHelper.requireNonNull(builder.min, this, "min"); - this.minSegmentSize = ApiTypeHelper.requireNonNull(builder.minSegmentSize, this, "minSegmentSize"); - - } - - public static FielddataFrequencyFilter of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code max} - */ - public final double max() { - return this.max; - } - - /** - * Required - API name: {@code min} - */ - public final double min() { - return this.min; - } - - /** - * Required - API name: {@code min_segment_size} - */ - public final int minSegmentSize() { - return this.minSegmentSize; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("max"); - generator.write(this.max); - - generator.writeKey("min"); - generator.write(this.min); - - generator.writeKey("min_segment_size"); - generator.write(this.minSegmentSize); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link FielddataFrequencyFilter}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private Double max; - - private Double min; - - private Integer minSegmentSize; - - /** - * Required - API name: {@code max} - */ - public final Builder max(double value) { - this.max = value; - return this; - } - - /** - * Required - API name: {@code min} - */ - public final Builder min(double value) { - this.min = value; - return this; - } - - /** - * Required - API name: {@code min_segment_size} - */ - public final Builder minSegmentSize(int value) { - this.minSegmentSize = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link FielddataFrequencyFilter}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public FielddataFrequencyFilter build() { - _checkSingleUse(); - - return new FielddataFrequencyFilter(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link FielddataFrequencyFilter} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, FielddataFrequencyFilter::setupFielddataFrequencyFilterDeserializer); - - protected static void setupFielddataFrequencyFilterDeserializer( - ObjectDeserializer op) { - - op.add(Builder::max, JsonpDeserializer.doubleDeserializer(), "max"); - op.add(Builder::min, JsonpDeserializer.doubleDeserializer(), "min"); - op.add(Builder::minSegmentSize, JsonpDeserializer.integerDeserializer(), "min_segment_size"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetAliasRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetAliasRequest.java deleted file mode 100644 index 1c2195539..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetAliasRequest.java +++ /dev/null @@ -1,446 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.ExpandWildcard; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.get_alias.Request - -/** - * Get aliases. Retrieves information for one or more data stream or index - * aliases. - * - * @see API - * specification - */ - -public class GetAliasRequest extends RequestBase { - @Nullable - private final Boolean allowNoIndices; - - private final List expandWildcards; - - @Nullable - private final Boolean ignoreUnavailable; - - private final List index; - - @Nullable - private final Boolean local; - - private final List name; - - // --------------------------------------------------------------------------------------------- - - private GetAliasRequest(Builder builder) { - - this.allowNoIndices = builder.allowNoIndices; - this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); - this.ignoreUnavailable = builder.ignoreUnavailable; - this.index = ApiTypeHelper.unmodifiable(builder.index); - this.local = builder.local; - this.name = ApiTypeHelper.unmodifiable(builder.name); - - } - - public static GetAliasRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code allow_no_indices} - */ - @Nullable - public final Boolean allowNoIndices() { - return this.allowNoIndices; - } - - /** - * 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. - *

- * API name: {@code expand_wildcards} - */ - public final List expandWildcards() { - return this.expandWildcards; - } - - /** - * If false, the request returns an error if it targets a missing - * or closed index. - *

- * API name: {@code ignore_unavailable} - */ - @Nullable - public final Boolean ignoreUnavailable() { - return this.ignoreUnavailable; - } - - /** - * 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. - *

- * API name: {@code index} - */ - public final List index() { - return this.index; - } - - /** - * If true, the request retrieves information from the local node - * only. - *

- * API name: {@code local} - */ - @Nullable - public final Boolean local() { - return this.local; - } - - /** - * Comma-separated list of aliases to retrieve. Supports wildcards - * (*). To retrieve all aliases, omit this parameter or use - * * or _all. - *

- * API name: {@code name} - */ - public final List name() { - return this.name; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GetAliasRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { - @Nullable - private Boolean allowNoIndices; - - @Nullable - private List expandWildcards; - - @Nullable - private Boolean ignoreUnavailable; - - @Nullable - private List index; - - @Nullable - private Boolean local; - - @Nullable - private List name; - - /** - * 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. - *

- * API name: {@code allow_no_indices} - */ - public final Builder allowNoIndices(@Nullable Boolean value) { - this.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. - *

- * API name: {@code expand_wildcards} - *

- * Adds all elements of list to expandWildcards. - */ - public final Builder expandWildcards(List list) { - this.expandWildcards = _listAddAll(this.expandWildcards, list); - 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. - *

- * API name: {@code expand_wildcards} - *

- * Adds one or more values to expandWildcards. - */ - public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { - this.expandWildcards = _listAdd(this.expandWildcards, value, values); - return this; - } - - /** - * If false, the request returns an error if it targets a missing - * or closed index. - *

- * API name: {@code ignore_unavailable} - */ - public final Builder ignoreUnavailable(@Nullable Boolean value) { - this.ignoreUnavailable = value; - return this; - } - - /** - * 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. - *

- * API name: {@code index} - *

- * Adds all elements of list to index. - */ - public final Builder index(List list) { - this.index = _listAddAll(this.index, list); - return this; - } - - /** - * 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. - *

- * API name: {@code index} - *

- * Adds one or more values to index. - */ - public final Builder index(String value, String... values) { - this.index = _listAdd(this.index, value, values); - return this; - } - - /** - * If true, the request retrieves information from the local node - * only. - *

- * API name: {@code local} - */ - public final Builder local(@Nullable Boolean value) { - this.local = value; - return this; - } - - /** - * Comma-separated list of aliases to retrieve. Supports wildcards - * (*). To retrieve all aliases, omit this parameter or use - * * or _all. - *

- * API name: {@code name} - *

- * Adds all elements of list to name. - */ - public final Builder name(List list) { - this.name = _listAddAll(this.name, list); - return this; - } - - /** - * Comma-separated list of aliases to retrieve. Supports wildcards - * (*). To retrieve all aliases, omit this parameter or use - * * or _all. - *

- * API name: {@code name} - *

- * Adds one or more values to name. - */ - public final Builder name(String value, String... values) { - this.name = _listAdd(this.name, value, values); - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link GetAliasRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GetAliasRequest build() { - _checkSingleUse(); - - return new GetAliasRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.get_alias}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.get_alias", - - // Request method - request -> { - return "GET"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - final int _index = 1 << 1; - - int propsSet = 0; - - if (ApiTypeHelper.isDefined(request.name())) - propsSet |= _name; - if (ApiTypeHelper.isDefined(request.index())) - propsSet |= _index; - - if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_alias"); - return buf.toString(); - } - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_alias"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); - return buf.toString(); - } - if (propsSet == (_index | _name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_alias"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); - return buf.toString(); - } - if (propsSet == (_index)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_alias"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - final int _index = 1 << 1; - - int propsSet = 0; - - if (ApiTypeHelper.isDefined(request.name())) - propsSet |= _name; - if (ApiTypeHelper.isDefined(request.index())) - propsSet |= _index; - - if (propsSet == 0) { - } - if (propsSet == (_name)) { - params.put("name", request.name.stream().map(v -> v).collect(Collectors.joining(","))); - } - if (propsSet == (_index | _name)) { - params.put("index", request.index.stream().map(v -> v).collect(Collectors.joining(","))); - params.put("name", request.name.stream().map(v -> v).collect(Collectors.joining(","))); - } - if (propsSet == (_index)) { - params.put("index", request.index.stream().map(v -> v).collect(Collectors.joining(","))); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (ApiTypeHelper.isDefined(request.expandWildcards)) { - params.put("expand_wildcards", - request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); - } - if (request.ignoreUnavailable != null) { - params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); - } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } - if (request.local != null) { - params.put("local", String.valueOf(request.local)); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, GetAliasResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetAliasResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetAliasResponse.java deleted file mode 100644 index 07a00f9c1..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetAliasResponse.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch.indices.get_alias.IndexAliases; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import jakarta.json.stream.JsonParser; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.get_alias.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class GetAliasResponse implements JsonpSerializable { - private final Map result; - - // --------------------------------------------------------------------------------------------- - - private GetAliasResponse(Builder builder) { - - this.result = ApiTypeHelper.unmodifiableRequired(builder.result, this, "result"); - - } - - public static GetAliasResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Response value. - */ - public final Map result() { - return this.result; - } - - /** - * Get an element of {@code result}. - */ - public final @Nullable IndexAliases get(String key) { - return this.result.get(key); - } - - /** - * Serialize this value to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - for (Map.Entry item0 : this.result.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GetAliasResponse}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Map result = new HashMap<>(); - - /** - * Required - Response value. - *

- * Adds all entries of map to result. - */ - public final Builder result(Map map) { - this.result = _mapPutAll(this.result, map); - return this; - } - - /** - * Required - Response value. - *

- * Adds an entry to result. - */ - public final Builder result(String key, IndexAliases value) { - this.result = _mapPut(this.result, key, value); - return this; - } - - /** - * Required - Response value. - *

- * Adds an entry to result using a builder lambda. - */ - public final Builder result(String key, Function> fn) { - return result(key, fn.apply(new IndexAliases.Builder()).build()); - } - - @Override - public Builder withJson(JsonParser parser, JsonpMapper mapper) { - - @SuppressWarnings("unchecked") - Map value = (Map) JsonpDeserializer - .stringMapDeserializer(IndexAliases._DESERIALIZER).deserialize(parser, mapper); - return this.result(value); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link GetAliasResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GetAliasResponse build() { - _checkSingleUse(); - - return new GetAliasResponse(this); - } - } - - public static final JsonpDeserializer _DESERIALIZER = createGetAliasResponseDeserializer(); - protected static JsonpDeserializer createGetAliasResponseDeserializer() { - - JsonpDeserializer> valueDeserializer = JsonpDeserializer - .stringMapDeserializer(IndexAliases._DESERIALIZER); - - return JsonpDeserializer.of(valueDeserializer.acceptedEvents(), (parser, mapper, event) -> new Builder() - .result(valueDeserializer.deserialize(parser, mapper, event)).build()); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataLifecycleRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataLifecycleRequest.java deleted file mode 100644 index 7ae7c3df5..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataLifecycleRequest.java +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.ExpandWildcard; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.get_data_lifecycle.Request - -/** - * Get data stream lifecycles. Retrieves the data stream lifecycle configuration - * of one or more data streams. - * - * @see API - * specification - */ - -public class GetDataLifecycleRequest extends RequestBase { - private final List expandWildcards; - - @Nullable - private final Boolean includeDefaults; - - @Nullable - private final Time masterTimeout; - - private final List name; - - // --------------------------------------------------------------------------------------------- - - private GetDataLifecycleRequest(Builder builder) { - - this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); - this.includeDefaults = builder.includeDefaults; - this.masterTimeout = builder.masterTimeout; - this.name = ApiTypeHelper.unmodifiableRequired(builder.name, this, "name"); - - } - - public static GetDataLifecycleRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code expand_wildcards} - */ - public final List expandWildcards() { - return this.expandWildcards; - } - - /** - * If true, return all default settings in the response. - *

- * API name: {@code include_defaults} - */ - @Nullable - public final Boolean includeDefaults() { - return this.includeDefaults; - } - - /** - * 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. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * Required - Comma-separated list of data streams to limit the request. - * Supports wildcards (*). To target all data streams, omit this - * parameter or use * or _all. - *

- * API name: {@code name} - */ - public final List name() { - return this.name; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GetDataLifecycleRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private List expandWildcards; - - @Nullable - private Boolean includeDefaults; - - @Nullable - private Time masterTimeout; - - private List name; - - /** - * 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. - *

- * API name: {@code expand_wildcards} - *

- * Adds all elements of list to expandWildcards. - */ - public final Builder expandWildcards(List list) { - this.expandWildcards = _listAddAll(this.expandWildcards, list); - 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. - *

- * API name: {@code expand_wildcards} - *

- * Adds one or more values to expandWildcards. - */ - public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { - this.expandWildcards = _listAdd(this.expandWildcards, value, values); - return this; - } - - /** - * If true, return all default settings in the response. - *

- * API name: {@code include_defaults} - */ - public final Builder includeDefaults(@Nullable Boolean value) { - this.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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Required - Comma-separated list of data streams to limit the request. - * Supports wildcards (*). To target all data streams, omit this - * parameter or use * or _all. - *

- * API name: {@code name} - *

- * Adds all elements of list to name. - */ - public final Builder name(List list) { - this.name = _listAddAll(this.name, list); - return this; - } - - /** - * Required - Comma-separated list of data streams to limit the request. - * Supports wildcards (*). To target all data streams, omit this - * parameter or use * or _all. - *

- * API name: {@code name} - *

- * Adds one or more values to name. - */ - public final Builder name(String value, String... values) { - this.name = _listAdd(this.name, value, values); - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link GetDataLifecycleRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GetDataLifecycleRequest build() { - _checkSingleUse(); - - return new GetDataLifecycleRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.get_data_lifecycle}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.get_data_lifecycle", - - // Request method - request -> { - return "GET"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_data_stream"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_lifecycle"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - params.put("name", request.name.stream().map(v -> v).collect(Collectors.joining(","))); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (ApiTypeHelper.isDefined(request.expandWildcards)) { - params.put("expand_wildcards", - request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); - } - if (request.includeDefaults != null) { - params.put("include_defaults", String.valueOf(request.includeDefaults)); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, GetDataLifecycleResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataLifecycleResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataLifecycleResponse.java deleted file mode 100644 index b770acbe5..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataLifecycleResponse.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch.indices.get_data_lifecycle.DataStreamWithLifecycle; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.get_data_lifecycle.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class GetDataLifecycleResponse implements JsonpSerializable { - private final List dataStreams; - - // --------------------------------------------------------------------------------------------- - - private GetDataLifecycleResponse(Builder builder) { - - this.dataStreams = ApiTypeHelper.unmodifiableRequired(builder.dataStreams, this, "dataStreams"); - - } - - public static GetDataLifecycleResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code data_streams} - */ - public final List dataStreams() { - return this.dataStreams; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.dataStreams)) { - generator.writeKey("data_streams"); - generator.writeStartArray(); - for (DataStreamWithLifecycle item0 : this.dataStreams) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GetDataLifecycleResponse}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private List dataStreams; - - /** - * Required - API name: {@code data_streams} - *

- * Adds all elements of list to dataStreams. - */ - public final Builder dataStreams(List list) { - this.dataStreams = _listAddAll(this.dataStreams, list); - return this; - } - - /** - * Required - API name: {@code data_streams} - *

- * Adds one or more values to dataStreams. - */ - public final Builder dataStreams(DataStreamWithLifecycle value, DataStreamWithLifecycle... values) { - this.dataStreams = _listAdd(this.dataStreams, value, values); - return this; - } - - /** - * Required - API name: {@code data_streams} - *

- * Adds a value to dataStreams using a builder lambda. - */ - public final Builder dataStreams( - Function> fn) { - return dataStreams(fn.apply(new DataStreamWithLifecycle.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link GetDataLifecycleResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GetDataLifecycleResponse build() { - _checkSingleUse(); - - return new GetDataLifecycleResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link GetDataLifecycleResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, GetDataLifecycleResponse::setupGetDataLifecycleResponseDeserializer); - - protected static void setupGetDataLifecycleResponseDeserializer( - ObjectDeserializer op) { - - op.add(Builder::dataStreams, JsonpDeserializer.arrayDeserializer(DataStreamWithLifecycle._DESERIALIZER), - "data_streams"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataStreamRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataStreamRequest.java deleted file mode 100644 index e2a86b8ea..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataStreamRequest.java +++ /dev/null @@ -1,334 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.ExpandWildcard; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.get_data_stream.Request - -/** - * Get data streams. Retrieves information about one or more data streams. - * - * @see API - * specification - */ - -public class GetDataStreamRequest extends RequestBase { - private final List expandWildcards; - - @Nullable - private final Boolean includeDefaults; - - @Nullable - private final Time masterTimeout; - - private final List name; - - // --------------------------------------------------------------------------------------------- - - private GetDataStreamRequest(Builder builder) { - - this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); - this.includeDefaults = builder.includeDefaults; - this.masterTimeout = builder.masterTimeout; - this.name = ApiTypeHelper.unmodifiable(builder.name); - - } - - public static GetDataStreamRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Type of data stream that wildcard patterns can match. Supports - * comma-separated values, such as open,hidden. - *

- * API name: {@code expand_wildcards} - */ - public final List expandWildcards() { - return this.expandWildcards; - } - - /** - * If true, returns all relevant default configurations for the index template. - *

- * API name: {@code include_defaults} - */ - @Nullable - public final Boolean includeDefaults() { - return this.includeDefaults; - } - - /** - * 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. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * Comma-separated list of data stream names used to limit the request. Wildcard - * (*) expressions are supported. If omitted, all data streams are - * returned. - *

- * API name: {@code name} - */ - public final List name() { - return this.name; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GetDataStreamRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private List expandWildcards; - - @Nullable - private Boolean includeDefaults; - - @Nullable - private Time masterTimeout; - - @Nullable - private List name; - - /** - * Type of data stream that wildcard patterns can match. Supports - * comma-separated values, such as open,hidden. - *

- * API name: {@code expand_wildcards} - *

- * Adds all elements of list to expandWildcards. - */ - public final Builder expandWildcards(List list) { - this.expandWildcards = _listAddAll(this.expandWildcards, list); - return this; - } - - /** - * Type of data stream that wildcard patterns can match. Supports - * comma-separated values, such as open,hidden. - *

- * API name: {@code expand_wildcards} - *

- * Adds one or more values to expandWildcards. - */ - public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { - this.expandWildcards = _listAdd(this.expandWildcards, value, values); - return this; - } - - /** - * If true, returns all relevant default configurations for the index template. - *

- * API name: {@code include_defaults} - */ - public final Builder includeDefaults(@Nullable Boolean value) { - this.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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Comma-separated list of data stream names used to limit the request. Wildcard - * (*) expressions are supported. If omitted, all data streams are - * returned. - *

- * API name: {@code name} - *

- * Adds all elements of list to name. - */ - public final Builder name(List list) { - this.name = _listAddAll(this.name, list); - return this; - } - - /** - * Comma-separated list of data stream names used to limit the request. Wildcard - * (*) expressions are supported. If omitted, all data streams are - * returned. - *

- * API name: {@code name} - *

- * Adds one or more values to name. - */ - public final Builder name(String value, String... values) { - this.name = _listAdd(this.name, value, values); - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link GetDataStreamRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GetDataStreamRequest build() { - _checkSingleUse(); - - return new GetDataStreamRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.get_data_stream}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.get_data_stream", - - // Request method - request -> { - return "GET"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - if (ApiTypeHelper.isDefined(request.name())) - propsSet |= _name; - - if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_data_stream"); - return buf.toString(); - } - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_data_stream"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - - int propsSet = 0; - - if (ApiTypeHelper.isDefined(request.name())) - propsSet |= _name; - - if (propsSet == 0) { - } - if (propsSet == (_name)) { - params.put("name", request.name.stream().map(v -> v).collect(Collectors.joining(","))); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (ApiTypeHelper.isDefined(request.expandWildcards)) { - params.put("expand_wildcards", - request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); - } - if (request.includeDefaults != null) { - params.put("include_defaults", String.valueOf(request.includeDefaults)); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, GetDataStreamResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataStreamResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataStreamResponse.java deleted file mode 100644 index 3c7fa5d83..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataStreamResponse.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.get_data_stream.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class GetDataStreamResponse implements JsonpSerializable { - private final List dataStreams; - - // --------------------------------------------------------------------------------------------- - - private GetDataStreamResponse(Builder builder) { - - this.dataStreams = ApiTypeHelper.unmodifiableRequired(builder.dataStreams, this, "dataStreams"); - - } - - public static GetDataStreamResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code data_streams} - */ - public final List dataStreams() { - return this.dataStreams; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.dataStreams)) { - generator.writeKey("data_streams"); - generator.writeStartArray(); - for (DataStream item0 : this.dataStreams) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GetDataStreamResponse}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private List dataStreams; - - /** - * Required - API name: {@code data_streams} - *

- * Adds all elements of list to dataStreams. - */ - public final Builder dataStreams(List list) { - this.dataStreams = _listAddAll(this.dataStreams, list); - return this; - } - - /** - * Required - API name: {@code data_streams} - *

- * Adds one or more values to dataStreams. - */ - public final Builder dataStreams(DataStream value, DataStream... values) { - this.dataStreams = _listAdd(this.dataStreams, value, values); - return this; - } - - /** - * Required - API name: {@code data_streams} - *

- * Adds a value to dataStreams using a builder lambda. - */ - public final Builder dataStreams(Function> fn) { - return dataStreams(fn.apply(new DataStream.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link GetDataStreamResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GetDataStreamResponse build() { - _checkSingleUse(); - - return new GetDataStreamResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link GetDataStreamResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, GetDataStreamResponse::setupGetDataStreamResponseDeserializer); - - protected static void setupGetDataStreamResponseDeserializer(ObjectDeserializer op) { - - op.add(Builder::dataStreams, JsonpDeserializer.arrayDeserializer(DataStream._DESERIALIZER), "data_streams"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetIndexRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetIndexRequest.java deleted file mode 100644 index f25673cc9..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetIndexRequest.java +++ /dev/null @@ -1,496 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.ExpandWildcard; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.elasticsearch.indices.get.Feature; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.get.Request - -/** - * Get index information. Returns information about one or more indices. For - * data streams, the API returns information about the stream’s backing indices. - * - * @see API - * specification - */ - -public class GetIndexRequest extends RequestBase { - @Nullable - private final Boolean allowNoIndices; - - private final List expandWildcards; - - private final List features; - - @Nullable - private final Boolean flatSettings; - - @Nullable - private final Boolean ignoreUnavailable; - - @Nullable - private final Boolean includeDefaults; - - private final List index; - - @Nullable - private final Boolean local; - - @Nullable - private final Time masterTimeout; - - // --------------------------------------------------------------------------------------------- - - private GetIndexRequest(Builder builder) { - - this.allowNoIndices = builder.allowNoIndices; - this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); - this.features = ApiTypeHelper.unmodifiable(builder.features); - this.flatSettings = builder.flatSettings; - this.ignoreUnavailable = builder.ignoreUnavailable; - this.includeDefaults = builder.includeDefaults; - this.index = ApiTypeHelper.unmodifiableRequired(builder.index, this, "index"); - this.local = builder.local; - this.masterTimeout = builder.masterTimeout; - - } - - public static GetIndexRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code allow_no_indices} - */ - @Nullable - public final Boolean allowNoIndices() { - return this.allowNoIndices; - } - - /** - * 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. - *

- * API name: {@code expand_wildcards} - */ - public final List expandWildcards() { - return this.expandWildcards; - } - - /** - * Return only information on specified index features - *

- * API name: {@code features} - */ - public final List features() { - return this.features; - } - - /** - * If true, returns settings in flat format. - *

- * API name: {@code flat_settings} - */ - @Nullable - public final Boolean flatSettings() { - return this.flatSettings; - } - - /** - * If false, requests that target a missing index return an error. - *

- * API name: {@code ignore_unavailable} - */ - @Nullable - public final Boolean ignoreUnavailable() { - return this.ignoreUnavailable; - } - - /** - * If true, return all default settings in the response. - *

- * API name: {@code include_defaults} - */ - @Nullable - public final Boolean includeDefaults() { - return this.includeDefaults; - } - - /** - * Required - Comma-separated list of data streams, indices, and index aliases - * used to limit the request. Wildcard expressions (*) are supported. - *

- * API name: {@code index} - */ - public final List index() { - return this.index; - } - - /** - * If true, the request retrieves information from the local node only. Defaults - * to false, which means information is retrieved from the master node. - *

- * API name: {@code local} - */ - @Nullable - public final Boolean local() { - return this.local; - } - - /** - * 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. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GetIndexRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { - @Nullable - private Boolean allowNoIndices; - - @Nullable - private List expandWildcards; - - @Nullable - private List features; - - @Nullable - private Boolean flatSettings; - - @Nullable - private Boolean ignoreUnavailable; - - @Nullable - private Boolean includeDefaults; - - private List index; - - @Nullable - private Boolean local; - - @Nullable - private Time masterTimeout; - - /** - * 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. - *

- * API name: {@code allow_no_indices} - */ - public final Builder allowNoIndices(@Nullable Boolean value) { - this.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. - *

- * API name: {@code expand_wildcards} - *

- * Adds all elements of list to expandWildcards. - */ - public final Builder expandWildcards(List list) { - this.expandWildcards = _listAddAll(this.expandWildcards, list); - 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. - *

- * API name: {@code expand_wildcards} - *

- * Adds one or more values to expandWildcards. - */ - public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { - this.expandWildcards = _listAdd(this.expandWildcards, value, values); - return this; - } - - /** - * Return only information on specified index features - *

- * API name: {@code features} - *

- * Adds all elements of list to features. - */ - public final Builder features(List list) { - this.features = _listAddAll(this.features, list); - return this; - } - - /** - * Return only information on specified index features - *

- * API name: {@code features} - *

- * Adds one or more values to features. - */ - public final Builder features(Feature value, Feature... values) { - this.features = _listAdd(this.features, value, values); - return this; - } - - /** - * If true, returns settings in flat format. - *

- * API name: {@code flat_settings} - */ - public final Builder flatSettings(@Nullable Boolean value) { - this.flatSettings = value; - return this; - } - - /** - * If false, requests that target a missing index return an error. - *

- * API name: {@code ignore_unavailable} - */ - public final Builder ignoreUnavailable(@Nullable Boolean value) { - this.ignoreUnavailable = value; - return this; - } - - /** - * If true, return all default settings in the response. - *

- * API name: {@code include_defaults} - */ - public final Builder includeDefaults(@Nullable Boolean value) { - this.includeDefaults = value; - return this; - } - - /** - * Required - Comma-separated list of data streams, indices, and index aliases - * used to limit the request. Wildcard expressions (*) are supported. - *

- * API name: {@code index} - *

- * Adds all elements of list to index. - */ - public final Builder index(List list) { - this.index = _listAddAll(this.index, list); - return this; - } - - /** - * Required - Comma-separated list of data streams, indices, and index aliases - * used to limit the request. Wildcard expressions (*) are supported. - *

- * API name: {@code index} - *

- * Adds one or more values to index. - */ - public final Builder index(String value, String... values) { - this.index = _listAdd(this.index, value, values); - 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. - *

- * API name: {@code local} - */ - public final Builder local(@Nullable Boolean value) { - this.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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link GetIndexRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GetIndexRequest build() { - _checkSingleUse(); - - return new GetIndexRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.get}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.get", - - // Request method - request -> { - return "GET"; - - }, - - // Request path - request -> { - final int _index = 1 << 0; - - int propsSet = 0; - - propsSet |= _index; - - if (propsSet == (_index)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _index = 1 << 0; - - int propsSet = 0; - - propsSet |= _index; - - if (propsSet == (_index)) { - params.put("index", request.index.stream().map(v -> v).collect(Collectors.joining(","))); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (ApiTypeHelper.isDefined(request.features)) { - params.put("features", - request.features.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); - } - if (request.flatSettings != null) { - params.put("flat_settings", String.valueOf(request.flatSettings)); - } - if (ApiTypeHelper.isDefined(request.expandWildcards)) { - params.put("expand_wildcards", - request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); - } - if (request.ignoreUnavailable != null) { - params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); - } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } - if (request.includeDefaults != null) { - params.put("include_defaults", String.valueOf(request.includeDefaults)); - } - if (request.local != null) { - params.put("local", String.valueOf(request.local)); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, GetIndexResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetIndexResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetIndexResponse.java deleted file mode 100644 index 0eb9e9f14..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetIndexResponse.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import jakarta.json.stream.JsonParser; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.get.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class GetIndexResponse implements JsonpSerializable { - private final Map result; - - // --------------------------------------------------------------------------------------------- - - private GetIndexResponse(Builder builder) { - - this.result = ApiTypeHelper.unmodifiableRequired(builder.result, this, "result"); - - } - - public static GetIndexResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Response value. - */ - public final Map result() { - return this.result; - } - - /** - * Get an element of {@code result}. - */ - public final @Nullable IndexState get(String key) { - return this.result.get(key); - } - - /** - * Serialize this value to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - for (Map.Entry item0 : this.result.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GetIndexResponse}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Map result = new HashMap<>(); - - /** - * Required - Response value. - *

- * Adds all entries of map to result. - */ - public final Builder result(Map map) { - this.result = _mapPutAll(this.result, map); - return this; - } - - /** - * Required - Response value. - *

- * Adds an entry to result. - */ - public final Builder result(String key, IndexState value) { - this.result = _mapPut(this.result, key, value); - return this; - } - - /** - * Required - Response value. - *

- * Adds an entry to result using a builder lambda. - */ - public final Builder result(String key, Function> fn) { - return result(key, fn.apply(new IndexState.Builder()).build()); - } - - @Override - public Builder withJson(JsonParser parser, JsonpMapper mapper) { - - @SuppressWarnings("unchecked") - Map value = (Map) JsonpDeserializer - .stringMapDeserializer(IndexState._DESERIALIZER).deserialize(parser, mapper); - return this.result(value); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link GetIndexResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GetIndexResponse build() { - _checkSingleUse(); - - return new GetIndexResponse(this); - } - } - - public static final JsonpDeserializer _DESERIALIZER = createGetIndexResponseDeserializer(); - protected static JsonpDeserializer createGetIndexResponseDeserializer() { - - JsonpDeserializer> valueDeserializer = JsonpDeserializer - .stringMapDeserializer(IndexState._DESERIALIZER); - - return JsonpDeserializer.of(valueDeserializer.acceptedEvents(), (parser, mapper, event) -> new Builder() - .result(valueDeserializer.deserialize(parser, mapper, event)).build()); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetIndexTemplateRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetIndexTemplateRequest.java deleted file mode 100644 index 88d77c6fb..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetIndexTemplateRequest.java +++ /dev/null @@ -1,331 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.get_index_template.Request - -/** - * Get index templates. Returns information about one or more index templates. - * - * @see API - * specification - */ - -public class GetIndexTemplateRequest extends RequestBase { - @Nullable - private final Boolean flatSettings; - - @Nullable - private final Boolean includeDefaults; - - @Nullable - private final Boolean local; - - @Nullable - private final Time masterTimeout; - - @Nullable - private final String name; - - // --------------------------------------------------------------------------------------------- - - private GetIndexTemplateRequest(Builder builder) { - - this.flatSettings = builder.flatSettings; - this.includeDefaults = builder.includeDefaults; - this.local = builder.local; - this.masterTimeout = builder.masterTimeout; - this.name = builder.name; - - } - - public static GetIndexTemplateRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * If true, returns settings in flat format. - *

- * API name: {@code flat_settings} - */ - @Nullable - public final Boolean flatSettings() { - return this.flatSettings; - } - - /** - * If true, returns all relevant default configurations for the index template. - *

- * API name: {@code include_defaults} - */ - @Nullable - public final Boolean includeDefaults() { - return this.includeDefaults; - } - - /** - * If true, the request retrieves information from the local node only. Defaults - * to false, which means information is retrieved from the master node. - *

- * API name: {@code local} - */ - @Nullable - public final Boolean local() { - return this.local; - } - - /** - * 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. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * Comma-separated list of index template names used to limit the request. - * Wildcard (*) expressions are supported. - *

- * API name: {@code name} - */ - @Nullable - public final String name() { - return this.name; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GetIndexTemplateRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private Boolean flatSettings; - - @Nullable - private Boolean includeDefaults; - - @Nullable - private Boolean local; - - @Nullable - private Time masterTimeout; - - @Nullable - private String name; - - /** - * If true, returns settings in flat format. - *

- * API name: {@code flat_settings} - */ - public final Builder flatSettings(@Nullable Boolean value) { - this.flatSettings = value; - return this; - } - - /** - * If true, returns all relevant default configurations for the index template. - *

- * API name: {@code include_defaults} - */ - public final Builder includeDefaults(@Nullable Boolean value) { - this.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. - *

- * API name: {@code local} - */ - public final Builder local(@Nullable Boolean value) { - this.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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Comma-separated list of index template names used to limit the request. - * Wildcard (*) expressions are supported. - *

- * API name: {@code name} - */ - public final Builder name(@Nullable String value) { - this.name = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link GetIndexTemplateRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GetIndexTemplateRequest build() { - _checkSingleUse(); - - return new GetIndexTemplateRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.get_index_template}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.get_index_template", - - // Request method - request -> { - return "GET"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - if (request.name() != null) - propsSet |= _name; - - if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_index_template"); - return buf.toString(); - } - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_index_template"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - - int propsSet = 0; - - if (request.name() != null) - propsSet |= _name; - - if (propsSet == 0) { - } - if (propsSet == (_name)) { - params.put("name", request.name); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (request.flatSettings != null) { - params.put("flat_settings", String.valueOf(request.flatSettings)); - } - if (request.includeDefaults != null) { - params.put("include_defaults", String.valueOf(request.includeDefaults)); - } - if (request.local != null) { - params.put("local", String.valueOf(request.local)); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, GetIndexTemplateResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetIndexTemplateResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetIndexTemplateResponse.java deleted file mode 100644 index a098f2ba7..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetIndexTemplateResponse.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch.indices.get_index_template.IndexTemplateItem; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.get_index_template.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class GetIndexTemplateResponse implements JsonpSerializable { - private final List indexTemplates; - - // --------------------------------------------------------------------------------------------- - - private GetIndexTemplateResponse(Builder builder) { - - this.indexTemplates = ApiTypeHelper.unmodifiableRequired(builder.indexTemplates, this, "indexTemplates"); - - } - - public static GetIndexTemplateResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code index_templates} - */ - public final List indexTemplates() { - return this.indexTemplates; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.indexTemplates)) { - generator.writeKey("index_templates"); - generator.writeStartArray(); - for (IndexTemplateItem item0 : this.indexTemplates) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GetIndexTemplateResponse}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private List indexTemplates; - - /** - * Required - API name: {@code index_templates} - *

- * Adds all elements of list to indexTemplates. - */ - public final Builder indexTemplates(List list) { - this.indexTemplates = _listAddAll(this.indexTemplates, list); - return this; - } - - /** - * Required - API name: {@code index_templates} - *

- * Adds one or more values to indexTemplates. - */ - public final Builder indexTemplates(IndexTemplateItem value, IndexTemplateItem... values) { - this.indexTemplates = _listAdd(this.indexTemplates, value, values); - return this; - } - - /** - * Required - API name: {@code index_templates} - *

- * Adds a value to indexTemplates using a builder lambda. - */ - public final Builder indexTemplates(Function> fn) { - return indexTemplates(fn.apply(new IndexTemplateItem.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link GetIndexTemplateResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GetIndexTemplateResponse build() { - _checkSingleUse(); - - return new GetIndexTemplateResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link GetIndexTemplateResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, GetIndexTemplateResponse::setupGetIndexTemplateResponseDeserializer); - - protected static void setupGetIndexTemplateResponseDeserializer( - ObjectDeserializer op) { - - op.add(Builder::indexTemplates, JsonpDeserializer.arrayDeserializer(IndexTemplateItem._DESERIALIZER), - "index_templates"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetIndicesSettingsRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetIndicesSettingsRequest.java deleted file mode 100644 index b24881456..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetIndicesSettingsRequest.java +++ /dev/null @@ -1,541 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.ExpandWildcard; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.get_settings.Request - -/** - * Get index settings. Returns setting information for one or more indices. For - * data streams, returns setting information for the stream’s backing indices. - * - * @see API - * specification - */ - -public class GetIndicesSettingsRequest extends RequestBase { - @Nullable - private final Boolean allowNoIndices; - - private final List expandWildcards; - - @Nullable - private final Boolean flatSettings; - - @Nullable - private final Boolean ignoreUnavailable; - - @Nullable - private final Boolean includeDefaults; - - private final List index; - - @Nullable - private final Boolean local; - - @Nullable - private final Time masterTimeout; - - private final List name; - - // --------------------------------------------------------------------------------------------- - - private GetIndicesSettingsRequest(Builder builder) { - - this.allowNoIndices = builder.allowNoIndices; - this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); - this.flatSettings = builder.flatSettings; - this.ignoreUnavailable = builder.ignoreUnavailable; - this.includeDefaults = builder.includeDefaults; - this.index = ApiTypeHelper.unmodifiable(builder.index); - this.local = builder.local; - this.masterTimeout = builder.masterTimeout; - this.name = ApiTypeHelper.unmodifiable(builder.name); - - } - - public static GetIndicesSettingsRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code allow_no_indices} - */ - @Nullable - public final Boolean allowNoIndices() { - return this.allowNoIndices; - } - - /** - * 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. - *

- * API name: {@code expand_wildcards} - */ - public final List expandWildcards() { - return this.expandWildcards; - } - - /** - * If true, returns settings in flat format. - *

- * API name: {@code flat_settings} - */ - @Nullable - public final Boolean flatSettings() { - return this.flatSettings; - } - - /** - * If false, the request returns an error if it targets a missing - * or closed index. - *

- * API name: {@code ignore_unavailable} - */ - @Nullable - public final Boolean ignoreUnavailable() { - return this.ignoreUnavailable; - } - - /** - * If true, return all default settings in the response. - *

- * API name: {@code include_defaults} - */ - @Nullable - public final Boolean includeDefaults() { - return this.includeDefaults; - } - - /** - * 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. - *

- * API name: {@code index} - */ - public final List index() { - return this.index; - } - - /** - * If true, the request retrieves information from the local node - * only. If false, information is retrieved from the master node. - *

- * API name: {@code local} - */ - @Nullable - public final Boolean local() { - return this.local; - } - - /** - * 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. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * Comma-separated list or wildcard expression of settings to retrieve. - *

- * API name: {@code name} - */ - public final List name() { - return this.name; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GetIndicesSettingsRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private Boolean allowNoIndices; - - @Nullable - private List expandWildcards; - - @Nullable - private Boolean flatSettings; - - @Nullable - private Boolean ignoreUnavailable; - - @Nullable - private Boolean includeDefaults; - - @Nullable - private List index; - - @Nullable - private Boolean local; - - @Nullable - private Time masterTimeout; - - @Nullable - private List name; - - /** - * 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. - *

- * API name: {@code allow_no_indices} - */ - public final Builder allowNoIndices(@Nullable Boolean value) { - this.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. - *

- * API name: {@code expand_wildcards} - *

- * Adds all elements of list to expandWildcards. - */ - public final Builder expandWildcards(List list) { - this.expandWildcards = _listAddAll(this.expandWildcards, list); - 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. - *

- * API name: {@code expand_wildcards} - *

- * Adds one or more values to expandWildcards. - */ - public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { - this.expandWildcards = _listAdd(this.expandWildcards, value, values); - return this; - } - - /** - * If true, returns settings in flat format. - *

- * API name: {@code flat_settings} - */ - public final Builder flatSettings(@Nullable Boolean value) { - this.flatSettings = value; - return this; - } - - /** - * If false, the request returns an error if it targets a missing - * or closed index. - *

- * API name: {@code ignore_unavailable} - */ - public final Builder ignoreUnavailable(@Nullable Boolean value) { - this.ignoreUnavailable = value; - return this; - } - - /** - * If true, return all default settings in the response. - *

- * API name: {@code include_defaults} - */ - public final Builder includeDefaults(@Nullable Boolean value) { - this.includeDefaults = 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. - *

- * API name: {@code index} - *

- * Adds all elements of list to index. - */ - public final Builder index(List list) { - this.index = _listAddAll(this.index, list); - 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. - *

- * API name: {@code index} - *

- * Adds one or more values to index. - */ - public final Builder index(String value, String... values) { - this.index = _listAdd(this.index, value, values); - return this; - } - - /** - * If true, the request retrieves information from the local node - * only. If false, information is retrieved from the master node. - *

- * API name: {@code local} - */ - public final Builder local(@Nullable Boolean value) { - this.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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Comma-separated list or wildcard expression of settings to retrieve. - *

- * API name: {@code name} - *

- * Adds all elements of list to name. - */ - public final Builder name(List list) { - this.name = _listAddAll(this.name, list); - return this; - } - - /** - * Comma-separated list or wildcard expression of settings to retrieve. - *

- * API name: {@code name} - *

- * Adds one or more values to name. - */ - public final Builder name(String value, String... values) { - this.name = _listAdd(this.name, value, values); - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link GetIndicesSettingsRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GetIndicesSettingsRequest build() { - _checkSingleUse(); - - return new GetIndicesSettingsRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.get_settings}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.get_settings", - - // Request method - request -> { - return "GET"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - final int _index = 1 << 1; - - int propsSet = 0; - - if (ApiTypeHelper.isDefined(request.name())) - propsSet |= _name; - if (ApiTypeHelper.isDefined(request.index())) - propsSet |= _index; - - if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_settings"); - return buf.toString(); - } - if (propsSet == (_index)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_settings"); - return buf.toString(); - } - if (propsSet == (_index | _name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_settings"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); - return buf.toString(); - } - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_settings"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - final int _index = 1 << 1; - - int propsSet = 0; - - if (ApiTypeHelper.isDefined(request.name())) - propsSet |= _name; - if (ApiTypeHelper.isDefined(request.index())) - propsSet |= _index; - - if (propsSet == 0) { - } - if (propsSet == (_index)) { - params.put("index", request.index.stream().map(v -> v).collect(Collectors.joining(","))); - } - if (propsSet == (_index | _name)) { - params.put("index", request.index.stream().map(v -> v).collect(Collectors.joining(","))); - params.put("name", request.name.stream().map(v -> v).collect(Collectors.joining(","))); - } - if (propsSet == (_name)) { - params.put("name", request.name.stream().map(v -> v).collect(Collectors.joining(","))); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (request.flatSettings != null) { - params.put("flat_settings", String.valueOf(request.flatSettings)); - } - if (ApiTypeHelper.isDefined(request.expandWildcards)) { - params.put("expand_wildcards", - request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); - } - if (request.ignoreUnavailable != null) { - params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); - } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } - if (request.includeDefaults != null) { - params.put("include_defaults", String.valueOf(request.includeDefaults)); - } - if (request.local != null) { - params.put("local", String.valueOf(request.local)); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, GetIndicesSettingsResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetIndicesSettingsResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetIndicesSettingsResponse.java deleted file mode 100644 index 4bbe6b441..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetIndicesSettingsResponse.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import jakarta.json.stream.JsonParser; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.get_settings.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class GetIndicesSettingsResponse implements JsonpSerializable { - private final Map result; - - // --------------------------------------------------------------------------------------------- - - private GetIndicesSettingsResponse(Builder builder) { - - this.result = ApiTypeHelper.unmodifiableRequired(builder.result, this, "result"); - - } - - public static GetIndicesSettingsResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Response value. - */ - public final Map result() { - return this.result; - } - - /** - * Get an element of {@code result}. - */ - public final @Nullable IndexState get(String key) { - return this.result.get(key); - } - - /** - * Serialize this value to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - for (Map.Entry item0 : this.result.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GetIndicesSettingsResponse}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private Map result = new HashMap<>(); - - /** - * Required - Response value. - *

- * Adds all entries of map to result. - */ - public final Builder result(Map map) { - this.result = _mapPutAll(this.result, map); - return this; - } - - /** - * Required - Response value. - *

- * Adds an entry to result. - */ - public final Builder result(String key, IndexState value) { - this.result = _mapPut(this.result, key, value); - return this; - } - - /** - * Required - Response value. - *

- * Adds an entry to result using a builder lambda. - */ - public final Builder result(String key, Function> fn) { - return result(key, fn.apply(new IndexState.Builder()).build()); - } - - @Override - public Builder withJson(JsonParser parser, JsonpMapper mapper) { - - @SuppressWarnings("unchecked") - Map value = (Map) JsonpDeserializer - .stringMapDeserializer(IndexState._DESERIALIZER).deserialize(parser, mapper); - return this.result(value); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link GetIndicesSettingsResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GetIndicesSettingsResponse build() { - _checkSingleUse(); - - return new GetIndicesSettingsResponse(this); - } - } - - public static final JsonpDeserializer _DESERIALIZER = createGetIndicesSettingsResponseDeserializer(); - protected static JsonpDeserializer createGetIndicesSettingsResponseDeserializer() { - - JsonpDeserializer> valueDeserializer = JsonpDeserializer - .stringMapDeserializer(IndexState._DESERIALIZER); - - return JsonpDeserializer.of(valueDeserializer.acceptedEvents(), (parser, mapper, event) -> new Builder() - .result(valueDeserializer.deserialize(parser, mapper, event)).build()); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetMappingRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetMappingRequest.java deleted file mode 100644 index ea3bf519a..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetMappingRequest.java +++ /dev/null @@ -1,418 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.ExpandWildcard; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.get_mapping.Request - -/** - * Get mapping definitions. Retrieves mapping definitions for one or more - * indices. For data streams, the API retrieves mappings for the stream’s - * backing indices. - * - * @see API - * specification - */ - -public class GetMappingRequest extends RequestBase { - @Nullable - private final Boolean allowNoIndices; - - private final List expandWildcards; - - @Nullable - private final Boolean ignoreUnavailable; - - private final List index; - - @Nullable - private final Boolean local; - - @Nullable - private final Time masterTimeout; - - // --------------------------------------------------------------------------------------------- - - private GetMappingRequest(Builder builder) { - - this.allowNoIndices = builder.allowNoIndices; - this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); - this.ignoreUnavailable = builder.ignoreUnavailable; - this.index = ApiTypeHelper.unmodifiable(builder.index); - this.local = builder.local; - this.masterTimeout = builder.masterTimeout; - - } - - public static GetMappingRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code allow_no_indices} - */ - @Nullable - public final Boolean allowNoIndices() { - return this.allowNoIndices; - } - - /** - * 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. - *

- * API name: {@code expand_wildcards} - */ - public final List expandWildcards() { - return this.expandWildcards; - } - - /** - * If false, the request returns an error if it targets a missing - * or closed index. - *

- * API name: {@code ignore_unavailable} - */ - @Nullable - public final Boolean ignoreUnavailable() { - return this.ignoreUnavailable; - } - - /** - * 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. - *

- * API name: {@code index} - */ - public final List index() { - return this.index; - } - - /** - * If true, the request retrieves information from the local node - * only. - *

- * API name: {@code local} - */ - @Nullable - public final Boolean local() { - return this.local; - } - - /** - * 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. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GetMappingRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private Boolean allowNoIndices; - - @Nullable - private List expandWildcards; - - @Nullable - private Boolean ignoreUnavailable; - - @Nullable - private List index; - - @Nullable - private Boolean local; - - @Nullable - private Time masterTimeout; - - /** - * 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. - *

- * API name: {@code allow_no_indices} - */ - public final Builder allowNoIndices(@Nullable Boolean value) { - this.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. - *

- * API name: {@code expand_wildcards} - *

- * Adds all elements of list to expandWildcards. - */ - public final Builder expandWildcards(List list) { - this.expandWildcards = _listAddAll(this.expandWildcards, list); - 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. - *

- * API name: {@code expand_wildcards} - *

- * Adds one or more values to expandWildcards. - */ - public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { - this.expandWildcards = _listAdd(this.expandWildcards, value, values); - return this; - } - - /** - * If false, the request returns an error if it targets a missing - * or closed index. - *

- * API name: {@code ignore_unavailable} - */ - public final Builder ignoreUnavailable(@Nullable Boolean value) { - this.ignoreUnavailable = 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. - *

- * API name: {@code index} - *

- * Adds all elements of list to index. - */ - public final Builder index(List list) { - this.index = _listAddAll(this.index, list); - 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. - *

- * API name: {@code index} - *

- * Adds one or more values to index. - */ - public final Builder index(String value, String... values) { - this.index = _listAdd(this.index, value, values); - return this; - } - - /** - * If true, the request retrieves information from the local node - * only. - *

- * API name: {@code local} - */ - public final Builder local(@Nullable Boolean value) { - this.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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link GetMappingRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GetMappingRequest build() { - _checkSingleUse(); - - return new GetMappingRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.get_mapping}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.get_mapping", - - // Request method - request -> { - return "GET"; - - }, - - // Request path - request -> { - final int _index = 1 << 0; - - int propsSet = 0; - - if (ApiTypeHelper.isDefined(request.index())) - propsSet |= _index; - - if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_mapping"); - return buf.toString(); - } - if (propsSet == (_index)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_mapping"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _index = 1 << 0; - - int propsSet = 0; - - if (ApiTypeHelper.isDefined(request.index())) - propsSet |= _index; - - if (propsSet == 0) { - } - if (propsSet == (_index)) { - params.put("index", request.index.stream().map(v -> v).collect(Collectors.joining(","))); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (ApiTypeHelper.isDefined(request.expandWildcards)) { - params.put("expand_wildcards", - request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); - } - if (request.ignoreUnavailable != null) { - params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); - } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } - if (request.local != null) { - params.put("local", String.valueOf(request.local)); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, GetMappingResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetMappingResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetMappingResponse.java deleted file mode 100644 index 5d88a4fed..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/GetMappingResponse.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch.indices.get_mapping.IndexMappingRecord; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import jakarta.json.stream.JsonParser; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.get_mapping.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class GetMappingResponse implements JsonpSerializable { - private final Map result; - - // --------------------------------------------------------------------------------------------- - - private GetMappingResponse(Builder builder) { - - this.result = ApiTypeHelper.unmodifiableRequired(builder.result, this, "result"); - - } - - public static GetMappingResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Response value. - */ - public final Map result() { - return this.result; - } - - /** - * Get an element of {@code result}. - */ - public final @Nullable IndexMappingRecord get(String key) { - return this.result.get(key); - } - - /** - * Serialize this value to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - for (Map.Entry item0 : this.result.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GetMappingResponse}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private Map result = new HashMap<>(); - - /** - * Required - Response value. - *

- * Adds all entries of map to result. - */ - public final Builder result(Map map) { - this.result = _mapPutAll(this.result, map); - return this; - } - - /** - * Required - Response value. - *

- * Adds an entry to result. - */ - public final Builder result(String key, IndexMappingRecord value) { - this.result = _mapPut(this.result, key, value); - return this; - } - - /** - * Required - Response value. - *

- * Adds an entry to result using a builder lambda. - */ - public final Builder result(String key, - Function> fn) { - return result(key, fn.apply(new IndexMappingRecord.Builder()).build()); - } - - @Override - public Builder withJson(JsonParser parser, JsonpMapper mapper) { - - @SuppressWarnings("unchecked") - Map value = (Map) JsonpDeserializer - .stringMapDeserializer(IndexMappingRecord._DESERIALIZER).deserialize(parser, mapper); - return this.result(value); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link GetMappingResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GetMappingResponse build() { - _checkSingleUse(); - - return new GetMappingResponse(this); - } - } - - public static final JsonpDeserializer _DESERIALIZER = createGetMappingResponseDeserializer(); - protected static JsonpDeserializer createGetMappingResponseDeserializer() { - - JsonpDeserializer> valueDeserializer = JsonpDeserializer - .stringMapDeserializer(IndexMappingRecord._DESERIALIZER); - - return JsonpDeserializer.of(valueDeserializer.acceptedEvents(), (parser, mapper, event) -> new Builder() - .result(valueDeserializer.deserialize(parser, mapper, event)).build()); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexCheckOnStartup.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexCheckOnStartup.java deleted file mode 100644 index f26073eec..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexCheckOnStartup.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum IndexCheckOnStartup implements JsonEnum { - True("true"), - - False("false"), - - Checksum("checksum"), - - ; - - private final String jsonValue; - - IndexCheckOnStartup(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - IndexCheckOnStartup.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexRouting.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexRouting.java deleted file mode 100644 index c8a8fbb59..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexRouting.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.IndexRouting - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexRouting implements JsonpSerializable { - @Nullable - private final IndexRoutingAllocation allocation; - - @Nullable - private final IndexRoutingRebalance rebalance; - - // --------------------------------------------------------------------------------------------- - - private IndexRouting(Builder builder) { - - this.allocation = builder.allocation; - this.rebalance = builder.rebalance; - - } - - public static IndexRouting of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code allocation} - */ - @Nullable - public final IndexRoutingAllocation allocation() { - return this.allocation; - } - - /** - * API name: {@code rebalance} - */ - @Nullable - public final IndexRoutingRebalance rebalance() { - return this.rebalance; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.allocation != null) { - generator.writeKey("allocation"); - this.allocation.serialize(generator, mapper); - - } - if (this.rebalance != null) { - generator.writeKey("rebalance"); - this.rebalance.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexRouting}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private IndexRoutingAllocation allocation; - - @Nullable - private IndexRoutingRebalance rebalance; - - /** - * API name: {@code allocation} - */ - public final Builder allocation(@Nullable IndexRoutingAllocation value) { - this.allocation = value; - return this; - } - - /** - * API name: {@code allocation} - */ - public final Builder allocation( - Function> fn) { - return this.allocation(fn.apply(new IndexRoutingAllocation.Builder()).build()); - } - - /** - * API name: {@code rebalance} - */ - public final Builder rebalance(@Nullable IndexRoutingRebalance value) { - this.rebalance = value; - return this; - } - - /** - * API name: {@code rebalance} - */ - public final Builder rebalance( - Function> fn) { - return this.rebalance(fn.apply(new IndexRoutingRebalance.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexRouting}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexRouting build() { - _checkSingleUse(); - - return new IndexRouting(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexRouting} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - IndexRouting::setupIndexRoutingDeserializer); - - protected static void setupIndexRoutingDeserializer(ObjectDeserializer op) { - - op.add(Builder::allocation, IndexRoutingAllocation._DESERIALIZER, "allocation"); - op.add(Builder::rebalance, IndexRoutingRebalance._DESERIALIZER, "rebalance"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexRoutingAllocation.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexRoutingAllocation.java deleted file mode 100644 index b97033031..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexRoutingAllocation.java +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.IndexRoutingAllocation - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexRoutingAllocation implements JsonpSerializable { - @Nullable - private final IndexRoutingAllocationOptions enable; - - @Nullable - private final IndexRoutingAllocationInclude include; - - @Nullable - private final IndexRoutingAllocationInitialRecovery initialRecovery; - - @Nullable - private final IndexRoutingAllocationDisk disk; - - // --------------------------------------------------------------------------------------------- - - private IndexRoutingAllocation(Builder builder) { - - this.enable = builder.enable; - this.include = builder.include; - this.initialRecovery = builder.initialRecovery; - this.disk = builder.disk; - - } - - public static IndexRoutingAllocation of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code enable} - */ - @Nullable - public final IndexRoutingAllocationOptions enable() { - return this.enable; - } - - /** - * API name: {@code include} - */ - @Nullable - public final IndexRoutingAllocationInclude include() { - return this.include; - } - - /** - * API name: {@code initial_recovery} - */ - @Nullable - public final IndexRoutingAllocationInitialRecovery initialRecovery() { - return this.initialRecovery; - } - - /** - * API name: {@code disk} - */ - @Nullable - public final IndexRoutingAllocationDisk disk() { - return this.disk; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.enable != null) { - generator.writeKey("enable"); - this.enable.serialize(generator, mapper); - } - if (this.include != null) { - generator.writeKey("include"); - this.include.serialize(generator, mapper); - - } - if (this.initialRecovery != null) { - generator.writeKey("initial_recovery"); - this.initialRecovery.serialize(generator, mapper); - - } - if (this.disk != null) { - generator.writeKey("disk"); - this.disk.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexRoutingAllocation}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private IndexRoutingAllocationOptions enable; - - @Nullable - private IndexRoutingAllocationInclude include; - - @Nullable - private IndexRoutingAllocationInitialRecovery initialRecovery; - - @Nullable - private IndexRoutingAllocationDisk disk; - - /** - * API name: {@code enable} - */ - public final Builder enable(@Nullable IndexRoutingAllocationOptions value) { - this.enable = value; - return this; - } - - /** - * API name: {@code include} - */ - public final Builder include(@Nullable IndexRoutingAllocationInclude value) { - this.include = value; - return this; - } - - /** - * API name: {@code include} - */ - public final Builder include( - Function> fn) { - return this.include(fn.apply(new IndexRoutingAllocationInclude.Builder()).build()); - } - - /** - * API name: {@code initial_recovery} - */ - public final Builder initialRecovery(@Nullable IndexRoutingAllocationInitialRecovery value) { - this.initialRecovery = value; - return this; - } - - /** - * API name: {@code initial_recovery} - */ - public final Builder initialRecovery( - Function> fn) { - return this.initialRecovery(fn.apply(new IndexRoutingAllocationInitialRecovery.Builder()).build()); - } - - /** - * API name: {@code disk} - */ - public final Builder disk(@Nullable IndexRoutingAllocationDisk value) { - this.disk = value; - return this; - } - - /** - * API name: {@code disk} - */ - public final Builder disk( - Function> fn) { - return this.disk(fn.apply(new IndexRoutingAllocationDisk.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexRoutingAllocation}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexRoutingAllocation build() { - _checkSingleUse(); - - return new IndexRoutingAllocation(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexRoutingAllocation} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, IndexRoutingAllocation::setupIndexRoutingAllocationDeserializer); - - protected static void setupIndexRoutingAllocationDeserializer( - ObjectDeserializer op) { - - op.add(Builder::enable, IndexRoutingAllocationOptions._DESERIALIZER, "enable"); - op.add(Builder::include, IndexRoutingAllocationInclude._DESERIALIZER, "include"); - op.add(Builder::initialRecovery, IndexRoutingAllocationInitialRecovery._DESERIALIZER, "initial_recovery"); - op.add(Builder::disk, IndexRoutingAllocationDisk._DESERIALIZER, "disk"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexRoutingAllocationDisk.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexRoutingAllocationDisk.java deleted file mode 100644 index 5433c50a8..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexRoutingAllocationDisk.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.IndexRoutingAllocationDisk - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexRoutingAllocationDisk implements JsonpSerializable { - @Nullable - private final Boolean thresholdEnabled; - - // --------------------------------------------------------------------------------------------- - - private IndexRoutingAllocationDisk(Builder builder) { - - this.thresholdEnabled = builder.thresholdEnabled; - - } - - public static IndexRoutingAllocationDisk of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code threshold_enabled} - */ - @Nullable - public final Boolean thresholdEnabled() { - return this.thresholdEnabled; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.thresholdEnabled != null) { - generator.writeKey("threshold_enabled"); - generator.write(this.thresholdEnabled); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexRoutingAllocationDisk}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Boolean thresholdEnabled; - - /** - * API name: {@code threshold_enabled} - */ - public final Builder thresholdEnabled(@Nullable Boolean value) { - this.thresholdEnabled = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexRoutingAllocationDisk}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexRoutingAllocationDisk build() { - _checkSingleUse(); - - return new IndexRoutingAllocationDisk(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexRoutingAllocationDisk} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, IndexRoutingAllocationDisk::setupIndexRoutingAllocationDiskDeserializer); - - protected static void setupIndexRoutingAllocationDiskDeserializer( - ObjectDeserializer op) { - - op.add(Builder::thresholdEnabled, JsonpDeserializer.booleanDeserializer(), "threshold_enabled"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexRoutingAllocationInclude.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexRoutingAllocationInclude.java deleted file mode 100644 index aaec90173..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexRoutingAllocationInclude.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.IndexRoutingAllocationInclude - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexRoutingAllocationInclude implements JsonpSerializable { - @Nullable - private final String tierPreference; - - @Nullable - private final String id; - - // --------------------------------------------------------------------------------------------- - - private IndexRoutingAllocationInclude(Builder builder) { - - this.tierPreference = builder.tierPreference; - this.id = builder.id; - - } - - public static IndexRoutingAllocationInclude of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code _tier_preference} - */ - @Nullable - public final String tierPreference() { - return this.tierPreference; - } - - /** - * API name: {@code _id} - */ - @Nullable - public final String id() { - return this.id; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.tierPreference != null) { - generator.writeKey("_tier_preference"); - generator.write(this.tierPreference); - - } - if (this.id != null) { - generator.writeKey("_id"); - generator.write(this.id); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexRoutingAllocationInclude}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private String tierPreference; - - @Nullable - private String id; - - /** - * API name: {@code _tier_preference} - */ - public final Builder tierPreference(@Nullable String value) { - this.tierPreference = value; - return this; - } - - /** - * API name: {@code _id} - */ - public final Builder id(@Nullable String value) { - this.id = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexRoutingAllocationInclude}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexRoutingAllocationInclude build() { - _checkSingleUse(); - - return new IndexRoutingAllocationInclude(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexRoutingAllocationInclude} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, IndexRoutingAllocationInclude::setupIndexRoutingAllocationIncludeDeserializer); - - protected static void setupIndexRoutingAllocationIncludeDeserializer( - ObjectDeserializer op) { - - op.add(Builder::tierPreference, JsonpDeserializer.stringDeserializer(), "_tier_preference"); - op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "_id"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexRoutingAllocationInitialRecovery.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexRoutingAllocationInitialRecovery.java deleted file mode 100644 index be6c63829..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexRoutingAllocationInitialRecovery.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.IndexRoutingAllocationInitialRecovery - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexRoutingAllocationInitialRecovery implements JsonpSerializable { - @Nullable - private final String id; - - // --------------------------------------------------------------------------------------------- - - private IndexRoutingAllocationInitialRecovery(Builder builder) { - - this.id = builder.id; - - } - - public static IndexRoutingAllocationInitialRecovery of( - Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code _id} - */ - @Nullable - public final String id() { - return this.id; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.id != null) { - generator.writeKey("_id"); - generator.write(this.id); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexRoutingAllocationInitialRecovery}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private String id; - - /** - * API name: {@code _id} - */ - public final Builder id(@Nullable String value) { - this.id = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexRoutingAllocationInitialRecovery}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexRoutingAllocationInitialRecovery build() { - _checkSingleUse(); - - return new IndexRoutingAllocationInitialRecovery(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexRoutingAllocationInitialRecovery} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, - IndexRoutingAllocationInitialRecovery::setupIndexRoutingAllocationInitialRecoveryDeserializer); - - protected static void setupIndexRoutingAllocationInitialRecoveryDeserializer( - ObjectDeserializer op) { - - op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "_id"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexRoutingAllocationOptions.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexRoutingAllocationOptions.java deleted file mode 100644 index e52caeb82..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexRoutingAllocationOptions.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum IndexRoutingAllocationOptions implements JsonEnum { - All("all"), - - Primaries("primaries"), - - NewPrimaries("new_primaries"), - - None("none"), - - ; - - private final String jsonValue; - - IndexRoutingAllocationOptions(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - IndexRoutingAllocationOptions.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexRoutingRebalance.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexRoutingRebalance.java deleted file mode 100644 index 437f95ac1..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexRoutingRebalance.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.IndexRoutingRebalance - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexRoutingRebalance implements JsonpSerializable { - private final IndexRoutingRebalanceOptions enable; - - // --------------------------------------------------------------------------------------------- - - private IndexRoutingRebalance(Builder builder) { - - this.enable = ApiTypeHelper.requireNonNull(builder.enable, this, "enable"); - - } - - public static IndexRoutingRebalance of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code enable} - */ - public final IndexRoutingRebalanceOptions enable() { - return this.enable; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("enable"); - this.enable.serialize(generator, mapper); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexRoutingRebalance}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private IndexRoutingRebalanceOptions enable; - - /** - * Required - API name: {@code enable} - */ - public final Builder enable(IndexRoutingRebalanceOptions value) { - this.enable = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexRoutingRebalance}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexRoutingRebalance build() { - _checkSingleUse(); - - return new IndexRoutingRebalance(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexRoutingRebalance} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, IndexRoutingRebalance::setupIndexRoutingRebalanceDeserializer); - - protected static void setupIndexRoutingRebalanceDeserializer(ObjectDeserializer op) { - - op.add(Builder::enable, IndexRoutingRebalanceOptions._DESERIALIZER, "enable"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexRoutingRebalanceOptions.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexRoutingRebalanceOptions.java deleted file mode 100644 index 8563e0f9e..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexRoutingRebalanceOptions.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum IndexRoutingRebalanceOptions implements JsonEnum { - All("all"), - - Primaries("primaries"), - - Replicas("replicas"), - - None("none"), - - ; - - private final String jsonValue; - - IndexRoutingRebalanceOptions(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - IndexRoutingRebalanceOptions.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSegmentSort.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSegmentSort.java deleted file mode 100644 index 882d57436..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSegmentSort.java +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.IndexSegmentSort - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexSegmentSort implements JsonpSerializable { - private final List field; - - private final List order; - - private final List mode; - - private final List missing; - - // --------------------------------------------------------------------------------------------- - - private IndexSegmentSort(Builder builder) { - - this.field = ApiTypeHelper.unmodifiable(builder.field); - this.order = ApiTypeHelper.unmodifiable(builder.order); - this.mode = ApiTypeHelper.unmodifiable(builder.mode); - this.missing = ApiTypeHelper.unmodifiable(builder.missing); - - } - - public static IndexSegmentSort of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code field} - */ - public final List field() { - return this.field; - } - - /** - * API name: {@code order} - */ - public final List order() { - return this.order; - } - - /** - * API name: {@code mode} - */ - public final List mode() { - return this.mode; - } - - /** - * API name: {@code missing} - */ - public final List missing() { - return this.missing; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.field)) { - generator.writeKey("field"); - generator.writeStartArray(); - for (String item0 : this.field) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.order)) { - generator.writeKey("order"); - generator.writeStartArray(); - for (SegmentSortOrder item0 : this.order) { - item0.serialize(generator, mapper); - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.mode)) { - generator.writeKey("mode"); - generator.writeStartArray(); - for (SegmentSortMode item0 : this.mode) { - item0.serialize(generator, mapper); - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.missing)) { - generator.writeKey("missing"); - generator.writeStartArray(); - for (SegmentSortMissing item0 : this.missing) { - item0.serialize(generator, mapper); - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexSegmentSort}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private List field; - - @Nullable - private List order; - - @Nullable - private List mode; - - @Nullable - private List missing; - - /** - * API name: {@code field} - *

- * Adds all elements of list to field. - */ - public final Builder field(List list) { - this.field = _listAddAll(this.field, list); - return this; - } - - /** - * API name: {@code field} - *

- * Adds one or more values to field. - */ - public final Builder field(String value, String... values) { - this.field = _listAdd(this.field, value, values); - return this; - } - - /** - * API name: {@code order} - *

- * Adds all elements of list to order. - */ - public final Builder order(List list) { - this.order = _listAddAll(this.order, list); - return this; - } - - /** - * API name: {@code order} - *

- * Adds one or more values to order. - */ - public final Builder order(SegmentSortOrder value, SegmentSortOrder... values) { - this.order = _listAdd(this.order, value, values); - return this; - } - - /** - * API name: {@code mode} - *

- * Adds all elements of list to mode. - */ - public final Builder mode(List list) { - this.mode = _listAddAll(this.mode, list); - return this; - } - - /** - * API name: {@code mode} - *

- * Adds one or more values to mode. - */ - public final Builder mode(SegmentSortMode value, SegmentSortMode... values) { - this.mode = _listAdd(this.mode, value, values); - return this; - } - - /** - * API name: {@code missing} - *

- * Adds all elements of list to missing. - */ - public final Builder missing(List list) { - this.missing = _listAddAll(this.missing, list); - return this; - } - - /** - * API name: {@code missing} - *

- * Adds one or more values to missing. - */ - public final Builder missing(SegmentSortMissing value, SegmentSortMissing... values) { - this.missing = _listAdd(this.missing, value, values); - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexSegmentSort}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexSegmentSort build() { - _checkSingleUse(); - - return new IndexSegmentSort(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexSegmentSort} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - IndexSegmentSort::setupIndexSegmentSortDeserializer); - - protected static void setupIndexSegmentSortDeserializer(ObjectDeserializer op) { - - op.add(Builder::field, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "field"); - op.add(Builder::order, JsonpDeserializer.arrayDeserializer(SegmentSortOrder._DESERIALIZER), "order"); - op.add(Builder::mode, JsonpDeserializer.arrayDeserializer(SegmentSortMode._DESERIALIZER), "mode"); - op.add(Builder::missing, JsonpDeserializer.arrayDeserializer(SegmentSortMissing._DESERIALIZER), "missing"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingBlocks.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingBlocks.java deleted file mode 100644 index 93fbc4b1a..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingBlocks.java +++ /dev/null @@ -1,277 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.IndexSettingBlocks - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexSettingBlocks implements JsonpSerializable { - @Nullable - private final Boolean readOnly; - - @Nullable - private final Boolean readOnlyAllowDelete; - - @Nullable - private final Boolean read; - - @Nullable - private final Boolean write; - - @Nullable - private final Boolean metadata; - - // --------------------------------------------------------------------------------------------- - - private IndexSettingBlocks(Builder builder) { - - this.readOnly = builder.readOnly; - this.readOnlyAllowDelete = builder.readOnlyAllowDelete; - this.read = builder.read; - this.write = builder.write; - this.metadata = builder.metadata; - - } - - public static IndexSettingBlocks of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code read_only} - */ - @Nullable - public final Boolean readOnly() { - return this.readOnly; - } - - /** - * API name: {@code read_only_allow_delete} - */ - @Nullable - public final Boolean readOnlyAllowDelete() { - return this.readOnlyAllowDelete; - } - - /** - * API name: {@code read} - */ - @Nullable - public final Boolean read() { - return this.read; - } - - /** - * API name: {@code write} - */ - @Nullable - public final Boolean write() { - return this.write; - } - - /** - * API name: {@code metadata} - */ - @Nullable - public final Boolean metadata() { - return this.metadata; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.readOnly != null) { - generator.writeKey("read_only"); - generator.write(this.readOnly); - - } - if (this.readOnlyAllowDelete != null) { - generator.writeKey("read_only_allow_delete"); - generator.write(this.readOnlyAllowDelete); - - } - if (this.read != null) { - generator.writeKey("read"); - generator.write(this.read); - - } - if (this.write != null) { - generator.writeKey("write"); - generator.write(this.write); - - } - if (this.metadata != null) { - generator.writeKey("metadata"); - generator.write(this.metadata); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexSettingBlocks}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Boolean readOnly; - - @Nullable - private Boolean readOnlyAllowDelete; - - @Nullable - private Boolean read; - - @Nullable - private Boolean write; - - @Nullable - private Boolean metadata; - - /** - * API name: {@code read_only} - */ - public final Builder readOnly(@Nullable Boolean value) { - this.readOnly = value; - return this; - } - - /** - * API name: {@code read_only_allow_delete} - */ - public final Builder readOnlyAllowDelete(@Nullable Boolean value) { - this.readOnlyAllowDelete = value; - return this; - } - - /** - * API name: {@code read} - */ - public final Builder read(@Nullable Boolean value) { - this.read = value; - return this; - } - - /** - * API name: {@code write} - */ - public final Builder write(@Nullable Boolean value) { - this.write = value; - return this; - } - - /** - * API name: {@code metadata} - */ - public final Builder metadata(@Nullable Boolean value) { - this.metadata = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexSettingBlocks}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexSettingBlocks build() { - _checkSingleUse(); - - return new IndexSettingBlocks(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexSettingBlocks} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, IndexSettingBlocks::setupIndexSettingBlocksDeserializer); - - protected static void setupIndexSettingBlocksDeserializer(ObjectDeserializer op) { - - op.add(Builder::readOnly, JsonpDeserializer.booleanDeserializer(), "read_only"); - op.add(Builder::readOnlyAllowDelete, JsonpDeserializer.booleanDeserializer(), "read_only_allow_delete"); - op.add(Builder::read, JsonpDeserializer.booleanDeserializer(), "read"); - op.add(Builder::write, JsonpDeserializer.booleanDeserializer(), "write"); - op.add(Builder::metadata, JsonpDeserializer.booleanDeserializer(), "metadata"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettings.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettings.java deleted file mode 100644 index 63fe19942..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettings.java +++ /dev/null @@ -1,2068 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonData; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.DateTime; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Integer; -import java.lang.Long; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.IndexSettings - -/** - * - * @see Documentation - * on elastic.co - * @see API - * specification - */ -@JsonpDeserializable -public class IndexSettings implements JsonpSerializable { - private final Map otherSettings; - - @Nullable - private final IndexSettings index; - - @Nullable - private final String mode; - - private final List routingPath; - - @Nullable - private final SoftDeletes softDeletes; - - @Nullable - private final IndexSegmentSort sort; - - @Nullable - private final String numberOfShards; - - @Nullable - private final String numberOfReplicas; - - @Nullable - private final Integer numberOfRoutingShards; - - @Nullable - private final IndexCheckOnStartup checkOnStartup; - - @Nullable - private final String codec; - - @Nullable - private final Integer routingPartitionSize; - - @Nullable - private final Boolean loadFixedBitsetFiltersEagerly; - - @Nullable - private final Boolean hidden; - - @Nullable - private final String autoExpandReplicas; - - @Nullable - private final Merge merge; - - @Nullable - private final SettingsSearch search; - - @Nullable - private final Time refreshInterval; - - @Nullable - private final Integer maxResultWindow; - - @Nullable - private final Integer maxInnerResultWindow; - - @Nullable - private final Integer maxRescoreWindow; - - @Nullable - private final Integer maxDocvalueFieldsSearch; - - @Nullable - private final Integer maxScriptFields; - - @Nullable - private final Integer maxNgramDiff; - - @Nullable - private final Integer maxShingleDiff; - - @Nullable - private final IndexSettingBlocks blocks; - - @Nullable - private final Integer maxRefreshListeners; - - @Nullable - private final SettingsAnalyze analyze; - - @Nullable - private final SettingsHighlight highlight; - - @Nullable - private final Integer maxTermsCount; - - @Nullable - private final Integer maxRegexLength; - - @Nullable - private final IndexRouting routing; - - @Nullable - private final Time gcDeletes; - - @Nullable - private final String defaultPipeline; - - @Nullable - private final String finalPipeline; - - @Nullable - private final IndexSettingsLifecycle lifecycle; - - @Nullable - private final String providedName; - - @Nullable - private final Long creationDate; - - @Nullable - private final DateTime creationDateString; - - @Nullable - private final String uuid; - - @Nullable - private final IndexVersioning version; - - @Nullable - private final Boolean verifiedBeforeClose; - - @Nullable - private final String format; - - @Nullable - private final Integer maxSlicesPerScroll; - - @Nullable - private final Translog translog; - - @Nullable - private final SettingsQueryString queryString; - - @Nullable - private final String priority; - - @Nullable - private final Integer topMetricsMaxSize; - - @Nullable - private final IndexSettingsAnalysis analysis; - - @Nullable - private final IndexSettings settings; - - @Nullable - private final IndexSettingsTimeSeries timeSeries; - - @Nullable - private final Queries queries; - - private final Map similarity; - - @Nullable - private final MappingLimitSettings mapping; - - @Nullable - private final IndexingSlowlogSettings indexingSlowlog; - - @Nullable - private final IndexingPressure indexingPressure; - - @Nullable - private final Storage store; - - // --------------------------------------------------------------------------------------------- - - private IndexSettings(Builder builder) { - - this.otherSettings = ApiTypeHelper.unmodifiable(builder.otherSettings); - - this.index = builder.index; - this.mode = builder.mode; - this.routingPath = ApiTypeHelper.unmodifiable(builder.routingPath); - this.softDeletes = builder.softDeletes; - this.sort = builder.sort; - this.numberOfShards = builder.numberOfShards; - this.numberOfReplicas = builder.numberOfReplicas; - this.numberOfRoutingShards = builder.numberOfRoutingShards; - this.checkOnStartup = builder.checkOnStartup; - this.codec = builder.codec; - this.routingPartitionSize = builder.routingPartitionSize; - this.loadFixedBitsetFiltersEagerly = builder.loadFixedBitsetFiltersEagerly; - this.hidden = builder.hidden; - this.autoExpandReplicas = builder.autoExpandReplicas; - this.merge = builder.merge; - this.search = builder.search; - this.refreshInterval = builder.refreshInterval; - this.maxResultWindow = builder.maxResultWindow; - this.maxInnerResultWindow = builder.maxInnerResultWindow; - this.maxRescoreWindow = builder.maxRescoreWindow; - this.maxDocvalueFieldsSearch = builder.maxDocvalueFieldsSearch; - this.maxScriptFields = builder.maxScriptFields; - this.maxNgramDiff = builder.maxNgramDiff; - this.maxShingleDiff = builder.maxShingleDiff; - this.blocks = builder.blocks; - this.maxRefreshListeners = builder.maxRefreshListeners; - this.analyze = builder.analyze; - this.highlight = builder.highlight; - this.maxTermsCount = builder.maxTermsCount; - this.maxRegexLength = builder.maxRegexLength; - this.routing = builder.routing; - this.gcDeletes = builder.gcDeletes; - this.defaultPipeline = builder.defaultPipeline; - this.finalPipeline = builder.finalPipeline; - this.lifecycle = builder.lifecycle; - this.providedName = builder.providedName; - this.creationDate = builder.creationDate; - this.creationDateString = builder.creationDateString; - this.uuid = builder.uuid; - this.version = builder.version; - this.verifiedBeforeClose = builder.verifiedBeforeClose; - this.format = builder.format; - this.maxSlicesPerScroll = builder.maxSlicesPerScroll; - this.translog = builder.translog; - this.queryString = builder.queryString; - this.priority = builder.priority; - this.topMetricsMaxSize = builder.topMetricsMaxSize; - this.analysis = builder.analysis; - this.settings = builder.settings; - this.timeSeries = builder.timeSeries; - this.queries = builder.queries; - this.similarity = ApiTypeHelper.unmodifiable(builder.similarity); - this.mapping = builder.mapping; - this.indexingSlowlog = builder.indexingSlowlog; - this.indexingPressure = builder.indexingPressure; - this.store = builder.store; - - } - - public static IndexSettings of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - */ - public final Map otherSettings() { - return this.otherSettings; - } - - /** - * API name: {@code index} - */ - @Nullable - public final IndexSettings index() { - return this.index; - } - - /** - * API name: {@code mode} - */ - @Nullable - public final String mode() { - return this.mode; - } - - /** - * API name: {@code routing_path} - */ - public final List routingPath() { - return this.routingPath; - } - - /** - * API name: {@code soft_deletes} - */ - @Nullable - public final SoftDeletes softDeletes() { - return this.softDeletes; - } - - /** - * API name: {@code sort} - */ - @Nullable - public final IndexSegmentSort sort() { - return this.sort; - } - - /** - * API name: {@code number_of_shards} - */ - @Nullable - public final String numberOfShards() { - return this.numberOfShards; - } - - /** - * API name: {@code number_of_replicas} - */ - @Nullable - public final String numberOfReplicas() { - return this.numberOfReplicas; - } - - /** - * API name: {@code number_of_routing_shards} - */ - @Nullable - public final Integer numberOfRoutingShards() { - return this.numberOfRoutingShards; - } - - /** - * API name: {@code check_on_startup} - */ - @Nullable - public final IndexCheckOnStartup checkOnStartup() { - return this.checkOnStartup; - } - - /** - * API name: {@code codec} - */ - @Nullable - public final String codec() { - return this.codec; - } - - /** - * API name: {@code routing_partition_size} - */ - @Nullable - public final Integer routingPartitionSize() { - return this.routingPartitionSize; - } - - /** - * API name: {@code load_fixed_bitset_filters_eagerly} - */ - @Nullable - public final Boolean loadFixedBitsetFiltersEagerly() { - return this.loadFixedBitsetFiltersEagerly; - } - - /** - * API name: {@code hidden} - */ - @Nullable - public final Boolean hidden() { - return this.hidden; - } - - /** - * API name: {@code auto_expand_replicas} - */ - @Nullable - public final String autoExpandReplicas() { - return this.autoExpandReplicas; - } - - /** - * API name: {@code merge} - */ - @Nullable - public final Merge merge() { - return this.merge; - } - - /** - * API name: {@code search} - */ - @Nullable - public final SettingsSearch search() { - return this.search; - } - - /** - * API name: {@code refresh_interval} - */ - @Nullable - public final Time refreshInterval() { - return this.refreshInterval; - } - - /** - * API name: {@code max_result_window} - */ - @Nullable - public final Integer maxResultWindow() { - return this.maxResultWindow; - } - - /** - * API name: {@code max_inner_result_window} - */ - @Nullable - public final Integer maxInnerResultWindow() { - return this.maxInnerResultWindow; - } - - /** - * API name: {@code max_rescore_window} - */ - @Nullable - public final Integer maxRescoreWindow() { - return this.maxRescoreWindow; - } - - /** - * API name: {@code max_docvalue_fields_search} - */ - @Nullable - public final Integer maxDocvalueFieldsSearch() { - return this.maxDocvalueFieldsSearch; - } - - /** - * API name: {@code max_script_fields} - */ - @Nullable - public final Integer maxScriptFields() { - return this.maxScriptFields; - } - - /** - * API name: {@code max_ngram_diff} - */ - @Nullable - public final Integer maxNgramDiff() { - return this.maxNgramDiff; - } - - /** - * API name: {@code max_shingle_diff} - */ - @Nullable - public final Integer maxShingleDiff() { - return this.maxShingleDiff; - } - - /** - * API name: {@code blocks} - */ - @Nullable - public final IndexSettingBlocks blocks() { - return this.blocks; - } - - /** - * API name: {@code max_refresh_listeners} - */ - @Nullable - public final Integer maxRefreshListeners() { - return this.maxRefreshListeners; - } - - /** - * Settings to define analyzers, tokenizers, token filters and character - * filters. - *

- * API name: {@code analyze} - */ - @Nullable - public final SettingsAnalyze analyze() { - return this.analyze; - } - - /** - * API name: {@code highlight} - */ - @Nullable - public final SettingsHighlight highlight() { - return this.highlight; - } - - /** - * API name: {@code max_terms_count} - */ - @Nullable - public final Integer maxTermsCount() { - return this.maxTermsCount; - } - - /** - * API name: {@code max_regex_length} - */ - @Nullable - public final Integer maxRegexLength() { - return this.maxRegexLength; - } - - /** - * API name: {@code routing} - */ - @Nullable - public final IndexRouting routing() { - return this.routing; - } - - /** - * API name: {@code gc_deletes} - */ - @Nullable - public final Time gcDeletes() { - return this.gcDeletes; - } - - /** - * API name: {@code default_pipeline} - */ - @Nullable - public final String defaultPipeline() { - return this.defaultPipeline; - } - - /** - * API name: {@code final_pipeline} - */ - @Nullable - public final String finalPipeline() { - return this.finalPipeline; - } - - /** - * API name: {@code lifecycle} - */ - @Nullable - public final IndexSettingsLifecycle lifecycle() { - return this.lifecycle; - } - - /** - * API name: {@code provided_name} - */ - @Nullable - public final String providedName() { - return this.providedName; - } - - /** - * API name: {@code creation_date} - */ - @Nullable - public final Long creationDate() { - return this.creationDate; - } - - /** - * API name: {@code creation_date_string} - */ - @Nullable - public final DateTime creationDateString() { - return this.creationDateString; - } - - /** - * API name: {@code uuid} - */ - @Nullable - public final String uuid() { - return this.uuid; - } - - /** - * API name: {@code version} - */ - @Nullable - public final IndexVersioning version() { - return this.version; - } - - /** - * API name: {@code verified_before_close} - */ - @Nullable - public final Boolean verifiedBeforeClose() { - return this.verifiedBeforeClose; - } - - /** - * API name: {@code format} - */ - @Nullable - public final String format() { - return this.format; - } - - /** - * API name: {@code max_slices_per_scroll} - */ - @Nullable - public final Integer maxSlicesPerScroll() { - return this.maxSlicesPerScroll; - } - - /** - * API name: {@code translog} - */ - @Nullable - public final Translog translog() { - return this.translog; - } - - /** - * API name: {@code query_string} - */ - @Nullable - public final SettingsQueryString queryString() { - return this.queryString; - } - - /** - * API name: {@code priority} - */ - @Nullable - public final String priority() { - return this.priority; - } - - /** - * API name: {@code top_metrics_max_size} - */ - @Nullable - public final Integer topMetricsMaxSize() { - return this.topMetricsMaxSize; - } - - /** - * API name: {@code analysis} - */ - @Nullable - public final IndexSettingsAnalysis analysis() { - return this.analysis; - } - - /** - * API name: {@code settings} - */ - @Nullable - public final IndexSettings settings() { - return this.settings; - } - - /** - * API name: {@code time_series} - */ - @Nullable - public final IndexSettingsTimeSeries timeSeries() { - return this.timeSeries; - } - - /** - * API name: {@code queries} - */ - @Nullable - public final Queries queries() { - return this.queries; - } - - /** - * Configure custom similarity settings to customize how search results are - * scored. - *

- * API name: {@code similarity} - */ - public final Map similarity() { - return this.similarity; - } - - /** - * Enable or disable dynamic mapping for an index. - *

- * API name: {@code mapping} - */ - @Nullable - public final MappingLimitSettings mapping() { - return this.mapping; - } - - /** - * API name: {@code indexing.slowlog} - */ - @Nullable - public final IndexingSlowlogSettings indexingSlowlog() { - return this.indexingSlowlog; - } - - /** - * Configure indexing back pressure limits. - *

- * API name: {@code indexing_pressure} - */ - @Nullable - public final IndexingPressure indexingPressure() { - return this.indexingPressure; - } - - /** - * The store module allows you to control how index data is stored and accessed - * on disk. - *

- * API name: {@code store} - */ - @Nullable - public final Storage store() { - return this.store; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - for (Map.Entry item0 : this.otherSettings.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - - if (this.index != null) { - generator.writeKey("index"); - this.index.serialize(generator, mapper); - - } - if (this.mode != null) { - generator.writeKey("mode"); - generator.write(this.mode); - - } - if (ApiTypeHelper.isDefined(this.routingPath)) { - generator.writeKey("routing_path"); - generator.writeStartArray(); - for (String item0 : this.routingPath) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (this.softDeletes != null) { - generator.writeKey("soft_deletes"); - this.softDeletes.serialize(generator, mapper); - - } - if (this.sort != null) { - generator.writeKey("sort"); - this.sort.serialize(generator, mapper); - - } - if (this.numberOfShards != null) { - generator.writeKey("number_of_shards"); - generator.write(this.numberOfShards); - - } - if (this.numberOfReplicas != null) { - generator.writeKey("number_of_replicas"); - generator.write(this.numberOfReplicas); - - } - if (this.numberOfRoutingShards != null) { - generator.writeKey("number_of_routing_shards"); - generator.write(this.numberOfRoutingShards); - - } - if (this.checkOnStartup != null) { - generator.writeKey("check_on_startup"); - this.checkOnStartup.serialize(generator, mapper); - } - if (this.codec != null) { - generator.writeKey("codec"); - generator.write(this.codec); - - } - if (this.routingPartitionSize != null) { - generator.writeKey("routing_partition_size"); - generator.write(this.routingPartitionSize); - - } - if (this.loadFixedBitsetFiltersEagerly != null) { - generator.writeKey("load_fixed_bitset_filters_eagerly"); - generator.write(this.loadFixedBitsetFiltersEagerly); - - } - if (this.hidden != null) { - generator.writeKey("hidden"); - generator.write(this.hidden); - - } - if (this.autoExpandReplicas != null) { - generator.writeKey("auto_expand_replicas"); - generator.write(this.autoExpandReplicas); - - } - if (this.merge != null) { - generator.writeKey("merge"); - this.merge.serialize(generator, mapper); - - } - if (this.search != null) { - generator.writeKey("search"); - this.search.serialize(generator, mapper); - - } - if (this.refreshInterval != null) { - generator.writeKey("refresh_interval"); - this.refreshInterval.serialize(generator, mapper); - - } - if (this.maxResultWindow != null) { - generator.writeKey("max_result_window"); - generator.write(this.maxResultWindow); - - } - if (this.maxInnerResultWindow != null) { - generator.writeKey("max_inner_result_window"); - generator.write(this.maxInnerResultWindow); - - } - if (this.maxRescoreWindow != null) { - generator.writeKey("max_rescore_window"); - generator.write(this.maxRescoreWindow); - - } - if (this.maxDocvalueFieldsSearch != null) { - generator.writeKey("max_docvalue_fields_search"); - generator.write(this.maxDocvalueFieldsSearch); - - } - if (this.maxScriptFields != null) { - generator.writeKey("max_script_fields"); - generator.write(this.maxScriptFields); - - } - if (this.maxNgramDiff != null) { - generator.writeKey("max_ngram_diff"); - generator.write(this.maxNgramDiff); - - } - if (this.maxShingleDiff != null) { - generator.writeKey("max_shingle_diff"); - generator.write(this.maxShingleDiff); - - } - if (this.blocks != null) { - generator.writeKey("blocks"); - this.blocks.serialize(generator, mapper); - - } - if (this.maxRefreshListeners != null) { - generator.writeKey("max_refresh_listeners"); - generator.write(this.maxRefreshListeners); - - } - if (this.analyze != null) { - generator.writeKey("analyze"); - this.analyze.serialize(generator, mapper); - - } - if (this.highlight != null) { - generator.writeKey("highlight"); - this.highlight.serialize(generator, mapper); - - } - if (this.maxTermsCount != null) { - generator.writeKey("max_terms_count"); - generator.write(this.maxTermsCount); - - } - if (this.maxRegexLength != null) { - generator.writeKey("max_regex_length"); - generator.write(this.maxRegexLength); - - } - if (this.routing != null) { - generator.writeKey("routing"); - this.routing.serialize(generator, mapper); - - } - if (this.gcDeletes != null) { - generator.writeKey("gc_deletes"); - this.gcDeletes.serialize(generator, mapper); - - } - if (this.defaultPipeline != null) { - generator.writeKey("default_pipeline"); - generator.write(this.defaultPipeline); - - } - if (this.finalPipeline != null) { - generator.writeKey("final_pipeline"); - generator.write(this.finalPipeline); - - } - if (this.lifecycle != null) { - generator.writeKey("lifecycle"); - this.lifecycle.serialize(generator, mapper); - - } - if (this.providedName != null) { - generator.writeKey("provided_name"); - generator.write(this.providedName); - - } - if (this.creationDate != null) { - generator.writeKey("creation_date"); - generator.write(this.creationDate); - - } - if (this.creationDateString != null) { - generator.writeKey("creation_date_string"); - this.creationDateString.serialize(generator, mapper); - } - if (this.uuid != null) { - generator.writeKey("uuid"); - generator.write(this.uuid); - - } - if (this.version != null) { - generator.writeKey("version"); - this.version.serialize(generator, mapper); - - } - if (this.verifiedBeforeClose != null) { - generator.writeKey("verified_before_close"); - generator.write(this.verifiedBeforeClose); - - } - if (this.format != null) { - generator.writeKey("format"); - generator.write(this.format); - - } - if (this.maxSlicesPerScroll != null) { - generator.writeKey("max_slices_per_scroll"); - generator.write(this.maxSlicesPerScroll); - - } - if (this.translog != null) { - generator.writeKey("translog"); - this.translog.serialize(generator, mapper); - - } - if (this.queryString != null) { - generator.writeKey("query_string"); - this.queryString.serialize(generator, mapper); - - } - if (this.priority != null) { - generator.writeKey("priority"); - generator.write(this.priority); - - } - if (this.topMetricsMaxSize != null) { - generator.writeKey("top_metrics_max_size"); - generator.write(this.topMetricsMaxSize); - - } - if (this.analysis != null) { - generator.writeKey("analysis"); - this.analysis.serialize(generator, mapper); - - } - if (this.settings != null) { - generator.writeKey("settings"); - this.settings.serialize(generator, mapper); - - } - if (this.timeSeries != null) { - generator.writeKey("time_series"); - this.timeSeries.serialize(generator, mapper); - - } - if (this.queries != null) { - generator.writeKey("queries"); - this.queries.serialize(generator, mapper); - - } - if (ApiTypeHelper.isDefined(this.similarity)) { - generator.writeKey("similarity"); - generator.writeStartObject(); - for (Map.Entry item0 : this.similarity.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.mapping != null) { - generator.writeKey("mapping"); - this.mapping.serialize(generator, mapper); - - } - if (this.indexingSlowlog != null) { - generator.writeKey("indexing.slowlog"); - this.indexingSlowlog.serialize(generator, mapper); - - } - if (this.indexingPressure != null) { - generator.writeKey("indexing_pressure"); - this.indexingPressure.serialize(generator, mapper); - - } - if (this.store != null) { - generator.writeKey("store"); - this.store.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexSettings}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private Map otherSettings = new HashMap<>(); - - /** - * 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. - *

- * Adds all entries of map to otherSettings. - */ - public final Builder otherSettings(Map map) { - this.otherSettings = _mapPutAll(this.otherSettings, map); - 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. - *

- * Adds an entry to otherSettings. - */ - public final Builder otherSettings(String key, JsonData value) { - this.otherSettings = _mapPut(this.otherSettings, key, value); - return this; - } - - @Nullable - private IndexSettings index; - - @Nullable - private String mode; - - @Nullable - private List routingPath; - - @Nullable - private SoftDeletes softDeletes; - - @Nullable - private IndexSegmentSort sort; - - @Nullable - private String numberOfShards; - - @Nullable - private String numberOfReplicas; - - @Nullable - private Integer numberOfRoutingShards; - - @Nullable - private IndexCheckOnStartup checkOnStartup; - - @Nullable - private String codec; - - @Nullable - private Integer routingPartitionSize; - - @Nullable - private Boolean loadFixedBitsetFiltersEagerly; - - @Nullable - private Boolean hidden; - - @Nullable - private String autoExpandReplicas; - - @Nullable - private Merge merge; - - @Nullable - private SettingsSearch search; - - @Nullable - private Time refreshInterval; - - @Nullable - private Integer maxResultWindow; - - @Nullable - private Integer maxInnerResultWindow; - - @Nullable - private Integer maxRescoreWindow; - - @Nullable - private Integer maxDocvalueFieldsSearch; - - @Nullable - private Integer maxScriptFields; - - @Nullable - private Integer maxNgramDiff; - - @Nullable - private Integer maxShingleDiff; - - @Nullable - private IndexSettingBlocks blocks; - - @Nullable - private Integer maxRefreshListeners; - - @Nullable - private SettingsAnalyze analyze; - - @Nullable - private SettingsHighlight highlight; - - @Nullable - private Integer maxTermsCount; - - @Nullable - private Integer maxRegexLength; - - @Nullable - private IndexRouting routing; - - @Nullable - private Time gcDeletes; - - @Nullable - private String defaultPipeline; - - @Nullable - private String finalPipeline; - - @Nullable - private IndexSettingsLifecycle lifecycle; - - @Nullable - private String providedName; - - @Nullable - private Long creationDate; - - @Nullable - private DateTime creationDateString; - - @Nullable - private String uuid; - - @Nullable - private IndexVersioning version; - - @Nullable - private Boolean verifiedBeforeClose; - - @Nullable - private String format; - - @Nullable - private Integer maxSlicesPerScroll; - - @Nullable - private Translog translog; - - @Nullable - private SettingsQueryString queryString; - - @Nullable - private String priority; - - @Nullable - private Integer topMetricsMaxSize; - - @Nullable - private IndexSettingsAnalysis analysis; - - @Nullable - private IndexSettings settings; - - @Nullable - private IndexSettingsTimeSeries timeSeries; - - @Nullable - private Queries queries; - - @Nullable - private Map similarity; - - @Nullable - private MappingLimitSettings mapping; - - @Nullable - private IndexingSlowlogSettings indexingSlowlog; - - @Nullable - private IndexingPressure indexingPressure; - - @Nullable - private Storage store; - - /** - * API name: {@code index} - */ - public final Builder index(@Nullable IndexSettings value) { - this.index = value; - return this; - } - - /** - * API name: {@code index} - */ - public final Builder index(Function> fn) { - return this.index(fn.apply(new IndexSettings.Builder()).build()); - } - - /** - * API name: {@code mode} - */ - public final Builder mode(@Nullable String value) { - this.mode = value; - return this; - } - - /** - * API name: {@code routing_path} - *

- * Adds all elements of list to routingPath. - */ - public final Builder routingPath(List list) { - this.routingPath = _listAddAll(this.routingPath, list); - return this; - } - - /** - * API name: {@code routing_path} - *

- * Adds one or more values to routingPath. - */ - public final Builder routingPath(String value, String... values) { - this.routingPath = _listAdd(this.routingPath, value, values); - return this; - } - - /** - * API name: {@code soft_deletes} - */ - public final Builder softDeletes(@Nullable SoftDeletes value) { - this.softDeletes = value; - return this; - } - - /** - * API name: {@code soft_deletes} - */ - public final Builder softDeletes(Function> fn) { - return this.softDeletes(fn.apply(new SoftDeletes.Builder()).build()); - } - - /** - * API name: {@code sort} - */ - public final Builder sort(@Nullable IndexSegmentSort value) { - this.sort = value; - return this; - } - - /** - * API name: {@code sort} - */ - public final Builder sort(Function> fn) { - return this.sort(fn.apply(new IndexSegmentSort.Builder()).build()); - } - - /** - * API name: {@code number_of_shards} - */ - public final Builder numberOfShards(@Nullable String value) { - this.numberOfShards = value; - return this; - } - - /** - * API name: {@code number_of_replicas} - */ - public final Builder numberOfReplicas(@Nullable String value) { - this.numberOfReplicas = value; - return this; - } - - /** - * API name: {@code number_of_routing_shards} - */ - public final Builder numberOfRoutingShards(@Nullable Integer value) { - this.numberOfRoutingShards = value; - return this; - } - - /** - * API name: {@code check_on_startup} - */ - public final Builder checkOnStartup(@Nullable IndexCheckOnStartup value) { - this.checkOnStartup = value; - return this; - } - - /** - * API name: {@code codec} - */ - public final Builder codec(@Nullable String value) { - this.codec = value; - return this; - } - - /** - * API name: {@code routing_partition_size} - */ - public final Builder routingPartitionSize(@Nullable Integer value) { - this.routingPartitionSize = value; - return this; - } - - /** - * API name: {@code load_fixed_bitset_filters_eagerly} - */ - public final Builder loadFixedBitsetFiltersEagerly(@Nullable Boolean value) { - this.loadFixedBitsetFiltersEagerly = value; - return this; - } - - /** - * API name: {@code hidden} - */ - public final Builder hidden(@Nullable Boolean value) { - this.hidden = value; - return this; - } - - /** - * API name: {@code auto_expand_replicas} - */ - public final Builder autoExpandReplicas(@Nullable String value) { - this.autoExpandReplicas = value; - return this; - } - - /** - * API name: {@code merge} - */ - public final Builder merge(@Nullable Merge value) { - this.merge = value; - return this; - } - - /** - * API name: {@code merge} - */ - public final Builder merge(Function> fn) { - return this.merge(fn.apply(new Merge.Builder()).build()); - } - - /** - * API name: {@code search} - */ - public final Builder search(@Nullable SettingsSearch value) { - this.search = value; - return this; - } - - /** - * API name: {@code search} - */ - public final Builder search(Function> fn) { - return this.search(fn.apply(new SettingsSearch.Builder()).build()); - } - - /** - * API name: {@code refresh_interval} - */ - public final Builder refreshInterval(@Nullable Time value) { - this.refreshInterval = value; - return this; - } - - /** - * API name: {@code refresh_interval} - */ - public final Builder refreshInterval(Function> fn) { - return this.refreshInterval(fn.apply(new Time.Builder()).build()); - } - - /** - * API name: {@code max_result_window} - */ - public final Builder maxResultWindow(@Nullable Integer value) { - this.maxResultWindow = value; - return this; - } - - /** - * API name: {@code max_inner_result_window} - */ - public final Builder maxInnerResultWindow(@Nullable Integer value) { - this.maxInnerResultWindow = value; - return this; - } - - /** - * API name: {@code max_rescore_window} - */ - public final Builder maxRescoreWindow(@Nullable Integer value) { - this.maxRescoreWindow = value; - return this; - } - - /** - * API name: {@code max_docvalue_fields_search} - */ - public final Builder maxDocvalueFieldsSearch(@Nullable Integer value) { - this.maxDocvalueFieldsSearch = value; - return this; - } - - /** - * API name: {@code max_script_fields} - */ - public final Builder maxScriptFields(@Nullable Integer value) { - this.maxScriptFields = value; - return this; - } - - /** - * API name: {@code max_ngram_diff} - */ - public final Builder maxNgramDiff(@Nullable Integer value) { - this.maxNgramDiff = value; - return this; - } - - /** - * API name: {@code max_shingle_diff} - */ - public final Builder maxShingleDiff(@Nullable Integer value) { - this.maxShingleDiff = value; - return this; - } - - /** - * API name: {@code blocks} - */ - public final Builder blocks(@Nullable IndexSettingBlocks value) { - this.blocks = value; - return this; - } - - /** - * API name: {@code blocks} - */ - public final Builder blocks(Function> fn) { - return this.blocks(fn.apply(new IndexSettingBlocks.Builder()).build()); - } - - /** - * API name: {@code max_refresh_listeners} - */ - public final Builder maxRefreshListeners(@Nullable Integer value) { - this.maxRefreshListeners = value; - return this; - } - - /** - * Settings to define analyzers, tokenizers, token filters and character - * filters. - *

- * API name: {@code analyze} - */ - public final Builder analyze(@Nullable SettingsAnalyze value) { - this.analyze = value; - return this; - } - - /** - * Settings to define analyzers, tokenizers, token filters and character - * filters. - *

- * API name: {@code analyze} - */ - public final Builder analyze(Function> fn) { - return this.analyze(fn.apply(new SettingsAnalyze.Builder()).build()); - } - - /** - * API name: {@code highlight} - */ - public final Builder highlight(@Nullable SettingsHighlight value) { - this.highlight = value; - return this; - } - - /** - * API name: {@code highlight} - */ - public final Builder highlight(Function> fn) { - return this.highlight(fn.apply(new SettingsHighlight.Builder()).build()); - } - - /** - * API name: {@code max_terms_count} - */ - public final Builder maxTermsCount(@Nullable Integer value) { - this.maxTermsCount = value; - return this; - } - - /** - * API name: {@code max_regex_length} - */ - public final Builder maxRegexLength(@Nullable Integer value) { - this.maxRegexLength = value; - return this; - } - - /** - * API name: {@code routing} - */ - public final Builder routing(@Nullable IndexRouting value) { - this.routing = value; - return this; - } - - /** - * API name: {@code routing} - */ - public final Builder routing(Function> fn) { - return this.routing(fn.apply(new IndexRouting.Builder()).build()); - } - - /** - * API name: {@code gc_deletes} - */ - public final Builder gcDeletes(@Nullable Time value) { - this.gcDeletes = value; - return this; - } - - /** - * API name: {@code gc_deletes} - */ - public final Builder gcDeletes(Function> fn) { - return this.gcDeletes(fn.apply(new Time.Builder()).build()); - } - - /** - * API name: {@code default_pipeline} - */ - public final Builder defaultPipeline(@Nullable String value) { - this.defaultPipeline = value; - return this; - } - - /** - * API name: {@code final_pipeline} - */ - public final Builder finalPipeline(@Nullable String value) { - this.finalPipeline = value; - return this; - } - - /** - * API name: {@code lifecycle} - */ - public final Builder lifecycle(@Nullable IndexSettingsLifecycle value) { - this.lifecycle = value; - return this; - } - - /** - * API name: {@code lifecycle} - */ - public final Builder lifecycle( - Function> fn) { - return this.lifecycle(fn.apply(new IndexSettingsLifecycle.Builder()).build()); - } - - /** - * API name: {@code provided_name} - */ - public final Builder providedName(@Nullable String value) { - this.providedName = value; - return this; - } - - /** - * API name: {@code creation_date} - */ - public final Builder creationDate(@Nullable Long value) { - this.creationDate = value; - return this; - } - - /** - * API name: {@code creation_date_string} - */ - public final Builder creationDateString(@Nullable DateTime value) { - this.creationDateString = value; - return this; - } - - /** - * API name: {@code uuid} - */ - public final Builder uuid(@Nullable String value) { - this.uuid = value; - return this; - } - - /** - * API name: {@code version} - */ - public final Builder version(@Nullable IndexVersioning value) { - this.version = value; - return this; - } - - /** - * API name: {@code version} - */ - public final Builder version(Function> fn) { - return this.version(fn.apply(new IndexVersioning.Builder()).build()); - } - - /** - * API name: {@code verified_before_close} - */ - public final Builder verifiedBeforeClose(@Nullable Boolean value) { - this.verifiedBeforeClose = value; - return this; - } - - /** - * API name: {@code format} - */ - public final Builder format(@Nullable String value) { - this.format = value; - return this; - } - - /** - * API name: {@code max_slices_per_scroll} - */ - public final Builder maxSlicesPerScroll(@Nullable Integer value) { - this.maxSlicesPerScroll = value; - return this; - } - - /** - * API name: {@code translog} - */ - public final Builder translog(@Nullable Translog value) { - this.translog = value; - return this; - } - - /** - * API name: {@code translog} - */ - public final Builder translog(Function> fn) { - return this.translog(fn.apply(new Translog.Builder()).build()); - } - - /** - * API name: {@code query_string} - */ - public final Builder queryString(@Nullable SettingsQueryString value) { - this.queryString = value; - return this; - } - - /** - * API name: {@code query_string} - */ - public final Builder queryString(Function> fn) { - return this.queryString(fn.apply(new SettingsQueryString.Builder()).build()); - } - - /** - * API name: {@code priority} - */ - public final Builder priority(@Nullable String value) { - this.priority = value; - return this; - } - - /** - * API name: {@code top_metrics_max_size} - */ - public final Builder topMetricsMaxSize(@Nullable Integer value) { - this.topMetricsMaxSize = value; - return this; - } - - /** - * API name: {@code analysis} - */ - public final Builder analysis(@Nullable IndexSettingsAnalysis value) { - this.analysis = value; - return this; - } - - /** - * API name: {@code analysis} - */ - public final Builder analysis( - Function> fn) { - return this.analysis(fn.apply(new IndexSettingsAnalysis.Builder()).build()); - } - - /** - * API name: {@code settings} - */ - public final Builder settings(@Nullable IndexSettings value) { - this.settings = value; - return this; - } - - /** - * API name: {@code settings} - */ - public final Builder settings(Function> fn) { - return this.settings(fn.apply(new IndexSettings.Builder()).build()); - } - - /** - * API name: {@code time_series} - */ - public final Builder timeSeries(@Nullable IndexSettingsTimeSeries value) { - this.timeSeries = value; - return this; - } - - /** - * API name: {@code time_series} - */ - public final Builder timeSeries( - Function> fn) { - return this.timeSeries(fn.apply(new IndexSettingsTimeSeries.Builder()).build()); - } - - /** - * API name: {@code queries} - */ - public final Builder queries(@Nullable Queries value) { - this.queries = value; - return this; - } - - /** - * API name: {@code queries} - */ - public final Builder queries(Function> fn) { - return this.queries(fn.apply(new Queries.Builder()).build()); - } - - /** - * Configure custom similarity settings to customize how search results are - * scored. - *

- * API name: {@code similarity} - *

- * Adds all entries of map to similarity. - */ - public final Builder similarity(Map map) { - this.similarity = _mapPutAll(this.similarity, map); - return this; - } - - /** - * Configure custom similarity settings to customize how search results are - * scored. - *

- * API name: {@code similarity} - *

- * Adds an entry to similarity. - */ - public final Builder similarity(String key, SettingsSimilarity value) { - this.similarity = _mapPut(this.similarity, key, value); - return this; - } - - /** - * Configure custom similarity settings to customize how search results are - * scored. - *

- * API name: {@code similarity} - *

- * Adds an entry to similarity using a builder lambda. - */ - public final Builder similarity(String key, - Function> fn) { - return similarity(key, fn.apply(new SettingsSimilarity.Builder()).build()); - } - - /** - * Enable or disable dynamic mapping for an index. - *

- * API name: {@code mapping} - */ - public final Builder mapping(@Nullable MappingLimitSettings value) { - this.mapping = value; - return this; - } - - /** - * Enable or disable dynamic mapping for an index. - *

- * API name: {@code mapping} - */ - public final Builder mapping(Function> fn) { - return this.mapping(fn.apply(new MappingLimitSettings.Builder()).build()); - } - - /** - * API name: {@code indexing.slowlog} - */ - public final Builder indexingSlowlog(@Nullable IndexingSlowlogSettings value) { - this.indexingSlowlog = value; - return this; - } - - /** - * API name: {@code indexing.slowlog} - */ - public final Builder indexingSlowlog( - Function> fn) { - return this.indexingSlowlog(fn.apply(new IndexingSlowlogSettings.Builder()).build()); - } - - /** - * Configure indexing back pressure limits. - *

- * API name: {@code indexing_pressure} - */ - public final Builder indexingPressure(@Nullable IndexingPressure value) { - this.indexingPressure = value; - return this; - } - - /** - * Configure indexing back pressure limits. - *

- * API name: {@code indexing_pressure} - */ - public final Builder indexingPressure(Function> fn) { - return this.indexingPressure(fn.apply(new IndexingPressure.Builder()).build()); - } - - /** - * The store module allows you to control how index data is stored and accessed - * on disk. - *

- * API name: {@code store} - */ - public final Builder store(@Nullable Storage value) { - this.store = value; - return this; - } - - /** - * The store module allows you to control how index data is stored and accessed - * on disk. - *

- * API name: {@code store} - */ - public final Builder store(Function> fn) { - return this.store(fn.apply(new Storage.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexSettings}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexSettings build() { - _checkSingleUse(); - - return new IndexSettings(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexSettings} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - IndexSettings::setupIndexSettingsDeserializer); - - protected static void setupIndexSettingsDeserializer(ObjectDeserializer op) { - - op.add(Builder::index, IndexSettings._DESERIALIZER, "index"); - op.add(Builder::mode, JsonpDeserializer.stringDeserializer(), "mode"); - op.add(Builder::routingPath, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "routing_path"); - op.add(Builder::softDeletes, SoftDeletes._DESERIALIZER, "soft_deletes"); - op.add(Builder::sort, IndexSegmentSort._DESERIALIZER, "sort"); - op.add(Builder::numberOfShards, JsonpDeserializer.stringDeserializer(), "number_of_shards"); - op.add(Builder::numberOfReplicas, JsonpDeserializer.stringDeserializer(), "number_of_replicas"); - op.add(Builder::numberOfRoutingShards, JsonpDeserializer.integerDeserializer(), "number_of_routing_shards"); - op.add(Builder::checkOnStartup, IndexCheckOnStartup._DESERIALIZER, "check_on_startup"); - op.add(Builder::codec, JsonpDeserializer.stringDeserializer(), "codec"); - op.add(Builder::routingPartitionSize, JsonpDeserializer.integerDeserializer(), "routing_partition_size"); - op.add(Builder::loadFixedBitsetFiltersEagerly, JsonpDeserializer.booleanDeserializer(), - "load_fixed_bitset_filters_eagerly"); - op.add(Builder::hidden, JsonpDeserializer.booleanDeserializer(), "hidden"); - op.add(Builder::autoExpandReplicas, JsonpDeserializer.stringDeserializer(), "auto_expand_replicas"); - op.add(Builder::merge, Merge._DESERIALIZER, "merge"); - op.add(Builder::search, SettingsSearch._DESERIALIZER, "search"); - op.add(Builder::refreshInterval, Time._DESERIALIZER, "refresh_interval"); - op.add(Builder::maxResultWindow, JsonpDeserializer.integerDeserializer(), "max_result_window"); - op.add(Builder::maxInnerResultWindow, JsonpDeserializer.integerDeserializer(), "max_inner_result_window"); - op.add(Builder::maxRescoreWindow, JsonpDeserializer.integerDeserializer(), "max_rescore_window"); - op.add(Builder::maxDocvalueFieldsSearch, JsonpDeserializer.integerDeserializer(), "max_docvalue_fields_search"); - op.add(Builder::maxScriptFields, JsonpDeserializer.integerDeserializer(), "max_script_fields"); - op.add(Builder::maxNgramDiff, JsonpDeserializer.integerDeserializer(), "max_ngram_diff"); - op.add(Builder::maxShingleDiff, JsonpDeserializer.integerDeserializer(), "max_shingle_diff"); - op.add(Builder::blocks, IndexSettingBlocks._DESERIALIZER, "blocks"); - op.add(Builder::maxRefreshListeners, JsonpDeserializer.integerDeserializer(), "max_refresh_listeners"); - op.add(Builder::analyze, SettingsAnalyze._DESERIALIZER, "analyze"); - op.add(Builder::highlight, SettingsHighlight._DESERIALIZER, "highlight"); - op.add(Builder::maxTermsCount, JsonpDeserializer.integerDeserializer(), "max_terms_count"); - op.add(Builder::maxRegexLength, JsonpDeserializer.integerDeserializer(), "max_regex_length"); - op.add(Builder::routing, IndexRouting._DESERIALIZER, "routing"); - op.add(Builder::gcDeletes, Time._DESERIALIZER, "gc_deletes"); - op.add(Builder::defaultPipeline, JsonpDeserializer.stringDeserializer(), "default_pipeline"); - op.add(Builder::finalPipeline, JsonpDeserializer.stringDeserializer(), "final_pipeline"); - op.add(Builder::lifecycle, IndexSettingsLifecycle._DESERIALIZER, "lifecycle"); - op.add(Builder::providedName, JsonpDeserializer.stringDeserializer(), "provided_name"); - op.add(Builder::creationDate, JsonpDeserializer.longDeserializer(), "creation_date"); - op.add(Builder::creationDateString, DateTime._DESERIALIZER, "creation_date_string"); - op.add(Builder::uuid, JsonpDeserializer.stringDeserializer(), "uuid"); - op.add(Builder::version, IndexVersioning._DESERIALIZER, "version"); - op.add(Builder::verifiedBeforeClose, JsonpDeserializer.booleanDeserializer(), "verified_before_close"); - op.add(Builder::format, JsonpDeserializer.stringDeserializer(), "format"); - op.add(Builder::maxSlicesPerScroll, JsonpDeserializer.integerDeserializer(), "max_slices_per_scroll"); - op.add(Builder::translog, Translog._DESERIALIZER, "translog"); - op.add(Builder::queryString, SettingsQueryString._DESERIALIZER, "query_string"); - op.add(Builder::priority, JsonpDeserializer.stringDeserializer(), "priority"); - op.add(Builder::topMetricsMaxSize, JsonpDeserializer.integerDeserializer(), "top_metrics_max_size"); - op.add(Builder::analysis, IndexSettingsAnalysis._DESERIALIZER, "analysis"); - op.add(Builder::settings, IndexSettings._DESERIALIZER, "settings"); - op.add(Builder::timeSeries, IndexSettingsTimeSeries._DESERIALIZER, "time_series"); - op.add(Builder::queries, Queries._DESERIALIZER, "queries"); - op.add(Builder::similarity, JsonpDeserializer.stringMapDeserializer(SettingsSimilarity._DESERIALIZER), - "similarity"); - op.add(Builder::mapping, MappingLimitSettings._DESERIALIZER, "mapping"); - op.add(Builder::indexingSlowlog, IndexingSlowlogSettings._DESERIALIZER, "indexing.slowlog"); - op.add(Builder::indexingPressure, IndexingPressure._DESERIALIZER, "indexing_pressure"); - op.add(Builder::store, Storage._DESERIALIZER, "store"); - - op.setUnknownFieldHandler((builder, name, parser, mapper) -> { - builder.otherSettings(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); - }); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingsAnalysis.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingsAnalysis.java deleted file mode 100644 index c2ff07403..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingsAnalysis.java +++ /dev/null @@ -1,409 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.analysis.Analyzer; -import co.elastic.clients.elasticsearch._types.analysis.CharFilter; -import co.elastic.clients.elasticsearch._types.analysis.Normalizer; -import co.elastic.clients.elasticsearch._types.analysis.TokenFilter; -import co.elastic.clients.elasticsearch._types.analysis.Tokenizer; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.IndexSettingsAnalysis - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexSettingsAnalysis implements JsonpSerializable { - private final Map analyzer; - - private final Map charFilter; - - private final Map filter; - - private final Map normalizer; - - private final Map tokenizer; - - // --------------------------------------------------------------------------------------------- - - private IndexSettingsAnalysis(Builder builder) { - - this.analyzer = ApiTypeHelper.unmodifiable(builder.analyzer); - this.charFilter = ApiTypeHelper.unmodifiable(builder.charFilter); - this.filter = ApiTypeHelper.unmodifiable(builder.filter); - this.normalizer = ApiTypeHelper.unmodifiable(builder.normalizer); - this.tokenizer = ApiTypeHelper.unmodifiable(builder.tokenizer); - - } - - public static IndexSettingsAnalysis of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code analyzer} - */ - public final Map analyzer() { - return this.analyzer; - } - - /** - * API name: {@code char_filter} - */ - public final Map charFilter() { - return this.charFilter; - } - - /** - * API name: {@code filter} - */ - public final Map filter() { - return this.filter; - } - - /** - * API name: {@code normalizer} - */ - public final Map normalizer() { - return this.normalizer; - } - - /** - * API name: {@code tokenizer} - */ - public final Map tokenizer() { - return this.tokenizer; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.analyzer)) { - generator.writeKey("analyzer"); - generator.writeStartObject(); - for (Map.Entry item0 : this.analyzer.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.charFilter)) { - generator.writeKey("char_filter"); - generator.writeStartObject(); - for (Map.Entry item0 : this.charFilter.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.filter)) { - generator.writeKey("filter"); - generator.writeStartObject(); - for (Map.Entry item0 : this.filter.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.normalizer)) { - generator.writeKey("normalizer"); - generator.writeStartObject(); - for (Map.Entry item0 : this.normalizer.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.tokenizer)) { - generator.writeKey("tokenizer"); - generator.writeStartObject(); - for (Map.Entry item0 : this.tokenizer.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexSettingsAnalysis}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Map analyzer; - - @Nullable - private Map charFilter; - - @Nullable - private Map filter; - - @Nullable - private Map normalizer; - - @Nullable - private Map tokenizer; - - /** - * API name: {@code analyzer} - *

- * Adds all entries of map to analyzer. - */ - public final Builder analyzer(Map map) { - this.analyzer = _mapPutAll(this.analyzer, map); - return this; - } - - /** - * API name: {@code analyzer} - *

- * Adds an entry to analyzer. - */ - public final Builder analyzer(String key, Analyzer value) { - this.analyzer = _mapPut(this.analyzer, key, value); - return this; - } - - /** - * API name: {@code analyzer} - *

- * Adds an entry to analyzer using a builder lambda. - */ - public final Builder analyzer(String key, Function> fn) { - return analyzer(key, fn.apply(new Analyzer.Builder()).build()); - } - - /** - * API name: {@code char_filter} - *

- * Adds all entries of map to charFilter. - */ - public final Builder charFilter(Map map) { - this.charFilter = _mapPutAll(this.charFilter, map); - return this; - } - - /** - * API name: {@code char_filter} - *

- * Adds an entry to charFilter. - */ - public final Builder charFilter(String key, CharFilter value) { - this.charFilter = _mapPut(this.charFilter, key, value); - return this; - } - - /** - * API name: {@code char_filter} - *

- * Adds an entry to charFilter using a builder lambda. - */ - public final Builder charFilter(String key, Function> fn) { - return charFilter(key, fn.apply(new CharFilter.Builder()).build()); - } - - /** - * API name: {@code filter} - *

- * Adds all entries of map to filter. - */ - public final Builder filter(Map map) { - this.filter = _mapPutAll(this.filter, map); - return this; - } - - /** - * API name: {@code filter} - *

- * Adds an entry to filter. - */ - public final Builder filter(String key, TokenFilter value) { - this.filter = _mapPut(this.filter, key, value); - return this; - } - - /** - * API name: {@code filter} - *

- * Adds an entry to filter using a builder lambda. - */ - public final Builder filter(String key, Function> fn) { - return filter(key, fn.apply(new TokenFilter.Builder()).build()); - } - - /** - * API name: {@code normalizer} - *

- * Adds all entries of map to normalizer. - */ - public final Builder normalizer(Map map) { - this.normalizer = _mapPutAll(this.normalizer, map); - return this; - } - - /** - * API name: {@code normalizer} - *

- * Adds an entry to normalizer. - */ - public final Builder normalizer(String key, Normalizer value) { - this.normalizer = _mapPut(this.normalizer, key, value); - return this; - } - - /** - * API name: {@code normalizer} - *

- * Adds an entry to normalizer using a builder lambda. - */ - public final Builder normalizer(String key, Function> fn) { - return normalizer(key, fn.apply(new Normalizer.Builder()).build()); - } - - /** - * API name: {@code tokenizer} - *

- * Adds all entries of map to tokenizer. - */ - public final Builder tokenizer(Map map) { - this.tokenizer = _mapPutAll(this.tokenizer, map); - return this; - } - - /** - * API name: {@code tokenizer} - *

- * Adds an entry to tokenizer. - */ - public final Builder tokenizer(String key, Tokenizer value) { - this.tokenizer = _mapPut(this.tokenizer, key, value); - return this; - } - - /** - * API name: {@code tokenizer} - *

- * Adds an entry to tokenizer using a builder lambda. - */ - public final Builder tokenizer(String key, Function> fn) { - return tokenizer(key, fn.apply(new Tokenizer.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexSettingsAnalysis}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexSettingsAnalysis build() { - _checkSingleUse(); - - return new IndexSettingsAnalysis(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexSettingsAnalysis} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, IndexSettingsAnalysis::setupIndexSettingsAnalysisDeserializer); - - protected static void setupIndexSettingsAnalysisDeserializer(ObjectDeserializer op) { - - op.add(Builder::analyzer, JsonpDeserializer.stringMapDeserializer(Analyzer._DESERIALIZER), "analyzer"); - op.add(Builder::charFilter, JsonpDeserializer.stringMapDeserializer(CharFilter._DESERIALIZER), "char_filter"); - op.add(Builder::filter, JsonpDeserializer.stringMapDeserializer(TokenFilter._DESERIALIZER), "filter"); - op.add(Builder::normalizer, JsonpDeserializer.stringMapDeserializer(Normalizer._DESERIALIZER), "normalizer"); - op.add(Builder::tokenizer, JsonpDeserializer.stringMapDeserializer(Tokenizer._DESERIALIZER), "tokenizer"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingsLifecycle.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingsLifecycle.java deleted file mode 100644 index 045ac9807..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingsLifecycle.java +++ /dev/null @@ -1,367 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Long; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.IndexSettingsLifecycle - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexSettingsLifecycle implements JsonpSerializable { - @Nullable - private final String name; - - @Nullable - private final Boolean indexingComplete; - - @Nullable - private final Long originationDate; - - @Nullable - private final Boolean parseOriginationDate; - - @Nullable - private final IndexSettingsLifecycleStep step; - - @Nullable - private final String rolloverAlias; - - // --------------------------------------------------------------------------------------------- - - private IndexSettingsLifecycle(Builder builder) { - - this.name = builder.name; - this.indexingComplete = builder.indexingComplete; - this.originationDate = builder.originationDate; - this.parseOriginationDate = builder.parseOriginationDate; - this.step = builder.step; - this.rolloverAlias = builder.rolloverAlias; - - } - - public static IndexSettingsLifecycle of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * The name of the policy to use to manage the index. For information about how - * Elasticsearch applies policy changes, see Policy updates. - *

- * API name: {@code name} - */ - @Nullable - public final String name() { - return this.name; - } - - /** - * 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. - *

- * API name: {@code indexing_complete} - */ - @Nullable - public final Boolean indexingComplete() { - return this.indexingComplete; - } - - /** - * If specified, this is the timestamp used to calculate the index age for its - * phase transitions. Use this setting if you create a new index that contains - * old data and want to use the original creation date to calculate the index - * age. Specified as a Unix epoch value in milliseconds. - *

- * API name: {@code origination_date} - */ - @Nullable - public final Long originationDate() { - return this.originationDate; - } - - /** - * Set to true to parse the origination date from the index name. This - * origination date is used to calculate the index age for its phase - * transitions. The index name must match the pattern ^.*-{date_format}-\d+, - * where the date_format is yyyy.MM.dd and the trailing digits are optional. An - * index that was rolled over would normally match the full format, for example - * logs-2016.10.31-000002). If the index name doesn’t match the pattern, index - * creation fails. - *

- * API name: {@code parse_origination_date} - */ - @Nullable - public final Boolean parseOriginationDate() { - return this.parseOriginationDate; - } - - /** - * API name: {@code step} - */ - @Nullable - public final IndexSettingsLifecycleStep step() { - return this.step; - } - - /** - * The index alias to update when the index rolls over. Specify when using a - * policy that contains a rollover action. When the index rolls over, the alias - * is updated to reflect that the index is no longer the write index. For more - * information about rolling indices, see Rollover. - *

- * API name: {@code rollover_alias} - */ - @Nullable - public final String rolloverAlias() { - return this.rolloverAlias; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.name != null) { - generator.writeKey("name"); - generator.write(this.name); - - } - if (this.indexingComplete != null) { - generator.writeKey("indexing_complete"); - generator.write(this.indexingComplete); - - } - if (this.originationDate != null) { - generator.writeKey("origination_date"); - generator.write(this.originationDate); - - } - if (this.parseOriginationDate != null) { - generator.writeKey("parse_origination_date"); - generator.write(this.parseOriginationDate); - - } - if (this.step != null) { - generator.writeKey("step"); - this.step.serialize(generator, mapper); - - } - if (this.rolloverAlias != null) { - generator.writeKey("rollover_alias"); - generator.write(this.rolloverAlias); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexSettingsLifecycle}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private String name; - - @Nullable - private Boolean indexingComplete; - - @Nullable - private Long originationDate; - - @Nullable - private Boolean parseOriginationDate; - - @Nullable - private IndexSettingsLifecycleStep step; - - @Nullable - private String rolloverAlias; - - /** - * The name of the policy to use to manage the index. For information about how - * Elasticsearch applies policy changes, see Policy updates. - *

- * API name: {@code name} - */ - public final Builder name(@Nullable String value) { - this.name = value; - return this; - } - - /** - * 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. - *

- * API name: {@code indexing_complete} - */ - public final Builder indexingComplete(@Nullable Boolean value) { - this.indexingComplete = value; - return this; - } - - /** - * If specified, this is the timestamp used to calculate the index age for its - * phase transitions. Use this setting if you create a new index that contains - * old data and want to use the original creation date to calculate the index - * age. Specified as a Unix epoch value in milliseconds. - *

- * API name: {@code origination_date} - */ - public final Builder originationDate(@Nullable Long value) { - this.originationDate = value; - return this; - } - - /** - * Set to true to parse the origination date from the index name. This - * origination date is used to calculate the index age for its phase - * transitions. The index name must match the pattern ^.*-{date_format}-\d+, - * where the date_format is yyyy.MM.dd and the trailing digits are optional. An - * index that was rolled over would normally match the full format, for example - * logs-2016.10.31-000002). If the index name doesn’t match the pattern, index - * creation fails. - *

- * API name: {@code parse_origination_date} - */ - public final Builder parseOriginationDate(@Nullable Boolean value) { - this.parseOriginationDate = value; - return this; - } - - /** - * API name: {@code step} - */ - public final Builder step(@Nullable IndexSettingsLifecycleStep value) { - this.step = value; - return this; - } - - /** - * API name: {@code step} - */ - public final Builder step( - Function> fn) { - return this.step(fn.apply(new IndexSettingsLifecycleStep.Builder()).build()); - } - - /** - * The index alias to update when the index rolls over. Specify when using a - * policy that contains a rollover action. When the index rolls over, the alias - * is updated to reflect that the index is no longer the write index. For more - * information about rolling indices, see Rollover. - *

- * API name: {@code rollover_alias} - */ - public final Builder rolloverAlias(@Nullable String value) { - this.rolloverAlias = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexSettingsLifecycle}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexSettingsLifecycle build() { - _checkSingleUse(); - - return new IndexSettingsLifecycle(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexSettingsLifecycle} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, IndexSettingsLifecycle::setupIndexSettingsLifecycleDeserializer); - - protected static void setupIndexSettingsLifecycleDeserializer( - ObjectDeserializer op) { - - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::indexingComplete, JsonpDeserializer.booleanDeserializer(), "indexing_complete"); - op.add(Builder::originationDate, JsonpDeserializer.longDeserializer(), "origination_date"); - op.add(Builder::parseOriginationDate, JsonpDeserializer.booleanDeserializer(), "parse_origination_date"); - op.add(Builder::step, IndexSettingsLifecycleStep._DESERIALIZER, "step"); - op.add(Builder::rolloverAlias, JsonpDeserializer.stringDeserializer(), "rollover_alias"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingsLifecycleStep.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingsLifecycleStep.java deleted file mode 100644 index d48d7e19d..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingsLifecycleStep.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.IndexSettingsLifecycleStep - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexSettingsLifecycleStep implements JsonpSerializable { - @Nullable - private final Time waitTimeThreshold; - - // --------------------------------------------------------------------------------------------- - - private IndexSettingsLifecycleStep(Builder builder) { - - this.waitTimeThreshold = builder.waitTimeThreshold; - - } - - public static IndexSettingsLifecycleStep of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code wait_time_threshold} - */ - @Nullable - public final Time waitTimeThreshold() { - return this.waitTimeThreshold; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.waitTimeThreshold != null) { - generator.writeKey("wait_time_threshold"); - this.waitTimeThreshold.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexSettingsLifecycleStep}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Time waitTimeThreshold; - - /** - * 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. - *

- * API name: {@code wait_time_threshold} - */ - public final Builder waitTimeThreshold(@Nullable Time value) { - this.waitTimeThreshold = value; - return this; - } - - /** - * 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. - *

- * API name: {@code wait_time_threshold} - */ - public final Builder waitTimeThreshold(Function> fn) { - return this.waitTimeThreshold(fn.apply(new Time.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexSettingsLifecycleStep}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexSettingsLifecycleStep build() { - _checkSingleUse(); - - return new IndexSettingsLifecycleStep(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexSettingsLifecycleStep} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, IndexSettingsLifecycleStep::setupIndexSettingsLifecycleStepDeserializer); - - protected static void setupIndexSettingsLifecycleStepDeserializer( - ObjectDeserializer op) { - - op.add(Builder::waitTimeThreshold, Time._DESERIALIZER, "wait_time_threshold"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingsTimeSeries.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingsTimeSeries.java deleted file mode 100644 index 85d2288cf..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingsTimeSeries.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.DateTime; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.IndexSettingsTimeSeries - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexSettingsTimeSeries implements JsonpSerializable { - @Nullable - private final DateTime endTime; - - @Nullable - private final DateTime startTime; - - // --------------------------------------------------------------------------------------------- - - private IndexSettingsTimeSeries(Builder builder) { - - this.endTime = builder.endTime; - this.startTime = builder.startTime; - - } - - public static IndexSettingsTimeSeries of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code end_time} - */ - @Nullable - public final DateTime endTime() { - return this.endTime; - } - - /** - * API name: {@code start_time} - */ - @Nullable - public final DateTime startTime() { - return this.startTime; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.endTime != null) { - generator.writeKey("end_time"); - this.endTime.serialize(generator, mapper); - } - if (this.startTime != null) { - generator.writeKey("start_time"); - this.startTime.serialize(generator, mapper); - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexSettingsTimeSeries}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private DateTime endTime; - - @Nullable - private DateTime startTime; - - /** - * API name: {@code end_time} - */ - public final Builder endTime(@Nullable DateTime value) { - this.endTime = value; - return this; - } - - /** - * API name: {@code start_time} - */ - public final Builder startTime(@Nullable DateTime value) { - this.startTime = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexSettingsTimeSeries}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexSettingsTimeSeries build() { - _checkSingleUse(); - - return new IndexSettingsTimeSeries(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexSettingsTimeSeries} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, IndexSettingsTimeSeries::setupIndexSettingsTimeSeriesDeserializer); - - protected static void setupIndexSettingsTimeSeriesDeserializer( - ObjectDeserializer op) { - - op.add(Builder::endTime, DateTime._DESERIALIZER, "end_time"); - op.add(Builder::startTime, DateTime._DESERIALIZER, "start_time"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexState.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexState.java deleted file mode 100644 index b787c554a..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexState.java +++ /dev/null @@ -1,374 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.mapping.TypeMapping; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.IndexState - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexState implements JsonpSerializable { - private final Map aliases; - - @Nullable - private final TypeMapping mappings; - - @Nullable - private final IndexSettings settings; - - @Nullable - private final IndexSettings defaults; - - @Nullable - private final String dataStream; - - @Nullable - private final DataStreamLifecycle lifecycle; - - // --------------------------------------------------------------------------------------------- - - private IndexState(Builder builder) { - - this.aliases = ApiTypeHelper.unmodifiable(builder.aliases); - this.mappings = builder.mappings; - this.settings = builder.settings; - this.defaults = builder.defaults; - this.dataStream = builder.dataStream; - this.lifecycle = builder.lifecycle; - - } - - public static IndexState of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code aliases} - */ - public final Map aliases() { - return this.aliases; - } - - /** - * API name: {@code mappings} - */ - @Nullable - public final TypeMapping mappings() { - return this.mappings; - } - - /** - * API name: {@code settings} - */ - @Nullable - public final IndexSettings settings() { - return this.settings; - } - - /** - * Default settings, included when the request's include_default is - * true. - *

- * API name: {@code defaults} - */ - @Nullable - public final IndexSettings defaults() { - return this.defaults; - } - - /** - * API name: {@code data_stream} - */ - @Nullable - public final String dataStream() { - return this.dataStream; - } - - /** - * Data stream lifecycle applicable if this is a data stream. - *

- * API name: {@code lifecycle} - */ - @Nullable - public final DataStreamLifecycle lifecycle() { - return this.lifecycle; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.aliases)) { - generator.writeKey("aliases"); - generator.writeStartObject(); - for (Map.Entry item0 : this.aliases.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.mappings != null) { - generator.writeKey("mappings"); - this.mappings.serialize(generator, mapper); - - } - if (this.settings != null) { - generator.writeKey("settings"); - this.settings.serialize(generator, mapper); - - } - if (this.defaults != null) { - generator.writeKey("defaults"); - this.defaults.serialize(generator, mapper); - - } - if (this.dataStream != null) { - generator.writeKey("data_stream"); - generator.write(this.dataStream); - - } - if (this.lifecycle != null) { - generator.writeKey("lifecycle"); - this.lifecycle.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexState}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private Map aliases; - - @Nullable - private TypeMapping mappings; - - @Nullable - private IndexSettings settings; - - @Nullable - private IndexSettings defaults; - - @Nullable - private String dataStream; - - @Nullable - private DataStreamLifecycle lifecycle; - - /** - * API name: {@code aliases} - *

- * Adds all entries of map to aliases. - */ - public final Builder aliases(Map map) { - this.aliases = _mapPutAll(this.aliases, map); - return this; - } - - /** - * API name: {@code aliases} - *

- * Adds an entry to aliases. - */ - public final Builder aliases(String key, Alias value) { - this.aliases = _mapPut(this.aliases, key, value); - return this; - } - - /** - * API name: {@code aliases} - *

- * Adds an entry to aliases using a builder lambda. - */ - public final Builder aliases(String key, Function> fn) { - return aliases(key, fn.apply(new Alias.Builder()).build()); - } - - /** - * API name: {@code mappings} - */ - public final Builder mappings(@Nullable TypeMapping value) { - this.mappings = value; - return this; - } - - /** - * API name: {@code mappings} - */ - public final Builder mappings(Function> fn) { - return this.mappings(fn.apply(new TypeMapping.Builder()).build()); - } - - /** - * API name: {@code settings} - */ - public final Builder settings(@Nullable IndexSettings value) { - this.settings = value; - return this; - } - - /** - * API name: {@code settings} - */ - public final Builder settings(Function> fn) { - return this.settings(fn.apply(new IndexSettings.Builder()).build()); - } - - /** - * Default settings, included when the request's include_default is - * true. - *

- * API name: {@code defaults} - */ - public final Builder defaults(@Nullable IndexSettings value) { - this.defaults = value; - return this; - } - - /** - * Default settings, included when the request's include_default is - * true. - *

- * API name: {@code defaults} - */ - public final Builder defaults(Function> fn) { - return this.defaults(fn.apply(new IndexSettings.Builder()).build()); - } - - /** - * API name: {@code data_stream} - */ - public final Builder dataStream(@Nullable String value) { - this.dataStream = value; - return this; - } - - /** - * Data stream lifecycle applicable if this is a data stream. - *

- * API name: {@code lifecycle} - */ - public final Builder lifecycle(@Nullable DataStreamLifecycle value) { - this.lifecycle = value; - return this; - } - - /** - * Data stream lifecycle applicable if this is a data stream. - *

- * API name: {@code lifecycle} - */ - public final Builder lifecycle(Function> fn) { - return this.lifecycle(fn.apply(new DataStreamLifecycle.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexState}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexState build() { - _checkSingleUse(); - - return new IndexState(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexState} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - IndexState::setupIndexStateDeserializer); - - protected static void setupIndexStateDeserializer(ObjectDeserializer op) { - - op.add(Builder::aliases, JsonpDeserializer.stringMapDeserializer(Alias._DESERIALIZER), "aliases"); - op.add(Builder::mappings, TypeMapping._DESERIALIZER, "mappings"); - op.add(Builder::settings, IndexSettings._DESERIALIZER, "settings"); - op.add(Builder::defaults, IndexSettings._DESERIALIZER, "defaults"); - op.add(Builder::dataStream, JsonpDeserializer.stringDeserializer(), "data_stream"); - op.add(Builder::lifecycle, DataStreamLifecycle._DESERIALIZER, "lifecycle"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplate.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplate.java deleted file mode 100644 index 638061f29..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplate.java +++ /dev/null @@ -1,494 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonData; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Long; -import java.lang.String; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.IndexTemplate - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexTemplate implements JsonpSerializable { - private final List indexPatterns; - - private final List composedOf; - - @Nullable - private final IndexTemplateSummary template; - - @Nullable - private final Long version; - - @Nullable - private final Long priority; - - private final Map meta; - - @Nullable - private final Boolean allowAutoCreate; - - @Nullable - private final IndexTemplateDataStreamConfiguration dataStream; - - // --------------------------------------------------------------------------------------------- - - private IndexTemplate(Builder builder) { - - this.indexPatterns = ApiTypeHelper.unmodifiableRequired(builder.indexPatterns, this, "indexPatterns"); - this.composedOf = ApiTypeHelper.unmodifiableRequired(builder.composedOf, this, "composedOf"); - this.template = builder.template; - this.version = builder.version; - this.priority = builder.priority; - this.meta = ApiTypeHelper.unmodifiable(builder.meta); - this.allowAutoCreate = builder.allowAutoCreate; - this.dataStream = builder.dataStream; - - } - - public static IndexTemplate of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Name of the index template. - *

- * API name: {@code index_patterns} - */ - public final List indexPatterns() { - return this.indexPatterns; - } - - /** - * Required - 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. - *

- * API name: {@code composed_of} - */ - public final List composedOf() { - return this.composedOf; - } - - /** - * Template to be applied. It may optionally include an aliases, - * mappings, or settings configuration. - *

- * API name: {@code template} - */ - @Nullable - public final IndexTemplateSummary template() { - return this.template; - } - - /** - * Version number used to manage index templates externally. This number is not - * automatically generated by Elasticsearch. - *

- * API name: {@code version} - */ - @Nullable - public final Long version() { - return this.version; - } - - /** - * Priority to determine index template precedence when a new data stream or - * index is created. The index template with the highest priority is chosen. If - * no priority is specified the template is treated as though it is of priority - * 0 (lowest priority). This number is not automatically generated by - * Elasticsearch. - *

- * API name: {@code priority} - */ - @Nullable - public final Long priority() { - return this.priority; - } - - /** - * Optional user metadata about the index template. May have any contents. This - * map is not automatically generated by Elasticsearch. - *

- * API name: {@code _meta} - */ - public final Map meta() { - return this.meta; - } - - /** - * API name: {@code allow_auto_create} - */ - @Nullable - public final Boolean allowAutoCreate() { - return this.allowAutoCreate; - } - - /** - * 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. - *

- * API name: {@code data_stream} - */ - @Nullable - public final IndexTemplateDataStreamConfiguration dataStream() { - return this.dataStream; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.indexPatterns)) { - generator.writeKey("index_patterns"); - generator.writeStartArray(); - for (String item0 : this.indexPatterns) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.composedOf)) { - generator.writeKey("composed_of"); - generator.writeStartArray(); - for (String item0 : this.composedOf) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (this.template != null) { - generator.writeKey("template"); - this.template.serialize(generator, mapper); - - } - if (this.version != null) { - generator.writeKey("version"); - generator.write(this.version); - - } - if (this.priority != null) { - generator.writeKey("priority"); - generator.write(this.priority); - - } - if (ApiTypeHelper.isDefined(this.meta)) { - generator.writeKey("_meta"); - generator.writeStartObject(); - for (Map.Entry item0 : this.meta.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.allowAutoCreate != null) { - generator.writeKey("allow_auto_create"); - generator.write(this.allowAutoCreate); - - } - if (this.dataStream != null) { - generator.writeKey("data_stream"); - this.dataStream.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexTemplate}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private List indexPatterns; - - private List composedOf; - - @Nullable - private IndexTemplateSummary template; - - @Nullable - private Long version; - - @Nullable - private Long priority; - - @Nullable - private Map meta; - - @Nullable - private Boolean allowAutoCreate; - - @Nullable - private IndexTemplateDataStreamConfiguration dataStream; - - /** - * Required - Name of the index template. - *

- * API name: {@code index_patterns} - *

- * Adds all elements of list to indexPatterns. - */ - public final Builder indexPatterns(List list) { - this.indexPatterns = _listAddAll(this.indexPatterns, list); - return this; - } - - /** - * Required - Name of the index template. - *

- * API name: {@code index_patterns} - *

- * Adds one or more values to indexPatterns. - */ - public final Builder indexPatterns(String value, String... values) { - this.indexPatterns = _listAdd(this.indexPatterns, value, values); - return this; - } - - /** - * Required - 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. - *

- * API name: {@code composed_of} - *

- * Adds all elements of list to composedOf. - */ - public final Builder composedOf(List list) { - this.composedOf = _listAddAll(this.composedOf, list); - return this; - } - - /** - * Required - 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. - *

- * API name: {@code composed_of} - *

- * Adds one or more values to composedOf. - */ - public final Builder composedOf(String value, String... values) { - this.composedOf = _listAdd(this.composedOf, value, values); - return this; - } - - /** - * Template to be applied. It may optionally include an aliases, - * mappings, or settings configuration. - *

- * API name: {@code template} - */ - public final Builder template(@Nullable IndexTemplateSummary value) { - this.template = value; - return this; - } - - /** - * Template to be applied. It may optionally include an aliases, - * mappings, or settings configuration. - *

- * API name: {@code template} - */ - public final Builder template(Function> fn) { - return this.template(fn.apply(new IndexTemplateSummary.Builder()).build()); - } - - /** - * Version number used to manage index templates externally. This number is not - * automatically generated by Elasticsearch. - *

- * API name: {@code version} - */ - public final Builder version(@Nullable Long value) { - this.version = value; - return this; - } - - /** - * Priority to determine index template precedence when a new data stream or - * index is created. The index template with the highest priority is chosen. If - * no priority is specified the template is treated as though it is of priority - * 0 (lowest priority). This number is not automatically generated by - * Elasticsearch. - *

- * API name: {@code priority} - */ - public final Builder priority(@Nullable Long value) { - this.priority = value; - return this; - } - - /** - * Optional user metadata about the index template. May have any contents. This - * map is not automatically generated by Elasticsearch. - *

- * API name: {@code _meta} - *

- * Adds all entries of map to meta. - */ - public final Builder meta(Map map) { - this.meta = _mapPutAll(this.meta, map); - return this; - } - - /** - * Optional user metadata about the index template. May have any contents. This - * map is not automatically generated by Elasticsearch. - *

- * API name: {@code _meta} - *

- * Adds an entry to meta. - */ - public final Builder meta(String key, JsonData value) { - this.meta = _mapPut(this.meta, key, value); - return this; - } - - /** - * API name: {@code allow_auto_create} - */ - public final Builder allowAutoCreate(@Nullable Boolean value) { - this.allowAutoCreate = value; - return this; - } - - /** - * 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. - *

- * API name: {@code data_stream} - */ - public final Builder dataStream(@Nullable IndexTemplateDataStreamConfiguration value) { - this.dataStream = value; - return this; - } - - /** - * 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. - *

- * API name: {@code data_stream} - */ - public final Builder dataStream( - Function> fn) { - return this.dataStream(fn.apply(new IndexTemplateDataStreamConfiguration.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexTemplate}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexTemplate build() { - _checkSingleUse(); - - return new IndexTemplate(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexTemplate} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - IndexTemplate::setupIndexTemplateDeserializer); - - protected static void setupIndexTemplateDeserializer(ObjectDeserializer op) { - - op.add(Builder::indexPatterns, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "index_patterns"); - op.add(Builder::composedOf, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "composed_of"); - op.add(Builder::template, IndexTemplateSummary._DESERIALIZER, "template"); - op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version"); - op.add(Builder::priority, JsonpDeserializer.longDeserializer(), "priority"); - op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta"); - op.add(Builder::allowAutoCreate, JsonpDeserializer.booleanDeserializer(), "allow_auto_create"); - op.add(Builder::dataStream, IndexTemplateDataStreamConfiguration._DESERIALIZER, "data_stream"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplateDataStreamConfiguration.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplateDataStreamConfiguration.java deleted file mode 100644 index db010925a..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplateDataStreamConfiguration.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.IndexTemplateDataStreamConfiguration - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexTemplateDataStreamConfiguration implements JsonpSerializable { - @Nullable - private final Boolean hidden; - - @Nullable - private final Boolean allowCustomRouting; - - // --------------------------------------------------------------------------------------------- - - private IndexTemplateDataStreamConfiguration(Builder builder) { - - this.hidden = builder.hidden; - this.allowCustomRouting = builder.allowCustomRouting; - - } - - public static IndexTemplateDataStreamConfiguration of( - Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * If true, the data stream is hidden. - *

- * API name: {@code hidden} - */ - @Nullable - public final Boolean hidden() { - return this.hidden; - } - - /** - * If true, the data stream supports custom routing. - *

- * API name: {@code allow_custom_routing} - */ - @Nullable - public final Boolean allowCustomRouting() { - return this.allowCustomRouting; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.hidden != null) { - generator.writeKey("hidden"); - generator.write(this.hidden); - - } - if (this.allowCustomRouting != null) { - generator.writeKey("allow_custom_routing"); - generator.write(this.allowCustomRouting); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexTemplateDataStreamConfiguration}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Boolean hidden; - - @Nullable - private Boolean allowCustomRouting; - - /** - * If true, the data stream is hidden. - *

- * API name: {@code hidden} - */ - public final Builder hidden(@Nullable Boolean value) { - this.hidden = value; - return this; - } - - /** - * If true, the data stream supports custom routing. - *

- * API name: {@code allow_custom_routing} - */ - public final Builder allowCustomRouting(@Nullable Boolean value) { - this.allowCustomRouting = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexTemplateDataStreamConfiguration}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexTemplateDataStreamConfiguration build() { - _checkSingleUse(); - - return new IndexTemplateDataStreamConfiguration(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexTemplateDataStreamConfiguration} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, - IndexTemplateDataStreamConfiguration::setupIndexTemplateDataStreamConfigurationDeserializer); - - protected static void setupIndexTemplateDataStreamConfigurationDeserializer( - ObjectDeserializer op) { - - op.add(Builder::hidden, JsonpDeserializer.booleanDeserializer(), "hidden"); - op.add(Builder::allowCustomRouting, JsonpDeserializer.booleanDeserializer(), "allow_custom_routing"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplateSummary.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplateSummary.java deleted file mode 100644 index cccd8686e..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplateSummary.java +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.mapping.TypeMapping; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.IndexTemplateSummary - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexTemplateSummary implements JsonpSerializable { - private final Map aliases; - - @Nullable - private final TypeMapping mappings; - - @Nullable - private final IndexSettings settings; - - @Nullable - private final DataStreamLifecycleWithRollover lifecycle; - - // --------------------------------------------------------------------------------------------- - - private IndexTemplateSummary(Builder builder) { - - this.aliases = ApiTypeHelper.unmodifiable(builder.aliases); - this.mappings = builder.mappings; - this.settings = builder.settings; - this.lifecycle = builder.lifecycle; - - } - - public static IndexTemplateSummary of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code aliases} - */ - public final Map aliases() { - return this.aliases; - } - - /** - * Mapping for fields in the index. If specified, this mapping can include field - * names, field data types, and mapping parameters. - *

- * API name: {@code mappings} - */ - @Nullable - public final TypeMapping mappings() { - return this.mappings; - } - - /** - * Configuration options for the index. - *

- * API name: {@code settings} - */ - @Nullable - public final IndexSettings settings() { - return this.settings; - } - - /** - * API name: {@code lifecycle} - */ - @Nullable - public final DataStreamLifecycleWithRollover lifecycle() { - return this.lifecycle; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.aliases)) { - generator.writeKey("aliases"); - generator.writeStartObject(); - for (Map.Entry item0 : this.aliases.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.mappings != null) { - generator.writeKey("mappings"); - this.mappings.serialize(generator, mapper); - - } - if (this.settings != null) { - generator.writeKey("settings"); - this.settings.serialize(generator, mapper); - - } - if (this.lifecycle != null) { - generator.writeKey("lifecycle"); - this.lifecycle.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexTemplateSummary}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Map aliases; - - @Nullable - private TypeMapping mappings; - - @Nullable - private IndexSettings settings; - - @Nullable - private 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. - *

- * API name: {@code aliases} - *

- * Adds all entries of map to aliases. - */ - public final Builder aliases(Map map) { - this.aliases = _mapPutAll(this.aliases, map); - 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. - *

- * API name: {@code aliases} - *

- * Adds an entry to aliases. - */ - public final Builder aliases(String key, Alias value) { - this.aliases = _mapPut(this.aliases, 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. - *

- * API name: {@code aliases} - *

- * Adds an entry to aliases using a builder lambda. - */ - public final Builder aliases(String key, Function> fn) { - return aliases(key, fn.apply(new Alias.Builder()).build()); - } - - /** - * Mapping for fields in the index. If specified, this mapping can include field - * names, field data types, and mapping parameters. - *

- * API name: {@code mappings} - */ - public final Builder mappings(@Nullable TypeMapping value) { - this.mappings = value; - return this; - } - - /** - * Mapping for fields in the index. If specified, this mapping can include field - * names, field data types, and mapping parameters. - *

- * API name: {@code mappings} - */ - public final Builder mappings(Function> fn) { - return this.mappings(fn.apply(new TypeMapping.Builder()).build()); - } - - /** - * Configuration options for the index. - *

- * API name: {@code settings} - */ - public final Builder settings(@Nullable IndexSettings value) { - this.settings = value; - return this; - } - - /** - * Configuration options for the index. - *

- * API name: {@code settings} - */ - public final Builder settings(Function> fn) { - return this.settings(fn.apply(new IndexSettings.Builder()).build()); - } - - /** - * API name: {@code lifecycle} - */ - public final Builder lifecycle(@Nullable DataStreamLifecycleWithRollover value) { - this.lifecycle = value; - return this; - } - - /** - * API name: {@code lifecycle} - */ - public final Builder lifecycle( - Function> fn) { - return this.lifecycle(fn.apply(new DataStreamLifecycleWithRollover.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexTemplateSummary}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexTemplateSummary build() { - _checkSingleUse(); - - return new IndexTemplateSummary(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexTemplateSummary} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, IndexTemplateSummary::setupIndexTemplateSummaryDeserializer); - - protected static void setupIndexTemplateSummaryDeserializer(ObjectDeserializer op) { - - op.add(Builder::aliases, JsonpDeserializer.stringMapDeserializer(Alias._DESERIALIZER), "aliases"); - op.add(Builder::mappings, TypeMapping._DESERIALIZER, "mappings"); - op.add(Builder::settings, IndexSettings._DESERIALIZER, "settings"); - op.add(Builder::lifecycle, DataStreamLifecycleWithRollover._DESERIALIZER, "lifecycle"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexVersioning.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexVersioning.java deleted file mode 100644 index 5a3a1527a..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexVersioning.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.IndexVersioning - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexVersioning implements JsonpSerializable { - @Nullable - private final String created; - - @Nullable - private final String createdString; - - // --------------------------------------------------------------------------------------------- - - private IndexVersioning(Builder builder) { - - this.created = builder.created; - this.createdString = builder.createdString; - - } - - public static IndexVersioning of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code created} - */ - @Nullable - public final String created() { - return this.created; - } - - /** - * API name: {@code created_string} - */ - @Nullable - public final String createdString() { - return this.createdString; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.created != null) { - generator.writeKey("created"); - generator.write(this.created); - - } - if (this.createdString != null) { - generator.writeKey("created_string"); - generator.write(this.createdString); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexVersioning}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private String created; - - @Nullable - private String createdString; - - /** - * API name: {@code created} - */ - public final Builder created(@Nullable String value) { - this.created = value; - return this; - } - - /** - * API name: {@code created_string} - */ - public final Builder createdString(@Nullable String value) { - this.createdString = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexVersioning}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexVersioning build() { - _checkSingleUse(); - - return new IndexVersioning(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexVersioning} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - IndexVersioning::setupIndexVersioningDeserializer); - - protected static void setupIndexVersioningDeserializer(ObjectDeserializer op) { - - op.add(Builder::created, JsonpDeserializer.stringDeserializer(), "created"); - op.add(Builder::createdString, JsonpDeserializer.stringDeserializer(), "created_string"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexingPressure.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexingPressure.java deleted file mode 100644 index 5d51352ce..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexingPressure.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.IndexingPressure - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexingPressure implements JsonpSerializable { - private final IndexingPressureMemory memory; - - // --------------------------------------------------------------------------------------------- - - private IndexingPressure(Builder builder) { - - this.memory = ApiTypeHelper.requireNonNull(builder.memory, this, "memory"); - - } - - public static IndexingPressure of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code memory} - */ - public final IndexingPressureMemory memory() { - return this.memory; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("memory"); - this.memory.serialize(generator, mapper); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexingPressure}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private IndexingPressureMemory memory; - - /** - * Required - API name: {@code memory} - */ - public final Builder memory(IndexingPressureMemory value) { - this.memory = value; - return this; - } - - /** - * Required - API name: {@code memory} - */ - public final Builder memory( - Function> fn) { - return this.memory(fn.apply(new IndexingPressureMemory.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexingPressure}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexingPressure build() { - _checkSingleUse(); - - return new IndexingPressure(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexingPressure} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - IndexingPressure::setupIndexingPressureDeserializer); - - protected static void setupIndexingPressureDeserializer(ObjectDeserializer op) { - - op.add(Builder::memory, IndexingPressureMemory._DESERIALIZER, "memory"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexingPressureMemory.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexingPressureMemory.java deleted file mode 100644 index bba23689f..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexingPressureMemory.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Integer; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.IndexingPressureMemory - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexingPressureMemory implements JsonpSerializable { - @Nullable - private final Integer limit; - - // --------------------------------------------------------------------------------------------- - - private IndexingPressureMemory(Builder builder) { - - this.limit = builder.limit; - - } - - public static IndexingPressureMemory of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Number of outstanding bytes that may be consumed by indexing requests. When - * this limit is reached or exceeded, the node will reject new coordinating and - * primary operations. When replica operations consume 1.5x this limit, the node - * will reject new replica operations. Defaults to 10% of the heap. - *

- * API name: {@code limit} - */ - @Nullable - public final Integer limit() { - return this.limit; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.limit != null) { - generator.writeKey("limit"); - generator.write(this.limit); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexingPressureMemory}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Integer limit; - - /** - * Number of outstanding bytes that may be consumed by indexing requests. When - * this limit is reached or exceeded, the node will reject new coordinating and - * primary operations. When replica operations consume 1.5x this limit, the node - * will reject new replica operations. Defaults to 10% of the heap. - *

- * API name: {@code limit} - */ - public final Builder limit(@Nullable Integer value) { - this.limit = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexingPressureMemory}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexingPressureMemory build() { - _checkSingleUse(); - - return new IndexingPressureMemory(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexingPressureMemory} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, IndexingPressureMemory::setupIndexingPressureMemoryDeserializer); - - protected static void setupIndexingPressureMemoryDeserializer( - ObjectDeserializer op) { - - op.add(Builder::limit, JsonpDeserializer.integerDeserializer(), "limit"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexingSlowlogSettings.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexingSlowlogSettings.java deleted file mode 100644 index abb2011eb..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexingSlowlogSettings.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Integer; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.IndexingSlowlogSettings - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexingSlowlogSettings implements JsonpSerializable { - @Nullable - private final String level; - - @Nullable - private final Integer source; - - @Nullable - private final Boolean reformat; - - @Nullable - private final IndexingSlowlogTresholds threshold; - - // --------------------------------------------------------------------------------------------- - - private IndexingSlowlogSettings(Builder builder) { - - this.level = builder.level; - this.source = builder.source; - this.reformat = builder.reformat; - this.threshold = builder.threshold; - - } - - public static IndexingSlowlogSettings of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code level} - */ - @Nullable - public final String level() { - return this.level; - } - - /** - * API name: {@code source} - */ - @Nullable - public final Integer source() { - return this.source; - } - - /** - * API name: {@code reformat} - */ - @Nullable - public final Boolean reformat() { - return this.reformat; - } - - /** - * API name: {@code threshold} - */ - @Nullable - public final IndexingSlowlogTresholds threshold() { - return this.threshold; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.level != null) { - generator.writeKey("level"); - generator.write(this.level); - - } - if (this.source != null) { - generator.writeKey("source"); - generator.write(this.source); - - } - if (this.reformat != null) { - generator.writeKey("reformat"); - generator.write(this.reformat); - - } - if (this.threshold != null) { - generator.writeKey("threshold"); - this.threshold.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexingSlowlogSettings}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private String level; - - @Nullable - private Integer source; - - @Nullable - private Boolean reformat; - - @Nullable - private IndexingSlowlogTresholds threshold; - - /** - * API name: {@code level} - */ - public final Builder level(@Nullable String value) { - this.level = value; - return this; - } - - /** - * API name: {@code source} - */ - public final Builder source(@Nullable Integer value) { - this.source = value; - return this; - } - - /** - * API name: {@code reformat} - */ - public final Builder reformat(@Nullable Boolean value) { - this.reformat = value; - return this; - } - - /** - * API name: {@code threshold} - */ - public final Builder threshold(@Nullable IndexingSlowlogTresholds value) { - this.threshold = value; - return this; - } - - /** - * API name: {@code threshold} - */ - public final Builder threshold( - Function> fn) { - return this.threshold(fn.apply(new IndexingSlowlogTresholds.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexingSlowlogSettings}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexingSlowlogSettings build() { - _checkSingleUse(); - - return new IndexingSlowlogSettings(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexingSlowlogSettings} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, IndexingSlowlogSettings::setupIndexingSlowlogSettingsDeserializer); - - protected static void setupIndexingSlowlogSettingsDeserializer( - ObjectDeserializer op) { - - op.add(Builder::level, JsonpDeserializer.stringDeserializer(), "level"); - op.add(Builder::source, JsonpDeserializer.integerDeserializer(), "source"); - op.add(Builder::reformat, JsonpDeserializer.booleanDeserializer(), "reformat"); - op.add(Builder::threshold, IndexingSlowlogTresholds._DESERIALIZER, "threshold"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexingSlowlogTresholds.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexingSlowlogTresholds.java deleted file mode 100644 index b46b97a73..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/IndexingSlowlogTresholds.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.IndexingSlowlogTresholds - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexingSlowlogTresholds implements JsonpSerializable { - @Nullable - private final SlowlogTresholdLevels index; - - // --------------------------------------------------------------------------------------------- - - private IndexingSlowlogTresholds(Builder builder) { - - this.index = builder.index; - - } - - public static IndexingSlowlogTresholds of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code index} - */ - @Nullable - public final SlowlogTresholdLevels index() { - return this.index; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.index != null) { - generator.writeKey("index"); - this.index.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexingSlowlogTresholds}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private SlowlogTresholdLevels index; - - /** - * 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. - *

- * API name: {@code index} - */ - public final Builder index(@Nullable SlowlogTresholdLevels value) { - this.index = value; - return this; - } - - /** - * 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. - *

- * API name: {@code index} - */ - public final Builder index(Function> fn) { - return this.index(fn.apply(new SlowlogTresholdLevels.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexingSlowlogTresholds}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexingSlowlogTresholds build() { - _checkSingleUse(); - - return new IndexingSlowlogTresholds(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexingSlowlogTresholds} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, IndexingSlowlogTresholds::setupIndexingSlowlogTresholdsDeserializer); - - protected static void setupIndexingSlowlogTresholdsDeserializer( - ObjectDeserializer op) { - - op.add(Builder::index, SlowlogTresholdLevels._DESERIALIZER, "index"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ManagedBy.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ManagedBy.java deleted file mode 100644 index e76a4cd5c..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ManagedBy.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum ManagedBy implements JsonEnum { - Ilm("Index Lifecycle Management"), - - Datastream("Data stream lifecycle"), - - Unmanaged("Unmanaged"), - - ; - - private final String jsonValue; - - ManagedBy(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - ManagedBy.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettings.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettings.java deleted file mode 100644 index f6848141d..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettings.java +++ /dev/null @@ -1,416 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.MappingLimitSettings - -/** - * Mapping Limit Settings - * - * @see Documentation - * on elastic.co - * @see API - * specification - */ -@JsonpDeserializable -public class MappingLimitSettings implements JsonpSerializable { - @Nullable - private final Boolean coerce; - - @Nullable - private final MappingLimitSettingsTotalFields totalFields; - - @Nullable - private final MappingLimitSettingsDepth depth; - - @Nullable - private final MappingLimitSettingsNestedFields nestedFields; - - @Nullable - private final MappingLimitSettingsNestedObjects nestedObjects; - - @Nullable - private final MappingLimitSettingsFieldNameLength fieldNameLength; - - @Nullable - private final MappingLimitSettingsDimensionFields dimensionFields; - - @Nullable - private final Boolean ignoreMalformed; - - // --------------------------------------------------------------------------------------------- - - private MappingLimitSettings(Builder builder) { - - this.coerce = builder.coerce; - this.totalFields = builder.totalFields; - this.depth = builder.depth; - this.nestedFields = builder.nestedFields; - this.nestedObjects = builder.nestedObjects; - this.fieldNameLength = builder.fieldNameLength; - this.dimensionFields = builder.dimensionFields; - this.ignoreMalformed = builder.ignoreMalformed; - - } - - public static MappingLimitSettings of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code coerce} - */ - @Nullable - public final Boolean coerce() { - return this.coerce; - } - - /** - * API name: {@code total_fields} - */ - @Nullable - public final MappingLimitSettingsTotalFields totalFields() { - return this.totalFields; - } - - /** - * API name: {@code depth} - */ - @Nullable - public final MappingLimitSettingsDepth depth() { - return this.depth; - } - - /** - * API name: {@code nested_fields} - */ - @Nullable - public final MappingLimitSettingsNestedFields nestedFields() { - return this.nestedFields; - } - - /** - * API name: {@code nested_objects} - */ - @Nullable - public final MappingLimitSettingsNestedObjects nestedObjects() { - return this.nestedObjects; - } - - /** - * API name: {@code field_name_length} - */ - @Nullable - public final MappingLimitSettingsFieldNameLength fieldNameLength() { - return this.fieldNameLength; - } - - /** - * API name: {@code dimension_fields} - */ - @Nullable - public final MappingLimitSettingsDimensionFields dimensionFields() { - return this.dimensionFields; - } - - /** - * API name: {@code ignore_malformed} - */ - @Nullable - public final Boolean ignoreMalformed() { - return this.ignoreMalformed; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.coerce != null) { - generator.writeKey("coerce"); - generator.write(this.coerce); - - } - if (this.totalFields != null) { - generator.writeKey("total_fields"); - this.totalFields.serialize(generator, mapper); - - } - if (this.depth != null) { - generator.writeKey("depth"); - this.depth.serialize(generator, mapper); - - } - if (this.nestedFields != null) { - generator.writeKey("nested_fields"); - this.nestedFields.serialize(generator, mapper); - - } - if (this.nestedObjects != null) { - generator.writeKey("nested_objects"); - this.nestedObjects.serialize(generator, mapper); - - } - if (this.fieldNameLength != null) { - generator.writeKey("field_name_length"); - this.fieldNameLength.serialize(generator, mapper); - - } - if (this.dimensionFields != null) { - generator.writeKey("dimension_fields"); - this.dimensionFields.serialize(generator, mapper); - - } - if (this.ignoreMalformed != null) { - generator.writeKey("ignore_malformed"); - generator.write(this.ignoreMalformed); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link MappingLimitSettings}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Boolean coerce; - - @Nullable - private MappingLimitSettingsTotalFields totalFields; - - @Nullable - private MappingLimitSettingsDepth depth; - - @Nullable - private MappingLimitSettingsNestedFields nestedFields; - - @Nullable - private MappingLimitSettingsNestedObjects nestedObjects; - - @Nullable - private MappingLimitSettingsFieldNameLength fieldNameLength; - - @Nullable - private MappingLimitSettingsDimensionFields dimensionFields; - - @Nullable - private Boolean ignoreMalformed; - - /** - * API name: {@code coerce} - */ - public final Builder coerce(@Nullable Boolean value) { - this.coerce = value; - return this; - } - - /** - * API name: {@code total_fields} - */ - public final Builder totalFields(@Nullable MappingLimitSettingsTotalFields value) { - this.totalFields = value; - return this; - } - - /** - * API name: {@code total_fields} - */ - public final Builder totalFields( - Function> fn) { - return this.totalFields(fn.apply(new MappingLimitSettingsTotalFields.Builder()).build()); - } - - /** - * API name: {@code depth} - */ - public final Builder depth(@Nullable MappingLimitSettingsDepth value) { - this.depth = value; - return this; - } - - /** - * API name: {@code depth} - */ - public final Builder depth( - Function> fn) { - return this.depth(fn.apply(new MappingLimitSettingsDepth.Builder()).build()); - } - - /** - * API name: {@code nested_fields} - */ - public final Builder nestedFields(@Nullable MappingLimitSettingsNestedFields value) { - this.nestedFields = value; - return this; - } - - /** - * API name: {@code nested_fields} - */ - public final Builder nestedFields( - Function> fn) { - return this.nestedFields(fn.apply(new MappingLimitSettingsNestedFields.Builder()).build()); - } - - /** - * API name: {@code nested_objects} - */ - public final Builder nestedObjects(@Nullable MappingLimitSettingsNestedObjects value) { - this.nestedObjects = value; - return this; - } - - /** - * API name: {@code nested_objects} - */ - public final Builder nestedObjects( - Function> fn) { - return this.nestedObjects(fn.apply(new MappingLimitSettingsNestedObjects.Builder()).build()); - } - - /** - * API name: {@code field_name_length} - */ - public final Builder fieldNameLength(@Nullable MappingLimitSettingsFieldNameLength value) { - this.fieldNameLength = value; - return this; - } - - /** - * API name: {@code field_name_length} - */ - public final Builder fieldNameLength( - Function> fn) { - return this.fieldNameLength(fn.apply(new MappingLimitSettingsFieldNameLength.Builder()).build()); - } - - /** - * API name: {@code dimension_fields} - */ - public final Builder dimensionFields(@Nullable MappingLimitSettingsDimensionFields value) { - this.dimensionFields = value; - return this; - } - - /** - * API name: {@code dimension_fields} - */ - public final Builder dimensionFields( - Function> fn) { - return this.dimensionFields(fn.apply(new MappingLimitSettingsDimensionFields.Builder()).build()); - } - - /** - * API name: {@code ignore_malformed} - */ - public final Builder ignoreMalformed(@Nullable Boolean value) { - this.ignoreMalformed = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link MappingLimitSettings}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public MappingLimitSettings build() { - _checkSingleUse(); - - return new MappingLimitSettings(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link MappingLimitSettings} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, MappingLimitSettings::setupMappingLimitSettingsDeserializer); - - protected static void setupMappingLimitSettingsDeserializer(ObjectDeserializer op) { - - op.add(Builder::coerce, JsonpDeserializer.booleanDeserializer(), "coerce"); - op.add(Builder::totalFields, MappingLimitSettingsTotalFields._DESERIALIZER, "total_fields"); - op.add(Builder::depth, MappingLimitSettingsDepth._DESERIALIZER, "depth"); - op.add(Builder::nestedFields, MappingLimitSettingsNestedFields._DESERIALIZER, "nested_fields"); - op.add(Builder::nestedObjects, MappingLimitSettingsNestedObjects._DESERIALIZER, "nested_objects"); - op.add(Builder::fieldNameLength, MappingLimitSettingsFieldNameLength._DESERIALIZER, "field_name_length"); - op.add(Builder::dimensionFields, MappingLimitSettingsDimensionFields._DESERIALIZER, "dimension_fields"); - op.add(Builder::ignoreMalformed, JsonpDeserializer.booleanDeserializer(), "ignore_malformed"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettingsDepth.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettingsDepth.java deleted file mode 100644 index 61b93c9ce..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettingsDepth.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Long; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.MappingLimitSettingsDepth - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class MappingLimitSettingsDepth implements JsonpSerializable { - @Nullable - private final Long limit; - - // --------------------------------------------------------------------------------------------- - - private MappingLimitSettingsDepth(Builder builder) { - - this.limit = builder.limit; - - } - - public static MappingLimitSettingsDepth of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code limit} - */ - @Nullable - public final Long limit() { - return this.limit; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.limit != null) { - generator.writeKey("limit"); - generator.write(this.limit); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link MappingLimitSettingsDepth}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Long limit; - - /** - * 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. - *

- * API name: {@code limit} - */ - public final Builder limit(@Nullable Long value) { - this.limit = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link MappingLimitSettingsDepth}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public MappingLimitSettingsDepth build() { - _checkSingleUse(); - - return new MappingLimitSettingsDepth(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link MappingLimitSettingsDepth} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, MappingLimitSettingsDepth::setupMappingLimitSettingsDepthDeserializer); - - protected static void setupMappingLimitSettingsDepthDeserializer( - ObjectDeserializer op) { - - op.add(Builder::limit, JsonpDeserializer.longDeserializer(), "limit"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettingsDimensionFields.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettingsDimensionFields.java deleted file mode 100644 index 52de5458e..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettingsDimensionFields.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Long; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.MappingLimitSettingsDimensionFields - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class MappingLimitSettingsDimensionFields implements JsonpSerializable { - @Nullable - private final Long limit; - - // --------------------------------------------------------------------------------------------- - - private MappingLimitSettingsDimensionFields(Builder builder) { - - this.limit = builder.limit; - - } - - public static MappingLimitSettingsDimensionFields of( - Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * [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. - *

- * API name: {@code limit} - */ - @Nullable - public final Long limit() { - return this.limit; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.limit != null) { - generator.writeKey("limit"); - generator.write(this.limit); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link MappingLimitSettingsDimensionFields}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Long limit; - - /** - * [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. - *

- * API name: {@code limit} - */ - public final Builder limit(@Nullable Long value) { - this.limit = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link MappingLimitSettingsDimensionFields}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public MappingLimitSettingsDimensionFields build() { - _checkSingleUse(); - - return new MappingLimitSettingsDimensionFields(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link MappingLimitSettingsDimensionFields} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, - MappingLimitSettingsDimensionFields::setupMappingLimitSettingsDimensionFieldsDeserializer); - - protected static void setupMappingLimitSettingsDimensionFieldsDeserializer( - ObjectDeserializer op) { - - op.add(Builder::limit, JsonpDeserializer.longDeserializer(), "limit"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettingsFieldNameLength.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettingsFieldNameLength.java deleted file mode 100644 index d268bd7f0..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettingsFieldNameLength.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Long; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.MappingLimitSettingsFieldNameLength - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class MappingLimitSettingsFieldNameLength implements JsonpSerializable { - @Nullable - private final Long limit; - - // --------------------------------------------------------------------------------------------- - - private MappingLimitSettingsFieldNameLength(Builder builder) { - - this.limit = builder.limit; - - } - - public static MappingLimitSettingsFieldNameLength of( - Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Setting for the maximum length of a field name. This setting isn’t really - * something that addresses mappings explosion but might still be useful if you - * want to limit the field length. It usually shouldn’t be necessary to set this - * setting. The 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). - *

- * API name: {@code limit} - */ - @Nullable - public final Long limit() { - return this.limit; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.limit != null) { - generator.writeKey("limit"); - generator.write(this.limit); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link MappingLimitSettingsFieldNameLength}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Long limit; - - /** - * Setting for the maximum length of a field name. This setting isn’t really - * something that addresses mappings explosion but might still be useful if you - * want to limit the field length. It usually shouldn’t be necessary to set this - * setting. The 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). - *

- * API name: {@code limit} - */ - public final Builder limit(@Nullable Long value) { - this.limit = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link MappingLimitSettingsFieldNameLength}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public MappingLimitSettingsFieldNameLength build() { - _checkSingleUse(); - - return new MappingLimitSettingsFieldNameLength(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link MappingLimitSettingsFieldNameLength} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, - MappingLimitSettingsFieldNameLength::setupMappingLimitSettingsFieldNameLengthDeserializer); - - protected static void setupMappingLimitSettingsFieldNameLengthDeserializer( - ObjectDeserializer op) { - - op.add(Builder::limit, JsonpDeserializer.longDeserializer(), "limit"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettingsNestedFields.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettingsNestedFields.java deleted file mode 100644 index 7bff31845..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettingsNestedFields.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Long; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.MappingLimitSettingsNestedFields - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class MappingLimitSettingsNestedFields implements JsonpSerializable { - @Nullable - private final Long limit; - - // --------------------------------------------------------------------------------------------- - - private MappingLimitSettingsNestedFields(Builder builder) { - - this.limit = builder.limit; - - } - - public static MappingLimitSettingsNestedFields of( - Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * The maximum number of distinct nested mappings in an index. The nested type - * should only be used in special cases, when arrays of objects need to be - * queried independently of each other. To safeguard against poorly designed - * mappings, this setting limits the number of unique nested types per index. - *

- * API name: {@code limit} - */ - @Nullable - public final Long limit() { - return this.limit; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.limit != null) { - generator.writeKey("limit"); - generator.write(this.limit); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link MappingLimitSettingsNestedFields}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Long limit; - - /** - * The maximum number of distinct nested mappings in an index. The nested type - * should only be used in special cases, when arrays of objects need to be - * queried independently of each other. To safeguard against poorly designed - * mappings, this setting limits the number of unique nested types per index. - *

- * API name: {@code limit} - */ - public final Builder limit(@Nullable Long value) { - this.limit = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link MappingLimitSettingsNestedFields}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public MappingLimitSettingsNestedFields build() { - _checkSingleUse(); - - return new MappingLimitSettingsNestedFields(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link MappingLimitSettingsNestedFields} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, MappingLimitSettingsNestedFields::setupMappingLimitSettingsNestedFieldsDeserializer); - - protected static void setupMappingLimitSettingsNestedFieldsDeserializer( - ObjectDeserializer op) { - - op.add(Builder::limit, JsonpDeserializer.longDeserializer(), "limit"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettingsNestedObjects.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettingsNestedObjects.java deleted file mode 100644 index d29c6b76a..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettingsNestedObjects.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Long; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.MappingLimitSettingsNestedObjects - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class MappingLimitSettingsNestedObjects implements JsonpSerializable { - @Nullable - private final Long limit; - - // --------------------------------------------------------------------------------------------- - - private MappingLimitSettingsNestedObjects(Builder builder) { - - this.limit = builder.limit; - - } - - public static MappingLimitSettingsNestedObjects of( - Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code limit} - */ - @Nullable - public final Long limit() { - return this.limit; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.limit != null) { - generator.writeKey("limit"); - generator.write(this.limit); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link MappingLimitSettingsNestedObjects}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Long limit; - - /** - * 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. - *

- * API name: {@code limit} - */ - public final Builder limit(@Nullable Long value) { - this.limit = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link MappingLimitSettingsNestedObjects}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public MappingLimitSettingsNestedObjects build() { - _checkSingleUse(); - - return new MappingLimitSettingsNestedObjects(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link MappingLimitSettingsNestedObjects} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, MappingLimitSettingsNestedObjects::setupMappingLimitSettingsNestedObjectsDeserializer); - - protected static void setupMappingLimitSettingsNestedObjectsDeserializer( - ObjectDeserializer op) { - - op.add(Builder::limit, JsonpDeserializer.longDeserializer(), "limit"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettingsTotalFields.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettingsTotalFields.java deleted file mode 100644 index ace492270..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettingsTotalFields.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Long; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.MappingLimitSettingsTotalFields - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class MappingLimitSettingsTotalFields implements JsonpSerializable { - @Nullable - private final Long limit; - - @Nullable - private final Boolean ignoreDynamicBeyondLimit; - - // --------------------------------------------------------------------------------------------- - - private MappingLimitSettingsTotalFields(Builder builder) { - - this.limit = builder.limit; - this.ignoreDynamicBeyondLimit = builder.ignoreDynamicBeyondLimit; - - } - - public static MappingLimitSettingsTotalFields of( - Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * The maximum number of fields in an index. Field and object mappings, as well - * as field aliases count towards this limit. The limit is in place to prevent - * mappings and searches from becoming too large. Higher values can lead to - * performance degradations and memory issues, especially in clusters with a - * high load or few resources. - *

- * API name: {@code limit} - */ - @Nullable - public final Long limit() { - return this.limit; - } - - /** - * This setting determines what happens when a dynamically mapped field would - * exceed the total fields limit. When set to false (the default), the index - * request of the document that tries to add a dynamic field to the mapping will - * fail with the message Limit of total fields [X] has been exceeded. When set - * to true, the index request will not fail. Instead, fields that would exceed - * the limit are not added to the mapping, similar to dynamic: false. The fields - * that were not added to the mapping will be added to the _ignored field. - *

- * API name: {@code ignore_dynamic_beyond_limit} - */ - @Nullable - public final Boolean ignoreDynamicBeyondLimit() { - return this.ignoreDynamicBeyondLimit; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.limit != null) { - generator.writeKey("limit"); - generator.write(this.limit); - - } - if (this.ignoreDynamicBeyondLimit != null) { - generator.writeKey("ignore_dynamic_beyond_limit"); - generator.write(this.ignoreDynamicBeyondLimit); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link MappingLimitSettingsTotalFields}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Long limit; - - @Nullable - private Boolean ignoreDynamicBeyondLimit; - - /** - * The maximum number of fields in an index. Field and object mappings, as well - * as field aliases count towards this limit. The limit is in place to prevent - * mappings and searches from becoming too large. Higher values can lead to - * performance degradations and memory issues, especially in clusters with a - * high load or few resources. - *

- * API name: {@code limit} - */ - public final Builder limit(@Nullable Long value) { - this.limit = value; - return this; - } - - /** - * This setting determines what happens when a dynamically mapped field would - * exceed the total fields limit. When set to false (the default), the index - * request of the document that tries to add a dynamic field to the mapping will - * fail with the message Limit of total fields [X] has been exceeded. When set - * to true, the index request will not fail. Instead, fields that would exceed - * the limit are not added to the mapping, similar to dynamic: false. The fields - * that were not added to the mapping will be added to the _ignored field. - *

- * API name: {@code ignore_dynamic_beyond_limit} - */ - public final Builder ignoreDynamicBeyondLimit(@Nullable Boolean value) { - this.ignoreDynamicBeyondLimit = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link MappingLimitSettingsTotalFields}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public MappingLimitSettingsTotalFields build() { - _checkSingleUse(); - - return new MappingLimitSettingsTotalFields(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link MappingLimitSettingsTotalFields} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, MappingLimitSettingsTotalFields::setupMappingLimitSettingsTotalFieldsDeserializer); - - protected static void setupMappingLimitSettingsTotalFieldsDeserializer( - ObjectDeserializer op) { - - op.add(Builder::limit, JsonpDeserializer.longDeserializer(), "limit"); - op.add(Builder::ignoreDynamicBeyondLimit, JsonpDeserializer.booleanDeserializer(), - "ignore_dynamic_beyond_limit"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/Merge.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/Merge.java deleted file mode 100644 index d9e94b6c3..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/Merge.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.Merge - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class Merge implements JsonpSerializable { - @Nullable - private final MergeScheduler scheduler; - - // --------------------------------------------------------------------------------------------- - - private Merge(Builder builder) { - - this.scheduler = builder.scheduler; - - } - - public static Merge of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code scheduler} - */ - @Nullable - public final MergeScheduler scheduler() { - return this.scheduler; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.scheduler != null) { - generator.writeKey("scheduler"); - this.scheduler.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link Merge}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private MergeScheduler scheduler; - - /** - * API name: {@code scheduler} - */ - public final Builder scheduler(@Nullable MergeScheduler value) { - this.scheduler = value; - return this; - } - - /** - * API name: {@code scheduler} - */ - public final Builder scheduler(Function> fn) { - return this.scheduler(fn.apply(new MergeScheduler.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link Merge}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public Merge build() { - _checkSingleUse(); - - return new Merge(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link Merge} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - Merge::setupMergeDeserializer); - - protected static void setupMergeDeserializer(ObjectDeserializer op) { - - op.add(Builder::scheduler, MergeScheduler._DESERIALIZER, "scheduler"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MergeScheduler.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MergeScheduler.java deleted file mode 100644 index caf86bbba..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MergeScheduler.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Integer; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.MergeScheduler - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class MergeScheduler implements JsonpSerializable { - @Nullable - private final Integer maxThreadCount; - - @Nullable - private final Integer maxMergeCount; - - // --------------------------------------------------------------------------------------------- - - private MergeScheduler(Builder builder) { - - this.maxThreadCount = builder.maxThreadCount; - this.maxMergeCount = builder.maxMergeCount; - - } - - public static MergeScheduler of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code max_thread_count} - */ - @Nullable - public final Integer maxThreadCount() { - return this.maxThreadCount; - } - - /** - * API name: {@code max_merge_count} - */ - @Nullable - public final Integer maxMergeCount() { - return this.maxMergeCount; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.maxThreadCount != null) { - generator.writeKey("max_thread_count"); - generator.write(this.maxThreadCount); - - } - if (this.maxMergeCount != null) { - generator.writeKey("max_merge_count"); - generator.write(this.maxMergeCount); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link MergeScheduler}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private Integer maxThreadCount; - - @Nullable - private Integer maxMergeCount; - - /** - * API name: {@code max_thread_count} - */ - public final Builder maxThreadCount(@Nullable Integer value) { - this.maxThreadCount = value; - return this; - } - - /** - * API name: {@code max_merge_count} - */ - public final Builder maxMergeCount(@Nullable Integer value) { - this.maxMergeCount = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link MergeScheduler}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public MergeScheduler build() { - _checkSingleUse(); - - return new MergeScheduler(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link MergeScheduler} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - MergeScheduler::setupMergeSchedulerDeserializer); - - protected static void setupMergeSchedulerDeserializer(ObjectDeserializer op) { - - op.add(Builder::maxThreadCount, JsonpDeserializer.integerDeserializer(), "max_thread_count"); - op.add(Builder::maxMergeCount, JsonpDeserializer.integerDeserializer(), "max_merge_count"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MigrateToDataStreamRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MigrateToDataStreamRequest.java deleted file mode 100644 index 6ad2f1b32..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MigrateToDataStreamRequest.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.migrate_to_data_stream.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. - * - * @see API - * specification - */ - -public class MigrateToDataStreamRequest extends RequestBase { - @Nullable - private final Time masterTimeout; - - private final String name; - - @Nullable - private final Time timeout; - - // --------------------------------------------------------------------------------------------- - - private MigrateToDataStreamRequest(Builder builder) { - - this.masterTimeout = builder.masterTimeout; - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.timeout = builder.timeout; - - } - - public static MigrateToDataStreamRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * Required - Name of the index alias to convert to a data stream. - *

- * API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. - *

- * API name: {@code timeout} - */ - @Nullable - public final Time timeout() { - return this.timeout; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link MigrateToDataStreamRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private Time masterTimeout; - - private String name; - - @Nullable - private Time 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Required - Name of the index alias to convert to a data stream. - *

- * API name: {@code name} - */ - public final Builder name(String value) { - this.name = 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. - *

- * API name: {@code timeout} - */ - public final Builder timeout(@Nullable Time value) { - this.timeout = 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. - *

- * API name: {@code timeout} - */ - public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link MigrateToDataStreamRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public MigrateToDataStreamRequest build() { - _checkSingleUse(); - - return new MigrateToDataStreamRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.migrate_to_data_stream}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.migrate_to_data_stream", - - // Request method - request -> { - return "POST"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_data_stream"); - buf.append("/_migrate"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - params.put("name", request.name); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (request.timeout != null) { - params.put("timeout", request.timeout._toJsonString()); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, MigrateToDataStreamResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MigrateToDataStreamResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MigrateToDataStreamResponse.java deleted file mode 100644 index 93aa19093..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/MigrateToDataStreamResponse.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.migrate_to_data_stream.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class MigrateToDataStreamResponse extends AcknowledgedResponseBase { - // --------------------------------------------------------------------------------------------- - - private MigrateToDataStreamResponse(Builder builder) { - super(builder); - - } - - public static MigrateToDataStreamResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link MigrateToDataStreamResponse}. - */ - - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder - implements - ObjectBuilder { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link MigrateToDataStreamResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public MigrateToDataStreamResponse build() { - _checkSingleUse(); - - return new MigrateToDataStreamResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link MigrateToDataStreamResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, MigrateToDataStreamResponse::setupMigrateToDataStreamResponseDeserializer); - - protected static void setupMigrateToDataStreamResponseDeserializer( - ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ModifyDataStreamRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ModifyDataStreamRequest.java deleted file mode 100644 index 92b887ae5..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ModifyDataStreamRequest.java +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch.indices.modify_data_stream.Action; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.modify_data_stream.Request - -/** - * Update data streams. Performs one or more data stream modification actions in - * a single atomic operation. - * - * @see API - * specification - */ -@JsonpDeserializable -public class ModifyDataStreamRequest extends RequestBase implements JsonpSerializable { - private final List actions; - - // --------------------------------------------------------------------------------------------- - - private ModifyDataStreamRequest(Builder builder) { - - this.actions = ApiTypeHelper.unmodifiableRequired(builder.actions, this, "actions"); - - } - - public static ModifyDataStreamRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Actions to perform. - *

- * API name: {@code actions} - */ - public final List actions() { - return this.actions; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.actions)) { - generator.writeKey("actions"); - generator.writeStartArray(); - for (Action item0 : this.actions) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ModifyDataStreamRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - private List actions; - - /** - * Required - Actions to perform. - *

- * API name: {@code actions} - *

- * Adds all elements of list to actions. - */ - public final Builder actions(List list) { - this.actions = _listAddAll(this.actions, list); - return this; - } - - /** - * Required - Actions to perform. - *

- * API name: {@code actions} - *

- * Adds one or more values to actions. - */ - public final Builder actions(Action value, Action... values) { - this.actions = _listAdd(this.actions, value, values); - return this; - } - - /** - * Required - Actions to perform. - *

- * API name: {@code actions} - *

- * Adds a value to actions using a builder lambda. - */ - public final Builder actions(Function> fn) { - return actions(fn.apply(new Action.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ModifyDataStreamRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ModifyDataStreamRequest build() { - _checkSingleUse(); - - return new ModifyDataStreamRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ModifyDataStreamRequest} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, ModifyDataStreamRequest::setupModifyDataStreamRequestDeserializer); - - protected static void setupModifyDataStreamRequestDeserializer( - ObjectDeserializer op) { - - op.add(Builder::actions, JsonpDeserializer.arrayDeserializer(Action._DESERIALIZER), "actions"); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.modify_data_stream}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.modify_data_stream", - - // Request method - request -> { - return "POST"; - - }, - - // Request path - request -> { - return "/_data_stream/_modify"; - - }, - - // Path parameters - request -> { - return Collections.emptyMap(); - }, - - // Request parameters - request -> { - return Collections.emptyMap(); - - }, SimpleEndpoint.emptyMap(), true, ModifyDataStreamResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ModifyDataStreamResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ModifyDataStreamResponse.java deleted file mode 100644 index d3664f088..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ModifyDataStreamResponse.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.modify_data_stream.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class ModifyDataStreamResponse extends AcknowledgedResponseBase { - // --------------------------------------------------------------------------------------------- - - private ModifyDataStreamResponse(Builder builder) { - super(builder); - - } - - public static ModifyDataStreamResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ModifyDataStreamResponse}. - */ - - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder - implements - ObjectBuilder { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ModifyDataStreamResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ModifyDataStreamResponse build() { - _checkSingleUse(); - - return new ModifyDataStreamResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ModifyDataStreamResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, ModifyDataStreamResponse::setupModifyDataStreamResponseDeserializer); - - protected static void setupModifyDataStreamResponseDeserializer( - ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/NumericFielddata.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/NumericFielddata.java deleted file mode 100644 index 836147ce0..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/NumericFielddata.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.NumericFielddata - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class NumericFielddata implements JsonpSerializable { - private final NumericFielddataFormat format; - - // --------------------------------------------------------------------------------------------- - - private NumericFielddata(Builder builder) { - - this.format = ApiTypeHelper.requireNonNull(builder.format, this, "format"); - - } - - public static NumericFielddata of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code format} - */ - public final NumericFielddataFormat format() { - return this.format; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("format"); - this.format.serialize(generator, mapper); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link NumericFielddata}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private NumericFielddataFormat format; - - /** - * Required - API name: {@code format} - */ - public final Builder format(NumericFielddataFormat value) { - this.format = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link NumericFielddata}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public NumericFielddata build() { - _checkSingleUse(); - - return new NumericFielddata(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link NumericFielddata} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - NumericFielddata::setupNumericFielddataDeserializer); - - protected static void setupNumericFielddataDeserializer(ObjectDeserializer op) { - - op.add(Builder::format, NumericFielddataFormat._DESERIALIZER, "format"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/NumericFielddataFormat.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/NumericFielddataFormat.java deleted file mode 100644 index 187639a8f..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/NumericFielddataFormat.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum NumericFielddataFormat implements JsonEnum { - Array("array"), - - Disabled("disabled"), - - ; - - private final String jsonValue; - - NumericFielddataFormat(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - NumericFielddataFormat.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutAliasRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutAliasRequest.java deleted file mode 100644 index 75f743d04..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutAliasRequest.java +++ /dev/null @@ -1,559 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.elasticsearch._types.query_dsl.Query; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.put_alias.Request - -/** - * Create or update an alias. Adds a data stream or index to an alias. - * - * @see API - * specification - */ -@JsonpDeserializable -public class PutAliasRequest extends RequestBase implements JsonpSerializable { - @Nullable - private final Query filter; - - private final List index; - - @Nullable - private final String indexRouting; - - @Nullable - private final Boolean isWriteIndex; - - @Nullable - private final Time masterTimeout; - - private final String name; - - @Nullable - private final String routing; - - @Nullable - private final String searchRouting; - - @Nullable - private final Time timeout; - - // --------------------------------------------------------------------------------------------- - - private PutAliasRequest(Builder builder) { - - this.filter = builder.filter; - this.index = ApiTypeHelper.unmodifiableRequired(builder.index, this, "index"); - this.indexRouting = builder.indexRouting; - this.isWriteIndex = builder.isWriteIndex; - this.masterTimeout = builder.masterTimeout; - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.routing = builder.routing; - this.searchRouting = builder.searchRouting; - this.timeout = builder.timeout; - - } - - public static PutAliasRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Query used to limit documents the alias can access. - *

- * API name: {@code filter} - */ - @Nullable - public final Query filter() { - return this.filter; - } - - /** - * Required - Comma-separated list of data streams or indices to add. Supports - * wildcards (*). Wildcard patterns that match both data streams - * and indices return an error. - *

- * API name: {@code index} - */ - public final List index() { - return this.index; - } - - /** - * Value used to route indexing operations to a specific shard. If specified, - * this overwrites the routing value for indexing operations. Data - * stream aliases don’t support this parameter. - *

- * API name: {@code index_routing} - */ - @Nullable - public final String indexRouting() { - return this.indexRouting; - } - - /** - * If true, sets the write index or data stream for the alias. If - * an alias points to multiple indices or data streams and - * is_write_index isn’t set, the alias rejects write requests. If - * an index alias points to one index and is_write_index isn’t set, - * the index automatically acts as the write index. Data stream aliases don’t - * automatically set a write data stream, even if the alias points to one data - * stream. - *

- * API name: {@code is_write_index} - */ - @Nullable - public final Boolean isWriteIndex() { - return this.isWriteIndex; - } - - /** - * 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. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * Required - Alias to update. If the alias doesn’t exist, the request creates - * it. Index alias names support date math. - *

- * API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Value used to route indexing and search operations to a specific shard. Data - * stream aliases don’t support this parameter. - *

- * API name: {@code routing} - */ - @Nullable - public final String routing() { - return this.routing; - } - - /** - * Value used to route search operations to a specific shard. If specified, this - * overwrites the routing value for search operations. Data stream - * aliases don’t support this parameter. - *

- * API name: {@code search_routing} - */ - @Nullable - public final String searchRouting() { - return this.searchRouting; - } - - /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. - *

- * API name: {@code timeout} - */ - @Nullable - public final Time timeout() { - return this.timeout; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.filter != null) { - generator.writeKey("filter"); - this.filter.serialize(generator, mapper); - - } - if (this.indexRouting != null) { - generator.writeKey("index_routing"); - generator.write(this.indexRouting); - - } - if (this.isWriteIndex != null) { - generator.writeKey("is_write_index"); - generator.write(this.isWriteIndex); - - } - if (this.routing != null) { - generator.writeKey("routing"); - generator.write(this.routing); - - } - if (this.searchRouting != null) { - generator.writeKey("search_routing"); - generator.write(this.searchRouting); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link PutAliasRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { - @Nullable - private Query filter; - - private List index; - - @Nullable - private String indexRouting; - - @Nullable - private Boolean isWriteIndex; - - @Nullable - private Time masterTimeout; - - private String name; - - @Nullable - private String routing; - - @Nullable - private String searchRouting; - - @Nullable - private Time timeout; - - /** - * Query used to limit documents the alias can access. - *

- * API name: {@code filter} - */ - public final Builder filter(@Nullable Query value) { - this.filter = value; - return this; - } - - /** - * Query used to limit documents the alias can access. - *

- * API name: {@code filter} - */ - public final Builder filter(Function> fn) { - return this.filter(fn.apply(new Query.Builder()).build()); - } - - /** - * Required - Comma-separated list of data streams or indices to add. Supports - * wildcards (*). Wildcard patterns that match both data streams - * and indices return an error. - *

- * API name: {@code index} - *

- * Adds all elements of list to index. - */ - public final Builder index(List list) { - this.index = _listAddAll(this.index, list); - return this; - } - - /** - * Required - Comma-separated list of data streams or indices to add. Supports - * wildcards (*). Wildcard patterns that match both data streams - * and indices return an error. - *

- * API name: {@code index} - *

- * Adds one or more values to index. - */ - public final Builder index(String value, String... values) { - this.index = _listAdd(this.index, value, values); - return this; - } - - /** - * Value used to route indexing operations to a specific shard. If specified, - * this overwrites the routing value for indexing operations. Data - * stream aliases don’t support this parameter. - *

- * API name: {@code index_routing} - */ - public final Builder indexRouting(@Nullable String value) { - this.indexRouting = value; - return this; - } - - /** - * If true, sets the write index or data stream for the alias. If - * an alias points to multiple indices or data streams and - * is_write_index isn’t set, the alias rejects write requests. If - * an index alias points to one index and is_write_index isn’t set, - * the index automatically acts as the write index. Data stream aliases don’t - * automatically set a write data stream, even if the alias points to one data - * stream. - *

- * API name: {@code is_write_index} - */ - public final Builder isWriteIndex(@Nullable Boolean value) { - this.isWriteIndex = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Required - Alias to update. If the alias doesn’t exist, the request creates - * it. Index alias names support date math. - *

- * API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * Value used to route indexing and search operations to a specific shard. Data - * stream aliases don’t support this parameter. - *

- * API name: {@code routing} - */ - public final Builder routing(@Nullable String value) { - this.routing = value; - return this; - } - - /** - * Value used to route search operations to a specific shard. If specified, this - * overwrites the routing value for search operations. Data stream - * aliases don’t support this parameter. - *

- * API name: {@code search_routing} - */ - public final Builder searchRouting(@Nullable String value) { - this.searchRouting = 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. - *

- * API name: {@code timeout} - */ - public final Builder timeout(@Nullable Time value) { - this.timeout = 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. - *

- * API name: {@code timeout} - */ - public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link PutAliasRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public PutAliasRequest build() { - _checkSingleUse(); - - return new PutAliasRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link PutAliasRequest} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - PutAliasRequest::setupPutAliasRequestDeserializer); - - protected static void setupPutAliasRequestDeserializer(ObjectDeserializer op) { - - op.add(Builder::filter, Query._DESERIALIZER, "filter"); - op.add(Builder::indexRouting, JsonpDeserializer.stringDeserializer(), "index_routing"); - op.add(Builder::isWriteIndex, JsonpDeserializer.booleanDeserializer(), "is_write_index"); - op.add(Builder::routing, JsonpDeserializer.stringDeserializer(), "routing"); - op.add(Builder::searchRouting, JsonpDeserializer.stringDeserializer(), "search_routing"); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.put_alias}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.put_alias", - - // Request method - request -> { - return "PUT"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - final int _index = 1 << 1; - - int propsSet = 0; - - propsSet |= _name; - propsSet |= _index; - - if (propsSet == (_index | _name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_alias"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); - return buf.toString(); - } - if (propsSet == (_index | _name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_aliases"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - final int _index = 1 << 1; - - int propsSet = 0; - - propsSet |= _name; - propsSet |= _index; - - if (propsSet == (_index | _name)) { - params.put("index", request.index.stream().map(v -> v).collect(Collectors.joining(","))); - params.put("name", request.name); - } - if (propsSet == (_index | _name)) { - params.put("index", request.index.stream().map(v -> v).collect(Collectors.joining(","))); - params.put("name", request.name); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (request.timeout != null) { - params.put("timeout", request.timeout._toJsonString()); - } - return params; - - }, SimpleEndpoint.emptyMap(), true, PutAliasResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutAliasResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutAliasResponse.java deleted file mode 100644 index 40cbac33b..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutAliasResponse.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.put_alias.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class PutAliasResponse extends AcknowledgedResponseBase { - // --------------------------------------------------------------------------------------------- - - private PutAliasResponse(Builder builder) { - super(builder); - - } - - public static PutAliasResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link PutAliasResponse}. - */ - - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder - implements - ObjectBuilder { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link PutAliasResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public PutAliasResponse build() { - _checkSingleUse(); - - return new PutAliasResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link PutAliasResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - PutAliasResponse::setupPutAliasResponseDeserializer); - - protected static void setupPutAliasResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutDataLifecycleRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutDataLifecycleRequest.java deleted file mode 100644 index 00ad95dc1..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutDataLifecycleRequest.java +++ /dev/null @@ -1,474 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.ExpandWildcard; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.put_data_lifecycle.Request - -/** - * Update data stream lifecycles. Update the data stream lifecycle of the - * specified data streams. - * - * @see API - * specification - */ -@JsonpDeserializable -public class PutDataLifecycleRequest extends RequestBase implements JsonpSerializable { - @Nullable - private final Time dataRetention; - - @Nullable - private final DataStreamLifecycleDownsampling downsampling; - - private final List expandWildcards; - - @Nullable - private final Time masterTimeout; - - private final List name; - - @Nullable - private final Time timeout; - - // --------------------------------------------------------------------------------------------- - - private PutDataLifecycleRequest(Builder builder) { - - this.dataRetention = builder.dataRetention; - this.downsampling = builder.downsampling; - this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); - this.masterTimeout = builder.masterTimeout; - this.name = ApiTypeHelper.unmodifiableRequired(builder.name, this, "name"); - this.timeout = builder.timeout; - - } - - public static PutDataLifecycleRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code data_retention} - */ - @Nullable - public final Time dataRetention() { - return this.dataRetention; - } - - /** - * If defined, every backing index will execute the configured downsampling - * configuration after the backing index is not the data stream write index - * anymore. - *

- * API name: {@code downsampling} - */ - @Nullable - public final DataStreamLifecycleDownsampling downsampling() { - return this.downsampling; - } - - /** - * 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. - *

- * API name: {@code expand_wildcards} - */ - public final List expandWildcards() { - return this.expandWildcards; - } - - /** - * 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. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * Required - Comma-separated list of data streams used to limit the request. - * Supports wildcards (*). To target all data streams use - * * or _all. - *

- * API name: {@code name} - */ - public final List name() { - return this.name; - } - - /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. - *

- * API name: {@code timeout} - */ - @Nullable - public final Time timeout() { - return this.timeout; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.dataRetention != null) { - generator.writeKey("data_retention"); - this.dataRetention.serialize(generator, mapper); - - } - if (this.downsampling != null) { - generator.writeKey("downsampling"); - this.downsampling.serialize(generator, mapper); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link PutDataLifecycleRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private Time dataRetention; - - @Nullable - private DataStreamLifecycleDownsampling downsampling; - - @Nullable - private List expandWildcards; - - @Nullable - private Time masterTimeout; - - private List name; - - @Nullable - private Time timeout; - - /** - * 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. - *

- * API name: {@code data_retention} - */ - public final Builder dataRetention(@Nullable Time value) { - this.dataRetention = value; - return this; - } - - /** - * 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. - *

- * API name: {@code data_retention} - */ - public final Builder dataRetention(Function> fn) { - return this.dataRetention(fn.apply(new Time.Builder()).build()); - } - - /** - * If defined, every backing index will execute the configured downsampling - * configuration after the backing index is not the data stream write index - * anymore. - *

- * API name: {@code downsampling} - */ - public final Builder downsampling(@Nullable DataStreamLifecycleDownsampling value) { - this.downsampling = 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. - *

- * API name: {@code downsampling} - */ - public final Builder downsampling( - Function> fn) { - return this.downsampling(fn.apply(new DataStreamLifecycleDownsampling.Builder()).build()); - } - - /** - * 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. - *

- * API name: {@code expand_wildcards} - *

- * Adds all elements of list to expandWildcards. - */ - public final Builder expandWildcards(List list) { - this.expandWildcards = _listAddAll(this.expandWildcards, list); - 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. - *

- * API name: {@code expand_wildcards} - *

- * Adds one or more values to expandWildcards. - */ - public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { - this.expandWildcards = _listAdd(this.expandWildcards, value, 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Required - Comma-separated list of data streams used to limit the request. - * Supports wildcards (*). To target all data streams use - * * or _all. - *

- * API name: {@code name} - *

- * Adds all elements of list to name. - */ - public final Builder name(List list) { - this.name = _listAddAll(this.name, list); - return this; - } - - /** - * Required - Comma-separated list of data streams used to limit the request. - * Supports wildcards (*). To target all data streams use - * * or _all. - *

- * API name: {@code name} - *

- * Adds one or more values to name. - */ - public final Builder name(String value, String... values) { - this.name = _listAdd(this.name, value, values); - return this; - } - - /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. - *

- * API name: {@code timeout} - */ - public final Builder timeout(@Nullable Time value) { - this.timeout = 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. - *

- * API name: {@code timeout} - */ - public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link PutDataLifecycleRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public PutDataLifecycleRequest build() { - _checkSingleUse(); - - return new PutDataLifecycleRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link PutDataLifecycleRequest} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, PutDataLifecycleRequest::setupPutDataLifecycleRequestDeserializer); - - protected static void setupPutDataLifecycleRequestDeserializer( - ObjectDeserializer op) { - - op.add(Builder::dataRetention, Time._DESERIALIZER, "data_retention"); - op.add(Builder::downsampling, DataStreamLifecycleDownsampling._DESERIALIZER, "downsampling"); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.put_data_lifecycle}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.put_data_lifecycle", - - // Request method - request -> { - return "PUT"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_data_stream"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_lifecycle"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - params.put("name", request.name.stream().map(v -> v).collect(Collectors.joining(","))); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (ApiTypeHelper.isDefined(request.expandWildcards)) { - params.put("expand_wildcards", - request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); - } - if (request.timeout != null) { - params.put("timeout", request.timeout._toJsonString()); - } - return params; - - }, SimpleEndpoint.emptyMap(), true, PutDataLifecycleResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutDataLifecycleResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutDataLifecycleResponse.java deleted file mode 100644 index b88e96fe0..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutDataLifecycleResponse.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.put_data_lifecycle.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class PutDataLifecycleResponse extends AcknowledgedResponseBase { - // --------------------------------------------------------------------------------------------- - - private PutDataLifecycleResponse(Builder builder) { - super(builder); - - } - - public static PutDataLifecycleResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link PutDataLifecycleResponse}. - */ - - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder - implements - ObjectBuilder { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link PutDataLifecycleResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public PutDataLifecycleResponse build() { - _checkSingleUse(); - - return new PutDataLifecycleResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link PutDataLifecycleResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, PutDataLifecycleResponse::setupPutDataLifecycleResponseDeserializer); - - protected static void setupPutDataLifecycleResponseDeserializer( - ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutIndexTemplateRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutIndexTemplateRequest.java deleted file mode 100644 index f0ea33bcb..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutIndexTemplateRequest.java +++ /dev/null @@ -1,791 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.elasticsearch.indices.put_index_template.IndexTemplateMapping; -import co.elastic.clients.json.JsonData; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Long; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.put_index_template.Request - -/** - * Create or update an index template. Index templates define settings, - * mappings, and aliases that can be applied automatically to new indices. - * - * @see API - * specification - */ -@JsonpDeserializable -public class PutIndexTemplateRequest extends RequestBase implements JsonpSerializable { - private final Map meta; - - @Nullable - private final Boolean allowAutoCreate; - - @Nullable - private final String cause; - - private final List composedOf; - - @Nullable - private final Boolean create; - - @Nullable - private final DataStreamVisibility dataStream; - - @Nullable - private final Boolean deprecated; - - private final List ignoreMissingComponentTemplates; - - private final List indexPatterns; - - @Nullable - private final Time masterTimeout; - - private final String name; - - @Nullable - private final Long priority; - - @Nullable - private final IndexTemplateMapping template; - - @Nullable - private final Long version; - - // --------------------------------------------------------------------------------------------- - - private PutIndexTemplateRequest(Builder builder) { - - this.meta = ApiTypeHelper.unmodifiable(builder.meta); - this.allowAutoCreate = builder.allowAutoCreate; - this.cause = builder.cause; - this.composedOf = ApiTypeHelper.unmodifiable(builder.composedOf); - this.create = builder.create; - this.dataStream = builder.dataStream; - this.deprecated = builder.deprecated; - this.ignoreMissingComponentTemplates = ApiTypeHelper.unmodifiable(builder.ignoreMissingComponentTemplates); - this.indexPatterns = ApiTypeHelper.unmodifiable(builder.indexPatterns); - this.masterTimeout = builder.masterTimeout; - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.priority = builder.priority; - this.template = builder.template; - this.version = builder.version; - - } - - public static PutIndexTemplateRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Optional user metadata about the index template. May have any contents. This - * map is not automatically generated by Elasticsearch. - *

- * API name: {@code _meta} - */ - public final Map meta() { - return this.meta; - } - - /** - * This setting overrides the value of the action.auto_create_index - * cluster setting. If set to true in a template, then indices can - * be automatically created using that template even if auto-creation of indices - * is disabled via actions.auto_create_index. If set to - * false, then indices or data streams matching the template must - * always be explicitly created, and may never be automatically created. - *

- * API name: {@code allow_auto_create} - */ - @Nullable - public final Boolean allowAutoCreate() { - return this.allowAutoCreate; - } - - /** - * User defined reason for creating/updating the index template - *

- * API name: {@code cause} - */ - @Nullable - public final String cause() { - return this.cause; - } - - /** - * 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. - *

- * API name: {@code composed_of} - */ - public final List composedOf() { - return this.composedOf; - } - - /** - * If true, this request cannot replace or update existing index - * templates. - *

- * API name: {@code create} - */ - @Nullable - public final Boolean create() { - return this.create; - } - - /** - * 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. - *

- * API name: {@code data_stream} - */ - @Nullable - public final DataStreamVisibility dataStream() { - return this.dataStream; - } - - /** - * Marks this index template as deprecated. When creating or updating a - * non-deprecated index template that uses deprecated components, Elasticsearch - * will emit a deprecation warning. - *

- * API name: {@code deprecated} - */ - @Nullable - public final Boolean deprecated() { - return this.deprecated; - } - - /** - * The configuration option ignore_missing_component_templates can be used when - * an index template references a component template that might not exist - *

- * API name: {@code ignore_missing_component_templates} - */ - public final List ignoreMissingComponentTemplates() { - return this.ignoreMissingComponentTemplates; - } - - /** - * Name of the index template to create. - *

- * API name: {@code index_patterns} - */ - public final List indexPatterns() { - return this.indexPatterns; - } - - /** - * 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. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * Required - Index or template name - *

- * API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Priority to determine index template precedence when a new data stream or - * index is created. The index template with the highest priority is chosen. If - * no priority is specified the template is treated as though it is of priority - * 0 (lowest priority). This number is not automatically generated by - * Elasticsearch. - *

- * API name: {@code priority} - */ - @Nullable - public final Long priority() { - return this.priority; - } - - /** - * Template to be applied. It may optionally include an aliases, - * mappings, or settings configuration. - *

- * API name: {@code template} - */ - @Nullable - public final IndexTemplateMapping template() { - return this.template; - } - - /** - * Version number used to manage index templates externally. This number is not - * automatically generated by Elasticsearch. - *

- * API name: {@code version} - */ - @Nullable - public final Long version() { - return this.version; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.meta)) { - generator.writeKey("_meta"); - generator.writeStartObject(); - for (Map.Entry item0 : this.meta.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.allowAutoCreate != null) { - generator.writeKey("allow_auto_create"); - generator.write(this.allowAutoCreate); - - } - if (ApiTypeHelper.isDefined(this.composedOf)) { - generator.writeKey("composed_of"); - generator.writeStartArray(); - for (String item0 : this.composedOf) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (this.dataStream != null) { - generator.writeKey("data_stream"); - this.dataStream.serialize(generator, mapper); - - } - if (this.deprecated != null) { - generator.writeKey("deprecated"); - generator.write(this.deprecated); - - } - if (ApiTypeHelper.isDefined(this.ignoreMissingComponentTemplates)) { - generator.writeKey("ignore_missing_component_templates"); - generator.writeStartArray(); - for (String item0 : this.ignoreMissingComponentTemplates) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.indexPatterns)) { - generator.writeKey("index_patterns"); - generator.writeStartArray(); - for (String item0 : this.indexPatterns) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (this.priority != null) { - generator.writeKey("priority"); - generator.write(this.priority); - - } - if (this.template != null) { - generator.writeKey("template"); - this.template.serialize(generator, mapper); - - } - if (this.version != null) { - generator.writeKey("version"); - generator.write(this.version); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link PutIndexTemplateRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private Map meta; - - @Nullable - private Boolean allowAutoCreate; - - @Nullable - private String cause; - - @Nullable - private List composedOf; - - @Nullable - private Boolean create; - - @Nullable - private DataStreamVisibility dataStream; - - @Nullable - private Boolean deprecated; - - @Nullable - private List ignoreMissingComponentTemplates; - - @Nullable - private List indexPatterns; - - @Nullable - private Time masterTimeout; - - private String name; - - @Nullable - private Long priority; - - @Nullable - private IndexTemplateMapping template; - - @Nullable - private Long version; - - /** - * Optional user metadata about the index template. May have any contents. This - * map is not automatically generated by Elasticsearch. - *

- * API name: {@code _meta} - *

- * Adds all entries of map to meta. - */ - public final Builder meta(Map map) { - this.meta = _mapPutAll(this.meta, map); - return this; - } - - /** - * Optional user metadata about the index template. May have any contents. This - * map is not automatically generated by Elasticsearch. - *

- * API name: {@code _meta} - *

- * Adds an entry to meta. - */ - public final Builder meta(String key, JsonData value) { - this.meta = _mapPut(this.meta, key, value); - return this; - } - - /** - * This setting overrides the value of the action.auto_create_index - * cluster setting. If set to true in a template, then indices can - * be automatically created using that template even if auto-creation of indices - * is disabled via actions.auto_create_index. If set to - * false, then indices or data streams matching the template must - * always be explicitly created, and may never be automatically created. - *

- * API name: {@code allow_auto_create} - */ - public final Builder allowAutoCreate(@Nullable Boolean value) { - this.allowAutoCreate = value; - return this; - } - - /** - * User defined reason for creating/updating the index template - *

- * API name: {@code cause} - */ - public final Builder cause(@Nullable String value) { - this.cause = 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. - *

- * API name: {@code composed_of} - *

- * Adds all elements of list to composedOf. - */ - public final Builder composedOf(List list) { - this.composedOf = _listAddAll(this.composedOf, list); - 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. - *

- * API name: {@code composed_of} - *

- * Adds one or more values to composedOf. - */ - public final Builder composedOf(String value, String... values) { - this.composedOf = _listAdd(this.composedOf, value, values); - return this; - } - - /** - * If true, this request cannot replace or update existing index - * templates. - *

- * API name: {@code create} - */ - public final Builder create(@Nullable Boolean value) { - this.create = value; - return this; - } - - /** - * 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. - *

- * API name: {@code data_stream} - */ - public final Builder dataStream(@Nullable DataStreamVisibility value) { - this.dataStream = value; - return this; - } - - /** - * 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. - *

- * API name: {@code data_stream} - */ - public final Builder dataStream( - Function> fn) { - return this.dataStream(fn.apply(new DataStreamVisibility.Builder()).build()); - } - - /** - * Marks this index template as deprecated. When creating or updating a - * non-deprecated index template that uses deprecated components, Elasticsearch - * will emit a deprecation warning. - *

- * API name: {@code deprecated} - */ - public final Builder deprecated(@Nullable Boolean value) { - this.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 - *

- * API name: {@code ignore_missing_component_templates} - *

- * Adds all elements of list to - * ignoreMissingComponentTemplates. - */ - public final Builder ignoreMissingComponentTemplates(List list) { - this.ignoreMissingComponentTemplates = _listAddAll(this.ignoreMissingComponentTemplates, list); - return this; - } - - /** - * The configuration option ignore_missing_component_templates can be used when - * an index template references a component template that might not exist - *

- * API name: {@code ignore_missing_component_templates} - *

- * Adds one or more values to ignoreMissingComponentTemplates. - */ - public final Builder ignoreMissingComponentTemplates(String value, String... values) { - this.ignoreMissingComponentTemplates = _listAdd(this.ignoreMissingComponentTemplates, value, values); - return this; - } - - /** - * Name of the index template to create. - *

- * API name: {@code index_patterns} - *

- * Adds all elements of list to indexPatterns. - */ - public final Builder indexPatterns(List list) { - this.indexPatterns = _listAddAll(this.indexPatterns, list); - return this; - } - - /** - * Name of the index template to create. - *

- * API name: {@code index_patterns} - *

- * Adds one or more values to indexPatterns. - */ - public final Builder indexPatterns(String value, String... values) { - this.indexPatterns = _listAdd(this.indexPatterns, value, 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Required - Index or template name - *

- * API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * Priority to determine index template precedence when a new data stream or - * index is created. The index template with the highest priority is chosen. If - * no priority is specified the template is treated as though it is of priority - * 0 (lowest priority). This number is not automatically generated by - * Elasticsearch. - *

- * API name: {@code priority} - */ - public final Builder priority(@Nullable Long value) { - this.priority = value; - return this; - } - - /** - * Template to be applied. It may optionally include an aliases, - * mappings, or settings configuration. - *

- * API name: {@code template} - */ - public final Builder template(@Nullable IndexTemplateMapping value) { - this.template = value; - return this; - } - - /** - * Template to be applied. It may optionally include an aliases, - * mappings, or settings configuration. - *

- * API name: {@code template} - */ - public final Builder template(Function> fn) { - return this.template(fn.apply(new IndexTemplateMapping.Builder()).build()); - } - - /** - * Version number used to manage index templates externally. This number is not - * automatically generated by Elasticsearch. - *

- * API name: {@code version} - */ - public final Builder version(@Nullable Long value) { - this.version = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link PutIndexTemplateRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public PutIndexTemplateRequest build() { - _checkSingleUse(); - - return new PutIndexTemplateRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link PutIndexTemplateRequest} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, PutIndexTemplateRequest::setupPutIndexTemplateRequestDeserializer); - - protected static void setupPutIndexTemplateRequestDeserializer( - ObjectDeserializer op) { - - op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta"); - op.add(Builder::allowAutoCreate, JsonpDeserializer.booleanDeserializer(), "allow_auto_create"); - op.add(Builder::composedOf, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "composed_of"); - op.add(Builder::dataStream, DataStreamVisibility._DESERIALIZER, "data_stream"); - op.add(Builder::deprecated, JsonpDeserializer.booleanDeserializer(), "deprecated"); - op.add(Builder::ignoreMissingComponentTemplates, - JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "ignore_missing_component_templates"); - op.add(Builder::indexPatterns, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "index_patterns"); - op.add(Builder::priority, JsonpDeserializer.longDeserializer(), "priority"); - op.add(Builder::template, IndexTemplateMapping._DESERIALIZER, "template"); - op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version"); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.put_index_template}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.put_index_template", - - // Request method - request -> { - return "PUT"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_index_template"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - params.put("name", request.name); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (request.create != null) { - params.put("create", String.valueOf(request.create)); - } - if (request.cause != null) { - params.put("cause", request.cause); - } - return params; - - }, SimpleEndpoint.emptyMap(), true, PutIndexTemplateResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutIndexTemplateResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutIndexTemplateResponse.java deleted file mode 100644 index 461d66aa8..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutIndexTemplateResponse.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.put_index_template.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class PutIndexTemplateResponse extends AcknowledgedResponseBase { - // --------------------------------------------------------------------------------------------- - - private PutIndexTemplateResponse(Builder builder) { - super(builder); - - } - - public static PutIndexTemplateResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link PutIndexTemplateResponse}. - */ - - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder - implements - ObjectBuilder { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link PutIndexTemplateResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public PutIndexTemplateResponse build() { - _checkSingleUse(); - - return new PutIndexTemplateResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link PutIndexTemplateResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, PutIndexTemplateResponse::setupPutIndexTemplateResponseDeserializer); - - protected static void setupPutIndexTemplateResponseDeserializer( - ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutIndicesSettingsRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutIndicesSettingsRequest.java deleted file mode 100644 index 860a3a0ff..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutIndicesSettingsRequest.java +++ /dev/null @@ -1,538 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.ExpandWildcard; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import jakarta.json.stream.JsonParser; -import java.lang.Boolean; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.put_settings.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. - * - * @see API - * specification - */ -@JsonpDeserializable -public class PutIndicesSettingsRequest extends RequestBase implements JsonpSerializable { - @Nullable - private final Boolean allowNoIndices; - - private final List expandWildcards; - - @Nullable - private final Boolean flatSettings; - - @Nullable - private final Boolean ignoreUnavailable; - - private final List index; - - @Nullable - private final Time masterTimeout; - - @Nullable - private final Boolean preserveExisting; - - @Nullable - private final Time timeout; - - private final IndexSettings settings; - - // --------------------------------------------------------------------------------------------- - - private PutIndicesSettingsRequest(Builder builder) { - - this.allowNoIndices = builder.allowNoIndices; - this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); - this.flatSettings = builder.flatSettings; - this.ignoreUnavailable = builder.ignoreUnavailable; - this.index = ApiTypeHelper.unmodifiable(builder.index); - this.masterTimeout = builder.masterTimeout; - this.preserveExisting = builder.preserveExisting; - this.timeout = builder.timeout; - this.settings = ApiTypeHelper.requireNonNull(builder.settings, this, "settings"); - - } - - public static PutIndicesSettingsRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code allow_no_indices} - */ - @Nullable - public final Boolean allowNoIndices() { - return this.allowNoIndices; - } - - /** - * 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. - *

- * API name: {@code expand_wildcards} - */ - public final List expandWildcards() { - return this.expandWildcards; - } - - /** - * If true, returns settings in flat format. - *

- * API name: {@code flat_settings} - */ - @Nullable - public final Boolean flatSettings() { - return this.flatSettings; - } - - /** - * If true, returns settings in flat format. - *

- * API name: {@code ignore_unavailable} - */ - @Nullable - public final Boolean ignoreUnavailable() { - return this.ignoreUnavailable; - } - - /** - * 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. - *

- * API name: {@code index} - */ - public final List index() { - return this.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. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * If true, existing index settings remain unchanged. - *

- * API name: {@code preserve_existing} - */ - @Nullable - public final Boolean preserveExisting() { - return this.preserveExisting; - } - - /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. - *

- * API name: {@code timeout} - */ - @Nullable - public final Time timeout() { - return this.timeout; - } - - /** - * Required - Request body. - */ - public final IndexSettings settings() { - return this.settings; - } - - /** - * Serialize this value to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - this.settings.serialize(generator, mapper); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link PutIndicesSettingsRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private Boolean allowNoIndices; - - @Nullable - private List expandWildcards; - - @Nullable - private Boolean flatSettings; - - @Nullable - private Boolean ignoreUnavailable; - - @Nullable - private List index; - - @Nullable - private Time masterTimeout; - - @Nullable - private Boolean preserveExisting; - - @Nullable - private Time timeout; - - private IndexSettings 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. - *

- * API name: {@code allow_no_indices} - */ - public final Builder allowNoIndices(@Nullable Boolean value) { - this.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. - *

- * API name: {@code expand_wildcards} - *

- * Adds all elements of list to expandWildcards. - */ - public final Builder expandWildcards(List list) { - this.expandWildcards = _listAddAll(this.expandWildcards, list); - 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. - *

- * API name: {@code expand_wildcards} - *

- * Adds one or more values to expandWildcards. - */ - public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { - this.expandWildcards = _listAdd(this.expandWildcards, value, values); - return this; - } - - /** - * If true, returns settings in flat format. - *

- * API name: {@code flat_settings} - */ - public final Builder flatSettings(@Nullable Boolean value) { - this.flatSettings = value; - return this; - } - - /** - * If true, returns settings in flat format. - *

- * API name: {@code ignore_unavailable} - */ - public final Builder ignoreUnavailable(@Nullable Boolean value) { - this.ignoreUnavailable = 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. - *

- * API name: {@code index} - *

- * Adds all elements of list to index. - */ - public final Builder index(List list) { - this.index = _listAddAll(this.index, list); - 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. - *

- * API name: {@code index} - *

- * Adds one or more values to index. - */ - public final Builder index(String value, String... values) { - this.index = _listAdd(this.index, value, 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * If true, existing index settings remain unchanged. - *

- * API name: {@code preserve_existing} - */ - public final Builder preserveExisting(@Nullable Boolean value) { - this.preserveExisting = 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. - *

- * API name: {@code timeout} - */ - public final Builder timeout(@Nullable Time value) { - this.timeout = 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. - *

- * API name: {@code timeout} - */ - public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Required - Request body. - */ - public final Builder settings(IndexSettings value) { - this.settings = value; - return this; - } - - /** - * Required - Request body. - */ - public final Builder settings(Function> fn) { - return this.settings(fn.apply(new IndexSettings.Builder()).build()); - } - - @Override - public Builder withJson(JsonParser parser, JsonpMapper mapper) { - - @SuppressWarnings("unchecked") - IndexSettings value = (IndexSettings) IndexSettings._DESERIALIZER.deserialize(parser, mapper); - return this.settings(value); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link PutIndicesSettingsRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public PutIndicesSettingsRequest build() { - _checkSingleUse(); - - return new PutIndicesSettingsRequest(this); - } - } - - public static final JsonpDeserializer _DESERIALIZER = createPutIndicesSettingsRequestDeserializer(); - protected static JsonpDeserializer createPutIndicesSettingsRequestDeserializer() { - - JsonpDeserializer valueDeserializer = IndexSettings._DESERIALIZER; - - return JsonpDeserializer.of(valueDeserializer.acceptedEvents(), (parser, mapper, event) -> new Builder() - .settings(valueDeserializer.deserialize(parser, mapper, event)).build()); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.put_settings}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.put_settings", - - // Request method - request -> { - return "PUT"; - - }, - - // Request path - request -> { - final int _index = 1 << 0; - - int propsSet = 0; - - if (ApiTypeHelper.isDefined(request.index())) - propsSet |= _index; - - if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_settings"); - return buf.toString(); - } - if (propsSet == (_index)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_settings"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _index = 1 << 0; - - int propsSet = 0; - - if (ApiTypeHelper.isDefined(request.index())) - propsSet |= _index; - - if (propsSet == 0) { - } - if (propsSet == (_index)) { - params.put("index", request.index.stream().map(v -> v).collect(Collectors.joining(","))); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (request.flatSettings != null) { - params.put("flat_settings", String.valueOf(request.flatSettings)); - } - if (ApiTypeHelper.isDefined(request.expandWildcards)) { - params.put("expand_wildcards", - request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); - } - if (request.ignoreUnavailable != null) { - params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); - } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } - if (request.preserveExisting != null) { - params.put("preserve_existing", String.valueOf(request.preserveExisting)); - } - if (request.timeout != null) { - params.put("timeout", request.timeout._toJsonString()); - } - return params; - - }, SimpleEndpoint.emptyMap(), true, PutIndicesSettingsResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutIndicesSettingsResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutIndicesSettingsResponse.java deleted file mode 100644 index 138fb4511..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutIndicesSettingsResponse.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.put_settings.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class PutIndicesSettingsResponse extends AcknowledgedResponseBase { - // --------------------------------------------------------------------------------------------- - - private PutIndicesSettingsResponse(Builder builder) { - super(builder); - - } - - public static PutIndicesSettingsResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link PutIndicesSettingsResponse}. - */ - - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder - implements - ObjectBuilder { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link PutIndicesSettingsResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public PutIndicesSettingsResponse build() { - _checkSingleUse(); - - return new PutIndicesSettingsResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link PutIndicesSettingsResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, PutIndicesSettingsResponse::setupPutIndicesSettingsResponseDeserializer); - - protected static void setupPutIndicesSettingsResponseDeserializer( - ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutMappingRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutMappingRequest.java deleted file mode 100644 index f818dc02d..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutMappingRequest.java +++ /dev/null @@ -1,1030 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.ExpandWildcard; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.elasticsearch._types.mapping.DynamicMapping; -import co.elastic.clients.elasticsearch._types.mapping.DynamicTemplate; -import co.elastic.clients.elasticsearch._types.mapping.FieldNamesField; -import co.elastic.clients.elasticsearch._types.mapping.Property; -import co.elastic.clients.elasticsearch._types.mapping.RoutingField; -import co.elastic.clients.elasticsearch._types.mapping.RuntimeField; -import co.elastic.clients.elasticsearch._types.mapping.SourceField; -import co.elastic.clients.json.JsonData; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.put_mapping.Request - -/** - * Update field mappings. Adds new fields to an existing data stream or index. - * You can also use this API to change the search settings of existing fields. - * For data streams, these changes are applied to all backing indices by - * default. - * - * @see API - * specification - */ -@JsonpDeserializable -public class PutMappingRequest extends RequestBase implements JsonpSerializable { - @Nullable - private final FieldNamesField fieldNames; - - private final Map meta; - - @Nullable - private final RoutingField routing; - - @Nullable - private final SourceField source; - - @Nullable - private final Boolean allowNoIndices; - - @Nullable - private final Boolean dateDetection; - - @Nullable - private final DynamicMapping dynamic; - - private final List dynamicDateFormats; - - private final List> dynamicTemplates; - - private final List expandWildcards; - - @Nullable - private final Boolean ignoreUnavailable; - - private final List index; - - @Nullable - private final Time masterTimeout; - - @Nullable - private final Boolean numericDetection; - - private final Map properties; - - private final Map runtime; - - @Nullable - private final Time timeout; - - @Nullable - private final Boolean writeIndexOnly; - - // --------------------------------------------------------------------------------------------- - - private PutMappingRequest(Builder builder) { - - this.fieldNames = builder.fieldNames; - this.meta = ApiTypeHelper.unmodifiable(builder.meta); - this.routing = builder.routing; - this.source = builder.source; - this.allowNoIndices = builder.allowNoIndices; - this.dateDetection = builder.dateDetection; - this.dynamic = builder.dynamic; - this.dynamicDateFormats = ApiTypeHelper.unmodifiable(builder.dynamicDateFormats); - this.dynamicTemplates = ApiTypeHelper.unmodifiable(builder.dynamicTemplates); - this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); - this.ignoreUnavailable = builder.ignoreUnavailable; - this.index = ApiTypeHelper.unmodifiableRequired(builder.index, this, "index"); - this.masterTimeout = builder.masterTimeout; - this.numericDetection = builder.numericDetection; - this.properties = ApiTypeHelper.unmodifiable(builder.properties); - this.runtime = ApiTypeHelper.unmodifiable(builder.runtime); - this.timeout = builder.timeout; - this.writeIndexOnly = builder.writeIndexOnly; - - } - - public static PutMappingRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Control whether field names are enabled for the index. - *

- * API name: {@code _field_names} - */ - @Nullable - public final FieldNamesField fieldNames() { - return this.fieldNames; - } - - /** - * 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. - *

- * API name: {@code _meta} - */ - public final Map meta() { - return this.meta; - } - - /** - * Enable making a routing value required on indexed documents. - *

- * API name: {@code _routing} - */ - @Nullable - public final RoutingField routing() { - return this.routing; - } - - /** - * Control whether the _source field is enabled on the index. - *

- * API name: {@code _source} - */ - @Nullable - public final SourceField source() { - return this.source; - } - - /** - * 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. - *

- * API name: {@code allow_no_indices} - */ - @Nullable - public final Boolean allowNoIndices() { - return this.allowNoIndices; - } - - /** - * Controls whether dynamic date detection is enabled. - *

- * API name: {@code date_detection} - */ - @Nullable - public final Boolean dateDetection() { - return this.dateDetection; - } - - /** - * Controls whether new fields are added dynamically. - *

- * API name: {@code dynamic} - */ - @Nullable - public final DynamicMapping dynamic() { - return this.dynamic; - } - - /** - * 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. - *

- * API name: {@code dynamic_date_formats} - */ - public final List dynamicDateFormats() { - return this.dynamicDateFormats; - } - - /** - * Specify dynamic templates for the mapping. - *

- * API name: {@code dynamic_templates} - */ - public final List> dynamicTemplates() { - return this.dynamicTemplates; - } - - /** - * 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. - *

- * API name: {@code expand_wildcards} - */ - public final List expandWildcards() { - return this.expandWildcards; - } - - /** - * If false, the request returns an error if it targets a missing - * or closed index. - *

- * API name: {@code ignore_unavailable} - */ - @Nullable - public final Boolean ignoreUnavailable() { - return this.ignoreUnavailable; - } - - /** - * Required - 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. - *

- * API name: {@code index} - */ - public final List index() { - return this.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. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * Automatically map strings into numeric data types for all fields. - *

- * API name: {@code numeric_detection} - */ - @Nullable - public final Boolean numericDetection() { - return this.numericDetection; - } - - /** - * Mapping for a field. For new fields, this mapping can include: - *

    - *
  • Field name
  • - *
  • Field data type
  • - *
  • Mapping parameters
  • - *
- *

- * API name: {@code properties} - */ - public final Map properties() { - return this.properties; - } - - /** - * Mapping of runtime fields for the index. - *

- * API name: {@code runtime} - */ - public final Map runtime() { - return this.runtime; - } - - /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. - *

- * API name: {@code timeout} - */ - @Nullable - public final Time timeout() { - return this.timeout; - } - - /** - * If true, the mappings are applied only to the current write - * index for the target. - *

- * API name: {@code write_index_only} - */ - @Nullable - public final Boolean writeIndexOnly() { - return this.writeIndexOnly; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.fieldNames != null) { - generator.writeKey("_field_names"); - this.fieldNames.serialize(generator, mapper); - - } - if (ApiTypeHelper.isDefined(this.meta)) { - generator.writeKey("_meta"); - generator.writeStartObject(); - for (Map.Entry item0 : this.meta.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.routing != null) { - generator.writeKey("_routing"); - this.routing.serialize(generator, mapper); - - } - if (this.source != null) { - generator.writeKey("_source"); - this.source.serialize(generator, mapper); - - } - if (this.dateDetection != null) { - generator.writeKey("date_detection"); - generator.write(this.dateDetection); - - } - if (this.dynamic != null) { - generator.writeKey("dynamic"); - this.dynamic.serialize(generator, mapper); - } - if (ApiTypeHelper.isDefined(this.dynamicDateFormats)) { - generator.writeKey("dynamic_date_formats"); - generator.writeStartArray(); - for (String item0 : this.dynamicDateFormats) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.dynamicTemplates)) { - generator.writeKey("dynamic_templates"); - generator.writeStartArray(); - for (Map item0 : this.dynamicTemplates) { - generator.writeStartObject(); - if (item0 != null) { - for (Map.Entry item1 : item0.entrySet()) { - generator.writeKey(item1.getKey()); - item1.getValue().serialize(generator, mapper); - - } - } - generator.writeEnd(); - - } - generator.writeEnd(); - - } - if (this.numericDetection != null) { - generator.writeKey("numeric_detection"); - generator.write(this.numericDetection); - - } - if (ApiTypeHelper.isDefined(this.properties)) { - generator.writeKey("properties"); - generator.writeStartObject(); - for (Map.Entry item0 : this.properties.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.runtime)) { - generator.writeKey("runtime"); - generator.writeStartObject(); - for (Map.Entry item0 : this.runtime.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link PutMappingRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private FieldNamesField fieldNames; - - @Nullable - private Map meta; - - @Nullable - private RoutingField routing; - - @Nullable - private SourceField source; - - @Nullable - private Boolean allowNoIndices; - - @Nullable - private Boolean dateDetection; - - @Nullable - private DynamicMapping dynamic; - - @Nullable - private List dynamicDateFormats; - - @Nullable - private List> dynamicTemplates; - - @Nullable - private List expandWildcards; - - @Nullable - private Boolean ignoreUnavailable; - - private List index; - - @Nullable - private Time masterTimeout; - - @Nullable - private Boolean numericDetection; - - @Nullable - private Map properties; - - @Nullable - private Map runtime; - - @Nullable - private Time timeout; - - @Nullable - private Boolean writeIndexOnly; - - /** - * Control whether field names are enabled for the index. - *

- * API name: {@code _field_names} - */ - public final Builder fieldNames(@Nullable FieldNamesField value) { - this.fieldNames = value; - return this; - } - - /** - * Control whether field names are enabled for the index. - *

- * API name: {@code _field_names} - */ - public final Builder fieldNames(Function> fn) { - return this.fieldNames(fn.apply(new FieldNamesField.Builder()).build()); - } - - /** - * 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. - *

- * API name: {@code _meta} - *

- * Adds all entries of map to meta. - */ - public final Builder meta(Map map) { - this.meta = _mapPutAll(this.meta, map); - 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. - *

- * API name: {@code _meta} - *

- * Adds an entry to meta. - */ - public final Builder meta(String key, JsonData value) { - this.meta = _mapPut(this.meta, key, value); - return this; - } - - /** - * Enable making a routing value required on indexed documents. - *

- * API name: {@code _routing} - */ - public final Builder routing(@Nullable RoutingField value) { - this.routing = value; - return this; - } - - /** - * Enable making a routing value required on indexed documents. - *

- * API name: {@code _routing} - */ - public final Builder routing(Function> fn) { - return this.routing(fn.apply(new RoutingField.Builder()).build()); - } - - /** - * Control whether the _source field is enabled on the index. - *

- * API name: {@code _source} - */ - public final Builder source(@Nullable SourceField value) { - this.source = value; - return this; - } - - /** - * Control whether the _source field is enabled on the index. - *

- * API name: {@code _source} - */ - public final Builder source(Function> fn) { - return this.source(fn.apply(new SourceField.Builder()).build()); - } - - /** - * 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. - *

- * API name: {@code allow_no_indices} - */ - public final Builder allowNoIndices(@Nullable Boolean value) { - this.allowNoIndices = value; - return this; - } - - /** - * Controls whether dynamic date detection is enabled. - *

- * API name: {@code date_detection} - */ - public final Builder dateDetection(@Nullable Boolean value) { - this.dateDetection = value; - return this; - } - - /** - * Controls whether new fields are added dynamically. - *

- * API name: {@code dynamic} - */ - public final Builder dynamic(@Nullable DynamicMapping value) { - this.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. - *

- * API name: {@code dynamic_date_formats} - *

- * Adds all elements of list to dynamicDateFormats. - */ - public final Builder dynamicDateFormats(List list) { - this.dynamicDateFormats = _listAddAll(this.dynamicDateFormats, list); - 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. - *

- * API name: {@code dynamic_date_formats} - *

- * Adds one or more values to dynamicDateFormats. - */ - public final Builder dynamicDateFormats(String value, String... values) { - this.dynamicDateFormats = _listAdd(this.dynamicDateFormats, value, values); - return this; - } - - /** - * Specify dynamic templates for the mapping. - *

- * API name: {@code dynamic_templates} - *

- * Adds all elements of list to dynamicTemplates. - */ - public final Builder dynamicTemplates(List> list) { - this.dynamicTemplates = _listAddAll(this.dynamicTemplates, list); - return this; - } - - /** - * Specify dynamic templates for the mapping. - *

- * API name: {@code dynamic_templates} - *

- * Adds one or more values to dynamicTemplates. - */ - public final Builder dynamicTemplates(Map value, - Map... values) { - this.dynamicTemplates = _listAdd(this.dynamicTemplates, value, values); - 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. - *

- * API name: {@code expand_wildcards} - *

- * Adds all elements of list to expandWildcards. - */ - public final Builder expandWildcards(List list) { - this.expandWildcards = _listAddAll(this.expandWildcards, list); - 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. - *

- * API name: {@code expand_wildcards} - *

- * Adds one or more values to expandWildcards. - */ - public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { - this.expandWildcards = _listAdd(this.expandWildcards, value, values); - return this; - } - - /** - * If false, the request returns an error if it targets a missing - * or closed index. - *

- * API name: {@code ignore_unavailable} - */ - public final Builder ignoreUnavailable(@Nullable Boolean value) { - this.ignoreUnavailable = value; - return this; - } - - /** - * Required - 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. - *

- * API name: {@code index} - *

- * Adds all elements of list to index. - */ - public final Builder index(List list) { - this.index = _listAddAll(this.index, list); - return this; - } - - /** - * Required - 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. - *

- * API name: {@code index} - *

- * Adds one or more values to index. - */ - public final Builder index(String value, String... values) { - this.index = _listAdd(this.index, value, 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Automatically map strings into numeric data types for all fields. - *

- * API name: {@code numeric_detection} - */ - public final Builder numericDetection(@Nullable Boolean value) { - this.numericDetection = value; - return this; - } - - /** - * Mapping for a field. For new fields, this mapping can include: - *

    - *
  • Field name
  • - *
  • Field data type
  • - *
  • Mapping parameters
  • - *
- *

- * API name: {@code properties} - *

- * Adds all entries of map to properties. - */ - public final Builder properties(Map map) { - this.properties = _mapPutAll(this.properties, map); - return this; - } - - /** - * Mapping for a field. For new fields, this mapping can include: - *

    - *
  • Field name
  • - *
  • Field data type
  • - *
  • Mapping parameters
  • - *
- *

- * API name: {@code properties} - *

- * Adds an entry to properties. - */ - public final Builder properties(String key, Property value) { - this.properties = _mapPut(this.properties, key, value); - return this; - } - - /** - * Mapping for a field. For new fields, this mapping can include: - *

    - *
  • Field name
  • - *
  • Field data type
  • - *
  • Mapping parameters
  • - *
- *

- * API name: {@code properties} - *

- * Adds an entry to properties using a builder lambda. - */ - public final Builder properties(String key, Function> fn) { - return properties(key, fn.apply(new Property.Builder()).build()); - } - - /** - * Mapping of runtime fields for the index. - *

- * API name: {@code runtime} - *

- * Adds all entries of map to runtime. - */ - public final Builder runtime(Map map) { - this.runtime = _mapPutAll(this.runtime, map); - return this; - } - - /** - * Mapping of runtime fields for the index. - *

- * API name: {@code runtime} - *

- * Adds an entry to runtime. - */ - public final Builder runtime(String key, RuntimeField value) { - this.runtime = _mapPut(this.runtime, key, value); - return this; - } - - /** - * Mapping of runtime fields for the index. - *

- * API name: {@code runtime} - *

- * Adds an entry to runtime using a builder lambda. - */ - public final Builder runtime(String key, Function> fn) { - return runtime(key, fn.apply(new RuntimeField.Builder()).build()); - } - - /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. - *

- * API name: {@code timeout} - */ - public final Builder timeout(@Nullable Time value) { - this.timeout = 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. - *

- * API name: {@code timeout} - */ - public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); - } - - /** - * If true, the mappings are applied only to the current write - * index for the target. - *

- * API name: {@code write_index_only} - */ - public final Builder writeIndexOnly(@Nullable Boolean value) { - this.writeIndexOnly = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link PutMappingRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public PutMappingRequest build() { - _checkSingleUse(); - - return new PutMappingRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link PutMappingRequest} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, PutMappingRequest::setupPutMappingRequestDeserializer); - - protected static void setupPutMappingRequestDeserializer(ObjectDeserializer op) { - - op.add(Builder::fieldNames, FieldNamesField._DESERIALIZER, "_field_names"); - op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta"); - op.add(Builder::routing, RoutingField._DESERIALIZER, "_routing"); - op.add(Builder::source, SourceField._DESERIALIZER, "_source"); - op.add(Builder::dateDetection, JsonpDeserializer.booleanDeserializer(), "date_detection"); - op.add(Builder::dynamic, DynamicMapping._DESERIALIZER, "dynamic"); - op.add(Builder::dynamicDateFormats, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "dynamic_date_formats"); - op.add(Builder::dynamicTemplates, JsonpDeserializer.arrayDeserializer( - JsonpDeserializer.stringMapDeserializer(DynamicTemplate._DESERIALIZER)), "dynamic_templates"); - op.add(Builder::numericDetection, JsonpDeserializer.booleanDeserializer(), "numeric_detection"); - op.add(Builder::properties, JsonpDeserializer.stringMapDeserializer(Property._DESERIALIZER), "properties"); - op.add(Builder::runtime, JsonpDeserializer.stringMapDeserializer(RuntimeField._DESERIALIZER), "runtime"); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.put_mapping}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.put_mapping", - - // Request method - request -> { - return "PUT"; - - }, - - // Request path - request -> { - final int _index = 1 << 0; - - int propsSet = 0; - - propsSet |= _index; - - if (propsSet == (_index)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_mapping"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _index = 1 << 0; - - int propsSet = 0; - - propsSet |= _index; - - if (propsSet == (_index)) { - params.put("index", request.index.stream().map(v -> v).collect(Collectors.joining(","))); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (ApiTypeHelper.isDefined(request.expandWildcards)) { - params.put("expand_wildcards", - request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); - } - if (request.ignoreUnavailable != null) { - params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); - } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } - if (request.writeIndexOnly != null) { - params.put("write_index_only", String.valueOf(request.writeIndexOnly)); - } - if (request.timeout != null) { - params.put("timeout", request.timeout._toJsonString()); - } - return params; - - }, SimpleEndpoint.emptyMap(), true, PutMappingResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutMappingResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutMappingResponse.java deleted file mode 100644 index be50ff1ee..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutMappingResponse.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.IndicesResponseBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.put_mapping.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class PutMappingResponse extends IndicesResponseBase { - // --------------------------------------------------------------------------------------------- - - private PutMappingResponse(Builder builder) { - super(builder); - - } - - public static PutMappingResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link PutMappingResponse}. - */ - - public static class Builder extends IndicesResponseBase.AbstractBuilder - implements - ObjectBuilder { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link PutMappingResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public PutMappingResponse build() { - _checkSingleUse(); - - return new PutMappingResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link PutMappingResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, PutMappingResponse::setupPutMappingResponseDeserializer); - - protected static void setupPutMappingResponseDeserializer(ObjectDeserializer op) { - IndicesResponseBase.setupIndicesResponseBaseDeserializer(op); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutTemplateRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutTemplateRequest.java deleted file mode 100644 index 5565de8d4..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutTemplateRequest.java +++ /dev/null @@ -1,591 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.elasticsearch._types.mapping.TypeMapping; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Integer; -import java.lang.Long; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.put_template.Request - -/** - * Create or update an index template. Index templates define settings, - * mappings, and aliases that can be applied automatically to new indices. - * - * @see API - * specification - */ -@JsonpDeserializable -public class PutTemplateRequest extends RequestBase implements JsonpSerializable { - private final Map aliases; - - @Nullable - private final String cause; - - @Nullable - private final Boolean create; - - private final List indexPatterns; - - @Nullable - private final TypeMapping mappings; - - @Nullable - private final Time masterTimeout; - - private final String name; - - @Nullable - private final Integer order; - - @Nullable - private final IndexSettings settings; - - @Nullable - private final Long version; - - // --------------------------------------------------------------------------------------------- - - private PutTemplateRequest(Builder builder) { - - this.aliases = ApiTypeHelper.unmodifiable(builder.aliases); - this.cause = builder.cause; - this.create = builder.create; - this.indexPatterns = ApiTypeHelper.unmodifiable(builder.indexPatterns); - this.mappings = builder.mappings; - this.masterTimeout = builder.masterTimeout; - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.order = builder.order; - this.settings = builder.settings; - this.version = builder.version; - - } - - public static PutTemplateRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Aliases for the index. - *

- * API name: {@code aliases} - */ - public final Map aliases() { - return this.aliases; - } - - /** - * API name: {@code cause} - */ - @Nullable - public final String cause() { - return this.cause; - } - - /** - * If true, this request cannot replace or update existing index templates. - *

- * API name: {@code create} - */ - @Nullable - public final Boolean create() { - return this.create; - } - - /** - * Array of wildcard expressions used to match the names of indices during - * creation. - *

- * API name: {@code index_patterns} - */ - public final List indexPatterns() { - return this.indexPatterns; - } - - /** - * Mapping for fields in the index. - *

- * API name: {@code mappings} - */ - @Nullable - public final TypeMapping mappings() { - return this.mappings; - } - - /** - * 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. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * Required - The name of the template - *

- * API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Order in which Elasticsearch applies this template if index matches multiple - * templates. - *

- * Templates with lower 'order' values are merged first. Templates with higher - * 'order' values are merged later, overriding templates with lower values. - *

- * API name: {@code order} - */ - @Nullable - public final Integer order() { - return this.order; - } - - /** - * Configuration options for the index. - *

- * API name: {@code settings} - */ - @Nullable - public final IndexSettings settings() { - return this.settings; - } - - /** - * Version number used to manage index templates externally. This number is not - * automatically generated by Elasticsearch. - *

- * API name: {@code version} - */ - @Nullable - public final Long version() { - return this.version; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.aliases)) { - generator.writeKey("aliases"); - generator.writeStartObject(); - for (Map.Entry item0 : this.aliases.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.indexPatterns)) { - generator.writeKey("index_patterns"); - generator.writeStartArray(); - for (String item0 : this.indexPatterns) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (this.mappings != null) { - generator.writeKey("mappings"); - this.mappings.serialize(generator, mapper); - - } - if (this.order != null) { - generator.writeKey("order"); - generator.write(this.order); - - } - if (this.settings != null) { - generator.writeKey("settings"); - this.settings.serialize(generator, mapper); - - } - if (this.version != null) { - generator.writeKey("version"); - generator.write(this.version); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link PutTemplateRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private Map aliases; - - @Nullable - private String cause; - - @Nullable - private Boolean create; - - @Nullable - private List indexPatterns; - - @Nullable - private TypeMapping mappings; - - @Nullable - private Time masterTimeout; - - private String name; - - @Nullable - private Integer order; - - @Nullable - private IndexSettings settings; - - @Nullable - private Long version; - - /** - * Aliases for the index. - *

- * API name: {@code aliases} - *

- * Adds all entries of map to aliases. - */ - public final Builder aliases(Map map) { - this.aliases = _mapPutAll(this.aliases, map); - return this; - } - - /** - * Aliases for the index. - *

- * API name: {@code aliases} - *

- * Adds an entry to aliases. - */ - public final Builder aliases(String key, Alias value) { - this.aliases = _mapPut(this.aliases, key, value); - return this; - } - - /** - * Aliases for the index. - *

- * API name: {@code aliases} - *

- * Adds an entry to aliases using a builder lambda. - */ - public final Builder aliases(String key, Function> fn) { - return aliases(key, fn.apply(new Alias.Builder()).build()); - } - - /** - * API name: {@code cause} - */ - public final Builder cause(@Nullable String value) { - this.cause = value; - return this; - } - - /** - * If true, this request cannot replace or update existing index templates. - *

- * API name: {@code create} - */ - public final Builder create(@Nullable Boolean value) { - this.create = value; - return this; - } - - /** - * Array of wildcard expressions used to match the names of indices during - * creation. - *

- * API name: {@code index_patterns} - *

- * Adds all elements of list to indexPatterns. - */ - public final Builder indexPatterns(List list) { - this.indexPatterns = _listAddAll(this.indexPatterns, list); - return this; - } - - /** - * Array of wildcard expressions used to match the names of indices during - * creation. - *

- * API name: {@code index_patterns} - *

- * Adds one or more values to indexPatterns. - */ - public final Builder indexPatterns(String value, String... values) { - this.indexPatterns = _listAdd(this.indexPatterns, value, values); - return this; - } - - /** - * Mapping for fields in the index. - *

- * API name: {@code mappings} - */ - public final Builder mappings(@Nullable TypeMapping value) { - this.mappings = value; - return this; - } - - /** - * Mapping for fields in the index. - *

- * API name: {@code mappings} - */ - public final Builder mappings(Function> fn) { - return this.mappings(fn.apply(new TypeMapping.Builder()).build()); - } - - /** - * 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Required - The name of the template - *

- * API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * Order in which Elasticsearch applies this template if index matches multiple - * templates. - *

- * Templates with lower 'order' values are merged first. Templates with higher - * 'order' values are merged later, overriding templates with lower values. - *

- * API name: {@code order} - */ - public final Builder order(@Nullable Integer value) { - this.order = value; - return this; - } - - /** - * Configuration options for the index. - *

- * API name: {@code settings} - */ - public final Builder settings(@Nullable IndexSettings value) { - this.settings = value; - return this; - } - - /** - * Configuration options for the index. - *

- * API name: {@code settings} - */ - public final Builder settings(Function> fn) { - return this.settings(fn.apply(new IndexSettings.Builder()).build()); - } - - /** - * Version number used to manage index templates externally. This number is not - * automatically generated by Elasticsearch. - *

- * API name: {@code version} - */ - public final Builder version(@Nullable Long value) { - this.version = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link PutTemplateRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public PutTemplateRequest build() { - _checkSingleUse(); - - return new PutTemplateRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link PutTemplateRequest} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, PutTemplateRequest::setupPutTemplateRequestDeserializer); - - protected static void setupPutTemplateRequestDeserializer(ObjectDeserializer op) { - - op.add(Builder::aliases, JsonpDeserializer.stringMapDeserializer(Alias._DESERIALIZER), "aliases"); - op.add(Builder::indexPatterns, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "index_patterns"); - op.add(Builder::mappings, TypeMapping._DESERIALIZER, "mappings"); - op.add(Builder::order, JsonpDeserializer.integerDeserializer(), "order"); - op.add(Builder::settings, IndexSettings._DESERIALIZER, "settings"); - op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version"); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.put_template}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.put_template", - - // Request method - request -> { - return "PUT"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_template"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - params.put("name", request.name); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (request.create != null) { - params.put("create", String.valueOf(request.create)); - } - if (request.cause != null) { - params.put("cause", request.cause); - } - return params; - - }, SimpleEndpoint.emptyMap(), true, PutTemplateResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutTemplateResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutTemplateResponse.java deleted file mode 100644 index dd12b6c88..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/PutTemplateResponse.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.put_template.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class PutTemplateResponse extends AcknowledgedResponseBase { - // --------------------------------------------------------------------------------------------- - - private PutTemplateResponse(Builder builder) { - super(builder); - - } - - public static PutTemplateResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link PutTemplateResponse}. - */ - - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder - implements - ObjectBuilder { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link PutTemplateResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public PutTemplateResponse build() { - _checkSingleUse(); - - return new PutTemplateResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link PutTemplateResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, PutTemplateResponse::setupPutTemplateResponseDeserializer); - - protected static void setupPutTemplateResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/Queries.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/Queries.java deleted file mode 100644 index f5db74497..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/Queries.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.Queries - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class Queries implements JsonpSerializable { - @Nullable - private final CacheQueries cache; - - // --------------------------------------------------------------------------------------------- - - private Queries(Builder builder) { - - this.cache = builder.cache; - - } - - public static Queries of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code cache} - */ - @Nullable - public final CacheQueries cache() { - return this.cache; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.cache != null) { - generator.writeKey("cache"); - this.cache.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link Queries}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private CacheQueries cache; - - /** - * API name: {@code cache} - */ - public final Builder cache(@Nullable CacheQueries value) { - this.cache = value; - return this; - } - - /** - * API name: {@code cache} - */ - public final Builder cache(Function> fn) { - return this.cache(fn.apply(new CacheQueries.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link Queries}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public Queries build() { - _checkSingleUse(); - - return new Queries(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link Queries} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - Queries::setupQueriesDeserializer); - - protected static void setupQueriesDeserializer(ObjectDeserializer op) { - - op.add(Builder::cache, CacheQueries._DESERIALIZER, "cache"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/RefreshRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/RefreshRequest.java deleted file mode 100644 index 218b5a1c4..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/RefreshRequest.java +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.ExpandWildcard; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.refresh.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. - * - * @see API - * specification - */ - -public class RefreshRequest extends RequestBase { - @Nullable - private final Boolean allowNoIndices; - - private final List expandWildcards; - - @Nullable - private final Boolean ignoreUnavailable; - - private final List index; - - // --------------------------------------------------------------------------------------------- - - private RefreshRequest(Builder builder) { - - this.allowNoIndices = builder.allowNoIndices; - this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); - this.ignoreUnavailable = builder.ignoreUnavailable; - this.index = ApiTypeHelper.unmodifiable(builder.index); - - } - - public static RefreshRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code allow_no_indices} - */ - @Nullable - public final Boolean allowNoIndices() { - return this.allowNoIndices; - } - - /** - * 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. - *

- * API name: {@code expand_wildcards} - */ - public final List expandWildcards() { - return this.expandWildcards; - } - - /** - * If false, the request returns an error if it targets a missing - * or closed index. - *

- * API name: {@code ignore_unavailable} - */ - @Nullable - public final Boolean ignoreUnavailable() { - return this.ignoreUnavailable; - } - - /** - * 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. - *

- * API name: {@code index} - */ - public final List index() { - return this.index; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link RefreshRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { - @Nullable - private Boolean allowNoIndices; - - @Nullable - private List expandWildcards; - - @Nullable - private Boolean ignoreUnavailable; - - @Nullable - private List index; - - /** - * 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. - *

- * API name: {@code allow_no_indices} - */ - public final Builder allowNoIndices(@Nullable Boolean value) { - this.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. - *

- * API name: {@code expand_wildcards} - *

- * Adds all elements of list to expandWildcards. - */ - public final Builder expandWildcards(List list) { - this.expandWildcards = _listAddAll(this.expandWildcards, list); - 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. - *

- * API name: {@code expand_wildcards} - *

- * Adds one or more values to expandWildcards. - */ - public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { - this.expandWildcards = _listAdd(this.expandWildcards, value, values); - return this; - } - - /** - * If false, the request returns an error if it targets a missing - * or closed index. - *

- * API name: {@code ignore_unavailable} - */ - public final Builder ignoreUnavailable(@Nullable Boolean value) { - this.ignoreUnavailable = 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. - *

- * API name: {@code index} - *

- * Adds all elements of list to index. - */ - public final Builder index(List list) { - this.index = _listAddAll(this.index, list); - 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. - *

- * API name: {@code index} - *

- * Adds one or more values to index. - */ - public final Builder index(String value, String... values) { - this.index = _listAdd(this.index, value, values); - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link RefreshRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public RefreshRequest build() { - _checkSingleUse(); - - return new RefreshRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.refresh}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.refresh", - - // Request method - request -> { - return "POST"; - - }, - - // Request path - request -> { - final int _index = 1 << 0; - - int propsSet = 0; - - if (ApiTypeHelper.isDefined(request.index())) - propsSet |= _index; - - if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_refresh"); - return buf.toString(); - } - if (propsSet == (_index)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_refresh"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _index = 1 << 0; - - int propsSet = 0; - - if (ApiTypeHelper.isDefined(request.index())) - propsSet |= _index; - - if (propsSet == 0) { - } - if (propsSet == (_index)) { - params.put("index", request.index.stream().map(v -> v).collect(Collectors.joining(","))); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (ApiTypeHelper.isDefined(request.expandWildcards)) { - params.put("expand_wildcards", - request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); - } - if (request.ignoreUnavailable != null) { - params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); - } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, RefreshResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/RefreshResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/RefreshResponse.java deleted file mode 100644 index c000085e2..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/RefreshResponse.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ShardsOperationResponseBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.refresh.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class RefreshResponse extends ShardsOperationResponseBase { - // --------------------------------------------------------------------------------------------- - - private RefreshResponse(Builder builder) { - super(builder); - - } - - public static RefreshResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link RefreshResponse}. - */ - - public static class Builder extends ShardsOperationResponseBase.AbstractBuilder - implements - ObjectBuilder { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link RefreshResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public RefreshResponse build() { - _checkSingleUse(); - - return new RefreshResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link RefreshResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - RefreshResponse::setupRefreshResponseDeserializer); - - protected static void setupRefreshResponseDeserializer(ObjectDeserializer op) { - ShardsOperationResponseBase.setupShardsOperationResponseBaseDeserializer(op); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ResolveIndexRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ResolveIndexRequest.java deleted file mode 100644 index 3ce0ffc59..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ResolveIndexRequest.java +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.ExpandWildcard; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.resolve_index.Request - -/** - * Resolves the specified name(s) and/or index patterns for indices, aliases, - * and data streams. Multiple patterns and remote clusters are supported. - * - * @see API - * specification - */ - -public class ResolveIndexRequest extends RequestBase { - private final List expandWildcards; - - private final List name; - - // --------------------------------------------------------------------------------------------- - - private ResolveIndexRequest(Builder builder) { - - this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); - this.name = ApiTypeHelper.unmodifiableRequired(builder.name, this, "name"); - - } - - public static ResolveIndexRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code expand_wildcards} - */ - public final List expandWildcards() { - return this.expandWildcards; - } - - /** - * Required - 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. - *

- * API name: {@code name} - */ - public final List name() { - return this.name; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ResolveIndexRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private List expandWildcards; - - private List name; - - /** - * 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. - *

- * API name: {@code expand_wildcards} - *

- * Adds all elements of list to expandWildcards. - */ - public final Builder expandWildcards(List list) { - this.expandWildcards = _listAddAll(this.expandWildcards, list); - 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. - *

- * API name: {@code expand_wildcards} - *

- * Adds one or more values to expandWildcards. - */ - public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { - this.expandWildcards = _listAdd(this.expandWildcards, value, values); - return this; - } - - /** - * Required - 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. - *

- * API name: {@code name} - *

- * Adds all elements of list to name. - */ - public final Builder name(List list) { - this.name = _listAddAll(this.name, list); - return this; - } - - /** - * Required - 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. - *

- * API name: {@code name} - *

- * Adds one or more values to name. - */ - public final Builder name(String value, String... values) { - this.name = _listAdd(this.name, value, values); - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ResolveIndexRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ResolveIndexRequest build() { - _checkSingleUse(); - - return new ResolveIndexRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.resolve_index}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.resolve_index", - - // Request method - request -> { - return "GET"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_resolve"); - buf.append("/index"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - params.put("name", request.name.stream().map(v -> v).collect(Collectors.joining(","))); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (ApiTypeHelper.isDefined(request.expandWildcards)) { - params.put("expand_wildcards", - request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, ResolveIndexResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ResolveIndexResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ResolveIndexResponse.java deleted file mode 100644 index 789d67994..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ResolveIndexResponse.java +++ /dev/null @@ -1,293 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch.indices.resolve_index.ResolveIndexAliasItem; -import co.elastic.clients.elasticsearch.indices.resolve_index.ResolveIndexDataStreamsItem; -import co.elastic.clients.elasticsearch.indices.resolve_index.ResolveIndexItem; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.resolve_index.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class ResolveIndexResponse implements JsonpSerializable { - private final List indices; - - private final List aliases; - - private final List dataStreams; - - // --------------------------------------------------------------------------------------------- - - private ResolveIndexResponse(Builder builder) { - - this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices"); - this.aliases = ApiTypeHelper.unmodifiableRequired(builder.aliases, this, "aliases"); - this.dataStreams = ApiTypeHelper.unmodifiableRequired(builder.dataStreams, this, "dataStreams"); - - } - - public static ResolveIndexResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code indices} - */ - public final List indices() { - return this.indices; - } - - /** - * Required - API name: {@code aliases} - */ - public final List aliases() { - return this.aliases; - } - - /** - * Required - API name: {@code data_streams} - */ - public final List dataStreams() { - return this.dataStreams; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.indices)) { - generator.writeKey("indices"); - generator.writeStartArray(); - for (ResolveIndexItem item0 : this.indices) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.aliases)) { - generator.writeKey("aliases"); - generator.writeStartArray(); - for (ResolveIndexAliasItem item0 : this.aliases) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.dataStreams)) { - generator.writeKey("data_streams"); - generator.writeStartArray(); - for (ResolveIndexDataStreamsItem item0 : this.dataStreams) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ResolveIndexResponse}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private List indices; - - private List aliases; - - private List dataStreams; - - /** - * Required - API name: {@code indices} - *

- * Adds all elements of list to indices. - */ - public final Builder indices(List list) { - this.indices = _listAddAll(this.indices, list); - return this; - } - - /** - * Required - API name: {@code indices} - *

- * Adds one or more values to indices. - */ - public final Builder indices(ResolveIndexItem value, ResolveIndexItem... values) { - this.indices = _listAdd(this.indices, value, values); - return this; - } - - /** - * Required - API name: {@code indices} - *

- * Adds a value to indices using a builder lambda. - */ - public final Builder indices(Function> fn) { - return indices(fn.apply(new ResolveIndexItem.Builder()).build()); - } - - /** - * Required - API name: {@code aliases} - *

- * Adds all elements of list to aliases. - */ - public final Builder aliases(List list) { - this.aliases = _listAddAll(this.aliases, list); - return this; - } - - /** - * Required - API name: {@code aliases} - *

- * Adds one or more values to aliases. - */ - public final Builder aliases(ResolveIndexAliasItem value, ResolveIndexAliasItem... values) { - this.aliases = _listAdd(this.aliases, value, values); - return this; - } - - /** - * Required - API name: {@code aliases} - *

- * Adds a value to aliases using a builder lambda. - */ - public final Builder aliases(Function> fn) { - return aliases(fn.apply(new ResolveIndexAliasItem.Builder()).build()); - } - - /** - * Required - API name: {@code data_streams} - *

- * Adds all elements of list to dataStreams. - */ - public final Builder dataStreams(List list) { - this.dataStreams = _listAddAll(this.dataStreams, list); - return this; - } - - /** - * Required - API name: {@code data_streams} - *

- * Adds one or more values to dataStreams. - */ - public final Builder dataStreams(ResolveIndexDataStreamsItem value, ResolveIndexDataStreamsItem... values) { - this.dataStreams = _listAdd(this.dataStreams, value, values); - return this; - } - - /** - * Required - API name: {@code data_streams} - *

- * Adds a value to dataStreams using a builder lambda. - */ - public final Builder dataStreams( - Function> fn) { - return dataStreams(fn.apply(new ResolveIndexDataStreamsItem.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ResolveIndexResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ResolveIndexResponse build() { - _checkSingleUse(); - - return new ResolveIndexResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ResolveIndexResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, ResolveIndexResponse::setupResolveIndexResponseDeserializer); - - protected static void setupResolveIndexResponseDeserializer(ObjectDeserializer op) { - - op.add(Builder::indices, JsonpDeserializer.arrayDeserializer(ResolveIndexItem._DESERIALIZER), "indices"); - op.add(Builder::aliases, JsonpDeserializer.arrayDeserializer(ResolveIndexAliasItem._DESERIALIZER), "aliases"); - op.add(Builder::dataStreams, JsonpDeserializer.arrayDeserializer(ResolveIndexDataStreamsItem._DESERIALIZER), - "data_streams"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/RetentionLease.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/RetentionLease.java deleted file mode 100644 index 0111463c2..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/RetentionLease.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.RetentionLease - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class RetentionLease implements JsonpSerializable { - private final Time period; - - // --------------------------------------------------------------------------------------------- - - private RetentionLease(Builder builder) { - - this.period = ApiTypeHelper.requireNonNull(builder.period, this, "period"); - - } - - public static RetentionLease of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code period} - */ - public final Time period() { - return this.period; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("period"); - this.period.serialize(generator, mapper); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link RetentionLease}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Time period; - - /** - * Required - API name: {@code period} - */ - public final Builder period(Time value) { - this.period = value; - return this; - } - - /** - * Required - API name: {@code period} - */ - public final Builder period(Function> fn) { - return this.period(fn.apply(new Time.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link RetentionLease}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public RetentionLease build() { - _checkSingleUse(); - - return new RetentionLease(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link RetentionLease} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - RetentionLease::setupRetentionLeaseDeserializer); - - protected static void setupRetentionLeaseDeserializer(ObjectDeserializer op) { - - op.add(Builder::period, Time._DESERIALIZER, "period"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/RolloverRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/RolloverRequest.java deleted file mode 100644 index 6c6fb15d4..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/RolloverRequest.java +++ /dev/null @@ -1,643 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.elasticsearch._types.WaitForActiveShards; -import co.elastic.clients.elasticsearch._types.mapping.TypeMapping; -import co.elastic.clients.elasticsearch.indices.rollover.RolloverConditions; -import co.elastic.clients.json.JsonData; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.rollover.Request - -/** - * Roll over to a new index. Creates a new index for a data stream or index - * alias. - * - * @see API - * specification - */ -@JsonpDeserializable -public class RolloverRequest extends RequestBase implements JsonpSerializable { - private final String alias; - - private final Map aliases; - - @Nullable - private final RolloverConditions conditions; - - @Nullable - private final Boolean dryRun; - - @Nullable - private final TypeMapping mappings; - - @Nullable - private final Time masterTimeout; - - @Nullable - private final String newIndex; - - private final Map settings; - - @Nullable - private final Time timeout; - - @Nullable - private final WaitForActiveShards waitForActiveShards; - - // --------------------------------------------------------------------------------------------- - - private RolloverRequest(Builder builder) { - - this.alias = ApiTypeHelper.requireNonNull(builder.alias, this, "alias"); - this.aliases = ApiTypeHelper.unmodifiable(builder.aliases); - this.conditions = builder.conditions; - this.dryRun = builder.dryRun; - this.mappings = builder.mappings; - this.masterTimeout = builder.masterTimeout; - this.newIndex = builder.newIndex; - this.settings = ApiTypeHelper.unmodifiable(builder.settings); - this.timeout = builder.timeout; - this.waitForActiveShards = builder.waitForActiveShards; - - } - - public static RolloverRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Name of the data stream or index alias to roll over. - *

- * API name: {@code alias} - */ - public final String alias() { - return this.alias; - } - - /** - * Aliases for the target index. Data streams do not support this parameter. - *

- * API name: {@code aliases} - */ - public final Map aliases() { - return this.aliases; - } - - /** - * 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. - *

- * API name: {@code conditions} - */ - @Nullable - public final RolloverConditions conditions() { - return this.conditions; - } - - /** - * If true, checks whether the current index satisfies the - * specified conditions but does not perform a rollover. - *

- * API name: {@code dry_run} - */ - @Nullable - public final Boolean dryRun() { - return this.dryRun; - } - - /** - * Mapping for fields in the index. If specified, this mapping can include field - * names, field data types, and mapping paramaters. - *

- * API name: {@code mappings} - */ - @Nullable - public final TypeMapping mappings() { - return this.mappings; - } - - /** - * 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. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * Name of the index to create. Supports date math. Data streams do not support - * this parameter. - *

- * API name: {@code new_index} - */ - @Nullable - public final String newIndex() { - return this.newIndex; - } - - /** - * Configuration options for the index. Data streams do not support this - * parameter. - *

- * API name: {@code settings} - */ - public final Map settings() { - return this.settings; - } - - /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. - *

- * API name: {@code timeout} - */ - @Nullable - public final Time timeout() { - return this.timeout; - } - - /** - * 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). - *

- * API name: {@code wait_for_active_shards} - */ - @Nullable - public final WaitForActiveShards waitForActiveShards() { - return this.waitForActiveShards; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.aliases)) { - generator.writeKey("aliases"); - generator.writeStartObject(); - for (Map.Entry item0 : this.aliases.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.conditions != null) { - generator.writeKey("conditions"); - this.conditions.serialize(generator, mapper); - - } - if (this.mappings != null) { - generator.writeKey("mappings"); - this.mappings.serialize(generator, mapper); - - } - if (ApiTypeHelper.isDefined(this.settings)) { - generator.writeKey("settings"); - generator.writeStartObject(); - for (Map.Entry item0 : this.settings.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link RolloverRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { - private String alias; - - @Nullable - private Map aliases; - - @Nullable - private RolloverConditions conditions; - - @Nullable - private Boolean dryRun; - - @Nullable - private TypeMapping mappings; - - @Nullable - private Time masterTimeout; - - @Nullable - private String newIndex; - - @Nullable - private Map settings; - - @Nullable - private Time timeout; - - @Nullable - private WaitForActiveShards waitForActiveShards; - - /** - * Required - Name of the data stream or index alias to roll over. - *

- * API name: {@code alias} - */ - public final Builder alias(String value) { - this.alias = value; - return this; - } - - /** - * Aliases for the target index. Data streams do not support this parameter. - *

- * API name: {@code aliases} - *

- * Adds all entries of map to aliases. - */ - public final Builder aliases(Map map) { - this.aliases = _mapPutAll(this.aliases, map); - return this; - } - - /** - * Aliases for the target index. Data streams do not support this parameter. - *

- * API name: {@code aliases} - *

- * Adds an entry to aliases. - */ - public final Builder aliases(String key, Alias value) { - this.aliases = _mapPut(this.aliases, key, value); - return this; - } - - /** - * Aliases for the target index. Data streams do not support this parameter. - *

- * API name: {@code aliases} - *

- * Adds an entry to aliases using a builder lambda. - */ - public final Builder aliases(String key, Function> fn) { - return aliases(key, fn.apply(new Alias.Builder()).build()); - } - - /** - * 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. - *

- * API name: {@code conditions} - */ - public final Builder conditions(@Nullable RolloverConditions value) { - this.conditions = value; - 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. - *

- * API name: {@code conditions} - */ - public final Builder conditions(Function> fn) { - return this.conditions(fn.apply(new RolloverConditions.Builder()).build()); - } - - /** - * If true, checks whether the current index satisfies the - * specified conditions but does not perform a rollover. - *

- * API name: {@code dry_run} - */ - public final Builder dryRun(@Nullable Boolean value) { - this.dryRun = value; - return this; - } - - /** - * Mapping for fields in the index. If specified, this mapping can include field - * names, field data types, and mapping paramaters. - *

- * API name: {@code mappings} - */ - public final Builder mappings(@Nullable TypeMapping value) { - this.mappings = value; - return this; - } - - /** - * Mapping for fields in the index. If specified, this mapping can include field - * names, field data types, and mapping paramaters. - *

- * API name: {@code mappings} - */ - public final Builder mappings(Function> fn) { - return this.mappings(fn.apply(new TypeMapping.Builder()).build()); - } - - /** - * 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Name of the index to create. Supports date math. Data streams do not support - * this parameter. - *

- * API name: {@code new_index} - */ - public final Builder newIndex(@Nullable String value) { - this.newIndex = value; - return this; - } - - /** - * Configuration options for the index. Data streams do not support this - * parameter. - *

- * API name: {@code settings} - *

- * Adds all entries of map to settings. - */ - public final Builder settings(Map map) { - this.settings = _mapPutAll(this.settings, map); - return this; - } - - /** - * Configuration options for the index. Data streams do not support this - * parameter. - *

- * API name: {@code settings} - *

- * Adds an entry to settings. - */ - public final Builder settings(String key, JsonData value) { - this.settings = _mapPut(this.settings, key, 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. - *

- * API name: {@code timeout} - */ - public final Builder timeout(@Nullable Time value) { - this.timeout = 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. - *

- * API name: {@code timeout} - */ - public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); - } - - /** - * 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). - *

- * API name: {@code wait_for_active_shards} - */ - public final Builder waitForActiveShards(@Nullable WaitForActiveShards value) { - this.waitForActiveShards = 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). - *

- * API name: {@code wait_for_active_shards} - */ - public final Builder waitForActiveShards( - Function> fn) { - return this.waitForActiveShards(fn.apply(new WaitForActiveShards.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link RolloverRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public RolloverRequest build() { - _checkSingleUse(); - - return new RolloverRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link RolloverRequest} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - RolloverRequest::setupRolloverRequestDeserializer); - - protected static void setupRolloverRequestDeserializer(ObjectDeserializer op) { - - op.add(Builder::aliases, JsonpDeserializer.stringMapDeserializer(Alias._DESERIALIZER), "aliases"); - op.add(Builder::conditions, RolloverConditions._DESERIALIZER, "conditions"); - op.add(Builder::mappings, TypeMapping._DESERIALIZER, "mappings"); - op.add(Builder::settings, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "settings"); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.rollover}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.rollover", - - // Request method - request -> { - return "POST"; - - }, - - // Request path - request -> { - final int _newIndex = 1 << 0; - final int _alias = 1 << 1; - - int propsSet = 0; - - if (request.newIndex() != null) - propsSet |= _newIndex; - propsSet |= _alias; - - if (propsSet == (_alias)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.alias, buf); - buf.append("/_rollover"); - return buf.toString(); - } - if (propsSet == (_alias | _newIndex)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.alias, buf); - buf.append("/_rollover"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.newIndex, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _newIndex = 1 << 0; - final int _alias = 1 << 1; - - int propsSet = 0; - - if (request.newIndex() != null) - propsSet |= _newIndex; - propsSet |= _alias; - - if (propsSet == (_alias)) { - params.put("alias", request.alias); - } - if (propsSet == (_alias | _newIndex)) { - params.put("alias", request.alias); - params.put("newIndex", request.newIndex); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (request.waitForActiveShards != null) { - params.put("wait_for_active_shards", request.waitForActiveShards._toJsonString()); - } - if (request.dryRun != null) { - params.put("dry_run", String.valueOf(request.dryRun)); - } - if (request.timeout != null) { - params.put("timeout", request.timeout._toJsonString()); - } - return params; - - }, SimpleEndpoint.emptyMap(), true, RolloverResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/RolloverResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/RolloverResponse.java deleted file mode 100644 index 1e54c4672..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/RolloverResponse.java +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.AcknowledgedResponse; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.rollover.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class RolloverResponse implements AcknowledgedResponse, JsonpSerializable { - private final boolean acknowledged; - - private final Map conditions; - - private final boolean dryRun; - - private final String newIndex; - - private final String oldIndex; - - private final boolean rolledOver; - - private final boolean shardsAcknowledged; - - // --------------------------------------------------------------------------------------------- - - private RolloverResponse(Builder builder) { - - this.acknowledged = ApiTypeHelper.requireNonNull(builder.acknowledged, this, "acknowledged"); - this.conditions = ApiTypeHelper.unmodifiableRequired(builder.conditions, this, "conditions"); - this.dryRun = ApiTypeHelper.requireNonNull(builder.dryRun, this, "dryRun"); - this.newIndex = ApiTypeHelper.requireNonNull(builder.newIndex, this, "newIndex"); - this.oldIndex = ApiTypeHelper.requireNonNull(builder.oldIndex, this, "oldIndex"); - this.rolledOver = ApiTypeHelper.requireNonNull(builder.rolledOver, this, "rolledOver"); - this.shardsAcknowledged = ApiTypeHelper.requireNonNull(builder.shardsAcknowledged, this, "shardsAcknowledged"); - - } - - public static RolloverResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code acknowledged} - */ - public final boolean acknowledged() { - return this.acknowledged; - } - - /** - * Required - API name: {@code conditions} - */ - public final Map conditions() { - return this.conditions; - } - - /** - * Required - API name: {@code dry_run} - */ - public final boolean dryRun() { - return this.dryRun; - } - - /** - * Required - API name: {@code new_index} - */ - public final String newIndex() { - return this.newIndex; - } - - /** - * Required - API name: {@code old_index} - */ - public final String oldIndex() { - return this.oldIndex; - } - - /** - * Required - API name: {@code rolled_over} - */ - public final boolean rolledOver() { - return this.rolledOver; - } - - /** - * Required - API name: {@code shards_acknowledged} - */ - public final boolean shardsAcknowledged() { - return this.shardsAcknowledged; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("acknowledged"); - generator.write(this.acknowledged); - - if (ApiTypeHelper.isDefined(this.conditions)) { - generator.writeKey("conditions"); - generator.writeStartObject(); - for (Map.Entry item0 : this.conditions.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); - - } - generator.writeKey("dry_run"); - generator.write(this.dryRun); - - generator.writeKey("new_index"); - generator.write(this.newIndex); - - generator.writeKey("old_index"); - generator.write(this.oldIndex); - - generator.writeKey("rolled_over"); - generator.write(this.rolledOver); - - generator.writeKey("shards_acknowledged"); - generator.write(this.shardsAcknowledged); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link RolloverResponse}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Boolean acknowledged; - - private Map conditions; - - private Boolean dryRun; - - private String newIndex; - - private String oldIndex; - - private Boolean rolledOver; - - private Boolean shardsAcknowledged; - - /** - * Required - API name: {@code acknowledged} - */ - public final Builder acknowledged(boolean value) { - this.acknowledged = value; - return this; - } - - /** - * Required - API name: {@code conditions} - *

- * Adds all entries of map to conditions. - */ - public final Builder conditions(Map map) { - this.conditions = _mapPutAll(this.conditions, map); - return this; - } - - /** - * Required - API name: {@code conditions} - *

- * Adds an entry to conditions. - */ - public final Builder conditions(String key, Boolean value) { - this.conditions = _mapPut(this.conditions, key, value); - return this; - } - - /** - * Required - API name: {@code dry_run} - */ - public final Builder dryRun(boolean value) { - this.dryRun = value; - return this; - } - - /** - * Required - API name: {@code new_index} - */ - public final Builder newIndex(String value) { - this.newIndex = value; - return this; - } - - /** - * Required - API name: {@code old_index} - */ - public final Builder oldIndex(String value) { - this.oldIndex = value; - return this; - } - - /** - * Required - API name: {@code rolled_over} - */ - public final Builder rolledOver(boolean value) { - this.rolledOver = value; - return this; - } - - /** - * Required - API name: {@code shards_acknowledged} - */ - public final Builder shardsAcknowledged(boolean value) { - this.shardsAcknowledged = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link RolloverResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public RolloverResponse build() { - _checkSingleUse(); - - return new RolloverResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link RolloverResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - RolloverResponse::setupRolloverResponseDeserializer); - - protected static void setupRolloverResponseDeserializer(ObjectDeserializer op) { - - op.add(Builder::acknowledged, JsonpDeserializer.booleanDeserializer(), "acknowledged"); - op.add(Builder::conditions, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.booleanDeserializer()), - "conditions"); - op.add(Builder::dryRun, JsonpDeserializer.booleanDeserializer(), "dry_run"); - op.add(Builder::newIndex, JsonpDeserializer.stringDeserializer(), "new_index"); - op.add(Builder::oldIndex, JsonpDeserializer.stringDeserializer(), "old_index"); - op.add(Builder::rolledOver, JsonpDeserializer.booleanDeserializer(), "rolled_over"); - op.add(Builder::shardsAcknowledged, JsonpDeserializer.booleanDeserializer(), "shards_acknowledged"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SearchIdle.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SearchIdle.java deleted file mode 100644 index b0d492f77..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SearchIdle.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.SearchIdle - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class SearchIdle implements JsonpSerializable { - @Nullable - private final Time after; - - // --------------------------------------------------------------------------------------------- - - private SearchIdle(Builder builder) { - - this.after = builder.after; - - } - - public static SearchIdle of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code after} - */ - @Nullable - public final Time after() { - return this.after; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.after != null) { - generator.writeKey("after"); - this.after.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SearchIdle}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private Time after; - - /** - * API name: {@code after} - */ - public final Builder after(@Nullable Time value) { - this.after = value; - return this; - } - - /** - * API name: {@code after} - */ - public final Builder after(Function> fn) { - return this.after(fn.apply(new Time.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link SearchIdle}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SearchIdle build() { - _checkSingleUse(); - - return new SearchIdle(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SearchIdle} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - SearchIdle::setupSearchIdleDeserializer); - - protected static void setupSearchIdleDeserializer(ObjectDeserializer op) { - - op.add(Builder::after, Time._DESERIALIZER, "after"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SegmentSortMissing.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SegmentSortMissing.java deleted file mode 100644 index 7cfbf1b3a..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SegmentSortMissing.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum SegmentSortMissing implements JsonEnum { - Last("_last"), - - First("_first"), - - ; - - private final String jsonValue; - - SegmentSortMissing(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - SegmentSortMissing.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SegmentSortMode.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SegmentSortMode.java deleted file mode 100644 index b2625620c..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SegmentSortMode.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum SegmentSortMode implements JsonEnum { - Min("min", "MIN"), - - Max("max", "MAX"), - - ; - - private final String jsonValue; - private final String[] aliases; - - SegmentSortMode(String jsonValue, String... aliases) { - this.jsonValue = jsonValue; - this.aliases = aliases; - } - - public String jsonValue() { - return this.jsonValue; - } - - public String[] aliases() { - return this.aliases; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - SegmentSortMode.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SegmentSortOrder.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SegmentSortOrder.java deleted file mode 100644 index 565f50904..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SegmentSortOrder.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum SegmentSortOrder implements JsonEnum { - Asc("asc", "ASC"), - - Desc("desc", "DESC"), - - ; - - private final String jsonValue; - private final String[] aliases; - - SegmentSortOrder(String jsonValue, String... aliases) { - this.jsonValue = jsonValue; - this.aliases = aliases; - } - - public String jsonValue() { - return this.jsonValue; - } - - public String[] aliases() { - return this.aliases; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - SegmentSortOrder.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsAnalyze.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsAnalyze.java deleted file mode 100644 index eb547c319..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsAnalyze.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Integer; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.SettingsAnalyze - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class SettingsAnalyze implements JsonpSerializable { - @Nullable - private final Integer maxTokenCount; - - // --------------------------------------------------------------------------------------------- - - private SettingsAnalyze(Builder builder) { - - this.maxTokenCount = builder.maxTokenCount; - - } - - public static SettingsAnalyze of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code max_token_count} - */ - @Nullable - public final Integer maxTokenCount() { - return this.maxTokenCount; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.maxTokenCount != null) { - generator.writeKey("max_token_count"); - generator.write(this.maxTokenCount); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SettingsAnalyze}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private Integer maxTokenCount; - - /** - * API name: {@code max_token_count} - */ - public final Builder maxTokenCount(@Nullable Integer value) { - this.maxTokenCount = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link SettingsAnalyze}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SettingsAnalyze build() { - _checkSingleUse(); - - return new SettingsAnalyze(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SettingsAnalyze} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - SettingsAnalyze::setupSettingsAnalyzeDeserializer); - - protected static void setupSettingsAnalyzeDeserializer(ObjectDeserializer op) { - - op.add(Builder::maxTokenCount, JsonpDeserializer.integerDeserializer(), "max_token_count"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsHighlight.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsHighlight.java deleted file mode 100644 index 5148f36e6..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsHighlight.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Integer; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.SettingsHighlight - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class SettingsHighlight implements JsonpSerializable { - @Nullable - private final Integer maxAnalyzedOffset; - - // --------------------------------------------------------------------------------------------- - - private SettingsHighlight(Builder builder) { - - this.maxAnalyzedOffset = builder.maxAnalyzedOffset; - - } - - public static SettingsHighlight of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code max_analyzed_offset} - */ - @Nullable - public final Integer maxAnalyzedOffset() { - return this.maxAnalyzedOffset; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.maxAnalyzedOffset != null) { - generator.writeKey("max_analyzed_offset"); - generator.write(this.maxAnalyzedOffset); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SettingsHighlight}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private Integer maxAnalyzedOffset; - - /** - * API name: {@code max_analyzed_offset} - */ - public final Builder maxAnalyzedOffset(@Nullable Integer value) { - this.maxAnalyzedOffset = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link SettingsHighlight}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SettingsHighlight build() { - _checkSingleUse(); - - return new SettingsHighlight(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SettingsHighlight} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, SettingsHighlight::setupSettingsHighlightDeserializer); - - protected static void setupSettingsHighlightDeserializer(ObjectDeserializer op) { - - op.add(Builder::maxAnalyzedOffset, JsonpDeserializer.integerDeserializer(), "max_analyzed_offset"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsQueryString.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsQueryString.java deleted file mode 100644 index 4251c53c9..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsQueryString.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.SettingsQueryString - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class SettingsQueryString implements JsonpSerializable { - private final boolean lenient; - - // --------------------------------------------------------------------------------------------- - - private SettingsQueryString(Builder builder) { - - this.lenient = ApiTypeHelper.requireNonNull(builder.lenient, this, "lenient"); - - } - - public static SettingsQueryString of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code lenient} - */ - public final boolean lenient() { - return this.lenient; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("lenient"); - generator.write(this.lenient); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SettingsQueryString}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private Boolean lenient; - - /** - * Required - API name: {@code lenient} - */ - public final Builder lenient(boolean value) { - this.lenient = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link SettingsQueryString}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SettingsQueryString build() { - _checkSingleUse(); - - return new SettingsQueryString(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SettingsQueryString} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, SettingsQueryString::setupSettingsQueryStringDeserializer); - - protected static void setupSettingsQueryStringDeserializer(ObjectDeserializer op) { - - op.add(Builder::lenient, JsonpDeserializer.booleanDeserializer(), "lenient"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSearch.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSearch.java deleted file mode 100644 index 94ab24661..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSearch.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.SettingsSearch - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class SettingsSearch implements JsonpSerializable { - @Nullable - private final SearchIdle idle; - - @Nullable - private final SlowlogSettings slowlog; - - // --------------------------------------------------------------------------------------------- - - private SettingsSearch(Builder builder) { - - this.idle = builder.idle; - this.slowlog = builder.slowlog; - - } - - public static SettingsSearch of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code idle} - */ - @Nullable - public final SearchIdle idle() { - return this.idle; - } - - /** - * API name: {@code slowlog} - */ - @Nullable - public final SlowlogSettings slowlog() { - return this.slowlog; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.idle != null) { - generator.writeKey("idle"); - this.idle.serialize(generator, mapper); - - } - if (this.slowlog != null) { - generator.writeKey("slowlog"); - this.slowlog.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SettingsSearch}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private SearchIdle idle; - - @Nullable - private SlowlogSettings slowlog; - - /** - * API name: {@code idle} - */ - public final Builder idle(@Nullable SearchIdle value) { - this.idle = value; - return this; - } - - /** - * API name: {@code idle} - */ - public final Builder idle(Function> fn) { - return this.idle(fn.apply(new SearchIdle.Builder()).build()); - } - - /** - * API name: {@code slowlog} - */ - public final Builder slowlog(@Nullable SlowlogSettings value) { - this.slowlog = value; - return this; - } - - /** - * API name: {@code slowlog} - */ - public final Builder slowlog(Function> fn) { - return this.slowlog(fn.apply(new SlowlogSettings.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link SettingsSearch}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SettingsSearch build() { - _checkSingleUse(); - - return new SettingsSearch(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SettingsSearch} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - SettingsSearch::setupSettingsSearchDeserializer); - - protected static void setupSettingsSearchDeserializer(ObjectDeserializer op) { - - op.add(Builder::idle, SearchIdle._DESERIALIZER, "idle"); - op.add(Builder::slowlog, SlowlogSettings._DESERIALIZER, "slowlog"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarity.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarity.java deleted file mode 100644 index 60d6d0d0f..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarity.java +++ /dev/null @@ -1,410 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.TaggedUnion; -import co.elastic.clients.util.TaggedUnionUtils; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.SettingsSimilarity - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class SettingsSimilarity - implements - TaggedUnion, - JsonpSerializable { - - /** - * {@link SettingsSimilarity} variant kinds. - * - * @see API - * specification - */ - - public enum Kind implements JsonEnum { - Bm25("BM25"), - - Boolean("boolean"), - - Dfi("DFI"), - - Dfr("DFR"), - - Ib("IB"), - - LMDirichlet("LMDirichlet"), - - LMJelinekMercer("LMJelinekMercer"), - - Scripted("scripted"), - - ; - - private final String jsonValue; - - Kind(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - } - - private final Kind _kind; - private final SettingsSimilarityVariant _value; - - @Override - public final Kind _kind() { - return _kind; - } - - @Override - public final SettingsSimilarityVariant _get() { - return _value; - } - - public SettingsSimilarity(SettingsSimilarityVariant value) { - - this._kind = ApiTypeHelper.requireNonNull(value._settingsSimilarityKind(), this, ""); - this._value = ApiTypeHelper.requireNonNull(value, this, ""); - - } - - private SettingsSimilarity(Builder builder) { - - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - - } - - public static SettingsSimilarity of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Is this variant instance of kind {@code BM25}? - */ - public boolean isBm25() { - return _kind == Kind.Bm25; - } - - /** - * Get the {@code BM25} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code BM25} kind. - */ - public SettingsSimilarityBm25 bm25() { - return TaggedUnionUtils.get(this, Kind.Bm25); - } - - /** - * Is this variant instance of kind {@code boolean}? - */ - public boolean isBoolean() { - return _kind == Kind.Boolean; - } - - /** - * Get the {@code boolean} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code boolean} kind. - */ - public SettingsSimilarityBoolean boolean_() { - return TaggedUnionUtils.get(this, Kind.Boolean); - } - - /** - * Is this variant instance of kind {@code DFI}? - */ - public boolean isDfi() { - return _kind == Kind.Dfi; - } - - /** - * Get the {@code DFI} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code DFI} kind. - */ - public SettingsSimilarityDfi dfi() { - return TaggedUnionUtils.get(this, Kind.Dfi); - } - - /** - * Is this variant instance of kind {@code DFR}? - */ - public boolean isDfr() { - return _kind == Kind.Dfr; - } - - /** - * Get the {@code DFR} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code DFR} kind. - */ - public SettingsSimilarityDfr dfr() { - return TaggedUnionUtils.get(this, Kind.Dfr); - } - - /** - * Is this variant instance of kind {@code IB}? - */ - public boolean isIb() { - return _kind == Kind.Ib; - } - - /** - * Get the {@code IB} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code IB} kind. - */ - public SettingsSimilarityIb ib() { - return TaggedUnionUtils.get(this, Kind.Ib); - } - - /** - * Is this variant instance of kind {@code LMDirichlet}? - */ - public boolean isLMDirichlet() { - return _kind == Kind.LMDirichlet; - } - - /** - * Get the {@code LMDirichlet} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code LMDirichlet} kind. - */ - public SettingsSimilarityLmd lmdirichlet() { - return TaggedUnionUtils.get(this, Kind.LMDirichlet); - } - - /** - * Is this variant instance of kind {@code LMJelinekMercer}? - */ - public boolean isLMJelinekMercer() { - return _kind == Kind.LMJelinekMercer; - } - - /** - * Get the {@code LMJelinekMercer} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code LMJelinekMercer} - * kind. - */ - public SettingsSimilarityLmj lmjelinekmercer() { - return TaggedUnionUtils.get(this, Kind.LMJelinekMercer); - } - - /** - * Is this variant instance of kind {@code scripted}? - */ - public boolean isScripted() { - return _kind == Kind.Scripted; - } - - /** - * Get the {@code scripted} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code scripted} kind. - */ - public SettingsSimilarityScripted scripted() { - return TaggedUnionUtils.get(this, Kind.Scripted); - } - - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - - mapper.serialize(_value, generator); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private Kind _kind; - private SettingsSimilarityVariant _value; - - @Override - protected Builder self() { - return this; - } - public ObjectBuilder bm25(SettingsSimilarityBm25 v) { - this._kind = Kind.Bm25; - this._value = v; - return this; - } - - public ObjectBuilder bm25( - Function> fn) { - return this.bm25(fn.apply(new SettingsSimilarityBm25.Builder()).build()); - } - - public ObjectBuilder boolean_(SettingsSimilarityBoolean v) { - this._kind = Kind.Boolean; - this._value = v; - return this; - } - - public ObjectBuilder boolean_( - Function> fn) { - return this.boolean_(fn.apply(new SettingsSimilarityBoolean.Builder()).build()); - } - - public ObjectBuilder dfi(SettingsSimilarityDfi v) { - this._kind = Kind.Dfi; - this._value = v; - return this; - } - - public ObjectBuilder dfi( - Function> fn) { - return this.dfi(fn.apply(new SettingsSimilarityDfi.Builder()).build()); - } - - public ObjectBuilder dfr(SettingsSimilarityDfr v) { - this._kind = Kind.Dfr; - this._value = v; - return this; - } - - public ObjectBuilder dfr( - Function> fn) { - return this.dfr(fn.apply(new SettingsSimilarityDfr.Builder()).build()); - } - - public ObjectBuilder ib(SettingsSimilarityIb v) { - this._kind = Kind.Ib; - this._value = v; - return this; - } - - public ObjectBuilder ib( - Function> fn) { - return this.ib(fn.apply(new SettingsSimilarityIb.Builder()).build()); - } - - public ObjectBuilder lmdirichlet(SettingsSimilarityLmd v) { - this._kind = Kind.LMDirichlet; - this._value = v; - return this; - } - - public ObjectBuilder lmdirichlet( - Function> fn) { - return this.lmdirichlet(fn.apply(new SettingsSimilarityLmd.Builder()).build()); - } - - public ObjectBuilder lmjelinekmercer(SettingsSimilarityLmj v) { - this._kind = Kind.LMJelinekMercer; - this._value = v; - return this; - } - - public ObjectBuilder lmjelinekmercer( - Function> fn) { - return this.lmjelinekmercer(fn.apply(new SettingsSimilarityLmj.Builder()).build()); - } - - public ObjectBuilder scripted(SettingsSimilarityScripted v) { - this._kind = Kind.Scripted; - this._value = v; - return this; - } - - public ObjectBuilder scripted( - Function> fn) { - return this.scripted(fn.apply(new SettingsSimilarityScripted.Builder()).build()); - } - - public SettingsSimilarity build() { - _checkSingleUse(); - return new SettingsSimilarity(this); - } - - } - - protected static void setupSettingsSimilarityDeserializer(ObjectDeserializer op) { - - op.add(Builder::bm25, SettingsSimilarityBm25._DESERIALIZER, "BM25"); - op.add(Builder::boolean_, SettingsSimilarityBoolean._DESERIALIZER, "boolean"); - op.add(Builder::dfi, SettingsSimilarityDfi._DESERIALIZER, "DFI"); - op.add(Builder::dfr, SettingsSimilarityDfr._DESERIALIZER, "DFR"); - op.add(Builder::ib, SettingsSimilarityIb._DESERIALIZER, "IB"); - op.add(Builder::lmdirichlet, SettingsSimilarityLmd._DESERIALIZER, "LMDirichlet"); - op.add(Builder::lmjelinekmercer, SettingsSimilarityLmj._DESERIALIZER, "LMJelinekMercer"); - op.add(Builder::scripted, SettingsSimilarityScripted._DESERIALIZER, "scripted"); - - op.setTypeProperty("type", null); - - } - - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, SettingsSimilarity::setupSettingsSimilarityDeserializer, Builder::build); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityBm25.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityBm25.java deleted file mode 100644 index 82ff73383..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityBm25.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Double; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.SettingsSimilarityBm25 - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class SettingsSimilarityBm25 implements SettingsSimilarityVariant, JsonpSerializable { - @Nullable - private final Double b; - - @Nullable - private final Boolean discountOverlaps; - - @Nullable - private final Double k1; - - // --------------------------------------------------------------------------------------------- - - private SettingsSimilarityBm25(Builder builder) { - - this.b = builder.b; - this.discountOverlaps = builder.discountOverlaps; - this.k1 = builder.k1; - - } - - public static SettingsSimilarityBm25 of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * SettingsSimilarity variant kind. - */ - @Override - public SettingsSimilarity.Kind _settingsSimilarityKind() { - return SettingsSimilarity.Kind.Bm25; - } - - /** - * API name: {@code b} - */ - @Nullable - public final Double b() { - return this.b; - } - - /** - * API name: {@code discount_overlaps} - */ - @Nullable - public final Boolean discountOverlaps() { - return this.discountOverlaps; - } - - /** - * API name: {@code k1} - */ - @Nullable - public final Double k1() { - return this.k1; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.write("type", "BM25"); - - if (this.b != null) { - generator.writeKey("b"); - generator.write(this.b); - - } - if (this.discountOverlaps != null) { - generator.writeKey("discount_overlaps"); - generator.write(this.discountOverlaps); - - } - if (this.k1 != null) { - generator.writeKey("k1"); - generator.write(this.k1); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SettingsSimilarityBm25}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Double b; - - @Nullable - private Boolean discountOverlaps; - - @Nullable - private Double k1; - - /** - * API name: {@code b} - */ - public final Builder b(@Nullable Double value) { - this.b = value; - return this; - } - - /** - * API name: {@code discount_overlaps} - */ - public final Builder discountOverlaps(@Nullable Boolean value) { - this.discountOverlaps = value; - return this; - } - - /** - * API name: {@code k1} - */ - public final Builder k1(@Nullable Double value) { - this.k1 = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link SettingsSimilarityBm25}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SettingsSimilarityBm25 build() { - _checkSingleUse(); - - return new SettingsSimilarityBm25(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SettingsSimilarityBm25} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, SettingsSimilarityBm25::setupSettingsSimilarityBm25Deserializer); - - protected static void setupSettingsSimilarityBm25Deserializer( - ObjectDeserializer op) { - - op.add(Builder::b, JsonpDeserializer.doubleDeserializer(), "b"); - op.add(Builder::discountOverlaps, JsonpDeserializer.booleanDeserializer(), "discount_overlaps"); - op.add(Builder::k1, JsonpDeserializer.doubleDeserializer(), "k1"); - - op.ignore("type"); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityBoolean.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityBoolean.java deleted file mode 100644 index e3016b8f1..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityBoolean.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.SettingsSimilarityBoolean - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class SettingsSimilarityBoolean implements SettingsSimilarityVariant, JsonpSerializable { - // --------------------------------------------------------------------------------------------- - - private SettingsSimilarityBoolean(Builder builder) { - - } - - public static SettingsSimilarityBoolean of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * SettingsSimilarity variant kind. - */ - @Override - public SettingsSimilarity.Kind _settingsSimilarityKind() { - return SettingsSimilarity.Kind.Boolean; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.write("type", "boolean"); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SettingsSimilarityBoolean}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link SettingsSimilarityBoolean}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SettingsSimilarityBoolean build() { - _checkSingleUse(); - - return new SettingsSimilarityBoolean(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SettingsSimilarityBoolean} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, SettingsSimilarityBoolean::setupSettingsSimilarityBooleanDeserializer); - - protected static void setupSettingsSimilarityBooleanDeserializer( - ObjectDeserializer op) { - - op.ignore("type"); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityBuilders.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityBuilders.java deleted file mode 100644 index 454f72af1..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityBuilders.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.util.ObjectBuilder; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Builders for {@link SettingsSimilarity} variants. - */ -public class SettingsSimilarityBuilders { - private SettingsSimilarityBuilders() { - } - - /** - * Creates a builder for the {@link SettingsSimilarityBm25 BM25} - * {@code SettingsSimilarity} variant. - */ - public static SettingsSimilarityBm25.Builder bm25() { - return new SettingsSimilarityBm25.Builder(); - } - - /** - * Creates a SettingsSimilarity of the {@link SettingsSimilarityBm25 BM25} - * {@code SettingsSimilarity} variant. - */ - public static SettingsSimilarity bm25( - Function> fn) { - SettingsSimilarity.Builder builder = new SettingsSimilarity.Builder(); - builder.bm25(fn.apply(new SettingsSimilarityBm25.Builder()).build()); - return builder.build(); - } - - /** - * Creates a builder for the {@link SettingsSimilarityBoolean boolean} - * {@code SettingsSimilarity} variant. - */ - public static SettingsSimilarityBoolean.Builder boolean_() { - return new SettingsSimilarityBoolean.Builder(); - } - - /** - * Creates a SettingsSimilarity of the {@link SettingsSimilarityBoolean boolean} - * {@code SettingsSimilarity} variant. - */ - public static SettingsSimilarity boolean_( - Function> fn) { - SettingsSimilarity.Builder builder = new SettingsSimilarity.Builder(); - builder.boolean_(fn.apply(new SettingsSimilarityBoolean.Builder()).build()); - return builder.build(); - } - - /** - * Creates a builder for the {@link SettingsSimilarityDfi DFI} - * {@code SettingsSimilarity} variant. - */ - public static SettingsSimilarityDfi.Builder dfi() { - return new SettingsSimilarityDfi.Builder(); - } - - /** - * Creates a SettingsSimilarity of the {@link SettingsSimilarityDfi DFI} - * {@code SettingsSimilarity} variant. - */ - public static SettingsSimilarity dfi( - Function> fn) { - SettingsSimilarity.Builder builder = new SettingsSimilarity.Builder(); - builder.dfi(fn.apply(new SettingsSimilarityDfi.Builder()).build()); - return builder.build(); - } - - /** - * Creates a builder for the {@link SettingsSimilarityDfr DFR} - * {@code SettingsSimilarity} variant. - */ - public static SettingsSimilarityDfr.Builder dfr() { - return new SettingsSimilarityDfr.Builder(); - } - - /** - * Creates a SettingsSimilarity of the {@link SettingsSimilarityDfr DFR} - * {@code SettingsSimilarity} variant. - */ - public static SettingsSimilarity dfr( - Function> fn) { - SettingsSimilarity.Builder builder = new SettingsSimilarity.Builder(); - builder.dfr(fn.apply(new SettingsSimilarityDfr.Builder()).build()); - return builder.build(); - } - - /** - * Creates a builder for the {@link SettingsSimilarityIb IB} - * {@code SettingsSimilarity} variant. - */ - public static SettingsSimilarityIb.Builder ib() { - return new SettingsSimilarityIb.Builder(); - } - - /** - * Creates a SettingsSimilarity of the {@link SettingsSimilarityIb IB} - * {@code SettingsSimilarity} variant. - */ - public static SettingsSimilarity ib( - Function> fn) { - SettingsSimilarity.Builder builder = new SettingsSimilarity.Builder(); - builder.ib(fn.apply(new SettingsSimilarityIb.Builder()).build()); - return builder.build(); - } - - /** - * Creates a builder for the {@link SettingsSimilarityLmd LMDirichlet} - * {@code SettingsSimilarity} variant. - */ - public static SettingsSimilarityLmd.Builder lmdirichlet() { - return new SettingsSimilarityLmd.Builder(); - } - - /** - * Creates a SettingsSimilarity of the {@link SettingsSimilarityLmd LMDirichlet} - * {@code SettingsSimilarity} variant. - */ - public static SettingsSimilarity lmdirichlet( - Function> fn) { - SettingsSimilarity.Builder builder = new SettingsSimilarity.Builder(); - builder.lmdirichlet(fn.apply(new SettingsSimilarityLmd.Builder()).build()); - return builder.build(); - } - - /** - * Creates a builder for the {@link SettingsSimilarityLmj LMJelinekMercer} - * {@code SettingsSimilarity} variant. - */ - public static SettingsSimilarityLmj.Builder lmjelinekmercer() { - return new SettingsSimilarityLmj.Builder(); - } - - /** - * Creates a SettingsSimilarity of the {@link SettingsSimilarityLmj - * LMJelinekMercer} {@code SettingsSimilarity} variant. - */ - public static SettingsSimilarity lmjelinekmercer( - Function> fn) { - SettingsSimilarity.Builder builder = new SettingsSimilarity.Builder(); - builder.lmjelinekmercer(fn.apply(new SettingsSimilarityLmj.Builder()).build()); - return builder.build(); - } - - /** - * Creates a builder for the {@link SettingsSimilarityScripted scripted} - * {@code SettingsSimilarity} variant. - */ - public static SettingsSimilarityScripted.Builder scripted() { - return new SettingsSimilarityScripted.Builder(); - } - - /** - * Creates a SettingsSimilarity of the {@link SettingsSimilarityScripted - * scripted} {@code SettingsSimilarity} variant. - */ - public static SettingsSimilarity scripted( - Function> fn) { - SettingsSimilarity.Builder builder = new SettingsSimilarity.Builder(); - builder.scripted(fn.apply(new SettingsSimilarityScripted.Builder()).build()); - return builder.build(); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityDfi.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityDfi.java deleted file mode 100644 index 596a78bd3..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityDfi.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.DFIIndependenceMeasure; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.SettingsSimilarityDfi - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class SettingsSimilarityDfi implements SettingsSimilarityVariant, JsonpSerializable { - private final DFIIndependenceMeasure independenceMeasure; - - // --------------------------------------------------------------------------------------------- - - private SettingsSimilarityDfi(Builder builder) { - - this.independenceMeasure = ApiTypeHelper.requireNonNull(builder.independenceMeasure, this, - "independenceMeasure"); - - } - - public static SettingsSimilarityDfi of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * SettingsSimilarity variant kind. - */ - @Override - public SettingsSimilarity.Kind _settingsSimilarityKind() { - return SettingsSimilarity.Kind.Dfi; - } - - /** - * Required - API name: {@code independence_measure} - */ - public final DFIIndependenceMeasure independenceMeasure() { - return this.independenceMeasure; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.write("type", "DFI"); - - generator.writeKey("independence_measure"); - this.independenceMeasure.serialize(generator, mapper); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SettingsSimilarityDfi}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private DFIIndependenceMeasure independenceMeasure; - - /** - * Required - API name: {@code independence_measure} - */ - public final Builder independenceMeasure(DFIIndependenceMeasure value) { - this.independenceMeasure = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link SettingsSimilarityDfi}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SettingsSimilarityDfi build() { - _checkSingleUse(); - - return new SettingsSimilarityDfi(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SettingsSimilarityDfi} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, SettingsSimilarityDfi::setupSettingsSimilarityDfiDeserializer); - - protected static void setupSettingsSimilarityDfiDeserializer(ObjectDeserializer op) { - - op.add(Builder::independenceMeasure, DFIIndependenceMeasure._DESERIALIZER, "independence_measure"); - - op.ignore("type"); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityDfr.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityDfr.java deleted file mode 100644 index 9e022df97..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityDfr.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.DFRAfterEffect; -import co.elastic.clients.elasticsearch._types.DFRBasicModel; -import co.elastic.clients.elasticsearch._types.Normalization; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.SettingsSimilarityDfr - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class SettingsSimilarityDfr implements SettingsSimilarityVariant, JsonpSerializable { - private final DFRAfterEffect afterEffect; - - private final DFRBasicModel basicModel; - - private final Normalization normalization; - - // --------------------------------------------------------------------------------------------- - - private SettingsSimilarityDfr(Builder builder) { - - this.afterEffect = ApiTypeHelper.requireNonNull(builder.afterEffect, this, "afterEffect"); - this.basicModel = ApiTypeHelper.requireNonNull(builder.basicModel, this, "basicModel"); - this.normalization = ApiTypeHelper.requireNonNull(builder.normalization, this, "normalization"); - - } - - public static SettingsSimilarityDfr of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * SettingsSimilarity variant kind. - */ - @Override - public SettingsSimilarity.Kind _settingsSimilarityKind() { - return SettingsSimilarity.Kind.Dfr; - } - - /** - * Required - API name: {@code after_effect} - */ - public final DFRAfterEffect afterEffect() { - return this.afterEffect; - } - - /** - * Required - API name: {@code basic_model} - */ - public final DFRBasicModel basicModel() { - return this.basicModel; - } - - /** - * Required - API name: {@code normalization} - */ - public final Normalization normalization() { - return this.normalization; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.write("type", "DFR"); - - generator.writeKey("after_effect"); - this.afterEffect.serialize(generator, mapper); - generator.writeKey("basic_model"); - this.basicModel.serialize(generator, mapper); - generator.writeKey("normalization"); - this.normalization.serialize(generator, mapper); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SettingsSimilarityDfr}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private DFRAfterEffect afterEffect; - - private DFRBasicModel basicModel; - - private Normalization normalization; - - /** - * Required - API name: {@code after_effect} - */ - public final Builder afterEffect(DFRAfterEffect value) { - this.afterEffect = value; - return this; - } - - /** - * Required - API name: {@code basic_model} - */ - public final Builder basicModel(DFRBasicModel value) { - this.basicModel = value; - return this; - } - - /** - * Required - API name: {@code normalization} - */ - public final Builder normalization(Normalization value) { - this.normalization = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link SettingsSimilarityDfr}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SettingsSimilarityDfr build() { - _checkSingleUse(); - - return new SettingsSimilarityDfr(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SettingsSimilarityDfr} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, SettingsSimilarityDfr::setupSettingsSimilarityDfrDeserializer); - - protected static void setupSettingsSimilarityDfrDeserializer(ObjectDeserializer op) { - - op.add(Builder::afterEffect, DFRAfterEffect._DESERIALIZER, "after_effect"); - op.add(Builder::basicModel, DFRBasicModel._DESERIALIZER, "basic_model"); - op.add(Builder::normalization, Normalization._DESERIALIZER, "normalization"); - - op.ignore("type"); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityIb.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityIb.java deleted file mode 100644 index ad8bf0ba1..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityIb.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.IBDistribution; -import co.elastic.clients.elasticsearch._types.IBLambda; -import co.elastic.clients.elasticsearch._types.Normalization; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.SettingsSimilarityIb - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class SettingsSimilarityIb implements SettingsSimilarityVariant, JsonpSerializable { - private final IBDistribution distribution; - - private final IBLambda lambda; - - private final Normalization normalization; - - // --------------------------------------------------------------------------------------------- - - private SettingsSimilarityIb(Builder builder) { - - this.distribution = ApiTypeHelper.requireNonNull(builder.distribution, this, "distribution"); - this.lambda = ApiTypeHelper.requireNonNull(builder.lambda, this, "lambda"); - this.normalization = ApiTypeHelper.requireNonNull(builder.normalization, this, "normalization"); - - } - - public static SettingsSimilarityIb of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * SettingsSimilarity variant kind. - */ - @Override - public SettingsSimilarity.Kind _settingsSimilarityKind() { - return SettingsSimilarity.Kind.Ib; - } - - /** - * Required - API name: {@code distribution} - */ - public final IBDistribution distribution() { - return this.distribution; - } - - /** - * Required - API name: {@code lambda} - */ - public final IBLambda lambda() { - return this.lambda; - } - - /** - * Required - API name: {@code normalization} - */ - public final Normalization normalization() { - return this.normalization; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.write("type", "IB"); - - generator.writeKey("distribution"); - this.distribution.serialize(generator, mapper); - generator.writeKey("lambda"); - this.lambda.serialize(generator, mapper); - generator.writeKey("normalization"); - this.normalization.serialize(generator, mapper); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SettingsSimilarityIb}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private IBDistribution distribution; - - private IBLambda lambda; - - private Normalization normalization; - - /** - * Required - API name: {@code distribution} - */ - public final Builder distribution(IBDistribution value) { - this.distribution = value; - return this; - } - - /** - * Required - API name: {@code lambda} - */ - public final Builder lambda(IBLambda value) { - this.lambda = value; - return this; - } - - /** - * Required - API name: {@code normalization} - */ - public final Builder normalization(Normalization value) { - this.normalization = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link SettingsSimilarityIb}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SettingsSimilarityIb build() { - _checkSingleUse(); - - return new SettingsSimilarityIb(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SettingsSimilarityIb} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, SettingsSimilarityIb::setupSettingsSimilarityIbDeserializer); - - protected static void setupSettingsSimilarityIbDeserializer(ObjectDeserializer op) { - - op.add(Builder::distribution, IBDistribution._DESERIALIZER, "distribution"); - op.add(Builder::lambda, IBLambda._DESERIALIZER, "lambda"); - op.add(Builder::normalization, Normalization._DESERIALIZER, "normalization"); - - op.ignore("type"); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityLmd.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityLmd.java deleted file mode 100644 index 298c45d95..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityLmd.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Double; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.SettingsSimilarityLmd - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class SettingsSimilarityLmd implements SettingsSimilarityVariant, JsonpSerializable { - @Nullable - private final Double mu; - - // --------------------------------------------------------------------------------------------- - - private SettingsSimilarityLmd(Builder builder) { - - this.mu = builder.mu; - - } - - public static SettingsSimilarityLmd of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * SettingsSimilarity variant kind. - */ - @Override - public SettingsSimilarity.Kind _settingsSimilarityKind() { - return SettingsSimilarity.Kind.LMDirichlet; - } - - /** - * API name: {@code mu} - */ - @Nullable - public final Double mu() { - return this.mu; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.write("type", "LMDirichlet"); - - if (this.mu != null) { - generator.writeKey("mu"); - generator.write(this.mu); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SettingsSimilarityLmd}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Double mu; - - /** - * API name: {@code mu} - */ - public final Builder mu(@Nullable Double value) { - this.mu = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link SettingsSimilarityLmd}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SettingsSimilarityLmd build() { - _checkSingleUse(); - - return new SettingsSimilarityLmd(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SettingsSimilarityLmd} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, SettingsSimilarityLmd::setupSettingsSimilarityLmdDeserializer); - - protected static void setupSettingsSimilarityLmdDeserializer(ObjectDeserializer op) { - - op.add(Builder::mu, JsonpDeserializer.doubleDeserializer(), "mu"); - - op.ignore("type"); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityLmj.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityLmj.java deleted file mode 100644 index 5c8998fd8..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityLmj.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Double; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.SettingsSimilarityLmj - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class SettingsSimilarityLmj implements SettingsSimilarityVariant, JsonpSerializable { - @Nullable - private final Double lambda; - - // --------------------------------------------------------------------------------------------- - - private SettingsSimilarityLmj(Builder builder) { - - this.lambda = builder.lambda; - - } - - public static SettingsSimilarityLmj of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * SettingsSimilarity variant kind. - */ - @Override - public SettingsSimilarity.Kind _settingsSimilarityKind() { - return SettingsSimilarity.Kind.LMJelinekMercer; - } - - /** - * API name: {@code lambda} - */ - @Nullable - public final Double lambda() { - return this.lambda; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.write("type", "LMJelinekMercer"); - - if (this.lambda != null) { - generator.writeKey("lambda"); - generator.write(this.lambda); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SettingsSimilarityLmj}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Double lambda; - - /** - * API name: {@code lambda} - */ - public final Builder lambda(@Nullable Double value) { - this.lambda = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link SettingsSimilarityLmj}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SettingsSimilarityLmj build() { - _checkSingleUse(); - - return new SettingsSimilarityLmj(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SettingsSimilarityLmj} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, SettingsSimilarityLmj::setupSettingsSimilarityLmjDeserializer); - - protected static void setupSettingsSimilarityLmjDeserializer(ObjectDeserializer op) { - - op.add(Builder::lambda, JsonpDeserializer.doubleDeserializer(), "lambda"); - - op.ignore("type"); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityScripted.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityScripted.java deleted file mode 100644 index daa33e276..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityScripted.java +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.Script; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.SettingsSimilarityScripted - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class SettingsSimilarityScripted implements SettingsSimilarityVariant, JsonpSerializable { - private final Script script; - - @Nullable - private final Script weightScript; - - // --------------------------------------------------------------------------------------------- - - private SettingsSimilarityScripted(Builder builder) { - - this.script = ApiTypeHelper.requireNonNull(builder.script, this, "script"); - this.weightScript = builder.weightScript; - - } - - public static SettingsSimilarityScripted of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * SettingsSimilarity variant kind. - */ - @Override - public SettingsSimilarity.Kind _settingsSimilarityKind() { - return SettingsSimilarity.Kind.Scripted; - } - - /** - * Required - API name: {@code script} - */ - public final Script script() { - return this.script; - } - - /** - * API name: {@code weight_script} - */ - @Nullable - public final Script weightScript() { - return this.weightScript; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.write("type", "scripted"); - - generator.writeKey("script"); - this.script.serialize(generator, mapper); - - if (this.weightScript != null) { - generator.writeKey("weight_script"); - this.weightScript.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SettingsSimilarityScripted}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private Script script; - - @Nullable - private Script weightScript; - - /** - * Required - API name: {@code script} - */ - public final Builder script(Script value) { - this.script = value; - return this; - } - - /** - * Required - API name: {@code script} - */ - public final Builder script(Function> fn) { - return this.script(fn.apply(new Script.Builder()).build()); - } - - /** - * API name: {@code weight_script} - */ - public final Builder weightScript(@Nullable Script value) { - this.weightScript = value; - return this; - } - - /** - * API name: {@code weight_script} - */ - public final Builder weightScript(Function> fn) { - return this.weightScript(fn.apply(new Script.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link SettingsSimilarityScripted}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SettingsSimilarityScripted build() { - _checkSingleUse(); - - return new SettingsSimilarityScripted(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SettingsSimilarityScripted} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, SettingsSimilarityScripted::setupSettingsSimilarityScriptedDeserializer); - - protected static void setupSettingsSimilarityScriptedDeserializer( - ObjectDeserializer op) { - - op.add(Builder::script, Script._DESERIALIZER, "script"); - op.add(Builder::weightScript, Script._DESERIALIZER, "weight_script"); - - op.ignore("type"); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityVariant.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityVariant.java deleted file mode 100644 index b77e52300..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityVariant.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpSerializable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Base interface for {@link SettingsSimilarity} variants. - */ -public interface SettingsSimilarityVariant extends JsonpSerializable { - - SettingsSimilarity.Kind _settingsSimilarityKind(); - - default SettingsSimilarity _toSettingsSimilarity() { - return new SettingsSimilarity(this); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateIndexTemplateRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateIndexTemplateRequest.java deleted file mode 100644 index 289107ed5..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateIndexTemplateRequest.java +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.simulate_index_template.Request - -/** - * Simulate an index. Returns the index configuration that would be applied to - * the specified index from an existing index template. - * - * @see API - * specification - */ - -public class SimulateIndexTemplateRequest extends RequestBase { - @Nullable - private final Boolean includeDefaults; - - @Nullable - private final Time masterTimeout; - - private final String name; - - // --------------------------------------------------------------------------------------------- - - private SimulateIndexTemplateRequest(Builder builder) { - - this.includeDefaults = builder.includeDefaults; - this.masterTimeout = builder.masterTimeout; - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - - } - - public static SimulateIndexTemplateRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * If true, returns all relevant default configurations for the index template. - *

- * API name: {@code include_defaults} - */ - @Nullable - public final Boolean includeDefaults() { - return this.includeDefaults; - } - - /** - * 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. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * Required - Name of the index to simulate - *

- * API name: {@code name} - */ - public final String name() { - return this.name; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SimulateIndexTemplateRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private Boolean includeDefaults; - - @Nullable - private Time masterTimeout; - - private String name; - - /** - * If true, returns all relevant default configurations for the index template. - *

- * API name: {@code include_defaults} - */ - public final Builder includeDefaults(@Nullable Boolean value) { - this.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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Required - Name of the index to simulate - *

- * API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link SimulateIndexTemplateRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SimulateIndexTemplateRequest build() { - _checkSingleUse(); - - return new SimulateIndexTemplateRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.simulate_index_template}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.simulate_index_template", - - // Request method - request -> { - return "POST"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_index_template"); - buf.append("/_simulate_index"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - params.put("name", request.name); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (request.includeDefaults != null) { - params.put("include_defaults", String.valueOf(request.includeDefaults)); - } - return params; - - }, SimpleEndpoint.emptyMap(), false, SimulateIndexTemplateResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateIndexTemplateResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateIndexTemplateResponse.java deleted file mode 100644 index b53fc70d9..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateIndexTemplateResponse.java +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch.indices.simulate_template.Overlapping; -import co.elastic.clients.elasticsearch.indices.simulate_template.Template; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.simulate_index_template.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class SimulateIndexTemplateResponse implements JsonpSerializable { - private final List overlapping; - - private final Template template; - - // --------------------------------------------------------------------------------------------- - - private SimulateIndexTemplateResponse(Builder builder) { - - this.overlapping = ApiTypeHelper.unmodifiable(builder.overlapping); - this.template = ApiTypeHelper.requireNonNull(builder.template, this, "template"); - - } - - public static SimulateIndexTemplateResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code overlapping} - */ - public final List overlapping() { - return this.overlapping; - } - - /** - * Required - API name: {@code template} - */ - public final Template template() { - return this.template; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.overlapping)) { - generator.writeKey("overlapping"); - generator.writeStartArray(); - for (Overlapping item0 : this.overlapping) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - generator.writeKey("template"); - this.template.serialize(generator, mapper); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SimulateIndexTemplateResponse}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private List overlapping; - - private Template template; - - /** - * API name: {@code overlapping} - *

- * Adds all elements of list to overlapping. - */ - public final Builder overlapping(List list) { - this.overlapping = _listAddAll(this.overlapping, list); - return this; - } - - /** - * API name: {@code overlapping} - *

- * Adds one or more values to overlapping. - */ - public final Builder overlapping(Overlapping value, Overlapping... values) { - this.overlapping = _listAdd(this.overlapping, value, values); - return this; - } - - /** - * API name: {@code overlapping} - *

- * Adds a value to overlapping using a builder lambda. - */ - public final Builder overlapping(Function> fn) { - return overlapping(fn.apply(new Overlapping.Builder()).build()); - } - - /** - * Required - API name: {@code template} - */ - public final Builder template(Template value) { - this.template = value; - return this; - } - - /** - * Required - API name: {@code template} - */ - public final Builder template(Function> fn) { - return this.template(fn.apply(new Template.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link SimulateIndexTemplateResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SimulateIndexTemplateResponse build() { - _checkSingleUse(); - - return new SimulateIndexTemplateResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SimulateIndexTemplateResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, SimulateIndexTemplateResponse::setupSimulateIndexTemplateResponseDeserializer); - - protected static void setupSimulateIndexTemplateResponseDeserializer( - ObjectDeserializer op) { - - op.add(Builder::overlapping, JsonpDeserializer.arrayDeserializer(Overlapping._DESERIALIZER), "overlapping"); - op.add(Builder::template, Template._DESERIALIZER, "template"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateTemplateRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateTemplateRequest.java deleted file mode 100644 index 8f253a4c8..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateTemplateRequest.java +++ /dev/null @@ -1,816 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.elasticsearch.indices.put_index_template.IndexTemplateMapping; -import co.elastic.clients.json.JsonData; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Long; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.simulate_template.Request - -/** - * Simulate an index template. Returns the index configuration that would be - * applied by a particular index template. - * - * @see API - * specification - */ -@JsonpDeserializable -public class SimulateTemplateRequest extends RequestBase implements JsonpSerializable { - private final Map meta; - - @Nullable - private final Boolean allowAutoCreate; - - private final List composedOf; - - @Nullable - private final Boolean create; - - @Nullable - private final DataStreamVisibility dataStream; - - @Nullable - private final Boolean deprecated; - - private final List ignoreMissingComponentTemplates; - - @Nullable - private final Boolean includeDefaults; - - private final List indexPatterns; - - @Nullable - private final Time masterTimeout; - - @Nullable - private final String name; - - @Nullable - private final Long priority; - - @Nullable - private final IndexTemplateMapping template; - - @Nullable - private final Long version; - - // --------------------------------------------------------------------------------------------- - - private SimulateTemplateRequest(Builder builder) { - - this.meta = ApiTypeHelper.unmodifiable(builder.meta); - this.allowAutoCreate = builder.allowAutoCreate; - this.composedOf = ApiTypeHelper.unmodifiable(builder.composedOf); - this.create = builder.create; - this.dataStream = builder.dataStream; - this.deprecated = builder.deprecated; - this.ignoreMissingComponentTemplates = ApiTypeHelper.unmodifiable(builder.ignoreMissingComponentTemplates); - this.includeDefaults = builder.includeDefaults; - this.indexPatterns = ApiTypeHelper.unmodifiable(builder.indexPatterns); - this.masterTimeout = builder.masterTimeout; - this.name = builder.name; - this.priority = builder.priority; - this.template = builder.template; - this.version = builder.version; - - } - - public static SimulateTemplateRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Optional user metadata about the index template. May have any contents. This - * map is not automatically generated by Elasticsearch. - *

- * API name: {@code _meta} - */ - public final Map meta() { - return this.meta; - } - - /** - * This setting overrides the value of the action.auto_create_index - * cluster setting. If set to true in a template, then indices can - * be automatically created using that template even if auto-creation of indices - * is disabled via actions.auto_create_index. If set to - * false, then indices or data streams matching the template must - * always be explicitly created, and may never be automatically created. - *

- * API name: {@code allow_auto_create} - */ - @Nullable - public final Boolean allowAutoCreate() { - return this.allowAutoCreate; - } - - /** - * 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. - *

- * API name: {@code composed_of} - */ - public final List composedOf() { - return this.composedOf; - } - - /** - * 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. - *

- * API name: {@code create} - */ - @Nullable - public final Boolean create() { - return this.create; - } - - /** - * 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. - *

- * API name: {@code data_stream} - */ - @Nullable - public final DataStreamVisibility dataStream() { - return this.dataStream; - } - - /** - * Marks this index template as deprecated. When creating or updating a - * non-deprecated index template that uses deprecated components, Elasticsearch - * will emit a deprecation warning. - *

- * API name: {@code deprecated} - */ - @Nullable - public final Boolean deprecated() { - return this.deprecated; - } - - /** - * The configuration option ignore_missing_component_templates can be used when - * an index template references a component template that might not exist - *

- * API name: {@code ignore_missing_component_templates} - */ - public final List ignoreMissingComponentTemplates() { - return this.ignoreMissingComponentTemplates; - } - - /** - * If true, returns all relevant default configurations for the index template. - *

- * API name: {@code include_defaults} - */ - @Nullable - public final Boolean includeDefaults() { - return this.includeDefaults; - } - - /** - * Array of wildcard (*) expressions used to match the names of - * data streams and indices during creation. - *

- * API name: {@code index_patterns} - */ - public final List indexPatterns() { - return this.indexPatterns; - } - - /** - * 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. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * 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. - *

- * API name: {@code name} - */ - @Nullable - public final String name() { - return this.name; - } - - /** - * Priority to determine index template precedence when a new data stream or - * index is created. The index template with the highest priority is chosen. If - * no priority is specified the template is treated as though it is of priority - * 0 (lowest priority). This number is not automatically generated by - * Elasticsearch. - *

- * API name: {@code priority} - */ - @Nullable - public final Long priority() { - return this.priority; - } - - /** - * Template to be applied. It may optionally include an aliases, - * mappings, or settings configuration. - *

- * API name: {@code template} - */ - @Nullable - public final IndexTemplateMapping template() { - return this.template; - } - - /** - * Version number used to manage index templates externally. This number is not - * automatically generated by Elasticsearch. - *

- * API name: {@code version} - */ - @Nullable - public final Long version() { - return this.version; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.meta)) { - generator.writeKey("_meta"); - generator.writeStartObject(); - for (Map.Entry item0 : this.meta.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.allowAutoCreate != null) { - generator.writeKey("allow_auto_create"); - generator.write(this.allowAutoCreate); - - } - if (ApiTypeHelper.isDefined(this.composedOf)) { - generator.writeKey("composed_of"); - generator.writeStartArray(); - for (String item0 : this.composedOf) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (this.dataStream != null) { - generator.writeKey("data_stream"); - this.dataStream.serialize(generator, mapper); - - } - if (this.deprecated != null) { - generator.writeKey("deprecated"); - generator.write(this.deprecated); - - } - if (ApiTypeHelper.isDefined(this.ignoreMissingComponentTemplates)) { - generator.writeKey("ignore_missing_component_templates"); - generator.writeStartArray(); - for (String item0 : this.ignoreMissingComponentTemplates) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.indexPatterns)) { - generator.writeKey("index_patterns"); - generator.writeStartArray(); - for (String item0 : this.indexPatterns) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (this.priority != null) { - generator.writeKey("priority"); - generator.write(this.priority); - - } - if (this.template != null) { - generator.writeKey("template"); - this.template.serialize(generator, mapper); - - } - if (this.version != null) { - generator.writeKey("version"); - generator.write(this.version); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SimulateTemplateRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private Map meta; - - @Nullable - private Boolean allowAutoCreate; - - @Nullable - private List composedOf; - - @Nullable - private Boolean create; - - @Nullable - private DataStreamVisibility dataStream; - - @Nullable - private Boolean deprecated; - - @Nullable - private List ignoreMissingComponentTemplates; - - @Nullable - private Boolean includeDefaults; - - @Nullable - private List indexPatterns; - - @Nullable - private Time masterTimeout; - - @Nullable - private String name; - - @Nullable - private Long priority; - - @Nullable - private IndexTemplateMapping template; - - @Nullable - private Long version; - - /** - * Optional user metadata about the index template. May have any contents. This - * map is not automatically generated by Elasticsearch. - *

- * API name: {@code _meta} - *

- * Adds all entries of map to meta. - */ - public final Builder meta(Map map) { - this.meta = _mapPutAll(this.meta, map); - return this; - } - - /** - * Optional user metadata about the index template. May have any contents. This - * map is not automatically generated by Elasticsearch. - *

- * API name: {@code _meta} - *

- * Adds an entry to meta. - */ - public final Builder meta(String key, JsonData value) { - this.meta = _mapPut(this.meta, key, value); - return this; - } - - /** - * This setting overrides the value of the action.auto_create_index - * cluster setting. If set to true in a template, then indices can - * be automatically created using that template even if auto-creation of indices - * is disabled via actions.auto_create_index. If set to - * false, then indices or data streams matching the template must - * always be explicitly created, and may never be automatically created. - *

- * API name: {@code allow_auto_create} - */ - public final Builder allowAutoCreate(@Nullable Boolean value) { - this.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. - *

- * API name: {@code composed_of} - *

- * Adds all elements of list to composedOf. - */ - public final Builder composedOf(List list) { - this.composedOf = _listAddAll(this.composedOf, list); - 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. - *

- * API name: {@code composed_of} - *

- * Adds one or more values to composedOf. - */ - public final Builder composedOf(String value, String... values) { - this.composedOf = _listAdd(this.composedOf, value, values); - return this; - } - - /** - * 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. - *

- * API name: {@code create} - */ - public final Builder create(@Nullable Boolean value) { - this.create = value; - return this; - } - - /** - * 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. - *

- * API name: {@code data_stream} - */ - public final Builder dataStream(@Nullable DataStreamVisibility value) { - this.dataStream = value; - return this; - } - - /** - * 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. - *

- * API name: {@code data_stream} - */ - public final Builder dataStream( - Function> fn) { - return this.dataStream(fn.apply(new DataStreamVisibility.Builder()).build()); - } - - /** - * Marks this index template as deprecated. When creating or updating a - * non-deprecated index template that uses deprecated components, Elasticsearch - * will emit a deprecation warning. - *

- * API name: {@code deprecated} - */ - public final Builder deprecated(@Nullable Boolean value) { - this.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 - *

- * API name: {@code ignore_missing_component_templates} - *

- * Adds all elements of list to - * ignoreMissingComponentTemplates. - */ - public final Builder ignoreMissingComponentTemplates(List list) { - this.ignoreMissingComponentTemplates = _listAddAll(this.ignoreMissingComponentTemplates, list); - return this; - } - - /** - * The configuration option ignore_missing_component_templates can be used when - * an index template references a component template that might not exist - *

- * API name: {@code ignore_missing_component_templates} - *

- * Adds one or more values to ignoreMissingComponentTemplates. - */ - public final Builder ignoreMissingComponentTemplates(String value, String... values) { - this.ignoreMissingComponentTemplates = _listAdd(this.ignoreMissingComponentTemplates, value, values); - return this; - } - - /** - * If true, returns all relevant default configurations for the index template. - *

- * API name: {@code include_defaults} - */ - public final Builder includeDefaults(@Nullable Boolean value) { - this.includeDefaults = value; - return this; - } - - /** - * Array of wildcard (*) expressions used to match the names of - * data streams and indices during creation. - *

- * API name: {@code index_patterns} - *

- * Adds all elements of list to indexPatterns. - */ - public final Builder indexPatterns(List list) { - this.indexPatterns = _listAddAll(this.indexPatterns, list); - return this; - } - - /** - * Array of wildcard (*) expressions used to match the names of - * data streams and indices during creation. - *

- * API name: {@code index_patterns} - *

- * Adds one or more values to indexPatterns. - */ - public final Builder indexPatterns(String value, String... values) { - this.indexPatterns = _listAdd(this.indexPatterns, value, 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * 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. - *

- * API name: {@code name} - */ - public final Builder name(@Nullable String value) { - this.name = value; - return this; - } - - /** - * Priority to determine index template precedence when a new data stream or - * index is created. The index template with the highest priority is chosen. If - * no priority is specified the template is treated as though it is of priority - * 0 (lowest priority). This number is not automatically generated by - * Elasticsearch. - *

- * API name: {@code priority} - */ - public final Builder priority(@Nullable Long value) { - this.priority = value; - return this; - } - - /** - * Template to be applied. It may optionally include an aliases, - * mappings, or settings configuration. - *

- * API name: {@code template} - */ - public final Builder template(@Nullable IndexTemplateMapping value) { - this.template = value; - return this; - } - - /** - * Template to be applied. It may optionally include an aliases, - * mappings, or settings configuration. - *

- * API name: {@code template} - */ - public final Builder template(Function> fn) { - return this.template(fn.apply(new IndexTemplateMapping.Builder()).build()); - } - - /** - * Version number used to manage index templates externally. This number is not - * automatically generated by Elasticsearch. - *

- * API name: {@code version} - */ - public final Builder version(@Nullable Long value) { - this.version = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link SimulateTemplateRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SimulateTemplateRequest build() { - _checkSingleUse(); - - return new SimulateTemplateRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SimulateTemplateRequest} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, SimulateTemplateRequest::setupSimulateTemplateRequestDeserializer); - - protected static void setupSimulateTemplateRequestDeserializer( - ObjectDeserializer op) { - - op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta"); - op.add(Builder::allowAutoCreate, JsonpDeserializer.booleanDeserializer(), "allow_auto_create"); - op.add(Builder::composedOf, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "composed_of"); - op.add(Builder::dataStream, DataStreamVisibility._DESERIALIZER, "data_stream"); - op.add(Builder::deprecated, JsonpDeserializer.booleanDeserializer(), "deprecated"); - op.add(Builder::ignoreMissingComponentTemplates, - JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "ignore_missing_component_templates"); - op.add(Builder::indexPatterns, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "index_patterns"); - op.add(Builder::priority, JsonpDeserializer.longDeserializer(), "priority"); - op.add(Builder::template, IndexTemplateMapping._DESERIALIZER, "template"); - op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version"); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.simulate_template}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.simulate_template", - - // Request method - request -> { - return "POST"; - - }, - - // Request path - request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - if (request.name() != null) - propsSet |= _name; - - if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_index_template"); - buf.append("/_simulate"); - return buf.toString(); - } - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_index_template"); - buf.append("/_simulate"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _name = 1 << 0; - - int propsSet = 0; - - if (request.name() != null) - propsSet |= _name; - - if (propsSet == 0) { - } - if (propsSet == (_name)) { - params.put("name", request.name); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (request.create != null) { - params.put("create", String.valueOf(request.create)); - } - if (request.includeDefaults != null) { - params.put("include_defaults", String.valueOf(request.includeDefaults)); - } - return params; - - }, SimpleEndpoint.emptyMap(), true, SimulateTemplateResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateTemplateResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateTemplateResponse.java deleted file mode 100644 index d3411d785..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateTemplateResponse.java +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch.indices.simulate_template.Overlapping; -import co.elastic.clients.elasticsearch.indices.simulate_template.Template; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.simulate_template.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class SimulateTemplateResponse implements JsonpSerializable { - private final List overlapping; - - private final Template template; - - // --------------------------------------------------------------------------------------------- - - private SimulateTemplateResponse(Builder builder) { - - this.overlapping = ApiTypeHelper.unmodifiable(builder.overlapping); - this.template = ApiTypeHelper.requireNonNull(builder.template, this, "template"); - - } - - public static SimulateTemplateResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code overlapping} - */ - public final List overlapping() { - return this.overlapping; - } - - /** - * Required - API name: {@code template} - */ - public final Template template() { - return this.template; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.overlapping)) { - generator.writeKey("overlapping"); - generator.writeStartArray(); - for (Overlapping item0 : this.overlapping) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - generator.writeKey("template"); - this.template.serialize(generator, mapper); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SimulateTemplateResponse}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private List overlapping; - - private Template template; - - /** - * API name: {@code overlapping} - *

- * Adds all elements of list to overlapping. - */ - public final Builder overlapping(List list) { - this.overlapping = _listAddAll(this.overlapping, list); - return this; - } - - /** - * API name: {@code overlapping} - *

- * Adds one or more values to overlapping. - */ - public final Builder overlapping(Overlapping value, Overlapping... values) { - this.overlapping = _listAdd(this.overlapping, value, values); - return this; - } - - /** - * API name: {@code overlapping} - *

- * Adds a value to overlapping using a builder lambda. - */ - public final Builder overlapping(Function> fn) { - return overlapping(fn.apply(new Overlapping.Builder()).build()); - } - - /** - * Required - API name: {@code template} - */ - public final Builder template(Template value) { - this.template = value; - return this; - } - - /** - * Required - API name: {@code template} - */ - public final Builder template(Function> fn) { - return this.template(fn.apply(new Template.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link SimulateTemplateResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SimulateTemplateResponse build() { - _checkSingleUse(); - - return new SimulateTemplateResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SimulateTemplateResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, SimulateTemplateResponse::setupSimulateTemplateResponseDeserializer); - - protected static void setupSimulateTemplateResponseDeserializer( - ObjectDeserializer op) { - - op.add(Builder::overlapping, JsonpDeserializer.arrayDeserializer(Overlapping._DESERIALIZER), "overlapping"); - op.add(Builder::template, Template._DESERIALIZER, "template"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SlowlogSettings.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SlowlogSettings.java deleted file mode 100644 index d191134f2..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SlowlogSettings.java +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Integer; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.SlowlogSettings - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class SlowlogSettings implements JsonpSerializable { - @Nullable - private final String level; - - @Nullable - private final Integer source; - - @Nullable - private final Boolean reformat; - - @Nullable - private final SlowlogTresholds threshold; - - // --------------------------------------------------------------------------------------------- - - private SlowlogSettings(Builder builder) { - - this.level = builder.level; - this.source = builder.source; - this.reformat = builder.reformat; - this.threshold = builder.threshold; - - } - - public static SlowlogSettings of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code level} - */ - @Nullable - public final String level() { - return this.level; - } - - /** - * API name: {@code source} - */ - @Nullable - public final Integer source() { - return this.source; - } - - /** - * API name: {@code reformat} - */ - @Nullable - public final Boolean reformat() { - return this.reformat; - } - - /** - * API name: {@code threshold} - */ - @Nullable - public final SlowlogTresholds threshold() { - return this.threshold; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.level != null) { - generator.writeKey("level"); - generator.write(this.level); - - } - if (this.source != null) { - generator.writeKey("source"); - generator.write(this.source); - - } - if (this.reformat != null) { - generator.writeKey("reformat"); - generator.write(this.reformat); - - } - if (this.threshold != null) { - generator.writeKey("threshold"); - this.threshold.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SlowlogSettings}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private String level; - - @Nullable - private Integer source; - - @Nullable - private Boolean reformat; - - @Nullable - private SlowlogTresholds threshold; - - /** - * API name: {@code level} - */ - public final Builder level(@Nullable String value) { - this.level = value; - return this; - } - - /** - * API name: {@code source} - */ - public final Builder source(@Nullable Integer value) { - this.source = value; - return this; - } - - /** - * API name: {@code reformat} - */ - public final Builder reformat(@Nullable Boolean value) { - this.reformat = value; - return this; - } - - /** - * API name: {@code threshold} - */ - public final Builder threshold(@Nullable SlowlogTresholds value) { - this.threshold = value; - return this; - } - - /** - * API name: {@code threshold} - */ - public final Builder threshold(Function> fn) { - return this.threshold(fn.apply(new SlowlogTresholds.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link SlowlogSettings}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SlowlogSettings build() { - _checkSingleUse(); - - return new SlowlogSettings(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SlowlogSettings} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - SlowlogSettings::setupSlowlogSettingsDeserializer); - - protected static void setupSlowlogSettingsDeserializer(ObjectDeserializer op) { - - op.add(Builder::level, JsonpDeserializer.stringDeserializer(), "level"); - op.add(Builder::source, JsonpDeserializer.integerDeserializer(), "source"); - op.add(Builder::reformat, JsonpDeserializer.booleanDeserializer(), "reformat"); - op.add(Builder::threshold, SlowlogTresholds._DESERIALIZER, "threshold"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SlowlogTresholdLevels.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SlowlogTresholdLevels.java deleted file mode 100644 index 16e3e513f..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SlowlogTresholdLevels.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.SlowlogTresholdLevels - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class SlowlogTresholdLevels implements JsonpSerializable { - @Nullable - private final Time warn; - - @Nullable - private final Time info; - - @Nullable - private final Time debug; - - @Nullable - private final Time trace; - - // --------------------------------------------------------------------------------------------- - - private SlowlogTresholdLevels(Builder builder) { - - this.warn = builder.warn; - this.info = builder.info; - this.debug = builder.debug; - this.trace = builder.trace; - - } - - public static SlowlogTresholdLevels of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code warn} - */ - @Nullable - public final Time warn() { - return this.warn; - } - - /** - * API name: {@code info} - */ - @Nullable - public final Time info() { - return this.info; - } - - /** - * API name: {@code debug} - */ - @Nullable - public final Time debug() { - return this.debug; - } - - /** - * API name: {@code trace} - */ - @Nullable - public final Time trace() { - return this.trace; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.warn != null) { - generator.writeKey("warn"); - this.warn.serialize(generator, mapper); - - } - if (this.info != null) { - generator.writeKey("info"); - this.info.serialize(generator, mapper); - - } - if (this.debug != null) { - generator.writeKey("debug"); - this.debug.serialize(generator, mapper); - - } - if (this.trace != null) { - generator.writeKey("trace"); - this.trace.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SlowlogTresholdLevels}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Time warn; - - @Nullable - private Time info; - - @Nullable - private Time debug; - - @Nullable - private Time trace; - - /** - * API name: {@code warn} - */ - public final Builder warn(@Nullable Time value) { - this.warn = value; - return this; - } - - /** - * API name: {@code warn} - */ - public final Builder warn(Function> fn) { - return this.warn(fn.apply(new Time.Builder()).build()); - } - - /** - * API name: {@code info} - */ - public final Builder info(@Nullable Time value) { - this.info = value; - return this; - } - - /** - * API name: {@code info} - */ - public final Builder info(Function> fn) { - return this.info(fn.apply(new Time.Builder()).build()); - } - - /** - * API name: {@code debug} - */ - public final Builder debug(@Nullable Time value) { - this.debug = value; - return this; - } - - /** - * API name: {@code debug} - */ - public final Builder debug(Function> fn) { - return this.debug(fn.apply(new Time.Builder()).build()); - } - - /** - * API name: {@code trace} - */ - public final Builder trace(@Nullable Time value) { - this.trace = value; - return this; - } - - /** - * API name: {@code trace} - */ - public final Builder trace(Function> fn) { - return this.trace(fn.apply(new Time.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link SlowlogTresholdLevels}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SlowlogTresholdLevels build() { - _checkSingleUse(); - - return new SlowlogTresholdLevels(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SlowlogTresholdLevels} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, SlowlogTresholdLevels::setupSlowlogTresholdLevelsDeserializer); - - protected static void setupSlowlogTresholdLevelsDeserializer(ObjectDeserializer op) { - - op.add(Builder::warn, Time._DESERIALIZER, "warn"); - op.add(Builder::info, Time._DESERIALIZER, "info"); - op.add(Builder::debug, Time._DESERIALIZER, "debug"); - op.add(Builder::trace, Time._DESERIALIZER, "trace"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SlowlogTresholds.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SlowlogTresholds.java deleted file mode 100644 index 4354d448a..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SlowlogTresholds.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.SlowlogTresholds - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class SlowlogTresholds implements JsonpSerializable { - @Nullable - private final SlowlogTresholdLevels query; - - @Nullable - private final SlowlogTresholdLevels fetch; - - // --------------------------------------------------------------------------------------------- - - private SlowlogTresholds(Builder builder) { - - this.query = builder.query; - this.fetch = builder.fetch; - - } - - public static SlowlogTresholds of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code query} - */ - @Nullable - public final SlowlogTresholdLevels query() { - return this.query; - } - - /** - * API name: {@code fetch} - */ - @Nullable - public final SlowlogTresholdLevels fetch() { - return this.fetch; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.query != null) { - generator.writeKey("query"); - this.query.serialize(generator, mapper); - - } - if (this.fetch != null) { - generator.writeKey("fetch"); - this.fetch.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SlowlogTresholds}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private SlowlogTresholdLevels query; - - @Nullable - private SlowlogTresholdLevels fetch; - - /** - * API name: {@code query} - */ - public final Builder query(@Nullable SlowlogTresholdLevels value) { - this.query = value; - return this; - } - - /** - * API name: {@code query} - */ - public final Builder query(Function> fn) { - return this.query(fn.apply(new SlowlogTresholdLevels.Builder()).build()); - } - - /** - * API name: {@code fetch} - */ - public final Builder fetch(@Nullable SlowlogTresholdLevels value) { - this.fetch = value; - return this; - } - - /** - * API name: {@code fetch} - */ - public final Builder fetch(Function> fn) { - return this.fetch(fn.apply(new SlowlogTresholdLevels.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link SlowlogTresholds}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SlowlogTresholds build() { - _checkSingleUse(); - - return new SlowlogTresholds(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SlowlogTresholds} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - SlowlogTresholds::setupSlowlogTresholdsDeserializer); - - protected static void setupSlowlogTresholdsDeserializer(ObjectDeserializer op) { - - op.add(Builder::query, SlowlogTresholdLevels._DESERIALIZER, "query"); - op.add(Builder::fetch, SlowlogTresholdLevels._DESERIALIZER, "fetch"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SoftDeletes.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SoftDeletes.java deleted file mode 100644 index 13aa7f0d7..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/SoftDeletes.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.SoftDeletes - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class SoftDeletes implements JsonpSerializable { - @Nullable - private final Boolean enabled; - - @Nullable - private final RetentionLease retentionLease; - - // --------------------------------------------------------------------------------------------- - - private SoftDeletes(Builder builder) { - - this.enabled = builder.enabled; - this.retentionLease = builder.retentionLease; - - } - - public static SoftDeletes of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Indicates whether soft deletes are enabled on the index. - *

- * API name: {@code enabled} - */ - @Nullable - public final Boolean enabled() { - return this.enabled; - } - - /** - * 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. - *

- * API name: {@code retention_lease} - */ - @Nullable - public final RetentionLease retentionLease() { - return this.retentionLease; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.enabled != null) { - generator.writeKey("enabled"); - generator.write(this.enabled); - - } - if (this.retentionLease != null) { - generator.writeKey("retention_lease"); - this.retentionLease.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SoftDeletes}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private Boolean enabled; - - @Nullable - private RetentionLease retentionLease; - - /** - * Indicates whether soft deletes are enabled on the index. - *

- * API name: {@code enabled} - */ - public final Builder enabled(@Nullable Boolean value) { - this.enabled = value; - return this; - } - - /** - * 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. - *

- * API name: {@code retention_lease} - */ - public final Builder retentionLease(@Nullable RetentionLease value) { - this.retentionLease = value; - return this; - } - - /** - * 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. - *

- * API name: {@code retention_lease} - */ - public final Builder retentionLease(Function> fn) { - return this.retentionLease(fn.apply(new RetentionLease.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link SoftDeletes}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SoftDeletes build() { - _checkSingleUse(); - - return new SoftDeletes(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SoftDeletes} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - SoftDeletes::setupSoftDeletesDeserializer); - - protected static void setupSoftDeletesDeserializer(ObjectDeserializer op) { - - op.add(Builder::enabled, JsonpDeserializer.booleanDeserializer(), "enabled"); - op.add(Builder::retentionLease, RetentionLease._DESERIALIZER, "retention_lease"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/Storage.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/Storage.java deleted file mode 100644 index f1a8c63f9..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/Storage.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.Storage - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class Storage implements JsonpSerializable { - private final String type; - - @Nullable - private final Boolean allowMmap; - - // --------------------------------------------------------------------------------------------- - - private Storage(Builder builder) { - - this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - this.allowMmap = builder.allowMmap; - - } - - public static Storage of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code type} - */ - public final String type() { - return this.type; - } - - /** - * You can restrict the use of the mmapfs and the related hybridfs store type - * via the setting node.store.allow_mmap. This is a boolean setting indicating - * whether or not memory-mapping is allowed. The default is to allow it. This - * setting is useful, for example, if you are in an environment where you can - * not control the ability to create a lot of memory maps so you need disable - * the ability to use memory-mapping. - *

- * API name: {@code allow_mmap} - */ - @Nullable - public final Boolean allowMmap() { - return this.allowMmap; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("type"); - generator.write(this.type); - - if (this.allowMmap != null) { - generator.writeKey("allow_mmap"); - generator.write(this.allowMmap); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link Storage}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private String type; - - @Nullable - private Boolean allowMmap; - - /** - * Required - API name: {@code type} - */ - public final Builder type(String value) { - this.type = value; - return this; - } - - /** - * Required - API name: {@code type} - */ - public final Builder type(StorageType value) { - this.type = value == null ? null : value.jsonValue(); - return this; - } - - /** - * You can restrict the use of the mmapfs and the related hybridfs store type - * via the setting node.store.allow_mmap. This is a boolean setting indicating - * whether or not memory-mapping is allowed. The default is to allow it. This - * setting is useful, for example, if you are in an environment where you can - * not control the ability to create a lot of memory maps so you need disable - * the ability to use memory-mapping. - *

- * API name: {@code allow_mmap} - */ - public final Builder allowMmap(@Nullable Boolean value) { - this.allowMmap = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link Storage}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public Storage build() { - _checkSingleUse(); - - return new Storage(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link Storage} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - Storage::setupStorageDeserializer); - - protected static void setupStorageDeserializer(ObjectDeserializer op) { - - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); - op.add(Builder::allowMmap, JsonpDeserializer.booleanDeserializer(), "allow_mmap"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/StorageType.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/StorageType.java deleted file mode 100644 index 2b429e72c..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/StorageType.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum StorageType implements JsonEnum { - /** - * 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. - */ - Fs("fs"), - - /** - * 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. - */ - Niofs("niofs"), - - /** - * 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. - */ - Mmapfs("mmapfs"), - - /** - * The hybridfs type is a hybrid of niofs and mmapfs, which chooses the best - * file system type for each type of file based on the read access pattern. - * Currently only the Lucene term dictionary, norms and doc values files are - * memory mapped. All other files are opened using Lucene NIOFSDirectory. - * Similarly to mmapfs be sure you have allowed plenty of virtual address space. - */ - Hybridfs("hybridfs"), - - ; - - private final String jsonValue; - - StorageType(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - StorageType.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/Translog.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/Translog.java deleted file mode 100644 index 5f42a6e05..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/Translog.java +++ /dev/null @@ -1,290 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.Translog - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class Translog implements JsonpSerializable { - @Nullable - private final Time syncInterval; - - @Nullable - private final TranslogDurability durability; - - @Nullable - private final String flushThresholdSize; - - @Nullable - private final TranslogRetention retention; - - // --------------------------------------------------------------------------------------------- - - private Translog(Builder builder) { - - this.syncInterval = builder.syncInterval; - this.durability = builder.durability; - this.flushThresholdSize = builder.flushThresholdSize; - this.retention = builder.retention; - - } - - public static Translog of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * How often the translog is fsynced to disk and committed, regardless of write - * operations. Values less than 100ms are not allowed. - *

- * API name: {@code sync_interval} - */ - @Nullable - public final Time syncInterval() { - return this.syncInterval; - } - - /** - * Whether or not to fsync and commit the translog after every - * index, delete, update, or bulk request. - *

- * API name: {@code durability} - */ - @Nullable - public final TranslogDurability durability() { - return this.durability; - } - - /** - * 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. - *

- * API name: {@code flush_threshold_size} - */ - @Nullable - public final String flushThresholdSize() { - return this.flushThresholdSize; - } - - /** - * API name: {@code retention} - */ - @Nullable - public final TranslogRetention retention() { - return this.retention; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.syncInterval != null) { - generator.writeKey("sync_interval"); - this.syncInterval.serialize(generator, mapper); - - } - if (this.durability != null) { - generator.writeKey("durability"); - this.durability.serialize(generator, mapper); - } - if (this.flushThresholdSize != null) { - generator.writeKey("flush_threshold_size"); - generator.write(this.flushThresholdSize); - - } - if (this.retention != null) { - generator.writeKey("retention"); - this.retention.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link Translog}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private Time syncInterval; - - @Nullable - private TranslogDurability durability; - - @Nullable - private String flushThresholdSize; - - @Nullable - private TranslogRetention retention; - - /** - * How often the translog is fsynced to disk and committed, regardless of write - * operations. Values less than 100ms are not allowed. - *

- * API name: {@code sync_interval} - */ - public final Builder syncInterval(@Nullable Time value) { - this.syncInterval = value; - return this; - } - - /** - * How often the translog is fsynced to disk and committed, regardless of write - * operations. Values less than 100ms are not allowed. - *

- * API name: {@code sync_interval} - */ - public final Builder syncInterval(Function> fn) { - return this.syncInterval(fn.apply(new Time.Builder()).build()); - } - - /** - * Whether or not to fsync and commit the translog after every - * index, delete, update, or bulk request. - *

- * API name: {@code durability} - */ - public final Builder durability(@Nullable TranslogDurability value) { - this.durability = value; - return this; - } - - /** - * 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. - *

- * API name: {@code flush_threshold_size} - */ - public final Builder flushThresholdSize(@Nullable String value) { - this.flushThresholdSize = value; - return this; - } - - /** - * API name: {@code retention} - */ - public final Builder retention(@Nullable TranslogRetention value) { - this.retention = value; - return this; - } - - /** - * API name: {@code retention} - */ - public final Builder retention(Function> fn) { - return this.retention(fn.apply(new TranslogRetention.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link Translog}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public Translog build() { - _checkSingleUse(); - - return new Translog(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link Translog} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - Translog::setupTranslogDeserializer); - - protected static void setupTranslogDeserializer(ObjectDeserializer op) { - - op.add(Builder::syncInterval, Time._DESERIALIZER, "sync_interval"); - op.add(Builder::durability, TranslogDurability._DESERIALIZER, "durability"); - op.add(Builder::flushThresholdSize, JsonpDeserializer.stringDeserializer(), "flush_threshold_size"); - op.add(Builder::retention, TranslogRetention._DESERIALIZER, "retention"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/TranslogDurability.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/TranslogDurability.java deleted file mode 100644 index c56acd4ca..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/TranslogDurability.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum TranslogDurability implements JsonEnum { - /** - * (default) fsync and commit after every request. In the event of hardware - * failure, all acknowledged writes will already have been committed to disk. - */ - Request("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. - */ - Async("async", "ASYNC"), - - ; - - private final String jsonValue; - private final String[] aliases; - - TranslogDurability(String jsonValue, String... aliases) { - this.jsonValue = jsonValue; - this.aliases = aliases; - } - - public String jsonValue() { - return this.jsonValue; - } - - public String[] aliases() { - return this.aliases; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - TranslogDurability.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/TranslogRetention.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/TranslogRetention.java deleted file mode 100644 index 5b768461b..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/TranslogRetention.java +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices._types.TranslogRetention - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class TranslogRetention implements JsonpSerializable { - @Nullable - private final String size; - - @Nullable - private final Time age; - - // --------------------------------------------------------------------------------------------- - - private TranslogRetention(Builder builder) { - - this.size = builder.size; - this.age = builder.age; - - } - - public static TranslogRetention of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code size} - */ - @Nullable - public final String size() { - return this.size; - } - - /** - * This controls the maximum duration for which translog files are kept by each - * shard. Keeping more translog files increases the chance of performing an - * operation based sync when recovering replicas. 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. - *

- * API name: {@code age} - */ - @Nullable - public final Time age() { - return this.age; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.size != null) { - generator.writeKey("size"); - generator.write(this.size); - - } - if (this.age != null) { - generator.writeKey("age"); - this.age.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link TranslogRetention}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private String size; - - @Nullable - private Time age; - - /** - * 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. - *

- * API name: {@code size} - */ - public final Builder size(@Nullable String value) { - this.size = value; - return this; - } - - /** - * This controls the maximum duration for which translog files are kept by each - * shard. Keeping more translog files increases the chance of performing an - * operation based sync when recovering replicas. 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. - *

- * API name: {@code age} - */ - public final Builder age(@Nullable Time value) { - this.age = value; - return this; - } - - /** - * This controls the maximum duration for which translog files are kept by each - * shard. Keeping more translog files increases the chance of performing an - * operation based sync when recovering replicas. 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. - *

- * API name: {@code age} - */ - public final Builder age(Function> fn) { - return this.age(fn.apply(new Time.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link TranslogRetention}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public TranslogRetention build() { - _checkSingleUse(); - - return new TranslogRetention(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link TranslogRetention} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, TranslogRetention::setupTranslogRetentionDeserializer); - - protected static void setupTranslogRetentionDeserializer(ObjectDeserializer op) { - - op.add(Builder::size, JsonpDeserializer.stringDeserializer(), "size"); - op.add(Builder::age, Time._DESERIALIZER, "age"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/UpdateAliasesRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/UpdateAliasesRequest.java deleted file mode 100644 index 8c5b888d7..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/UpdateAliasesRequest.java +++ /dev/null @@ -1,311 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.elasticsearch.indices.update_aliases.Action; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.update_aliases.Request - -/** - * Create or update an alias. Adds a data stream or index to an alias. - * - * @see API - * specification - */ -@JsonpDeserializable -public class UpdateAliasesRequest extends RequestBase implements JsonpSerializable { - private final List actions; - - @Nullable - private final Time masterTimeout; - - @Nullable - private final Time timeout; - - // --------------------------------------------------------------------------------------------- - - private UpdateAliasesRequest(Builder builder) { - - this.actions = ApiTypeHelper.unmodifiable(builder.actions); - this.masterTimeout = builder.masterTimeout; - this.timeout = builder.timeout; - - } - - public static UpdateAliasesRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Actions to perform. - *

- * API name: {@code actions} - */ - public final List actions() { - return this.actions; - } - - /** - * 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. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. - *

- * API name: {@code timeout} - */ - @Nullable - public final Time timeout() { - return this.timeout; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.actions)) { - generator.writeKey("actions"); - generator.writeStartArray(); - for (Action item0 : this.actions) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link UpdateAliasesRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private List actions; - - @Nullable - private Time masterTimeout; - - @Nullable - private Time timeout; - - /** - * Actions to perform. - *

- * API name: {@code actions} - *

- * Adds all elements of list to actions. - */ - public final Builder actions(List list) { - this.actions = _listAddAll(this.actions, list); - return this; - } - - /** - * Actions to perform. - *

- * API name: {@code actions} - *

- * Adds one or more values to actions. - */ - public final Builder actions(Action value, Action... values) { - this.actions = _listAdd(this.actions, value, values); - return this; - } - - /** - * Actions to perform. - *

- * API name: {@code actions} - *

- * Adds a value to actions using a builder lambda. - */ - public final Builder actions(Function> fn) { - return actions(fn.apply(new Action.Builder()).build()); - } - - /** - * 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = 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. - *

- * API name: {@code master_timeout} - */ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. - *

- * API name: {@code timeout} - */ - public final Builder timeout(@Nullable Time value) { - this.timeout = 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. - *

- * API name: {@code timeout} - */ - public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link UpdateAliasesRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public UpdateAliasesRequest build() { - _checkSingleUse(); - - return new UpdateAliasesRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link UpdateAliasesRequest} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, UpdateAliasesRequest::setupUpdateAliasesRequestDeserializer); - - protected static void setupUpdateAliasesRequestDeserializer(ObjectDeserializer op) { - - op.add(Builder::actions, JsonpDeserializer.arrayDeserializer(Action._DESERIALIZER), "actions"); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.update_aliases}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.update_aliases", - - // Request method - request -> { - return "POST"; - - }, - - // Request path - request -> { - return "/_aliases"; - - }, - - // Path parameters - request -> { - return Collections.emptyMap(); - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (request.timeout != null) { - params.put("timeout", request.timeout._toJsonString()); - } - return params; - - }, SimpleEndpoint.emptyMap(), true, UpdateAliasesResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/UpdateAliasesResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/UpdateAliasesResponse.java deleted file mode 100644 index defd4316c..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/UpdateAliasesResponse.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.update_aliases.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class UpdateAliasesResponse extends AcknowledgedResponseBase { - // --------------------------------------------------------------------------------------------- - - private UpdateAliasesResponse(Builder builder) { - super(builder); - - } - - public static UpdateAliasesResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link UpdateAliasesResponse}. - */ - - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder - implements - ObjectBuilder { - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link UpdateAliasesResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public UpdateAliasesResponse build() { - _checkSingleUse(); - - return new UpdateAliasesResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link UpdateAliasesResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, UpdateAliasesResponse::setupUpdateAliasesResponseDeserializer); - - protected static void setupUpdateAliasesResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ValidateQueryRequest.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ValidateQueryRequest.java deleted file mode 100644 index 0d2ae4412..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ValidateQueryRequest.java +++ /dev/null @@ -1,702 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.ExpandWildcard; -import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.query_dsl.Operator; -import co.elastic.clients.elasticsearch._types.query_dsl.Query; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.transport.Endpoint; -import co.elastic.clients.transport.endpoints.SimpleEndpoint; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.validate_query.Request - -/** - * Validate a query. Validates a query without running it. - * - * @see API - * specification - */ -@JsonpDeserializable -public class ValidateQueryRequest extends RequestBase implements JsonpSerializable { - @Nullable - private final Boolean allShards; - - @Nullable - private final Boolean allowNoIndices; - - @Nullable - private final Boolean analyzeWildcard; - - @Nullable - private final String analyzer; - - @Nullable - private final Operator defaultOperator; - - @Nullable - private final String df; - - private final List expandWildcards; - - @Nullable - private final Boolean explain; - - @Nullable - private final Boolean ignoreUnavailable; - - private final List index; - - @Nullable - private final Boolean lenient; - - @Nullable - private final String q; - - @Nullable - private final Query query; - - @Nullable - private final Boolean rewrite; - - // --------------------------------------------------------------------------------------------- - - private ValidateQueryRequest(Builder builder) { - - this.allShards = builder.allShards; - this.allowNoIndices = builder.allowNoIndices; - this.analyzeWildcard = builder.analyzeWildcard; - this.analyzer = builder.analyzer; - this.defaultOperator = builder.defaultOperator; - this.df = builder.df; - this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); - this.explain = builder.explain; - this.ignoreUnavailable = builder.ignoreUnavailable; - this.index = ApiTypeHelper.unmodifiable(builder.index); - this.lenient = builder.lenient; - this.q = builder.q; - this.query = builder.query; - this.rewrite = builder.rewrite; - - } - - public static ValidateQueryRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * If true, the validation is executed on all shards instead of one - * random shard per index. - *

- * API name: {@code all_shards} - */ - @Nullable - public final Boolean allShards() { - return this.allShards; - } - - /** - * 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. - *

- * API name: {@code allow_no_indices} - */ - @Nullable - public final Boolean allowNoIndices() { - return this.allowNoIndices; - } - - /** - * If true, wildcard and prefix queries are analyzed. - *

- * API name: {@code analyze_wildcard} - */ - @Nullable - public final Boolean analyzeWildcard() { - return this.analyzeWildcard; - } - - /** - * Analyzer to use for the query string. This parameter can only be used when - * the q query string parameter is specified. - *

- * API name: {@code analyzer} - */ - @Nullable - public final String analyzer() { - return this.analyzer; - } - - /** - * The default operator for query string query: AND or - * OR. - *

- * API name: {@code default_operator} - */ - @Nullable - public final Operator defaultOperator() { - return this.defaultOperator; - } - - /** - * 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. - *

- * API name: {@code df} - */ - @Nullable - public final String df() { - return this.df; - } - - /** - * 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. - *

- * API name: {@code expand_wildcards} - */ - public final List expandWildcards() { - return this.expandWildcards; - } - - /** - * If true, the response returns detailed information if an error - * has occurred. - *

- * API name: {@code explain} - */ - @Nullable - public final Boolean explain() { - return this.explain; - } - - /** - * If false, the request returns an error if it targets a missing - * or closed index. - *

- * API name: {@code ignore_unavailable} - */ - @Nullable - public final Boolean ignoreUnavailable() { - return this.ignoreUnavailable; - } - - /** - * 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. - *

- * API name: {@code index} - */ - public final List index() { - return this.index; - } - - /** - * If true, format-based query failures (such as providing text to - * a numeric field) in the query string will be ignored. - *

- * API name: {@code lenient} - */ - @Nullable - public final Boolean lenient() { - return this.lenient; - } - - /** - * Query in the Lucene query string syntax. - *

- * API name: {@code q} - */ - @Nullable - public final String q() { - return this.q; - } - - /** - * Query in the Lucene query string syntax. - *

- * API name: {@code query} - */ - @Nullable - public final Query query() { - return this.query; - } - - /** - * If true, returns a more detailed explanation showing the actual - * Lucene query that will be executed. - *

- * API name: {@code rewrite} - */ - @Nullable - public final Boolean rewrite() { - return this.rewrite; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.query != null) { - generator.writeKey("query"); - this.query.serialize(generator, mapper); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ValidateQueryRequest}. - */ - - public static class Builder extends RequestBase.AbstractBuilder - implements - ObjectBuilder { - @Nullable - private Boolean allShards; - - @Nullable - private Boolean allowNoIndices; - - @Nullable - private Boolean analyzeWildcard; - - @Nullable - private String analyzer; - - @Nullable - private Operator defaultOperator; - - @Nullable - private String df; - - @Nullable - private List expandWildcards; - - @Nullable - private Boolean explain; - - @Nullable - private Boolean ignoreUnavailable; - - @Nullable - private List index; - - @Nullable - private Boolean lenient; - - @Nullable - private String q; - - @Nullable - private Query query; - - @Nullable - private Boolean rewrite; - - /** - * If true, the validation is executed on all shards instead of one - * random shard per index. - *

- * API name: {@code all_shards} - */ - public final Builder allShards(@Nullable Boolean value) { - this.allShards = 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. - *

- * API name: {@code allow_no_indices} - */ - public final Builder allowNoIndices(@Nullable Boolean value) { - this.allowNoIndices = value; - return this; - } - - /** - * If true, wildcard and prefix queries are analyzed. - *

- * API name: {@code analyze_wildcard} - */ - public final Builder analyzeWildcard(@Nullable Boolean value) { - this.analyzeWildcard = value; - return this; - } - - /** - * Analyzer to use for the query string. This parameter can only be used when - * the q query string parameter is specified. - *

- * API name: {@code analyzer} - */ - public final Builder analyzer(@Nullable String value) { - this.analyzer = value; - return this; - } - - /** - * The default operator for query string query: AND or - * OR. - *

- * API name: {@code default_operator} - */ - public final Builder defaultOperator(@Nullable Operator value) { - this.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. - *

- * API name: {@code df} - */ - public final Builder df(@Nullable String value) { - this.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. - *

- * API name: {@code expand_wildcards} - *

- * Adds all elements of list to expandWildcards. - */ - public final Builder expandWildcards(List list) { - this.expandWildcards = _listAddAll(this.expandWildcards, list); - 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. - *

- * API name: {@code expand_wildcards} - *

- * Adds one or more values to expandWildcards. - */ - public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { - this.expandWildcards = _listAdd(this.expandWildcards, value, values); - return this; - } - - /** - * If true, the response returns detailed information if an error - * has occurred. - *

- * API name: {@code explain} - */ - public final Builder explain(@Nullable Boolean value) { - this.explain = value; - return this; - } - - /** - * If false, the request returns an error if it targets a missing - * or closed index. - *

- * API name: {@code ignore_unavailable} - */ - public final Builder ignoreUnavailable(@Nullable Boolean value) { - this.ignoreUnavailable = value; - return this; - } - - /** - * 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. - *

- * API name: {@code index} - *

- * Adds all elements of list to index. - */ - public final Builder index(List list) { - this.index = _listAddAll(this.index, list); - return this; - } - - /** - * 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. - *

- * API name: {@code index} - *

- * Adds one or more values to index. - */ - public final Builder index(String value, String... values) { - this.index = _listAdd(this.index, value, values); - return this; - } - - /** - * If true, format-based query failures (such as providing text to - * a numeric field) in the query string will be ignored. - *

- * API name: {@code lenient} - */ - public final Builder lenient(@Nullable Boolean value) { - this.lenient = value; - return this; - } - - /** - * Query in the Lucene query string syntax. - *

- * API name: {@code q} - */ - public final Builder q(@Nullable String value) { - this.q = value; - return this; - } - - /** - * Query in the Lucene query string syntax. - *

- * API name: {@code query} - */ - public final Builder query(@Nullable Query value) { - this.query = value; - return this; - } - - /** - * Query in the Lucene query string syntax. - *

- * API name: {@code query} - */ - public final Builder query(Function> fn) { - return this.query(fn.apply(new Query.Builder()).build()); - } - - /** - * If true, returns a more detailed explanation showing the actual - * Lucene query that will be executed. - *

- * API name: {@code rewrite} - */ - public final Builder rewrite(@Nullable Boolean value) { - this.rewrite = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ValidateQueryRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ValidateQueryRequest build() { - _checkSingleUse(); - - return new ValidateQueryRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ValidateQueryRequest} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, ValidateQueryRequest::setupValidateQueryRequestDeserializer); - - protected static void setupValidateQueryRequestDeserializer(ObjectDeserializer op) { - - op.add(Builder::query, Query._DESERIALIZER, "query"); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.validate_query}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/indices.validate_query", - - // Request method - request -> { - return "POST"; - - }, - - // Request path - request -> { - final int _index = 1 << 0; - - int propsSet = 0; - - if (ApiTypeHelper.isDefined(request.index())) - propsSet |= _index; - - if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_validate"); - buf.append("/query"); - return buf.toString(); - } - if (propsSet == (_index)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_validate"); - buf.append("/query"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Path parameters - request -> { - Map params = new HashMap<>(); - final int _index = 1 << 0; - - int propsSet = 0; - - if (ApiTypeHelper.isDefined(request.index())) - propsSet |= _index; - - if (propsSet == 0) { - } - if (propsSet == (_index)) { - params.put("index", request.index.stream().map(v -> v).collect(Collectors.joining(","))); - } - return params; - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.explain != null) { - params.put("explain", String.valueOf(request.explain)); - } - if (request.q != null) { - params.put("q", request.q); - } - if (request.df != null) { - params.put("df", request.df); - } - if (request.defaultOperator != null) { - params.put("default_operator", request.defaultOperator.jsonValue()); - } - if (request.allShards != null) { - params.put("all_shards", String.valueOf(request.allShards)); - } - if (ApiTypeHelper.isDefined(request.expandWildcards)) { - params.put("expand_wildcards", - request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); - } - if (request.ignoreUnavailable != null) { - params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); - } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } - if (request.analyzer != null) { - params.put("analyzer", request.analyzer); - } - if (request.analyzeWildcard != null) { - params.put("analyze_wildcard", String.valueOf(request.analyzeWildcard)); - } - if (request.lenient != null) { - params.put("lenient", String.valueOf(request.lenient)); - } - if (request.rewrite != null) { - params.put("rewrite", String.valueOf(request.rewrite)); - } - return params; - - }, SimpleEndpoint.emptyMap(), true, ValidateQueryResponse._DESERIALIZER); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ValidateQueryResponse.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ValidateQueryResponse.java deleted file mode 100644 index b269fc8ad..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/ValidateQueryResponse.java +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices; - -import co.elastic.clients.elasticsearch._types.ShardStatistics; -import co.elastic.clients.elasticsearch.indices.validate_query.IndicesValidationExplanation; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.validate_query.Response - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class ValidateQueryResponse implements JsonpSerializable { - private final List explanations; - - @Nullable - private final ShardStatistics shards; - - private final boolean valid; - - @Nullable - private final String error; - - // --------------------------------------------------------------------------------------------- - - private ValidateQueryResponse(Builder builder) { - - this.explanations = ApiTypeHelper.unmodifiable(builder.explanations); - this.shards = builder.shards; - this.valid = ApiTypeHelper.requireNonNull(builder.valid, this, "valid"); - this.error = builder.error; - - } - - public static ValidateQueryResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code explanations} - */ - public final List explanations() { - return this.explanations; - } - - /** - * API name: {@code _shards} - */ - @Nullable - public final ShardStatistics shards() { - return this.shards; - } - - /** - * Required - API name: {@code valid} - */ - public final boolean valid() { - return this.valid; - } - - /** - * API name: {@code error} - */ - @Nullable - public final String error() { - return this.error; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.explanations)) { - generator.writeKey("explanations"); - generator.writeStartArray(); - for (IndicesValidationExplanation item0 : this.explanations) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.shards != null) { - generator.writeKey("_shards"); - this.shards.serialize(generator, mapper); - - } - generator.writeKey("valid"); - generator.write(this.valid); - - if (this.error != null) { - generator.writeKey("error"); - generator.write(this.error); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ValidateQueryResponse}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private List explanations; - - @Nullable - private ShardStatistics shards; - - private Boolean valid; - - @Nullable - private String error; - - /** - * API name: {@code explanations} - *

- * Adds all elements of list to explanations. - */ - public final Builder explanations(List list) { - this.explanations = _listAddAll(this.explanations, list); - return this; - } - - /** - * API name: {@code explanations} - *

- * Adds one or more values to explanations. - */ - public final Builder explanations(IndicesValidationExplanation value, IndicesValidationExplanation... values) { - this.explanations = _listAdd(this.explanations, value, values); - return this; - } - - /** - * API name: {@code explanations} - *

- * Adds a value to explanations using a builder lambda. - */ - public final Builder explanations( - Function> fn) { - return explanations(fn.apply(new IndicesValidationExplanation.Builder()).build()); - } - - /** - * API name: {@code _shards} - */ - public final Builder shards(@Nullable ShardStatistics value) { - this.shards = value; - return this; - } - - /** - * API name: {@code _shards} - */ - public final Builder shards(Function> fn) { - return this.shards(fn.apply(new ShardStatistics.Builder()).build()); - } - - /** - * Required - API name: {@code valid} - */ - public final Builder valid(boolean value) { - this.valid = value; - return this; - } - - /** - * API name: {@code error} - */ - public final Builder error(@Nullable String value) { - this.error = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ValidateQueryResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ValidateQueryResponse build() { - _checkSingleUse(); - - return new ValidateQueryResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ValidateQueryResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, ValidateQueryResponse::setupValidateQueryResponseDeserializer); - - protected static void setupValidateQueryResponseDeserializer(ObjectDeserializer op) { - - op.add(Builder::explanations, JsonpDeserializer.arrayDeserializer(IndicesValidationExplanation._DESERIALIZER), - "explanations"); - op.add(Builder::shards, ShardStatistics._DESERIALIZER, "_shards"); - op.add(Builder::valid, JsonpDeserializer.booleanDeserializer(), "valid"); - op.add(Builder::error, JsonpDeserializer.stringDeserializer(), "error"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/add_block/IndicesBlockOptions.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/add_block/IndicesBlockOptions.java deleted file mode 100644 index 7c646190d..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/add_block/IndicesBlockOptions.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.add_block; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum IndicesBlockOptions implements JsonEnum { - Metadata("metadata"), - - Read("read"), - - ReadOnly("read_only"), - - Write("write"), - - ; - - private final String jsonValue; - - IndicesBlockOptions(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - IndicesBlockOptions.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/add_block/IndicesBlockStatus.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/add_block/IndicesBlockStatus.java deleted file mode 100644 index cd9d033cd..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/add_block/IndicesBlockStatus.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.add_block; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.add_block.IndicesBlockStatus - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndicesBlockStatus implements JsonpSerializable { - private final String name; - - private final boolean blocked; - - // --------------------------------------------------------------------------------------------- - - private IndicesBlockStatus(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.blocked = ApiTypeHelper.requireNonNull(builder.blocked, this, "blocked"); - - } - - public static IndicesBlockStatus of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Required - API name: {@code blocked} - */ - public final boolean blocked() { - return this.blocked; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("name"); - generator.write(this.name); - - generator.writeKey("blocked"); - generator.write(this.blocked); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndicesBlockStatus}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private String name; - - private Boolean blocked; - - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * Required - API name: {@code blocked} - */ - public final Builder blocked(boolean value) { - this.blocked = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndicesBlockStatus}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndicesBlockStatus build() { - _checkSingleUse(); - - return new IndicesBlockStatus(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndicesBlockStatus} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, IndicesBlockStatus::setupIndicesBlockStatusDeserializer); - - protected static void setupIndicesBlockStatusDeserializer(ObjectDeserializer op) { - - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::blocked, JsonpDeserializer.booleanDeserializer(), "blocked"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/analyze/AnalyzeDetail.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/analyze/AnalyzeDetail.java deleted file mode 100644 index 00ba2a66c..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/analyze/AnalyzeDetail.java +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.analyze; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.analyze.AnalyzeDetail - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class AnalyzeDetail implements JsonpSerializable { - @Nullable - private final AnalyzerDetail analyzer; - - private final List charfilters; - - private final boolean customAnalyzer; - - private final List tokenfilters; - - @Nullable - private final TokenDetail tokenizer; - - // --------------------------------------------------------------------------------------------- - - private AnalyzeDetail(Builder builder) { - - this.analyzer = builder.analyzer; - this.charfilters = ApiTypeHelper.unmodifiable(builder.charfilters); - this.customAnalyzer = ApiTypeHelper.requireNonNull(builder.customAnalyzer, this, "customAnalyzer"); - this.tokenfilters = ApiTypeHelper.unmodifiable(builder.tokenfilters); - this.tokenizer = builder.tokenizer; - - } - - public static AnalyzeDetail of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code analyzer} - */ - @Nullable - public final AnalyzerDetail analyzer() { - return this.analyzer; - } - - /** - * API name: {@code charfilters} - */ - public final List charfilters() { - return this.charfilters; - } - - /** - * Required - API name: {@code custom_analyzer} - */ - public final boolean customAnalyzer() { - return this.customAnalyzer; - } - - /** - * API name: {@code tokenfilters} - */ - public final List tokenfilters() { - return this.tokenfilters; - } - - /** - * API name: {@code tokenizer} - */ - @Nullable - public final TokenDetail tokenizer() { - return this.tokenizer; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.analyzer != null) { - generator.writeKey("analyzer"); - this.analyzer.serialize(generator, mapper); - - } - if (ApiTypeHelper.isDefined(this.charfilters)) { - generator.writeKey("charfilters"); - generator.writeStartArray(); - for (CharFilterDetail item0 : this.charfilters) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - generator.writeKey("custom_analyzer"); - generator.write(this.customAnalyzer); - - if (ApiTypeHelper.isDefined(this.tokenfilters)) { - generator.writeKey("tokenfilters"); - generator.writeStartArray(); - for (TokenDetail item0 : this.tokenfilters) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.tokenizer != null) { - generator.writeKey("tokenizer"); - this.tokenizer.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link AnalyzeDetail}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private AnalyzerDetail analyzer; - - @Nullable - private List charfilters; - - private Boolean customAnalyzer; - - @Nullable - private List tokenfilters; - - @Nullable - private TokenDetail tokenizer; - - /** - * API name: {@code analyzer} - */ - public final Builder analyzer(@Nullable AnalyzerDetail value) { - this.analyzer = value; - return this; - } - - /** - * API name: {@code analyzer} - */ - public final Builder analyzer(Function> fn) { - return this.analyzer(fn.apply(new AnalyzerDetail.Builder()).build()); - } - - /** - * API name: {@code charfilters} - *

- * Adds all elements of list to charfilters. - */ - public final Builder charfilters(List list) { - this.charfilters = _listAddAll(this.charfilters, list); - return this; - } - - /** - * API name: {@code charfilters} - *

- * Adds one or more values to charfilters. - */ - public final Builder charfilters(CharFilterDetail value, CharFilterDetail... values) { - this.charfilters = _listAdd(this.charfilters, value, values); - return this; - } - - /** - * API name: {@code charfilters} - *

- * Adds a value to charfilters using a builder lambda. - */ - public final Builder charfilters(Function> fn) { - return charfilters(fn.apply(new CharFilterDetail.Builder()).build()); - } - - /** - * Required - API name: {@code custom_analyzer} - */ - public final Builder customAnalyzer(boolean value) { - this.customAnalyzer = value; - return this; - } - - /** - * API name: {@code tokenfilters} - *

- * Adds all elements of list to tokenfilters. - */ - public final Builder tokenfilters(List list) { - this.tokenfilters = _listAddAll(this.tokenfilters, list); - return this; - } - - /** - * API name: {@code tokenfilters} - *

- * Adds one or more values to tokenfilters. - */ - public final Builder tokenfilters(TokenDetail value, TokenDetail... values) { - this.tokenfilters = _listAdd(this.tokenfilters, value, values); - return this; - } - - /** - * API name: {@code tokenfilters} - *

- * Adds a value to tokenfilters using a builder lambda. - */ - public final Builder tokenfilters(Function> fn) { - return tokenfilters(fn.apply(new TokenDetail.Builder()).build()); - } - - /** - * API name: {@code tokenizer} - */ - public final Builder tokenizer(@Nullable TokenDetail value) { - this.tokenizer = value; - return this; - } - - /** - * API name: {@code tokenizer} - */ - public final Builder tokenizer(Function> fn) { - return this.tokenizer(fn.apply(new TokenDetail.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link AnalyzeDetail}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public AnalyzeDetail build() { - _checkSingleUse(); - - return new AnalyzeDetail(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link AnalyzeDetail} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - AnalyzeDetail::setupAnalyzeDetailDeserializer); - - protected static void setupAnalyzeDetailDeserializer(ObjectDeserializer op) { - - op.add(Builder::analyzer, AnalyzerDetail._DESERIALIZER, "analyzer"); - op.add(Builder::charfilters, JsonpDeserializer.arrayDeserializer(CharFilterDetail._DESERIALIZER), - "charfilters"); - op.add(Builder::customAnalyzer, JsonpDeserializer.booleanDeserializer(), "custom_analyzer"); - op.add(Builder::tokenfilters, JsonpDeserializer.arrayDeserializer(TokenDetail._DESERIALIZER), "tokenfilters"); - op.add(Builder::tokenizer, TokenDetail._DESERIALIZER, "tokenizer"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/analyze/AnalyzeToken.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/analyze/AnalyzeToken.java deleted file mode 100644 index e2630d9e9..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/analyze/AnalyzeToken.java +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.analyze; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Long; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.analyze.AnalyzeToken - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class AnalyzeToken implements JsonpSerializable { - private final long endOffset; - - private final long position; - - @Nullable - private final Long positionlength; - - private final long startOffset; - - private final String token; - - private final String type; - - // --------------------------------------------------------------------------------------------- - - private AnalyzeToken(Builder builder) { - - this.endOffset = ApiTypeHelper.requireNonNull(builder.endOffset, this, "endOffset"); - this.position = ApiTypeHelper.requireNonNull(builder.position, this, "position"); - this.positionlength = builder.positionlength; - this.startOffset = ApiTypeHelper.requireNonNull(builder.startOffset, this, "startOffset"); - this.token = ApiTypeHelper.requireNonNull(builder.token, this, "token"); - this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - - } - - public static AnalyzeToken of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code end_offset} - */ - public final long endOffset() { - return this.endOffset; - } - - /** - * Required - API name: {@code position} - */ - public final long position() { - return this.position; - } - - /** - * API name: {@code positionLength} - */ - @Nullable - public final Long positionlength() { - return this.positionlength; - } - - /** - * Required - API name: {@code start_offset} - */ - public final long startOffset() { - return this.startOffset; - } - - /** - * Required - API name: {@code token} - */ - public final String token() { - return this.token; - } - - /** - * Required - API name: {@code type} - */ - public final String type() { - return this.type; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("end_offset"); - generator.write(this.endOffset); - - generator.writeKey("position"); - generator.write(this.position); - - if (this.positionlength != null) { - generator.writeKey("positionLength"); - generator.write(this.positionlength); - - } - generator.writeKey("start_offset"); - generator.write(this.startOffset); - - generator.writeKey("token"); - generator.write(this.token); - - generator.writeKey("type"); - generator.write(this.type); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link AnalyzeToken}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Long endOffset; - - private Long position; - - @Nullable - private Long positionlength; - - private Long startOffset; - - private String token; - - private String type; - - /** - * Required - API name: {@code end_offset} - */ - public final Builder endOffset(long value) { - this.endOffset = value; - return this; - } - - /** - * Required - API name: {@code position} - */ - public final Builder position(long value) { - this.position = value; - return this; - } - - /** - * API name: {@code positionLength} - */ - public final Builder positionlength(@Nullable Long value) { - this.positionlength = value; - return this; - } - - /** - * Required - API name: {@code start_offset} - */ - public final Builder startOffset(long value) { - this.startOffset = value; - return this; - } - - /** - * Required - API name: {@code token} - */ - public final Builder token(String value) { - this.token = value; - return this; - } - - /** - * Required - API name: {@code type} - */ - public final Builder type(String value) { - this.type = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link AnalyzeToken}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public AnalyzeToken build() { - _checkSingleUse(); - - return new AnalyzeToken(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link AnalyzeToken} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - AnalyzeToken::setupAnalyzeTokenDeserializer); - - protected static void setupAnalyzeTokenDeserializer(ObjectDeserializer op) { - - op.add(Builder::endOffset, JsonpDeserializer.longDeserializer(), "end_offset"); - op.add(Builder::position, JsonpDeserializer.longDeserializer(), "position"); - op.add(Builder::positionlength, JsonpDeserializer.longDeserializer(), "positionLength"); - op.add(Builder::startOffset, JsonpDeserializer.longDeserializer(), "start_offset"); - op.add(Builder::token, JsonpDeserializer.stringDeserializer(), "token"); - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/analyze/AnalyzerDetail.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/analyze/AnalyzerDetail.java deleted file mode 100644 index 3037ce531..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/analyze/AnalyzerDetail.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.analyze; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.analyze.AnalyzerDetail - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class AnalyzerDetail implements JsonpSerializable { - private final String name; - - private final List tokens; - - // --------------------------------------------------------------------------------------------- - - private AnalyzerDetail(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.tokens = ApiTypeHelper.unmodifiableRequired(builder.tokens, this, "tokens"); - - } - - public static AnalyzerDetail of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Required - API name: {@code tokens} - */ - public final List tokens() { - return this.tokens; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("name"); - generator.write(this.name); - - if (ApiTypeHelper.isDefined(this.tokens)) { - generator.writeKey("tokens"); - generator.writeStartArray(); - for (ExplainAnalyzeToken item0 : this.tokens) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link AnalyzerDetail}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private String name; - - private List tokens; - - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * Required - API name: {@code tokens} - *

- * Adds all elements of list to tokens. - */ - public final Builder tokens(List list) { - this.tokens = _listAddAll(this.tokens, list); - return this; - } - - /** - * Required - API name: {@code tokens} - *

- * Adds one or more values to tokens. - */ - public final Builder tokens(ExplainAnalyzeToken value, ExplainAnalyzeToken... values) { - this.tokens = _listAdd(this.tokens, value, values); - return this; - } - - /** - * Required - API name: {@code tokens} - *

- * Adds a value to tokens using a builder lambda. - */ - public final Builder tokens(Function> fn) { - return tokens(fn.apply(new ExplainAnalyzeToken.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link AnalyzerDetail}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public AnalyzerDetail build() { - _checkSingleUse(); - - return new AnalyzerDetail(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link AnalyzerDetail} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - AnalyzerDetail::setupAnalyzerDetailDeserializer); - - protected static void setupAnalyzerDetailDeserializer(ObjectDeserializer op) { - - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::tokens, JsonpDeserializer.arrayDeserializer(ExplainAnalyzeToken._DESERIALIZER), "tokens"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/analyze/CharFilterDetail.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/analyze/CharFilterDetail.java deleted file mode 100644 index 4abd71957..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/analyze/CharFilterDetail.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.analyze; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.analyze.CharFilterDetail - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class CharFilterDetail implements JsonpSerializable { - private final List filteredText; - - private final String name; - - // --------------------------------------------------------------------------------------------- - - private CharFilterDetail(Builder builder) { - - this.filteredText = ApiTypeHelper.unmodifiableRequired(builder.filteredText, this, "filteredText"); - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - - } - - public static CharFilterDetail of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code filtered_text} - */ - public final List filteredText() { - return this.filteredText; - } - - /** - * Required - API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.filteredText)) { - generator.writeKey("filtered_text"); - generator.writeStartArray(); - for (String item0 : this.filteredText) { - generator.write(item0); - - } - generator.writeEnd(); - - } - generator.writeKey("name"); - generator.write(this.name); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link CharFilterDetail}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private List filteredText; - - private String name; - - /** - * Required - API name: {@code filtered_text} - *

- * Adds all elements of list to filteredText. - */ - public final Builder filteredText(List list) { - this.filteredText = _listAddAll(this.filteredText, list); - return this; - } - - /** - * Required - API name: {@code filtered_text} - *

- * Adds one or more values to filteredText. - */ - public final Builder filteredText(String value, String... values) { - this.filteredText = _listAdd(this.filteredText, value, values); - return this; - } - - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link CharFilterDetail}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public CharFilterDetail build() { - _checkSingleUse(); - - return new CharFilterDetail(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link CharFilterDetail} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - CharFilterDetail::setupCharFilterDetailDeserializer); - - protected static void setupCharFilterDetailDeserializer(ObjectDeserializer op) { - - op.add(Builder::filteredText, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "filtered_text"); - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/analyze/ExplainAnalyzeToken.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/analyze/ExplainAnalyzeToken.java deleted file mode 100644 index 241ceebf2..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/analyze/ExplainAnalyzeToken.java +++ /dev/null @@ -1,402 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.analyze; - -import co.elastic.clients.json.JsonData; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Long; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.analyze.ExplainAnalyzeToken - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class ExplainAnalyzeToken implements JsonpSerializable { - private final Map attributes; - - private final String bytes; - - private final long endOffset; - - @Nullable - private final Boolean keyword; - - private final long position; - - private final long positionlength; - - private final long startOffset; - - private final long termfrequency; - - private final String token; - - private final String type; - - // --------------------------------------------------------------------------------------------- - - private ExplainAnalyzeToken(Builder builder) { - - this.attributes = ApiTypeHelper.unmodifiable(builder.attributes); - - this.bytes = ApiTypeHelper.requireNonNull(builder.bytes, this, "bytes"); - this.endOffset = ApiTypeHelper.requireNonNull(builder.endOffset, this, "endOffset"); - this.keyword = builder.keyword; - this.position = ApiTypeHelper.requireNonNull(builder.position, this, "position"); - this.positionlength = ApiTypeHelper.requireNonNull(builder.positionlength, this, "positionlength"); - this.startOffset = ApiTypeHelper.requireNonNull(builder.startOffset, this, "startOffset"); - this.termfrequency = ApiTypeHelper.requireNonNull(builder.termfrequency, this, "termfrequency"); - this.token = ApiTypeHelper.requireNonNull(builder.token, this, "token"); - this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - - } - - public static ExplainAnalyzeToken of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Additional tokenizer-specific attributes - */ - public final Map attributes() { - return this.attributes; - } - - /** - * Required - API name: {@code bytes} - */ - public final String bytes() { - return this.bytes; - } - - /** - * Required - API name: {@code end_offset} - */ - public final long endOffset() { - return this.endOffset; - } - - /** - * API name: {@code keyword} - */ - @Nullable - public final Boolean keyword() { - return this.keyword; - } - - /** - * Required - API name: {@code position} - */ - public final long position() { - return this.position; - } - - /** - * Required - API name: {@code positionLength} - */ - public final long positionlength() { - return this.positionlength; - } - - /** - * Required - API name: {@code start_offset} - */ - public final long startOffset() { - return this.startOffset; - } - - /** - * Required - API name: {@code termFrequency} - */ - public final long termfrequency() { - return this.termfrequency; - } - - /** - * Required - API name: {@code token} - */ - public final String token() { - return this.token; - } - - /** - * Required - API name: {@code type} - */ - public final String type() { - return this.type; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - for (Map.Entry item0 : this.attributes.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - - generator.writeKey("bytes"); - generator.write(this.bytes); - - generator.writeKey("end_offset"); - generator.write(this.endOffset); - - if (this.keyword != null) { - generator.writeKey("keyword"); - generator.write(this.keyword); - - } - generator.writeKey("position"); - generator.write(this.position); - - generator.writeKey("positionLength"); - generator.write(this.positionlength); - - generator.writeKey("start_offset"); - generator.write(this.startOffset); - - generator.writeKey("termFrequency"); - generator.write(this.termfrequency); - - generator.writeKey("token"); - generator.write(this.token); - - generator.writeKey("type"); - generator.write(this.type); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ExplainAnalyzeToken}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Map attributes = new HashMap<>(); - - /** - * Additional tokenizer-specific attributes - *

- * Adds all entries of map to attributes. - */ - public final Builder attributes(Map map) { - this.attributes = _mapPutAll(this.attributes, map); - return this; - } - - /** - * Additional tokenizer-specific attributes - *

- * Adds an entry to attributes. - */ - public final Builder attributes(String key, JsonData value) { - this.attributes = _mapPut(this.attributes, key, value); - return this; - } - - private String bytes; - - private Long endOffset; - - @Nullable - private Boolean keyword; - - private Long position; - - private Long positionlength; - - private Long startOffset; - - private Long termfrequency; - - private String token; - - private String type; - - /** - * Required - API name: {@code bytes} - */ - public final Builder bytes(String value) { - this.bytes = value; - return this; - } - - /** - * Required - API name: {@code end_offset} - */ - public final Builder endOffset(long value) { - this.endOffset = value; - return this; - } - - /** - * API name: {@code keyword} - */ - public final Builder keyword(@Nullable Boolean value) { - this.keyword = value; - return this; - } - - /** - * Required - API name: {@code position} - */ - public final Builder position(long value) { - this.position = value; - return this; - } - - /** - * Required - API name: {@code positionLength} - */ - public final Builder positionlength(long value) { - this.positionlength = value; - return this; - } - - /** - * Required - API name: {@code start_offset} - */ - public final Builder startOffset(long value) { - this.startOffset = value; - return this; - } - - /** - * Required - API name: {@code termFrequency} - */ - public final Builder termfrequency(long value) { - this.termfrequency = value; - return this; - } - - /** - * Required - API name: {@code token} - */ - public final Builder token(String value) { - this.token = value; - return this; - } - - /** - * Required - API name: {@code type} - */ - public final Builder type(String value) { - this.type = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ExplainAnalyzeToken}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ExplainAnalyzeToken build() { - _checkSingleUse(); - - return new ExplainAnalyzeToken(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ExplainAnalyzeToken} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, ExplainAnalyzeToken::setupExplainAnalyzeTokenDeserializer); - - protected static void setupExplainAnalyzeTokenDeserializer(ObjectDeserializer op) { - - op.add(Builder::bytes, JsonpDeserializer.stringDeserializer(), "bytes"); - op.add(Builder::endOffset, JsonpDeserializer.longDeserializer(), "end_offset"); - op.add(Builder::keyword, JsonpDeserializer.booleanDeserializer(), "keyword"); - op.add(Builder::position, JsonpDeserializer.longDeserializer(), "position"); - op.add(Builder::positionlength, JsonpDeserializer.longDeserializer(), "positionLength"); - op.add(Builder::startOffset, JsonpDeserializer.longDeserializer(), "start_offset"); - op.add(Builder::termfrequency, JsonpDeserializer.longDeserializer(), "termFrequency"); - op.add(Builder::token, JsonpDeserializer.stringDeserializer(), "token"); - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); - - op.setUnknownFieldHandler((builder, name, parser, mapper) -> { - builder.attributes(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); - }); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/analyze/TokenDetail.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/analyze/TokenDetail.java deleted file mode 100644 index c8da22be3..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/analyze/TokenDetail.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.analyze; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.analyze.TokenDetail - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class TokenDetail implements JsonpSerializable { - private final String name; - - private final List tokens; - - // --------------------------------------------------------------------------------------------- - - private TokenDetail(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.tokens = ApiTypeHelper.unmodifiableRequired(builder.tokens, this, "tokens"); - - } - - public static TokenDetail of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Required - API name: {@code tokens} - */ - public final List tokens() { - return this.tokens; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("name"); - generator.write(this.name); - - if (ApiTypeHelper.isDefined(this.tokens)) { - generator.writeKey("tokens"); - generator.writeStartArray(); - for (ExplainAnalyzeToken item0 : this.tokens) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link TokenDetail}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private String name; - - private List tokens; - - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * Required - API name: {@code tokens} - *

- * Adds all elements of list to tokens. - */ - public final Builder tokens(List list) { - this.tokens = _listAddAll(this.tokens, list); - return this; - } - - /** - * Required - API name: {@code tokens} - *

- * Adds one or more values to tokens. - */ - public final Builder tokens(ExplainAnalyzeToken value, ExplainAnalyzeToken... values) { - this.tokens = _listAdd(this.tokens, value, values); - return this; - } - - /** - * Required - API name: {@code tokens} - *

- * Adds a value to tokens using a builder lambda. - */ - public final Builder tokens(Function> fn) { - return tokens(fn.apply(new ExplainAnalyzeToken.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link TokenDetail}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public TokenDetail build() { - _checkSingleUse(); - - return new TokenDetail(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link TokenDetail} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - TokenDetail::setupTokenDetailDeserializer); - - protected static void setupTokenDetailDeserializer(ObjectDeserializer op) { - - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::tokens, JsonpDeserializer.arrayDeserializer(ExplainAnalyzeToken._DESERIALIZER), "tokens"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/data_streams_stats/DataStreamsStatsItem.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/data_streams_stats/DataStreamsStatsItem.java deleted file mode 100644 index 1545c0030..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/data_streams_stats/DataStreamsStatsItem.java +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.data_streams_stats; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Integer; -import java.lang.Long; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.data_streams_stats.DataStreamsStatsItem - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class DataStreamsStatsItem implements JsonpSerializable { - private final int backingIndices; - - private final String dataStream; - - private final long maximumTimestamp; - - @Nullable - private final String storeSize; - - private final long storeSizeBytes; - - // --------------------------------------------------------------------------------------------- - - private DataStreamsStatsItem(Builder builder) { - - this.backingIndices = ApiTypeHelper.requireNonNull(builder.backingIndices, this, "backingIndices"); - this.dataStream = ApiTypeHelper.requireNonNull(builder.dataStream, this, "dataStream"); - this.maximumTimestamp = ApiTypeHelper.requireNonNull(builder.maximumTimestamp, this, "maximumTimestamp"); - this.storeSize = builder.storeSize; - this.storeSizeBytes = ApiTypeHelper.requireNonNull(builder.storeSizeBytes, this, "storeSizeBytes"); - - } - - public static DataStreamsStatsItem of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Current number of backing indices for the data stream. - *

- * API name: {@code backing_indices} - */ - public final int backingIndices() { - return this.backingIndices; - } - - /** - * Required - Name of the data stream. - *

- * API name: {@code data_stream} - */ - public final String dataStream() { - return this.dataStream; - } - - /** - * Required - The data stream’s highest @timestamp value, converted - * to milliseconds since the Unix epoch. NOTE: This timestamp is provided as a - * best effort. The data stream may contain @timestamp values - * higher than this if one or more of the following conditions are met: The - * stream contains closed backing indices; Backing indices with a lower - * generation contain higher @timestamp values. - *

- * API name: {@code maximum_timestamp} - */ - public final long maximumTimestamp() { - return this.maximumTimestamp; - } - - /** - * Total size of all shards for the data stream’s backing indices. This - * parameter is only returned if the human query parameter is - * true. - *

- * API name: {@code store_size} - */ - @Nullable - public final String storeSize() { - return this.storeSize; - } - - /** - * Required - Total size, in bytes, of all shards for the data stream’s backing - * indices. - *

- * API name: {@code store_size_bytes} - */ - public final long storeSizeBytes() { - return this.storeSizeBytes; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("backing_indices"); - generator.write(this.backingIndices); - - generator.writeKey("data_stream"); - generator.write(this.dataStream); - - generator.writeKey("maximum_timestamp"); - generator.write(this.maximumTimestamp); - - if (this.storeSize != null) { - generator.writeKey("store_size"); - generator.write(this.storeSize); - - } - generator.writeKey("store_size_bytes"); - generator.write(this.storeSizeBytes); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DataStreamsStatsItem}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private Integer backingIndices; - - private String dataStream; - - private Long maximumTimestamp; - - @Nullable - private String storeSize; - - private Long storeSizeBytes; - - /** - * Required - Current number of backing indices for the data stream. - *

- * API name: {@code backing_indices} - */ - public final Builder backingIndices(int value) { - this.backingIndices = value; - return this; - } - - /** - * Required - Name of the data stream. - *

- * API name: {@code data_stream} - */ - public final Builder dataStream(String value) { - this.dataStream = value; - return this; - } - - /** - * Required - The data stream’s highest @timestamp value, converted - * to milliseconds since the Unix epoch. NOTE: This timestamp is provided as a - * best effort. The data stream may contain @timestamp values - * higher than this if one or more of the following conditions are met: The - * stream contains closed backing indices; Backing indices with a lower - * generation contain higher @timestamp values. - *

- * API name: {@code maximum_timestamp} - */ - public final Builder maximumTimestamp(long value) { - this.maximumTimestamp = value; - return this; - } - - /** - * Total size of all shards for the data stream’s backing indices. This - * parameter is only returned if the human query parameter is - * true. - *

- * API name: {@code store_size} - */ - public final Builder storeSize(@Nullable String value) { - this.storeSize = value; - return this; - } - - /** - * Required - Total size, in bytes, of all shards for the data stream’s backing - * indices. - *

- * API name: {@code store_size_bytes} - */ - public final Builder storeSizeBytes(long value) { - this.storeSizeBytes = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DataStreamsStatsItem}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DataStreamsStatsItem build() { - _checkSingleUse(); - - return new DataStreamsStatsItem(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DataStreamsStatsItem} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, DataStreamsStatsItem::setupDataStreamsStatsItemDeserializer); - - protected static void setupDataStreamsStatsItemDeserializer(ObjectDeserializer op) { - - op.add(Builder::backingIndices, JsonpDeserializer.integerDeserializer(), "backing_indices"); - op.add(Builder::dataStream, JsonpDeserializer.stringDeserializer(), "data_stream"); - op.add(Builder::maximumTimestamp, JsonpDeserializer.longDeserializer(), "maximum_timestamp"); - op.add(Builder::storeSize, JsonpDeserializer.stringDeserializer(), "store_size"); - op.add(Builder::storeSizeBytes, JsonpDeserializer.longDeserializer(), "store_size_bytes"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/explain_data_lifecycle/DataStreamLifecycleExplain.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/explain_data_lifecycle/DataStreamLifecycleExplain.java deleted file mode 100644 index 145d2197f..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/explain_data_lifecycle/DataStreamLifecycleExplain.java +++ /dev/null @@ -1,418 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.explain_data_lifecycle; - -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.elasticsearch.indices.DataStreamLifecycleWithRollover; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Boolean; -import java.lang.Long; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.explain_data_lifecycle.DataStreamLifecycleExplain - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class DataStreamLifecycleExplain implements JsonpSerializable { - private final String index; - - private final boolean managedByLifecycle; - - @Nullable - private final Long indexCreationDateMillis; - - @Nullable - private final Time timeSinceIndexCreation; - - @Nullable - private final Long rolloverDateMillis; - - @Nullable - private final Time timeSinceRollover; - - @Nullable - private final DataStreamLifecycleWithRollover lifecycle; - - @Nullable - private final Time generationTime; - - @Nullable - private final String error; - - // --------------------------------------------------------------------------------------------- - - private DataStreamLifecycleExplain(Builder builder) { - - this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); - this.managedByLifecycle = ApiTypeHelper.requireNonNull(builder.managedByLifecycle, this, "managedByLifecycle"); - this.indexCreationDateMillis = builder.indexCreationDateMillis; - this.timeSinceIndexCreation = builder.timeSinceIndexCreation; - this.rolloverDateMillis = builder.rolloverDateMillis; - this.timeSinceRollover = builder.timeSinceRollover; - this.lifecycle = builder.lifecycle; - this.generationTime = builder.generationTime; - this.error = builder.error; - - } - - public static DataStreamLifecycleExplain of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code index} - */ - public final String index() { - return this.index; - } - - /** - * Required - API name: {@code managed_by_lifecycle} - */ - public final boolean managedByLifecycle() { - return this.managedByLifecycle; - } - - /** - * API name: {@code index_creation_date_millis} - */ - @Nullable - public final Long indexCreationDateMillis() { - return this.indexCreationDateMillis; - } - - /** - * API name: {@code time_since_index_creation} - */ - @Nullable - public final Time timeSinceIndexCreation() { - return this.timeSinceIndexCreation; - } - - /** - * API name: {@code rollover_date_millis} - */ - @Nullable - public final Long rolloverDateMillis() { - return this.rolloverDateMillis; - } - - /** - * API name: {@code time_since_rollover} - */ - @Nullable - public final Time timeSinceRollover() { - return this.timeSinceRollover; - } - - /** - * API name: {@code lifecycle} - */ - @Nullable - public final DataStreamLifecycleWithRollover lifecycle() { - return this.lifecycle; - } - - /** - * API name: {@code generation_time} - */ - @Nullable - public final Time generationTime() { - return this.generationTime; - } - - /** - * API name: {@code error} - */ - @Nullable - public final String error() { - return this.error; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("index"); - generator.write(this.index); - - generator.writeKey("managed_by_lifecycle"); - generator.write(this.managedByLifecycle); - - if (this.indexCreationDateMillis != null) { - generator.writeKey("index_creation_date_millis"); - generator.write(this.indexCreationDateMillis); - - } - if (this.timeSinceIndexCreation != null) { - generator.writeKey("time_since_index_creation"); - this.timeSinceIndexCreation.serialize(generator, mapper); - - } - if (this.rolloverDateMillis != null) { - generator.writeKey("rollover_date_millis"); - generator.write(this.rolloverDateMillis); - - } - if (this.timeSinceRollover != null) { - generator.writeKey("time_since_rollover"); - this.timeSinceRollover.serialize(generator, mapper); - - } - if (this.lifecycle != null) { - generator.writeKey("lifecycle"); - this.lifecycle.serialize(generator, mapper); - - } - if (this.generationTime != null) { - generator.writeKey("generation_time"); - this.generationTime.serialize(generator, mapper); - - } - if (this.error != null) { - generator.writeKey("error"); - generator.write(this.error); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DataStreamLifecycleExplain}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private String index; - - private Boolean managedByLifecycle; - - @Nullable - private Long indexCreationDateMillis; - - @Nullable - private Time timeSinceIndexCreation; - - @Nullable - private Long rolloverDateMillis; - - @Nullable - private Time timeSinceRollover; - - @Nullable - private DataStreamLifecycleWithRollover lifecycle; - - @Nullable - private Time generationTime; - - @Nullable - private String error; - - /** - * Required - API name: {@code index} - */ - public final Builder index(String value) { - this.index = value; - return this; - } - - /** - * Required - API name: {@code managed_by_lifecycle} - */ - public final Builder managedByLifecycle(boolean value) { - this.managedByLifecycle = value; - return this; - } - - /** - * API name: {@code index_creation_date_millis} - */ - public final Builder indexCreationDateMillis(@Nullable Long value) { - this.indexCreationDateMillis = value; - return this; - } - - /** - * API name: {@code time_since_index_creation} - */ - public final Builder timeSinceIndexCreation(@Nullable Time value) { - this.timeSinceIndexCreation = value; - return this; - } - - /** - * API name: {@code time_since_index_creation} - */ - public final Builder timeSinceIndexCreation(Function> fn) { - return this.timeSinceIndexCreation(fn.apply(new Time.Builder()).build()); - } - - /** - * API name: {@code rollover_date_millis} - */ - public final Builder rolloverDateMillis(@Nullable Long value) { - this.rolloverDateMillis = value; - return this; - } - - /** - * API name: {@code time_since_rollover} - */ - public final Builder timeSinceRollover(@Nullable Time value) { - this.timeSinceRollover = value; - return this; - } - - /** - * API name: {@code time_since_rollover} - */ - public final Builder timeSinceRollover(Function> fn) { - return this.timeSinceRollover(fn.apply(new Time.Builder()).build()); - } - - /** - * API name: {@code lifecycle} - */ - public final Builder lifecycle(@Nullable DataStreamLifecycleWithRollover value) { - this.lifecycle = value; - return this; - } - - /** - * API name: {@code lifecycle} - */ - public final Builder lifecycle( - Function> fn) { - return this.lifecycle(fn.apply(new DataStreamLifecycleWithRollover.Builder()).build()); - } - - /** - * API name: {@code generation_time} - */ - public final Builder generationTime(@Nullable Time value) { - this.generationTime = value; - return this; - } - - /** - * API name: {@code generation_time} - */ - public final Builder generationTime(Function> fn) { - return this.generationTime(fn.apply(new Time.Builder()).build()); - } - - /** - * API name: {@code error} - */ - public final Builder error(@Nullable String value) { - this.error = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DataStreamLifecycleExplain}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DataStreamLifecycleExplain build() { - _checkSingleUse(); - - return new DataStreamLifecycleExplain(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DataStreamLifecycleExplain} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, DataStreamLifecycleExplain::setupDataStreamLifecycleExplainDeserializer); - - protected static void setupDataStreamLifecycleExplainDeserializer( - ObjectDeserializer op) { - - op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); - op.add(Builder::managedByLifecycle, JsonpDeserializer.booleanDeserializer(), "managed_by_lifecycle"); - op.add(Builder::indexCreationDateMillis, JsonpDeserializer.longDeserializer(), "index_creation_date_millis"); - op.add(Builder::timeSinceIndexCreation, Time._DESERIALIZER, "time_since_index_creation"); - op.add(Builder::rolloverDateMillis, JsonpDeserializer.longDeserializer(), "rollover_date_millis"); - op.add(Builder::timeSinceRollover, Time._DESERIALIZER, "time_since_rollover"); - op.add(Builder::lifecycle, DataStreamLifecycleWithRollover._DESERIALIZER, "lifecycle"); - op.add(Builder::generationTime, Time._DESERIALIZER, "generation_time"); - op.add(Builder::error, JsonpDeserializer.stringDeserializer(), "error"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/get/Feature.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/get/Feature.java deleted file mode 100644 index e89ee66bb..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/get/Feature.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.get; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public enum Feature implements JsonEnum { - Aliases("aliases"), - - Mappings("mappings"), - - Settings("settings"), - - ; - - private final String jsonValue; - - Feature(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Feature.values()); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/get_alias/IndexAliases.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/get_alias/IndexAliases.java deleted file mode 100644 index 23ab2d267..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/get_alias/IndexAliases.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.get_alias; - -import co.elastic.clients.elasticsearch.indices.AliasDefinition; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.get_alias.IndexAliases - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexAliases implements JsonpSerializable { - private final Map aliases; - - // --------------------------------------------------------------------------------------------- - - private IndexAliases(Builder builder) { - - this.aliases = ApiTypeHelper.unmodifiableRequired(builder.aliases, this, "aliases"); - - } - - public static IndexAliases of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code aliases} - */ - public final Map aliases() { - return this.aliases; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.aliases)) { - generator.writeKey("aliases"); - generator.writeStartObject(); - for (Map.Entry item0 : this.aliases.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexAliases}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Map aliases; - - /** - * Required - API name: {@code aliases} - *

- * Adds all entries of map to aliases. - */ - public final Builder aliases(Map map) { - this.aliases = _mapPutAll(this.aliases, map); - return this; - } - - /** - * Required - API name: {@code aliases} - *

- * Adds an entry to aliases. - */ - public final Builder aliases(String key, AliasDefinition value) { - this.aliases = _mapPut(this.aliases, key, value); - return this; - } - - /** - * Required - API name: {@code aliases} - *

- * Adds an entry to aliases using a builder lambda. - */ - public final Builder aliases(String key, Function> fn) { - return aliases(key, fn.apply(new AliasDefinition.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexAliases}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexAliases build() { - _checkSingleUse(); - - return new IndexAliases(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexAliases} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - IndexAliases::setupIndexAliasesDeserializer); - - protected static void setupIndexAliasesDeserializer(ObjectDeserializer op) { - - op.add(Builder::aliases, JsonpDeserializer.stringMapDeserializer(AliasDefinition._DESERIALIZER), "aliases"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/get_data_lifecycle/DataStreamWithLifecycle.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/get_data_lifecycle/DataStreamWithLifecycle.java deleted file mode 100644 index c0f1c5612..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/get_data_lifecycle/DataStreamWithLifecycle.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.get_data_lifecycle; - -import co.elastic.clients.elasticsearch.indices.DataStreamLifecycle; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.get_data_lifecycle.DataStreamWithLifecycle - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class DataStreamWithLifecycle implements JsonpSerializable { - private final String name; - - @Nullable - private final DataStreamLifecycle lifecycle; - - // --------------------------------------------------------------------------------------------- - - private DataStreamWithLifecycle(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.lifecycle = builder.lifecycle; - - } - - public static DataStreamWithLifecycle of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * API name: {@code lifecycle} - */ - @Nullable - public final DataStreamLifecycle lifecycle() { - return this.lifecycle; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("name"); - generator.write(this.name); - - if (this.lifecycle != null) { - generator.writeKey("lifecycle"); - this.lifecycle.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DataStreamWithLifecycle}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private String name; - - @Nullable - private DataStreamLifecycle lifecycle; - - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * API name: {@code lifecycle} - */ - public final Builder lifecycle(@Nullable DataStreamLifecycle value) { - this.lifecycle = value; - return this; - } - - /** - * API name: {@code lifecycle} - */ - public final Builder lifecycle(Function> fn) { - return this.lifecycle(fn.apply(new DataStreamLifecycle.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DataStreamWithLifecycle}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DataStreamWithLifecycle build() { - _checkSingleUse(); - - return new DataStreamWithLifecycle(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DataStreamWithLifecycle} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, DataStreamWithLifecycle::setupDataStreamWithLifecycleDeserializer); - - protected static void setupDataStreamWithLifecycleDeserializer( - ObjectDeserializer op) { - - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::lifecycle, DataStreamLifecycle._DESERIALIZER, "lifecycle"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/get_index_template/IndexTemplateItem.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/get_index_template/IndexTemplateItem.java deleted file mode 100644 index 83a4abfd7..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/get_index_template/IndexTemplateItem.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.get_index_template; - -import co.elastic.clients.elasticsearch.indices.IndexTemplate; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.get_index_template.IndexTemplateItem - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexTemplateItem implements JsonpSerializable { - private final String name; - - private final IndexTemplate indexTemplate; - - // --------------------------------------------------------------------------------------------- - - private IndexTemplateItem(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.indexTemplate = ApiTypeHelper.requireNonNull(builder.indexTemplate, this, "indexTemplate"); - - } - - public static IndexTemplateItem of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Required - API name: {@code index_template} - */ - public final IndexTemplate indexTemplate() { - return this.indexTemplate; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("name"); - generator.write(this.name); - - generator.writeKey("index_template"); - this.indexTemplate.serialize(generator, mapper); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexTemplateItem}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private String name; - - private IndexTemplate indexTemplate; - - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * Required - API name: {@code index_template} - */ - public final Builder indexTemplate(IndexTemplate value) { - this.indexTemplate = value; - return this; - } - - /** - * Required - API name: {@code index_template} - */ - public final Builder indexTemplate(Function> fn) { - return this.indexTemplate(fn.apply(new IndexTemplate.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexTemplateItem}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexTemplateItem build() { - _checkSingleUse(); - - return new IndexTemplateItem(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexTemplateItem} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, IndexTemplateItem::setupIndexTemplateItemDeserializer); - - protected static void setupIndexTemplateItemDeserializer(ObjectDeserializer op) { - - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::indexTemplate, IndexTemplate._DESERIALIZER, "index_template"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/get_mapping/IndexMappingRecord.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/get_mapping/IndexMappingRecord.java deleted file mode 100644 index 5a7ae2e65..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/get_mapping/IndexMappingRecord.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.get_mapping; - -import co.elastic.clients.elasticsearch._types.mapping.TypeMapping; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.get_mapping.IndexMappingRecord - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexMappingRecord implements JsonpSerializable { - @Nullable - private final TypeMapping item; - - private final TypeMapping mappings; - - // --------------------------------------------------------------------------------------------- - - private IndexMappingRecord(Builder builder) { - - this.item = builder.item; - this.mappings = ApiTypeHelper.requireNonNull(builder.mappings, this, "mappings"); - - } - - public static IndexMappingRecord of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code item} - */ - @Nullable - public final TypeMapping item() { - return this.item; - } - - /** - * Required - API name: {@code mappings} - */ - public final TypeMapping mappings() { - return this.mappings; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.item != null) { - generator.writeKey("item"); - this.item.serialize(generator, mapper); - - } - generator.writeKey("mappings"); - this.mappings.serialize(generator, mapper); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexMappingRecord}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private TypeMapping item; - - private TypeMapping mappings; - - /** - * API name: {@code item} - */ - public final Builder item(@Nullable TypeMapping value) { - this.item = value; - return this; - } - - /** - * API name: {@code item} - */ - public final Builder item(Function> fn) { - return this.item(fn.apply(new TypeMapping.Builder()).build()); - } - - /** - * Required - API name: {@code mappings} - */ - public final Builder mappings(TypeMapping value) { - this.mappings = value; - return this; - } - - /** - * Required - API name: {@code mappings} - */ - public final Builder mappings(Function> fn) { - return this.mappings(fn.apply(new TypeMapping.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexMappingRecord}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexMappingRecord build() { - _checkSingleUse(); - - return new IndexMappingRecord(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexMappingRecord} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, IndexMappingRecord::setupIndexMappingRecordDeserializer); - - protected static void setupIndexMappingRecordDeserializer(ObjectDeserializer op) { - - op.add(Builder::item, TypeMapping._DESERIALIZER, "item"); - op.add(Builder::mappings, TypeMapping._DESERIALIZER, "mappings"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/modify_data_stream/Action.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/modify_data_stream/Action.java deleted file mode 100644 index 6fe324d84..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/modify_data_stream/Action.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.modify_data_stream; - -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.TaggedUnion; -import co.elastic.clients.util.TaggedUnionUtils; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Object; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.modify_data_stream.Action - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class Action implements TaggedUnion, JsonpSerializable { - - /** - * {@link Action} variant kinds. - * - * @see API - * specification - */ - - public enum Kind implements JsonEnum { - AddBackingIndex("add_backing_index"), - - RemoveBackingIndex("remove_backing_index"), - - ; - - private final String jsonValue; - - Kind(String jsonValue) { - this.jsonValue = jsonValue; - } - - public String jsonValue() { - return this.jsonValue; - } - - } - - private final Kind _kind; - private final Object _value; - - @Override - public final Kind _kind() { - return _kind; - } - - @Override - public final Object _get() { - return _value; - } - - public Action(ActionVariant value) { - - this._kind = ApiTypeHelper.requireNonNull(value._actionKind(), this, ""); - this._value = ApiTypeHelper.requireNonNull(value, this, ""); - - } - - private Action(Builder builder) { - - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - - } - - public static Action of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Is this variant instance of kind {@code add_backing_index}? - */ - public boolean isAddBackingIndex() { - return _kind == Kind.AddBackingIndex; - } - - /** - * Get the {@code add_backing_index} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code add_backing_index} - * kind. - */ - public IndexAndDataStreamAction addBackingIndex() { - return TaggedUnionUtils.get(this, Kind.AddBackingIndex); - } - - /** - * Is this variant instance of kind {@code remove_backing_index}? - */ - public boolean isRemoveBackingIndex() { - return _kind == Kind.RemoveBackingIndex; - } - - /** - * Get the {@code remove_backing_index} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code remove_backing_index} - * kind. - */ - public IndexAndDataStreamAction removeBackingIndex() { - return TaggedUnionUtils.get(this, Kind.RemoveBackingIndex); - } - - @Override - @SuppressWarnings("unchecked") - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeStartObject(); - - generator.writeKey(_kind.jsonValue()); - if (_value instanceof JsonpSerializable) { - ((JsonpSerializable) _value).serialize(generator, mapper); - } - - generator.writeEnd(); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Kind _kind; - private Object _value; - - @Override - protected Builder self() { - return this; - } - public ObjectBuilder addBackingIndex(IndexAndDataStreamAction v) { - this._kind = Kind.AddBackingIndex; - this._value = v; - return this; - } - - public ObjectBuilder addBackingIndex( - Function> fn) { - return this.addBackingIndex(fn.apply(new IndexAndDataStreamAction.Builder()).build()); - } - - public ObjectBuilder removeBackingIndex(IndexAndDataStreamAction v) { - this._kind = Kind.RemoveBackingIndex; - this._value = v; - return this; - } - - public ObjectBuilder removeBackingIndex( - Function> fn) { - return this.removeBackingIndex(fn.apply(new IndexAndDataStreamAction.Builder()).build()); - } - - public Action build() { - _checkSingleUse(); - return new Action(this); - } - - } - - protected static void setupActionDeserializer(ObjectDeserializer op) { - - op.add(Builder::addBackingIndex, IndexAndDataStreamAction._DESERIALIZER, "add_backing_index"); - op.add(Builder::removeBackingIndex, IndexAndDataStreamAction._DESERIALIZER, "remove_backing_index"); - - } - - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - Action::setupActionDeserializer, Builder::build); -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/modify_data_stream/ActionBuilders.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/modify_data_stream/ActionBuilders.java deleted file mode 100644 index 966068fba..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/modify_data_stream/ActionBuilders.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.modify_data_stream; - -import co.elastic.clients.util.ObjectBuilder; -import java.util.function.Function; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Builders for {@link Action} variants. - */ -public class ActionBuilders { - private ActionBuilders() { - } - - /** - * Creates a builder for the {@link IndexAndDataStreamAction add_backing_index} - * {@code Action} variant. - */ - public static IndexAndDataStreamAction.Builder addBackingIndex() { - return new IndexAndDataStreamAction.Builder(); - } - - /** - * Creates a Action of the {@link IndexAndDataStreamAction add_backing_index} - * {@code Action} variant. - */ - public static Action addBackingIndex( - Function> fn) { - Action.Builder builder = new Action.Builder(); - builder.addBackingIndex(fn.apply(new IndexAndDataStreamAction.Builder()).build()); - return builder.build(); - } - - /** - * Creates a builder for the {@link IndexAndDataStreamAction - * remove_backing_index} {@code Action} variant. - */ - public static IndexAndDataStreamAction.Builder removeBackingIndex() { - return new IndexAndDataStreamAction.Builder(); - } - - /** - * Creates a Action of the {@link IndexAndDataStreamAction remove_backing_index} - * {@code Action} variant. - */ - public static Action removeBackingIndex( - Function> fn) { - Action.Builder builder = new Action.Builder(); - builder.removeBackingIndex(fn.apply(new IndexAndDataStreamAction.Builder()).build()); - return builder.build(); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/modify_data_stream/ActionVariant.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/modify_data_stream/ActionVariant.java deleted file mode 100644 index 88a044748..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/modify_data_stream/ActionVariant.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.modify_data_stream; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -/** - * Base interface for {@link Action} variants. - */ -public interface ActionVariant { - - Action.Kind _actionKind(); - - default Action _toAction() { - return new Action(this); - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/modify_data_stream/IndexAndDataStreamAction.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/modify_data_stream/IndexAndDataStreamAction.java deleted file mode 100644 index 79d42882d..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/modify_data_stream/IndexAndDataStreamAction.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.modify_data_stream; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.modify_data_stream.IndexAndDataStreamAction - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexAndDataStreamAction implements ActionVariant, JsonpSerializable { - private final String dataStream; - - private final String index; - - // --------------------------------------------------------------------------------------------- - - private IndexAndDataStreamAction(Builder builder) { - - this.dataStream = ApiTypeHelper.requireNonNull(builder.dataStream, this, "dataStream"); - this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); - - } - - public static IndexAndDataStreamAction of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Action variant kind. - */ - @Override - public Action.Kind _actionKind() { - return Action.Kind.RemoveBackingIndex; - } - - /** - * Required - Data stream targeted by the action. - *

- * API name: {@code data_stream} - */ - public final String dataStream() { - return this.dataStream; - } - - /** - * Required - Index for the action. - *

- * API name: {@code index} - */ - public final String index() { - return this.index; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("data_stream"); - generator.write(this.dataStream); - - generator.writeKey("index"); - generator.write(this.index); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexAndDataStreamAction}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private String dataStream; - - private String index; - - /** - * Required - Data stream targeted by the action. - *

- * API name: {@code data_stream} - */ - public final Builder dataStream(String value) { - this.dataStream = value; - return this; - } - - /** - * Required - Index for the action. - *

- * API name: {@code index} - */ - public final Builder index(String value) { - this.index = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexAndDataStreamAction}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexAndDataStreamAction build() { - _checkSingleUse(); - - return new IndexAndDataStreamAction(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexAndDataStreamAction} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, IndexAndDataStreamAction::setupIndexAndDataStreamActionDeserializer); - - protected static void setupIndexAndDataStreamActionDeserializer( - ObjectDeserializer op) { - - op.add(Builder::dataStream, JsonpDeserializer.stringDeserializer(), "data_stream"); - op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/put_index_template/IndexTemplateMapping.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/put_index_template/IndexTemplateMapping.java deleted file mode 100644 index b22923919..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/put_index_template/IndexTemplateMapping.java +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.put_index_template; - -import co.elastic.clients.elasticsearch._types.mapping.TypeMapping; -import co.elastic.clients.elasticsearch.indices.Alias; -import co.elastic.clients.elasticsearch.indices.DataStreamLifecycle; -import co.elastic.clients.elasticsearch.indices.IndexSettings; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.put_index_template.IndexTemplateMapping - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class IndexTemplateMapping implements JsonpSerializable { - private final Map aliases; - - @Nullable - private final TypeMapping mappings; - - @Nullable - private final IndexSettings settings; - - @Nullable - private final DataStreamLifecycle lifecycle; - - // --------------------------------------------------------------------------------------------- - - private IndexTemplateMapping(Builder builder) { - - this.aliases = ApiTypeHelper.unmodifiable(builder.aliases); - this.mappings = builder.mappings; - this.settings = builder.settings; - this.lifecycle = builder.lifecycle; - - } - - public static IndexTemplateMapping of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * 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. - *

- * API name: {@code aliases} - */ - public final Map aliases() { - return this.aliases; - } - - /** - * Mapping for fields in the index. If specified, this mapping can include field - * names, field data types, and mapping parameters. - *

- * API name: {@code mappings} - */ - @Nullable - public final TypeMapping mappings() { - return this.mappings; - } - - /** - * Configuration options for the index. - *

- * API name: {@code settings} - */ - @Nullable - public final IndexSettings settings() { - return this.settings; - } - - /** - * API name: {@code lifecycle} - */ - @Nullable - public final DataStreamLifecycle lifecycle() { - return this.lifecycle; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.aliases)) { - generator.writeKey("aliases"); - generator.writeStartObject(); - for (Map.Entry item0 : this.aliases.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.mappings != null) { - generator.writeKey("mappings"); - this.mappings.serialize(generator, mapper); - - } - if (this.settings != null) { - generator.writeKey("settings"); - this.settings.serialize(generator, mapper); - - } - if (this.lifecycle != null) { - generator.writeKey("lifecycle"); - this.lifecycle.serialize(generator, mapper); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexTemplateMapping}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Map aliases; - - @Nullable - private TypeMapping mappings; - - @Nullable - private IndexSettings settings; - - @Nullable - private 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. - *

- * API name: {@code aliases} - *

- * Adds all entries of map to aliases. - */ - public final Builder aliases(Map map) { - this.aliases = _mapPutAll(this.aliases, map); - 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. - *

- * API name: {@code aliases} - *

- * Adds an entry to aliases. - */ - public final Builder aliases(String key, Alias value) { - this.aliases = _mapPut(this.aliases, 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. - *

- * API name: {@code aliases} - *

- * Adds an entry to aliases using a builder lambda. - */ - public final Builder aliases(String key, Function> fn) { - return aliases(key, fn.apply(new Alias.Builder()).build()); - } - - /** - * Mapping for fields in the index. If specified, this mapping can include field - * names, field data types, and mapping parameters. - *

- * API name: {@code mappings} - */ - public final Builder mappings(@Nullable TypeMapping value) { - this.mappings = value; - return this; - } - - /** - * Mapping for fields in the index. If specified, this mapping can include field - * names, field data types, and mapping parameters. - *

- * API name: {@code mappings} - */ - public final Builder mappings(Function> fn) { - return this.mappings(fn.apply(new TypeMapping.Builder()).build()); - } - - /** - * Configuration options for the index. - *

- * API name: {@code settings} - */ - public final Builder settings(@Nullable IndexSettings value) { - this.settings = value; - return this; - } - - /** - * Configuration options for the index. - *

- * API name: {@code settings} - */ - public final Builder settings(Function> fn) { - return this.settings(fn.apply(new IndexSettings.Builder()).build()); - } - - /** - * API name: {@code lifecycle} - */ - public final Builder lifecycle(@Nullable DataStreamLifecycle value) { - this.lifecycle = value; - return this; - } - - /** - * API name: {@code lifecycle} - */ - public final Builder lifecycle(Function> fn) { - return this.lifecycle(fn.apply(new DataStreamLifecycle.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link IndexTemplateMapping}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexTemplateMapping build() { - _checkSingleUse(); - - return new IndexTemplateMapping(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexTemplateMapping} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, IndexTemplateMapping::setupIndexTemplateMappingDeserializer); - - protected static void setupIndexTemplateMappingDeserializer(ObjectDeserializer op) { - - op.add(Builder::aliases, JsonpDeserializer.stringMapDeserializer(Alias._DESERIALIZER), "aliases"); - op.add(Builder::mappings, TypeMapping._DESERIALIZER, "mappings"); - op.add(Builder::settings, IndexSettings._DESERIALIZER, "settings"); - op.add(Builder::lifecycle, DataStreamLifecycle._DESERIALIZER, "lifecycle"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/reload_search_analyzers/ReloadDetails.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/reload_search_analyzers/ReloadDetails.java deleted file mode 100644 index 982e693ae..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/reload_search_analyzers/ReloadDetails.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.reload_search_analyzers; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.reload_search_analyzers.ReloadDetails - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class ReloadDetails implements JsonpSerializable { - private final String index; - - private final List reloadedAnalyzers; - - private final List reloadedNodeIds; - - // --------------------------------------------------------------------------------------------- - - private ReloadDetails(Builder builder) { - - this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); - this.reloadedAnalyzers = ApiTypeHelper.unmodifiableRequired(builder.reloadedAnalyzers, this, - "reloadedAnalyzers"); - this.reloadedNodeIds = ApiTypeHelper.unmodifiableRequired(builder.reloadedNodeIds, this, "reloadedNodeIds"); - - } - - public static ReloadDetails of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code index} - */ - public final String index() { - return this.index; - } - - /** - * Required - API name: {@code reloaded_analyzers} - */ - public final List reloadedAnalyzers() { - return this.reloadedAnalyzers; - } - - /** - * Required - API name: {@code reloaded_node_ids} - */ - public final List reloadedNodeIds() { - return this.reloadedNodeIds; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("index"); - generator.write(this.index); - - if (ApiTypeHelper.isDefined(this.reloadedAnalyzers)) { - generator.writeKey("reloaded_analyzers"); - generator.writeStartArray(); - for (String item0 : this.reloadedAnalyzers) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.reloadedNodeIds)) { - generator.writeKey("reloaded_node_ids"); - generator.writeStartArray(); - for (String item0 : this.reloadedNodeIds) { - generator.write(item0); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ReloadDetails}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private String index; - - private List reloadedAnalyzers; - - private List reloadedNodeIds; - - /** - * Required - API name: {@code index} - */ - public final Builder index(String value) { - this.index = value; - return this; - } - - /** - * Required - API name: {@code reloaded_analyzers} - *

- * Adds all elements of list to reloadedAnalyzers. - */ - public final Builder reloadedAnalyzers(List list) { - this.reloadedAnalyzers = _listAddAll(this.reloadedAnalyzers, list); - return this; - } - - /** - * Required - API name: {@code reloaded_analyzers} - *

- * Adds one or more values to reloadedAnalyzers. - */ - public final Builder reloadedAnalyzers(String value, String... values) { - this.reloadedAnalyzers = _listAdd(this.reloadedAnalyzers, value, values); - return this; - } - - /** - * Required - API name: {@code reloaded_node_ids} - *

- * Adds all elements of list to reloadedNodeIds. - */ - public final Builder reloadedNodeIds(List list) { - this.reloadedNodeIds = _listAddAll(this.reloadedNodeIds, list); - return this; - } - - /** - * Required - API name: {@code reloaded_node_ids} - *

- * Adds one or more values to reloadedNodeIds. - */ - public final Builder reloadedNodeIds(String value, String... values) { - this.reloadedNodeIds = _listAdd(this.reloadedNodeIds, value, values); - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ReloadDetails}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ReloadDetails build() { - _checkSingleUse(); - - return new ReloadDetails(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ReloadDetails} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - ReloadDetails::setupReloadDetailsDeserializer); - - protected static void setupReloadDetailsDeserializer(ObjectDeserializer op) { - - op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); - op.add(Builder::reloadedAnalyzers, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "reloaded_analyzers"); - op.add(Builder::reloadedNodeIds, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "reloaded_node_ids"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/reload_search_analyzers/ReloadResult.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/reload_search_analyzers/ReloadResult.java deleted file mode 100644 index 387a9a0eb..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/reload_search_analyzers/ReloadResult.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.reload_search_analyzers; - -import co.elastic.clients.elasticsearch._types.ShardStatistics; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.reload_search_analyzers.ReloadResult - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class ReloadResult implements JsonpSerializable { - private final List reloadDetails; - - private final ShardStatistics shards; - - // --------------------------------------------------------------------------------------------- - - private ReloadResult(Builder builder) { - - this.reloadDetails = ApiTypeHelper.unmodifiableRequired(builder.reloadDetails, this, "reloadDetails"); - this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards"); - - } - - public static ReloadResult of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code reload_details} - */ - public final List reloadDetails() { - return this.reloadDetails; - } - - /** - * Required - API name: {@code _shards} - */ - public final ShardStatistics shards() { - return this.shards; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.reloadDetails)) { - generator.writeKey("reload_details"); - generator.writeStartArray(); - for (ReloadDetails item0 : this.reloadDetails) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - generator.writeKey("_shards"); - this.shards.serialize(generator, mapper); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ReloadResult}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private List reloadDetails; - - private ShardStatistics shards; - - /** - * Required - API name: {@code reload_details} - *

- * Adds all elements of list to reloadDetails. - */ - public final Builder reloadDetails(List list) { - this.reloadDetails = _listAddAll(this.reloadDetails, list); - return this; - } - - /** - * Required - API name: {@code reload_details} - *

- * Adds one or more values to reloadDetails. - */ - public final Builder reloadDetails(ReloadDetails value, ReloadDetails... values) { - this.reloadDetails = _listAdd(this.reloadDetails, value, values); - return this; - } - - /** - * Required - API name: {@code reload_details} - *

- * Adds a value to reloadDetails using a builder lambda. - */ - public final Builder reloadDetails(Function> fn) { - return reloadDetails(fn.apply(new ReloadDetails.Builder()).build()); - } - - /** - * Required - API name: {@code _shards} - */ - public final Builder shards(ShardStatistics value) { - this.shards = value; - return this; - } - - /** - * Required - API name: {@code _shards} - */ - public final Builder shards(Function> fn) { - return this.shards(fn.apply(new ShardStatistics.Builder()).build()); - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ReloadResult}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ReloadResult build() { - _checkSingleUse(); - - return new ReloadResult(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ReloadResult} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - ReloadResult::setupReloadResultDeserializer); - - protected static void setupReloadResultDeserializer(ObjectDeserializer op) { - - op.add(Builder::reloadDetails, JsonpDeserializer.arrayDeserializer(ReloadDetails._DESERIALIZER), - "reload_details"); - op.add(Builder::shards, ShardStatistics._DESERIALIZER, "_shards"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/resolve_index/ResolveIndexAliasItem.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/resolve_index/ResolveIndexAliasItem.java deleted file mode 100644 index fb78dbddd..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/resolve_index/ResolveIndexAliasItem.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.resolve_index; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.resolve_index.ResolveIndexAliasItem - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class ResolveIndexAliasItem implements JsonpSerializable { - private final String name; - - private final List indices; - - // --------------------------------------------------------------------------------------------- - - private ResolveIndexAliasItem(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices"); - - } - - public static ResolveIndexAliasItem of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Required - API name: {@code indices} - */ - public final List indices() { - return this.indices; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("name"); - generator.write(this.name); - - if (ApiTypeHelper.isDefined(this.indices)) { - generator.writeKey("indices"); - generator.writeStartArray(); - for (String item0 : this.indices) { - generator.write(item0); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ResolveIndexAliasItem}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private String name; - - private List indices; - - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * Required - API name: {@code indices} - *

- * Adds all elements of list to indices. - */ - public final Builder indices(List list) { - this.indices = _listAddAll(this.indices, list); - return this; - } - - /** - * Required - API name: {@code indices} - *

- * Adds one or more values to indices. - */ - public final Builder indices(String value, String... values) { - this.indices = _listAdd(this.indices, value, values); - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ResolveIndexAliasItem}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ResolveIndexAliasItem build() { - _checkSingleUse(); - - return new ResolveIndexAliasItem(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ResolveIndexAliasItem} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, ResolveIndexAliasItem::setupResolveIndexAliasItemDeserializer); - - protected static void setupResolveIndexAliasItemDeserializer(ObjectDeserializer op) { - - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::indices, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "indices"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/resolve_index/ResolveIndexDataStreamsItem.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/resolve_index/ResolveIndexDataStreamsItem.java deleted file mode 100644 index 0640f7330..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/resolve_index/ResolveIndexDataStreamsItem.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.resolve_index; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.resolve_index.ResolveIndexDataStreamsItem - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class ResolveIndexDataStreamsItem implements JsonpSerializable { - private final String name; - - private final String timestampField; - - private final List backingIndices; - - // --------------------------------------------------------------------------------------------- - - private ResolveIndexDataStreamsItem(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.timestampField = ApiTypeHelper.requireNonNull(builder.timestampField, this, "timestampField"); - this.backingIndices = ApiTypeHelper.unmodifiableRequired(builder.backingIndices, this, "backingIndices"); - - } - - public static ResolveIndexDataStreamsItem of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Required - API name: {@code timestamp_field} - */ - public final String timestampField() { - return this.timestampField; - } - - /** - * Required - API name: {@code backing_indices} - */ - public final List backingIndices() { - return this.backingIndices; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("name"); - generator.write(this.name); - - generator.writeKey("timestamp_field"); - generator.write(this.timestampField); - - if (ApiTypeHelper.isDefined(this.backingIndices)) { - generator.writeKey("backing_indices"); - generator.writeStartArray(); - for (String item0 : this.backingIndices) { - generator.write(item0); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ResolveIndexDataStreamsItem}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - private String name; - - private String timestampField; - - private List backingIndices; - - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * Required - API name: {@code timestamp_field} - */ - public final Builder timestampField(String value) { - this.timestampField = value; - return this; - } - - /** - * Required - API name: {@code backing_indices} - *

- * Adds all elements of list to backingIndices. - */ - public final Builder backingIndices(List list) { - this.backingIndices = _listAddAll(this.backingIndices, list); - return this; - } - - /** - * Required - API name: {@code backing_indices} - *

- * Adds one or more values to backingIndices. - */ - public final Builder backingIndices(String value, String... values) { - this.backingIndices = _listAdd(this.backingIndices, value, values); - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ResolveIndexDataStreamsItem}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ResolveIndexDataStreamsItem build() { - _checkSingleUse(); - - return new ResolveIndexDataStreamsItem(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ResolveIndexDataStreamsItem} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, ResolveIndexDataStreamsItem::setupResolveIndexDataStreamsItemDeserializer); - - protected static void setupResolveIndexDataStreamsItemDeserializer( - ObjectDeserializer op) { - - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::timestampField, JsonpDeserializer.stringDeserializer(), "timestamp_field"); - op.add(Builder::backingIndices, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "backing_indices"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/resolve_index/ResolveIndexItem.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/resolve_index/ResolveIndexItem.java deleted file mode 100644 index ec702bb65..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/resolve_index/ResolveIndexItem.java +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.resolve_index; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.resolve_index.ResolveIndexItem - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class ResolveIndexItem implements JsonpSerializable { - private final String name; - - private final List aliases; - - private final List attributes; - - @Nullable - private final String dataStream; - - // --------------------------------------------------------------------------------------------- - - private ResolveIndexItem(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.aliases = ApiTypeHelper.unmodifiable(builder.aliases); - this.attributes = ApiTypeHelper.unmodifiableRequired(builder.attributes, this, "attributes"); - this.dataStream = builder.dataStream; - - } - - public static ResolveIndexItem of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * API name: {@code aliases} - */ - public final List aliases() { - return this.aliases; - } - - /** - * Required - API name: {@code attributes} - */ - public final List attributes() { - return this.attributes; - } - - /** - * API name: {@code data_stream} - */ - @Nullable - public final String dataStream() { - return this.dataStream; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("name"); - generator.write(this.name); - - if (ApiTypeHelper.isDefined(this.aliases)) { - generator.writeKey("aliases"); - generator.writeStartArray(); - for (String item0 : this.aliases) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.attributes)) { - generator.writeKey("attributes"); - generator.writeStartArray(); - for (String item0 : this.attributes) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (this.dataStream != null) { - generator.writeKey("data_stream"); - generator.write(this.dataStream); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ResolveIndexItem}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private String name; - - @Nullable - private List aliases; - - private List attributes; - - @Nullable - private String dataStream; - - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * API name: {@code aliases} - *

- * Adds all elements of list to aliases. - */ - public final Builder aliases(List list) { - this.aliases = _listAddAll(this.aliases, list); - return this; - } - - /** - * API name: {@code aliases} - *

- * Adds one or more values to aliases. - */ - public final Builder aliases(String value, String... values) { - this.aliases = _listAdd(this.aliases, value, values); - return this; - } - - /** - * Required - API name: {@code attributes} - *

- * Adds all elements of list to attributes. - */ - public final Builder attributes(List list) { - this.attributes = _listAddAll(this.attributes, list); - return this; - } - - /** - * Required - API name: {@code attributes} - *

- * Adds one or more values to attributes. - */ - public final Builder attributes(String value, String... values) { - this.attributes = _listAdd(this.attributes, value, values); - return this; - } - - /** - * API name: {@code data_stream} - */ - public final Builder dataStream(@Nullable String value) { - this.dataStream = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ResolveIndexItem}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ResolveIndexItem build() { - _checkSingleUse(); - - return new ResolveIndexItem(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ResolveIndexItem} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - ResolveIndexItem::setupResolveIndexItemDeserializer); - - protected static void setupResolveIndexItemDeserializer(ObjectDeserializer op) { - - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::aliases, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "aliases"); - op.add(Builder::attributes, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "attributes"); - op.add(Builder::dataStream, JsonpDeserializer.stringDeserializer(), "data_stream"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/rollover/RolloverConditions.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/rollover/RolloverConditions.java deleted file mode 100644 index b50f0ef8d..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/rollover/RolloverConditions.java +++ /dev/null @@ -1,583 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.rollover; - -import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.Long; -import java.lang.String; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.rollover.RolloverConditions - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class RolloverConditions implements JsonpSerializable { - @Nullable - private final Time minAge; - - @Nullable - private final Time maxAge; - - @Nullable - private final Long maxAgeMillis; - - @Nullable - private final Long minDocs; - - @Nullable - private final Long maxDocs; - - @Nullable - private final String maxSize; - - @Nullable - private final Long maxSizeBytes; - - @Nullable - private final String minSize; - - @Nullable - private final Long minSizeBytes; - - @Nullable - private final String maxPrimaryShardSize; - - @Nullable - private final Long maxPrimaryShardSizeBytes; - - @Nullable - private final String minPrimaryShardSize; - - @Nullable - private final Long minPrimaryShardSizeBytes; - - @Nullable - private final Long maxPrimaryShardDocs; - - @Nullable - private final Long minPrimaryShardDocs; - - // --------------------------------------------------------------------------------------------- - - private RolloverConditions(Builder builder) { - - this.minAge = builder.minAge; - this.maxAge = builder.maxAge; - this.maxAgeMillis = builder.maxAgeMillis; - this.minDocs = builder.minDocs; - this.maxDocs = builder.maxDocs; - this.maxSize = builder.maxSize; - this.maxSizeBytes = builder.maxSizeBytes; - this.minSize = builder.minSize; - this.minSizeBytes = builder.minSizeBytes; - this.maxPrimaryShardSize = builder.maxPrimaryShardSize; - this.maxPrimaryShardSizeBytes = builder.maxPrimaryShardSizeBytes; - this.minPrimaryShardSize = builder.minPrimaryShardSize; - this.minPrimaryShardSizeBytes = builder.minPrimaryShardSizeBytes; - this.maxPrimaryShardDocs = builder.maxPrimaryShardDocs; - this.minPrimaryShardDocs = builder.minPrimaryShardDocs; - - } - - public static RolloverConditions of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code min_age} - */ - @Nullable - public final Time minAge() { - return this.minAge; - } - - /** - * API name: {@code max_age} - */ - @Nullable - public final Time maxAge() { - return this.maxAge; - } - - /** - * API name: {@code max_age_millis} - */ - @Nullable - public final Long maxAgeMillis() { - return this.maxAgeMillis; - } - - /** - * API name: {@code min_docs} - */ - @Nullable - public final Long minDocs() { - return this.minDocs; - } - - /** - * API name: {@code max_docs} - */ - @Nullable - public final Long maxDocs() { - return this.maxDocs; - } - - /** - * API name: {@code max_size} - */ - @Nullable - public final String maxSize() { - return this.maxSize; - } - - /** - * API name: {@code max_size_bytes} - */ - @Nullable - public final Long maxSizeBytes() { - return this.maxSizeBytes; - } - - /** - * API name: {@code min_size} - */ - @Nullable - public final String minSize() { - return this.minSize; - } - - /** - * API name: {@code min_size_bytes} - */ - @Nullable - public final Long minSizeBytes() { - return this.minSizeBytes; - } - - /** - * API name: {@code max_primary_shard_size} - */ - @Nullable - public final String maxPrimaryShardSize() { - return this.maxPrimaryShardSize; - } - - /** - * API name: {@code max_primary_shard_size_bytes} - */ - @Nullable - public final Long maxPrimaryShardSizeBytes() { - return this.maxPrimaryShardSizeBytes; - } - - /** - * API name: {@code min_primary_shard_size} - */ - @Nullable - public final String minPrimaryShardSize() { - return this.minPrimaryShardSize; - } - - /** - * API name: {@code min_primary_shard_size_bytes} - */ - @Nullable - public final Long minPrimaryShardSizeBytes() { - return this.minPrimaryShardSizeBytes; - } - - /** - * API name: {@code max_primary_shard_docs} - */ - @Nullable - public final Long maxPrimaryShardDocs() { - return this.maxPrimaryShardDocs; - } - - /** - * API name: {@code min_primary_shard_docs} - */ - @Nullable - public final Long minPrimaryShardDocs() { - return this.minPrimaryShardDocs; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.minAge != null) { - generator.writeKey("min_age"); - this.minAge.serialize(generator, mapper); - - } - if (this.maxAge != null) { - generator.writeKey("max_age"); - this.maxAge.serialize(generator, mapper); - - } - if (this.maxAgeMillis != null) { - generator.writeKey("max_age_millis"); - generator.write(this.maxAgeMillis); - - } - if (this.minDocs != null) { - generator.writeKey("min_docs"); - generator.write(this.minDocs); - - } - if (this.maxDocs != null) { - generator.writeKey("max_docs"); - generator.write(this.maxDocs); - - } - if (this.maxSize != null) { - generator.writeKey("max_size"); - generator.write(this.maxSize); - - } - if (this.maxSizeBytes != null) { - generator.writeKey("max_size_bytes"); - generator.write(this.maxSizeBytes); - - } - if (this.minSize != null) { - generator.writeKey("min_size"); - generator.write(this.minSize); - - } - if (this.minSizeBytes != null) { - generator.writeKey("min_size_bytes"); - generator.write(this.minSizeBytes); - - } - if (this.maxPrimaryShardSize != null) { - generator.writeKey("max_primary_shard_size"); - generator.write(this.maxPrimaryShardSize); - - } - if (this.maxPrimaryShardSizeBytes != null) { - generator.writeKey("max_primary_shard_size_bytes"); - generator.write(this.maxPrimaryShardSizeBytes); - - } - if (this.minPrimaryShardSize != null) { - generator.writeKey("min_primary_shard_size"); - generator.write(this.minPrimaryShardSize); - - } - if (this.minPrimaryShardSizeBytes != null) { - generator.writeKey("min_primary_shard_size_bytes"); - generator.write(this.minPrimaryShardSizeBytes); - - } - if (this.maxPrimaryShardDocs != null) { - generator.writeKey("max_primary_shard_docs"); - generator.write(this.maxPrimaryShardDocs); - - } - if (this.minPrimaryShardDocs != null) { - generator.writeKey("min_primary_shard_docs"); - generator.write(this.minPrimaryShardDocs); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link RolloverConditions}. - */ - - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { - @Nullable - private Time minAge; - - @Nullable - private Time maxAge; - - @Nullable - private Long maxAgeMillis; - - @Nullable - private Long minDocs; - - @Nullable - private Long maxDocs; - - @Nullable - private String maxSize; - - @Nullable - private Long maxSizeBytes; - - @Nullable - private String minSize; - - @Nullable - private Long minSizeBytes; - - @Nullable - private String maxPrimaryShardSize; - - @Nullable - private Long maxPrimaryShardSizeBytes; - - @Nullable - private String minPrimaryShardSize; - - @Nullable - private Long minPrimaryShardSizeBytes; - - @Nullable - private Long maxPrimaryShardDocs; - - @Nullable - private Long minPrimaryShardDocs; - - /** - * API name: {@code min_age} - */ - public final Builder minAge(@Nullable Time value) { - this.minAge = value; - return this; - } - - /** - * API name: {@code min_age} - */ - public final Builder minAge(Function> fn) { - return this.minAge(fn.apply(new Time.Builder()).build()); - } - - /** - * API name: {@code max_age} - */ - public final Builder maxAge(@Nullable Time value) { - this.maxAge = value; - return this; - } - - /** - * API name: {@code max_age} - */ - public final Builder maxAge(Function> fn) { - return this.maxAge(fn.apply(new Time.Builder()).build()); - } - - /** - * API name: {@code max_age_millis} - */ - public final Builder maxAgeMillis(@Nullable Long value) { - this.maxAgeMillis = value; - return this; - } - - /** - * API name: {@code min_docs} - */ - public final Builder minDocs(@Nullable Long value) { - this.minDocs = value; - return this; - } - - /** - * API name: {@code max_docs} - */ - public final Builder maxDocs(@Nullable Long value) { - this.maxDocs = value; - return this; - } - - /** - * API name: {@code max_size} - */ - public final Builder maxSize(@Nullable String value) { - this.maxSize = value; - return this; - } - - /** - * API name: {@code max_size_bytes} - */ - public final Builder maxSizeBytes(@Nullable Long value) { - this.maxSizeBytes = value; - return this; - } - - /** - * API name: {@code min_size} - */ - public final Builder minSize(@Nullable String value) { - this.minSize = value; - return this; - } - - /** - * API name: {@code min_size_bytes} - */ - public final Builder minSizeBytes(@Nullable Long value) { - this.minSizeBytes = value; - return this; - } - - /** - * API name: {@code max_primary_shard_size} - */ - public final Builder maxPrimaryShardSize(@Nullable String value) { - this.maxPrimaryShardSize = value; - return this; - } - - /** - * API name: {@code max_primary_shard_size_bytes} - */ - public final Builder maxPrimaryShardSizeBytes(@Nullable Long value) { - this.maxPrimaryShardSizeBytes = value; - return this; - } - - /** - * API name: {@code min_primary_shard_size} - */ - public final Builder minPrimaryShardSize(@Nullable String value) { - this.minPrimaryShardSize = value; - return this; - } - - /** - * API name: {@code min_primary_shard_size_bytes} - */ - public final Builder minPrimaryShardSizeBytes(@Nullable Long value) { - this.minPrimaryShardSizeBytes = value; - return this; - } - - /** - * API name: {@code max_primary_shard_docs} - */ - public final Builder maxPrimaryShardDocs(@Nullable Long value) { - this.maxPrimaryShardDocs = value; - return this; - } - - /** - * API name: {@code min_primary_shard_docs} - */ - public final Builder minPrimaryShardDocs(@Nullable Long value) { - this.minPrimaryShardDocs = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link RolloverConditions}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public RolloverConditions build() { - _checkSingleUse(); - - return new RolloverConditions(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link RolloverConditions} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, RolloverConditions::setupRolloverConditionsDeserializer); - - protected static void setupRolloverConditionsDeserializer(ObjectDeserializer op) { - - op.add(Builder::minAge, Time._DESERIALIZER, "min_age"); - op.add(Builder::maxAge, Time._DESERIALIZER, "max_age"); - op.add(Builder::maxAgeMillis, JsonpDeserializer.longDeserializer(), "max_age_millis"); - op.add(Builder::minDocs, JsonpDeserializer.longDeserializer(), "min_docs"); - op.add(Builder::maxDocs, JsonpDeserializer.longDeserializer(), "max_docs"); - op.add(Builder::maxSize, JsonpDeserializer.stringDeserializer(), "max_size"); - op.add(Builder::maxSizeBytes, JsonpDeserializer.longDeserializer(), "max_size_bytes"); - op.add(Builder::minSize, JsonpDeserializer.stringDeserializer(), "min_size"); - op.add(Builder::minSizeBytes, JsonpDeserializer.longDeserializer(), "min_size_bytes"); - op.add(Builder::maxPrimaryShardSize, JsonpDeserializer.stringDeserializer(), "max_primary_shard_size"); - op.add(Builder::maxPrimaryShardSizeBytes, JsonpDeserializer.longDeserializer(), "max_primary_shard_size_bytes"); - op.add(Builder::minPrimaryShardSize, JsonpDeserializer.stringDeserializer(), "min_primary_shard_size"); - op.add(Builder::minPrimaryShardSizeBytes, JsonpDeserializer.longDeserializer(), "min_primary_shard_size_bytes"); - op.add(Builder::maxPrimaryShardDocs, JsonpDeserializer.longDeserializer(), "max_primary_shard_docs"); - op.add(Builder::minPrimaryShardDocs, JsonpDeserializer.longDeserializer(), "min_primary_shard_docs"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/simulate_template/Overlapping.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/simulate_template/Overlapping.java deleted file mode 100644 index 1235ad9a4..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/simulate_template/Overlapping.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.simulate_template; - -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.simulate_template.Overlapping - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class Overlapping implements JsonpSerializable { - private final String name; - - private final List indexPatterns; - - // --------------------------------------------------------------------------------------------- - - private Overlapping(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.indexPatterns = ApiTypeHelper.unmodifiableRequired(builder.indexPatterns, this, "indexPatterns"); - - } - - public static Overlapping of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Required - API name: {@code index_patterns} - */ - public final List indexPatterns() { - return this.indexPatterns; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("name"); - generator.write(this.name); - - if (ApiTypeHelper.isDefined(this.indexPatterns)) { - generator.writeKey("index_patterns"); - generator.writeStartArray(); - for (String item0 : this.indexPatterns) { - generator.write(item0); - - } - generator.writeEnd(); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link Overlapping}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private String name; - - private List indexPatterns; - - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * Required - API name: {@code index_patterns} - *

- * Adds all elements of list to indexPatterns. - */ - public final Builder indexPatterns(List list) { - this.indexPatterns = _listAddAll(this.indexPatterns, list); - return this; - } - - /** - * Required - API name: {@code index_patterns} - *

- * Adds one or more values to indexPatterns. - */ - public final Builder indexPatterns(String value, String... values) { - this.indexPatterns = _listAdd(this.indexPatterns, value, values); - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link Overlapping}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public Overlapping build() { - _checkSingleUse(); - - return new Overlapping(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link Overlapping} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - Overlapping::setupOverlappingDeserializer); - - protected static void setupOverlappingDeserializer(ObjectDeserializer op) { - - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::indexPatterns, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "index_patterns"); - - } - -} diff --git a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/simulate_template/Template.java b/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/simulate_template/Template.java deleted file mode 100644 index 516a1f06a..000000000 --- a/java-client-serverless/src/main/java/co/elastic/clients/elasticsearch/indices/simulate_template/Template.java +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package co.elastic.clients.elasticsearch.indices.simulate_template; - -import co.elastic.clients.elasticsearch._types.mapping.TypeMapping; -import co.elastic.clients.elasticsearch.indices.Alias; -import co.elastic.clients.elasticsearch.indices.IndexSettings; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; -import co.elastic.clients.json.JsonpSerializable; -import co.elastic.clients.json.JsonpUtils; -import co.elastic.clients.json.ObjectBuilderDeserializer; -import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; -import co.elastic.clients.util.ObjectBuilder; -import co.elastic.clients.util.WithJsonObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.lang.String; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import javax.annotation.Nullable; - -//---------------------------------------------------------------- -// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -//---------------------------------------------------------------- -// -// This code is generated from the Elasticsearch API specification -// at https://github.com/elastic/elasticsearch-specification -// -// Manual updates to this file will be lost when the code is -// re-generated. -// -// If you find a property that is missing or wrongly typed, please -// open an issue or a PR on the API specification repository. -// -//---------------------------------------------------------------- - -// typedef: indices.simulate_template.Template - -/** - * - * @see API - * specification - */ -@JsonpDeserializable -public class Template implements JsonpSerializable { - private final Map aliases; - - private final TypeMapping mappings; - - private final IndexSettings settings; - - // --------------------------------------------------------------------------------------------- - - private Template(Builder builder) { - - this.aliases = ApiTypeHelper.unmodifiableRequired(builder.aliases, this, "aliases"); - this.mappings = ApiTypeHelper.requireNonNull(builder.mappings, this, "mappings"); - this.settings = ApiTypeHelper.requireNonNull(builder.settings, this, "settings"); - - } - - public static Template of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code aliases} - */ - public final Map aliases() { - return this.aliases; - } - - /** - * Required - API name: {@code mappings} - */ - public final TypeMapping mappings() { - return this.mappings; - } - - /** - * Required - API name: {@code settings} - */ - public final IndexSettings settings() { - return this.settings; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.aliases)) { - generator.writeKey("aliases"); - generator.writeStartObject(); - for (Map.Entry item0 : this.aliases.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - generator.writeKey("mappings"); - this.mappings.serialize(generator, mapper); - - generator.writeKey("settings"); - this.settings.serialize(generator, mapper); - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link Template}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder