diff --git a/Makefile b/Makefile index ba01681ee8..f58b518edc 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ validate-no-cache: ## Validate a given endpoint request or response without loca generate: ## Generate the output spec @echo ">> generating the spec .." + @make generate-language-examples @npm run generate-schema --prefix compiler -- --spec ../specification/ --output ../output/ @npm run start --prefix typescript-generator @@ -40,6 +41,7 @@ setup: ## Install dependencies for contrib target @npm install --prefix compiler @npm install --prefix typescript-generator @npm install @redocly/cli + @npm install --prefix docs/examples clean-dep: ## Clean npm dependencies @rm -rf compiler/node_modules @@ -67,6 +69,10 @@ overlay-docs: ## Apply overlays to OpenAPI documents @npx @redocly/cli bundle output/openapi/elasticsearch-openapi.tmp2.json --ext json -o output/openapi/elasticsearch-openapi.examples.json rm output/openapi/elasticsearch-openapi.tmp*.json +generate-language-examples: + @node docs/examples/generate-language-examples.js + @npm run format:fix-examples --prefix compiler + lint-docs: ## Lint the OpenAPI documents after overlays @npx @redocly/cli lint "output/openapi/elasticsearch-*.json" --config "docs/linters/redocly.yaml" --format stylish --max-problems 500 diff --git a/compiler-rs/clients_schema/src/lib.rs b/compiler-rs/clients_schema/src/lib.rs index 8fcc6d57e8..31e03157fb 100644 --- a/compiler-rs/clients_schema/src/lib.rs +++ b/compiler-rs/clients_schema/src/lib.rs @@ -484,13 +484,20 @@ impl TypeDefinition { /// The Example type is used for both requests and responses. /// -/// This type definition is taken from the OpenAPI spec +/// This type definition is based on the OpenAPI spec /// https://spec.openapis.org/oas/v3.1.0#example-object -/// with the exception of using String as the 'value' type. +/// with the exception of using String as the 'value' type, +/// and some custom additions. /// /// The OpenAPI v3 spec also defines the 'Example' type, so /// to distinguish them, this type is called SchemaExample. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ExampleAlternative { + pub language: String, + pub code: String, +} + #[derive(Debug, Clone, Serialize, Deserialize)] pub struct SchemaExample { pub summary: Option, @@ -498,6 +505,7 @@ pub struct SchemaExample { pub description: Option, pub value: Option, pub external_value: Option, + pub alternatives: Option>, } /// Common attributes for all type definitions diff --git a/compiler-rs/clients_schema_to_openapi/src/paths.rs b/compiler-rs/clients_schema_to_openapi/src/paths.rs index 2dff857440..8dda3d0b6d 100644 --- a/compiler-rs/clients_schema_to_openapi/src/paths.rs +++ b/compiler-rs/clients_schema_to_openapi/src/paths.rs @@ -355,6 +355,14 @@ pub fn add_endpoint( "source": request_line + "\n" + request_body.as_str(), })); } + if let Some(alternatives) = example.alternatives.clone() { + for alternative in alternatives.iter() { + code_samples.push(serde_json::json!({ + "lang": alternative.language, + "source": alternative.code.as_str(), + })); + } + } } } if !code_samples.is_empty() { diff --git a/compiler-rs/compiler-wasm-lib/pkg/compiler_wasm_lib_bg.wasm b/compiler-rs/compiler-wasm-lib/pkg/compiler_wasm_lib_bg.wasm index 03d58f2568..8e41d69518 100644 Binary files a/compiler-rs/compiler-wasm-lib/pkg/compiler_wasm_lib_bg.wasm and b/compiler-rs/compiler-wasm-lib/pkg/compiler_wasm_lib_bg.wasm differ diff --git a/compiler/package.json b/compiler/package.json index da69b60817..0984792ba5 100644 --- a/compiler/package.json +++ b/compiler/package.json @@ -8,6 +8,7 @@ "lint:fix": "ts-standard --fix src", "format:check": "prettier --config .prettierrc.json --loglevel warn --check ../specification/", "format:fix": "prettier --config .prettierrc.json --loglevel warn --write ../specification/", + "format:fix-examples": "prettier --config .prettierrc.json --loglevel warn --write ../specification/**/*.yaml", "generate-schema": "ts-node src/index.ts", "transform-expand-generics": "ts-node src/transform/expand-generics.ts", "transform-to-openapi": "ts-node src/transform/schema-to-openapi.ts", diff --git a/compiler/src/model/metamodel.ts b/compiler/src/model/metamodel.ts index 3b4e987e30..62aa8bf355 100644 --- a/compiler/src/model/metamodel.ts +++ b/compiler/src/model/metamodel.ts @@ -260,6 +260,14 @@ export class Interface extends BaseType { variants?: Container } +/** + * An alternative of an example, coded in a given language. + */ +export class ExampleAlternative { + language: string + code: string +} + /** * The Example type is used for both requests and responses * This type definition is taken from the OpenAPI spec @@ -277,6 +285,8 @@ export class Example { value?: string /** A URI that points to the literal example */ external_value?: string + /** An array of alternatives for this example in other languages */ + alternatives?: ExampleAlternative[] } /** diff --git a/docs/examples/generate-language-examples.js b/docs/examples/generate-language-examples.js new file mode 100644 index 0000000000..01aacf8f93 --- /dev/null +++ b/docs/examples/generate-language-examples.js @@ -0,0 +1,80 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +const fs = require('fs'); +const path = require('path'); +const { parseDocument: yamlParseDocument } = require('yaml'); +const { convertRequests, loadSchema } = require('@elastic/request-converter'); + +const LANGUAGES = ['Python', 'JavaScript', 'Ruby', 'PHP', 'curl']; + +async function generateLanguages(example) { + const doc = yamlParseDocument(await fs.promises.readFile(example, 'utf8')); + const data = doc.toJS(); + let request = data.method_request; + if (data.value) { + if (typeof data.value === 'string') { + request += '\n' + data.value; + } + else { + request += '\n' + JSON.stringify(data.value); + } + } + data.alternatives = []; + for (const lang of LANGUAGES) { + data.alternatives.push({ + language: lang, + code: (await convertRequests(request, lang, {})).trim(), + }); + } + doc.delete('alternatives'); + doc.add(doc.createPair('alternatives', data.alternatives)); + await fs.promises.writeFile(example, doc.toString({lineWidth: 132})); +} + +async function* walkExamples(dir) { + for await (const d of await fs.promises.opendir(dir)) { + const entry = path.join(dir, d.name); + if (d.isDirectory()) { + yield* walkExamples(entry); + } + else if (d.isFile() && entry.includes('/examples/request/') && entry.endsWith('.yaml')) { + yield entry; + } + } +} + +async function main() { + let count = 0; + let errors = 0; + await loadSchema('output/schema/schema.json'); + for await (const example of walkExamples('./specification/')) { + try { + await generateLanguages(example); + } + catch (err) { + console.log(`${example}: ${err}`); + errors += 1; + } + count += 1; + } + console.log(`${count} examples processed, ${errors} errors.`); +} + +main(); diff --git a/docs/examples/package-lock.json b/docs/examples/package-lock.json new file mode 100644 index 0000000000..39aabc68e4 --- /dev/null +++ b/docs/examples/package-lock.json @@ -0,0 +1,5397 @@ +{ + "name": "examples", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "@elastic/request-converter": "^9.1.1", + "@redocly/cli": "^1.34.3", + "@stoplight/spectral-cli": "^6.14.2", + "yaml": "^2.8.0" + } + }, + "node_modules/@asyncapi/specs": { + "version": "6.8.1", + "resolved": "https://registry.npmjs.org/@asyncapi/specs/-/specs-6.8.1.tgz", + "integrity": "sha512-czHoAk3PeXTLR+X8IUaD+IpT+g+zUvkcgMDJVothBsan+oHN3jfcFcFUNdOPAAFoUCQN1hXF1dWuphWy05THlA==", + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.11" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", + "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.27.1", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz", + "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.27.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.27.6.tgz", + "integrity": "sha512-vbavdySgbTTrmFE+EsiqUTzlOr5bzlnJtUv9PynGCAKvfQqjIXbvFdumPM/GxMDfyuGMJaJAU6TO4zc1Jf1i8Q==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@elastic/request-converter": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/@elastic/request-converter/-/request-converter-9.1.1.tgz", + "integrity": "sha512-aFNNKvYgyasn97bh2cJx0dL0NgLFQuFMHCLQGnAebe1cwE/vc2mOh+DWWMGICndIKeP/F1aVpCy7KYbCXmyjzA==", + "license": "Apache-2.0", + "dependencies": { + "base64url": "^3.0.1", + "commander": "^12.1.0", + "find-my-way-ts": "^0.1.2", + "handlebars": "^4.7.8", + "prettier": "^2.8.8" + }, + "bin": { + "es-request-converter": "dist/es-request-converter.js" + } + }, + "node_modules/@emotion/is-prop-valid": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.2.2.tgz", + "integrity": "sha512-uNsoYd37AFmaCdXlg6EYD1KaPOaRWRByMCYzbKUX4+hhMfrxdVSelShywL4JVaAeM/eHUOSprYBQls+/neX3pw==", + "license": "MIT", + "dependencies": { + "@emotion/memoize": "^0.8.1" + } + }, + "node_modules/@emotion/memoize": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.8.1.tgz", + "integrity": "sha512-W2P2c/VRW1/1tLox0mVUalvnWXxavmv/Oum2aPsRcoDJuob75FC3Y8FbpfLwUegRcxINtGUMPq0tFCvYNTBXNA==", + "license": "MIT" + }, + "node_modules/@emotion/unitless": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.8.1.tgz", + "integrity": "sha512-KOEGMu6dmJZtpadb476IsZBclKvILjopjUii3V+7MnXIQCYh8W3NgNcgwo21n9LXZX6EDIKvqfjYxXebDwxKmQ==", + "license": "MIT" + }, + "node_modules/@exodus/schemasafe": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@exodus/schemasafe/-/schemasafe-1.3.0.tgz", + "integrity": "sha512-5Aap/GaRupgNx/feGBwLLTVv8OQFfv3pq2lPRzPg9R+IOBnDgghTGW7l7EuVXOvg5cc/xSAlRW8rBrjIC3Nvqw==", + "license": "MIT" + }, + "node_modules/@faker-js/faker": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-7.6.0.tgz", + "integrity": "sha512-XK6BTq1NDMo9Xqw/YkYyGjSsg44fbNwYRx7QK2CuoQgyy+f1rrTDHoExVM5PsyXCtfl2vs2vVJ0MN0yN6LppRw==", + "license": "MIT", + "engines": { + "node": ">=14.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/@humanwhocodes/momoa": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@humanwhocodes/momoa/-/momoa-2.0.4.tgz", + "integrity": "sha512-RE815I4arJFtt+FVeU1Tgp9/Xvecacji8w/V6XtXsWWH/wz/eNkNbhb+ny/+PlVZjV0rxQpRSQKNKE3lcktHEA==", + "license": "Apache-2.0", + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@jest/schemas": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "license": "MIT", + "dependencies": { + "@sinclair/typebox": "^0.27.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jsep-plugin/assignment": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@jsep-plugin/assignment/-/assignment-1.3.0.tgz", + "integrity": "sha512-VVgV+CXrhbMI3aSusQyclHkenWSAm95WaiKrMxRFam3JSUiIaQjoMIw2sEs/OX4XifnqeQUN4DYbJjlA8EfktQ==", + "license": "MIT", + "engines": { + "node": ">= 10.16.0" + }, + "peerDependencies": { + "jsep": "^0.4.0||^1.0.0" + } + }, + "node_modules/@jsep-plugin/regex": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@jsep-plugin/regex/-/regex-1.0.4.tgz", + "integrity": "sha512-q7qL4Mgjs1vByCaTnDFcBnV9HS7GVPJX5vyVoCgZHNSC9rjwIlmbXG5sUuorR5ndfHAIlJ8pVStxvjXHbNvtUg==", + "license": "MIT", + "engines": { + "node": ">= 10.16.0" + }, + "peerDependencies": { + "jsep": "^0.4.0||^1.0.0" + } + }, + "node_modules/@jsep-plugin/ternary": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@jsep-plugin/ternary/-/ternary-1.1.4.tgz", + "integrity": "sha512-ck5wiqIbqdMX6WRQztBL7ASDty9YLgJ3sSAK5ZpBzXeySvFGCzIvM6UiAI4hTZ22fEcYQVV/zhUbNscggW+Ukg==", + "license": "MIT", + "engines": { + "node": ">= 10.16.0" + }, + "peerDependencies": { + "jsep": "^0.4.0||^1.0.0" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@opentelemetry/api": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz", + "integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==", + "license": "Apache-2.0", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@opentelemetry/api-logs": { + "version": "0.53.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.53.0.tgz", + "integrity": "sha512-8HArjKx+RaAI8uEIgcORbZIPklyh1YLjPSBus8hjRmvLi6DeFzgOcdZ7KwPabKj8mXF8dX0hyfAyGfycz0DbFw==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/api": "^1.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@opentelemetry/context-async-hooks": { + "version": "1.26.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/context-async-hooks/-/context-async-hooks-1.26.0.tgz", + "integrity": "sha512-HedpXXYzzbaoutw6DFLWLDket2FwLkLpil4hGCZ1xYEIMTcivdfwEOISgdbLEWyG3HW52gTq2V9mOVJrONgiwg==", + "license": "Apache-2.0", + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/core": { + "version": "1.26.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.26.0.tgz", + "integrity": "sha512-1iKxXXE8415Cdv0yjG3G6hQnB5eVEsJce3QaawX8SjDn0mAS0ZM8fAbZZJD4ajvhC15cePvosSCut404KrIIvQ==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/semantic-conventions": "1.27.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/exporter-trace-otlp-http": { + "version": "0.53.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-http/-/exporter-trace-otlp-http-0.53.0.tgz", + "integrity": "sha512-m7F5ZTq+V9mKGWYpX8EnZ7NjoqAU7VemQ1E2HAG+W/u0wpY1x0OmbxAXfGKFHCspdJk8UKlwPGrpcB8nay3P8A==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "1.26.0", + "@opentelemetry/otlp-exporter-base": "0.53.0", + "@opentelemetry/otlp-transformer": "0.53.0", + "@opentelemetry/resources": "1.26.0", + "@opentelemetry/sdk-trace-base": "1.26.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.0.0" + } + }, + "node_modules/@opentelemetry/otlp-exporter-base": { + "version": "0.53.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-exporter-base/-/otlp-exporter-base-0.53.0.tgz", + "integrity": "sha512-UCWPreGQEhD6FjBaeDuXhiMf6kkBODF0ZQzrk/tuQcaVDJ+dDQ/xhJp192H9yWnKxVpEjFrSSLnpqmX4VwX+eA==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "1.26.0", + "@opentelemetry/otlp-transformer": "0.53.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.0.0" + } + }, + "node_modules/@opentelemetry/otlp-transformer": { + "version": "0.53.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-transformer/-/otlp-transformer-0.53.0.tgz", + "integrity": "sha512-rM0sDA9HD8dluwuBxLetUmoqGJKSAbWenwD65KY9iZhUxdBHRLrIdrABfNDP7aiTjcgK8XFyTn5fhDz7N+W6DA==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/api-logs": "0.53.0", + "@opentelemetry/core": "1.26.0", + "@opentelemetry/resources": "1.26.0", + "@opentelemetry/sdk-logs": "0.53.0", + "@opentelemetry/sdk-metrics": "1.26.0", + "@opentelemetry/sdk-trace-base": "1.26.0", + "protobufjs": "^7.3.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/propagator-b3": { + "version": "1.26.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-b3/-/propagator-b3-1.26.0.tgz", + "integrity": "sha512-vvVkQLQ/lGGyEy9GT8uFnI047pajSOVnZI2poJqVGD3nJ+B9sFGdlHNnQKophE3lHfnIH0pw2ubrCTjZCgIj+Q==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "1.26.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/propagator-jaeger": { + "version": "1.26.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-jaeger/-/propagator-jaeger-1.26.0.tgz", + "integrity": "sha512-DelFGkCdaxA1C/QA0Xilszfr0t4YbGd3DjxiCDPh34lfnFr+VkkrjV9S8ZTJvAzfdKERXhfOxIKBoGPJwoSz7Q==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "1.26.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/resources": { + "version": "1.26.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.26.0.tgz", + "integrity": "sha512-CPNYchBE7MBecCSVy0HKpUISEeJOniWqcHaAHpmasZ3j9o6V3AyBzhRc90jdmemq0HOxDr6ylhUbDhBqqPpeNw==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "1.26.0", + "@opentelemetry/semantic-conventions": "1.27.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-logs": { + "version": "0.53.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-logs/-/sdk-logs-0.53.0.tgz", + "integrity": "sha512-dhSisnEgIj/vJZXZV6f6KcTnyLDx/VuQ6l3ejuZpMpPlh9S1qMHiZU9NMmOkVkwwHkMy3G6mEBwdP23vUZVr4g==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/api-logs": "0.53.0", + "@opentelemetry/core": "1.26.0", + "@opentelemetry/resources": "1.26.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.4.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-metrics": { + "version": "1.26.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-1.26.0.tgz", + "integrity": "sha512-0SvDXmou/JjzSDOjUmetAAvcKQW6ZrvosU0rkbDGpXvvZN+pQF6JbK/Kd4hNdK4q/22yeruqvukXEJyySTzyTQ==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "1.26.0", + "@opentelemetry/resources": "1.26.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.3.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-trace-base": { + "version": "1.26.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.26.0.tgz", + "integrity": "sha512-olWQldtvbK4v22ymrKLbIcBi9L2SpMO84sCPY54IVsJhP9fRsxJT194C/AVaAuJzLE30EdhhM1VmvVYR7az+cw==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/core": "1.26.0", + "@opentelemetry/resources": "1.26.0", + "@opentelemetry/semantic-conventions": "1.27.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-trace-node": { + "version": "1.26.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-node/-/sdk-trace-node-1.26.0.tgz", + "integrity": "sha512-Fj5IVKrj0yeUwlewCRwzOVcr5avTuNnMHWf7GPc1t6WaT78J6CJyF3saZ/0RkZfdeNO8IcBl/bNcWMVZBMRW8Q==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/context-async-hooks": "1.26.0", + "@opentelemetry/core": "1.26.0", + "@opentelemetry/propagator-b3": "1.26.0", + "@opentelemetry/propagator-jaeger": "1.26.0", + "@opentelemetry/sdk-trace-base": "1.26.0", + "semver": "^7.5.2" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/semantic-conventions": { + "version": "1.27.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.27.0.tgz", + "integrity": "sha512-sAay1RrB+ONOem0OZanAR1ZI/k7yDpnOQSQmTMuGImUQb2y8EbSaCJ94FQluM74xoU03vlb2d2U90hZluL6nQg==", + "license": "Apache-2.0", + "engines": { + "node": ">=14" + } + }, + "node_modules/@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/codegen": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/eventemitter": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", + "license": "BSD-3-Clause", + "dependencies": { + "@protobufjs/aspromise": "^1.1.1", + "@protobufjs/inquire": "^1.1.0" + } + }, + "node_modules/@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/inquire": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==", + "license": "BSD-3-Clause" + }, + "node_modules/@redocly/ajv": { + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/@redocly/ajv/-/ajv-8.11.2.tgz", + "integrity": "sha512-io1JpnwtIcvojV7QKDUSIuMN/ikdOUd1ReEnUnMKGfDVridQZ31J0MmIuqwuRjWDZfmvr+Q0MqCcfHM2gTivOg==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js-replace": "^1.0.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/@redocly/cli": { + "version": "1.34.3", + "resolved": "https://registry.npmjs.org/@redocly/cli/-/cli-1.34.3.tgz", + "integrity": "sha512-GJNBTMfm5wTCtH6K+RtPQZuGbqflMclXqAZ5My12tfux6xFDMW1l0MNd5RMpnIS1aeFcDX++P1gnnROWlesj4w==", + "license": "MIT", + "dependencies": { + "@opentelemetry/api": "1.9.0", + "@opentelemetry/exporter-trace-otlp-http": "0.53.0", + "@opentelemetry/resources": "1.26.0", + "@opentelemetry/sdk-trace-node": "1.26.0", + "@opentelemetry/semantic-conventions": "1.27.0", + "@redocly/config": "^0.22.0", + "@redocly/openapi-core": "1.34.3", + "@redocly/respect-core": "1.34.3", + "abort-controller": "^3.0.0", + "chokidar": "^3.5.1", + "colorette": "^1.2.0", + "core-js": "^3.32.1", + "dotenv": "^16.4.7", + "form-data": "^4.0.0", + "get-port-please": "^3.0.1", + "glob": "^7.1.6", + "handlebars": "^4.7.6", + "mobx": "^6.0.4", + "pluralize": "^8.0.0", + "react": "^17.0.0 || ^18.2.0 || ^19.0.0", + "react-dom": "^17.0.0 || ^18.2.0 || ^19.0.0", + "redoc": "2.5.0", + "semver": "^7.5.2", + "simple-websocket": "^9.0.0", + "styled-components": "^6.0.7", + "yargs": "17.0.1" + }, + "bin": { + "openapi": "bin/cli.js", + "redocly": "bin/cli.js" + }, + "engines": { + "node": ">=18.17.0", + "npm": ">=9.5.0" + } + }, + "node_modules/@redocly/config": { + "version": "0.22.2", + "resolved": "https://registry.npmjs.org/@redocly/config/-/config-0.22.2.tgz", + "integrity": "sha512-roRDai8/zr2S9YfmzUfNhKjOF0NdcOIqF7bhf4MVC5UxpjIysDjyudvlAiVbpPHp3eDRWbdzUgtkK1a7YiDNyQ==", + "license": "MIT" + }, + "node_modules/@redocly/openapi-core": { + "version": "1.34.3", + "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.34.3.tgz", + "integrity": "sha512-3arRdUp1fNx55itnjKiUhO6t4Mf91TsrTIYINDNLAZPS0TPd5YpiXRctwjel0qqWoOOhjA34cZ3m4dksLDFUYg==", + "license": "MIT", + "dependencies": { + "@redocly/ajv": "^8.11.2", + "@redocly/config": "^0.22.0", + "colorette": "^1.2.0", + "https-proxy-agent": "^7.0.5", + "js-levenshtein": "^1.1.6", + "js-yaml": "^4.1.0", + "minimatch": "^5.0.1", + "pluralize": "^8.0.0", + "yaml-ast-parser": "0.0.43" + }, + "engines": { + "node": ">=18.17.0", + "npm": ">=9.5.0" + } + }, + "node_modules/@redocly/respect-core": { + "version": "1.34.3", + "resolved": "https://registry.npmjs.org/@redocly/respect-core/-/respect-core-1.34.3.tgz", + "integrity": "sha512-vo/gu7dRGwTVsRueVSjVk04jOQuL0w22RBJRdRUWkfyse791tYXgMCOx35ijKekL83Q/7Okxf/YX6UY1v5CAug==", + "license": "MIT", + "dependencies": { + "@faker-js/faker": "^7.6.0", + "@redocly/ajv": "8.11.2", + "@redocly/openapi-core": "1.34.3", + "better-ajv-errors": "^1.2.0", + "colorette": "^2.0.20", + "concat-stream": "^2.0.0", + "cookie": "^0.7.2", + "dotenv": "16.4.5", + "form-data": "4.0.0", + "jest-diff": "^29.3.1", + "jest-matcher-utils": "^29.3.1", + "js-yaml": "4.1.0", + "json-pointer": "^0.6.2", + "jsonpath-plus": "^10.0.6", + "open": "^10.1.0", + "openapi-sampler": "^1.6.1", + "outdent": "^0.8.0", + "set-cookie-parser": "^2.3.5", + "undici": "^6.21.1" + }, + "engines": { + "node": ">=18.17.0", + "npm": ">=9.5.0" + } + }, + "node_modules/@redocly/respect-core/node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "license": "MIT" + }, + "node_modules/@redocly/respect-core/node_modules/dotenv": { + "version": "16.4.5", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", + "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/@redocly/respect-core/node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@rollup/plugin-commonjs": { + "version": "22.0.2", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-22.0.2.tgz", + "integrity": "sha512-//NdP6iIwPbMTcazYsiBMbJW7gfmpHom33u1beiIoHDEM0Q9clvtQB1T0efvMqHeKsGohiHo97BCPCkBXdscwg==", + "license": "MIT", + "dependencies": { + "@rollup/pluginutils": "^3.1.0", + "commondir": "^1.0.1", + "estree-walker": "^2.0.1", + "glob": "^7.1.6", + "is-reference": "^1.2.1", + "magic-string": "^0.25.7", + "resolve": "^1.17.0" + }, + "engines": { + "node": ">= 12.0.0" + }, + "peerDependencies": { + "rollup": "^2.68.0" + } + }, + "node_modules/@rollup/pluginutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", + "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "license": "MIT", + "dependencies": { + "@types/estree": "0.0.39", + "estree-walker": "^1.0.1", + "picomatch": "^2.2.2" + }, + "engines": { + "node": ">= 8.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0" + } + }, + "node_modules/@rollup/pluginutils/node_modules/estree-walker": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", + "license": "MIT" + }, + "node_modules/@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "license": "MIT" + }, + "node_modules/@stoplight/better-ajv-errors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@stoplight/better-ajv-errors/-/better-ajv-errors-1.0.3.tgz", + "integrity": "sha512-0p9uXkuB22qGdNfy3VeEhxkU5uwvp/KrBTAbrLBURv6ilxIVwanKwjMc41lQfIVgPGcOkmLbTolfFrSsueu7zA==", + "license": "Apache-2.0", + "dependencies": { + "jsonpointer": "^5.0.0", + "leven": "^3.1.0" + }, + "engines": { + "node": "^12.20 || >= 14.13" + }, + "peerDependencies": { + "ajv": ">=8" + } + }, + "node_modules/@stoplight/json": { + "version": "3.21.7", + "resolved": "https://registry.npmjs.org/@stoplight/json/-/json-3.21.7.tgz", + "integrity": "sha512-xcJXgKFqv/uCEgtGlPxy3tPA+4I+ZI4vAuMJ885+ThkTHFVkC+0Fm58lA9NlsyjnkpxFh4YiQWpH+KefHdbA0A==", + "license": "Apache-2.0", + "dependencies": { + "@stoplight/ordered-object-literal": "^1.0.3", + "@stoplight/path": "^1.3.2", + "@stoplight/types": "^13.6.0", + "jsonc-parser": "~2.2.1", + "lodash": "^4.17.21", + "safe-stable-stringify": "^1.1" + }, + "engines": { + "node": ">=8.3.0" + } + }, + "node_modules/@stoplight/json-ref-readers": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@stoplight/json-ref-readers/-/json-ref-readers-1.2.2.tgz", + "integrity": "sha512-nty0tHUq2f1IKuFYsLM4CXLZGHdMn+X/IwEUIpeSOXt0QjMUbL0Em57iJUDzz+2MkWG83smIigNZ3fauGjqgdQ==", + "license": "Apache-2.0", + "dependencies": { + "node-fetch": "^2.6.0", + "tslib": "^1.14.1" + }, + "engines": { + "node": ">=8.3.0" + } + }, + "node_modules/@stoplight/json-ref-readers/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "license": "0BSD" + }, + "node_modules/@stoplight/json-ref-resolver": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/@stoplight/json-ref-resolver/-/json-ref-resolver-3.1.6.tgz", + "integrity": "sha512-YNcWv3R3n3U6iQYBsFOiWSuRGE5su1tJSiX6pAPRVk7dP0L7lqCteXGzuVRQ0gMZqUl8v1P0+fAKxF6PLo9B5A==", + "license": "Apache-2.0", + "dependencies": { + "@stoplight/json": "^3.21.0", + "@stoplight/path": "^1.3.2", + "@stoplight/types": "^12.3.0 || ^13.0.0", + "@types/urijs": "^1.19.19", + "dependency-graph": "~0.11.0", + "fast-memoize": "^2.5.2", + "immer": "^9.0.6", + "lodash": "^4.17.21", + "tslib": "^2.6.0", + "urijs": "^1.19.11" + }, + "engines": { + "node": ">=8.3.0" + } + }, + "node_modules/@stoplight/ordered-object-literal": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@stoplight/ordered-object-literal/-/ordered-object-literal-1.0.5.tgz", + "integrity": "sha512-COTiuCU5bgMUtbIFBuyyh2/yVVzlr5Om0v5utQDgBCuQUOPgU1DwoffkTfg4UBQOvByi5foF4w4T+H9CoRe5wg==", + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/@stoplight/path": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@stoplight/path/-/path-1.3.2.tgz", + "integrity": "sha512-lyIc6JUlUA8Ve5ELywPC8I2Sdnh1zc1zmbYgVarhXIp9YeAB0ReeqmGEOWNtlHkbP2DAA1AL65Wfn2ncjK/jtQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/@stoplight/spectral-cli": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/@stoplight/spectral-cli/-/spectral-cli-6.15.0.tgz", + "integrity": "sha512-FVeQIuqQQnnLfa8vy+oatTKUve7uU+3SaaAfdjpX/B+uB1NcfkKRJYhKT9wMEehDRaMPL5AKIRYMCFerdEbIpw==", + "license": "Apache-2.0", + "dependencies": { + "@stoplight/json": "~3.21.0", + "@stoplight/path": "1.3.2", + "@stoplight/spectral-core": "^1.19.5", + "@stoplight/spectral-formatters": "^1.4.1", + "@stoplight/spectral-parsers": "^1.0.4", + "@stoplight/spectral-ref-resolver": "^1.0.4", + "@stoplight/spectral-ruleset-bundler": "^1.6.0", + "@stoplight/spectral-ruleset-migrator": "^1.11.0", + "@stoplight/spectral-rulesets": ">=1", + "@stoplight/spectral-runtime": "^1.1.2", + "@stoplight/types": "^13.6.0", + "chalk": "4.1.2", + "fast-glob": "~3.2.12", + "hpagent": "~1.2.0", + "lodash": "~4.17.21", + "pony-cause": "^1.1.1", + "stacktracey": "^2.1.8", + "tslib": "^2.8.1", + "yargs": "~17.7.2" + }, + "bin": { + "spectral": "dist/index.js" + }, + "engines": { + "node": "^16.20 || ^18.18 || >= 20.17" + } + }, + "node_modules/@stoplight/spectral-cli/node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@stoplight/spectral-cli/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@stoplight/spectral-cli/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/@stoplight/spectral-core": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/@stoplight/spectral-core/-/spectral-core-1.20.0.tgz", + "integrity": "sha512-5hBP81nCC1zn1hJXL/uxPNRKNcB+/pEIHgCjPRpl/w/qy9yC9ver04tw1W0l/PMiv0UeB5dYgozXVQ4j5a6QQQ==", + "license": "Apache-2.0", + "dependencies": { + "@stoplight/better-ajv-errors": "1.0.3", + "@stoplight/json": "~3.21.0", + "@stoplight/path": "1.3.2", + "@stoplight/spectral-parsers": "^1.0.0", + "@stoplight/spectral-ref-resolver": "^1.0.4", + "@stoplight/spectral-runtime": "^1.1.2", + "@stoplight/types": "~13.6.0", + "@types/es-aggregate-error": "^1.0.2", + "@types/json-schema": "^7.0.11", + "ajv": "^8.17.1", + "ajv-errors": "~3.0.0", + "ajv-formats": "~2.1.1", + "es-aggregate-error": "^1.0.7", + "jsonpath-plus": "^10.3.0", + "lodash": "~4.17.21", + "lodash.topath": "^4.5.2", + "minimatch": "3.1.2", + "nimma": "0.2.3", + "pony-cause": "^1.1.1", + "simple-eval": "1.0.1", + "tslib": "^2.8.1" + }, + "engines": { + "node": "^16.20 || ^18.18 || >= 20.17" + } + }, + "node_modules/@stoplight/spectral-core/node_modules/@stoplight/types": { + "version": "13.6.0", + "resolved": "https://registry.npmjs.org/@stoplight/types/-/types-13.6.0.tgz", + "integrity": "sha512-dzyuzvUjv3m1wmhPfq82lCVYGcXG0xUYgqnWfCq3PCVR4BKFhjdkHrnJ+jIDoMKvXb05AZP/ObQF6+NpDo29IQ==", + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.4", + "utility-types": "^3.10.0" + }, + "engines": { + "node": "^12.20 || >=14.13" + } + }, + "node_modules/@stoplight/spectral-core/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@stoplight/spectral-core/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@stoplight/spectral-formats": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@stoplight/spectral-formats/-/spectral-formats-1.8.2.tgz", + "integrity": "sha512-c06HB+rOKfe7tuxg0IdKDEA5XnjL2vrn/m/OVIIxtINtBzphZrOgtRn7epQ5bQF5SWp84Ue7UJWaGgDwVngMFw==", + "license": "Apache-2.0", + "dependencies": { + "@stoplight/json": "^3.17.0", + "@stoplight/spectral-core": "^1.19.2", + "@types/json-schema": "^7.0.7", + "tslib": "^2.8.1" + }, + "engines": { + "node": "^16.20 || ^18.18 || >= 20.17" + } + }, + "node_modules/@stoplight/spectral-formatters": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@stoplight/spectral-formatters/-/spectral-formatters-1.5.0.tgz", + "integrity": "sha512-lR7s41Z00Mf8TdXBBZQ3oi2uR8wqAtR6NO0KA8Ltk4FSpmAy0i6CKUmJG9hZQjanTnGmwpQkT/WP66p1GY3iXA==", + "license": "Apache-2.0", + "dependencies": { + "@stoplight/path": "^1.3.2", + "@stoplight/spectral-core": "^1.19.4", + "@stoplight/spectral-runtime": "^1.1.2", + "@stoplight/types": "^13.15.0", + "@types/markdown-escape": "^1.1.3", + "chalk": "4.1.2", + "cliui": "7.0.4", + "lodash": "^4.17.21", + "markdown-escape": "^2.0.0", + "node-sarif-builder": "^2.0.3", + "strip-ansi": "6.0", + "text-table": "^0.2.0", + "tslib": "^2.8.1" + }, + "engines": { + "node": "^16.20 || ^18.18 || >= 20.17" + } + }, + "node_modules/@stoplight/spectral-functions": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@stoplight/spectral-functions/-/spectral-functions-1.10.1.tgz", + "integrity": "sha512-obu8ZfoHxELOapfGsCJixKZXZcffjg+lSoNuttpmUFuDzVLT3VmH8QkPXfOGOL5Pz80BR35ClNAToDkdnYIURg==", + "license": "Apache-2.0", + "dependencies": { + "@stoplight/better-ajv-errors": "1.0.3", + "@stoplight/json": "^3.17.1", + "@stoplight/spectral-core": "^1.19.4", + "@stoplight/spectral-formats": "^1.8.1", + "@stoplight/spectral-runtime": "^1.1.2", + "ajv": "^8.17.1", + "ajv-draft-04": "~1.0.0", + "ajv-errors": "~3.0.0", + "ajv-formats": "~2.1.1", + "lodash": "~4.17.21", + "tslib": "^2.8.1" + }, + "engines": { + "node": "^16.20 || ^18.18 || >= 20.17" + } + }, + "node_modules/@stoplight/spectral-parsers": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@stoplight/spectral-parsers/-/spectral-parsers-1.0.5.tgz", + "integrity": "sha512-ANDTp2IHWGvsQDAY85/jQi9ZrF4mRrA5bciNHX+PUxPr4DwS6iv4h+FVWJMVwcEYdpyoIdyL+SRmHdJfQEPmwQ==", + "license": "Apache-2.0", + "dependencies": { + "@stoplight/json": "~3.21.0", + "@stoplight/types": "^14.1.1", + "@stoplight/yaml": "~4.3.0", + "tslib": "^2.8.1" + }, + "engines": { + "node": "^16.20 || ^18.18 || >= 20.17" + } + }, + "node_modules/@stoplight/spectral-parsers/node_modules/@stoplight/types": { + "version": "14.1.1", + "resolved": "https://registry.npmjs.org/@stoplight/types/-/types-14.1.1.tgz", + "integrity": "sha512-/kjtr+0t0tjKr+heVfviO9FrU/uGLc+QNX3fHJc19xsCNYqU7lVhaXxDmEID9BZTjG+/r9pK9xP/xU02XGg65g==", + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.4", + "utility-types": "^3.10.0" + }, + "engines": { + "node": "^12.20 || >=14.13" + } + }, + "node_modules/@stoplight/spectral-ref-resolver": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@stoplight/spectral-ref-resolver/-/spectral-ref-resolver-1.0.5.tgz", + "integrity": "sha512-gj3TieX5a9zMW29z3mBlAtDOCgN3GEc1VgZnCVlr5irmR4Qi5LuECuFItAq4pTn5Zu+sW5bqutsCH7D4PkpyAA==", + "license": "Apache-2.0", + "dependencies": { + "@stoplight/json-ref-readers": "1.2.2", + "@stoplight/json-ref-resolver": "~3.1.6", + "@stoplight/spectral-runtime": "^1.1.2", + "dependency-graph": "0.11.0", + "tslib": "^2.8.1" + }, + "engines": { + "node": "^16.20 || ^18.18 || >= 20.17" + } + }, + "node_modules/@stoplight/spectral-ruleset-bundler": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@stoplight/spectral-ruleset-bundler/-/spectral-ruleset-bundler-1.6.3.tgz", + "integrity": "sha512-AQFRO6OCKg8SZJUupnr3+OzI1LrMieDTEUHsYgmaRpNiDRPvzImE3bzM1KyQg99q58kTQyZ8kpr7sG8Lp94RRA==", + "license": "Apache-2.0", + "dependencies": { + "@rollup/plugin-commonjs": "~22.0.2", + "@stoplight/path": "1.3.2", + "@stoplight/spectral-core": ">=1", + "@stoplight/spectral-formats": "^1.8.1", + "@stoplight/spectral-functions": ">=1", + "@stoplight/spectral-parsers": ">=1", + "@stoplight/spectral-ref-resolver": "^1.0.4", + "@stoplight/spectral-ruleset-migrator": "^1.9.6", + "@stoplight/spectral-rulesets": ">=1", + "@stoplight/spectral-runtime": "^1.1.2", + "@stoplight/types": "^13.6.0", + "@types/node": "*", + "pony-cause": "1.1.1", + "rollup": "~2.79.2", + "tslib": "^2.8.1", + "validate-npm-package-name": "3.0.0" + }, + "engines": { + "node": "^16.20 || ^18.18 || >= 20.17" + } + }, + "node_modules/@stoplight/spectral-ruleset-migrator": { + "version": "1.11.2", + "resolved": "https://registry.npmjs.org/@stoplight/spectral-ruleset-migrator/-/spectral-ruleset-migrator-1.11.2.tgz", + "integrity": "sha512-6r5i4hrDmppspSSxdUKKNHc07NGSSIkvwKNk3M5ukCwvSslImvDEimeWAhPBryhmSJ82YAsKr8erZZpKullxWw==", + "license": "Apache-2.0", + "dependencies": { + "@stoplight/json": "~3.21.0", + "@stoplight/ordered-object-literal": "~1.0.4", + "@stoplight/path": "1.3.2", + "@stoplight/spectral-functions": "^1.9.1", + "@stoplight/spectral-runtime": "^1.1.2", + "@stoplight/types": "^13.6.0", + "@stoplight/yaml": "~4.2.3", + "@types/node": "*", + "ajv": "^8.17.1", + "ast-types": "0.14.2", + "astring": "^1.9.0", + "reserved": "0.1.2", + "tslib": "^2.8.1", + "validate-npm-package-name": "3.0.0" + }, + "engines": { + "node": "^16.20 || ^18.18 || >= 20.17" + } + }, + "node_modules/@stoplight/spectral-ruleset-migrator/node_modules/@stoplight/yaml": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/@stoplight/yaml/-/yaml-4.2.3.tgz", + "integrity": "sha512-Mx01wjRAR9C7yLMUyYFTfbUf5DimEpHMkRDQ1PKLe9dfNILbgdxyrncsOXM3vCpsQ1Hfj4bPiGl+u4u6e9Akqw==", + "license": "Apache-2.0", + "dependencies": { + "@stoplight/ordered-object-literal": "^1.0.1", + "@stoplight/types": "^13.0.0", + "@stoplight/yaml-ast-parser": "0.0.48", + "tslib": "^2.2.0" + }, + "engines": { + "node": ">=10.8" + } + }, + "node_modules/@stoplight/spectral-ruleset-migrator/node_modules/@stoplight/yaml-ast-parser": { + "version": "0.0.48", + "resolved": "https://registry.npmjs.org/@stoplight/yaml-ast-parser/-/yaml-ast-parser-0.0.48.tgz", + "integrity": "sha512-sV+51I7WYnLJnKPn2EMWgS4EUfoP4iWEbrWwbXsj0MZCB/xOK8j6+C9fntIdOM50kpx45ZLC3s6kwKivWuqvyg==", + "license": "Apache-2.0" + }, + "node_modules/@stoplight/spectral-rulesets": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/@stoplight/spectral-rulesets/-/spectral-rulesets-1.22.0.tgz", + "integrity": "sha512-l2EY2jiKKLsvnPfGy+pXC0LeGsbJzcQP5G/AojHgf+cwN//VYxW1Wvv4WKFx/CLmLxc42mJYF2juwWofjWYNIQ==", + "license": "Apache-2.0", + "dependencies": { + "@asyncapi/specs": "^6.8.0", + "@stoplight/better-ajv-errors": "1.0.3", + "@stoplight/json": "^3.17.0", + "@stoplight/spectral-core": "^1.19.4", + "@stoplight/spectral-formats": "^1.8.1", + "@stoplight/spectral-functions": "^1.9.1", + "@stoplight/spectral-runtime": "^1.1.2", + "@stoplight/types": "^13.6.0", + "@types/json-schema": "^7.0.7", + "ajv": "^8.17.1", + "ajv-formats": "~2.1.1", + "json-schema-traverse": "^1.0.0", + "leven": "3.1.0", + "lodash": "~4.17.21", + "tslib": "^2.8.1" + }, + "engines": { + "node": "^16.20 || ^18.18 || >= 20.17" + } + }, + "node_modules/@stoplight/spectral-runtime": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@stoplight/spectral-runtime/-/spectral-runtime-1.1.4.tgz", + "integrity": "sha512-YHbhX3dqW0do6DhiPSgSGQzr6yQLlWybhKwWx0cqxjMwxej3TqLv3BXMfIUYFKKUqIwH4Q2mV8rrMM8qD2N0rQ==", + "license": "Apache-2.0", + "dependencies": { + "@stoplight/json": "^3.20.1", + "@stoplight/path": "^1.3.2", + "@stoplight/types": "^13.6.0", + "abort-controller": "^3.0.0", + "lodash": "^4.17.21", + "node-fetch": "^2.7.0", + "tslib": "^2.8.1" + }, + "engines": { + "node": "^16.20 || ^18.18 || >= 20.17" + } + }, + "node_modules/@stoplight/types": { + "version": "13.20.0", + "resolved": "https://registry.npmjs.org/@stoplight/types/-/types-13.20.0.tgz", + "integrity": "sha512-2FNTv05If7ib79VPDA/r9eUet76jewXFH2y2K5vuge6SXbRHtWBhcaRmu+6QpF4/WRNoJj5XYRSwLGXDxysBGA==", + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.4", + "utility-types": "^3.10.0" + }, + "engines": { + "node": "^12.20 || >=14.13" + } + }, + "node_modules/@stoplight/yaml": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@stoplight/yaml/-/yaml-4.3.0.tgz", + "integrity": "sha512-JZlVFE6/dYpP9tQmV0/ADfn32L9uFarHWxfcRhReKUnljz1ZiUM5zpX+PH8h5CJs6lao3TuFqnPm9IJJCEkE2w==", + "license": "Apache-2.0", + "dependencies": { + "@stoplight/ordered-object-literal": "^1.0.5", + "@stoplight/types": "^14.1.1", + "@stoplight/yaml-ast-parser": "0.0.50", + "tslib": "^2.2.0" + }, + "engines": { + "node": ">=10.8" + } + }, + "node_modules/@stoplight/yaml-ast-parser": { + "version": "0.0.50", + "resolved": "https://registry.npmjs.org/@stoplight/yaml-ast-parser/-/yaml-ast-parser-0.0.50.tgz", + "integrity": "sha512-Pb6M8TDO9DtSVla9yXSTAxmo9GVEouq5P40DWXdOie69bXogZTkgvopCq+yEvTMA0F6PEvdJmbtTV3ccIp11VQ==", + "license": "Apache-2.0" + }, + "node_modules/@stoplight/yaml/node_modules/@stoplight/types": { + "version": "14.1.1", + "resolved": "https://registry.npmjs.org/@stoplight/types/-/types-14.1.1.tgz", + "integrity": "sha512-/kjtr+0t0tjKr+heVfviO9FrU/uGLc+QNX3fHJc19xsCNYqU7lVhaXxDmEID9BZTjG+/r9pK9xP/xU02XGg65g==", + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.4", + "utility-types": "^3.10.0" + }, + "engines": { + "node": "^12.20 || >=14.13" + } + }, + "node_modules/@types/es-aggregate-error": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/es-aggregate-error/-/es-aggregate-error-1.0.6.tgz", + "integrity": "sha512-qJ7LIFp06h1QE1aVxbVd+zJP2wdaugYXYfd6JxsyRMrYHaxb6itXPogW2tz+ylUJ1n1b+JF1PHyYCfYHm0dvUg==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", + "license": "MIT" + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "license": "MIT" + }, + "node_modules/@types/markdown-escape": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@types/markdown-escape/-/markdown-escape-1.1.3.tgz", + "integrity": "sha512-JIc1+s3y5ujKnt/+N+wq6s/QdL2qZ11fP79MijrVXsAAnzSxCbT2j/3prHRouJdZ2yFLN3vkP0HytfnoCczjOw==", + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "24.0.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.0.tgz", + "integrity": "sha512-yZQa2zm87aRVcqDyH5+4Hv9KYgSdgwX1rFnGvpbzMaC7YAljmhBET93TPiTd3ObwTL+gSpIzPKg5BqVxdCvxKg==", + "license": "MIT", + "dependencies": { + "undici-types": "~7.8.0" + } + }, + "node_modules/@types/sarif": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/@types/sarif/-/sarif-2.1.7.tgz", + "integrity": "sha512-kRz0VEkJqWLf1LLVN4pT1cg1Z9wAuvI6L97V3m2f5B76Tg8d413ddvLBPTEHAZJlnn4XSvu0FkZtViCQGVyrXQ==", + "license": "MIT" + }, + "node_modules/@types/stylis": { + "version": "4.2.5", + "resolved": "https://registry.npmjs.org/@types/stylis/-/stylis-4.2.5.tgz", + "integrity": "sha512-1Xve+NMN7FWjY14vLoY5tL3BVEQ/n42YLwaqJIPYhotZ9uBHt87VceMwWQpzmdEt2TNXIorIFG+YeCUUW7RInw==", + "license": "MIT" + }, + "node_modules/@types/trusted-types": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", + "license": "MIT", + "optional": true + }, + "node_modules/@types/urijs": { + "version": "1.19.25", + "resolved": "https://registry.npmjs.org/@types/urijs/-/urijs-1.19.25.tgz", + "integrity": "sha512-XOfUup9r3Y06nFAZh3WvO0rBU4OtlfPB/vgxpjg+NRdGU6CN6djdc6OEiH+PcqHCY6eFLo9Ista73uarf4gnBg==", + "license": "MIT" + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "license": "MIT", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/agent-base": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz", + "integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-draft-04": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/ajv-draft-04/-/ajv-draft-04-1.0.0.tgz", + "integrity": "sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==", + "license": "MIT", + "peerDependencies": { + "ajv": "^8.5.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/ajv-errors": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-3.0.0.tgz", + "integrity": "sha512-V3wD15YHfHz6y0KdhYFjyy9vWtEVALT9UrxfN3zqlI6dMioHnJrqOYfyPKol3oqrnCM9uwkcdCwkJ0WUcbLMTQ==", + "license": "MIT", + "peerDependencies": { + "ajv": "^8.0.1" + } + }, + "node_modules/ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "license": "MIT", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0" + }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz", + "integrity": "sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "is-array-buffer": "^3.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz", + "integrity": "sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==", + "license": "MIT", + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "is-array-buffer": "^3.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/as-table": { + "version": "1.0.55", + "resolved": "https://registry.npmjs.org/as-table/-/as-table-1.0.55.tgz", + "integrity": "sha512-xvsWESUJn0JN421Xb9MQw6AsMHRCUknCe0Wjlxvjud80mU4E6hQf1A6NzQKcYNmYw62MfzEtXc+badstZP3JpQ==", + "license": "MIT", + "dependencies": { + "printable-characters": "^1.0.42" + } + }, + "node_modules/ast-types": { + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.14.2.tgz", + "integrity": "sha512-O0yuUDnZeQDL+ncNGlJ78BiO4jnYI3bvMsD5prT0/nsgijG/LpNBIr63gTjVTNsiGkgQhiyCShTgxt8oXOrklA==", + "license": "MIT", + "dependencies": { + "tslib": "^2.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/astring": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/astring/-/astring-1.9.0.tgz", + "integrity": "sha512-LElXdjswlqjWrPpJFg1Fx4wpkOCxj1TDHlSV4PlaRxHGWko024xICaa97ZkMfs6DRKlCguiAI+rbXv5GWwXIkg==", + "license": "MIT", + "bin": { + "astring": "bin/astring" + } + }, + "node_modules/async-function": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-function/-/async-function-1.0.0.tgz", + "integrity": "sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "license": "MIT" + }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "license": "MIT", + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "license": "MIT" + }, + "node_modules/base64url": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/base64url/-/base64url-3.0.1.tgz", + "integrity": "sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A==", + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/better-ajv-errors": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/better-ajv-errors/-/better-ajv-errors-1.2.0.tgz", + "integrity": "sha512-UW+IsFycygIo7bclP9h5ugkNH8EjCSgqyFB/yQ4Hqqa1OEYDtb0uFIkYE0b6+CjkgJYVM5UKI/pJPxjYe9EZlA==", + "license": "Apache-2.0", + "dependencies": { + "@babel/code-frame": "^7.16.0", + "@humanwhocodes/momoa": "^2.0.2", + "chalk": "^4.1.2", + "jsonpointer": "^5.0.0", + "leven": "^3.1.0 < 4" + }, + "engines": { + "node": ">= 12.13.0" + }, + "peerDependencies": { + "ajv": "4.11.8 - 8" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "license": "MIT" + }, + "node_modules/builtins": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-1.0.3.tgz", + "integrity": "sha512-uYBjakWipfaO/bXI7E8rq6kpwHRZK5cNYrUv2OzZSI/FvmdMyXJ2tG9dKcjEC5YHmHpUAwsargWIZNWdxb/bnQ==", + "license": "MIT" + }, + "node_modules/bundle-name": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.0.tgz", + "integrity": "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==", + "license": "MIT", + "dependencies": { + "run-applescript": "^7.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/call-bind": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.0", + "es-define-property": "^1.0.0", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/call-me-maybe": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.2.tgz", + "integrity": "sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==", + "license": "MIT" + }, + "node_modules/camelize": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/camelize/-/camelize-1.0.1.tgz", + "integrity": "sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/classnames": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.5.1.tgz", + "integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==", + "license": "MIT" + }, + "node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/clsx": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" + }, + "node_modules/colorette": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz", + "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==", + "license": "MIT" + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/commander": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", + "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", + "license": "MIT" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "license": "MIT" + }, + "node_modules/concat-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-2.0.0.tgz", + "integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==", + "engines": [ + "node >= 6.0" + ], + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.0.2", + "typedarray": "^0.0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/core-js": { + "version": "3.43.0", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.43.0.tgz", + "integrity": "sha512-N6wEbTTZSYOY2rYAn85CuvWWkCK6QweMn7/4Nr3w+gDBeBhk/x4EJeY6FPo4QzDoJZxVTv8U7CMvgWk6pOHHqA==", + "hasInstallScript": true, + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/css-color-keywords": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/css-color-keywords/-/css-color-keywords-1.0.0.tgz", + "integrity": "sha512-FyyrDHZKEjXDpNJYvVsV960FiqQyXc/LlYmsxl2BcdMb2WPx0OGRVgTg55rPSyLSNMqP52R9r8geSp7apN3Ofg==", + "license": "ISC", + "engines": { + "node": ">=4" + } + }, + "node_modules/css-to-react-native": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/css-to-react-native/-/css-to-react-native-3.2.0.tgz", + "integrity": "sha512-e8RKaLXMOFii+02mOlqwjbD00KSEKqblnpO9e++1aXS1fPQOpS1YoqdVHBqPjHNoxeF2mimzVqawm2KCbEdtHQ==", + "license": "MIT", + "dependencies": { + "camelize": "^1.0.0", + "css-color-keywords": "^1.0.0", + "postcss-value-parser": "^4.0.2" + } + }, + "node_modules/csstype": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", + "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", + "license": "MIT" + }, + "node_modules/data-uri-to-buffer": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-2.0.2.tgz", + "integrity": "sha512-ND9qDTLc6diwj+Xe5cdAgVTbLVdXbtxTJRXRhli8Mowuaan+0EJOtdqJ0QCHNSSPyoXGx9HX2/VMnKeC34AChA==", + "license": "MIT" + }, + "node_modules/data-view-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz", + "integrity": "sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz", + "integrity": "sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/inspect-js" + } + }, + "node_modules/data-view-byte-offset": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz", + "integrity": "sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/debug": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decko": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decko/-/decko-1.2.0.tgz", + "integrity": "sha512-m8FnyHXV1QX+S1cl+KPFDIl6NMkxtKsy6+U/aYyjrOqWMuwAwYWu7ePqrsUHtDR5Y8Yk2pi/KIDSgF+vT4cPOQ==" + }, + "node_modules/default-browser": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.2.1.tgz", + "integrity": "sha512-WY/3TUME0x3KPYdRRxEJJvXRHV4PyPoUsxtZa78lwItwRQRHhd2U9xOscaT/YTf8uCXIAjeJOFBVEh/7FtD8Xg==", + "license": "MIT", + "dependencies": { + "bundle-name": "^4.1.0", + "default-browser-id": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser-id": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-5.0.0.tgz", + "integrity": "sha512-A6p/pu/6fyBcA1TRz/GqWYPViplrftcW2gZC9q79ngNCKAeR/X3gcEdXQHl4KNXV+3wgIJ1CPkJQ3IHM6lcsyA==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-lazy-prop": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", + "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "license": "MIT", + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/dependency-graph": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/dependency-graph/-/dependency-graph-0.11.0.tgz", + "integrity": "sha512-JeMq7fEshyepOWDfcfHK06N3MhyPhz++vtqWhMT5O9A3K42rdsEDpfdVqjaqaAhsw6a+ZqeDvQVtD0hFHQWrzg==", + "license": "MIT", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/diff-sequences": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/dompurify": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.2.6.tgz", + "integrity": "sha512-/2GogDQlohXPZe6D6NOgQvXLPSYBqIWMnZ8zzOhn09REE4eyAzb+Hed3jhoM9OkuaJ8P6ZGTTVWQKAi8ieIzfQ==", + "license": "(MPL-2.0 OR Apache-2.0)", + "optionalDependencies": { + "@types/trusted-types": "^2.0.7" + } + }, + "node_modules/dotenv": { + "version": "16.5.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.5.0.tgz", + "integrity": "sha512-m/C+AwOAr9/W1UOIZUo232ejMNnJAJtYQjUbHoNTBNTJSvqzzDh7vnrei3o3r3m9blf6ZoDkvcw0VmozNRFJxg==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/es-abstract": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.24.0.tgz", + "integrity": "sha512-WSzPgsdLtTcQwm4CROfS5ju2Wa1QQcVeT37jFjYzdFz1r9ahadC8B8/a4qxJxM+09F18iumCdRmlr96ZYkQvEg==", + "license": "MIT", + "dependencies": { + "array-buffer-byte-length": "^1.0.2", + "arraybuffer.prototype.slice": "^1.0.4", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "data-view-buffer": "^1.0.2", + "data-view-byte-length": "^1.0.2", + "data-view-byte-offset": "^1.0.1", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "es-set-tostringtag": "^2.1.0", + "es-to-primitive": "^1.3.0", + "function.prototype.name": "^1.1.8", + "get-intrinsic": "^1.3.0", + "get-proto": "^1.0.1", + "get-symbol-description": "^1.1.0", + "globalthis": "^1.0.4", + "gopd": "^1.2.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "internal-slot": "^1.1.0", + "is-array-buffer": "^3.0.5", + "is-callable": "^1.2.7", + "is-data-view": "^1.0.2", + "is-negative-zero": "^2.0.3", + "is-regex": "^1.2.1", + "is-set": "^2.0.3", + "is-shared-array-buffer": "^1.0.4", + "is-string": "^1.1.1", + "is-typed-array": "^1.1.15", + "is-weakref": "^1.1.1", + "math-intrinsics": "^1.1.0", + "object-inspect": "^1.13.4", + "object-keys": "^1.1.1", + "object.assign": "^4.1.7", + "own-keys": "^1.0.1", + "regexp.prototype.flags": "^1.5.4", + "safe-array-concat": "^1.1.3", + "safe-push-apply": "^1.0.0", + "safe-regex-test": "^1.1.0", + "set-proto": "^1.0.0", + "stop-iteration-iterator": "^1.1.0", + "string.prototype.trim": "^1.2.10", + "string.prototype.trimend": "^1.0.9", + "string.prototype.trimstart": "^1.0.8", + "typed-array-buffer": "^1.0.3", + "typed-array-byte-length": "^1.0.3", + "typed-array-byte-offset": "^1.0.4", + "typed-array-length": "^1.0.7", + "unbox-primitive": "^1.1.0", + "which-typed-array": "^1.1.19" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-aggregate-error": { + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/es-aggregate-error/-/es-aggregate-error-1.0.14.tgz", + "integrity": "sha512-3YxX6rVb07B5TV11AV5wsL7nQCHXNwoHPsQC8S4AmBiqYhyNCJ5BRKXkXyDJvs8QzXN20NgRtxe3dEEQD9NLHA==", + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.24.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "globalthis": "^1.0.4", + "has-property-descriptors": "^1.0.2", + "set-function-name": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-to-primitive": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.3.0.tgz", + "integrity": "sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g==", + "license": "MIT", + "dependencies": { + "is-callable": "^1.2.7", + "is-date-object": "^1.0.5", + "is-symbol": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es6-promise": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", + "integrity": "sha512-SOp9Phqvqn7jtEUxPWdWfWoLmyt2VaJ6MpvP9Comy1MceMXqE6bxvaTu4iaxpYYPzhny28Lc+M87/c2cPK6lDg==", + "license": "MIT" + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "license": "MIT" + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "license": "MIT" + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "license": "MIT" + }, + "node_modules/fast-glob": { + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-memoize": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/fast-memoize/-/fast-memoize-2.5.2.tgz", + "integrity": "sha512-Ue0LwpDYErFbmNnZSF0UH6eImUwDmogUO1jyE+JbN2gsQz/jICm1Ve7t9QT0rNSsfJt+Hs4/S3GnsDVjL4HVrw==", + "license": "MIT" + }, + "node_modules/fast-safe-stringify": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", + "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", + "license": "MIT" + }, + "node_modules/fast-uri": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.6.tgz", + "integrity": "sha512-Atfo14OibSv5wAp4VWNsFYE1AchQRTv9cBGWET4pZWHzYshFSS9NQI6I57rdKn9croWVMbYFbLhJ+yJvmZIIHw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/fast-xml-parser": { + "version": "4.5.3", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.5.3.tgz", + "integrity": "sha512-RKihhV+SHsIUGXObeVy9AXiBbFwkVk7Syp8XgwN5U3JV416+Gwp/GO9i0JYKmikykgz/UHRrrV4ROuZEo/T0ig==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT", + "dependencies": { + "strnum": "^1.1.1" + }, + "bin": { + "fxparser": "src/cli/cli.js" + } + }, + "node_modules/fastq": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", + "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-my-way-ts": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/find-my-way-ts/-/find-my-way-ts-0.1.5.tgz", + "integrity": "sha512-4GOTMrpGQVzsCH2ruUn2vmwzV/02zF4q+ybhCIrw/Rkt3L8KWcycdC6aJMctJzwN4fXD4SD5F/4B9Sksh5rE0A==", + "license": "MIT" + }, + "node_modules/for-each": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", + "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", + "license": "MIT", + "dependencies": { + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/foreach": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.6.tgz", + "integrity": "sha512-k6GAGDyqLe9JaebCsFCoudPPWfihKu8pylYXRlqP1J7ms39iPoTtk2fviNglIeQEwdh0bQeKJ01ZPyuyQvKzwg==", + "license": "MIT" + }, + "node_modules/form-data": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.3.tgz", + "integrity": "sha512-qsITQPfmvMOSAdeyZ+12I1c+CKSstAFAwu+97zrnWAbIr5u8wfsExUzCesVLC8NgHuRUqNN4Zy6UPWUTRGslcA==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "license": "ISC" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/function.prototype.name": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.8.tgz", + "integrity": "sha512-e5iwyodOHhbMr/yNrc7fDYG4qlbIvI5gajyzPnb5TCwyhjApznQh1BMFou9b30SevY43gCJKXycoCBjMbsuW0Q==", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "functions-have-names": "^1.2.3", + "hasown": "^2.0.2", + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-port-please": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/get-port-please/-/get-port-please-3.1.2.tgz", + "integrity": "sha512-Gxc29eLs1fbn6LQ4jSU4vXjlwyZhF5HsGuMAa7gqBP4Rw4yxxltyDUuF5MBclFzDTXO+ACchGQoeela4DSfzdQ==", + "license": "MIT" + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-source": { + "version": "2.0.12", + "resolved": "https://registry.npmjs.org/get-source/-/get-source-2.0.12.tgz", + "integrity": "sha512-X5+4+iD+HoSeEED+uwrQ07BOQr0kEDFMVqqpBuI+RaZBpBpHCuXxo70bjar6f0b0u/DQJsJ7ssurpP0V60Az+w==", + "license": "Unlicense", + "dependencies": { + "data-uri-to-buffer": "^2.0.0", + "source-map": "^0.6.1" + } + }, + "node_modules/get-symbol-description": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz", + "integrity": "sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/glob/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "license": "MIT", + "dependencies": { + "define-properties": "^1.2.1", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "license": "ISC" + }, + "node_modules/handlebars": { + "version": "4.7.8", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", + "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5", + "neo-async": "^2.6.2", + "source-map": "^0.6.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "handlebars": "bin/handlebars" + }, + "engines": { + "node": ">=0.4.7" + }, + "optionalDependencies": { + "uglify-js": "^3.1.4" + } + }, + "node_modules/has-bigints": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.1.0.tgz", + "integrity": "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.2.0.tgz", + "integrity": "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hpagent": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/hpagent/-/hpagent-1.2.0.tgz", + "integrity": "sha512-A91dYTeIB6NoXG+PxTQpCCDDnfHsW9kc06Lvpu1TEe9gnd6ZFeiBoRO9JvzEv6xK7EX97/dUE8g/vBMTqTS3CA==", + "license": "MIT", + "engines": { + "node": ">=14" + } + }, + "node_modules/http2-client": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/http2-client/-/http2-client-1.3.5.tgz", + "integrity": "sha512-EC2utToWl4RKfs5zd36Mxq7nzHHBuomZboI0yYL6Y0RmBgT7Sgkq4rQ0ezFTYoIsSs7Tm9SJe+o2FcAg6GBhGA==", + "license": "MIT" + }, + "node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/immer": { + "version": "9.0.21", + "resolved": "https://registry.npmjs.org/immer/-/immer-9.0.21.tgz", + "integrity": "sha512-bc4NBHqOqSfRW7POMkHd51LvClaeMXpm8dx0e8oE2GORbq5aRK7Bxl4FyzVLdGtLmvLKL7BTDBG5ACQm4HWjTA==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/immer" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/internal-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", + "integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "hasown": "^2.0.2", + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-array-buffer": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz", + "integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-async-function": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.1.1.tgz", + "integrity": "sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==", + "license": "MIT", + "dependencies": { + "async-function": "^1.0.0", + "call-bound": "^1.0.3", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bigint": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.1.0.tgz", + "integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==", + "license": "MIT", + "dependencies": { + "has-bigints": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-boolean-object": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.2.tgz", + "integrity": "sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-data-view": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.2.tgz", + "integrity": "sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz", + "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-finalizationregistry": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz", + "integrity": "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-generator-function": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.0.tgz", + "integrity": "sha512-nPUB5km40q9e8UfN/Zc24eLlzdSf9OfKByBw9CIdw4H1giPMeA0OIJvbchsCu4npfI2QcMVBsGEBHKZ7wLTWmQ==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "get-proto": "^1.0.0", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-inside-container": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", + "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", + "license": "MIT", + "dependencies": { + "is-docker": "^3.0.0" + }, + "bin": { + "is-inside-container": "cli.js" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-map": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", + "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-negative-zero": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-number-object": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz", + "integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-reference": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "license": "MIT", + "dependencies": { + "@types/estree": "*" + } + }, + "node_modules/is-regex": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", + "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-set": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz", + "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz", + "integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-string": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz", + "integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.1.1.tgz", + "integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "has-symbols": "^1.1.0", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", + "license": "MIT", + "dependencies": { + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakmap": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz", + "integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakref": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.1.tgz", + "integrity": "sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakset": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.4.tgz", + "integrity": "sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-wsl": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz", + "integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==", + "license": "MIT", + "dependencies": { + "is-inside-container": "^1.0.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "license": "MIT" + }, + "node_modules/jest-diff": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", + "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-get-type": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", + "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-matcher-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz", + "integrity": "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==", + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/js-levenshtein": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz", + "integrity": "sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsep": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jsep/-/jsep-1.4.0.tgz", + "integrity": "sha512-B7qPcEVE3NVkmSJbaYxvv4cHkVW7DQsZz13pUMrfS8z8Q/BuShN+gcTXrUlPiGqM2/t/EEaI030bpxMqY8gMlw==", + "license": "MIT", + "engines": { + "node": ">= 10.16.0" + } + }, + "node_modules/json-pointer": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/json-pointer/-/json-pointer-0.6.2.tgz", + "integrity": "sha512-vLWcKbOaXlO+jvRy4qNd+TI1QUPZzfJj1tpJ3vAXDych5XJf93ftpUKe5pKCrzyIIwgBJcOcCVRUfqQP25afBw==", + "license": "MIT", + "dependencies": { + "foreach": "^2.0.4" + } + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT" + }, + "node_modules/jsonc-parser": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.2.1.tgz", + "integrity": "sha512-o6/yDBYccGvTz1+QFevz6l6OBZ2+fMVu2JZ9CIhzsYRX4mjaK5IyX9eldUdCmga16zlgQxyrj5pt9kzuj2C02w==", + "license": "MIT" + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/jsonpath-plus": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/jsonpath-plus/-/jsonpath-plus-10.3.0.tgz", + "integrity": "sha512-8TNmfeTCk2Le33A3vRRwtuworG/L5RrgMvdjhKZxvyShO+mBu2fP50OWUjRLNtvw344DdDarFh9buFAZs5ujeA==", + "license": "MIT", + "dependencies": { + "@jsep-plugin/assignment": "^1.3.0", + "@jsep-plugin/regex": "^1.0.4", + "jsep": "^1.4.0" + }, + "bin": { + "jsonpath": "bin/jsonpath-cli.js", + "jsonpath-plus": "bin/jsonpath-cli.js" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/jsonpointer": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-5.0.1.tgz", + "integrity": "sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "license": "MIT" + }, + "node_modules/lodash.topath": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/lodash.topath/-/lodash.topath-4.5.2.tgz", + "integrity": "sha512-1/W4dM+35DwvE/iEd1M9ekewOSTlpFekhw9mhAtrwjVqUr83/ilQiyAvmg4tVX7Unkcfl1KC+i9WdaT4B6aQcg==", + "license": "MIT" + }, + "node_modules/long": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz", + "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==", + "license": "Apache-2.0" + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "license": "MIT", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/lunr": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", + "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", + "license": "MIT" + }, + "node_modules/magic-string": { + "version": "0.25.9", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", + "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", + "license": "MIT", + "dependencies": { + "sourcemap-codec": "^1.4.8" + } + }, + "node_modules/mark.js": { + "version": "8.11.1", + "resolved": "https://registry.npmjs.org/mark.js/-/mark.js-8.11.1.tgz", + "integrity": "sha512-1I+1qpDt4idfgLQG+BNWmrqku+7/2bi5nLf4YwF8y8zXvmfiTBY3PV3ZibfrjBueCByROpuBjLLFCajqkgYoLQ==", + "license": "MIT" + }, + "node_modules/markdown-escape": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/markdown-escape/-/markdown-escape-2.0.0.tgz", + "integrity": "sha512-Trz4v0+XWlwy68LJIyw3bLbsJiC8XAbRCKF9DbEtZjyndKOGVx6n+wNB0VfoRmY2LKboQLeniap3xrb6LGSJ8A==", + "license": "MIT" + }, + "node_modules/marked": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", + "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", + "license": "MIT", + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 12" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mobx": { + "version": "6.13.7", + "resolved": "https://registry.npmjs.org/mobx/-/mobx-6.13.7.tgz", + "integrity": "sha512-aChaVU/DO5aRPmk1GX8L+whocagUUpBQqoPtJk+cm7UOXUk87J4PeWCh6nNmTTIfEhiR9DI/+FnA8dln/hTK7g==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mobx" + } + }, + "node_modules/mobx-react": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/mobx-react/-/mobx-react-9.2.0.tgz", + "integrity": "sha512-dkGWCx+S0/1mfiuFfHRH8D9cplmwhxOV5CkXMp38u6rQGG2Pv3FWYztS0M7ncR6TyPRQKaTG/pnitInoYE9Vrw==", + "license": "MIT", + "dependencies": { + "mobx-react-lite": "^4.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mobx" + }, + "peerDependencies": { + "mobx": "^6.9.0", + "react": "^16.8.0 || ^17 || ^18 || ^19" + }, + "peerDependenciesMeta": { + "react-dom": { + "optional": true + }, + "react-native": { + "optional": true + } + } + }, + "node_modules/mobx-react-lite": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mobx-react-lite/-/mobx-react-lite-4.1.0.tgz", + "integrity": "sha512-QEP10dpHHBeQNv1pks3WnHRCem2Zp636lq54M2nKO2Sarr13pL4u6diQXf65yzXUn0mkk18SyIDCm9UOJYTi1w==", + "license": "MIT", + "dependencies": { + "use-sync-external-store": "^1.4.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mobx" + }, + "peerDependencies": { + "mobx": "^6.9.0", + "react": "^16.8.0 || ^17 || ^18 || ^19" + }, + "peerDependenciesMeta": { + "react-dom": { + "optional": true + }, + "react-native": { + "optional": true + } + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "license": "MIT" + }, + "node_modules/nimma": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/nimma/-/nimma-0.2.3.tgz", + "integrity": "sha512-1ZOI8J+1PKKGceo/5CT5GfQOG6H8I2BencSK06YarZ2wXwH37BSSUWldqJmMJYA5JfqDqffxDXynt6f11AyKcA==", + "license": "Apache-2.0", + "dependencies": { + "@jsep-plugin/regex": "^1.0.1", + "@jsep-plugin/ternary": "^1.0.2", + "astring": "^1.8.1", + "jsep": "^1.2.0" + }, + "engines": { + "node": "^12.20 || >=14.13" + }, + "optionalDependencies": { + "jsonpath-plus": "^6.0.1 || ^10.1.0", + "lodash.topath": "^4.5.2" + } + }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-fetch-h2": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/node-fetch-h2/-/node-fetch-h2-2.3.0.tgz", + "integrity": "sha512-ofRW94Ab0T4AOh5Fk8t0h8OBWrmjb0SSB20xh1H8YnPV9EJ+f5AMoYSUQ2zgJ4Iq2HAK0I2l5/Nequ8YzFS3Hg==", + "license": "MIT", + "dependencies": { + "http2-client": "^1.2.5" + }, + "engines": { + "node": "4.x || >=6.0.0" + } + }, + "node_modules/node-readfiles": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/node-readfiles/-/node-readfiles-0.2.0.tgz", + "integrity": "sha512-SU00ZarexNlE4Rjdm83vglt5Y9yiQ+XI1XpflWlb7q7UTN1JUItm69xMeiQCTxtTfnzt+83T8Cx+vI2ED++VDA==", + "license": "MIT", + "dependencies": { + "es6-promise": "^3.2.1" + } + }, + "node_modules/node-sarif-builder": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/node-sarif-builder/-/node-sarif-builder-2.0.3.tgz", + "integrity": "sha512-Pzr3rol8fvhG/oJjIq2NTVB0vmdNNlz22FENhhPojYRZ4/ee08CfK4YuKmuL54V9MLhI1kpzxfOJ/63LzmZzDg==", + "license": "MIT", + "dependencies": { + "@types/sarif": "^2.1.4", + "fs-extra": "^10.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/oas-kit-common": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/oas-kit-common/-/oas-kit-common-1.0.8.tgz", + "integrity": "sha512-pJTS2+T0oGIwgjGpw7sIRU8RQMcUoKCDWFLdBqKB2BNmGpbBMH2sdqAaOXUg8OzonZHU0L7vfJu1mJFEiYDWOQ==", + "license": "BSD-3-Clause", + "dependencies": { + "fast-safe-stringify": "^2.0.7" + } + }, + "node_modules/oas-linter": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/oas-linter/-/oas-linter-3.2.2.tgz", + "integrity": "sha512-KEGjPDVoU5K6swgo9hJVA/qYGlwfbFx+Kg2QB/kd7rzV5N8N5Mg6PlsoCMohVnQmo+pzJap/F610qTodKzecGQ==", + "license": "BSD-3-Clause", + "dependencies": { + "@exodus/schemasafe": "^1.0.0-rc.2", + "should": "^13.2.1", + "yaml": "^1.10.0" + }, + "funding": { + "url": "https://github.com/Mermade/oas-kit?sponsor=1" + } + }, + "node_modules/oas-linter/node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "license": "ISC", + "engines": { + "node": ">= 6" + } + }, + "node_modules/oas-resolver": { + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/oas-resolver/-/oas-resolver-2.5.6.tgz", + "integrity": "sha512-Yx5PWQNZomfEhPPOphFbZKi9W93CocQj18NlD2Pa4GWZzdZpSJvYwoiuurRI7m3SpcChrnO08hkuQDL3FGsVFQ==", + "license": "BSD-3-Clause", + "dependencies": { + "node-fetch-h2": "^2.3.0", + "oas-kit-common": "^1.0.8", + "reftools": "^1.1.9", + "yaml": "^1.10.0", + "yargs": "^17.0.1" + }, + "bin": { + "resolve": "resolve.js" + }, + "funding": { + "url": "https://github.com/Mermade/oas-kit?sponsor=1" + } + }, + "node_modules/oas-resolver/node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "license": "ISC", + "engines": { + "node": ">= 6" + } + }, + "node_modules/oas-schema-walker": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/oas-schema-walker/-/oas-schema-walker-1.1.5.tgz", + "integrity": "sha512-2yucenq1a9YPmeNExoUa9Qwrt9RFkjqaMAA1X+U7sbb0AqBeTIdMHky9SQQ6iN94bO5NW0W4TRYXerG+BdAvAQ==", + "license": "BSD-3-Clause", + "funding": { + "url": "https://github.com/Mermade/oas-kit?sponsor=1" + } + }, + "node_modules/oas-validator": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/oas-validator/-/oas-validator-5.0.8.tgz", + "integrity": "sha512-cu20/HE5N5HKqVygs3dt94eYJfBi0TsZvPVXDhbXQHiEityDN+RROTleefoKRKKJ9dFAF2JBkDHgvWj0sjKGmw==", + "license": "BSD-3-Clause", + "dependencies": { + "call-me-maybe": "^1.0.1", + "oas-kit-common": "^1.0.8", + "oas-linter": "^3.2.2", + "oas-resolver": "^2.5.6", + "oas-schema-walker": "^1.1.5", + "reftools": "^1.1.9", + "should": "^13.2.1", + "yaml": "^1.10.0" + }, + "funding": { + "url": "https://github.com/Mermade/oas-kit?sponsor=1" + } + }, + "node_modules/oas-validator/node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "license": "ISC", + "engines": { + "node": ">= 6" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.7.tgz", + "integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0", + "has-symbols": "^1.1.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/open": { + "version": "10.1.2", + "resolved": "https://registry.npmjs.org/open/-/open-10.1.2.tgz", + "integrity": "sha512-cxN6aIDPz6rm8hbebcP7vrQNhvRcveZoJU72Y7vskh4oIm+BZwBECnx5nTmrlres1Qapvx27Qo1Auukpf8PKXw==", + "license": "MIT", + "dependencies": { + "default-browser": "^5.2.1", + "define-lazy-prop": "^3.0.0", + "is-inside-container": "^1.0.0", + "is-wsl": "^3.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/openapi-sampler": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/openapi-sampler/-/openapi-sampler-1.6.1.tgz", + "integrity": "sha512-s1cIatOqrrhSj2tmJ4abFYZQK6l5v+V4toO5q1Pa0DyN8mtyqy2I+Qrj5W9vOELEtybIMQs/TBZGVO/DtTFK8w==", + "license": "MIT", + "dependencies": { + "@types/json-schema": "^7.0.7", + "fast-xml-parser": "^4.5.0", + "json-pointer": "0.6.2" + } + }, + "node_modules/outdent": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/outdent/-/outdent-0.8.0.tgz", + "integrity": "sha512-KiOAIsdpUTcAXuykya5fnVVT+/5uS0Q1mrkRHcF89tpieSmY33O/tmc54CqwA+bfhbtEfZUNLHaPUiB9X3jt1A==", + "license": "MIT" + }, + "node_modules/own-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.1.tgz", + "integrity": "sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==", + "license": "MIT", + "dependencies": { + "get-intrinsic": "^1.2.6", + "object-keys": "^1.1.1", + "safe-push-apply": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/path-browserify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", + "license": "MIT" + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "license": "MIT" + }, + "node_modules/perfect-scrollbar": { + "version": "1.5.6", + "resolved": "https://registry.npmjs.org/perfect-scrollbar/-/perfect-scrollbar-1.5.6.tgz", + "integrity": "sha512-rixgxw3SxyJbCaSpo1n35A/fwI1r2rdwMKOTCg/AcG+xOEyZcE8UHVjpZMFCVImzsFoCZeJTT+M/rdEIQYO2nw==", + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pluralize": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", + "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/polished": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/polished/-/polished-4.3.1.tgz", + "integrity": "sha512-OBatVyC/N7SCW/FaDHrSd+vn0o5cS855TOmYi4OkdWUMSJCET/xip//ch8xGUvtr3i44X9LVyWwQlRMTN3pwSA==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.17.8" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/pony-cause": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pony-cause/-/pony-cause-1.1.1.tgz", + "integrity": "sha512-PxkIc/2ZpLiEzQXu5YRDOUgBlfGYBY8156HY5ZcRAwwonMk5W/MrJP2LLkG/hF7GEQzaHo2aS7ho6ZLCOvf+6g==", + "license": "0BSD", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/possible-typed-array-names": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", + "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/postcss": { + "version": "8.4.49", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.49.tgz", + "integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.7", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postcss-value-parser": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", + "license": "MIT" + }, + "node_modules/prettier": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "license": "MIT", + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/pretty-format": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "license": "MIT", + "dependencies": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/printable-characters": { + "version": "1.0.42", + "resolved": "https://registry.npmjs.org/printable-characters/-/printable-characters-1.0.42.tgz", + "integrity": "sha512-dKp+C4iXWK4vVYZmYSd0KBH5F/h1HoZRsbJ82AVKRO3PEo8L4lBS/vLwhVtpwwuYcoIsVY+1JYKR268yn480uQ==", + "license": "Unlicense" + }, + "node_modules/prismjs": { + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.30.0.tgz", + "integrity": "sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, + "node_modules/prop-types/node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "license": "MIT" + }, + "node_modules/protobufjs": { + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.5.3.tgz", + "integrity": "sha512-sildjKwVqOI2kmFDiXQ6aEB0fjYTafpEvIBs8tOR8qI4spuL9OPROLVu2qZqi/xgCfsHIwVqlaF8JBjWFHnKbw==", + "hasInstallScript": true, + "license": "BSD-3-Clause", + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/node": ">=13.7.0", + "long": "^5.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "license": "MIT", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/react": { + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/react/-/react-19.1.0.tgz", + "integrity": "sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.1.0.tgz", + "integrity": "sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g==", + "license": "MIT", + "dependencies": { + "scheduler": "^0.26.0" + }, + "peerDependencies": { + "react": "^19.1.0" + } + }, + "node_modules/react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "license": "MIT" + }, + "node_modules/react-tabs": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/react-tabs/-/react-tabs-6.1.0.tgz", + "integrity": "sha512-6QtbTRDKM+jA/MZTTefvigNxo0zz+gnBTVFw2CFVvq+f2BuH0nF0vDLNClL045nuTAdOoK/IL1vTP0ZLX0DAyQ==", + "license": "MIT", + "dependencies": { + "clsx": "^2.0.0", + "prop-types": "^15.5.0" + }, + "peerDependencies": { + "react": "^18.0.0 || ^19.0.0" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/redoc": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/redoc/-/redoc-2.5.0.tgz", + "integrity": "sha512-NpYsOZ1PD9qFdjbLVBZJWptqE+4Y6TkUuvEOqPUmoH7AKOmPcE+hYjotLxQNTqVoWL4z0T2uxILmcc8JGDci+Q==", + "license": "MIT", + "dependencies": { + "@redocly/openapi-core": "^1.4.0", + "classnames": "^2.3.2", + "decko": "^1.2.0", + "dompurify": "^3.2.4", + "eventemitter3": "^5.0.1", + "json-pointer": "^0.6.2", + "lunr": "^2.3.9", + "mark.js": "^8.11.1", + "marked": "^4.3.0", + "mobx-react": "^9.1.1", + "openapi-sampler": "^1.5.0", + "path-browserify": "^1.0.1", + "perfect-scrollbar": "^1.5.5", + "polished": "^4.2.2", + "prismjs": "^1.29.0", + "prop-types": "^15.8.1", + "react-tabs": "^6.0.2", + "slugify": "~1.4.7", + "stickyfill": "^1.1.1", + "swagger2openapi": "^7.0.8", + "url-template": "^2.0.8" + }, + "engines": { + "node": ">=6.9", + "npm": ">=3.0.0" + }, + "peerDependencies": { + "core-js": "^3.1.4", + "mobx": "^6.0.4", + "react": "^16.8.4 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.8.4 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "styled-components": "^4.1.1 || ^5.1.1 || ^6.0.5" + } + }, + "node_modules/reflect.getprototypeof": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", + "integrity": "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.7", + "get-proto": "^1.0.1", + "which-builtin-type": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/reftools": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/reftools/-/reftools-1.1.9.tgz", + "integrity": "sha512-OVede/NQE13xBQ+ob5CKd5KyeJYU2YInb1bmV4nRoOfquZPkAkxuOXicSe1PvqIuZZ4kD13sPKBbR7UFDmli6w==", + "license": "BSD-3-Clause", + "funding": { + "url": "https://github.com/Mermade/oas-kit?sponsor=1" + } + }, + "node_modules/regexp.prototype.flags": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", + "integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "set-function-name": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/reserved": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/reserved/-/reserved-0.1.2.tgz", + "integrity": "sha512-/qO54MWj5L8WCBP9/UNe2iefJc+L9yETbH32xO/ft/EYPOTCR5k+azvDUgdCOKwZH8hXwPd0b8XBL78Nn2U69g==", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/resolve": { + "version": "1.22.10", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", + "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", + "license": "MIT", + "dependencies": { + "is-core-module": "^2.16.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rollup": { + "version": "2.79.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.2.tgz", + "integrity": "sha512-fS6iqSPZDs3dr/y7Od6y5nha8dW1YnbgtsyotCVvoFGKbERG++CVRFv1meyGDE1SNItQA8BrnCw7ScdAhRJ3XQ==", + "license": "MIT", + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=10.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/run-applescript": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.0.0.tgz", + "integrity": "sha512-9by4Ij99JUr/MCFBUkDKLWK3G9HVXmabKz9U5MlIAIuvuzkiOicRYs8XJLxX+xahD+mLiiCYDqF9dKAgtzKP1A==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-array-concat": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.3.tgz", + "integrity": "sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q==", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "has-symbols": "^1.1.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safe-push-apply": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-push-apply/-/safe-push-apply-1.0.0.tgz", + "integrity": "sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-regex-test": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz", + "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-regex": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-stable-stringify": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-1.1.1.tgz", + "integrity": "sha512-ERq4hUjKDbJfE4+XtZLFPCDi8Vb1JqaxAPTxWFLBx8XcAlf9Bda/ZJdVezs/NAfsMQScyIlUMx+Yeu7P7rx5jw==", + "license": "MIT" + }, + "node_modules/scheduler": { + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.26.0.tgz", + "integrity": "sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/set-cookie-parser": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.1.tgz", + "integrity": "sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ==", + "license": "MIT" + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-function-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-proto": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/set-proto/-/set-proto-1.0.0.tgz", + "integrity": "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/shallowequal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/shallowequal/-/shallowequal-1.1.0.tgz", + "integrity": "sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==", + "license": "MIT" + }, + "node_modules/should": { + "version": "13.2.3", + "resolved": "https://registry.npmjs.org/should/-/should-13.2.3.tgz", + "integrity": "sha512-ggLesLtu2xp+ZxI+ysJTmNjh2U0TsC+rQ/pfED9bUZZ4DKefP27D+7YJVVTvKsmjLpIi9jAa7itwDGkDDmt1GQ==", + "license": "MIT", + "dependencies": { + "should-equal": "^2.0.0", + "should-format": "^3.0.3", + "should-type": "^1.4.0", + "should-type-adaptors": "^1.0.1", + "should-util": "^1.0.0" + } + }, + "node_modules/should-equal": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/should-equal/-/should-equal-2.0.0.tgz", + "integrity": "sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==", + "license": "MIT", + "dependencies": { + "should-type": "^1.4.0" + } + }, + "node_modules/should-format": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/should-format/-/should-format-3.0.3.tgz", + "integrity": "sha512-hZ58adtulAk0gKtua7QxevgUaXTTXxIi8t41L3zo9AHvjXO1/7sdLECuHeIN2SRtYXpNkmhoUP2pdeWgricQ+Q==", + "license": "MIT", + "dependencies": { + "should-type": "^1.3.0", + "should-type-adaptors": "^1.0.1" + } + }, + "node_modules/should-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/should-type/-/should-type-1.4.0.tgz", + "integrity": "sha512-MdAsTu3n25yDbIe1NeN69G4n6mUnJGtSJHygX3+oN0ZbO3DTiATnf7XnYJdGT42JCXurTb1JI0qOBR65shvhPQ==", + "license": "MIT" + }, + "node_modules/should-type-adaptors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz", + "integrity": "sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA==", + "license": "MIT", + "dependencies": { + "should-type": "^1.3.0", + "should-util": "^1.0.0" + } + }, + "node_modules/should-util": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/should-util/-/should-util-1.0.1.tgz", + "integrity": "sha512-oXF8tfxx5cDk8r2kYqlkUJzZpDBqVY/II2WhvU0n9Y3XYvAYRmeaf1PvvIvTgPnv4KJ+ES5M0PyDq5Jp+Ygy2g==", + "license": "MIT" + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/simple-eval": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-eval/-/simple-eval-1.0.1.tgz", + "integrity": "sha512-LH7FpTAkeD+y5xQC4fzS+tFtaNlvt3Ib1zKzvhjv/Y+cioV4zIuw4IZr2yhRLu67CWL7FR9/6KXKnjRoZTvGGQ==", + "license": "MIT", + "dependencies": { + "jsep": "^1.3.6" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/simple-websocket": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/simple-websocket/-/simple-websocket-9.1.0.tgz", + "integrity": "sha512-8MJPnjRN6A8UCp1I+H/dSFyjwJhp6wta4hsVRhjf8w9qBHRzxYt14RaOcjvQnhD1N4yKOddEjflwMnQM4VtXjQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "debug": "^4.3.1", + "queue-microtask": "^1.2.2", + "randombytes": "^2.1.0", + "readable-stream": "^3.6.0", + "ws": "^7.4.2" + } + }, + "node_modules/slugify": { + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/slugify/-/slugify-1.4.7.tgz", + "integrity": "sha512-tf+h5W1IrjNm/9rKKj0JU2MDMruiopx0jjVA5zCdBtcGjfp0+c5rHw/zADLC3IeKlGHtVbHtpfzvYA0OYT+HKg==", + "license": "MIT", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sourcemap-codec": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", + "deprecated": "Please use @jridgewell/sourcemap-codec instead", + "license": "MIT" + }, + "node_modules/stacktracey": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/stacktracey/-/stacktracey-2.1.8.tgz", + "integrity": "sha512-Kpij9riA+UNg7TnphqjH7/CzctQ/owJGNbFkfEeve4Z4uxT5+JapVLFXcsurIfN34gnTWZNJ/f7NMG0E8JDzTw==", + "license": "Unlicense", + "dependencies": { + "as-table": "^1.0.36", + "get-source": "^2.0.12" + } + }, + "node_modules/stickyfill": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stickyfill/-/stickyfill-1.1.1.tgz", + "integrity": "sha512-GCp7vHAfpao+Qh/3Flh9DXEJ/qSi0KJwJw6zYlZOtRYXWUIpMM6mC2rIep/dK8RQqwW0KxGJIllmjPIBOGN8AA==" + }, + "node_modules/stop-iteration-iterator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz", + "integrity": "sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "internal-slot": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string.prototype.trim": { + "version": "1.2.10", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.10.tgz", + "integrity": "sha512-Rs66F0P/1kedk5lyYyH9uBzuiI/kNRmwJAR9quK6VOtIpZ2G+hMZd+HQbbv25MgCA6gEffoMZYxlTod4WcdrKA==", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-data-property": "^1.1.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-object-atoms": "^1.0.0", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.9.tgz", + "integrity": "sha512-G7Ok5C6E/j4SGfyLCloXTrngQIQU3PWtXGst3yM7Bea9FRURf1S42ZHlZZtsNque2FN2PoUhfZXYLNWwEr4dLQ==", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strnum": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/strnum/-/strnum-1.1.2.tgz", + "integrity": "sha512-vrN+B7DBIoTTZjnPNewwhx6cBA/H+IS7rfW68n7XxC1y7uoiGQBxaKzqucGUgavX15dJgiGztLJ8vxuEzwqBdA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT" + }, + "node_modules/styled-components": { + "version": "6.1.18", + "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-6.1.18.tgz", + "integrity": "sha512-Mvf3gJFzZCkhjY2Y/Fx9z1m3dxbza0uI9H1CbNZm/jSHCojzJhQ0R7bByrlFJINnMzz/gPulpoFFGymNwrsMcw==", + "license": "MIT", + "dependencies": { + "@emotion/is-prop-valid": "1.2.2", + "@emotion/unitless": "0.8.1", + "@types/stylis": "4.2.5", + "css-to-react-native": "3.2.0", + "csstype": "3.1.3", + "postcss": "8.4.49", + "shallowequal": "1.1.0", + "stylis": "4.3.2", + "tslib": "2.6.2" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/styled-components" + }, + "peerDependencies": { + "react": ">= 16.8.0", + "react-dom": ">= 16.8.0" + } + }, + "node_modules/styled-components/node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "license": "0BSD" + }, + "node_modules/stylis": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.3.2.tgz", + "integrity": "sha512-bhtUjWd/z6ltJiQwg0dUfxEJ+W+jdqQd8TbWLWyeIJHlnsqmGLRFFd8e5mA0AZi/zx90smXRlN66YMTcaSFifg==", + "license": "MIT" + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/swagger2openapi": { + "version": "7.0.8", + "resolved": "https://registry.npmjs.org/swagger2openapi/-/swagger2openapi-7.0.8.tgz", + "integrity": "sha512-upi/0ZGkYgEcLeGieoz8gT74oWHA0E7JivX7aN9mAf+Tc7BQoRBvnIGHoPDw+f9TXTW4s6kGYCZJtauP6OYp7g==", + "license": "BSD-3-Clause", + "dependencies": { + "call-me-maybe": "^1.0.1", + "node-fetch": "^2.6.1", + "node-fetch-h2": "^2.3.0", + "node-readfiles": "^0.2.0", + "oas-kit-common": "^1.0.8", + "oas-resolver": "^2.5.6", + "oas-schema-walker": "^1.1.5", + "oas-validator": "^5.0.8", + "reftools": "^1.1.9", + "yaml": "^1.10.0", + "yargs": "^17.0.1" + }, + "bin": { + "boast": "boast.js", + "oas-validate": "oas-validate.js", + "swagger2openapi": "swagger2openapi.js" + }, + "funding": { + "url": "https://github.com/Mermade/oas-kit?sponsor=1" + } + }, + "node_modules/swagger2openapi/node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "license": "ISC", + "engines": { + "node": ">= 6" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "license": "MIT" + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "license": "MIT" + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, + "node_modules/typed-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz", + "integrity": "sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-byte-offset": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.4.tgz", + "integrity": "sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ==", + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.15", + "reflect.getprototypeof": "^1.0.9" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-length": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.7.tgz", + "integrity": "sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "is-typed-array": "^1.1.13", + "possible-typed-array-names": "^1.0.0", + "reflect.getprototypeof": "^1.0.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", + "license": "MIT" + }, + "node_modules/uglify-js": { + "version": "3.19.3", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz", + "integrity": "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==", + "license": "BSD-2-Clause", + "optional": true, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/unbox-primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", + "integrity": "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-bigints": "^1.0.2", + "has-symbols": "^1.1.0", + "which-boxed-primitive": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/undici": { + "version": "6.21.3", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.21.3.tgz", + "integrity": "sha512-gBLkYIlEnSp8pFbT64yFgGE6UIB9tAkhukC23PmMDCe5Nd+cRqKxSjw5y54MK2AZMgZfJWMaNE4nYUHgi1XEOw==", + "license": "MIT", + "engines": { + "node": ">=18.17" + } + }, + "node_modules/undici-types": { + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz", + "integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==", + "license": "MIT" + }, + "node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/uri-js-replace": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/uri-js-replace/-/uri-js-replace-1.0.1.tgz", + "integrity": "sha512-W+C9NWNLFOoBI2QWDp4UT9pv65r2w5Cx+3sTYFvtMdDBxkKt1syCqsUdSFAChbEe1uK5TfS04wt/nGwmaeIQ0g==", + "license": "MIT" + }, + "node_modules/urijs": { + "version": "1.19.11", + "resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.11.tgz", + "integrity": "sha512-HXgFDgDommxn5/bIv0cnQZsPhHDA90NPHD6+c/v21U5+Sx5hoP8+dP9IZXBU1gIfvdRfhG8cel9QNPeionfcCQ==", + "license": "MIT" + }, + "node_modules/url-template": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/url-template/-/url-template-2.0.8.tgz", + "integrity": "sha512-XdVKMF4SJ0nP/O7XIPB0JwAEuT9lDIYnNsK8yGVe43y0AWoKeJNdv3ZNWh7ksJ6KqQFjOO6ox/VEitLnaVNufw==", + "license": "BSD" + }, + "node_modules/use-sync-external-store": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.5.0.tgz", + "integrity": "sha512-Rb46I4cGGVBmjamjphe8L/UnvJD+uPPtTkNvX5mZgqdbavhI4EbgIWJiIHXJ8bc/i9EQGPRh4DwEURJ552Do0A==", + "license": "MIT", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, + "node_modules/utility-types": { + "version": "3.11.0", + "resolved": "https://registry.npmjs.org/utility-types/-/utility-types-3.11.0.tgz", + "integrity": "sha512-6Z7Ma2aVEWisaL6TvBCy7P8rm2LQoPv6dJ7ecIaIixHcwfbJ0x7mWdbcwlIM5IGQxPZSFYeqRCqlOOeKoJYMkw==", + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/validate-npm-package-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz", + "integrity": "sha512-M6w37eVCMMouJ9V/sdPGnC5H4uDr73/+xdq0FBLO3TFFX1+7wiUY6Es328NN+y43tmY+doUdN9g9J21vqB7iLw==", + "license": "ISC", + "dependencies": { + "builtins": "^1.0.3" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "license": "BSD-2-Clause" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/which-boxed-primitive": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz", + "integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==", + "license": "MIT", + "dependencies": { + "is-bigint": "^1.1.0", + "is-boolean-object": "^1.2.1", + "is-number-object": "^1.1.1", + "is-string": "^1.1.1", + "is-symbol": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-builtin-type": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.2.1.tgz", + "integrity": "sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "function.prototype.name": "^1.1.6", + "has-tostringtag": "^1.0.2", + "is-async-function": "^2.0.0", + "is-date-object": "^1.1.0", + "is-finalizationregistry": "^1.1.0", + "is-generator-function": "^1.0.10", + "is-regex": "^1.2.1", + "is-weakref": "^1.0.2", + "isarray": "^2.0.5", + "which-boxed-primitive": "^1.1.0", + "which-collection": "^1.0.2", + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-collection": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.2.tgz", + "integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==", + "license": "MIT", + "dependencies": { + "is-map": "^2.0.3", + "is-set": "^2.0.3", + "is-weakmap": "^2.0.2", + "is-weakset": "^2.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.19", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.19.tgz", + "integrity": "sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw==", + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", + "license": "MIT" + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + }, + "node_modules/ws": { + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "license": "MIT", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yaml": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.0.tgz", + "integrity": "sha512-4lLa/EcQCB0cJkyts+FpIRx5G/llPxfP6VQU5KByHEhLxY3IJCH0f0Hy1MHI8sClTvsIb8qwRJ6R/ZdlDJ/leQ==", + "license": "ISC", + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14.6" + } + }, + "node_modules/yaml-ast-parser": { + "version": "0.0.43", + "resolved": "https://registry.npmjs.org/yaml-ast-parser/-/yaml-ast-parser-0.0.43.tgz", + "integrity": "sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A==", + "license": "Apache-2.0" + }, + "node_modules/yargs": { + "version": "17.0.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.0.1.tgz", + "integrity": "sha512-xBBulfCc8Y6gLFcrPvtqKz9hz8SO0l1Ni8GgDekvBX2ro0HRQImDGnikfc33cgzcYUSncapnNcZDjVFIH3f6KQ==", + "license": "MIT", + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "license": "ISC", + "engines": { + "node": ">=10" + } + } + } +} diff --git a/docs/examples/package.json b/docs/examples/package.json new file mode 100644 index 0000000000..32c28c5450 --- /dev/null +++ b/docs/examples/package.json @@ -0,0 +1,11 @@ +{ + "scripts": { + "transform-to-openapi": "npm run transform-to-openapi --prefix compiler --" + }, + "dependencies": { + "@elastic/request-converter": "^9.1.1", + "@redocly/cli": "^1.34.3", + "@stoplight/spectral-cli": "^6.14.2", + "yaml": "^2.8.0" + } +} diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 2ec375ea6a..5cb60e3aa1 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -83,6 +83,26 @@ { "lang": "Console", "source": "GET /_async_search/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\n" + }, + { + "lang": "Python", + "source": "resp = client.async_search.get(\n id=\"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.asyncSearch.get({\n id: \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.async_search.get(\n id: \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->asyncSearch()->get([\n \"id\" => \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_async_search/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\"" } ] }, @@ -123,6 +143,26 @@ { "lang": "Console", "source": "DELETE /_async_search/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\n" + }, + { + "lang": "Python", + "source": "resp = client.async_search.delete(\n id=\"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.asyncSearch.delete({\n id: \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.async_search.delete(\n id: \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->asyncSearch()->delete([\n \"id\" => \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_async_search/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\"" } ] } @@ -192,6 +232,26 @@ { "lang": "Console", "source": "GET /_async_search/status/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\n" + }, + { + "lang": "Python", + "source": "resp = client.async_search.status(\n id=\"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.asyncSearch.status({\n id: \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.async_search.status(\n id: \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->asyncSearch()->status([\n \"id\" => \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_async_search/status/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\"" } ] } @@ -348,6 +408,26 @@ { "lang": "Console", "source": "POST /sales*/_async_search?size=0\n{\n \"sort\": [\n { \"date\": { \"order\": \"asc\" } }\n ],\n \"aggs\": {\n \"sale_date\": {\n \"date_histogram\": {\n \"field\": \"date\",\n \"calendar_interval\": \"1d\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.async_search.submit(\n index=\"sales*\",\n size=\"0\",\n sort=[\n {\n \"date\": {\n \"order\": \"asc\"\n }\n }\n ],\n aggs={\n \"sale_date\": {\n \"date_histogram\": {\n \"field\": \"date\",\n \"calendar_interval\": \"1d\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.asyncSearch.submit({\n index: \"sales*\",\n size: 0,\n sort: [\n {\n date: {\n order: \"asc\",\n },\n },\n ],\n aggs: {\n sale_date: {\n date_histogram: {\n field: \"date\",\n calendar_interval: \"1d\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.async_search.submit(\n index: \"sales*\",\n size: \"0\",\n body: {\n \"sort\": [\n {\n \"date\": {\n \"order\": \"asc\"\n }\n }\n ],\n \"aggs\": {\n \"sale_date\": {\n \"date_histogram\": {\n \"field\": \"date\",\n \"calendar_interval\": \"1d\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->asyncSearch()->submit([\n \"index\" => \"sales*\",\n \"size\" => \"0\",\n \"body\" => [\n \"sort\" => array(\n [\n \"date\" => [\n \"order\" => \"asc\",\n ],\n ],\n ),\n \"aggs\" => [\n \"sale_date\" => [\n \"date_histogram\" => [\n \"field\" => \"date\",\n \"calendar_interval\" => \"1d\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"sort\":[{\"date\":{\"order\":\"asc\"}}],\"aggs\":{\"sale_date\":{\"date_histogram\":{\"field\":\"date\",\"calendar_interval\":\"1d\"}}}}' \"$ELASTICSEARCH_URL/sales*/_async_search?size=0\"" } ] } @@ -507,6 +587,26 @@ { "lang": "Console", "source": "POST /sales*/_async_search?size=0\n{\n \"sort\": [\n { \"date\": { \"order\": \"asc\" } }\n ],\n \"aggs\": {\n \"sale_date\": {\n \"date_histogram\": {\n \"field\": \"date\",\n \"calendar_interval\": \"1d\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.async_search.submit(\n index=\"sales*\",\n size=\"0\",\n sort=[\n {\n \"date\": {\n \"order\": \"asc\"\n }\n }\n ],\n aggs={\n \"sale_date\": {\n \"date_histogram\": {\n \"field\": \"date\",\n \"calendar_interval\": \"1d\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.asyncSearch.submit({\n index: \"sales*\",\n size: 0,\n sort: [\n {\n date: {\n order: \"asc\",\n },\n },\n ],\n aggs: {\n sale_date: {\n date_histogram: {\n field: \"date\",\n calendar_interval: \"1d\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.async_search.submit(\n index: \"sales*\",\n size: \"0\",\n body: {\n \"sort\": [\n {\n \"date\": {\n \"order\": \"asc\"\n }\n }\n ],\n \"aggs\": {\n \"sale_date\": {\n \"date_histogram\": {\n \"field\": \"date\",\n \"calendar_interval\": \"1d\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->asyncSearch()->submit([\n \"index\" => \"sales*\",\n \"size\" => \"0\",\n \"body\" => [\n \"sort\" => array(\n [\n \"date\" => [\n \"order\" => \"asc\",\n ],\n ],\n ),\n \"aggs\" => [\n \"sale_date\" => [\n \"date_histogram\" => [\n \"field\" => \"date\",\n \"calendar_interval\" => \"1d\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"sort\":[{\"date\":{\"order\":\"asc\"}}],\"aggs\":{\"sale_date\":{\"date_histogram\":{\"field\":\"date\",\"calendar_interval\":\"1d\"}}}}' \"$ELASTICSEARCH_URL/sales*/_async_search?size=0\"" } ] } @@ -569,6 +669,26 @@ { "lang": "Console", "source": "GET /_autoscaling/policy/my_autoscaling_policy\n" + }, + { + "lang": "Python", + "source": "resp = client.autoscaling.get_autoscaling_policy(\n name=\"my_autoscaling_policy\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.autoscaling.getAutoscalingPolicy({\n name: \"my_autoscaling_policy\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.autoscaling.get_autoscaling_policy(\n name: \"my_autoscaling_policy\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->autoscaling()->getAutoscalingPolicy([\n \"name\" => \"my_autoscaling_policy\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_autoscaling/policy/my_autoscaling_policy\"" } ] }, @@ -659,6 +779,26 @@ { "lang": "Console", "source": "PUT /_autoscaling/policy/\n{\n \"roles\": [],\n \"deciders\": {\n \"fixed\": {\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.autoscaling.put_autoscaling_policy(\n name=\"\",\n policy={\n \"roles\": [],\n \"deciders\": {\n \"fixed\": {}\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.autoscaling.putAutoscalingPolicy({\n name: \"\",\n policy: {\n roles: [],\n deciders: {\n fixed: {},\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.autoscaling.put_autoscaling_policy(\n name: \"\",\n body: {\n \"roles\": [],\n \"deciders\": {\n \"fixed\": {}\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->autoscaling()->putAutoscalingPolicy([\n \"name\" => \"\",\n \"body\" => [\n \"roles\" => array(\n ),\n \"deciders\" => [\n \"fixed\" => new ArrayObject([]),\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"roles\":[],\"deciders\":{\"fixed\":{}}}' \"$ELASTICSEARCH_URL/_autoscaling/policy/\"" } ] }, @@ -729,6 +869,26 @@ { "lang": "Console", "source": "DELETE /_autoscaling/policy/*\n" + }, + { + "lang": "Python", + "source": "resp = client.autoscaling.delete_autoscaling_policy(\n name=\"*\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.autoscaling.deleteAutoscalingPolicy({\n name: \"*\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.autoscaling.delete_autoscaling_policy(\n name: \"*\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->autoscaling()->deleteAutoscalingPolicy([\n \"name\" => \"*\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_autoscaling/policy/*\"" } ] } @@ -791,6 +951,26 @@ { "lang": "Console", "source": "GET /_autoscaling/capacity\n" + }, + { + "lang": "Python", + "source": "resp = client.autoscaling.get_autoscaling_capacity()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.autoscaling.getAutoscalingCapacity();" + }, + { + "lang": "Ruby", + "source": "response = client.autoscaling.get_autoscaling_capacity" + }, + { + "lang": "PHP", + "source": "$resp = $client->autoscaling()->getAutoscalingCapacity();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_autoscaling/capacity\"" } ] } @@ -856,6 +1036,26 @@ { "lang": "Console", "source": "POST _bulk\n{ \"index\" : { \"_index\" : \"test\", \"_id\" : \"1\" } }\n{ \"field1\" : \"value1\" }\n{ \"delete\" : { \"_index\" : \"test\", \"_id\" : \"2\" } }\n{ \"create\" : { \"_index\" : \"test\", \"_id\" : \"3\" } }\n{ \"field1\" : \"value3\" }\n{ \"update\" : {\"_id\" : \"1\", \"_index\" : \"test\"} }\n{ \"doc\" : {\"field2\" : \"value2\"} }" + }, + { + "lang": "Python", + "source": "resp = client.bulk(\n operations=[\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.bulk({\n operations: [\n {\n index: {\n _index: \"test\",\n _id: \"1\",\n },\n },\n {\n field1: \"value1\",\n },\n {\n delete: {\n _index: \"test\",\n _id: \"2\",\n },\n },\n {\n create: {\n _index: \"test\",\n _id: \"3\",\n },\n },\n {\n field1: \"value3\",\n },\n {\n update: {\n _id: \"1\",\n _index: \"test\",\n },\n },\n {\n doc: {\n field2: \"value2\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.bulk(\n body: [\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->bulk([\n \"body\" => array(\n [\n \"index\" => [\n \"_index\" => \"test\",\n \"_id\" => \"1\",\n ],\n ],\n [\n \"field1\" => \"value1\",\n ],\n [\n \"delete\" => [\n \"_index\" => \"test\",\n \"_id\" => \"2\",\n ],\n ],\n [\n \"create\" => [\n \"_index\" => \"test\",\n \"_id\" => \"3\",\n ],\n ],\n [\n \"field1\" => \"value3\",\n ],\n [\n \"update\" => [\n \"_id\" => \"1\",\n \"_index\" => \"test\",\n ],\n ],\n [\n \"doc\" => [\n \"field2\" => \"value2\",\n ],\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{\"index\":{\"_index\":\"test\",\"_id\":\"1\"}},{\"field1\":\"value1\"},{\"delete\":{\"_index\":\"test\",\"_id\":\"2\"}},{\"create\":{\"_index\":\"test\",\"_id\":\"3\"}},{\"field1\":\"value3\"},{\"update\":{\"_id\":\"1\",\"_index\":\"test\"}},{\"doc\":{\"field2\":\"value2\"}}]' \"$ELASTICSEARCH_URL/_bulk\"" } ] }, @@ -919,6 +1119,26 @@ { "lang": "Console", "source": "POST _bulk\n{ \"index\" : { \"_index\" : \"test\", \"_id\" : \"1\" } }\n{ \"field1\" : \"value1\" }\n{ \"delete\" : { \"_index\" : \"test\", \"_id\" : \"2\" } }\n{ \"create\" : { \"_index\" : \"test\", \"_id\" : \"3\" } }\n{ \"field1\" : \"value3\" }\n{ \"update\" : {\"_id\" : \"1\", \"_index\" : \"test\"} }\n{ \"doc\" : {\"field2\" : \"value2\"} }" + }, + { + "lang": "Python", + "source": "resp = client.bulk(\n operations=[\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.bulk({\n operations: [\n {\n index: {\n _index: \"test\",\n _id: \"1\",\n },\n },\n {\n field1: \"value1\",\n },\n {\n delete: {\n _index: \"test\",\n _id: \"2\",\n },\n },\n {\n create: {\n _index: \"test\",\n _id: \"3\",\n },\n },\n {\n field1: \"value3\",\n },\n {\n update: {\n _id: \"1\",\n _index: \"test\",\n },\n },\n {\n doc: {\n field2: \"value2\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.bulk(\n body: [\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->bulk([\n \"body\" => array(\n [\n \"index\" => [\n \"_index\" => \"test\",\n \"_id\" => \"1\",\n ],\n ],\n [\n \"field1\" => \"value1\",\n ],\n [\n \"delete\" => [\n \"_index\" => \"test\",\n \"_id\" => \"2\",\n ],\n ],\n [\n \"create\" => [\n \"_index\" => \"test\",\n \"_id\" => \"3\",\n ],\n ],\n [\n \"field1\" => \"value3\",\n ],\n [\n \"update\" => [\n \"_id\" => \"1\",\n \"_index\" => \"test\",\n ],\n ],\n [\n \"doc\" => [\n \"field2\" => \"value2\",\n ],\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{\"index\":{\"_index\":\"test\",\"_id\":\"1\"}},{\"field1\":\"value1\"},{\"delete\":{\"_index\":\"test\",\"_id\":\"2\"}},{\"create\":{\"_index\":\"test\",\"_id\":\"3\"}},{\"field1\":\"value3\"},{\"update\":{\"_id\":\"1\",\"_index\":\"test\"}},{\"doc\":{\"field2\":\"value2\"}}]' \"$ELASTICSEARCH_URL/_bulk\"" } ] } @@ -987,6 +1207,26 @@ { "lang": "Console", "source": "POST _bulk\n{ \"index\" : { \"_index\" : \"test\", \"_id\" : \"1\" } }\n{ \"field1\" : \"value1\" }\n{ \"delete\" : { \"_index\" : \"test\", \"_id\" : \"2\" } }\n{ \"create\" : { \"_index\" : \"test\", \"_id\" : \"3\" } }\n{ \"field1\" : \"value3\" }\n{ \"update\" : {\"_id\" : \"1\", \"_index\" : \"test\"} }\n{ \"doc\" : {\"field2\" : \"value2\"} }" + }, + { + "lang": "Python", + "source": "resp = client.bulk(\n operations=[\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.bulk({\n operations: [\n {\n index: {\n _index: \"test\",\n _id: \"1\",\n },\n },\n {\n field1: \"value1\",\n },\n {\n delete: {\n _index: \"test\",\n _id: \"2\",\n },\n },\n {\n create: {\n _index: \"test\",\n _id: \"3\",\n },\n },\n {\n field1: \"value3\",\n },\n {\n update: {\n _id: \"1\",\n _index: \"test\",\n },\n },\n {\n doc: {\n field2: \"value2\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.bulk(\n body: [\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->bulk([\n \"body\" => array(\n [\n \"index\" => [\n \"_index\" => \"test\",\n \"_id\" => \"1\",\n ],\n ],\n [\n \"field1\" => \"value1\",\n ],\n [\n \"delete\" => [\n \"_index\" => \"test\",\n \"_id\" => \"2\",\n ],\n ],\n [\n \"create\" => [\n \"_index\" => \"test\",\n \"_id\" => \"3\",\n ],\n ],\n [\n \"field1\" => \"value3\",\n ],\n [\n \"update\" => [\n \"_id\" => \"1\",\n \"_index\" => \"test\",\n ],\n ],\n [\n \"doc\" => [\n \"field2\" => \"value2\",\n ],\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{\"index\":{\"_index\":\"test\",\"_id\":\"1\"}},{\"field1\":\"value1\"},{\"delete\":{\"_index\":\"test\",\"_id\":\"2\"}},{\"create\":{\"_index\":\"test\",\"_id\":\"3\"}},{\"field1\":\"value3\"},{\"update\":{\"_id\":\"1\",\"_index\":\"test\"}},{\"doc\":{\"field2\":\"value2\"}}]' \"$ELASTICSEARCH_URL/_bulk\"" } ] }, @@ -1053,6 +1293,26 @@ { "lang": "Console", "source": "POST _bulk\n{ \"index\" : { \"_index\" : \"test\", \"_id\" : \"1\" } }\n{ \"field1\" : \"value1\" }\n{ \"delete\" : { \"_index\" : \"test\", \"_id\" : \"2\" } }\n{ \"create\" : { \"_index\" : \"test\", \"_id\" : \"3\" } }\n{ \"field1\" : \"value3\" }\n{ \"update\" : {\"_id\" : \"1\", \"_index\" : \"test\"} }\n{ \"doc\" : {\"field2\" : \"value2\"} }" + }, + { + "lang": "Python", + "source": "resp = client.bulk(\n operations=[\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.bulk({\n operations: [\n {\n index: {\n _index: \"test\",\n _id: \"1\",\n },\n },\n {\n field1: \"value1\",\n },\n {\n delete: {\n _index: \"test\",\n _id: \"2\",\n },\n },\n {\n create: {\n _index: \"test\",\n _id: \"3\",\n },\n },\n {\n field1: \"value3\",\n },\n {\n update: {\n _id: \"1\",\n _index: \"test\",\n },\n },\n {\n doc: {\n field2: \"value2\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.bulk(\n body: [\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->bulk([\n \"body\" => array(\n [\n \"index\" => [\n \"_index\" => \"test\",\n \"_id\" => \"1\",\n ],\n ],\n [\n \"field1\" => \"value1\",\n ],\n [\n \"delete\" => [\n \"_index\" => \"test\",\n \"_id\" => \"2\",\n ],\n ],\n [\n \"create\" => [\n \"_index\" => \"test\",\n \"_id\" => \"3\",\n ],\n ],\n [\n \"field1\" => \"value3\",\n ],\n [\n \"update\" => [\n \"_id\" => \"1\",\n \"_index\" => \"test\",\n ],\n ],\n [\n \"doc\" => [\n \"field2\" => \"value2\",\n ],\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{\"index\":{\"_index\":\"test\",\"_id\":\"1\"}},{\"field1\":\"value1\"},{\"delete\":{\"_index\":\"test\",\"_id\":\"2\"}},{\"create\":{\"_index\":\"test\",\"_id\":\"3\"}},{\"field1\":\"value3\"},{\"update\":{\"_id\":\"1\",\"_index\":\"test\"}},{\"doc\":{\"field2\":\"value2\"}}]' \"$ELASTICSEARCH_URL/_bulk\"" } ] } @@ -1088,6 +1348,26 @@ { "lang": "Console", "source": "GET _cat/aliases?format=json&v=true\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.aliases(\n format=\"json\",\n v=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.aliases({\n format: \"json\",\n v: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.aliases(\n format: \"json\",\n v: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->aliases([\n \"format\" => \"json\",\n \"v\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/aliases?format=json&v=true\"" } ] } @@ -1126,6 +1406,26 @@ { "lang": "Console", "source": "GET _cat/aliases?format=json&v=true\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.aliases(\n format=\"json\",\n v=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.aliases({\n format: \"json\",\n v: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.aliases(\n format: \"json\",\n v: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->aliases([\n \"format\" => \"json\",\n \"v\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/aliases?format=json&v=true\"" } ] } @@ -1164,6 +1464,26 @@ { "lang": "Console", "source": "GET /_cat/allocation?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.allocation(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.allocation({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.allocation(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->allocation([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/allocation?v=true&format=json\"" } ] } @@ -1205,6 +1525,26 @@ { "lang": "Console", "source": "GET /_cat/allocation?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.allocation(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.allocation({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.allocation(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->allocation([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/allocation?v=true&format=json\"" } ] } @@ -1241,6 +1581,26 @@ { "lang": "Console", "source": "GET _cat/component_templates/my-template-*?v=true&s=name&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.component_templates(\n name=\"my-template-*\",\n v=True,\n s=\"name\",\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.componentTemplates({\n name: \"my-template-*\",\n v: \"true\",\n s: \"name\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.component_templates(\n name: \"my-template-*\",\n v: \"true\",\n s: \"name\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->componentTemplates([\n \"name\" => \"my-template-*\",\n \"v\" => \"true\",\n \"s\" => \"name\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/component_templates/my-template-*?v=true&s=name&format=json\"" } ] } @@ -1280,6 +1640,26 @@ { "lang": "Console", "source": "GET _cat/component_templates/my-template-*?v=true&s=name&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.component_templates(\n name=\"my-template-*\",\n v=True,\n s=\"name\",\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.componentTemplates({\n name: \"my-template-*\",\n v: \"true\",\n s: \"name\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.component_templates(\n name: \"my-template-*\",\n v: \"true\",\n s: \"name\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->componentTemplates([\n \"name\" => \"my-template-*\",\n \"v\" => \"true\",\n \"s\" => \"name\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/component_templates/my-template-*?v=true&s=name&format=json\"" } ] } @@ -1309,6 +1689,26 @@ { "lang": "Console", "source": "GET /_cat/count/my-index-000001?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.count(\n index=\"my-index-000001\",\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.count({\n index: \"my-index-000001\",\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.count(\n index: \"my-index-000001\",\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->count([\n \"index\" => \"my-index-000001\",\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/count/my-index-000001?v=true&format=json\"" } ] } @@ -1341,6 +1741,26 @@ { "lang": "Console", "source": "GET /_cat/count/my-index-000001?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.count(\n index=\"my-index-000001\",\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.count({\n index: \"my-index-000001\",\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.count(\n index: \"my-index-000001\",\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->count([\n \"index\" => \"my-index-000001\",\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/count/my-index-000001?v=true&format=json\"" } ] } @@ -1376,6 +1796,26 @@ { "lang": "Console", "source": "GET /_cat/fielddata?v=true&fields=body&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.fielddata(\n v=True,\n fields=\"body\",\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.fielddata({\n v: \"true\",\n fields: \"body\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.fielddata(\n v: \"true\",\n fields: \"body\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->fielddata([\n \"v\" => \"true\",\n \"fields\" => \"body\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/fielddata?v=true&fields=body&format=json\"" } ] } @@ -1414,6 +1854,26 @@ { "lang": "Console", "source": "GET /_cat/fielddata?v=true&fields=body&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.fielddata(\n v=True,\n fields=\"body\",\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.fielddata({\n v: \"true\",\n fields: \"body\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.fielddata(\n v: \"true\",\n fields: \"body\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->fielddata([\n \"v\" => \"true\",\n \"fields\" => \"body\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/fielddata?v=true&fields=body&format=json\"" } ] } @@ -1493,6 +1953,26 @@ { "lang": "Console", "source": "GET /_cat/health?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.health(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.health({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.health(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->health([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/health?v=true&format=json\"" } ] } @@ -1565,6 +2045,26 @@ { "lang": "Console", "source": "GET /_cat/indices/my-index-*?v=true&s=index&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.indices(\n index=\"my-index-*\",\n v=True,\n s=\"index\",\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.indices({\n index: \"my-index-*\",\n v: \"true\",\n s: \"index\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.indices(\n index: \"my-index-*\",\n v: \"true\",\n s: \"index\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->indices([\n \"index\" => \"my-index-*\",\n \"v\" => \"true\",\n \"s\" => \"index\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/indices/my-index-*?v=true&s=index&format=json\"" } ] } @@ -1618,6 +2118,26 @@ { "lang": "Console", "source": "GET /_cat/indices/my-index-*?v=true&s=index&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.indices(\n index=\"my-index-*\",\n v=True,\n s=\"index\",\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.indices({\n index: \"my-index-*\",\n v: \"true\",\n s: \"index\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.indices(\n index: \"my-index-*\",\n v: \"true\",\n s: \"index\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->indices([\n \"index\" => \"my-index-*\",\n \"v\" => \"true\",\n \"s\" => \"index\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/indices/my-index-*?v=true&s=index&format=json\"" } ] } @@ -1697,6 +2217,26 @@ { "lang": "Console", "source": "GET /_cat/master?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.master(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.master({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.master(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->master([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/master?v=true&format=json\"" } ] } @@ -1736,6 +2276,26 @@ { "lang": "Console", "source": "GET _cat/ml/data_frame/analytics?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.ml_data_frame_analytics(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.mlDataFrameAnalytics({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.ml_data_frame_analytics(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->mlDataFrameAnalytics([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/ml/data_frame/analytics?v=true&format=json\"" } ] } @@ -1778,6 +2338,26 @@ { "lang": "Console", "source": "GET _cat/ml/data_frame/analytics?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.ml_data_frame_analytics(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.mlDataFrameAnalytics({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.ml_data_frame_analytics(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->mlDataFrameAnalytics([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/ml/data_frame/analytics?v=true&format=json\"" } ] } @@ -1814,6 +2394,26 @@ { "lang": "Console", "source": "GET _cat/ml/datafeeds?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.ml_datafeeds(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.mlDatafeeds({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.ml_datafeeds(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->mlDatafeeds([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/ml/datafeeds?v=true&format=json\"" } ] } @@ -1853,6 +2453,26 @@ { "lang": "Console", "source": "GET _cat/ml/datafeeds?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.ml_datafeeds(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.mlDatafeeds({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.ml_datafeeds(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->mlDatafeeds([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/ml/datafeeds?v=true&format=json\"" } ] } @@ -1892,6 +2512,26 @@ { "lang": "Console", "source": "GET _cat/ml/anomaly_detectors?h=id,s,dpr,mb&v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.ml_jobs(\n h=\"id,s,dpr,mb\",\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.mlJobs({\n h: \"id,s,dpr,mb\",\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.ml_jobs(\n h: \"id,s,dpr,mb\",\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->mlJobs([\n \"h\" => \"id,s,dpr,mb\",\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/ml/anomaly_detectors?h=id,s,dpr,mb&v=true&format=json\"" } ] } @@ -1934,6 +2574,26 @@ { "lang": "Console", "source": "GET _cat/ml/anomaly_detectors?h=id,s,dpr,mb&v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.ml_jobs(\n h=\"id,s,dpr,mb\",\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.mlJobs({\n h: \"id,s,dpr,mb\",\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.ml_jobs(\n h: \"id,s,dpr,mb\",\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->mlJobs([\n \"h\" => \"id,s,dpr,mb\",\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/ml/anomaly_detectors?h=id,s,dpr,mb&v=true&format=json\"" } ] } @@ -1979,6 +2639,26 @@ { "lang": "Console", "source": "GET _cat/ml/trained_models?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.ml_trained_models(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.mlTrainedModels({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.ml_trained_models(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->mlTrainedModels([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/ml/trained_models?v=true&format=json\"" } ] } @@ -2027,6 +2707,26 @@ { "lang": "Console", "source": "GET _cat/ml/trained_models?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.ml_trained_models(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.mlTrainedModels({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.ml_trained_models(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->mlTrainedModels([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/ml/trained_models?v=true&format=json\"" } ] } @@ -2112,6 +2812,26 @@ { "lang": "Console", "source": "GET /_cat/nodeattrs?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.nodeattrs(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.nodeattrs({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.nodeattrs(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->nodeattrs([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/nodeattrs?v=true&format=json\"" } ] } @@ -2234,6 +2954,26 @@ { "lang": "Console", "source": "GET /_cat/nodes?v=true&h=id,ip,port,v,m&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.nodes(\n v=True,\n h=\"id,ip,port,v,m\",\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.nodes({\n v: \"true\",\n h: \"id,ip,port,v,m\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.nodes(\n v: \"true\",\n h: \"id,ip,port,v,m\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->nodes([\n \"v\" => \"true\",\n \"h\" => \"id,ip,port,v,m\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/nodes?v=true&h=id,ip,port,v,m&format=json\"" } ] } @@ -2323,6 +3063,26 @@ { "lang": "Console", "source": "GET /_cat/pending_tasks?v=trueh=insertOrder,timeInQueue,priority,source&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.pending_tasks(\n v=\"trueh=insertOrder,timeInQueue,priority,source\",\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.pendingTasks({\n v: \"trueh=insertOrder,timeInQueue,priority,source\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.pending_tasks(\n v: \"trueh=insertOrder,timeInQueue,priority,source\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->pendingTasks([\n \"v\" => \"trueh=insertOrder,timeInQueue,priority,source\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/pending_tasks?v=trueh=insertOrder,timeInQueue,priority,source&format=json\"" } ] } @@ -2412,6 +3172,26 @@ { "lang": "Console", "source": "GET /_cat/plugins?v=true&s=component&h=name,component,version,description&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.plugins(\n v=True,\n s=\"component\",\n h=\"name,component,version,description\",\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.plugins({\n v: \"true\",\n s: \"component\",\n h: \"name,component,version,description\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.plugins(\n v: \"true\",\n s: \"component\",\n h: \"name,component,version,description\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->plugins([\n \"v\" => \"true\",\n \"s\" => \"component\",\n \"h\" => \"name,component,version,description\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/plugins?v=true&s=component&h=name,component,version,description&format=json\"" } ] } @@ -2456,6 +3236,26 @@ { "lang": "Console", "source": "GET _cat/recovery?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.recovery(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.recovery({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.recovery(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->recovery([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/recovery?v=true&format=json\"" } ] } @@ -2503,6 +3303,26 @@ { "lang": "Console", "source": "GET _cat/recovery?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.recovery(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.recovery({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.recovery(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->recovery([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/recovery?v=true&format=json\"" } ] } @@ -2583,6 +3403,26 @@ { "lang": "Console", "source": "GET /_cat/repositories?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.repositories(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.repositories({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.repositories(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->repositories([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/repositories?v=true&format=json\"" } ] } @@ -2621,6 +3461,26 @@ { "lang": "Console", "source": "GET /_cat/segments?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.segments(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.segments({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.segments(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->segments([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/segments?v=true&format=json\"" } ] } @@ -2662,6 +3522,26 @@ { "lang": "Console", "source": "GET /_cat/segments?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.segments(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.segments({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.segments(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->segments([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/segments?v=true&format=json\"" } ] } @@ -2700,6 +3580,26 @@ { "lang": "Console", "source": "GET _cat/shards?format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.shards(\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.shards({\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.shards(\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->shards([\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/shards?format=json\"" } ] } @@ -2741,6 +3641,26 @@ { "lang": "Console", "source": "GET _cat/shards?format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.shards(\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.shards({\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.shards(\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->shards([\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/shards?format=json\"" } ] } @@ -2780,6 +3700,26 @@ { "lang": "Console", "source": "GET /_cat/snapshots/repo1?v=true&s=id&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.snapshots(\n repository=\"repo1\",\n v=True,\n s=\"id\",\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.snapshots({\n repository: \"repo1\",\n v: \"true\",\n s: \"id\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.snapshots(\n repository: \"repo1\",\n v: \"true\",\n s: \"id\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->snapshots([\n \"repository\" => \"repo1\",\n \"v\" => \"true\",\n \"s\" => \"id\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/snapshots/repo1?v=true&s=id&format=json\"" } ] } @@ -2822,6 +3762,26 @@ { "lang": "Console", "source": "GET /_cat/snapshots/repo1?v=true&s=id&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.snapshots(\n repository=\"repo1\",\n v=True,\n s=\"id\",\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.snapshots({\n repository: \"repo1\",\n v: \"true\",\n s: \"id\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.snapshots(\n repository: \"repo1\",\n v: \"true\",\n s: \"id\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->snapshots([\n \"repository\" => \"repo1\",\n \"v\" => \"true\",\n \"s\" => \"id\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/snapshots/repo1?v=true&s=id&format=json\"" } ] } @@ -2958,58 +3918,39 @@ { "lang": "Console", "source": "GET _cat/tasks?v=true&format=json\n" - } - ] - } - }, - "/_cat/templates": { - "get": { - "tags": [ - "cat" - ], - "summary": "Get index template information", - "description": "Get information about the index templates in a cluster.\nYou can use index templates to apply index settings and field mappings to new indices at creation.\nIMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get index template API.\n ##Required authorization\n* Cluster privileges: `monitor`", - "operationId": "cat-templates", - "parameters": [ + }, { - "$ref": "#/components/parameters/cat.templates-h" + "lang": "Python", + "source": "resp = client.cat.tasks(\n v=True,\n format=\"json\",\n)" }, { - "$ref": "#/components/parameters/cat.templates-s" + "lang": "JavaScript", + "source": "const response = await client.cat.tasks({\n v: \"true\",\n format: \"json\",\n});" }, { - "$ref": "#/components/parameters/cat.templates-local" + "lang": "Ruby", + "source": "response = client.cat.tasks(\n v: \"true\",\n format: \"json\"\n)" }, { - "$ref": "#/components/parameters/cat.templates-master_timeout" - } - ], - "responses": { - "200": { - "$ref": "#/components/responses/cat.templates-200" - } - }, - "x-state": "Added in 5.2.0", - "x-codeSamples": [ + "lang": "PHP", + "source": "$resp = $client->cat()->tasks([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, { - "lang": "Console", - "source": "GET _cat/templates/my-template-*?v=true&s=name&format=json\n" + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/tasks?v=true&format=json\"" } ] } }, - "/_cat/templates/{name}": { + "/_cat/templates": { "get": { "tags": [ "cat" ], "summary": "Get index template information", "description": "Get information about the index templates in a cluster.\nYou can use index templates to apply index settings and field mappings to new indices at creation.\nIMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get index template API.\n ##Required authorization\n* Cluster privileges: `monitor`", - "operationId": "cat-templates-1", + "operationId": "cat-templates", "parameters": [ - { - "$ref": "#/components/parameters/cat.templates-name" - }, { "$ref": "#/components/parameters/cat.templates-h" }, @@ -3033,6 +3974,85 @@ { "lang": "Console", "source": "GET _cat/templates/my-template-*?v=true&s=name&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.templates(\n name=\"my-template-*\",\n v=True,\n s=\"name\",\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.templates({\n name: \"my-template-*\",\n v: \"true\",\n s: \"name\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.templates(\n name: \"my-template-*\",\n v: \"true\",\n s: \"name\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->templates([\n \"name\" => \"my-template-*\",\n \"v\" => \"true\",\n \"s\" => \"name\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/templates/my-template-*?v=true&s=name&format=json\"" + } + ] + } + }, + "/_cat/templates/{name}": { + "get": { + "tags": [ + "cat" + ], + "summary": "Get index template information", + "description": "Get information about the index templates in a cluster.\nYou can use index templates to apply index settings and field mappings to new indices at creation.\nIMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get index template API.\n ##Required authorization\n* Cluster privileges: `monitor`", + "operationId": "cat-templates-1", + "parameters": [ + { + "$ref": "#/components/parameters/cat.templates-name" + }, + { + "$ref": "#/components/parameters/cat.templates-h" + }, + { + "$ref": "#/components/parameters/cat.templates-s" + }, + { + "$ref": "#/components/parameters/cat.templates-local" + }, + { + "$ref": "#/components/parameters/cat.templates-master_timeout" + } + ], + "responses": { + "200": { + "$ref": "#/components/responses/cat.templates-200" + } + }, + "x-state": "Added in 5.2.0", + "x-codeSamples": [ + { + "lang": "Console", + "source": "GET _cat/templates/my-template-*?v=true&s=name&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.templates(\n name=\"my-template-*\",\n v=True,\n s=\"name\",\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.templates({\n name: \"my-template-*\",\n v: \"true\",\n s: \"name\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.templates(\n name: \"my-template-*\",\n v: \"true\",\n s: \"name\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->templates([\n \"name\" => \"my-template-*\",\n \"v\" => \"true\",\n \"s\" => \"name\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/templates/my-template-*?v=true&s=name&format=json\"" } ] } @@ -3071,6 +4091,26 @@ { "lang": "Console", "source": "GET /_cat/thread_pool?format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.thread_pool(\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.threadPool({\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.thread_pool(\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->threadPool([\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/thread_pool?format=json\"" } ] } @@ -3112,6 +4152,26 @@ { "lang": "Console", "source": "GET /_cat/thread_pool?format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.thread_pool(\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.threadPool({\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.thread_pool(\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->threadPool([\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/thread_pool?format=json\"" } ] } @@ -3154,6 +4214,26 @@ { "lang": "Console", "source": "GET /_cat/transforms?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.transforms(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.transforms({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.transforms(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->transforms([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/transforms?v=true&format=json\"" } ] } @@ -3199,6 +4279,26 @@ { "lang": "Console", "source": "GET /_cat/transforms?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.transforms(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.transforms({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.transforms(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->transforms([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/transforms?v=true&format=json\"" } ] } @@ -3232,6 +4332,26 @@ { "lang": "Console", "source": "GET /_ccr/auto_follow/my_auto_follow_pattern\n" + }, + { + "lang": "Python", + "source": "resp = client.ccr.get_auto_follow_pattern(\n name=\"my_auto_follow_pattern\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ccr.getAutoFollowPattern({\n name: \"my_auto_follow_pattern\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ccr.get_auto_follow_pattern(\n name: \"my_auto_follow_pattern\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ccr()->getAutoFollowPattern([\n \"name\" => \"my_auto_follow_pattern\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ccr/auto_follow/my_auto_follow_pattern\"" } ] }, @@ -3367,6 +4487,26 @@ { "lang": "Console", "source": "PUT /_ccr/auto_follow/my_auto_follow_pattern\n{\n \"remote_cluster\" : \"remote_cluster\",\n \"leader_index_patterns\" :\n [\n \"leader_index*\"\n ],\n \"follow_index_pattern\" : \"{{leader_index}}-follower\",\n \"settings\": {\n \"index.number_of_replicas\": 0\n },\n \"max_read_request_operation_count\" : 1024,\n \"max_outstanding_read_requests\" : 16,\n \"max_read_request_size\" : \"1024k\",\n \"max_write_request_operation_count\" : 32768,\n \"max_write_request_size\" : \"16k\",\n \"max_outstanding_write_requests\" : 8,\n \"max_write_buffer_count\" : 512,\n \"max_write_buffer_size\" : \"512k\",\n \"max_retry_delay\" : \"10s\",\n \"read_poll_timeout\" : \"30s\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ccr.put_auto_follow_pattern(\n name=\"my_auto_follow_pattern\",\n remote_cluster=\"remote_cluster\",\n leader_index_patterns=[\n \"leader_index*\"\n ],\n follow_index_pattern=\"{{leader_index}}-follower\",\n settings={\n \"index.number_of_replicas\": 0\n },\n max_read_request_operation_count=1024,\n max_outstanding_read_requests=16,\n max_read_request_size=\"1024k\",\n max_write_request_operation_count=32768,\n max_write_request_size=\"16k\",\n max_outstanding_write_requests=8,\n max_write_buffer_count=512,\n max_write_buffer_size=\"512k\",\n max_retry_delay=\"10s\",\n read_poll_timeout=\"30s\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ccr.putAutoFollowPattern({\n name: \"my_auto_follow_pattern\",\n remote_cluster: \"remote_cluster\",\n leader_index_patterns: [\"leader_index*\"],\n follow_index_pattern: \"{{leader_index}}-follower\",\n settings: {\n \"index.number_of_replicas\": 0,\n },\n max_read_request_operation_count: 1024,\n max_outstanding_read_requests: 16,\n max_read_request_size: \"1024k\",\n max_write_request_operation_count: 32768,\n max_write_request_size: \"16k\",\n max_outstanding_write_requests: 8,\n max_write_buffer_count: 512,\n max_write_buffer_size: \"512k\",\n max_retry_delay: \"10s\",\n read_poll_timeout: \"30s\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ccr.put_auto_follow_pattern(\n name: \"my_auto_follow_pattern\",\n body: {\n \"remote_cluster\": \"remote_cluster\",\n \"leader_index_patterns\": [\n \"leader_index*\"\n ],\n \"follow_index_pattern\": \"{{leader_index}}-follower\",\n \"settings\": {\n \"index.number_of_replicas\": 0\n },\n \"max_read_request_operation_count\": 1024,\n \"max_outstanding_read_requests\": 16,\n \"max_read_request_size\": \"1024k\",\n \"max_write_request_operation_count\": 32768,\n \"max_write_request_size\": \"16k\",\n \"max_outstanding_write_requests\": 8,\n \"max_write_buffer_count\": 512,\n \"max_write_buffer_size\": \"512k\",\n \"max_retry_delay\": \"10s\",\n \"read_poll_timeout\": \"30s\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ccr()->putAutoFollowPattern([\n \"name\" => \"my_auto_follow_pattern\",\n \"body\" => [\n \"remote_cluster\" => \"remote_cluster\",\n \"leader_index_patterns\" => array(\n \"leader_index*\",\n ),\n \"follow_index_pattern\" => \"{{leader_index}}-follower\",\n \"settings\" => [\n \"index.number_of_replicas\" => 0,\n ],\n \"max_read_request_operation_count\" => 1024,\n \"max_outstanding_read_requests\" => 16,\n \"max_read_request_size\" => \"1024k\",\n \"max_write_request_operation_count\" => 32768,\n \"max_write_request_size\" => \"16k\",\n \"max_outstanding_write_requests\" => 8,\n \"max_write_buffer_count\" => 512,\n \"max_write_buffer_size\" => \"512k\",\n \"max_retry_delay\" => \"10s\",\n \"read_poll_timeout\" => \"30s\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"remote_cluster\":\"remote_cluster\",\"leader_index_patterns\":[\"leader_index*\"],\"follow_index_pattern\":\"{{leader_index}}-follower\",\"settings\":{\"index.number_of_replicas\":0},\"max_read_request_operation_count\":1024,\"max_outstanding_read_requests\":16,\"max_read_request_size\":\"1024k\",\"max_write_request_operation_count\":32768,\"max_write_request_size\":\"16k\",\"max_outstanding_write_requests\":8,\"max_write_buffer_count\":512,\"max_write_buffer_size\":\"512k\",\"max_retry_delay\":\"10s\",\"read_poll_timeout\":\"30s\"}' \"$ELASTICSEARCH_URL/_ccr/auto_follow/my_auto_follow_pattern\"" } ] }, @@ -3426,6 +4566,26 @@ { "lang": "Console", "source": "DELETE /_ccr/auto_follow/my_auto_follow_pattern\n" + }, + { + "lang": "Python", + "source": "resp = client.ccr.delete_auto_follow_pattern(\n name=\"my_auto_follow_pattern\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ccr.deleteAutoFollowPattern({\n name: \"my_auto_follow_pattern\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ccr.delete_auto_follow_pattern(\n name: \"my_auto_follow_pattern\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ccr()->deleteAutoFollowPattern([\n \"name\" => \"my_auto_follow_pattern\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ccr/auto_follow/my_auto_follow_pattern\"" } ] } @@ -3581,6 +4741,26 @@ { "lang": "Console", "source": "PUT /follower_index/_ccr/follow?wait_for_active_shards=1\n{\n \"remote_cluster\" : \"remote_cluster\",\n \"leader_index\" : \"leader_index\",\n \"settings\": {\n \"index.number_of_replicas\": 0\n },\n \"max_read_request_operation_count\" : 1024,\n \"max_outstanding_read_requests\" : 16,\n \"max_read_request_size\" : \"1024k\",\n \"max_write_request_operation_count\" : 32768,\n \"max_write_request_size\" : \"16k\",\n \"max_outstanding_write_requests\" : 8,\n \"max_write_buffer_count\" : 512,\n \"max_write_buffer_size\" : \"512k\",\n \"max_retry_delay\" : \"10s\",\n \"read_poll_timeout\" : \"30s\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ccr.follow(\n index=\"follower_index\",\n wait_for_active_shards=\"1\",\n remote_cluster=\"remote_cluster\",\n leader_index=\"leader_index\",\n settings={\n \"index.number_of_replicas\": 0\n },\n max_read_request_operation_count=1024,\n max_outstanding_read_requests=16,\n max_read_request_size=\"1024k\",\n max_write_request_operation_count=32768,\n max_write_request_size=\"16k\",\n max_outstanding_write_requests=8,\n max_write_buffer_count=512,\n max_write_buffer_size=\"512k\",\n max_retry_delay=\"10s\",\n read_poll_timeout=\"30s\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ccr.follow({\n index: \"follower_index\",\n wait_for_active_shards: 1,\n remote_cluster: \"remote_cluster\",\n leader_index: \"leader_index\",\n settings: {\n \"index.number_of_replicas\": 0,\n },\n max_read_request_operation_count: 1024,\n max_outstanding_read_requests: 16,\n max_read_request_size: \"1024k\",\n max_write_request_operation_count: 32768,\n max_write_request_size: \"16k\",\n max_outstanding_write_requests: 8,\n max_write_buffer_count: 512,\n max_write_buffer_size: \"512k\",\n max_retry_delay: \"10s\",\n read_poll_timeout: \"30s\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ccr.follow(\n index: \"follower_index\",\n wait_for_active_shards: \"1\",\n body: {\n \"remote_cluster\": \"remote_cluster\",\n \"leader_index\": \"leader_index\",\n \"settings\": {\n \"index.number_of_replicas\": 0\n },\n \"max_read_request_operation_count\": 1024,\n \"max_outstanding_read_requests\": 16,\n \"max_read_request_size\": \"1024k\",\n \"max_write_request_operation_count\": 32768,\n \"max_write_request_size\": \"16k\",\n \"max_outstanding_write_requests\": 8,\n \"max_write_buffer_count\": 512,\n \"max_write_buffer_size\": \"512k\",\n \"max_retry_delay\": \"10s\",\n \"read_poll_timeout\": \"30s\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ccr()->follow([\n \"index\" => \"follower_index\",\n \"wait_for_active_shards\" => \"1\",\n \"body\" => [\n \"remote_cluster\" => \"remote_cluster\",\n \"leader_index\" => \"leader_index\",\n \"settings\" => [\n \"index.number_of_replicas\" => 0,\n ],\n \"max_read_request_operation_count\" => 1024,\n \"max_outstanding_read_requests\" => 16,\n \"max_read_request_size\" => \"1024k\",\n \"max_write_request_operation_count\" => 32768,\n \"max_write_request_size\" => \"16k\",\n \"max_outstanding_write_requests\" => 8,\n \"max_write_buffer_count\" => 512,\n \"max_write_buffer_size\" => \"512k\",\n \"max_retry_delay\" => \"10s\",\n \"read_poll_timeout\" => \"30s\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"remote_cluster\":\"remote_cluster\",\"leader_index\":\"leader_index\",\"settings\":{\"index.number_of_replicas\":0},\"max_read_request_operation_count\":1024,\"max_outstanding_read_requests\":16,\"max_read_request_size\":\"1024k\",\"max_write_request_operation_count\":32768,\"max_write_request_size\":\"16k\",\"max_outstanding_write_requests\":8,\"max_write_buffer_count\":512,\"max_write_buffer_size\":\"512k\",\"max_retry_delay\":\"10s\",\"read_poll_timeout\":\"30s\"}' \"$ELASTICSEARCH_URL/follower_index/_ccr/follow?wait_for_active_shards=1\"" } ] } @@ -3659,6 +4839,26 @@ { "lang": "Console", "source": "GET /follower_index/_ccr/info\n" + }, + { + "lang": "Python", + "source": "resp = client.ccr.follow_info(\n index=\"follower_index\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ccr.followInfo({\n index: \"follower_index\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ccr.follow_info(\n index: \"follower_index\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ccr()->followInfo([\n \"index\" => \"follower_index\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/follower_index/_ccr/info\"" } ] } @@ -3732,6 +4932,26 @@ { "lang": "Console", "source": "GET /follower_index/_ccr/stats\n" + }, + { + "lang": "Python", + "source": "resp = client.ccr.follow_stats(\n index=\"follower_index\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ccr.followStats({\n index: \"follower_index\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ccr.follow_stats(\n index: \"follower_index\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ccr()->followStats([\n \"index\" => \"follower_index\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/follower_index/_ccr/stats\"" } ] } @@ -3831,6 +5051,26 @@ { "lang": "Console", "source": "POST //_ccr/forget_follower\n{\n \"follower_cluster\" : \"\",\n \"follower_index\" : \"\",\n \"follower_index_uuid\" : \"\",\n \"leader_remote_cluster\" : \"\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ccr.forget_follower(\n index=\"\",\n follower_cluster=\"\",\n follower_index=\"\",\n follower_index_uuid=\"\",\n leader_remote_cluster=\"\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ccr.forgetFollower({\n index: \"\",\n follower_cluster: \"\",\n follower_index: \"\",\n follower_index_uuid: \"\",\n leader_remote_cluster: \"\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ccr.forget_follower(\n index: \"\",\n body: {\n \"follower_cluster\": \"\",\n \"follower_index\": \"\",\n \"follower_index_uuid\": \"\",\n \"leader_remote_cluster\": \"\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ccr()->forgetFollower([\n \"index\" => \"\",\n \"body\" => [\n \"follower_cluster\" => \"\",\n \"follower_index\" => \"\",\n \"follower_index_uuid\" => \"\",\n \"leader_remote_cluster\" => \"\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"follower_cluster\":\"\",\"follower_index\":\"\",\"follower_index_uuid\":\"\",\"leader_remote_cluster\":\"\"}' \"$ELASTICSEARCH_URL//_ccr/forget_follower\"" } ] } @@ -3861,6 +5101,26 @@ { "lang": "Console", "source": "GET /_ccr/auto_follow/my_auto_follow_pattern\n" + }, + { + "lang": "Python", + "source": "resp = client.ccr.get_auto_follow_pattern(\n name=\"my_auto_follow_pattern\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ccr.getAutoFollowPattern({\n name: \"my_auto_follow_pattern\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ccr.get_auto_follow_pattern(\n name: \"my_auto_follow_pattern\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ccr()->getAutoFollowPattern([\n \"name\" => \"my_auto_follow_pattern\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ccr/auto_follow/my_auto_follow_pattern\"" } ] } @@ -3922,6 +5182,26 @@ { "lang": "Console", "source": "POST /_ccr/auto_follow/my_auto_follow_pattern/pause\n" + }, + { + "lang": "Python", + "source": "resp = client.ccr.pause_auto_follow_pattern(\n name=\"my_auto_follow_pattern\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ccr.pauseAutoFollowPattern({\n name: \"my_auto_follow_pattern\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ccr.pause_auto_follow_pattern(\n name: \"my_auto_follow_pattern\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ccr()->pauseAutoFollowPattern([\n \"name\" => \"my_auto_follow_pattern\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ccr/auto_follow/my_auto_follow_pattern/pause\"" } ] } @@ -3980,6 +5260,26 @@ { "lang": "Console", "source": "POST /follower_index/_ccr/pause_follow\n" + }, + { + "lang": "Python", + "source": "resp = client.ccr.pause_follow(\n index=\"follower_index\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ccr.pauseFollow({\n index: \"follower_index\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ccr.pause_follow(\n index: \"follower_index\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ccr()->pauseFollow([\n \"index\" => \"follower_index\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/follower_index/_ccr/pause_follow\"" } ] } @@ -4041,6 +5341,26 @@ { "lang": "Console", "source": "POST /_ccr/auto_follow/my_auto_follow_pattern/resume\n" + }, + { + "lang": "Python", + "source": "resp = client.ccr.resume_auto_follow_pattern(\n name=\"my_auto_follow_pattern\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ccr.resumeAutoFollowPattern({\n name: \"my_auto_follow_pattern\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ccr.resume_auto_follow_pattern(\n name: \"my_auto_follow_pattern\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ccr()->resumeAutoFollowPattern([\n \"name\" => \"my_auto_follow_pattern\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ccr/auto_follow/my_auto_follow_pattern/resume\"" } ] } @@ -4149,6 +5469,26 @@ { "lang": "Console", "source": "POST /follower_index/_ccr/resume_follow\n{\n \"max_read_request_operation_count\" : 1024,\n \"max_outstanding_read_requests\" : 16,\n \"max_read_request_size\" : \"1024k\",\n \"max_write_request_operation_count\" : 32768,\n \"max_write_request_size\" : \"16k\",\n \"max_outstanding_write_requests\" : 8,\n \"max_write_buffer_count\" : 512,\n \"max_write_buffer_size\" : \"512k\",\n \"max_retry_delay\" : \"10s\",\n \"read_poll_timeout\" : \"30s\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ccr.resume_follow(\n index=\"follower_index\",\n max_read_request_operation_count=1024,\n max_outstanding_read_requests=16,\n max_read_request_size=\"1024k\",\n max_write_request_operation_count=32768,\n max_write_request_size=\"16k\",\n max_outstanding_write_requests=8,\n max_write_buffer_count=512,\n max_write_buffer_size=\"512k\",\n max_retry_delay=\"10s\",\n read_poll_timeout=\"30s\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ccr.resumeFollow({\n index: \"follower_index\",\n max_read_request_operation_count: 1024,\n max_outstanding_read_requests: 16,\n max_read_request_size: \"1024k\",\n max_write_request_operation_count: 32768,\n max_write_request_size: \"16k\",\n max_outstanding_write_requests: 8,\n max_write_buffer_count: 512,\n max_write_buffer_size: \"512k\",\n max_retry_delay: \"10s\",\n read_poll_timeout: \"30s\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ccr.resume_follow(\n index: \"follower_index\",\n body: {\n \"max_read_request_operation_count\": 1024,\n \"max_outstanding_read_requests\": 16,\n \"max_read_request_size\": \"1024k\",\n \"max_write_request_operation_count\": 32768,\n \"max_write_request_size\": \"16k\",\n \"max_outstanding_write_requests\": 8,\n \"max_write_buffer_count\": 512,\n \"max_write_buffer_size\": \"512k\",\n \"max_retry_delay\": \"10s\",\n \"read_poll_timeout\": \"30s\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ccr()->resumeFollow([\n \"index\" => \"follower_index\",\n \"body\" => [\n \"max_read_request_operation_count\" => 1024,\n \"max_outstanding_read_requests\" => 16,\n \"max_read_request_size\" => \"1024k\",\n \"max_write_request_operation_count\" => 32768,\n \"max_write_request_size\" => \"16k\",\n \"max_outstanding_write_requests\" => 8,\n \"max_write_buffer_count\" => 512,\n \"max_write_buffer_size\" => \"512k\",\n \"max_retry_delay\" => \"10s\",\n \"read_poll_timeout\" => \"30s\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"max_read_request_operation_count\":1024,\"max_outstanding_read_requests\":16,\"max_read_request_size\":\"1024k\",\"max_write_request_operation_count\":32768,\"max_write_request_size\":\"16k\",\"max_outstanding_write_requests\":8,\"max_write_buffer_count\":512,\"max_write_buffer_size\":\"512k\",\"max_retry_delay\":\"10s\",\"read_poll_timeout\":\"30s\"}' \"$ELASTICSEARCH_URL/follower_index/_ccr/resume_follow\"" } ] } @@ -4218,6 +5558,26 @@ { "lang": "Console", "source": "GET /_ccr/stats\n" + }, + { + "lang": "Python", + "source": "resp = client.ccr.stats()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ccr.stats();" + }, + { + "lang": "Ruby", + "source": "response = client.ccr.stats" + }, + { + "lang": "PHP", + "source": "$resp = $client->ccr()->stats();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ccr/stats\"" } ] } @@ -4279,6 +5639,26 @@ { "lang": "Console", "source": "POST /follower_index/_ccr/unfollow\n" + }, + { + "lang": "Python", + "source": "resp = client.ccr.unfollow(\n index=\"follower_index\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ccr.unfollow({\n index: \"follower_index\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ccr.unfollow(\n index: \"follower_index\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ccr()->unfollow([\n \"index\" => \"follower_index\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/follower_index/_ccr/unfollow\"" } ] } @@ -4317,6 +5697,26 @@ { "lang": "Console", "source": "GET /_search/scroll\n{\n \"scroll_id\" : \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.scroll(\n scroll_id=\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.scroll({\n scroll_id: \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.scroll(\n body: {\n \"scroll_id\": \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->scroll([\n \"body\" => [\n \"scroll_id\" => \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"scroll_id\":\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"}' \"$ELASTICSEARCH_URL/_search/scroll\"" } ] }, @@ -4353,6 +5753,26 @@ { "lang": "Console", "source": "GET /_search/scroll\n{\n \"scroll_id\" : \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.scroll(\n scroll_id=\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.scroll({\n scroll_id: \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.scroll(\n body: {\n \"scroll_id\": \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->scroll([\n \"body\" => [\n \"scroll_id\" => \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"scroll_id\":\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"}' \"$ELASTICSEARCH_URL/_search/scroll\"" } ] }, @@ -4378,6 +5798,26 @@ { "lang": "Console", "source": "DELETE /_search/scroll\n{\n \"scroll_id\": \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.clear_scroll(\n scroll_id=\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.clearScroll({\n scroll_id: \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.clear_scroll(\n body: {\n \"scroll_id\": \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->clearScroll([\n \"body\" => [\n \"scroll_id\" => \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"scroll_id\":\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"}' \"$ELASTICSEARCH_URL/_search/scroll\"" } ] } @@ -4419,6 +5859,26 @@ { "lang": "Console", "source": "GET /_search/scroll\n{\n \"scroll_id\" : \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.scroll(\n scroll_id=\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.scroll({\n scroll_id: \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.scroll(\n body: {\n \"scroll_id\": \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->scroll([\n \"body\" => [\n \"scroll_id\" => \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"scroll_id\":\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"}' \"$ELASTICSEARCH_URL/_search/scroll\"" } ] }, @@ -4458,6 +5918,26 @@ { "lang": "Console", "source": "GET /_search/scroll\n{\n \"scroll_id\" : \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.scroll(\n scroll_id=\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.scroll({\n scroll_id: \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.scroll(\n body: {\n \"scroll_id\": \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->scroll([\n \"body\" => [\n \"scroll_id\" => \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"scroll_id\":\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"}' \"$ELASTICSEARCH_URL/_search/scroll\"" } ] }, @@ -4488,6 +5968,26 @@ { "lang": "Console", "source": "DELETE /_search/scroll\n{\n \"scroll_id\": \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.clear_scroll(\n scroll_id=\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.clearScroll({\n scroll_id: \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.clear_scroll(\n body: {\n \"scroll_id\": \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->clearScroll([\n \"body\" => [\n \"scroll_id\" => \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"scroll_id\":\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"}' \"$ELASTICSEARCH_URL/_search/scroll\"" } ] } @@ -4560,6 +6060,26 @@ { "lang": "Console", "source": "DELETE /_pit\n{\n \"id\": \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.close_point_in_time(\n id=\"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.closePointInTime({\n id: \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.close_point_in_time(\n body: {\n \"id\": \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->closePointInTime([\n \"body\" => [\n \"id\" => \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\"}' \"$ELASTICSEARCH_URL/_pit\"" } ] } @@ -4599,6 +6119,26 @@ { "lang": "Console", "source": "GET _cluster/allocation/explain\n{\n \"index\": \"my-index-000001\",\n \"shard\": 0,\n \"primary\": false,\n \"current_node\": \"my-node\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.cluster.allocation_explain(\n index=\"my-index-000001\",\n shard=0,\n primary=False,\n current_node=\"my-node\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.allocationExplain({\n index: \"my-index-000001\",\n shard: 0,\n primary: false,\n current_node: \"my-node\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.allocation_explain(\n body: {\n \"index\": \"my-index-000001\",\n \"shard\": 0,\n \"primary\": false,\n \"current_node\": \"my-node\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->allocationExplain([\n \"body\" => [\n \"index\" => \"my-index-000001\",\n \"shard\" => 0,\n \"primary\" => false,\n \"current_node\" => \"my-node\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index\":\"my-index-000001\",\"shard\":0,\"primary\":false,\"current_node\":\"my-node\"}' \"$ELASTICSEARCH_URL/_cluster/allocation/explain\"" } ] }, @@ -4636,6 +6176,26 @@ { "lang": "Console", "source": "GET _cluster/allocation/explain\n{\n \"index\": \"my-index-000001\",\n \"shard\": 0,\n \"primary\": false,\n \"current_node\": \"my-node\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.cluster.allocation_explain(\n index=\"my-index-000001\",\n shard=0,\n primary=False,\n current_node=\"my-node\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.allocationExplain({\n index: \"my-index-000001\",\n shard: 0,\n primary: false,\n current_node: \"my-node\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.allocation_explain(\n body: {\n \"index\": \"my-index-000001\",\n \"shard\": 0,\n \"primary\": false,\n \"current_node\": \"my-node\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->allocationExplain([\n \"body\" => [\n \"index\" => \"my-index-000001\",\n \"shard\" => 0,\n \"primary\" => false,\n \"current_node\" => \"my-node\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index\":\"my-index-000001\",\"shard\":0,\"primary\":false,\"current_node\":\"my-node\"}' \"$ELASTICSEARCH_URL/_cluster/allocation/explain\"" } ] } @@ -4675,6 +6235,26 @@ { "lang": "Console", "source": "GET /_component_template/template_1\n" + }, + { + "lang": "Python", + "source": "resp = client.cluster.get_component_template(\n name=\"template_1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.getComponentTemplate({\n name: \"template_1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.get_component_template(\n name: \"template_1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->getComponentTemplate([\n \"name\" => \"template_1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_component_template/template_1\"" } ] }, @@ -4709,6 +6289,26 @@ { "lang": "Console", "source": "PUT _component_template/template_1\n{\n \"template\": null,\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"mappings\": {\n \"_source\": {\n \"enabled\": false\n },\n \"properties\": {\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.cluster.put_component_template(\n name=\"template_1\",\n template=None,\n settings={\n \"number_of_shards\": 1\n },\n mappings={\n \"_source\": {\n \"enabled\": False\n },\n \"properties\": {\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.putComponentTemplate({\n name: \"template_1\",\n template: null,\n settings: {\n number_of_shards: 1,\n },\n mappings: {\n _source: {\n enabled: false,\n },\n properties: {\n host_name: {\n type: \"keyword\",\n },\n created_at: {\n type: \"date\",\n format: \"EEE MMM dd HH:mm:ss Z yyyy\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.put_component_template(\n name: \"template_1\",\n body: {\n \"template\": nil,\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"mappings\": {\n \"_source\": {\n \"enabled\": false\n },\n \"properties\": {\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->putComponentTemplate([\n \"name\" => \"template_1\",\n \"body\" => [\n \"template\" => null,\n \"settings\" => [\n \"number_of_shards\" => 1,\n ],\n \"mappings\" => [\n \"_source\" => [\n \"enabled\" => false,\n ],\n \"properties\" => [\n \"host_name\" => [\n \"type\" => \"keyword\",\n ],\n \"created_at\" => [\n \"type\" => \"date\",\n \"format\" => \"EEE MMM dd HH:mm:ss Z yyyy\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"template\":null,\"settings\":{\"number_of_shards\":1},\"mappings\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"keyword\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z yyyy\"}}}}' \"$ELASTICSEARCH_URL/_component_template/template_1\"" } ] }, @@ -4743,6 +6343,26 @@ { "lang": "Console", "source": "PUT _component_template/template_1\n{\n \"template\": null,\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"mappings\": {\n \"_source\": {\n \"enabled\": false\n },\n \"properties\": {\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.cluster.put_component_template(\n name=\"template_1\",\n template=None,\n settings={\n \"number_of_shards\": 1\n },\n mappings={\n \"_source\": {\n \"enabled\": False\n },\n \"properties\": {\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.putComponentTemplate({\n name: \"template_1\",\n template: null,\n settings: {\n number_of_shards: 1,\n },\n mappings: {\n _source: {\n enabled: false,\n },\n properties: {\n host_name: {\n type: \"keyword\",\n },\n created_at: {\n type: \"date\",\n format: \"EEE MMM dd HH:mm:ss Z yyyy\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.put_component_template(\n name: \"template_1\",\n body: {\n \"template\": nil,\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"mappings\": {\n \"_source\": {\n \"enabled\": false\n },\n \"properties\": {\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->putComponentTemplate([\n \"name\" => \"template_1\",\n \"body\" => [\n \"template\" => null,\n \"settings\" => [\n \"number_of_shards\" => 1,\n ],\n \"mappings\" => [\n \"_source\" => [\n \"enabled\" => false,\n ],\n \"properties\" => [\n \"host_name\" => [\n \"type\" => \"keyword\",\n ],\n \"created_at\" => [\n \"type\" => \"date\",\n \"format\" => \"EEE MMM dd HH:mm:ss Z yyyy\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"template\":null,\"settings\":{\"number_of_shards\":1},\"mappings\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"keyword\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z yyyy\"}}}}' \"$ELASTICSEARCH_URL/_component_template/template_1\"" } ] }, @@ -4803,6 +6423,26 @@ { "lang": "Console", "source": "DELETE _component_template/template_1\n" + }, + { + "lang": "Python", + "source": "resp = client.cluster.delete_component_template(\n name=\"template_1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.deleteComponentTemplate({\n name: \"template_1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.delete_component_template(\n name: \"template_1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->deleteComponentTemplate([\n \"name\" => \"template_1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_component_template/template_1\"" } ] }, @@ -4995,6 +6635,26 @@ { "lang": "Console", "source": "GET /_component_template/template_1\n" + }, + { + "lang": "Python", + "source": "resp = client.cluster.get_component_template(\n name=\"template_1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.getComponentTemplate({\n name: \"template_1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.get_component_template(\n name: \"template_1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->getComponentTemplate([\n \"name\" => \"template_1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_component_template/template_1\"" } ] } @@ -5095,6 +6755,26 @@ { "lang": "Console", "source": "GET /_cluster/settings?filter_path=persistent.cluster.remote\n" + }, + { + "lang": "Python", + "source": "resp = client.cluster.get_settings(\n filter_path=\"persistent.cluster.remote\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.getSettings({\n filter_path: \"persistent.cluster.remote\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.get_settings(\n filter_path: \"persistent.cluster.remote\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->getSettings([\n \"filter_path\" => \"persistent.cluster.remote\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cluster/settings?filter_path=persistent.cluster.remote\"" } ] }, @@ -5216,6 +6896,26 @@ { "lang": "Console", "source": "PUT /_cluster/settings\n{\n \"persistent\" : {\n \"indices.recovery.max_bytes_per_sec\" : \"50mb\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.cluster.put_settings(\n persistent={\n \"indices.recovery.max_bytes_per_sec\": \"50mb\"\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.putSettings({\n persistent: {\n \"indices.recovery.max_bytes_per_sec\": \"50mb\",\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.put_settings(\n body: {\n \"persistent\": {\n \"indices.recovery.max_bytes_per_sec\": \"50mb\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->putSettings([\n \"body\" => [\n \"persistent\" => [\n \"indices.recovery.max_bytes_per_sec\" => \"50mb\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"persistent\":{\"indices.recovery.max_bytes_per_sec\":\"50mb\"}}' \"$ELASTICSEARCH_URL/_cluster/settings\"" } ] } @@ -5273,6 +6973,26 @@ { "lang": "Console", "source": "GET _cluster/health\n" + }, + { + "lang": "Python", + "source": "resp = client.cluster.health()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.health();" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.health" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->health();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cluster/health\"" } ] } @@ -5333,6 +7053,26 @@ { "lang": "Console", "source": "GET _cluster/health\n" + }, + { + "lang": "Python", + "source": "resp = client.cluster.health()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.health();" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.health" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->health();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cluster/health\"" } ] } @@ -5398,6 +7138,26 @@ { "lang": "Console", "source": "GET /_info/_all\n" + }, + { + "lang": "Python", + "source": "resp = client.cluster.info(\n target=\"_all\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.info({\n target: \"_all\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.info(\n target: \"_all\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->info([\n \"target\" => \"_all\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_info/_all\"" } ] } @@ -5459,6 +7219,26 @@ { "lang": "Console", "source": "GET /_cluster/pending_tasks\n" + }, + { + "lang": "Python", + "source": "resp = client.cluster.pending_tasks()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.pendingTasks();" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.pending_tasks" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->pendingTasks();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cluster/pending_tasks\"" } ] } @@ -5494,6 +7274,26 @@ { "lang": "Console", "source": "GET /_remote/info\n" + }, + { + "lang": "Python", + "source": "resp = client.cluster.remote_info()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.remoteInfo();" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.remote_info" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->remoteInfo();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_remote/info\"" } ] } @@ -5627,6 +7427,26 @@ { "lang": "Console", "source": "POST /_cluster/reroute?metric=none\n{\n \"commands\": [\n {\n \"move\": {\n \"index\": \"test\", \"shard\": 0,\n \"from_node\": \"node1\", \"to_node\": \"node2\"\n }\n },\n {\n \"allocate_replica\": {\n \"index\": \"test\", \"shard\": 1,\n \"node\": \"node3\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.cluster.reroute(\n metric=\"none\",\n commands=[\n {\n \"move\": {\n \"index\": \"test\",\n \"shard\": 0,\n \"from_node\": \"node1\",\n \"to_node\": \"node2\"\n }\n },\n {\n \"allocate_replica\": {\n \"index\": \"test\",\n \"shard\": 1,\n \"node\": \"node3\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.reroute({\n metric: \"none\",\n commands: [\n {\n move: {\n index: \"test\",\n shard: 0,\n from_node: \"node1\",\n to_node: \"node2\",\n },\n },\n {\n allocate_replica: {\n index: \"test\",\n shard: 1,\n node: \"node3\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.reroute(\n metric: \"none\",\n body: {\n \"commands\": [\n {\n \"move\": {\n \"index\": \"test\",\n \"shard\": 0,\n \"from_node\": \"node1\",\n \"to_node\": \"node2\"\n }\n },\n {\n \"allocate_replica\": {\n \"index\": \"test\",\n \"shard\": 1,\n \"node\": \"node3\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->reroute([\n \"metric\" => \"none\",\n \"body\" => [\n \"commands\" => array(\n [\n \"move\" => [\n \"index\" => \"test\",\n \"shard\" => 0,\n \"from_node\" => \"node1\",\n \"to_node\" => \"node2\",\n ],\n ],\n [\n \"allocate_replica\" => [\n \"index\" => \"test\",\n \"shard\" => 1,\n \"node\" => \"node3\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"commands\":[{\"move\":{\"index\":\"test\",\"shard\":0,\"from_node\":\"node1\",\"to_node\":\"node2\"}},{\"allocate_replica\":{\"index\":\"test\",\"shard\":1,\"node\":\"node3\"}}]}' \"$ELASTICSEARCH_URL/_cluster/reroute?metric=none\"" } ] } @@ -5675,6 +7495,26 @@ { "lang": "Console", "source": "GET /_cluster/state?filter_path=metadata.cluster_coordination.last_committed_config\n" + }, + { + "lang": "Python", + "source": "resp = client.cluster.state(\n filter_path=\"metadata.cluster_coordination.last_committed_config\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.state({\n filter_path: \"metadata.cluster_coordination.last_committed_config\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.state(\n filter_path: \"metadata.cluster_coordination.last_committed_config\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->state([\n \"filter_path\" => \"metadata.cluster_coordination.last_committed_config\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cluster/state?filter_path=metadata.cluster_coordination.last_committed_config\"" } ] } @@ -5726,6 +7566,26 @@ { "lang": "Console", "source": "GET /_cluster/state?filter_path=metadata.cluster_coordination.last_committed_config\n" + }, + { + "lang": "Python", + "source": "resp = client.cluster.state(\n filter_path=\"metadata.cluster_coordination.last_committed_config\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.state({\n filter_path: \"metadata.cluster_coordination.last_committed_config\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.state(\n filter_path: \"metadata.cluster_coordination.last_committed_config\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->state([\n \"filter_path\" => \"metadata.cluster_coordination.last_committed_config\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cluster/state?filter_path=metadata.cluster_coordination.last_committed_config\"" } ] } @@ -5780,6 +7640,26 @@ { "lang": "Console", "source": "GET /_cluster/state?filter_path=metadata.cluster_coordination.last_committed_config\n" + }, + { + "lang": "Python", + "source": "resp = client.cluster.state(\n filter_path=\"metadata.cluster_coordination.last_committed_config\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.state({\n filter_path: \"metadata.cluster_coordination.last_committed_config\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.state(\n filter_path: \"metadata.cluster_coordination.last_committed_config\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->state([\n \"filter_path\" => \"metadata.cluster_coordination.last_committed_config\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cluster/state?filter_path=metadata.cluster_coordination.last_committed_config\"" } ] } @@ -5810,6 +7690,26 @@ { "lang": "Console", "source": "GET _cluster/stats?human&filter_path=indices.mappings.total_deduplicated_mapping_size*\n" + }, + { + "lang": "Python", + "source": "resp = client.cluster.stats(\n human=True,\n filter_path=\"indices.mappings.total_deduplicated_mapping_size*\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.stats({\n human: \"true\",\n filter_path: \"indices.mappings.total_deduplicated_mapping_size*\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.stats(\n human: \"true\",\n filter_path: \"indices.mappings.total_deduplicated_mapping_size*\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->stats([\n \"human\" => \"true\",\n \"filter_path\" => \"indices.mappings.total_deduplicated_mapping_size*\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cluster/stats?human&filter_path=indices.mappings.total_deduplicated_mapping_size*\"" } ] } @@ -5843,6 +7743,26 @@ { "lang": "Console", "source": "GET _cluster/stats?human&filter_path=indices.mappings.total_deduplicated_mapping_size*\n" + }, + { + "lang": "Python", + "source": "resp = client.cluster.stats(\n human=True,\n filter_path=\"indices.mappings.total_deduplicated_mapping_size*\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.stats({\n human: \"true\",\n filter_path: \"indices.mappings.total_deduplicated_mapping_size*\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.stats(\n human: \"true\",\n filter_path: \"indices.mappings.total_deduplicated_mapping_size*\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->stats([\n \"human\" => \"true\",\n \"filter_path\" => \"indices.mappings.total_deduplicated_mapping_size*\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cluster/stats?human&filter_path=indices.mappings.total_deduplicated_mapping_size*\"" } ] } @@ -5898,6 +7818,26 @@ { "lang": "Console", "source": "PUT _connector/my-connector/_check_in\n" + }, + { + "lang": "Python", + "source": "resp = client.connector.check_in(\n connector_id=\"my-connector\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.checkIn({\n connector_id: \"my-connector\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.check_in(\n connector_id: \"my-connector\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->checkIn([\n \"connector_id\" => \"my-connector\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/my-connector/_check_in\"" } ] } @@ -5950,6 +7890,26 @@ { "lang": "Console", "source": "GET _connector/my-connector-id\n" + }, + { + "lang": "Python", + "source": "resp = client.connector.get(\n connector_id=\"my-connector-id\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.get({\n connector_id: \"my-connector-id\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.get(\n connector_id: \"my-connector-id\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->get([\n \"connector_id\" => \"my-connector-id\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/my-connector-id\"" } ] }, @@ -5977,6 +7937,26 @@ { "lang": "Console", "source": "PUT _connector/my-connector\n{\n \"index_name\": \"search-google-drive\",\n \"name\": \"My Connector\",\n \"service_type\": \"google_drive\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.put(\n connector_id=\"my-connector\",\n index_name=\"search-google-drive\",\n name=\"My Connector\",\n service_type=\"google_drive\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.put({\n connector_id: \"my-connector\",\n index_name: \"search-google-drive\",\n name: \"My Connector\",\n service_type: \"google_drive\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.put(\n connector_id: \"my-connector\",\n body: {\n \"index_name\": \"search-google-drive\",\n \"name\": \"My Connector\",\n \"service_type\": \"google_drive\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->put([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"index_name\" => \"search-google-drive\",\n \"name\" => \"My Connector\",\n \"service_type\" => \"google_drive\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_name\":\"search-google-drive\",\"name\":\"My Connector\",\"service_type\":\"google_drive\"}' \"$ELASTICSEARCH_URL/_connector/my-connector\"" } ] }, @@ -6042,6 +8022,26 @@ { "lang": "Console", "source": "DELETE _connector/my-connector-id&delete_sync_jobs=true\n" + }, + { + "lang": "Python", + "source": "resp = client.connector.delete(\n connector_id=\"my-connector-id&delete_sync_jobs=true\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.delete({\n connector_id: \"my-connector-id&delete_sync_jobs=true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.delete(\n connector_id: \"my-connector-id&delete_sync_jobs=true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->delete([\n \"connector_id\" => \"my-connector-id&delete_sync_jobs=true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/my-connector-id&delete_sync_jobs=true\"" } ] } @@ -6158,6 +8158,26 @@ { "lang": "Console", "source": "GET _connector\n" + }, + { + "lang": "Python", + "source": "resp = client.connector.list()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.list();" + }, + { + "lang": "Ruby", + "source": "response = client.connector.list" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->list();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector\"" } ] }, @@ -6180,6 +8200,26 @@ { "lang": "Console", "source": "PUT _connector/my-connector\n{\n \"index_name\": \"search-google-drive\",\n \"name\": \"My Connector\",\n \"service_type\": \"google_drive\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.put(\n connector_id=\"my-connector\",\n index_name=\"search-google-drive\",\n name=\"My Connector\",\n service_type=\"google_drive\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.put({\n connector_id: \"my-connector\",\n index_name: \"search-google-drive\",\n name: \"My Connector\",\n service_type: \"google_drive\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.put(\n connector_id: \"my-connector\",\n body: {\n \"index_name\": \"search-google-drive\",\n \"name\": \"My Connector\",\n \"service_type\": \"google_drive\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->put([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"index_name\" => \"search-google-drive\",\n \"name\" => \"My Connector\",\n \"service_type\" => \"google_drive\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_name\":\"search-google-drive\",\"name\":\"My Connector\",\"service_type\":\"google_drive\"}' \"$ELASTICSEARCH_URL/_connector/my-connector\"" } ] }, @@ -6292,6 +8332,26 @@ { "lang": "Console", "source": "PUT _connector/_sync_job/my-connector-sync-job-id/_cancel\n" + }, + { + "lang": "Python", + "source": "resp = client.connector.sync_job_cancel(\n connector_sync_job_id=\"my-connector-sync-job-id\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.syncJobCancel({\n connector_sync_job_id: \"my-connector-sync-job-id\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.sync_job_cancel(\n connector_sync_job_id: \"my-connector-sync-job-id\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->syncJobCancel([\n \"connector_sync_job_id\" => \"my-connector-sync-job-id\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job-id/_cancel\"" } ] } @@ -6334,6 +8394,26 @@ { "lang": "Console", "source": "PUT _connector/_sync_job/my-connector-sync-job/_check_in\n" + }, + { + "lang": "Python", + "source": "resp = client.connector.sync_job_check_in(\n connector_sync_job_id=\"my-connector-sync-job\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.syncJobCheckIn({\n connector_sync_job_id: \"my-connector-sync-job\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.sync_job_check_in(\n connector_sync_job_id: \"my-connector-sync-job\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->syncJobCheckIn([\n \"connector_sync_job_id\" => \"my-connector-sync-job\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job/_check_in\"" } ] } @@ -6405,6 +8485,26 @@ { "lang": "Console", "source": "PUT _connector/_sync_job/my-connector-sync-job-id/_claim\n{\n \"worker_hostname\": \"some-machine\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.sync_job_claim(\n connector_sync_job_id=\"my-connector-sync-job-id\",\n worker_hostname=\"some-machine\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.syncJobClaim({\n connector_sync_job_id: \"my-connector-sync-job-id\",\n worker_hostname: \"some-machine\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.sync_job_claim(\n connector_sync_job_id: \"my-connector-sync-job-id\",\n body: {\n \"worker_hostname\": \"some-machine\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->syncJobClaim([\n \"connector_sync_job_id\" => \"my-connector-sync-job-id\",\n \"body\" => [\n \"worker_hostname\" => \"some-machine\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"worker_hostname\":\"some-machine\"}' \"$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job-id/_claim\"" } ] } @@ -6446,6 +8546,26 @@ { "lang": "Console", "source": "GET _connector/_sync_job/my-connector-sync-job\n" + }, + { + "lang": "Python", + "source": "resp = client.connector.sync_job_get(\n connector_sync_job_id=\"my-connector-sync-job\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.syncJobGet({\n connector_sync_job_id: \"my-connector-sync-job\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.sync_job_get(\n connector_sync_job_id: \"my-connector-sync-job\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->syncJobGet([\n \"connector_sync_job_id\" => \"my-connector-sync-job\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job\"" } ] }, @@ -6491,6 +8611,26 @@ { "lang": "Console", "source": "DELETE _connector/_sync_job/my-connector-sync-job-id\n" + }, + { + "lang": "Python", + "source": "resp = client.connector.sync_job_delete(\n connector_sync_job_id=\"my-connector-sync-job-id\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.syncJobDelete({\n connector_sync_job_id: \"my-connector-sync-job-id\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.sync_job_delete(\n connector_sync_job_id: \"my-connector-sync-job-id\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->syncJobDelete([\n \"connector_sync_job_id\" => \"my-connector-sync-job-id\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job-id\"" } ] } @@ -6557,6 +8697,26 @@ { "lang": "Console", "source": "PUT _connector/_sync_job/my-connector-sync-job/_error\n{\n \"error\": \"some-error\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.sync_job_error(\n connector_sync_job_id=\"my-connector-sync-job\",\n error=\"some-error\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.syncJobError({\n connector_sync_job_id: \"my-connector-sync-job\",\n error: \"some-error\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.sync_job_error(\n connector_sync_job_id: \"my-connector-sync-job\",\n body: {\n \"error\": \"some-error\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->syncJobError([\n \"connector_sync_job_id\" => \"my-connector-sync-job\",\n \"body\" => [\n \"error\" => \"some-error\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"error\":\"some-error\"}' \"$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job/_error\"" } ] } @@ -6663,6 +8823,26 @@ { "lang": "Console", "source": "GET _connector/_sync_job?connector_id=my-connector-id&size=1\n" + }, + { + "lang": "Python", + "source": "resp = client.connector.sync_job_list(\n connector_id=\"my-connector-id\",\n size=\"1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.syncJobList({\n connector_id: \"my-connector-id\",\n size: 1,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.sync_job_list(\n connector_id: \"my-connector-id\",\n size: \"1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->syncJobList([\n \"connector_id\" => \"my-connector-id\",\n \"size\" => \"1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/_sync_job?connector_id=my-connector-id&size=1\"" } ] }, @@ -6727,6 +8907,26 @@ { "lang": "Console", "source": "POST _connector/_sync_job\n{\n \"id\": \"connector-id\",\n \"job_type\": \"full\",\n \"trigger_method\": \"on_demand\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.sync_job_post(\n id=\"connector-id\",\n job_type=\"full\",\n trigger_method=\"on_demand\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.syncJobPost({\n id: \"connector-id\",\n job_type: \"full\",\n trigger_method: \"on_demand\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.sync_job_post(\n body: {\n \"id\": \"connector-id\",\n \"job_type\": \"full\",\n \"trigger_method\": \"on_demand\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->syncJobPost([\n \"body\" => [\n \"id\" => \"connector-id\",\n \"job_type\" => \"full\",\n \"trigger_method\" => \"on_demand\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"connector-id\",\"job_type\":\"full\",\"trigger_method\":\"on_demand\"}' \"$ELASTICSEARCH_URL/_connector/_sync_job\"" } ] } @@ -6814,6 +9014,26 @@ { "lang": "Console", "source": "PUT _connector/_sync_job/my-connector-sync-job/_stats\n{\n \"deleted_document_count\": 10,\n \"indexed_document_count\": 20,\n \"indexed_document_volume\": 1000,\n \"total_document_count\": 2000,\n \"last_seen\": \"2023-01-02T10:00:00Z\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.sync_job_update_stats(\n connector_sync_job_id=\"my-connector-sync-job\",\n deleted_document_count=10,\n indexed_document_count=20,\n indexed_document_volume=1000,\n total_document_count=2000,\n last_seen=\"2023-01-02T10:00:00Z\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.syncJobUpdateStats({\n connector_sync_job_id: \"my-connector-sync-job\",\n deleted_document_count: 10,\n indexed_document_count: 20,\n indexed_document_volume: 1000,\n total_document_count: 2000,\n last_seen: \"2023-01-02T10:00:00Z\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.sync_job_update_stats(\n connector_sync_job_id: \"my-connector-sync-job\",\n body: {\n \"deleted_document_count\": 10,\n \"indexed_document_count\": 20,\n \"indexed_document_volume\": 1000,\n \"total_document_count\": 2000,\n \"last_seen\": \"2023-01-02T10:00:00Z\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->syncJobUpdateStats([\n \"connector_sync_job_id\" => \"my-connector-sync-job\",\n \"body\" => [\n \"deleted_document_count\" => 10,\n \"indexed_document_count\" => 20,\n \"indexed_document_volume\" => 1000,\n \"total_document_count\" => 2000,\n \"last_seen\" => \"2023-01-02T10:00:00Z\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"deleted_document_count\":10,\"indexed_document_count\":20,\"indexed_document_volume\":1000,\"total_document_count\":2000,\"last_seen\":\"2023-01-02T10:00:00Z\"}' \"$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job/_stats\"" } ] } @@ -6936,6 +9156,26 @@ { "lang": "Console", "source": "PUT _connector/my-connector/_api_key_id\n{\n \"api_key_id\": \"my-api-key-id\",\n \"api_key_secret_id\": \"my-connector-secret-id\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.update_api_key_id(\n connector_id=\"my-connector\",\n api_key_id=\"my-api-key-id\",\n api_key_secret_id=\"my-connector-secret-id\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.updateApiKeyId({\n connector_id: \"my-connector\",\n api_key_id: \"my-api-key-id\",\n api_key_secret_id: \"my-connector-secret-id\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.update_api_key_id(\n connector_id: \"my-connector\",\n body: {\n \"api_key_id\": \"my-api-key-id\",\n \"api_key_secret_id\": \"my-connector-secret-id\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->updateApiKeyId([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"api_key_id\" => \"my-api-key-id\",\n \"api_key_secret_id\" => \"my-connector-secret-id\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"api_key_id\":\"my-api-key-id\",\"api_key_secret_id\":\"my-connector-secret-id\"}' \"$ELASTICSEARCH_URL/_connector/my-connector/_api_key_id\"" } ] } @@ -7020,6 +9260,26 @@ { "lang": "Console", "source": "PUT _connector/my-spo-connector/_configuration\n{\n \"values\": {\n \"tenant_id\": \"my-tenant-id\",\n \"tenant_name\": \"my-sharepoint-site\",\n \"client_id\": \"foo\",\n \"secret_value\": \"bar\",\n \"site_collections\": \"*\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.update_configuration(\n connector_id=\"my-spo-connector\",\n values={\n \"tenant_id\": \"my-tenant-id\",\n \"tenant_name\": \"my-sharepoint-site\",\n \"client_id\": \"foo\",\n \"secret_value\": \"bar\",\n \"site_collections\": \"*\"\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.updateConfiguration({\n connector_id: \"my-spo-connector\",\n values: {\n tenant_id: \"my-tenant-id\",\n tenant_name: \"my-sharepoint-site\",\n client_id: \"foo\",\n secret_value: \"bar\",\n site_collections: \"*\",\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.update_configuration(\n connector_id: \"my-spo-connector\",\n body: {\n \"values\": {\n \"tenant_id\": \"my-tenant-id\",\n \"tenant_name\": \"my-sharepoint-site\",\n \"client_id\": \"foo\",\n \"secret_value\": \"bar\",\n \"site_collections\": \"*\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->updateConfiguration([\n \"connector_id\" => \"my-spo-connector\",\n \"body\" => [\n \"values\" => [\n \"tenant_id\" => \"my-tenant-id\",\n \"tenant_name\" => \"my-sharepoint-site\",\n \"client_id\" => \"foo\",\n \"secret_value\" => \"bar\",\n \"site_collections\" => \"*\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"values\":{\"tenant_id\":\"my-tenant-id\",\"tenant_name\":\"my-sharepoint-site\",\"client_id\":\"foo\",\"secret_value\":\"bar\",\"site_collections\":\"*\"}}' \"$ELASTICSEARCH_URL/_connector/my-spo-connector/_configuration\"" } ] } @@ -7105,6 +9365,26 @@ { "lang": "Console", "source": "PUT _connector/my-connector/_error\n{\n \"error\": \"Houston, we have a problem!\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.update_error(\n connector_id=\"my-connector\",\n error=\"Houston, we have a problem!\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.updateError({\n connector_id: \"my-connector\",\n error: \"Houston, we have a problem!\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.update_error(\n connector_id: \"my-connector\",\n body: {\n \"error\": \"Houston, we have a problem!\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->updateError([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"error\" => \"Houston, we have a problem!\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"error\":\"Houston, we have a problem!\"}' \"$ELASTICSEARCH_URL/_connector/my-connector/_error\"" } ] } @@ -7186,6 +9466,26 @@ { "lang": "Console", "source": "PUT _connector/my-connector/_features\n{\n \"features\": {\n \"document_level_security\": {\n \"enabled\": true\n },\n \"incremental_sync\": {\n \"enabled\": true\n },\n \"sync_rules\": {\n \"advanced\": {\n \"enabled\": false\n },\n \"basic\": {\n \"enabled\": true\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.update_features(\n connector_id=\"my-connector\",\n features={\n \"document_level_security\": {\n \"enabled\": True\n },\n \"incremental_sync\": {\n \"enabled\": True\n },\n \"sync_rules\": {\n \"advanced\": {\n \"enabled\": False\n },\n \"basic\": {\n \"enabled\": True\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.updateFeatures({\n connector_id: \"my-connector\",\n features: {\n document_level_security: {\n enabled: true,\n },\n incremental_sync: {\n enabled: true,\n },\n sync_rules: {\n advanced: {\n enabled: false,\n },\n basic: {\n enabled: true,\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.update_features(\n connector_id: \"my-connector\",\n body: {\n \"features\": {\n \"document_level_security\": {\n \"enabled\": true\n },\n \"incremental_sync\": {\n \"enabled\": true\n },\n \"sync_rules\": {\n \"advanced\": {\n \"enabled\": false\n },\n \"basic\": {\n \"enabled\": true\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->updateFeatures([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"features\" => [\n \"document_level_security\" => [\n \"enabled\" => true,\n ],\n \"incremental_sync\" => [\n \"enabled\" => true,\n ],\n \"sync_rules\" => [\n \"advanced\" => [\n \"enabled\" => false,\n ],\n \"basic\" => [\n \"enabled\" => true,\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"features\":{\"document_level_security\":{\"enabled\":true},\"incremental_sync\":{\"enabled\":true},\"sync_rules\":{\"advanced\":{\"enabled\":false},\"basic\":{\"enabled\":true}}}}' \"$ELASTICSEARCH_URL/_connector/my-connector/_features\"" } ] } @@ -7276,6 +9576,26 @@ { "lang": "Console", "source": "PUT _connector/my-g-drive-connector/_filtering\n{\n \"rules\": [\n {\n \"field\": \"file_extension\",\n \"id\": \"exclude-txt-files\",\n \"order\": 0,\n \"policy\": \"exclude\",\n \"rule\": \"equals\",\n \"value\": \"txt\"\n },\n {\n \"field\": \"_\",\n \"id\": \"DEFAULT\",\n \"order\": 1,\n \"policy\": \"include\",\n \"rule\": \"regex\",\n \"value\": \".*\"\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.update_filtering(\n connector_id=\"my-g-drive-connector\",\n rules=[\n {\n \"field\": \"file_extension\",\n \"id\": \"exclude-txt-files\",\n \"order\": 0,\n \"policy\": \"exclude\",\n \"rule\": \"equals\",\n \"value\": \"txt\"\n },\n {\n \"field\": \"_\",\n \"id\": \"DEFAULT\",\n \"order\": 1,\n \"policy\": \"include\",\n \"rule\": \"regex\",\n \"value\": \".*\"\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.updateFiltering({\n connector_id: \"my-g-drive-connector\",\n rules: [\n {\n field: \"file_extension\",\n id: \"exclude-txt-files\",\n order: 0,\n policy: \"exclude\",\n rule: \"equals\",\n value: \"txt\",\n },\n {\n field: \"_\",\n id: \"DEFAULT\",\n order: 1,\n policy: \"include\",\n rule: \"regex\",\n value: \".*\",\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.update_filtering(\n connector_id: \"my-g-drive-connector\",\n body: {\n \"rules\": [\n {\n \"field\": \"file_extension\",\n \"id\": \"exclude-txt-files\",\n \"order\": 0,\n \"policy\": \"exclude\",\n \"rule\": \"equals\",\n \"value\": \"txt\"\n },\n {\n \"field\": \"_\",\n \"id\": \"DEFAULT\",\n \"order\": 1,\n \"policy\": \"include\",\n \"rule\": \"regex\",\n \"value\": \".*\"\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->updateFiltering([\n \"connector_id\" => \"my-g-drive-connector\",\n \"body\" => [\n \"rules\" => array(\n [\n \"field\" => \"file_extension\",\n \"id\" => \"exclude-txt-files\",\n \"order\" => 0,\n \"policy\" => \"exclude\",\n \"rule\" => \"equals\",\n \"value\" => \"txt\",\n ],\n [\n \"field\" => \"_\",\n \"id\" => \"DEFAULT\",\n \"order\" => 1,\n \"policy\" => \"include\",\n \"rule\" => \"regex\",\n \"value\" => \".*\",\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"rules\":[{\"field\":\"file_extension\",\"id\":\"exclude-txt-files\",\"order\":0,\"policy\":\"exclude\",\"rule\":\"equals\",\"value\":\"txt\"},{\"field\":\"_\",\"id\":\"DEFAULT\",\"order\":1,\"policy\":\"include\",\"rule\":\"regex\",\"value\":\".*\"}]}' \"$ELASTICSEARCH_URL/_connector/my-g-drive-connector/_filtering\"" } ] } @@ -7423,6 +9743,26 @@ { "lang": "Console", "source": "PUT _connector/my-connector/_index_name\n{\n \"index_name\": \"data-from-my-google-drive\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.update_index_name(\n connector_id=\"my-connector\",\n index_name=\"data-from-my-google-drive\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.updateIndexName({\n connector_id: \"my-connector\",\n index_name: \"data-from-my-google-drive\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.update_index_name(\n connector_id: \"my-connector\",\n body: {\n \"index_name\": \"data-from-my-google-drive\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->updateIndexName([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"index_name\" => \"data-from-my-google-drive\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_name\":\"data-from-my-google-drive\"}' \"$ELASTICSEARCH_URL/_connector/my-connector/_index_name\"" } ] } @@ -7500,6 +9840,26 @@ { "lang": "Console", "source": "PUT _connector/my-connector/_name\n{\n \"name\": \"Custom connector\",\n \"description\": \"This is my customized connector\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.update_name(\n connector_id=\"my-connector\",\n name=\"Custom connector\",\n description=\"This is my customized connector\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.updateName({\n connector_id: \"my-connector\",\n name: \"Custom connector\",\n description: \"This is my customized connector\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.update_name(\n connector_id: \"my-connector\",\n body: {\n \"name\": \"Custom connector\",\n \"description\": \"This is my customized connector\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->updateName([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"name\" => \"Custom connector\",\n \"description\" => \"This is my customized connector\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"name\":\"Custom connector\",\"description\":\"This is my customized connector\"}' \"$ELASTICSEARCH_URL/_connector/my-connector/_name\"" } ] } @@ -7639,6 +9999,26 @@ { "lang": "Console", "source": "PUT _connector/my-connector/_pipeline\n{\n \"pipeline\": {\n \"extract_binary_content\": true,\n \"name\": \"my-connector-pipeline\",\n \"reduce_whitespace\": true,\n \"run_ml_inference\": true\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.update_pipeline(\n connector_id=\"my-connector\",\n pipeline={\n \"extract_binary_content\": True,\n \"name\": \"my-connector-pipeline\",\n \"reduce_whitespace\": True,\n \"run_ml_inference\": True\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.updatePipeline({\n connector_id: \"my-connector\",\n pipeline: {\n extract_binary_content: true,\n name: \"my-connector-pipeline\",\n reduce_whitespace: true,\n run_ml_inference: true,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.update_pipeline(\n connector_id: \"my-connector\",\n body: {\n \"pipeline\": {\n \"extract_binary_content\": true,\n \"name\": \"my-connector-pipeline\",\n \"reduce_whitespace\": true,\n \"run_ml_inference\": true\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->updatePipeline([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"pipeline\" => [\n \"extract_binary_content\" => true,\n \"name\" => \"my-connector-pipeline\",\n \"reduce_whitespace\" => true,\n \"run_ml_inference\" => true,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"pipeline\":{\"extract_binary_content\":true,\"name\":\"my-connector-pipeline\",\"reduce_whitespace\":true,\"run_ml_inference\":true}}' \"$ELASTICSEARCH_URL/_connector/my-connector/_pipeline\"" } ] } @@ -7719,6 +10099,26 @@ { "lang": "Console", "source": "PUT _connector/my-connector/_scheduling\n{\n \"scheduling\": {\n \"access_control\": {\n \"enabled\": true,\n \"interval\": \"0 10 0 * * ?\"\n },\n \"full\": {\n \"enabled\": true,\n \"interval\": \"0 20 0 * * ?\"\n },\n \"incremental\": {\n \"enabled\": false,\n \"interval\": \"0 30 0 * * ?\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.update_scheduling(\n connector_id=\"my-connector\",\n scheduling={\n \"access_control\": {\n \"enabled\": True,\n \"interval\": \"0 10 0 * * ?\"\n },\n \"full\": {\n \"enabled\": True,\n \"interval\": \"0 20 0 * * ?\"\n },\n \"incremental\": {\n \"enabled\": False,\n \"interval\": \"0 30 0 * * ?\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.updateScheduling({\n connector_id: \"my-connector\",\n scheduling: {\n access_control: {\n enabled: true,\n interval: \"0 10 0 * * ?\",\n },\n full: {\n enabled: true,\n interval: \"0 20 0 * * ?\",\n },\n incremental: {\n enabled: false,\n interval: \"0 30 0 * * ?\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.update_scheduling(\n connector_id: \"my-connector\",\n body: {\n \"scheduling\": {\n \"access_control\": {\n \"enabled\": true,\n \"interval\": \"0 10 0 * * ?\"\n },\n \"full\": {\n \"enabled\": true,\n \"interval\": \"0 20 0 * * ?\"\n },\n \"incremental\": {\n \"enabled\": false,\n \"interval\": \"0 30 0 * * ?\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->updateScheduling([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"scheduling\" => [\n \"access_control\" => [\n \"enabled\" => true,\n \"interval\" => \"0 10 0 * * ?\",\n ],\n \"full\" => [\n \"enabled\" => true,\n \"interval\" => \"0 20 0 * * ?\",\n ],\n \"incremental\" => [\n \"enabled\" => false,\n \"interval\" => \"0 30 0 * * ?\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"scheduling\":{\"access_control\":{\"enabled\":true,\"interval\":\"0 10 0 * * ?\"},\"full\":{\"enabled\":true,\"interval\":\"0 20 0 * * ?\"},\"incremental\":{\"enabled\":false,\"interval\":\"0 30 0 * * ?\"}}}' \"$ELASTICSEARCH_URL/_connector/my-connector/_scheduling\"" } ] } @@ -7796,6 +10196,26 @@ { "lang": "Console", "source": "PUT _connector/my-connector/_service_type\n{\n \"service_type\": \"sharepoint_online\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.update_service_type(\n connector_id=\"my-connector\",\n service_type=\"sharepoint_online\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.updateServiceType({\n connector_id: \"my-connector\",\n service_type: \"sharepoint_online\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.update_service_type(\n connector_id: \"my-connector\",\n body: {\n \"service_type\": \"sharepoint_online\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->updateServiceType([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"service_type\" => \"sharepoint_online\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service_type\":\"sharepoint_online\"}' \"$ELASTICSEARCH_URL/_connector/my-connector/_service_type\"" } ] } @@ -7873,6 +10293,26 @@ { "lang": "Console", "source": "PUT _connector/my-connector/_status\n{\n \"status\": \"needs_configuration\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.update_status(\n connector_id=\"my-connector\",\n status=\"needs_configuration\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.updateStatus({\n connector_id: \"my-connector\",\n status: \"needs_configuration\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.update_status(\n connector_id: \"my-connector\",\n body: {\n \"status\": \"needs_configuration\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->updateStatus([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"status\" => \"needs_configuration\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"status\":\"needs_configuration\"}' \"$ELASTICSEARCH_URL/_connector/my-connector/_status\"" } ] } @@ -7941,6 +10381,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_count\n{\n \"query\" : {\n \"term\" : { \"user.id\" : \"kimchy\" }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.count(\n index=\"my-index-000001\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.count({\n index: \"my-index-000001\",\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.count(\n index: \"my-index-000001\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->count([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_count\"" } ] }, @@ -8007,6 +10467,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_count\n{\n \"query\" : {\n \"term\" : { \"user.id\" : \"kimchy\" }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.count(\n index=\"my-index-000001\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.count({\n index: \"my-index-000001\",\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.count(\n index: \"my-index-000001\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->count([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_count\"" } ] } @@ -8078,6 +10558,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_count\n{\n \"query\" : {\n \"term\" : { \"user.id\" : \"kimchy\" }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.count(\n index=\"my-index-000001\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.count({\n index: \"my-index-000001\",\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.count(\n index: \"my-index-000001\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->count([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_count\"" } ] }, @@ -8147,6 +10647,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_count\n{\n \"query\" : {\n \"term\" : { \"user.id\" : \"kimchy\" }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.count(\n index=\"my-index-000001\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.count({\n index: \"my-index-000001\",\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.count(\n index: \"my-index-000001\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->count([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_count\"" } ] } @@ -8222,6 +10742,26 @@ { "lang": "Console", "source": "PUT my-index-000001/_create/1\n{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.create(\n index=\"my-index-000001\",\n id=\"1\",\n document={\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.create({\n index: \"my-index-000001\",\n id: 1,\n document: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n message: \"GET /search HTTP/1.1 200 1070000\",\n user: {\n id: \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.create(\n index: \"my-index-000001\",\n id: \"1\",\n body: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->create([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"body\" => [\n \"@timestamp\" => \"2099-11-15T13:12:00\",\n \"message\" => \"GET /search HTTP/1.1 200 1070000\",\n \"user\" => [\n \"id\" => \"kimchy\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"@timestamp\":\"2099-11-15T13:12:00\",\"message\":\"GET /search HTTP/1.1 200 1070000\",\"user\":{\"id\":\"kimchy\"}}' \"$ELASTICSEARCH_URL/my-index-000001/_create/1\"" } ] }, @@ -8295,6 +10835,26 @@ { "lang": "Console", "source": "PUT my-index-000001/_create/1\n{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.create(\n index=\"my-index-000001\",\n id=\"1\",\n document={\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.create({\n index: \"my-index-000001\",\n id: 1,\n document: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n message: \"GET /search HTTP/1.1 200 1070000\",\n user: {\n id: \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.create(\n index: \"my-index-000001\",\n id: \"1\",\n body: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->create([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"body\" => [\n \"@timestamp\" => \"2099-11-15T13:12:00\",\n \"message\" => \"GET /search HTTP/1.1 200 1070000\",\n \"user\" => [\n \"id\" => \"kimchy\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"@timestamp\":\"2099-11-15T13:12:00\",\"message\":\"GET /search HTTP/1.1 200 1070000\",\"user\":{\"id\":\"kimchy\"}}' \"$ELASTICSEARCH_URL/my-index-000001/_create/1\"" } ] } @@ -8374,6 +10934,26 @@ { "lang": "Console", "source": "POST /_dangling/zmM4e0JtBkeUjiHD-MihPQ?accept_data_loss=true\n" + }, + { + "lang": "Python", + "source": "resp = client.dangling_indices.import_dangling_index(\n index_uuid=\"zmM4e0JtBkeUjiHD-MihPQ\",\n accept_data_loss=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.danglingIndices.importDanglingIndex({\n index_uuid: \"zmM4e0JtBkeUjiHD-MihPQ\",\n accept_data_loss: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.dangling_indices.import_dangling_index(\n index_uuid: \"zmM4e0JtBkeUjiHD-MihPQ\",\n accept_data_loss: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->danglingIndices()->importDanglingIndex([\n \"index_uuid\" => \"zmM4e0JtBkeUjiHD-MihPQ\",\n \"accept_data_loss\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_dangling/zmM4e0JtBkeUjiHD-MihPQ?accept_data_loss=true\"" } ] }, @@ -8445,6 +11025,26 @@ { "lang": "Console", "source": "DELETE /_dangling/?accept_data_loss=true\n" + }, + { + "lang": "Python", + "source": "resp = client.dangling_indices.delete_dangling_index(\n index_uuid=\"\",\n accept_data_loss=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.danglingIndices.deleteDanglingIndex({\n index_uuid: \"\",\n accept_data_loss: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.dangling_indices.delete_dangling_index(\n index_uuid: \"\",\n accept_data_loss: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->danglingIndices()->deleteDanglingIndex([\n \"index_uuid\" => \"\",\n \"accept_data_loss\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_dangling/?accept_data_loss=true\"" } ] } @@ -8490,6 +11090,26 @@ { "lang": "Console", "source": "GET /_dangling\n" + }, + { + "lang": "Python", + "source": "resp = client.dangling_indices.list_dangling_indices()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.danglingIndices.listDanglingIndices();" + }, + { + "lang": "Ruby", + "source": "response = client.dangling_indices.list_dangling_indices" + }, + { + "lang": "PHP", + "source": "$resp = $client->danglingIndices()->listDanglingIndices();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_dangling\"" } ] } @@ -8659,6 +11279,26 @@ { "lang": "Console", "source": "GET my-index-000001/_doc/1?stored_fields=tags,counter\n" + }, + { + "lang": "Python", + "source": "resp = client.get(\n index=\"my-index-000001\",\n id=\"1\",\n stored_fields=\"tags,counter\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.get({\n index: \"my-index-000001\",\n id: 1,\n stored_fields: \"tags,counter\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.get(\n index: \"my-index-000001\",\n id: \"1\",\n stored_fields: \"tags,counter\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->get([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"stored_fields\" => \"tags,counter\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_doc/1?stored_fields=tags,counter\"" } ] }, @@ -8728,6 +11368,26 @@ { "lang": "Console", "source": "POST my-index-000001/_doc/\n{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.index(\n index=\"my-index-000001\",\n document={\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.index({\n index: \"my-index-000001\",\n document: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n message: \"GET /search HTTP/1.1 200 1070000\",\n user: {\n id: \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.index(\n index: \"my-index-000001\",\n body: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->index([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"@timestamp\" => \"2099-11-15T13:12:00\",\n \"message\" => \"GET /search HTTP/1.1 200 1070000\",\n \"user\" => [\n \"id\" => \"kimchy\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"@timestamp\":\"2099-11-15T13:12:00\",\"message\":\"GET /search HTTP/1.1 200 1070000\",\"user\":{\"id\":\"kimchy\"}}' \"$ELASTICSEARCH_URL/my-index-000001/_doc/\"" } ] }, @@ -8797,6 +11457,26 @@ { "lang": "Console", "source": "POST my-index-000001/_doc/\n{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.index(\n index=\"my-index-000001\",\n document={\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.index({\n index: \"my-index-000001\",\n document: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n message: \"GET /search HTTP/1.1 200 1070000\",\n user: {\n id: \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.index(\n index: \"my-index-000001\",\n body: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->index([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"@timestamp\" => \"2099-11-15T13:12:00\",\n \"message\" => \"GET /search HTTP/1.1 200 1070000\",\n \"user\" => [\n \"id\" => \"kimchy\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"@timestamp\":\"2099-11-15T13:12:00\",\"message\":\"GET /search HTTP/1.1 200 1070000\",\"user\":{\"id\":\"kimchy\"}}' \"$ELASTICSEARCH_URL/my-index-000001/_doc/\"" } ] }, @@ -8933,6 +11613,26 @@ { "lang": "Console", "source": "DELETE /my-index-000001/_doc/1\n" + }, + { + "lang": "Python", + "source": "resp = client.delete(\n index=\"my-index-000001\",\n id=\"1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.delete({\n index: \"my-index-000001\",\n id: 1,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.delete(\n index: \"my-index-000001\",\n id: \"1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->delete([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_doc/1\"" } ] }, @@ -9079,6 +11779,26 @@ { "lang": "Console", "source": "HEAD my-index-000001/_doc/0\n" + }, + { + "lang": "Python", + "source": "resp = client.exists(\n index=\"my-index-000001\",\n id=\"0\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.exists({\n index: \"my-index-000001\",\n id: 0,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.exists(\n index: \"my-index-000001\",\n id: \"0\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->exists([\n \"index\" => \"my-index-000001\",\n \"id\" => \"0\",\n]);" + }, + { + "lang": "curl", + "source": "curl --head -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_doc/0\"" } ] } @@ -9528,6 +12248,26 @@ { "lang": "Console", "source": "POST /my-index-000001,my-index-000002/_delete_by_query\n{\n \"query\": {\n \"match_all\": {}\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.delete_by_query(\n index=\"my-index-000001,my-index-000002\",\n query={\n \"match_all\": {}\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.deleteByQuery({\n index: \"my-index-000001,my-index-000002\",\n query: {\n match_all: {},\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.delete_by_query(\n index: \"my-index-000001,my-index-000002\",\n body: {\n \"query\": {\n \"match_all\": {}\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->deleteByQuery([\n \"index\" => \"my-index-000001,my-index-000002\",\n \"body\" => [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"match_all\":{}}}' \"$ELASTICSEARCH_URL/my-index-000001,my-index-000002/_delete_by_query\"" } ] } @@ -9580,6 +12320,26 @@ { "lang": "Console", "source": "POST _delete_by_query/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1\n" + }, + { + "lang": "Python", + "source": "resp = client.delete_by_query_rethrottle(\n task_id=\"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second=\"-1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.deleteByQueryRethrottle({\n task_id: \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second: \"-1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.delete_by_query_rethrottle(\n task_id: \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second: \"-1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->deleteByQueryRethrottle([\n \"task_id\" => \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n \"requests_per_second\" => \"-1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_delete_by_query/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1\"" } ] } @@ -9646,6 +12406,26 @@ { "lang": "Console", "source": "GET _scripts/my-search-template\n" + }, + { + "lang": "Python", + "source": "resp = client.get_script(\n id=\"my-search-template\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.getScript({\n id: \"my-search-template\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.get_script(\n id: \"my-search-template\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->getScript([\n \"id\" => \"my-search-template\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_scripts/my-search-template\"" } ] }, @@ -9685,6 +12465,26 @@ { "lang": "Console", "source": "PUT _scripts/my-search-template\n{\n \"script\": {\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.put_script(\n id=\"my-search-template\",\n script={\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.putScript({\n id: \"my-search-template\",\n script: {\n lang: \"mustache\",\n source: {\n query: {\n match: {\n message: \"{{query_string}}\",\n },\n },\n from: \"{{from}}\",\n size: \"{{size}}\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.put_script(\n id: \"my-search-template\",\n body: {\n \"script\": {\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->putScript([\n \"id\" => \"my-search-template\",\n \"body\" => [\n \"script\" => [\n \"lang\" => \"mustache\",\n \"source\" => [\n \"query\" => [\n \"match\" => [\n \"message\" => \"{{query_string}}\",\n ],\n ],\n \"from\" => \"{{from}}\",\n \"size\" => \"{{size}}\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"lang\":\"mustache\",\"source\":{\"query\":{\"match\":{\"message\":\"{{query_string}}\"}},\"from\":\"{{from}}\",\"size\":\"{{size}}\"}}}' \"$ELASTICSEARCH_URL/_scripts/my-search-template\"" } ] }, @@ -9724,6 +12524,26 @@ { "lang": "Console", "source": "PUT _scripts/my-search-template\n{\n \"script\": {\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.put_script(\n id=\"my-search-template\",\n script={\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.putScript({\n id: \"my-search-template\",\n script: {\n lang: \"mustache\",\n source: {\n query: {\n match: {\n message: \"{{query_string}}\",\n },\n },\n from: \"{{from}}\",\n size: \"{{size}}\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.put_script(\n id: \"my-search-template\",\n body: {\n \"script\": {\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->putScript([\n \"id\" => \"my-search-template\",\n \"body\" => [\n \"script\" => [\n \"lang\" => \"mustache\",\n \"source\" => [\n \"query\" => [\n \"match\" => [\n \"message\" => \"{{query_string}}\",\n ],\n ],\n \"from\" => \"{{from}}\",\n \"size\" => \"{{size}}\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"lang\":\"mustache\",\"source\":{\"query\":{\"match\":{\"message\":\"{{query_string}}\"}},\"from\":\"{{from}}\",\"size\":\"{{size}}\"}}}' \"$ELASTICSEARCH_URL/_scripts/my-search-template\"" } ] }, @@ -9783,6 +12603,26 @@ { "lang": "Console", "source": "DELETE _scripts/my-search-template\n" + }, + { + "lang": "Python", + "source": "resp = client.delete_script(\n id=\"my-search-template\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.deleteScript({\n id: \"my-search-template\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.delete_script(\n id: \"my-search-template\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->deleteScript([\n \"id\" => \"my-search-template\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_scripts/my-search-template\"" } ] } @@ -9813,6 +12653,26 @@ { "lang": "Console", "source": "GET /_enrich/policy/my-policy\n" + }, + { + "lang": "Python", + "source": "resp = client.enrich.get_policy(\n name=\"my-policy\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.enrich.getPolicy({\n name: \"my-policy\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.enrich.get_policy(\n name: \"my-policy\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->enrich()->getPolicy([\n \"name\" => \"my-policy\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_enrich/policy/my-policy\"" } ] }, @@ -9890,6 +12750,26 @@ { "lang": "Console", "source": "PUT /_enrich/policy/postal_policy\n{\n \"geo_match\": {\n \"indices\": \"postal_codes\",\n \"match_field\": \"location\",\n \"enrich_fields\": [ \"location\", \"postal_code\" ]\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.enrich.put_policy(\n name=\"postal_policy\",\n geo_match={\n \"indices\": \"postal_codes\",\n \"match_field\": \"location\",\n \"enrich_fields\": [\n \"location\",\n \"postal_code\"\n ]\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.enrich.putPolicy({\n name: \"postal_policy\",\n geo_match: {\n indices: \"postal_codes\",\n match_field: \"location\",\n enrich_fields: [\"location\", \"postal_code\"],\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.enrich.put_policy(\n name: \"postal_policy\",\n body: {\n \"geo_match\": {\n \"indices\": \"postal_codes\",\n \"match_field\": \"location\",\n \"enrich_fields\": [\n \"location\",\n \"postal_code\"\n ]\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->enrich()->putPolicy([\n \"name\" => \"postal_policy\",\n \"body\" => [\n \"geo_match\" => [\n \"indices\" => \"postal_codes\",\n \"match_field\" => \"location\",\n \"enrich_fields\" => array(\n \"location\",\n \"postal_code\",\n ),\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"geo_match\":{\"indices\":\"postal_codes\",\"match_field\":\"location\",\"enrich_fields\":[\"location\",\"postal_code\"]}}' \"$ELASTICSEARCH_URL/_enrich/policy/postal_policy\"" } ] }, @@ -9940,6 +12820,26 @@ { "lang": "Console", "source": "DELETE /_enrich/policy/my-policy\n" + }, + { + "lang": "Python", + "source": "resp = client.enrich.delete_policy(\n name=\"my-policy\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.enrich.deletePolicy({\n name: \"my-policy\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.enrich.delete_policy(\n name: \"my-policy\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->enrich()->deletePolicy([\n \"name\" => \"my-policy\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_enrich/policy/my-policy\"" } ] } @@ -10010,6 +12910,26 @@ { "lang": "Console", "source": "PUT /_enrich/policy/my-policy/_execute?wait_for_completion=false\n" + }, + { + "lang": "Python", + "source": "resp = client.enrich.execute_policy(\n name=\"my-policy\",\n wait_for_completion=False,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.enrich.executePolicy({\n name: \"my-policy\",\n wait_for_completion: \"false\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.enrich.execute_policy(\n name: \"my-policy\",\n wait_for_completion: \"false\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->enrich()->executePolicy([\n \"name\" => \"my-policy\",\n \"wait_for_completion\" => \"false\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_enrich/policy/my-policy/_execute?wait_for_completion=false\"" } ] } @@ -10037,6 +12957,26 @@ { "lang": "Console", "source": "GET /_enrich/policy/my-policy\n" + }, + { + "lang": "Python", + "source": "resp = client.enrich.get_policy(\n name=\"my-policy\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.enrich.getPolicy({\n name: \"my-policy\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.enrich.get_policy(\n name: \"my-policy\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->enrich()->getPolicy([\n \"name\" => \"my-policy\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_enrich/policy/my-policy\"" } ] } @@ -10105,6 +13045,26 @@ { "lang": "Console", "source": "GET /_enrich/_stats\n" + }, + { + "lang": "Python", + "source": "resp = client.enrich.stats()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.enrich.stats();" + }, + { + "lang": "Ruby", + "source": "response = client.enrich.stats" + }, + { + "lang": "PHP", + "source": "$resp = $client->enrich()->stats();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_enrich/_stats\"" } ] } @@ -10167,6 +13127,26 @@ { "lang": "Console", "source": "GET /_eql/search/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=?wait_for_completion_timeout=2s\n" + }, + { + "lang": "Python", + "source": "resp = client.eql.get(\n id=\"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n wait_for_completion_timeout=\"2s\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.eql.get({\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n wait_for_completion_timeout: \"2s\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.eql.get(\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n wait_for_completion_timeout: \"2s\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->eql()->get([\n \"id\" => \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n \"wait_for_completion_timeout\" => \"2s\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_eql/search/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=?wait_for_completion_timeout=2s\"" } ] }, @@ -10207,6 +13187,26 @@ { "lang": "Console", "source": "DELETE /_eql/search/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\n" + }, + { + "lang": "Python", + "source": "resp = client.eql.delete(\n id=\"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.eql.delete({\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.eql.delete(\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->eql()->delete([\n \"id\" => \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_eql/search/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\"" } ] } @@ -10283,6 +13283,26 @@ { "lang": "Console", "source": "GET /_eql/search/status/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\n" + }, + { + "lang": "Python", + "source": "resp = client.eql.get_status(\n id=\"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.eql.getStatus({\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.eql.get_status(\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->eql()->getStatus([\n \"id\" => \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_eql/search/status/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\"" } ] } @@ -10340,6 +13360,26 @@ { "lang": "Console", "source": "GET /my-data-stream/_eql/search\n{\n \"query\": \"\"\"\n process where (process.name == \"cmd.exe\" and process.pid != 2013)\n \"\"\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.eql.search(\n index=\"my-data-stream\",\n query=\"\\n process where (process.name == \\\"cmd.exe\\\" and process.pid != 2013)\\n \",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.eql.search({\n index: \"my-data-stream\",\n query:\n '\\n process where (process.name == \"cmd.exe\" and process.pid != 2013)\\n ',\n});" + }, + { + "lang": "Ruby", + "source": "response = client.eql.search(\n index: \"my-data-stream\",\n body: {\n \"query\": \"\\n process where (process.name == \\\"cmd.exe\\\" and process.pid != 2013)\\n \"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->eql()->search([\n \"index\" => \"my-data-stream\",\n \"body\" => [\n \"query\" => \"\\n process where (process.name == \\\"cmd.exe\\\" and process.pid != 2013)\\n \",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":\"\\n process where (process.name == \\\"cmd.exe\\\" and process.pid != 2013)\\n \"}' \"$ELASTICSEARCH_URL/my-data-stream/_eql/search\"" } ] }, @@ -10395,6 +13435,26 @@ { "lang": "Console", "source": "GET /my-data-stream/_eql/search\n{\n \"query\": \"\"\"\n process where (process.name == \"cmd.exe\" and process.pid != 2013)\n \"\"\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.eql.search(\n index=\"my-data-stream\",\n query=\"\\n process where (process.name == \\\"cmd.exe\\\" and process.pid != 2013)\\n \",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.eql.search({\n index: \"my-data-stream\",\n query:\n '\\n process where (process.name == \"cmd.exe\" and process.pid != 2013)\\n ',\n});" + }, + { + "lang": "Ruby", + "source": "response = client.eql.search(\n index: \"my-data-stream\",\n body: {\n \"query\": \"\\n process where (process.name == \\\"cmd.exe\\\" and process.pid != 2013)\\n \"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->eql()->search([\n \"index\" => \"my-data-stream\",\n \"body\" => [\n \"query\" => \"\\n process where (process.name == \\\"cmd.exe\\\" and process.pid != 2013)\\n \",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":\"\\n process where (process.name == \\\"cmd.exe\\\" and process.pid != 2013)\\n \"}' \"$ELASTICSEARCH_URL/my-data-stream/_eql/search\"" } ] } @@ -10551,6 +13611,26 @@ { "lang": "Console", "source": "POST /_query/async\n{\n \"query\": \"\"\"\n FROM library,remote-*:library\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n | STATS MAX(page_count) BY year\n | SORT year\n | LIMIT 5\n \"\"\",\n \"wait_for_completion_timeout\": \"2s\",\n \"include_ccs_metadata\": true\n}" + }, + { + "lang": "Python", + "source": "resp = client.esql.async_query(\n query=\"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\n wait_for_completion_timeout=\"2s\",\n include_ccs_metadata=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.esql.asyncQuery({\n query:\n \"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\n wait_for_completion_timeout: \"2s\",\n include_ccs_metadata: true,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.esql.async_query(\n body: {\n \"query\": \"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\n \"wait_for_completion_timeout\": \"2s\",\n \"include_ccs_metadata\": true\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->esql()->asyncQuery([\n \"body\" => [\n \"query\" => \"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\n \"wait_for_completion_timeout\" => \"2s\",\n \"include_ccs_metadata\" => true,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":\"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\"wait_for_completion_timeout\":\"2s\",\"include_ccs_metadata\":true}' \"$ELASTICSEARCH_URL/_query/async\"" } ] } @@ -10626,6 +13706,26 @@ { "lang": "Console", "source": "GET /_query/async/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=?wait_for_completion_timeout=30s\n" + }, + { + "lang": "Python", + "source": "resp = client.esql.async_query_get(\n id=\"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n wait_for_completion_timeout=\"30s\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.esql.asyncQueryGet({\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n wait_for_completion_timeout: \"30s\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.esql.async_query_get(\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n wait_for_completion_timeout: \"30s\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->esql()->asyncQueryGet([\n \"id\" => \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n \"wait_for_completion_timeout\" => \"30s\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query/async/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=?wait_for_completion_timeout=30s\"" } ] }, @@ -10669,6 +13769,26 @@ { "lang": "Console", "source": "DELETE /_query/async/FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\n" + }, + { + "lang": "Python", + "source": "resp = client.esql.async_query_delete(\n id=\"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.esql.asyncQueryDelete({\n id: \"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.esql.async_query_delete(\n id: \"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->esql()->asyncQueryDelete([\n \"id\" => \"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query/async/FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\"" } ] } @@ -10724,6 +13844,26 @@ { "lang": "Console", "source": "POST /_query/async/FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=/stop\n" + }, + { + "lang": "Python", + "source": "resp = client.esql.async_query_stop(\n id=\"FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.esql.asyncQueryStop({\n id: \"FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.esql.async_query_stop(\n id: \"FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->esql()->asyncQueryStop([\n \"id\" => \"FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query/async/FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=/stop\"" } ] } @@ -10847,6 +13987,26 @@ { "lang": "Console", "source": "POST /_query\n{\n \"query\": \"\"\"\n FROM library,remote-*:library\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n | STATS MAX(page_count) BY year\n | SORT year\n | LIMIT 5\n \"\"\",\n \"include_ccs_metadata\": true\n}" + }, + { + "lang": "Python", + "source": "resp = client.esql.query(\n query=\"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\n include_ccs_metadata=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.esql.query({\n query:\n \"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\n include_ccs_metadata: true,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.esql.query(\n body: {\n \"query\": \"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\n \"include_ccs_metadata\": true\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->esql()->query([\n \"body\" => [\n \"query\" => \"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\n \"include_ccs_metadata\" => true,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":\"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\"include_ccs_metadata\":true}' \"$ELASTICSEARCH_URL/_query\"" } ] } @@ -11002,6 +14162,26 @@ { "lang": "Console", "source": "GET my-index-000001/_source/1\n" + }, + { + "lang": "Python", + "source": "resp = client.get_source(\n index=\"my-index-000001\",\n id=\"1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.getSource({\n index: \"my-index-000001\",\n id: 1,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.get_source(\n index: \"my-index-000001\",\n id: \"1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->getSource([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_source/1\"" } ] }, @@ -11142,6 +14322,26 @@ { "lang": "Console", "source": "HEAD my-index-000001/_source/1\n" + }, + { + "lang": "Python", + "source": "resp = client.exists_source(\n index=\"my-index-000001\",\n id=\"1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.existsSource({\n index: \"my-index-000001\",\n id: 1,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.exists_source(\n index: \"my-index-000001\",\n id: \"1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->existsSource([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n]);" + }, + { + "lang": "curl", + "source": "curl --head -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_source/1\"" } ] } @@ -11210,6 +14410,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_explain/0\n{\n \"query\" : {\n \"match\" : { \"message\" : \"elasticsearch\" }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.explain(\n index=\"my-index-000001\",\n id=\"0\",\n query={\n \"match\": {\n \"message\": \"elasticsearch\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.explain({\n index: \"my-index-000001\",\n id: 0,\n query: {\n match: {\n message: \"elasticsearch\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.explain(\n index: \"my-index-000001\",\n id: \"0\",\n body: {\n \"query\": {\n \"match\": {\n \"message\": \"elasticsearch\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->explain([\n \"index\" => \"my-index-000001\",\n \"id\" => \"0\",\n \"body\" => [\n \"query\" => [\n \"match\" => [\n \"message\" => \"elasticsearch\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"match\":{\"message\":\"elasticsearch\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_explain/0\"" } ] }, @@ -11276,6 +14496,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_explain/0\n{\n \"query\" : {\n \"match\" : { \"message\" : \"elasticsearch\" }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.explain(\n index=\"my-index-000001\",\n id=\"0\",\n query={\n \"match\": {\n \"message\": \"elasticsearch\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.explain({\n index: \"my-index-000001\",\n id: 0,\n query: {\n match: {\n message: \"elasticsearch\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.explain(\n index: \"my-index-000001\",\n id: \"0\",\n body: {\n \"query\": {\n \"match\": {\n \"message\": \"elasticsearch\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->explain([\n \"index\" => \"my-index-000001\",\n \"id\" => \"0\",\n \"body\" => [\n \"query\" => [\n \"match\" => [\n \"message\" => \"elasticsearch\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"match\":{\"message\":\"elasticsearch\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_explain/0\"" } ] } @@ -11337,6 +14577,26 @@ { "lang": "Console", "source": "GET _features\n" + }, + { + "lang": "Python", + "source": "resp = client.features.get_features()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.features.getFeatures();" + }, + { + "lang": "Ruby", + "source": "response = client.features.get_features" + }, + { + "lang": "PHP", + "source": "$resp = $client->features()->getFeatures();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_features\"" } ] } @@ -11395,6 +14655,26 @@ { "lang": "Console", "source": "POST /_features/_reset\n" + }, + { + "lang": "Python", + "source": "resp = client.features.reset_features()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.features.resetFeatures();" + }, + { + "lang": "Ruby", + "source": "response = client.features.reset_features" + }, + { + "lang": "PHP", + "source": "$resp = $client->features()->resetFeatures();" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_features/_reset\"" } ] } @@ -11446,6 +14726,26 @@ { "lang": "Console", "source": "POST my-index-*/_field_caps?fields=rating\n{\n \"index_filter\": {\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.field_caps(\n index=\"my-index-*\",\n fields=\"rating\",\n index_filter={\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.fieldCaps({\n index: \"my-index-*\",\n fields: \"rating\",\n index_filter: {\n range: {\n \"@timestamp\": {\n gte: \"2018\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.field_caps(\n index: \"my-index-*\",\n fields: \"rating\",\n body: {\n \"index_filter\": {\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->fieldCaps([\n \"index\" => \"my-index-*\",\n \"fields\" => \"rating\",\n \"body\" => [\n \"index_filter\" => [\n \"range\" => [\n \"@timestamp\" => [\n \"gte\" => \"2018\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_filter\":{\"range\":{\"@timestamp\":{\"gte\":\"2018\"}}}}' \"$ELASTICSEARCH_URL/my-index-*/_field_caps?fields=rating\"" } ] }, @@ -11495,6 +14795,26 @@ { "lang": "Console", "source": "POST my-index-*/_field_caps?fields=rating\n{\n \"index_filter\": {\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.field_caps(\n index=\"my-index-*\",\n fields=\"rating\",\n index_filter={\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.fieldCaps({\n index: \"my-index-*\",\n fields: \"rating\",\n index_filter: {\n range: {\n \"@timestamp\": {\n gte: \"2018\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.field_caps(\n index: \"my-index-*\",\n fields: \"rating\",\n body: {\n \"index_filter\": {\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->fieldCaps([\n \"index\" => \"my-index-*\",\n \"fields\" => \"rating\",\n \"body\" => [\n \"index_filter\" => [\n \"range\" => [\n \"@timestamp\" => [\n \"gte\" => \"2018\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_filter\":{\"range\":{\"@timestamp\":{\"gte\":\"2018\"}}}}' \"$ELASTICSEARCH_URL/my-index-*/_field_caps?fields=rating\"" } ] } @@ -11549,6 +14869,26 @@ { "lang": "Console", "source": "POST my-index-*/_field_caps?fields=rating\n{\n \"index_filter\": {\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.field_caps(\n index=\"my-index-*\",\n fields=\"rating\",\n index_filter={\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.fieldCaps({\n index: \"my-index-*\",\n fields: \"rating\",\n index_filter: {\n range: {\n \"@timestamp\": {\n gte: \"2018\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.field_caps(\n index: \"my-index-*\",\n fields: \"rating\",\n body: {\n \"index_filter\": {\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->fieldCaps([\n \"index\" => \"my-index-*\",\n \"fields\" => \"rating\",\n \"body\" => [\n \"index_filter\" => [\n \"range\" => [\n \"@timestamp\" => [\n \"gte\" => \"2018\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_filter\":{\"range\":{\"@timestamp\":{\"gte\":\"2018\"}}}}' \"$ELASTICSEARCH_URL/my-index-*/_field_caps?fields=rating\"" } ] }, @@ -11601,6 +14941,26 @@ { "lang": "Console", "source": "POST my-index-*/_field_caps?fields=rating\n{\n \"index_filter\": {\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.field_caps(\n index=\"my-index-*\",\n fields=\"rating\",\n index_filter={\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.fieldCaps({\n index: \"my-index-*\",\n fields: \"rating\",\n index_filter: {\n range: {\n \"@timestamp\": {\n gte: \"2018\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.field_caps(\n index: \"my-index-*\",\n fields: \"rating\",\n body: {\n \"index_filter\": {\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->fieldCaps([\n \"index\" => \"my-index-*\",\n \"fields\" => \"rating\",\n \"body\" => [\n \"index_filter\" => [\n \"range\" => [\n \"@timestamp\" => [\n \"gte\" => \"2018\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_filter\":{\"range\":{\"@timestamp\":{\"gte\":\"2018\"}}}}' \"$ELASTICSEARCH_URL/my-index-*/_field_caps?fields=rating\"" } ] } @@ -12287,6 +15647,26 @@ { "lang": "Console", "source": "GET _script_context\n" + }, + { + "lang": "Python", + "source": "resp = client.get_script_context()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.getScriptContext();" + }, + { + "lang": "Ruby", + "source": "response = client.get_script_context" + }, + { + "lang": "PHP", + "source": "$resp = $client->getScriptContext();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_script_context\"" } ] } @@ -12333,6 +15713,26 @@ { "lang": "Console", "source": "GET _script_language\n" + }, + { + "lang": "Python", + "source": "resp = client.get_script_languages()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.getScriptLanguages();" + }, + { + "lang": "Ruby", + "source": "response = client.get_script_languages" + }, + { + "lang": "PHP", + "source": "$resp = $client->getScriptLanguages();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_script_language\"" } ] } @@ -12371,6 +15771,26 @@ { "lang": "Console", "source": "POST clicklogs/_graph/explore\n{\n \"query\": {\n \"match\": {\n \"query.raw\": \"midi\"\n }\n },\n \"vertices\": [\n {\n \"field\": \"product\"\n }\n ],\n \"connections\": {\n \"vertices\": [\n {\n \"field\": \"query.raw\"\n }\n ]\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.graph.explore(\n index=\"clicklogs\",\n query={\n \"match\": {\n \"query.raw\": \"midi\"\n }\n },\n vertices=[\n {\n \"field\": \"product\"\n }\n ],\n connections={\n \"vertices\": [\n {\n \"field\": \"query.raw\"\n }\n ]\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.graph.explore({\n index: \"clicklogs\",\n query: {\n match: {\n \"query.raw\": \"midi\",\n },\n },\n vertices: [\n {\n field: \"product\",\n },\n ],\n connections: {\n vertices: [\n {\n field: \"query.raw\",\n },\n ],\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.graph.explore(\n index: \"clicklogs\",\n body: {\n \"query\": {\n \"match\": {\n \"query.raw\": \"midi\"\n }\n },\n \"vertices\": [\n {\n \"field\": \"product\"\n }\n ],\n \"connections\": {\n \"vertices\": [\n {\n \"field\": \"query.raw\"\n }\n ]\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->graph()->explore([\n \"index\" => \"clicklogs\",\n \"body\" => [\n \"query\" => [\n \"match\" => [\n \"query.raw\" => \"midi\",\n ],\n ],\n \"vertices\" => array(\n [\n \"field\" => \"product\",\n ],\n ),\n \"connections\" => [\n \"vertices\" => array(\n [\n \"field\" => \"query.raw\",\n ],\n ),\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"match\":{\"query.raw\":\"midi\"}},\"vertices\":[{\"field\":\"product\"}],\"connections\":{\"vertices\":[{\"field\":\"query.raw\"}]}}' \"$ELASTICSEARCH_URL/clicklogs/_graph/explore\"" } ] }, @@ -12407,6 +15827,26 @@ { "lang": "Console", "source": "POST clicklogs/_graph/explore\n{\n \"query\": {\n \"match\": {\n \"query.raw\": \"midi\"\n }\n },\n \"vertices\": [\n {\n \"field\": \"product\"\n }\n ],\n \"connections\": {\n \"vertices\": [\n {\n \"field\": \"query.raw\"\n }\n ]\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.graph.explore(\n index=\"clicklogs\",\n query={\n \"match\": {\n \"query.raw\": \"midi\"\n }\n },\n vertices=[\n {\n \"field\": \"product\"\n }\n ],\n connections={\n \"vertices\": [\n {\n \"field\": \"query.raw\"\n }\n ]\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.graph.explore({\n index: \"clicklogs\",\n query: {\n match: {\n \"query.raw\": \"midi\",\n },\n },\n vertices: [\n {\n field: \"product\",\n },\n ],\n connections: {\n vertices: [\n {\n field: \"query.raw\",\n },\n ],\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.graph.explore(\n index: \"clicklogs\",\n body: {\n \"query\": {\n \"match\": {\n \"query.raw\": \"midi\"\n }\n },\n \"vertices\": [\n {\n \"field\": \"product\"\n }\n ],\n \"connections\": {\n \"vertices\": [\n {\n \"field\": \"query.raw\"\n }\n ]\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->graph()->explore([\n \"index\" => \"clicklogs\",\n \"body\" => [\n \"query\" => [\n \"match\" => [\n \"query.raw\" => \"midi\",\n ],\n ],\n \"vertices\" => array(\n [\n \"field\" => \"product\",\n ],\n ),\n \"connections\" => [\n \"vertices\" => array(\n [\n \"field\" => \"query.raw\",\n ],\n ),\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"match\":{\"query.raw\":\"midi\"}},\"vertices\":[{\"field\":\"product\"}],\"connections\":{\"vertices\":[{\"field\":\"query.raw\"}]}}' \"$ELASTICSEARCH_URL/clicklogs/_graph/explore\"" } ] } @@ -12440,6 +15880,26 @@ { "lang": "Console", "source": "GET _health_report\n" + }, + { + "lang": "Python", + "source": "resp = client.health_report()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.healthReport();" + }, + { + "lang": "Ruby", + "source": "response = client.health_report" + }, + { + "lang": "PHP", + "source": "$resp = $client->healthReport();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_health_report\"" } ] } @@ -12476,6 +15936,26 @@ { "lang": "Console", "source": "GET _health_report\n" + }, + { + "lang": "Python", + "source": "resp = client.health_report()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.healthReport();" + }, + { + "lang": "Ruby", + "source": "response = client.health_report" + }, + { + "lang": "PHP", + "source": "$resp = $client->healthReport();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_health_report\"" } ] } @@ -12509,6 +15989,26 @@ { "lang": "Console", "source": "GET _ilm/policy/my_policy\n" + }, + { + "lang": "Python", + "source": "resp = client.ilm.get_lifecycle(\n name=\"my_policy\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ilm.getLifecycle({\n name: \"my_policy\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ilm.get_lifecycle(\n policy: \"my_policy\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ilm()->getLifecycle([\n \"policy\" => \"my_policy\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ilm/policy/my_policy\"" } ] }, @@ -12598,6 +16098,26 @@ { "lang": "Console", "source": "PUT _ilm/policy/my_policy\n{\n \"policy\": {\n \"_meta\": {\n \"description\": \"used for nginx log\",\n \"project\": {\n \"name\": \"myProject\",\n \"department\": \"myDepartment\"\n }\n },\n \"phases\": {\n \"warm\": {\n \"min_age\": \"10d\",\n \"actions\": {\n \"forcemerge\": {\n \"max_num_segments\": 1\n }\n }\n },\n \"delete\": {\n \"min_age\": \"30d\",\n \"actions\": {\n \"delete\": {}\n }\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ilm.put_lifecycle(\n name=\"my_policy\",\n policy={\n \"_meta\": {\n \"description\": \"used for nginx log\",\n \"project\": {\n \"name\": \"myProject\",\n \"department\": \"myDepartment\"\n }\n },\n \"phases\": {\n \"warm\": {\n \"min_age\": \"10d\",\n \"actions\": {\n \"forcemerge\": {\n \"max_num_segments\": 1\n }\n }\n },\n \"delete\": {\n \"min_age\": \"30d\",\n \"actions\": {\n \"delete\": {}\n }\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ilm.putLifecycle({\n name: \"my_policy\",\n policy: {\n _meta: {\n description: \"used for nginx log\",\n project: {\n name: \"myProject\",\n department: \"myDepartment\",\n },\n },\n phases: {\n warm: {\n min_age: \"10d\",\n actions: {\n forcemerge: {\n max_num_segments: 1,\n },\n },\n },\n delete: {\n min_age: \"30d\",\n actions: {\n delete: {},\n },\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ilm.put_lifecycle(\n policy: \"my_policy\",\n body: {\n \"policy\": {\n \"_meta\": {\n \"description\": \"used for nginx log\",\n \"project\": {\n \"name\": \"myProject\",\n \"department\": \"myDepartment\"\n }\n },\n \"phases\": {\n \"warm\": {\n \"min_age\": \"10d\",\n \"actions\": {\n \"forcemerge\": {\n \"max_num_segments\": 1\n }\n }\n },\n \"delete\": {\n \"min_age\": \"30d\",\n \"actions\": {\n \"delete\": {}\n }\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ilm()->putLifecycle([\n \"policy\" => \"my_policy\",\n \"body\" => [\n \"policy\" => [\n \"_meta\" => [\n \"description\" => \"used for nginx log\",\n \"project\" => [\n \"name\" => \"myProject\",\n \"department\" => \"myDepartment\",\n ],\n ],\n \"phases\" => [\n \"warm\" => [\n \"min_age\" => \"10d\",\n \"actions\" => [\n \"forcemerge\" => [\n \"max_num_segments\" => 1,\n ],\n ],\n ],\n \"delete\" => [\n \"min_age\" => \"30d\",\n \"actions\" => [\n \"delete\" => new ArrayObject([]),\n ],\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"policy\":{\"_meta\":{\"description\":\"used for nginx log\",\"project\":{\"name\":\"myProject\",\"department\":\"myDepartment\"}},\"phases\":{\"warm\":{\"min_age\":\"10d\",\"actions\":{\"forcemerge\":{\"max_num_segments\":1}}},\"delete\":{\"min_age\":\"30d\",\"actions\":{\"delete\":{}}}}}}' \"$ELASTICSEARCH_URL/_ilm/policy/my_policy\"" } ] }, @@ -12664,6 +16184,26 @@ { "lang": "Console", "source": "DELETE _ilm/policy/my_policy\n" + }, + { + "lang": "Python", + "source": "resp = client.ilm.delete_lifecycle(\n name=\"my_policy\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ilm.deleteLifecycle({\n name: \"my_policy\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ilm.delete_lifecycle(\n policy: \"my_policy\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ilm()->deleteLifecycle([\n \"policy\" => \"my_policy\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ilm/policy/my_policy\"" } ] } @@ -12753,6 +16293,26 @@ { "lang": "Console", "source": "GET .ds-timeseries-*/_ilm/explain\n" + }, + { + "lang": "Python", + "source": "resp = client.ilm.explain_lifecycle(\n index=\".ds-timeseries-*\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ilm.explainLifecycle({\n index: \".ds-timeseries-*\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ilm.explain_lifecycle(\n index: \".ds-timeseries-*\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ilm()->explainLifecycle([\n \"index\" => \".ds-timeseries-*\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/.ds-timeseries-*/_ilm/explain\"" } ] } @@ -12783,6 +16343,26 @@ { "lang": "Console", "source": "GET _ilm/policy/my_policy\n" + }, + { + "lang": "Python", + "source": "resp = client.ilm.get_lifecycle(\n name=\"my_policy\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ilm.getLifecycle({\n name: \"my_policy\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ilm.get_lifecycle(\n policy: \"my_policy\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ilm()->getLifecycle([\n \"policy\" => \"my_policy\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ilm/policy/my_policy\"" } ] } @@ -12826,6 +16406,26 @@ { "lang": "Console", "source": "GET _ilm/status\n" + }, + { + "lang": "Python", + "source": "resp = client.ilm.get_status()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ilm.getStatus();" + }, + { + "lang": "Ruby", + "source": "response = client.ilm.get_status" + }, + { + "lang": "PHP", + "source": "$resp = $client->ilm()->getStatus();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ilm/status\"" } ] } @@ -12958,6 +16558,26 @@ { "lang": "Console", "source": "POST /_ilm/migrate_to_data_tiers\n{\n \"legacy_template_to_delete\": \"global-template\",\n \"node_attribute\": \"custom_attribute_name\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ilm.migrate_to_data_tiers(\n legacy_template_to_delete=\"global-template\",\n node_attribute=\"custom_attribute_name\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ilm.migrateToDataTiers({\n legacy_template_to_delete: \"global-template\",\n node_attribute: \"custom_attribute_name\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ilm.migrate_to_data_tiers(\n body: {\n \"legacy_template_to_delete\": \"global-template\",\n \"node_attribute\": \"custom_attribute_name\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ilm()->migrateToDataTiers([\n \"body\" => [\n \"legacy_template_to_delete\" => \"global-template\",\n \"node_attribute\" => \"custom_attribute_name\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"legacy_template_to_delete\":\"global-template\",\"node_attribute\":\"custom_attribute_name\"}' \"$ELASTICSEARCH_URL/_ilm/migrate_to_data_tiers\"" } ] } @@ -13039,6 +16659,26 @@ { "lang": "Console", "source": "POST _ilm/move/my-index-000001\n{\n \"current_step\": {\n \"phase\": \"new\",\n \"action\": \"complete\",\n \"name\": \"complete\"\n },\n \"next_step\": {\n \"phase\": \"warm\",\n \"action\": \"forcemerge\",\n \"name\": \"forcemerge\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ilm.move_to_step(\n index=\"my-index-000001\",\n current_step={\n \"phase\": \"new\",\n \"action\": \"complete\",\n \"name\": \"complete\"\n },\n next_step={\n \"phase\": \"warm\",\n \"action\": \"forcemerge\",\n \"name\": \"forcemerge\"\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ilm.moveToStep({\n index: \"my-index-000001\",\n current_step: {\n phase: \"new\",\n action: \"complete\",\n name: \"complete\",\n },\n next_step: {\n phase: \"warm\",\n action: \"forcemerge\",\n name: \"forcemerge\",\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ilm.move_to_step(\n index: \"my-index-000001\",\n body: {\n \"current_step\": {\n \"phase\": \"new\",\n \"action\": \"complete\",\n \"name\": \"complete\"\n },\n \"next_step\": {\n \"phase\": \"warm\",\n \"action\": \"forcemerge\",\n \"name\": \"forcemerge\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ilm()->moveToStep([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"current_step\" => [\n \"phase\" => \"new\",\n \"action\" => \"complete\",\n \"name\" => \"complete\",\n ],\n \"next_step\" => [\n \"phase\" => \"warm\",\n \"action\" => \"forcemerge\",\n \"name\" => \"forcemerge\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"current_step\":{\"phase\":\"new\",\"action\":\"complete\",\"name\":\"complete\"},\"next_step\":{\"phase\":\"warm\",\"action\":\"forcemerge\",\"name\":\"forcemerge\"}}' \"$ELASTICSEARCH_URL/_ilm/move/my-index-000001\"" } ] } @@ -13102,6 +16742,26 @@ { "lang": "Console", "source": "POST logs-my_app-default/_ilm/remove\n" + }, + { + "lang": "Python", + "source": "resp = client.ilm.remove_policy(\n index=\"logs-my_app-default\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ilm.removePolicy({\n index: \"logs-my_app-default\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ilm.remove_policy(\n index: \"logs-my_app-default\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ilm()->removePolicy([\n \"index\" => \"logs-my_app-default\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/logs-my_app-default/_ilm/remove\"" } ] } @@ -13144,6 +16804,26 @@ { "lang": "Console", "source": "POST /my-index-000001/_ilm/retry\n" + }, + { + "lang": "Python", + "source": "resp = client.ilm.retry(\n index=\"my-index-000001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ilm.retry({\n index: \"my-index-000001\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ilm.retry(\n index: \"my-index-000001\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ilm()->retry([\n \"index\" => \"my-index-000001\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_ilm/retry\"" } ] } @@ -13201,6 +16881,26 @@ { "lang": "Console", "source": "POST _ilm/start\n" + }, + { + "lang": "Python", + "source": "resp = client.ilm.start()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ilm.start();" + }, + { + "lang": "Ruby", + "source": "response = client.ilm.start" + }, + { + "lang": "PHP", + "source": "$resp = $client->ilm()->start();" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ilm/start\"" } ] } @@ -13258,6 +16958,26 @@ { "lang": "Console", "source": "POST _ilm/stop\n" + }, + { + "lang": "Python", + "source": "resp = client.ilm.stop()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ilm.stop();" + }, + { + "lang": "Ruby", + "source": "response = client.ilm.stop" + }, + { + "lang": "PHP", + "source": "$resp = $client->ilm()->stop();" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ilm/stop\"" } ] } @@ -13326,6 +17046,26 @@ { "lang": "Console", "source": "POST my-index-000001/_doc/\n{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.index(\n index=\"my-index-000001\",\n document={\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.index({\n index: \"my-index-000001\",\n document: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n message: \"GET /search HTTP/1.1 200 1070000\",\n user: {\n id: \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.index(\n index: \"my-index-000001\",\n body: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->index([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"@timestamp\" => \"2099-11-15T13:12:00\",\n \"message\" => \"GET /search HTTP/1.1 200 1070000\",\n \"user\" => [\n \"id\" => \"kimchy\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"@timestamp\":\"2099-11-15T13:12:00\",\"message\":\"GET /search HTTP/1.1 200 1070000\",\"user\":{\"id\":\"kimchy\"}}' \"$ELASTICSEARCH_URL/my-index-000001/_doc/\"" } ] } @@ -13454,6 +17194,26 @@ { "lang": "Console", "source": "PUT /my-index-000001/_block/write\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.add_block(\n index=\"my-index-000001\",\n block=\"write\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.addBlock({\n index: \"my-index-000001\",\n block: \"write\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.add_block(\n index: \"my-index-000001\",\n block: \"write\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->addBlock([\n \"index\" => \"my-index-000001\",\n \"block\" => \"write\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_block/write\"" } ] } @@ -13486,6 +17246,26 @@ { "lang": "Console", "source": "GET /_analyze\n{\n \"analyzer\": \"standard\",\n \"text\": \"this is a test\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.analyze(\n analyzer=\"standard\",\n text=\"this is a test\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.analyze({\n analyzer: \"standard\",\n text: \"this is a test\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.analyze(\n body: {\n \"analyzer\": \"standard\",\n \"text\": \"this is a test\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->analyze([\n \"body\" => [\n \"analyzer\" => \"standard\",\n \"text\" => \"this is a test\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"analyzer\":\"standard\",\"text\":\"this is a test\"}' \"$ELASTICSEARCH_URL/_analyze\"" } ] }, @@ -13516,6 +17296,26 @@ { "lang": "Console", "source": "GET /_analyze\n{\n \"analyzer\": \"standard\",\n \"text\": \"this is a test\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.analyze(\n analyzer=\"standard\",\n text=\"this is a test\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.analyze({\n analyzer: \"standard\",\n text: \"this is a test\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.analyze(\n body: {\n \"analyzer\": \"standard\",\n \"text\": \"this is a test\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->analyze([\n \"body\" => [\n \"analyzer\" => \"standard\",\n \"text\" => \"this is a test\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"analyzer\":\"standard\",\"text\":\"this is a test\"}' \"$ELASTICSEARCH_URL/_analyze\"" } ] } @@ -13551,6 +17351,26 @@ { "lang": "Console", "source": "GET /_analyze\n{\n \"analyzer\": \"standard\",\n \"text\": \"this is a test\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.analyze(\n analyzer=\"standard\",\n text=\"this is a test\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.analyze({\n analyzer: \"standard\",\n text: \"this is a test\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.analyze(\n body: {\n \"analyzer\": \"standard\",\n \"text\": \"this is a test\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->analyze([\n \"body\" => [\n \"analyzer\" => \"standard\",\n \"text\" => \"this is a test\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"analyzer\":\"standard\",\"text\":\"this is a test\"}' \"$ELASTICSEARCH_URL/_analyze\"" } ] }, @@ -13584,6 +17404,26 @@ { "lang": "Console", "source": "GET /_analyze\n{\n \"analyzer\": \"standard\",\n \"text\": \"this is a test\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.analyze(\n analyzer=\"standard\",\n text=\"this is a test\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.analyze({\n analyzer: \"standard\",\n text: \"this is a test\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.analyze(\n body: {\n \"analyzer\": \"standard\",\n \"text\": \"this is a test\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->analyze([\n \"body\" => [\n \"analyzer\" => \"standard\",\n \"text\" => \"this is a test\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"analyzer\":\"standard\",\"text\":\"this is a test\"}' \"$ELASTICSEARCH_URL/_analyze\"" } ] } @@ -13626,6 +17466,26 @@ { "lang": "Console", "source": "POST /_migration/reindex/my-data-stream/_cancel\n" + }, + { + "lang": "Python", + "source": "resp = client.perform_request(\n \"POST\",\n \"/_migration/reindex/my-data-stream/_cancel\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transport.request({\n method: \"POST\",\n path: \"/_migration/reindex/my-data-stream/_cancel\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.perform_request(\n \"POST\",\n \"/_migration/reindex/my-data-stream/_cancel\",\n {},\n)" + }, + { + "lang": "PHP", + "source": "$requestFactory = Psr17FactoryDiscovery::findRequestFactory();\n$request = $requestFactory->createRequest(\n \"POST\",\n \"/_migration/reindex/my-data-stream/_cancel\",\n);\n$resp = $client->sendRequest($request);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_migration/reindex/my-data-stream/_cancel\"" } ] } @@ -13673,6 +17533,26 @@ { "lang": "Console", "source": "POST /my-index-000001,my-index-000002/_cache/clear?request=true\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.clear_cache(\n index=\"my-index-000001,my-index-000002\",\n request=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.clearCache({\n index: \"my-index-000001,my-index-000002\",\n request: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.clear_cache(\n index: \"my-index-000001,my-index-000002\",\n request: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->clearCache([\n \"index\" => \"my-index-000001,my-index-000002\",\n \"request\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001,my-index-000002/_cache/clear?request=true\"" } ] } @@ -13723,6 +17603,26 @@ { "lang": "Console", "source": "POST /my-index-000001,my-index-000002/_cache/clear?request=true\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.clear_cache(\n index=\"my-index-000001,my-index-000002\",\n request=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.clearCache({\n index: \"my-index-000001,my-index-000002\",\n request: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.clear_cache(\n index: \"my-index-000001,my-index-000002\",\n request: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->clearCache([\n \"index\" => \"my-index-000001,my-index-000002\",\n \"request\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001,my-index-000002/_cache/clear?request=true\"" } ] } @@ -13765,6 +17665,26 @@ { "lang": "Console", "source": "POST /my_source_index/_clone/my_target_index\n{\n \"settings\": {\n \"index.number_of_shards\": 5\n },\n \"aliases\": {\n \"my_search_indices\": {}\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.clone(\n index=\"my_source_index\",\n target=\"my_target_index\",\n settings={\n \"index.number_of_shards\": 5\n },\n aliases={\n \"my_search_indices\": {}\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.clone({\n index: \"my_source_index\",\n target: \"my_target_index\",\n settings: {\n \"index.number_of_shards\": 5,\n },\n aliases: {\n my_search_indices: {},\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.clone(\n index: \"my_source_index\",\n target: \"my_target_index\",\n body: {\n \"settings\": {\n \"index.number_of_shards\": 5\n },\n \"aliases\": {\n \"my_search_indices\": {}\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->clone([\n \"index\" => \"my_source_index\",\n \"target\" => \"my_target_index\",\n \"body\" => [\n \"settings\" => [\n \"index.number_of_shards\" => 5,\n ],\n \"aliases\" => [\n \"my_search_indices\" => new ArrayObject([]),\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"settings\":{\"index.number_of_shards\":5},\"aliases\":{\"my_search_indices\":{}}}' \"$ELASTICSEARCH_URL/my_source_index/_clone/my_target_index\"" } ] }, @@ -13805,6 +17725,26 @@ { "lang": "Console", "source": "POST /my_source_index/_clone/my_target_index\n{\n \"settings\": {\n \"index.number_of_shards\": 5\n },\n \"aliases\": {\n \"my_search_indices\": {}\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.clone(\n index=\"my_source_index\",\n target=\"my_target_index\",\n settings={\n \"index.number_of_shards\": 5\n },\n aliases={\n \"my_search_indices\": {}\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.clone({\n index: \"my_source_index\",\n target: \"my_target_index\",\n settings: {\n \"index.number_of_shards\": 5,\n },\n aliases: {\n my_search_indices: {},\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.clone(\n index: \"my_source_index\",\n target: \"my_target_index\",\n body: {\n \"settings\": {\n \"index.number_of_shards\": 5\n },\n \"aliases\": {\n \"my_search_indices\": {}\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->clone([\n \"index\" => \"my_source_index\",\n \"target\" => \"my_target_index\",\n \"body\" => [\n \"settings\" => [\n \"index.number_of_shards\" => 5,\n ],\n \"aliases\" => [\n \"my_search_indices\" => new ArrayObject([]),\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"settings\":{\"index.number_of_shards\":5},\"aliases\":{\"my_search_indices\":{}}}' \"$ELASTICSEARCH_URL/my_source_index/_clone/my_target_index\"" } ] } @@ -13931,6 +17871,26 @@ { "lang": "Console", "source": "POST /my-index-00001/_close\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.close(\n index=\"my-index-00001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.close({\n index: \"my-index-00001\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.close(\n index: \"my-index-00001\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->close([\n \"index\" => \"my-index-00001\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-00001/_close\"" } ] } @@ -14055,6 +18015,26 @@ { "lang": "Console", "source": "GET /my-index-000001\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get(\n index=\"my-index-000001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.get({\n index: \"my-index-000001\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get(\n index: \"my-index-000001\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->get([\n \"index\" => \"my-index-000001\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001\"" } ] }, @@ -14181,6 +18161,26 @@ { "lang": "Console", "source": "PUT /my-index-000001\n{\n \"settings\": {\n \"number_of_shards\": 3,\n \"number_of_replicas\": 2\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.create(\n index=\"my-index-000001\",\n settings={\n \"number_of_shards\": 3,\n \"number_of_replicas\": 2\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.create({\n index: \"my-index-000001\",\n settings: {\n number_of_shards: 3,\n number_of_replicas: 2,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.create(\n index: \"my-index-000001\",\n body: {\n \"settings\": {\n \"number_of_shards\": 3,\n \"number_of_replicas\": 2\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->create([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"settings\" => [\n \"number_of_shards\" => 3,\n \"number_of_replicas\" => 2,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"settings\":{\"number_of_shards\":3,\"number_of_replicas\":2}}' \"$ELASTICSEARCH_URL/my-index-000001\"" } ] }, @@ -14270,6 +18270,26 @@ { "lang": "Console", "source": "DELETE /books\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.delete(\n index=\"books\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.delete({\n index: \"books\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.delete(\n index: \"books\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->delete([\n \"index\" => \"books\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/books\"" } ] }, @@ -14365,6 +18385,26 @@ { "lang": "Console", "source": "HEAD my-data-stream\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.exists(\n index=\"my-data-stream\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.exists({\n index: \"my-data-stream\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.exists(\n index: \"my-data-stream\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->exists([\n \"index\" => \"my-data-stream\",\n]);" + }, + { + "lang": "curl", + "source": "curl --head -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-data-stream\"" } ] } @@ -14404,6 +18444,26 @@ { "lang": "Console", "source": "GET _data_stream/my-data-stream\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_data_stream(\n name=\"my-data-stream\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getDataStream({\n name: \"my-data-stream\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_data_stream(\n name: \"my-data-stream\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getDataStream([\n \"name\" => \"my-data-stream\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/my-data-stream\"" } ] }, @@ -14464,6 +18524,26 @@ { "lang": "Console", "source": "PUT _data_stream/logs-foo-bar\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.create_data_stream(\n name=\"logs-foo-bar\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.createDataStream({\n name: \"logs-foo-bar\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.create_data_stream(\n name: \"logs-foo-bar\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->createDataStream([\n \"name\" => \"logs-foo-bar\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/logs-foo-bar\"" } ] }, @@ -14524,6 +18604,26 @@ { "lang": "Console", "source": "DELETE _data_stream/my-data-stream\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.delete_data_stream(\n name=\"my-data-stream\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.deleteDataStream({\n name: \"my-data-stream\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.delete_data_stream(\n name: \"my-data-stream\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->deleteDataStream([\n \"name\" => \"my-data-stream\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/my-data-stream\"" } ] } @@ -14557,6 +18657,26 @@ { "lang": "Console", "source": "POST _create_from/my-index/my-new-index\n" + }, + { + "lang": "Python", + "source": "resp = client.perform_request(\n \"POST\",\n \"/_create_from/my-index/my-new-index\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transport.request({\n method: \"POST\",\n path: \"/_create_from/my-index/my-new-index\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.perform_request(\n \"POST\",\n \"/_create_from/my-index/my-new-index\",\n {},\n)" + }, + { + "lang": "PHP", + "source": "$requestFactory = Psr17FactoryDiscovery::findRequestFactory();\n$request = $requestFactory->createRequest(\n \"POST\",\n \"/_create_from/my-index/my-new-index\",\n);\n$resp = $client->sendRequest($request);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_create_from/my-index/my-new-index\"" } ] }, @@ -14588,6 +18708,26 @@ { "lang": "Console", "source": "POST _create_from/my-index/my-new-index\n" + }, + { + "lang": "Python", + "source": "resp = client.perform_request(\n \"POST\",\n \"/_create_from/my-index/my-new-index\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transport.request({\n method: \"POST\",\n path: \"/_create_from/my-index/my-new-index\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.perform_request(\n \"POST\",\n \"/_create_from/my-index/my-new-index\",\n {},\n)" + }, + { + "lang": "PHP", + "source": "$requestFactory = Psr17FactoryDiscovery::findRequestFactory();\n$request = $requestFactory->createRequest(\n \"POST\",\n \"/_create_from/my-index/my-new-index\",\n);\n$resp = $client->sendRequest($request);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_create_from/my-index/my-new-index\"" } ] } @@ -14615,6 +18755,26 @@ { "lang": "Console", "source": "GET /_data_stream/my-index-000001/_stats\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.data_streams_stats(\n name=\"my-index-000001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.dataStreamsStats({\n name: \"my-index-000001\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.data_streams_stats(\n name: \"my-index-000001\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->dataStreamsStats([\n \"name\" => \"my-index-000001\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/my-index-000001/_stats\"" } ] } @@ -14645,6 +18805,26 @@ { "lang": "Console", "source": "GET /_data_stream/my-index-000001/_stats\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.data_streams_stats(\n name=\"my-index-000001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.dataStreamsStats({\n name: \"my-index-000001\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.data_streams_stats(\n name: \"my-index-000001\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->dataStreamsStats([\n \"name\" => \"my-index-000001\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/my-index-000001/_stats\"" } ] } @@ -14686,6 +18866,26 @@ { "lang": "Console", "source": "GET _alias\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_alias()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getAlias();" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_alias" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getAlias();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_alias\"" } ] }, @@ -14722,6 +18922,26 @@ { "lang": "Console", "source": "POST _aliases\n{\n \"actions\": [\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.update_aliases(\n actions=[\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.updateAliases({\n actions: [\n {\n add: {\n index: \"my-data-stream\",\n alias: \"my-alias\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.update_aliases(\n body: {\n \"actions\": [\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->updateAliases([\n \"body\" => [\n \"actions\" => array(\n [\n \"add\" => [\n \"index\" => \"my-data-stream\",\n \"alias\" => \"my-alias\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"actions\":[{\"add\":{\"index\":\"my-data-stream\",\"alias\":\"my-alias\"}}]}' \"$ELASTICSEARCH_URL/_aliases\"" } ] }, @@ -14758,6 +18978,26 @@ { "lang": "Console", "source": "POST _aliases\n{\n \"actions\": [\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.update_aliases(\n actions=[\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.updateAliases({\n actions: [\n {\n add: {\n index: \"my-data-stream\",\n alias: \"my-alias\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.update_aliases(\n body: {\n \"actions\": [\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->updateAliases([\n \"body\" => [\n \"actions\" => array(\n [\n \"add\" => [\n \"index\" => \"my-data-stream\",\n \"alias\" => \"my-alias\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"actions\":[{\"add\":{\"index\":\"my-data-stream\",\"alias\":\"my-alias\"}}]}' \"$ELASTICSEARCH_URL/_aliases\"" } ] }, @@ -14791,6 +19031,26 @@ { "lang": "Console", "source": "DELETE my-data-stream/_alias/my-alias\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.delete_alias(\n index=\"my-data-stream\",\n name=\"my-alias\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.deleteAlias({\n index: \"my-data-stream\",\n name: \"my-alias\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.delete_alias(\n index: \"my-data-stream\",\n name: \"my-alias\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->deleteAlias([\n \"index\" => \"my-data-stream\",\n \"name\" => \"my-alias\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-data-stream/_alias/my-alias\"" } ] }, @@ -14830,6 +19090,26 @@ { "lang": "Console", "source": "HEAD _alias/my-alias\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.exists_alias(\n name=\"my-alias\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.existsAlias({\n name: \"my-alias\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.exists_alias(\n name: \"my-alias\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->existsAlias([\n \"name\" => \"my-alias\",\n]);" + }, + { + "lang": "curl", + "source": "curl --head -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_alias/my-alias\"" } ] } @@ -14868,6 +19148,26 @@ { "lang": "Console", "source": "POST _aliases\n{\n \"actions\": [\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.update_aliases(\n actions=[\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.updateAliases({\n actions: [\n {\n add: {\n index: \"my-data-stream\",\n alias: \"my-alias\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.update_aliases(\n body: {\n \"actions\": [\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->updateAliases([\n \"body\" => [\n \"actions\" => array(\n [\n \"add\" => [\n \"index\" => \"my-data-stream\",\n \"alias\" => \"my-alias\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"actions\":[{\"add\":{\"index\":\"my-data-stream\",\"alias\":\"my-alias\"}}]}' \"$ELASTICSEARCH_URL/_aliases\"" } ] }, @@ -14904,6 +19204,26 @@ { "lang": "Console", "source": "POST _aliases\n{\n \"actions\": [\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.update_aliases(\n actions=[\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.updateAliases({\n actions: [\n {\n add: {\n index: \"my-data-stream\",\n alias: \"my-alias\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.update_aliases(\n body: {\n \"actions\": [\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->updateAliases([\n \"body\" => [\n \"actions\" => array(\n [\n \"add\" => [\n \"index\" => \"my-data-stream\",\n \"alias\" => \"my-alias\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"actions\":[{\"add\":{\"index\":\"my-data-stream\",\"alias\":\"my-alias\"}}]}' \"$ELASTICSEARCH_URL/_aliases\"" } ] }, @@ -14937,6 +19257,26 @@ { "lang": "Console", "source": "DELETE my-data-stream/_alias/my-alias\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.delete_alias(\n index=\"my-data-stream\",\n name=\"my-alias\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.deleteAlias({\n index: \"my-data-stream\",\n name: \"my-alias\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.delete_alias(\n index: \"my-data-stream\",\n name: \"my-alias\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->deleteAlias([\n \"index\" => \"my-data-stream\",\n \"name\" => \"my-alias\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-data-stream/_alias/my-alias\"" } ] } @@ -15026,6 +19366,26 @@ { "lang": "Console", "source": "GET /_data_stream/{name}/_lifecycle?human&pretty\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_data_lifecycle(\n name=\"{name}\",\n human=True,\n pretty=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getDataLifecycle({\n name: \"{name}\",\n human: \"true\",\n pretty: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_data_lifecycle(\n name: \"{name}\",\n human: \"true\",\n pretty: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getDataLifecycle([\n \"name\" => \"{name}\",\n \"human\" => \"true\",\n \"pretty\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/%7Bname%7D/_lifecycle?human&pretty\"" } ] }, @@ -15134,6 +19494,26 @@ { "lang": "Console", "source": "PUT _data_stream/my-data-stream/_lifecycle\n{\n \"data_retention\": \"7d\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.put_data_lifecycle(\n name=\"my-data-stream\",\n data_retention=\"7d\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.putDataLifecycle({\n name: \"my-data-stream\",\n data_retention: \"7d\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.put_data_lifecycle(\n name: \"my-data-stream\",\n body: {\n \"data_retention\": \"7d\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->putDataLifecycle([\n \"name\" => \"my-data-stream\",\n \"body\" => [\n \"data_retention\" => \"7d\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"data_retention\":\"7d\"}' \"$ELASTICSEARCH_URL/_data_stream/my-data-stream/_lifecycle\"" } ] }, @@ -15210,6 +19590,26 @@ { "lang": "Console", "source": "DELETE _data_stream/my-data-stream/_lifecycle\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.delete_data_lifecycle(\n name=\"my-data-stream\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.deleteDataLifecycle({\n name: \"my-data-stream\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.delete_data_lifecycle(\n name: \"my-data-stream\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->deleteDataLifecycle([\n \"name\" => \"my-data-stream\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/my-data-stream/_lifecycle\"" } ] } @@ -15249,6 +19649,26 @@ { "lang": "Console", "source": "GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_index_template(\n name=\"*\",\n filter_path=\"index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getIndexTemplate({\n name: \"*\",\n filter_path:\n \"index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_index_template(\n name: \"*\",\n filter_path: \"index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getIndexTemplate([\n \"name\" => \"*\",\n \"filter_path\" => \"index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\"" } ] }, @@ -15286,6 +19706,26 @@ { "lang": "Console", "source": "PUT /_index_template/template_1\n{\n \"index_patterns\" : [\"template*\"],\n \"priority\" : 1,\n \"template\": {\n \"settings\" : {\n \"number_of_shards\" : 2\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.put_index_template(\n name=\"template_1\",\n index_patterns=[\n \"template*\"\n ],\n priority=1,\n template={\n \"settings\": {\n \"number_of_shards\": 2\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.putIndexTemplate({\n name: \"template_1\",\n index_patterns: [\"template*\"],\n priority: 1,\n template: {\n settings: {\n number_of_shards: 2,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.put_index_template(\n name: \"template_1\",\n body: {\n \"index_patterns\": [\n \"template*\"\n ],\n \"priority\": 1,\n \"template\": {\n \"settings\": {\n \"number_of_shards\": 2\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->putIndexTemplate([\n \"name\" => \"template_1\",\n \"body\" => [\n \"index_patterns\" => array(\n \"template*\",\n ),\n \"priority\" => 1,\n \"template\" => [\n \"settings\" => [\n \"number_of_shards\" => 2,\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_patterns\":[\"template*\"],\"priority\":1,\"template\":{\"settings\":{\"number_of_shards\":2}}}' \"$ELASTICSEARCH_URL/_index_template/template_1\"" } ] }, @@ -15323,6 +19763,26 @@ { "lang": "Console", "source": "PUT /_index_template/template_1\n{\n \"index_patterns\" : [\"template*\"],\n \"priority\" : 1,\n \"template\": {\n \"settings\" : {\n \"number_of_shards\" : 2\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.put_index_template(\n name=\"template_1\",\n index_patterns=[\n \"template*\"\n ],\n priority=1,\n template={\n \"settings\": {\n \"number_of_shards\": 2\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.putIndexTemplate({\n name: \"template_1\",\n index_patterns: [\"template*\"],\n priority: 1,\n template: {\n settings: {\n number_of_shards: 2,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.put_index_template(\n name: \"template_1\",\n body: {\n \"index_patterns\": [\n \"template*\"\n ],\n \"priority\": 1,\n \"template\": {\n \"settings\": {\n \"number_of_shards\": 2\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->putIndexTemplate([\n \"name\" => \"template_1\",\n \"body\" => [\n \"index_patterns\" => array(\n \"template*\",\n ),\n \"priority\" => 1,\n \"template\" => [\n \"settings\" => [\n \"number_of_shards\" => 2,\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_patterns\":[\"template*\"],\"priority\":1,\"template\":{\"settings\":{\"number_of_shards\":2}}}' \"$ELASTICSEARCH_URL/_index_template/template_1\"" } ] }, @@ -15383,6 +19843,26 @@ { "lang": "Console", "source": "DELETE /_index_template/my-index-template\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.delete_index_template(\n name=\"my-index-template\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.deleteIndexTemplate({\n name: \"my-index-template\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.delete_index_template(\n name: \"my-index-template\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->deleteIndexTemplate([\n \"name\" => \"my-index-template\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_index_template/my-index-template\"" } ] }, @@ -15481,47 +19961,30 @@ { "lang": "Console", "source": "GET /_template/.monitoring-*\n" - } - ] - }, - "put": { - "tags": [ - "indices" - ], - "summary": "Create or update a legacy index template", - "description": "Index templates define settings, mappings, and aliases that can be applied automatically to new indices.\nElasticsearch applies templates to new indices based on an index pattern that matches the index name.\n\nIMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.\n\nComposable templates always take precedence over legacy templates.\nIf no composable template matches a new index, matching legacy templates are applied according to their order.\n\nIndex templates are only applied during index creation.\nChanges to index templates do not affect existing indices.\nSettings and mappings specified in create index API requests override any settings or mappings specified in an index template.\n\nYou can use C-style `/* *\\/` block comments in index templates.\nYou can include comments anywhere in the request body, except before the opening curly bracket.\n\n**Indices matching multiple templates**\n\nMultiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index.\nThe order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them.\nNOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order.\n ##Required authorization\n* Cluster privileges: `manage_index_templates`,`manage`", - "externalDocs": { - "url": "https://www.elastic.co/docs/manage-data/data-store/templates" - }, - "operationId": "indices-put-template", - "parameters": [ + }, { - "$ref": "#/components/parameters/indices.put_template-name" + "lang": "Python", + "source": "resp = client.indices.get_template(\n name=\".monitoring-*\",\n)" }, { - "$ref": "#/components/parameters/indices.put_template-create" + "lang": "JavaScript", + "source": "const response = await client.indices.getTemplate({\n name: \".monitoring-*\",\n});" }, { - "$ref": "#/components/parameters/indices.put_template-master_timeout" + "lang": "Ruby", + "source": "response = client.indices.get_template(\n name: \".monitoring-*\"\n)" }, { - "$ref": "#/components/parameters/indices.put_template-order" + "lang": "PHP", + "source": "$resp = $client->indices()->getTemplate([\n \"name\" => \".monitoring-*\",\n]);" }, { - "$ref": "#/components/parameters/indices.put_template-cause" - } - ], - "requestBody": { - "$ref": "#/components/requestBodies/indices.put_template" - }, - "responses": { - "200": { - "$ref": "#/components/responses/indices.put_template-200" + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_template/.monitoring-*\"" } - }, - "deprecated": true + ] }, - "post": { + "put": { "tags": [ "indices" ], @@ -15530,7 +19993,7 @@ "externalDocs": { "url": "https://www.elastic.co/docs/manage-data/data-store/templates" }, - "operationId": "indices-put-template-1", + "operationId": "indices-put-template", "parameters": [ { "$ref": "#/components/parameters/indices.put_template-name" @@ -15556,7 +20019,96 @@ "$ref": "#/components/responses/indices.put_template-200" } }, - "deprecated": true + "deprecated": true, + "x-codeSamples": [ + { + "lang": "Console", + "source": "PUT _template/template_1\n{\n \"index_patterns\": [\n \"te*\",\n \"bar*\"\n ],\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"mappings\": {\n \"_source\": {\n \"enabled\": false\n }\n },\n \"properties\": {\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.put_template(\n name=\"template_1\",\n index_patterns=[\n \"te*\",\n \"bar*\"\n ],\n settings={\n \"number_of_shards\": 1\n },\n mappings={\n \"_source\": {\n \"enabled\": False\n }\n },\n properties={\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.putTemplate({\n name: \"template_1\",\n index_patterns: [\"te*\", \"bar*\"],\n settings: {\n number_of_shards: 1,\n },\n mappings: {\n _source: {\n enabled: false,\n },\n },\n properties: {\n host_name: {\n type: \"keyword\",\n },\n created_at: {\n type: \"date\",\n format: \"EEE MMM dd HH:mm:ss Z yyyy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.put_template(\n name: \"template_1\",\n body: {\n \"index_patterns\": [\n \"te*\",\n \"bar*\"\n ],\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"mappings\": {\n \"_source\": {\n \"enabled\": false\n }\n },\n \"properties\": {\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->putTemplate([\n \"name\" => \"template_1\",\n \"body\" => [\n \"index_patterns\" => array(\n \"te*\",\n \"bar*\",\n ),\n \"settings\" => [\n \"number_of_shards\" => 1,\n ],\n \"mappings\" => [\n \"_source\" => [\n \"enabled\" => false,\n ],\n ],\n \"properties\" => [\n \"host_name\" => [\n \"type\" => \"keyword\",\n ],\n \"created_at\" => [\n \"type\" => \"date\",\n \"format\" => \"EEE MMM dd HH:mm:ss Z yyyy\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_patterns\":[\"te*\",\"bar*\"],\"settings\":{\"number_of_shards\":1},\"mappings\":{\"_source\":{\"enabled\":false}},\"properties\":{\"host_name\":{\"type\":\"keyword\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z yyyy\"}}}' \"$ELASTICSEARCH_URL/_template/template_1\"" + } + ] + }, + "post": { + "tags": [ + "indices" + ], + "summary": "Create or update a legacy index template", + "description": "Index templates define settings, mappings, and aliases that can be applied automatically to new indices.\nElasticsearch applies templates to new indices based on an index pattern that matches the index name.\n\nIMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.\n\nComposable templates always take precedence over legacy templates.\nIf no composable template matches a new index, matching legacy templates are applied according to their order.\n\nIndex templates are only applied during index creation.\nChanges to index templates do not affect existing indices.\nSettings and mappings specified in create index API requests override any settings or mappings specified in an index template.\n\nYou can use C-style `/* *\\/` block comments in index templates.\nYou can include comments anywhere in the request body, except before the opening curly bracket.\n\n**Indices matching multiple templates**\n\nMultiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index.\nThe order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them.\nNOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order.\n ##Required authorization\n* Cluster privileges: `manage_index_templates`,`manage`", + "externalDocs": { + "url": "https://www.elastic.co/docs/manage-data/data-store/templates" + }, + "operationId": "indices-put-template-1", + "parameters": [ + { + "$ref": "#/components/parameters/indices.put_template-name" + }, + { + "$ref": "#/components/parameters/indices.put_template-create" + }, + { + "$ref": "#/components/parameters/indices.put_template-master_timeout" + }, + { + "$ref": "#/components/parameters/indices.put_template-order" + }, + { + "$ref": "#/components/parameters/indices.put_template-cause" + } + ], + "requestBody": { + "$ref": "#/components/requestBodies/indices.put_template" + }, + "responses": { + "200": { + "$ref": "#/components/responses/indices.put_template-200" + } + }, + "deprecated": true, + "x-codeSamples": [ + { + "lang": "Console", + "source": "PUT _template/template_1\n{\n \"index_patterns\": [\n \"te*\",\n \"bar*\"\n ],\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"mappings\": {\n \"_source\": {\n \"enabled\": false\n }\n },\n \"properties\": {\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.put_template(\n name=\"template_1\",\n index_patterns=[\n \"te*\",\n \"bar*\"\n ],\n settings={\n \"number_of_shards\": 1\n },\n mappings={\n \"_source\": {\n \"enabled\": False\n }\n },\n properties={\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.putTemplate({\n name: \"template_1\",\n index_patterns: [\"te*\", \"bar*\"],\n settings: {\n number_of_shards: 1,\n },\n mappings: {\n _source: {\n enabled: false,\n },\n },\n properties: {\n host_name: {\n type: \"keyword\",\n },\n created_at: {\n type: \"date\",\n format: \"EEE MMM dd HH:mm:ss Z yyyy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.put_template(\n name: \"template_1\",\n body: {\n \"index_patterns\": [\n \"te*\",\n \"bar*\"\n ],\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"mappings\": {\n \"_source\": {\n \"enabled\": false\n }\n },\n \"properties\": {\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->putTemplate([\n \"name\" => \"template_1\",\n \"body\" => [\n \"index_patterns\" => array(\n \"te*\",\n \"bar*\",\n ),\n \"settings\" => [\n \"number_of_shards\" => 1,\n ],\n \"mappings\" => [\n \"_source\" => [\n \"enabled\" => false,\n ],\n ],\n \"properties\" => [\n \"host_name\" => [\n \"type\" => \"keyword\",\n ],\n \"created_at\" => [\n \"type\" => \"date\",\n \"format\" => \"EEE MMM dd HH:mm:ss Z yyyy\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_patterns\":[\"te*\",\"bar*\"],\"settings\":{\"number_of_shards\":1},\"mappings\":{\"_source\":{\"enabled\":false}},\"properties\":{\"host_name\":{\"type\":\"keyword\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z yyyy\"}}}' \"$ELASTICSEARCH_URL/_template/template_1\"" + } + ] }, "delete": { "tags": [ @@ -15615,6 +20167,26 @@ { "lang": "Console", "source": "DELETE _template/.cloud-hot-warm-allocation-0\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.delete_template(\n name=\".cloud-hot-warm-allocation-0\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.deleteTemplate({\n name: \".cloud-hot-warm-allocation-0\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.delete_template(\n name: \".cloud-hot-warm-allocation-0\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->deleteTemplate([\n \"name\" => \".cloud-hot-warm-allocation-0\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_template/.cloud-hot-warm-allocation-0\"" } ] }, @@ -15683,6 +20255,26 @@ { "lang": "Console", "source": "HEAD /_template/template_1\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.exists_template(\n name=\"template_1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.existsTemplate({\n name: \"template_1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.exists_template(\n name: \"template_1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->existsTemplate([\n \"name\" => \"template_1\",\n]);" + }, + { + "lang": "curl", + "source": "curl --head -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_template/template_1\"" } ] } @@ -15775,6 +20367,26 @@ { "lang": "Console", "source": "POST /my-index-000001/_disk_usage?run_expensive_tasks=true\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.disk_usage(\n index=\"my-index-000001\",\n run_expensive_tasks=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.diskUsage({\n index: \"my-index-000001\",\n run_expensive_tasks: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.disk_usage(\n index: \"my-index-000001\",\n run_expensive_tasks: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->diskUsage([\n \"index\" => \"my-index-000001\",\n \"run_expensive_tasks\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_disk_usage?run_expensive_tasks=true\"" } ] } @@ -15843,6 +20455,26 @@ { "lang": "Console", "source": "POST /my-time-series-index/_downsample/my-downsampled-time-series-index\n{\n \"fixed_interval\": \"1d\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.downsample(\n index=\"my-time-series-index\",\n target_index=\"my-downsampled-time-series-index\",\n config={\n \"fixed_interval\": \"1d\"\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.downsample({\n index: \"my-time-series-index\",\n target_index: \"my-downsampled-time-series-index\",\n config: {\n fixed_interval: \"1d\",\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.downsample(\n index: \"my-time-series-index\",\n target_index: \"my-downsampled-time-series-index\",\n body: {\n \"fixed_interval\": \"1d\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->downsample([\n \"index\" => \"my-time-series-index\",\n \"target_index\" => \"my-downsampled-time-series-index\",\n \"body\" => [\n \"fixed_interval\" => \"1d\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"fixed_interval\":\"1d\"}' \"$ELASTICSEARCH_URL/my-time-series-index/_downsample/my-downsampled-time-series-index\"" } ] } @@ -15881,6 +20513,26 @@ { "lang": "Console", "source": "GET _alias\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_alias()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getAlias();" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_alias" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getAlias();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_alias\"" } ] }, @@ -15917,6 +20569,26 @@ { "lang": "Console", "source": "HEAD _alias/my-alias\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.exists_alias(\n name=\"my-alias\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.existsAlias({\n name: \"my-alias\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.exists_alias(\n name: \"my-alias\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->existsAlias([\n \"name\" => \"my-alias\",\n]);" + }, + { + "lang": "curl", + "source": "curl --head -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_alias/my-alias\"" } ] } @@ -16002,6 +20674,26 @@ { "lang": "Console", "source": "GET .ds-metrics-2023.03.22-000001/_lifecycle/explain\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.explain_data_lifecycle(\n index=\".ds-metrics-2023.03.22-000001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.explainDataLifecycle({\n index: \".ds-metrics-2023.03.22-000001\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.explain_data_lifecycle(\n index: \".ds-metrics-2023.03.22-000001\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->explainDataLifecycle([\n \"index\" => \".ds-metrics-2023.03.22-000001\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/.ds-metrics-2023.03.22-000001/_lifecycle/explain\"" } ] } @@ -16090,6 +20782,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_field_usage_stats\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.field_usage_stats(\n index=\"my-index-000001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.fieldUsageStats({\n index: \"my-index-000001\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.field_usage_stats(\n index: \"my-index-000001\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->fieldUsageStats([\n \"index\" => \"my-index-000001\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_field_usage_stats\"" } ] } @@ -16128,6 +20840,26 @@ { "lang": "Console", "source": "POST /_flush\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.flush()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.flush();" + }, + { + "lang": "Ruby", + "source": "response = client.indices.flush" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->flush();" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_flush\"" } ] }, @@ -16164,6 +20896,26 @@ { "lang": "Console", "source": "POST /_flush\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.flush()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.flush();" + }, + { + "lang": "Ruby", + "source": "response = client.indices.flush" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->flush();" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_flush\"" } ] } @@ -16205,6 +20957,26 @@ { "lang": "Console", "source": "POST /_flush\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.flush()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.flush();" + }, + { + "lang": "Ruby", + "source": "response = client.indices.flush" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->flush();" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_flush\"" } ] }, @@ -16244,6 +21016,26 @@ { "lang": "Console", "source": "POST /_flush\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.flush()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.flush();" + }, + { + "lang": "Ruby", + "source": "response = client.indices.flush" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->flush();" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_flush\"" } ] } @@ -16292,6 +21084,26 @@ { "lang": "Console", "source": "POST my-index-000001/_forcemerge\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.forcemerge(\n index=\"my-index-000001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.forcemerge({\n index: \"my-index-000001\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.forcemerge(\n index: \"my-index-000001\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->forcemerge([\n \"index\" => \"my-index-000001\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_forcemerge\"" } ] } @@ -16343,6 +21155,26 @@ { "lang": "Console", "source": "POST my-index-000001/_forcemerge\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.forcemerge(\n index=\"my-index-000001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.forcemerge({\n index: \"my-index-000001\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.forcemerge(\n index: \"my-index-000001\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->forcemerge([\n \"index\" => \"my-index-000001\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_forcemerge\"" } ] } @@ -16378,6 +21210,26 @@ { "lang": "Console", "source": "GET _alias\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_alias()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getAlias();" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_alias" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getAlias();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_alias\"" } ] } @@ -16416,6 +21268,26 @@ { "lang": "Console", "source": "GET _alias\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_alias()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getAlias();" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_alias" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getAlias();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_alias\"" } ] } @@ -16474,6 +21346,26 @@ { "lang": "Console", "source": "GET _lifecycle/stats?human&pretty\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_data_lifecycle_stats(\n human=True,\n pretty=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getDataLifecycleStats({\n human: \"true\",\n pretty: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_data_lifecycle_stats(\n human: \"true\",\n pretty: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getDataLifecycleStats([\n \"human\" => \"true\",\n \"pretty\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_lifecycle/stats?human&pretty\"" } ] } @@ -16510,6 +21402,26 @@ { "lang": "Console", "source": "GET _data_stream/my-data-stream\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_data_stream(\n name=\"my-data-stream\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getDataStream({\n name: \"my-data-stream\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_data_stream(\n name: \"my-data-stream\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getDataStream([\n \"name\" => \"my-data-stream\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/my-data-stream\"" } ] } @@ -16551,6 +21463,26 @@ { "lang": "Console", "source": "GET publications/_mapping/field/title\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_field_mapping(\n index=\"publications\",\n fields=\"title\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getFieldMapping({\n index: \"publications\",\n fields: \"title\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_field_mapping(\n index: \"publications\",\n fields: \"title\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getFieldMapping([\n \"index\" => \"publications\",\n \"fields\" => \"title\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/publications/_mapping/field/title\"" } ] } @@ -16595,6 +21527,26 @@ { "lang": "Console", "source": "GET publications/_mapping/field/title\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_field_mapping(\n index=\"publications\",\n fields=\"title\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getFieldMapping({\n index: \"publications\",\n fields: \"title\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_field_mapping(\n index: \"publications\",\n fields: \"title\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getFieldMapping([\n \"index\" => \"publications\",\n \"fields\" => \"title\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/publications/_mapping/field/title\"" } ] } @@ -16631,6 +21583,26 @@ { "lang": "Console", "source": "GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_index_template(\n name=\"*\",\n filter_path=\"index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getIndexTemplate({\n name: \"*\",\n filter_path:\n \"index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_index_template(\n name: \"*\",\n filter_path: \"index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getIndexTemplate([\n \"name\" => \"*\",\n \"filter_path\" => \"index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\"" } ] } @@ -16669,6 +21641,26 @@ { "lang": "Console", "source": "GET /books/_mapping\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_mapping(\n index=\"books\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getMapping({\n index: \"books\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_mapping(\n index: \"books\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getMapping([\n \"index\" => \"books\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/books/_mapping\"" } ] } @@ -16710,6 +21702,26 @@ { "lang": "Console", "source": "GET /books/_mapping\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_mapping(\n index=\"books\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getMapping({\n index: \"books\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_mapping(\n index: \"books\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getMapping([\n \"index\" => \"books\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/books/_mapping\"" } ] }, @@ -16758,6 +21770,26 @@ { "lang": "Console", "source": "PUT /my-index-000001/_mapping\n{\n \"properties\": {\n \"user\": {\n \"properties\": {\n \"name\": {\n \"type\": \"keyword\"\n }\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.put_mapping(\n index=\"my-index-000001\",\n properties={\n \"user\": {\n \"properties\": {\n \"name\": {\n \"type\": \"keyword\"\n }\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.putMapping({\n index: \"my-index-000001\",\n properties: {\n user: {\n properties: {\n name: {\n type: \"keyword\",\n },\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.put_mapping(\n index: \"my-index-000001\",\n body: {\n \"properties\": {\n \"user\": {\n \"properties\": {\n \"name\": {\n \"type\": \"keyword\"\n }\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->putMapping([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"properties\" => [\n \"user\" => [\n \"properties\" => [\n \"name\" => [\n \"type\" => \"keyword\",\n ],\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"properties\":{\"user\":{\"properties\":{\"name\":{\"type\":\"keyword\"}}}}}' \"$ELASTICSEARCH_URL/my-index-000001/_mapping\"" } ] }, @@ -16806,6 +21838,26 @@ { "lang": "Console", "source": "PUT /my-index-000001/_mapping\n{\n \"properties\": {\n \"user\": {\n \"properties\": {\n \"name\": {\n \"type\": \"keyword\"\n }\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.put_mapping(\n index=\"my-index-000001\",\n properties={\n \"user\": {\n \"properties\": {\n \"name\": {\n \"type\": \"keyword\"\n }\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.putMapping({\n index: \"my-index-000001\",\n properties: {\n user: {\n properties: {\n name: {\n type: \"keyword\",\n },\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.put_mapping(\n index: \"my-index-000001\",\n body: {\n \"properties\": {\n \"user\": {\n \"properties\": {\n \"name\": {\n \"type\": \"keyword\"\n }\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->putMapping([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"properties\" => [\n \"user\" => [\n \"properties\" => [\n \"name\" => [\n \"type\" => \"keyword\",\n ],\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"properties\":{\"user\":{\"properties\":{\"name\":{\"type\":\"keyword\"}}}}}' \"$ELASTICSEARCH_URL/my-index-000001/_mapping\"" } ] } @@ -16896,6 +21948,26 @@ { "lang": "Console", "source": "GET /_migration/reindex/my-data-stream/_status\n" + }, + { + "lang": "Python", + "source": "resp = client.perform_request(\n \"GET\",\n \"/_migration/reindex/my-data-stream/_status\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transport.request({\n method: \"GET\",\n path: \"/_migration/reindex/my-data-stream/_status\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.perform_request(\n \"GET\",\n \"/_migration/reindex/my-data-stream/_status\",\n {},\n)" + }, + { + "lang": "PHP", + "source": "$requestFactory = Psr17FactoryDiscovery::findRequestFactory();\n$request = $requestFactory->createRequest(\n \"GET\",\n \"/_migration/reindex/my-data-stream/_status\",\n);\n$resp = $client->sendRequest($request);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_migration/reindex/my-data-stream/_status\"" } ] } @@ -16940,6 +22012,26 @@ { "lang": "Console", "source": "GET _all/_settings?expand_wildcards=all&filter_path=*.settings.index.*.slowlog\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_settings(\n index=\"_all\",\n expand_wildcards=\"all\",\n filter_path=\"*.settings.index.*.slowlog\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getSettings({\n index: \"_all\",\n expand_wildcards: \"all\",\n filter_path: \"*.settings.index.*.slowlog\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_settings(\n index: \"_all\",\n expand_wildcards: \"all\",\n filter_path: \"*.settings.index.*.slowlog\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getSettings([\n \"index\" => \"_all\",\n \"expand_wildcards\" => \"all\",\n \"filter_path\" => \"*.settings.index.*.slowlog\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_all/_settings?expand_wildcards=all&filter_path=*.settings.index.*.slowlog\"" } ] }, @@ -16991,6 +22083,26 @@ { "lang": "Console", "source": "PUT /my-index-000001/_settings\n{\n \"index\" : {\n \"number_of_replicas\" : 2\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.put_settings(\n index=\"my-index-000001\",\n settings={\n \"index\": {\n \"number_of_replicas\": 2\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.putSettings({\n index: \"my-index-000001\",\n settings: {\n index: {\n number_of_replicas: 2,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.put_settings(\n index: \"my-index-000001\",\n body: {\n \"index\": {\n \"number_of_replicas\": 2\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->putSettings([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"index\" => [\n \"number_of_replicas\" => 2,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index\":{\"number_of_replicas\":2}}' \"$ELASTICSEARCH_URL/my-index-000001/_settings\"" } ] } @@ -17038,6 +22150,26 @@ { "lang": "Console", "source": "GET _all/_settings?expand_wildcards=all&filter_path=*.settings.index.*.slowlog\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_settings(\n index=\"_all\",\n expand_wildcards=\"all\",\n filter_path=\"*.settings.index.*.slowlog\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getSettings({\n index: \"_all\",\n expand_wildcards: \"all\",\n filter_path: \"*.settings.index.*.slowlog\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_settings(\n index: \"_all\",\n expand_wildcards: \"all\",\n filter_path: \"*.settings.index.*.slowlog\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getSettings([\n \"index\" => \"_all\",\n \"expand_wildcards\" => \"all\",\n \"filter_path\" => \"*.settings.index.*.slowlog\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_all/_settings?expand_wildcards=all&filter_path=*.settings.index.*.slowlog\"" } ] }, @@ -17092,6 +22224,26 @@ { "lang": "Console", "source": "PUT /my-index-000001/_settings\n{\n \"index\" : {\n \"number_of_replicas\" : 2\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.put_settings(\n index=\"my-index-000001\",\n settings={\n \"index\": {\n \"number_of_replicas\": 2\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.putSettings({\n index: \"my-index-000001\",\n settings: {\n index: {\n number_of_replicas: 2,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.put_settings(\n index: \"my-index-000001\",\n body: {\n \"index\": {\n \"number_of_replicas\": 2\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->putSettings([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"index\" => [\n \"number_of_replicas\" => 2,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index\":{\"number_of_replicas\":2}}' \"$ELASTICSEARCH_URL/my-index-000001/_settings\"" } ] } @@ -17142,6 +22294,26 @@ { "lang": "Console", "source": "GET _all/_settings?expand_wildcards=all&filter_path=*.settings.index.*.slowlog\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_settings(\n index=\"_all\",\n expand_wildcards=\"all\",\n filter_path=\"*.settings.index.*.slowlog\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getSettings({\n index: \"_all\",\n expand_wildcards: \"all\",\n filter_path: \"*.settings.index.*.slowlog\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_settings(\n index: \"_all\",\n expand_wildcards: \"all\",\n filter_path: \"*.settings.index.*.slowlog\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getSettings([\n \"index\" => \"_all\",\n \"expand_wildcards\" => \"all\",\n \"filter_path\" => \"*.settings.index.*.slowlog\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_all/_settings?expand_wildcards=all&filter_path=*.settings.index.*.slowlog\"" } ] } @@ -17189,6 +22361,26 @@ { "lang": "Console", "source": "GET _all/_settings?expand_wildcards=all&filter_path=*.settings.index.*.slowlog\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_settings(\n index=\"_all\",\n expand_wildcards=\"all\",\n filter_path=\"*.settings.index.*.slowlog\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getSettings({\n index: \"_all\",\n expand_wildcards: \"all\",\n filter_path: \"*.settings.index.*.slowlog\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_settings(\n index: \"_all\",\n expand_wildcards: \"all\",\n filter_path: \"*.settings.index.*.slowlog\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getSettings([\n \"index\" => \"_all\",\n \"expand_wildcards\" => \"all\",\n \"filter_path\" => \"*.settings.index.*.slowlog\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_all/_settings?expand_wildcards=all&filter_path=*.settings.index.*.slowlog\"" } ] } @@ -17225,6 +22417,26 @@ { "lang": "Console", "source": "GET /_template/.monitoring-*\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_template(\n name=\".monitoring-*\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getTemplate({\n name: \".monitoring-*\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_template(\n name: \".monitoring-*\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getTemplate([\n \"name\" => \".monitoring-*\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_template/.monitoring-*\"" } ] } @@ -17270,6 +22482,26 @@ { "lang": "Console", "source": "POST _migration/reindex\n{\n \"source\": {\n \"index\": \"my-data-stream\"\n },\n \"mode\": \"upgrade\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.perform_request(\n \"POST\",\n \"/_migration/reindex\",\n headers={\"Content-Type\": \"application/json\"},\n body={\n \"source\": {\n \"index\": \"my-data-stream\"\n },\n \"mode\": \"upgrade\"\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transport.request({\n method: \"POST\",\n path: \"/_migration/reindex\",\n body: {\n source: {\n index: \"my-data-stream\",\n },\n mode: \"upgrade\",\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.perform_request(\n \"POST\",\n \"/_migration/reindex\",\n {},\n {\n \"source\": {\n \"index\": \"my-data-stream\"\n },\n \"mode\": \"upgrade\"\n },\n { \"Content-Type\": \"application/json\" },\n)" + }, + { + "lang": "PHP", + "source": "$requestFactory = Psr17FactoryDiscovery::findRequestFactory();\n$streamFactory = Psr17FactoryDiscovery::findStreamFactory();\n$request = $requestFactory->createRequest(\n \"POST\",\n \"/_migration/reindex\",\n);\n$request = $request->withHeader(\"Content-Type\", \"application/json\");\n$request = $request->withBody($streamFactory->createStream(\n json_encode([\n \"source\" => [\n \"index\" => \"my-data-stream\",\n ],\n \"mode\" => \"upgrade\",\n ]),\n));\n$resp = $client->sendRequest($request);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"my-data-stream\"},\"mode\":\"upgrade\"}' \"$ELASTICSEARCH_URL/_migration/reindex\"" } ] } @@ -17332,6 +22564,26 @@ { "lang": "Console", "source": "POST _data_stream/_migrate/my-time-series-data\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.migrate_to_data_stream(\n name=\"my-time-series-data\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.migrateToDataStream({\n name: \"my-time-series-data\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.migrate_to_data_stream(\n name: \"my-time-series-data\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->migrateToDataStream([\n \"name\" => \"my-time-series-data\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/_migrate/my-time-series-data\"" } ] } @@ -17389,6 +22641,26 @@ { "lang": "Console", "source": "POST _data_stream/_modify\n{\n \"actions\": [\n {\n \"remove_backing_index\": {\n \"data_stream\": \"my-data-stream\",\n \"index\": \".ds-my-data-stream-2023.07.26-000001\"\n }\n },\n {\n \"add_backing_index\": {\n \"data_stream\": \"my-data-stream\",\n \"index\": \".ds-my-data-stream-2023.07.26-000001-downsample\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.modify_data_stream(\n actions=[\n {\n \"remove_backing_index\": {\n \"data_stream\": \"my-data-stream\",\n \"index\": \".ds-my-data-stream-2023.07.26-000001\"\n }\n },\n {\n \"add_backing_index\": {\n \"data_stream\": \"my-data-stream\",\n \"index\": \".ds-my-data-stream-2023.07.26-000001-downsample\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.modifyDataStream({\n actions: [\n {\n remove_backing_index: {\n data_stream: \"my-data-stream\",\n index: \".ds-my-data-stream-2023.07.26-000001\",\n },\n },\n {\n add_backing_index: {\n data_stream: \"my-data-stream\",\n index: \".ds-my-data-stream-2023.07.26-000001-downsample\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.modify_data_stream(\n body: {\n \"actions\": [\n {\n \"remove_backing_index\": {\n \"data_stream\": \"my-data-stream\",\n \"index\": \".ds-my-data-stream-2023.07.26-000001\"\n }\n },\n {\n \"add_backing_index\": {\n \"data_stream\": \"my-data-stream\",\n \"index\": \".ds-my-data-stream-2023.07.26-000001-downsample\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->modifyDataStream([\n \"body\" => [\n \"actions\" => array(\n [\n \"remove_backing_index\" => [\n \"data_stream\" => \"my-data-stream\",\n \"index\" => \".ds-my-data-stream-2023.07.26-000001\",\n ],\n ],\n [\n \"add_backing_index\" => [\n \"data_stream\" => \"my-data-stream\",\n \"index\" => \".ds-my-data-stream-2023.07.26-000001-downsample\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"actions\":[{\"remove_backing_index\":{\"data_stream\":\"my-data-stream\",\"index\":\".ds-my-data-stream-2023.07.26-000001\"}},{\"add_backing_index\":{\"data_stream\":\"my-data-stream\",\"index\":\".ds-my-data-stream-2023.07.26-000001-downsample\"}}]}' \"$ELASTICSEARCH_URL/_data_stream/_modify\"" } ] } @@ -17508,6 +22780,26 @@ { "lang": "Console", "source": "POST /.ds-my-data-stream-2099.03.07-000001/_open/\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.open(\n index=\".ds-my-data-stream-2099.03.07-000001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.open({\n index: \".ds-my-data-stream-2099.03.07-000001\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.open(\n index: \".ds-my-data-stream-2099.03.07-000001\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->open([\n \"index\" => \".ds-my-data-stream-2099.03.07-000001\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/.ds-my-data-stream-2099.03.07-000001/_open/\"" } ] } @@ -17560,6 +22852,26 @@ { "lang": "Console", "source": "POST /_data_stream/_promote/my-data-stream\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.promote_data_stream(\n name=\"my-data-stream\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.promoteDataStream({\n name: \"my-data-stream\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.promote_data_stream(\n name: \"my-data-stream\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->promoteDataStream([\n \"name\" => \"my-data-stream\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/_promote/my-data-stream\"" } ] } @@ -17589,6 +22901,26 @@ { "lang": "Console", "source": "GET /_recovery?human\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.recovery(\n human=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.recovery({\n human: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.recovery(\n human: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->recovery([\n \"human\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_recovery?human\"" } ] } @@ -17621,6 +22953,26 @@ { "lang": "Console", "source": "GET /_recovery?human\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.recovery(\n human=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.recovery({\n human: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.recovery(\n human: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->recovery([\n \"human\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_recovery?human\"" } ] } @@ -17653,6 +23005,26 @@ { "lang": "Console", "source": "GET _refresh\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.refresh()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.refresh();" + }, + { + "lang": "Ruby", + "source": "response = client.indices.refresh" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->refresh();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_refresh\"" } ] }, @@ -17683,51 +23055,38 @@ { "lang": "Console", "source": "GET _refresh\n" - } - ] - } - }, - "/{index}/_refresh": { - "get": { - "tags": [ - "indices" - ], - "summary": "Refresh an index", - "description": "A refresh makes recent operations performed on one or more indices available for search.\nFor data streams, the API runs the refresh operation on the stream’s backing indices.\n\nBy default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds.\nYou can change this default interval with the `index.refresh_interval` setting.\n\nRefresh requests are synchronous and do not return a response until the refresh operation completes.\n\nRefreshes are resource-intensive.\nTo ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible.\n\nIf your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's `refresh=wait_for` query parameter option.\nThis option ensures the indexing operation waits for a periodic refresh before running the search.\n ##Required authorization\n* Index privileges: `maintenance`", - "operationId": "indices-refresh-3", - "parameters": [ + }, { - "$ref": "#/components/parameters/indices.refresh-index" + "lang": "Python", + "source": "resp = client.indices.refresh()" }, { - "$ref": "#/components/parameters/indices.refresh-allow_no_indices" + "lang": "JavaScript", + "source": "const response = await client.indices.refresh();" }, { - "$ref": "#/components/parameters/indices.refresh-expand_wildcards" + "lang": "Ruby", + "source": "response = client.indices.refresh" }, { - "$ref": "#/components/parameters/indices.refresh-ignore_unavailable" - } - ], - "responses": { - "200": { - "$ref": "#/components/responses/indices.refresh-200" - } - }, - "x-codeSamples": [ + "lang": "PHP", + "source": "$resp = $client->indices()->refresh();" + }, { - "lang": "Console", - "source": "GET _refresh\n" + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_refresh\"" } ] - }, - "post": { + } + }, + "/{index}/_refresh": { + "get": { "tags": [ "indices" ], "summary": "Refresh an index", "description": "A refresh makes recent operations performed on one or more indices available for search.\nFor data streams, the API runs the refresh operation on the stream’s backing indices.\n\nBy default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds.\nYou can change this default interval with the `index.refresh_interval` setting.\n\nRefresh requests are synchronous and do not return a response until the refresh operation completes.\n\nRefreshes are resource-intensive.\nTo ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible.\n\nIf your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's `refresh=wait_for` query parameter option.\nThis option ensures the indexing operation waits for a periodic refresh before running the search.\n ##Required authorization\n* Index privileges: `maintenance`", - "operationId": "indices-refresh-2", + "operationId": "indices-refresh-3", "parameters": [ { "$ref": "#/components/parameters/indices.refresh-index" @@ -17751,6 +23110,79 @@ { "lang": "Console", "source": "GET _refresh\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.refresh()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.refresh();" + }, + { + "lang": "Ruby", + "source": "response = client.indices.refresh" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->refresh();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_refresh\"" + } + ] + }, + "post": { + "tags": [ + "indices" + ], + "summary": "Refresh an index", + "description": "A refresh makes recent operations performed on one or more indices available for search.\nFor data streams, the API runs the refresh operation on the stream’s backing indices.\n\nBy default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds.\nYou can change this default interval with the `index.refresh_interval` setting.\n\nRefresh requests are synchronous and do not return a response until the refresh operation completes.\n\nRefreshes are resource-intensive.\nTo ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible.\n\nIf your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's `refresh=wait_for` query parameter option.\nThis option ensures the indexing operation waits for a periodic refresh before running the search.\n ##Required authorization\n* Index privileges: `maintenance`", + "operationId": "indices-refresh-2", + "parameters": [ + { + "$ref": "#/components/parameters/indices.refresh-index" + }, + { + "$ref": "#/components/parameters/indices.refresh-allow_no_indices" + }, + { + "$ref": "#/components/parameters/indices.refresh-expand_wildcards" + }, + { + "$ref": "#/components/parameters/indices.refresh-ignore_unavailable" + } + ], + "responses": { + "200": { + "$ref": "#/components/responses/indices.refresh-200" + } + }, + "x-codeSamples": [ + { + "lang": "Console", + "source": "GET _refresh\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.refresh()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.refresh();" + }, + { + "lang": "Ruby", + "source": "response = client.indices.refresh" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->refresh();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_refresh\"" } ] } @@ -17793,6 +23225,26 @@ { "lang": "Console", "source": "POST /my-index-000001/_reload_search_analyzers\n{\n \"_shards\": {\n \"total\": 2,\n \"successful\": 2,\n \"failed\": 0\n },\n \"reload_details\": [\n {\n \"index\": \"my-index-000001\",\n \"reloaded_analyzers\": [\n \"my_synonyms\"\n ],\n \"reloaded_node_ids\": [\n \"mfdqTXn_T7SGr2Ho2KT8uw\"\n ]\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.reload_search_analyzers(\n index=\"my-index-000001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.reloadSearchAnalyzers({\n index: \"my-index-000001\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.reload_search_analyzers(\n index: \"my-index-000001\",\n body: {\n \"_shards\": {\n \"total\": 2,\n \"successful\": 2,\n \"failed\": 0\n },\n \"reload_details\": [\n {\n \"index\": \"my-index-000001\",\n \"reloaded_analyzers\": [\n \"my_synonyms\"\n ],\n \"reloaded_node_ids\": [\n \"mfdqTXn_T7SGr2Ho2KT8uw\"\n ]\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->reloadSearchAnalyzers([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"_shards\" => [\n \"total\" => 2,\n \"successful\" => 2,\n \"failed\" => 0,\n ],\n \"reload_details\" => array(\n [\n \"index\" => \"my-index-000001\",\n \"reloaded_analyzers\" => array(\n \"my_synonyms\",\n ),\n \"reloaded_node_ids\" => array(\n \"mfdqTXn_T7SGr2Ho2KT8uw\",\n ),\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"_shards\":{\"total\":2,\"successful\":2,\"failed\":0},\"reload_details\":[{\"index\":\"my-index-000001\",\"reloaded_analyzers\":[\"my_synonyms\"],\"reloaded_node_ids\":[\"mfdqTXn_T7SGr2Ho2KT8uw\"]}]}' \"$ELASTICSEARCH_URL/my-index-000001/_reload_search_analyzers\"" } ] }, @@ -17833,6 +23285,26 @@ { "lang": "Console", "source": "POST /my-index-000001/_reload_search_analyzers\n{\n \"_shards\": {\n \"total\": 2,\n \"successful\": 2,\n \"failed\": 0\n },\n \"reload_details\": [\n {\n \"index\": \"my-index-000001\",\n \"reloaded_analyzers\": [\n \"my_synonyms\"\n ],\n \"reloaded_node_ids\": [\n \"mfdqTXn_T7SGr2Ho2KT8uw\"\n ]\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.reload_search_analyzers(\n index=\"my-index-000001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.reloadSearchAnalyzers({\n index: \"my-index-000001\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.reload_search_analyzers(\n index: \"my-index-000001\",\n body: {\n \"_shards\": {\n \"total\": 2,\n \"successful\": 2,\n \"failed\": 0\n },\n \"reload_details\": [\n {\n \"index\": \"my-index-000001\",\n \"reloaded_analyzers\": [\n \"my_synonyms\"\n ],\n \"reloaded_node_ids\": [\n \"mfdqTXn_T7SGr2Ho2KT8uw\"\n ]\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->reloadSearchAnalyzers([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"_shards\" => [\n \"total\" => 2,\n \"successful\" => 2,\n \"failed\" => 0,\n ],\n \"reload_details\" => array(\n [\n \"index\" => \"my-index-000001\",\n \"reloaded_analyzers\" => array(\n \"my_synonyms\",\n ),\n \"reloaded_node_ids\" => array(\n \"mfdqTXn_T7SGr2Ho2KT8uw\",\n ),\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"_shards\":{\"total\":2,\"successful\":2,\"failed\":0},\"reload_details\":[{\"index\":\"my-index-000001\",\"reloaded_analyzers\":[\"my_synonyms\"],\"reloaded_node_ids\":[\"mfdqTXn_T7SGr2Ho2KT8uw\"]}]}' \"$ELASTICSEARCH_URL/my-index-000001/_reload_search_analyzers\"" } ] } @@ -17872,6 +23344,26 @@ { "lang": "Console", "source": "GET /_resolve/cluster/not-present,clust*:my-index*,oldcluster:*?ignore_unavailable=false&timeout=5s\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.resolve_cluster(\n name=\"not-present,clust*:my-index*,oldcluster:*\",\n ignore_unavailable=False,\n timeout=\"5s\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.resolveCluster({\n name: \"not-present,clust*:my-index*,oldcluster:*\",\n ignore_unavailable: \"false\",\n timeout: \"5s\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.resolve_cluster(\n name: \"not-present,clust*:my-index*,oldcluster:*\",\n ignore_unavailable: \"false\",\n timeout: \"5s\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->resolveCluster([\n \"name\" => \"not-present,clust*:my-index*,oldcluster:*\",\n \"ignore_unavailable\" => \"false\",\n \"timeout\" => \"5s\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_resolve/cluster/not-present,clust*:my-index*,oldcluster:*?ignore_unavailable=false&timeout=5s\"" } ] } @@ -17914,6 +23406,26 @@ { "lang": "Console", "source": "GET /_resolve/cluster/not-present,clust*:my-index*,oldcluster:*?ignore_unavailable=false&timeout=5s\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.resolve_cluster(\n name=\"not-present,clust*:my-index*,oldcluster:*\",\n ignore_unavailable=False,\n timeout=\"5s\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.resolveCluster({\n name: \"not-present,clust*:my-index*,oldcluster:*\",\n ignore_unavailable: \"false\",\n timeout: \"5s\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.resolve_cluster(\n name: \"not-present,clust*:my-index*,oldcluster:*\",\n ignore_unavailable: \"false\",\n timeout: \"5s\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->resolveCluster([\n \"name\" => \"not-present,clust*:my-index*,oldcluster:*\",\n \"ignore_unavailable\" => \"false\",\n \"timeout\" => \"5s\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_resolve/cluster/not-present,clust*:my-index*,oldcluster:*?ignore_unavailable=false&timeout=5s\"" } ] } @@ -18017,6 +23529,26 @@ { "lang": "Console", "source": "GET /_resolve/index/f*,remoteCluster1:bar*?expand_wildcards=all\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.resolve_index(\n name=\"f*,remoteCluster1:bar*\",\n expand_wildcards=\"all\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.resolveIndex({\n name: \"f*,remoteCluster1:bar*\",\n expand_wildcards: \"all\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.resolve_index(\n name: \"f*,remoteCluster1:bar*\",\n expand_wildcards: \"all\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->resolveIndex([\n \"name\" => \"f*,remoteCluster1:bar*\",\n \"expand_wildcards\" => \"all\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_resolve/index/f*,remoteCluster1:bar*?expand_wildcards=all\"" } ] } @@ -18062,6 +23594,26 @@ { "lang": "Console", "source": "POST my-data-stream/_rollover\n{\n \"conditions\": {\n \"max_age\": \"7d\",\n \"max_docs\": 1000,\n \"max_primary_shard_size\": \"50gb\",\n \"max_primary_shard_docs\": \"2000\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.rollover(\n alias=\"my-data-stream\",\n conditions={\n \"max_age\": \"7d\",\n \"max_docs\": 1000,\n \"max_primary_shard_size\": \"50gb\",\n \"max_primary_shard_docs\": \"2000\"\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.rollover({\n alias: \"my-data-stream\",\n conditions: {\n max_age: \"7d\",\n max_docs: 1000,\n max_primary_shard_size: \"50gb\",\n max_primary_shard_docs: \"2000\",\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.rollover(\n alias: \"my-data-stream\",\n body: {\n \"conditions\": {\n \"max_age\": \"7d\",\n \"max_docs\": 1000,\n \"max_primary_shard_size\": \"50gb\",\n \"max_primary_shard_docs\": \"2000\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->rollover([\n \"alias\" => \"my-data-stream\",\n \"body\" => [\n \"conditions\" => [\n \"max_age\" => \"7d\",\n \"max_docs\" => 1000,\n \"max_primary_shard_size\" => \"50gb\",\n \"max_primary_shard_docs\" => \"2000\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"conditions\":{\"max_age\":\"7d\",\"max_docs\":1000,\"max_primary_shard_size\":\"50gb\",\"max_primary_shard_docs\":\"2000\"}}' \"$ELASTICSEARCH_URL/my-data-stream/_rollover\"" } ] } @@ -18110,6 +23662,26 @@ { "lang": "Console", "source": "POST my-data-stream/_rollover\n{\n \"conditions\": {\n \"max_age\": \"7d\",\n \"max_docs\": 1000,\n \"max_primary_shard_size\": \"50gb\",\n \"max_primary_shard_docs\": \"2000\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.rollover(\n alias=\"my-data-stream\",\n conditions={\n \"max_age\": \"7d\",\n \"max_docs\": 1000,\n \"max_primary_shard_size\": \"50gb\",\n \"max_primary_shard_docs\": \"2000\"\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.rollover({\n alias: \"my-data-stream\",\n conditions: {\n max_age: \"7d\",\n max_docs: 1000,\n max_primary_shard_size: \"50gb\",\n max_primary_shard_docs: \"2000\",\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.rollover(\n alias: \"my-data-stream\",\n body: {\n \"conditions\": {\n \"max_age\": \"7d\",\n \"max_docs\": 1000,\n \"max_primary_shard_size\": \"50gb\",\n \"max_primary_shard_docs\": \"2000\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->rollover([\n \"alias\" => \"my-data-stream\",\n \"body\" => [\n \"conditions\" => [\n \"max_age\" => \"7d\",\n \"max_docs\" => 1000,\n \"max_primary_shard_size\" => \"50gb\",\n \"max_primary_shard_docs\" => \"2000\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"conditions\":{\"max_age\":\"7d\",\"max_docs\":1000,\"max_primary_shard_size\":\"50gb\",\"max_primary_shard_docs\":\"2000\"}}' \"$ELASTICSEARCH_URL/my-data-stream/_rollover\"" } ] } @@ -18142,6 +23714,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_segments\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.segments(\n index=\"my-index-000001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.segments({\n index: \"my-index-000001\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.segments(\n index: \"my-index-000001\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->segments([\n \"index\" => \"my-index-000001\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_segments\"" } ] } @@ -18177,6 +23769,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_segments\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.segments(\n index=\"my-index-000001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.segments({\n index: \"my-index-000001\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.segments(\n index: \"my-index-000001\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->segments([\n \"index\" => \"my-index-000001\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_segments\"" } ] } @@ -18212,6 +23824,26 @@ { "lang": "Console", "source": "GET /_shard_stores?status=green\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.shard_stores(\n status=\"green\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.shardStores({\n status: \"green\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.shard_stores(\n status: \"green\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->shardStores([\n \"status\" => \"green\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_shard_stores?status=green\"" } ] } @@ -18250,6 +23882,26 @@ { "lang": "Console", "source": "GET /_shard_stores?status=green\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.shard_stores(\n status=\"green\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.shardStores({\n status: \"green\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.shard_stores(\n status: \"green\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->shardStores([\n \"status\" => \"green\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_shard_stores?status=green\"" } ] } @@ -18292,6 +23944,26 @@ { "lang": "Console", "source": "POST /my_source_index/_shrink/my_target_index\n{\n \"settings\": {\n \"index.routing.allocation.require._name\": null,\n \"index.blocks.write\": null\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.shrink(\n index=\"my_source_index\",\n target=\"my_target_index\",\n settings={\n \"index.routing.allocation.require._name\": None,\n \"index.blocks.write\": None\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.shrink({\n index: \"my_source_index\",\n target: \"my_target_index\",\n settings: {\n \"index.routing.allocation.require._name\": null,\n \"index.blocks.write\": null,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.shrink(\n index: \"my_source_index\",\n target: \"my_target_index\",\n body: {\n \"settings\": {\n \"index.routing.allocation.require._name\": nil,\n \"index.blocks.write\": nil\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->shrink([\n \"index\" => \"my_source_index\",\n \"target\" => \"my_target_index\",\n \"body\" => [\n \"settings\" => [\n \"index.routing.allocation.require._name\" => null,\n \"index.blocks.write\" => null,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"settings\":{\"index.routing.allocation.require._name\":null,\"index.blocks.write\":null}}' \"$ELASTICSEARCH_URL/my_source_index/_shrink/my_target_index\"" } ] }, @@ -18332,6 +24004,26 @@ { "lang": "Console", "source": "POST /my_source_index/_shrink/my_target_index\n{\n \"settings\": {\n \"index.routing.allocation.require._name\": null,\n \"index.blocks.write\": null\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.shrink(\n index=\"my_source_index\",\n target=\"my_target_index\",\n settings={\n \"index.routing.allocation.require._name\": None,\n \"index.blocks.write\": None\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.shrink({\n index: \"my_source_index\",\n target: \"my_target_index\",\n settings: {\n \"index.routing.allocation.require._name\": null,\n \"index.blocks.write\": null,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.shrink(\n index: \"my_source_index\",\n target: \"my_target_index\",\n body: {\n \"settings\": {\n \"index.routing.allocation.require._name\": nil,\n \"index.blocks.write\": nil\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->shrink([\n \"index\" => \"my_source_index\",\n \"target\" => \"my_target_index\",\n \"body\" => [\n \"settings\" => [\n \"index.routing.allocation.require._name\" => null,\n \"index.blocks.write\" => null,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"settings\":{\"index.routing.allocation.require._name\":null,\"index.blocks.write\":null}}' \"$ELASTICSEARCH_URL/my_source_index/_shrink/my_target_index\"" } ] } @@ -18434,6 +24126,26 @@ { "lang": "Console", "source": "POST /_index_template/_simulate_index/my-index-000001\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.simulate_index_template(\n name=\"my-index-000001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.simulateIndexTemplate({\n name: \"my-index-000001\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.simulate_index_template(\n name: \"my-index-000001\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->simulateIndexTemplate([\n \"name\" => \"my-index-000001\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_index_template/_simulate_index/my-index-000001\"" } ] } @@ -18472,6 +24184,26 @@ { "lang": "Console", "source": "POST /_index_template/_simulate\n{\n \"index_patterns\": [\"my-index-*\"],\n \"composed_of\": [\"ct2\"],\n \"priority\": 10,\n \"template\": {\n \"settings\": {\n \"index.number_of_replicas\": 1\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.simulate_template(\n index_patterns=[\n \"my-index-*\"\n ],\n composed_of=[\n \"ct2\"\n ],\n priority=10,\n template={\n \"settings\": {\n \"index.number_of_replicas\": 1\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.simulateTemplate({\n index_patterns: [\"my-index-*\"],\n composed_of: [\"ct2\"],\n priority: 10,\n template: {\n settings: {\n \"index.number_of_replicas\": 1,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.simulate_template(\n body: {\n \"index_patterns\": [\n \"my-index-*\"\n ],\n \"composed_of\": [\n \"ct2\"\n ],\n \"priority\": 10,\n \"template\": {\n \"settings\": {\n \"index.number_of_replicas\": 1\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->simulateTemplate([\n \"body\" => [\n \"index_patterns\" => array(\n \"my-index-*\",\n ),\n \"composed_of\" => array(\n \"ct2\",\n ),\n \"priority\" => 10,\n \"template\" => [\n \"settings\" => [\n \"index.number_of_replicas\" => 1,\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_patterns\":[\"my-index-*\"],\"composed_of\":[\"ct2\"],\"priority\":10,\"template\":{\"settings\":{\"index.number_of_replicas\":1}}}' \"$ELASTICSEARCH_URL/_index_template/_simulate\"" } ] } @@ -18513,6 +24245,26 @@ { "lang": "Console", "source": "POST /_index_template/_simulate\n{\n \"index_patterns\": [\"my-index-*\"],\n \"composed_of\": [\"ct2\"],\n \"priority\": 10,\n \"template\": {\n \"settings\": {\n \"index.number_of_replicas\": 1\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.simulate_template(\n index_patterns=[\n \"my-index-*\"\n ],\n composed_of=[\n \"ct2\"\n ],\n priority=10,\n template={\n \"settings\": {\n \"index.number_of_replicas\": 1\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.simulateTemplate({\n index_patterns: [\"my-index-*\"],\n composed_of: [\"ct2\"],\n priority: 10,\n template: {\n settings: {\n \"index.number_of_replicas\": 1,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.simulate_template(\n body: {\n \"index_patterns\": [\n \"my-index-*\"\n ],\n \"composed_of\": [\n \"ct2\"\n ],\n \"priority\": 10,\n \"template\": {\n \"settings\": {\n \"index.number_of_replicas\": 1\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->simulateTemplate([\n \"body\" => [\n \"index_patterns\" => array(\n \"my-index-*\",\n ),\n \"composed_of\" => array(\n \"ct2\",\n ),\n \"priority\" => 10,\n \"template\" => [\n \"settings\" => [\n \"index.number_of_replicas\" => 1,\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_patterns\":[\"my-index-*\"],\"composed_of\":[\"ct2\"],\"priority\":10,\"template\":{\"settings\":{\"index.number_of_replicas\":1}}}' \"$ELASTICSEARCH_URL/_index_template/_simulate\"" } ] } @@ -18555,6 +24307,26 @@ { "lang": "Console", "source": "POST /my-index-000001/_split/split-my-index-000001\n{\n \"settings\": {\n \"index.number_of_shards\": 2\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.split(\n index=\"my-index-000001\",\n target=\"split-my-index-000001\",\n settings={\n \"index.number_of_shards\": 2\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.split({\n index: \"my-index-000001\",\n target: \"split-my-index-000001\",\n settings: {\n \"index.number_of_shards\": 2,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.split(\n index: \"my-index-000001\",\n target: \"split-my-index-000001\",\n body: {\n \"settings\": {\n \"index.number_of_shards\": 2\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->split([\n \"index\" => \"my-index-000001\",\n \"target\" => \"split-my-index-000001\",\n \"body\" => [\n \"settings\" => [\n \"index.number_of_shards\" => 2,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"settings\":{\"index.number_of_shards\":2}}' \"$ELASTICSEARCH_URL/my-index-000001/_split/split-my-index-000001\"" } ] }, @@ -18595,6 +24367,26 @@ { "lang": "Console", "source": "POST /my-index-000001/_split/split-my-index-000001\n{\n \"settings\": {\n \"index.number_of_shards\": 2\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.split(\n index=\"my-index-000001\",\n target=\"split-my-index-000001\",\n settings={\n \"index.number_of_shards\": 2\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.split({\n index: \"my-index-000001\",\n target: \"split-my-index-000001\",\n settings: {\n \"index.number_of_shards\": 2,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.split(\n index: \"my-index-000001\",\n target: \"split-my-index-000001\",\n body: {\n \"settings\": {\n \"index.number_of_shards\": 2\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->split([\n \"index\" => \"my-index-000001\",\n \"target\" => \"split-my-index-000001\",\n \"body\" => [\n \"settings\" => [\n \"index.number_of_shards\" => 2,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"settings\":{\"index.number_of_shards\":2}}' \"$ELASTICSEARCH_URL/my-index-000001/_split/split-my-index-000001\"" } ] } @@ -18646,6 +24438,26 @@ { "lang": "Console", "source": "GET _stats/fielddata?human&fields=my_join_field#question\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.stats(\n metric=\"fielddata\",\n human=True,\n fields=\"my_join_field\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.stats({\n metric: \"fielddata\",\n human: \"true\",\n fields: \"my_join_field\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.stats(\n metric: \"fielddata\",\n human: \"true\",\n fields: \"my_join_field\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->stats([\n \"metric\" => \"fielddata\",\n \"human\" => \"true\",\n \"fields\" => \"my_join_field\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_stats/fielddata?human&fields=my_join_field#question\"" } ] } @@ -18700,6 +24512,26 @@ { "lang": "Console", "source": "GET _stats/fielddata?human&fields=my_join_field#question\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.stats(\n metric=\"fielddata\",\n human=True,\n fields=\"my_join_field\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.stats({\n metric: \"fielddata\",\n human: \"true\",\n fields: \"my_join_field\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.stats(\n metric: \"fielddata\",\n human: \"true\",\n fields: \"my_join_field\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->stats([\n \"metric\" => \"fielddata\",\n \"human\" => \"true\",\n \"fields\" => \"my_join_field\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_stats/fielddata?human&fields=my_join_field#question\"" } ] } @@ -18754,6 +24586,26 @@ { "lang": "Console", "source": "GET _stats/fielddata?human&fields=my_join_field#question\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.stats(\n metric=\"fielddata\",\n human=True,\n fields=\"my_join_field\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.stats({\n metric: \"fielddata\",\n human: \"true\",\n fields: \"my_join_field\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.stats(\n metric: \"fielddata\",\n human: \"true\",\n fields: \"my_join_field\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->stats([\n \"metric\" => \"fielddata\",\n \"human\" => \"true\",\n \"fields\" => \"my_join_field\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_stats/fielddata?human&fields=my_join_field#question\"" } ] } @@ -18811,6 +24663,26 @@ { "lang": "Console", "source": "GET _stats/fielddata?human&fields=my_join_field#question\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.stats(\n metric=\"fielddata\",\n human=True,\n fields=\"my_join_field\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.stats({\n metric: \"fielddata\",\n human: \"true\",\n fields: \"my_join_field\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.stats(\n metric: \"fielddata\",\n human: \"true\",\n fields: \"my_join_field\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->stats([\n \"metric\" => \"fielddata\",\n \"human\" => \"true\",\n \"fields\" => \"my_join_field\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_stats/fielddata?human&fields=my_join_field#question\"" } ] } @@ -18887,6 +24759,26 @@ { "lang": "Console", "source": "POST _aliases\n{\n \"actions\": [\n {\n \"add\": {\n \"index\": \"logs-nginx.access-prod\",\n \"alias\": \"logs\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.update_aliases(\n actions=[\n {\n \"add\": {\n \"index\": \"logs-nginx.access-prod\",\n \"alias\": \"logs\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.updateAliases({\n actions: [\n {\n add: {\n index: \"logs-nginx.access-prod\",\n alias: \"logs\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.update_aliases(\n body: {\n \"actions\": [\n {\n \"add\": {\n \"index\": \"logs-nginx.access-prod\",\n \"alias\": \"logs\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->updateAliases([\n \"body\" => [\n \"actions\" => array(\n [\n \"add\" => [\n \"index\" => \"logs-nginx.access-prod\",\n \"alias\" => \"logs\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"actions\":[{\"add\":{\"index\":\"logs-nginx.access-prod\",\"alias\":\"logs\"}}]}' \"$ELASTICSEARCH_URL/_aliases\"" } ] } @@ -18950,6 +24842,26 @@ { "lang": "Console", "source": "GET my-index-000001/_validate/query?q=user.id:kimchy\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.validate_query(\n index=\"my-index-000001\",\n q=\"user.id:kimchy\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.validateQuery({\n index: \"my-index-000001\",\n q: \"user.id:kimchy\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.validate_query(\n index: \"my-index-000001\",\n q: \"user.id:kimchy\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->validateQuery([\n \"index\" => \"my-index-000001\",\n \"q\" => \"user.id:kimchy\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_validate/query?q=user.id:kimchy\"" } ] }, @@ -19011,6 +24923,26 @@ { "lang": "Console", "source": "GET my-index-000001/_validate/query?q=user.id:kimchy\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.validate_query(\n index=\"my-index-000001\",\n q=\"user.id:kimchy\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.validateQuery({\n index: \"my-index-000001\",\n q: \"user.id:kimchy\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.validate_query(\n index: \"my-index-000001\",\n q: \"user.id:kimchy\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->validateQuery([\n \"index\" => \"my-index-000001\",\n \"q\" => \"user.id:kimchy\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_validate/query?q=user.id:kimchy\"" } ] } @@ -19077,6 +25009,26 @@ { "lang": "Console", "source": "GET my-index-000001/_validate/query?q=user.id:kimchy\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.validate_query(\n index=\"my-index-000001\",\n q=\"user.id:kimchy\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.validateQuery({\n index: \"my-index-000001\",\n q: \"user.id:kimchy\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.validate_query(\n index: \"my-index-000001\",\n q: \"user.id:kimchy\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->validateQuery([\n \"index\" => \"my-index-000001\",\n \"q\" => \"user.id:kimchy\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_validate/query?q=user.id:kimchy\"" } ] }, @@ -19141,6 +25093,26 @@ { "lang": "Console", "source": "GET my-index-000001/_validate/query?q=user.id:kimchy\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.validate_query(\n index=\"my-index-000001\",\n q=\"user.id:kimchy\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.validateQuery({\n index: \"my-index-000001\",\n q: \"user.id:kimchy\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.validate_query(\n index: \"my-index-000001\",\n q: \"user.id:kimchy\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->validateQuery([\n \"index\" => \"my-index-000001\",\n \"q\" => \"user.id:kimchy\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_validate/query?q=user.id:kimchy\"" } ] } @@ -19190,12 +25162,12 @@ }, "PostChatCompletionRequestExample2": { "summary": "A chat completion task with tool_calls", - "description": "Run `POST POST _inference/chat_completion/openai-completion/_stream` to perform a chat completion using an Assistant message with `tool_calls`.", + "description": "Run `POST _inference/chat_completion/openai-completion/_stream` to perform a chat completion using an Assistant message with `tool_calls`.", "value": "{\n \"messages\": [\n {\n \"role\": \"assistant\",\n \"content\": \"Let's find out what the weather is\",\n \"tool_calls\": [ \n {\n \"id\": \"call_KcAjWtAww20AihPHphUh46Gd\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"arguments\": \"{\\\"location\\\":\\\"Boston, MA\\\"}\"\n }\n }\n ]\n },\n { \n \"role\": \"tool\",\n \"content\": \"The weather is cold\",\n \"tool_call_id\": \"call_KcAjWtAww20AihPHphUh46Gd\"\n }\n ]\n}" }, "PostChatCompletionRequestExample3": { "summary": "A chat completion task with tools and tool_calls", - "description": "Run `POST POST _inference/chat_completion/openai-completion/_stream` to perform a chat completion using a User message with `tools` and `tool_choice`.", + "description": "Run `POST _inference/chat_completion/openai-completion/_stream` to perform a chat completion using a User message with `tools` and `tool_choice`.", "value": "{\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"What's the price of a scarf?\"\n }\n ]\n }\n ],\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_price\",\n \"description\": \"Get the current price of a item\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"item\": {\n \"id\": \"123\"\n }\n }\n }\n }\n }\n ],\n \"tool_choice\": {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_price\"\n }\n }\n}" } } @@ -19226,6 +25198,26 @@ { "lang": "Console", "source": "POST _inference/chat_completion/openai-completion/_stream\n{\n \"model\": \"gpt-4o\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is Elastic?\"\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.chat_completion_unified(\n inference_id=\"openai-completion\",\n chat_completion_request={\n \"model\": \"gpt-4o\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is Elastic?\"\n }\n ]\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.chatCompletionUnified({\n inference_id: \"openai-completion\",\n chat_completion_request: {\n model: \"gpt-4o\",\n messages: [\n {\n role: \"user\",\n content: \"What is Elastic?\",\n },\n ],\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.chat_completion_unified(\n inference_id: \"openai-completion\",\n body: {\n \"model\": \"gpt-4o\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is Elastic?\"\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->chatCompletionUnified([\n \"inference_id\" => \"openai-completion\",\n \"body\" => [\n \"model\" => \"gpt-4o\",\n \"messages\" => array(\n [\n \"role\" => \"user\",\n \"content\" => \"What is Elastic?\",\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"model\":\"gpt-4o\",\"messages\":[{\"role\":\"user\",\"content\":\"What is Elastic?\"}]}' \"$ELASTICSEARCH_URL/_inference/chat_completion/openai-completion/_stream\"" } ] } @@ -19322,6 +25314,26 @@ { "lang": "Console", "source": "POST _inference/completion/openai_chat_completions\n{\n \"input\": \"What is Elastic?\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.completion(\n inference_id=\"openai_chat_completions\",\n input=\"What is Elastic?\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.completion({\n inference_id: \"openai_chat_completions\",\n input: \"What is Elastic?\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.completion(\n inference_id: \"openai_chat_completions\",\n body: {\n \"input\": \"What is Elastic?\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->completion([\n \"inference_id\" => \"openai_chat_completions\",\n \"body\" => [\n \"input\" => \"What is Elastic?\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"input\":\"What is Elastic?\"}' \"$ELASTICSEARCH_URL/_inference/completion/openai_chat_completions\"" } ] } @@ -19348,6 +25360,26 @@ { "lang": "Console", "source": "GET _inference/sparse_embedding/my-elser-model\n" + }, + { + "lang": "Python", + "source": "resp = client.inference.get(\n task_type=\"sparse_embedding\",\n inference_id=\"my-elser-model\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.get({\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.get(\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->get([\n \"task_type\" => \"sparse_embedding\",\n \"inference_id\" => \"my-elser-model\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"" } ] }, @@ -19376,6 +25408,26 @@ { "lang": "Console", "source": "PUT _inference/rerank/my-rerank-model\n{\n \"service\": \"cohere\",\n \"service_settings\": {\n \"model_id\": \"rerank-english-v3.0\",\n \"api_key\": \"{{COHERE_API_KEY}}\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"rerank\",\n inference_id=\"my-rerank-model\",\n inference_config={\n \"service\": \"cohere\",\n \"service_settings\": {\n \"model_id\": \"rerank-english-v3.0\",\n \"api_key\": \"{{COHERE_API_KEY}}\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"rerank\",\n inference_id: \"my-rerank-model\",\n inference_config: {\n service: \"cohere\",\n service_settings: {\n model_id: \"rerank-english-v3.0\",\n api_key: \"{{COHERE_API_KEY}}\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"rerank\",\n inference_id: \"my-rerank-model\",\n body: {\n \"service\": \"cohere\",\n \"service_settings\": {\n \"model_id\": \"rerank-english-v3.0\",\n \"api_key\": \"{{COHERE_API_KEY}}\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"rerank\",\n \"inference_id\" => \"my-rerank-model\",\n \"body\" => [\n \"service\" => \"cohere\",\n \"service_settings\" => [\n \"model_id\" => \"rerank-english-v3.0\",\n \"api_key\" => \"{{COHERE_API_KEY}}\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"cohere\",\"service_settings\":{\"model_id\":\"rerank-english-v3.0\",\"api_key\":\"{{COHERE_API_KEY}}\"}}' \"$ELASTICSEARCH_URL/_inference/rerank/my-rerank-model\"" } ] }, @@ -19431,6 +25483,26 @@ { "lang": "Console", "source": "DELETE /_inference/sparse_embedding/my-elser-model\n" + }, + { + "lang": "Python", + "source": "resp = client.inference.delete(\n task_type=\"sparse_embedding\",\n inference_id=\"my-elser-model\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.delete({\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.delete(\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->delete([\n \"task_type\" => \"sparse_embedding\",\n \"inference_id\" => \"my-elser-model\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"" } ] } @@ -19460,6 +25532,26 @@ { "lang": "Console", "source": "GET _inference/sparse_embedding/my-elser-model\n" + }, + { + "lang": "Python", + "source": "resp = client.inference.get(\n task_type=\"sparse_embedding\",\n inference_id=\"my-elser-model\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.get({\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.get(\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->get([\n \"task_type\" => \"sparse_embedding\",\n \"inference_id\" => \"my-elser-model\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"" } ] }, @@ -19491,6 +25583,26 @@ { "lang": "Console", "source": "PUT _inference/rerank/my-rerank-model\n{\n \"service\": \"cohere\",\n \"service_settings\": {\n \"model_id\": \"rerank-english-v3.0\",\n \"api_key\": \"{{COHERE_API_KEY}}\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"rerank\",\n inference_id=\"my-rerank-model\",\n inference_config={\n \"service\": \"cohere\",\n \"service_settings\": {\n \"model_id\": \"rerank-english-v3.0\",\n \"api_key\": \"{{COHERE_API_KEY}}\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"rerank\",\n inference_id: \"my-rerank-model\",\n inference_config: {\n service: \"cohere\",\n service_settings: {\n model_id: \"rerank-english-v3.0\",\n api_key: \"{{COHERE_API_KEY}}\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"rerank\",\n inference_id: \"my-rerank-model\",\n body: {\n \"service\": \"cohere\",\n \"service_settings\": {\n \"model_id\": \"rerank-english-v3.0\",\n \"api_key\": \"{{COHERE_API_KEY}}\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"rerank\",\n \"inference_id\" => \"my-rerank-model\",\n \"body\" => [\n \"service\" => \"cohere\",\n \"service_settings\" => [\n \"model_id\" => \"rerank-english-v3.0\",\n \"api_key\" => \"{{COHERE_API_KEY}}\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"cohere\",\"service_settings\":{\"model_id\":\"rerank-english-v3.0\",\"api_key\":\"{{COHERE_API_KEY}}\"}}' \"$ELASTICSEARCH_URL/_inference/rerank/my-rerank-model\"" } ] }, @@ -19552,6 +25664,26 @@ { "lang": "Console", "source": "DELETE /_inference/sparse_embedding/my-elser-model\n" + }, + { + "lang": "Python", + "source": "resp = client.inference.delete(\n task_type=\"sparse_embedding\",\n inference_id=\"my-elser-model\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.delete({\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.delete(\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->delete([\n \"task_type\" => \"sparse_embedding\",\n \"inference_id\" => \"my-elser-model\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"" } ] } @@ -19573,6 +25705,26 @@ { "lang": "Console", "source": "GET _inference/sparse_embedding/my-elser-model\n" + }, + { + "lang": "Python", + "source": "resp = client.inference.get(\n task_type=\"sparse_embedding\",\n inference_id=\"my-elser-model\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.get({\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.get(\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->get([\n \"task_type\" => \"sparse_embedding\",\n \"inference_id\" => \"my-elser-model\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"" } ] } @@ -19675,6 +25827,26 @@ { "lang": "Console", "source": "PUT _inference/completion/alibabacloud_ai_search_completion\n{\n \"service\": \"alibabacloud-ai-search\",\n \"service_settings\": {\n \"host\" : \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n \"api_key\": \"AlibabaCloud-API-Key\",\n \"service_id\": \"ops-qwen-turbo\",\n \"workspace\" : \"default\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"completion\",\n inference_id=\"alibabacloud_ai_search_completion\",\n inference_config={\n \"service\": \"alibabacloud-ai-search\",\n \"service_settings\": {\n \"host\": \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n \"api_key\": \"AlibabaCloud-API-Key\",\n \"service_id\": \"ops-qwen-turbo\",\n \"workspace\": \"default\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"completion\",\n inference_id: \"alibabacloud_ai_search_completion\",\n inference_config: {\n service: \"alibabacloud-ai-search\",\n service_settings: {\n host: \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n api_key: \"AlibabaCloud-API-Key\",\n service_id: \"ops-qwen-turbo\",\n workspace: \"default\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"completion\",\n inference_id: \"alibabacloud_ai_search_completion\",\n body: {\n \"service\": \"alibabacloud-ai-search\",\n \"service_settings\": {\n \"host\": \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n \"api_key\": \"AlibabaCloud-API-Key\",\n \"service_id\": \"ops-qwen-turbo\",\n \"workspace\": \"default\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"completion\",\n \"inference_id\" => \"alibabacloud_ai_search_completion\",\n \"body\" => [\n \"service\" => \"alibabacloud-ai-search\",\n \"service_settings\" => [\n \"host\" => \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n \"api_key\" => \"AlibabaCloud-API-Key\",\n \"service_id\" => \"ops-qwen-turbo\",\n \"workspace\" => \"default\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"alibabacloud-ai-search\",\"service_settings\":{\"host\":\"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\"api_key\":\"AlibabaCloud-API-Key\",\"service_id\":\"ops-qwen-turbo\",\"workspace\":\"default\"}}' \"$ELASTICSEARCH_URL/_inference/completion/alibabacloud_ai_search_completion\"" } ] } @@ -19767,6 +25939,26 @@ { "lang": "Console", "source": "PUT _inference/text_embedding/amazon_bedrock_embeddings\n{\n \"service\": \"amazonbedrock\",\n \"service_settings\": {\n \"access_key\": \"AWS-access-key\",\n \"secret_key\": \"AWS-secret-key\",\n \"region\": \"us-east-1\",\n \"provider\": \"amazontitan\",\n \"model\": \"amazon.titan-embed-text-v2:0\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"amazon_bedrock_embeddings\",\n inference_config={\n \"service\": \"amazonbedrock\",\n \"service_settings\": {\n \"access_key\": \"AWS-access-key\",\n \"secret_key\": \"AWS-secret-key\",\n \"region\": \"us-east-1\",\n \"provider\": \"amazontitan\",\n \"model\": \"amazon.titan-embed-text-v2:0\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"amazon_bedrock_embeddings\",\n inference_config: {\n service: \"amazonbedrock\",\n service_settings: {\n access_key: \"AWS-access-key\",\n secret_key: \"AWS-secret-key\",\n region: \"us-east-1\",\n provider: \"amazontitan\",\n model: \"amazon.titan-embed-text-v2:0\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"amazon_bedrock_embeddings\",\n body: {\n \"service\": \"amazonbedrock\",\n \"service_settings\": {\n \"access_key\": \"AWS-access-key\",\n \"secret_key\": \"AWS-secret-key\",\n \"region\": \"us-east-1\",\n \"provider\": \"amazontitan\",\n \"model\": \"amazon.titan-embed-text-v2:0\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"amazon_bedrock_embeddings\",\n \"body\" => [\n \"service\" => \"amazonbedrock\",\n \"service_settings\" => [\n \"access_key\" => \"AWS-access-key\",\n \"secret_key\" => \"AWS-secret-key\",\n \"region\" => \"us-east-1\",\n \"provider\" => \"amazontitan\",\n \"model\" => \"amazon.titan-embed-text-v2:0\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"amazonbedrock\",\"service_settings\":{\"access_key\":\"AWS-access-key\",\"secret_key\":\"AWS-secret-key\",\"region\":\"us-east-1\",\"provider\":\"amazontitan\",\"model\":\"amazon.titan-embed-text-v2:0\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/amazon_bedrock_embeddings\"" } ] } @@ -19853,6 +26045,26 @@ { "lang": "Console", "source": "PUT _inference/completion/anthropic_completion\n{\n \"service\": \"anthropic\",\n \"service_settings\": {\n \"api_key\": \"Anthropic-Api-Key\",\n \"model_id\": \"Model-ID\"\n },\n \"task_settings\": {\n \"max_tokens\": 1024\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"completion\",\n inference_id=\"anthropic_completion\",\n inference_config={\n \"service\": \"anthropic\",\n \"service_settings\": {\n \"api_key\": \"Anthropic-Api-Key\",\n \"model_id\": \"Model-ID\"\n },\n \"task_settings\": {\n \"max_tokens\": 1024\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"completion\",\n inference_id: \"anthropic_completion\",\n inference_config: {\n service: \"anthropic\",\n service_settings: {\n api_key: \"Anthropic-Api-Key\",\n model_id: \"Model-ID\",\n },\n task_settings: {\n max_tokens: 1024,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"completion\",\n inference_id: \"anthropic_completion\",\n body: {\n \"service\": \"anthropic\",\n \"service_settings\": {\n \"api_key\": \"Anthropic-Api-Key\",\n \"model_id\": \"Model-ID\"\n },\n \"task_settings\": {\n \"max_tokens\": 1024\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"completion\",\n \"inference_id\" => \"anthropic_completion\",\n \"body\" => [\n \"service\" => \"anthropic\",\n \"service_settings\" => [\n \"api_key\" => \"Anthropic-Api-Key\",\n \"model_id\" => \"Model-ID\",\n ],\n \"task_settings\" => [\n \"max_tokens\" => 1024,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"anthropic\",\"service_settings\":{\"api_key\":\"Anthropic-Api-Key\",\"model_id\":\"Model-ID\"},\"task_settings\":{\"max_tokens\":1024}}' \"$ELASTICSEARCH_URL/_inference/completion/anthropic_completion\"" } ] } @@ -19945,6 +26157,26 @@ { "lang": "Console", "source": "PUT _inference/text_embedding/azure_ai_studio_embeddings\n{\n \"service\": \"azureaistudio\",\n \"service_settings\": {\n \"api_key\": \"Azure-AI-Studio-API-key\",\n \"target\": \"Target-Uri\",\n \"provider\": \"openai\",\n \"endpoint_type\": \"token\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"azure_ai_studio_embeddings\",\n inference_config={\n \"service\": \"azureaistudio\",\n \"service_settings\": {\n \"api_key\": \"Azure-AI-Studio-API-key\",\n \"target\": \"Target-Uri\",\n \"provider\": \"openai\",\n \"endpoint_type\": \"token\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"azure_ai_studio_embeddings\",\n inference_config: {\n service: \"azureaistudio\",\n service_settings: {\n api_key: \"Azure-AI-Studio-API-key\",\n target: \"Target-Uri\",\n provider: \"openai\",\n endpoint_type: \"token\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"azure_ai_studio_embeddings\",\n body: {\n \"service\": \"azureaistudio\",\n \"service_settings\": {\n \"api_key\": \"Azure-AI-Studio-API-key\",\n \"target\": \"Target-Uri\",\n \"provider\": \"openai\",\n \"endpoint_type\": \"token\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"azure_ai_studio_embeddings\",\n \"body\" => [\n \"service\" => \"azureaistudio\",\n \"service_settings\" => [\n \"api_key\" => \"Azure-AI-Studio-API-key\",\n \"target\" => \"Target-Uri\",\n \"provider\" => \"openai\",\n \"endpoint_type\" => \"token\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"azureaistudio\",\"service_settings\":{\"api_key\":\"Azure-AI-Studio-API-key\",\"target\":\"Target-Uri\",\"provider\":\"openai\",\"endpoint_type\":\"token\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/azure_ai_studio_embeddings\"" } ] } @@ -20037,6 +26269,26 @@ { "lang": "Console", "source": "PUT _inference/text_embedding/azure_openai_embeddings\n{\n \"service\": \"azureopenai\",\n \"service_settings\": {\n \"api_key\": \"Api-Key\",\n \"resource_name\": \"Resource-name\",\n \"deployment_id\": \"Deployment-id\",\n \"api_version\": \"2024-02-01\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"azure_openai_embeddings\",\n inference_config={\n \"service\": \"azureopenai\",\n \"service_settings\": {\n \"api_key\": \"Api-Key\",\n \"resource_name\": \"Resource-name\",\n \"deployment_id\": \"Deployment-id\",\n \"api_version\": \"2024-02-01\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"azure_openai_embeddings\",\n inference_config: {\n service: \"azureopenai\",\n service_settings: {\n api_key: \"Api-Key\",\n resource_name: \"Resource-name\",\n deployment_id: \"Deployment-id\",\n api_version: \"2024-02-01\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"azure_openai_embeddings\",\n body: {\n \"service\": \"azureopenai\",\n \"service_settings\": {\n \"api_key\": \"Api-Key\",\n \"resource_name\": \"Resource-name\",\n \"deployment_id\": \"Deployment-id\",\n \"api_version\": \"2024-02-01\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"azure_openai_embeddings\",\n \"body\" => [\n \"service\" => \"azureopenai\",\n \"service_settings\" => [\n \"api_key\" => \"Api-Key\",\n \"resource_name\" => \"Resource-name\",\n \"deployment_id\" => \"Deployment-id\",\n \"api_version\" => \"2024-02-01\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"azureopenai\",\"service_settings\":{\"api_key\":\"Api-Key\",\"resource_name\":\"Resource-name\",\"deployment_id\":\"Deployment-id\",\"api_version\":\"2024-02-01\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/azure_openai_embeddings\"" } ] } @@ -20129,6 +26381,26 @@ { "lang": "Console", "source": "PUT _inference/text_embedding/cohere-embeddings\n{\n \"service\": \"cohere\",\n \"service_settings\": {\n \"api_key\": \"Cohere-Api-key\",\n \"model_id\": \"embed-english-light-v3.0\",\n \"embedding_type\": \"byte\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"cohere-embeddings\",\n inference_config={\n \"service\": \"cohere\",\n \"service_settings\": {\n \"api_key\": \"Cohere-Api-key\",\n \"model_id\": \"embed-english-light-v3.0\",\n \"embedding_type\": \"byte\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"cohere-embeddings\",\n inference_config: {\n service: \"cohere\",\n service_settings: {\n api_key: \"Cohere-Api-key\",\n model_id: \"embed-english-light-v3.0\",\n embedding_type: \"byte\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"cohere-embeddings\",\n body: {\n \"service\": \"cohere\",\n \"service_settings\": {\n \"api_key\": \"Cohere-Api-key\",\n \"model_id\": \"embed-english-light-v3.0\",\n \"embedding_type\": \"byte\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"cohere-embeddings\",\n \"body\" => [\n \"service\" => \"cohere\",\n \"service_settings\" => [\n \"api_key\" => \"Cohere-Api-key\",\n \"model_id\" => \"embed-english-light-v3.0\",\n \"embedding_type\" => \"byte\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"cohere\",\"service_settings\":{\"api_key\":\"Cohere-Api-key\",\"model_id\":\"embed-english-light-v3.0\",\"embedding_type\":\"byte\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/cohere-embeddings\"" } ] } @@ -20247,6 +26519,26 @@ { "lang": "Console", "source": "PUT _inference/sparse_embedding/my-elser-model\n{\n \"service\": \"elasticsearch\",\n \"service_settings\": {\n \"adaptive_allocations\": { \n \"enabled\": true,\n \"min_number_of_allocations\": 1,\n \"max_number_of_allocations\": 4\n },\n \"num_threads\": 1,\n \"model_id\": \".elser_model_2\" \n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"sparse_embedding\",\n inference_id=\"my-elser-model\",\n inference_config={\n \"service\": \"elasticsearch\",\n \"service_settings\": {\n \"adaptive_allocations\": {\n \"enabled\": True,\n \"min_number_of_allocations\": 1,\n \"max_number_of_allocations\": 4\n },\n \"num_threads\": 1,\n \"model_id\": \".elser_model_2\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n inference_config: {\n service: \"elasticsearch\",\n service_settings: {\n adaptive_allocations: {\n enabled: true,\n min_number_of_allocations: 1,\n max_number_of_allocations: 4,\n },\n num_threads: 1,\n model_id: \".elser_model_2\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n body: {\n \"service\": \"elasticsearch\",\n \"service_settings\": {\n \"adaptive_allocations\": {\n \"enabled\": true,\n \"min_number_of_allocations\": 1,\n \"max_number_of_allocations\": 4\n },\n \"num_threads\": 1,\n \"model_id\": \".elser_model_2\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"sparse_embedding\",\n \"inference_id\" => \"my-elser-model\",\n \"body\" => [\n \"service\" => \"elasticsearch\",\n \"service_settings\" => [\n \"adaptive_allocations\" => [\n \"enabled\" => true,\n \"min_number_of_allocations\" => 1,\n \"max_number_of_allocations\" => 4,\n ],\n \"num_threads\" => 1,\n \"model_id\" => \".elser_model_2\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"elasticsearch\",\"service_settings\":{\"adaptive_allocations\":{\"enabled\":true,\"min_number_of_allocations\":1,\"max_number_of_allocations\":4},\"num_threads\":1,\"model_id\":\".elser_model_2\"}}' \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"" } ] } @@ -20343,6 +26635,26 @@ { "lang": "Console", "source": "PUT _inference/sparse_embedding/my-elser-model\n{\n \"service\": \"elser\",\n \"service_settings\": {\n \"num_allocations\": 1,\n \"num_threads\": 1\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"sparse_embedding\",\n inference_id=\"my-elser-model\",\n inference_config={\n \"service\": \"elser\",\n \"service_settings\": {\n \"num_allocations\": 1,\n \"num_threads\": 1\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n inference_config: {\n service: \"elser\",\n service_settings: {\n num_allocations: 1,\n num_threads: 1,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n body: {\n \"service\": \"elser\",\n \"service_settings\": {\n \"num_allocations\": 1,\n \"num_threads\": 1\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"sparse_embedding\",\n \"inference_id\" => \"my-elser-model\",\n \"body\" => [\n \"service\" => \"elser\",\n \"service_settings\" => [\n \"num_allocations\" => 1,\n \"num_threads\" => 1,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"elser\",\"service_settings\":{\"num_allocations\":1,\"num_threads\":1}}' \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"" } ] } @@ -20427,6 +26739,26 @@ { "lang": "Console", "source": "PUT _inference/completion/google_ai_studio_completion\n{\n \"service\": \"googleaistudio\",\n \"service_settings\": {\n \"api_key\": \"api-key\",\n \"model_id\": \"model-id\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"completion\",\n inference_id=\"google_ai_studio_completion\",\n inference_config={\n \"service\": \"googleaistudio\",\n \"service_settings\": {\n \"api_key\": \"api-key\",\n \"model_id\": \"model-id\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"completion\",\n inference_id: \"google_ai_studio_completion\",\n inference_config: {\n service: \"googleaistudio\",\n service_settings: {\n api_key: \"api-key\",\n model_id: \"model-id\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"completion\",\n inference_id: \"google_ai_studio_completion\",\n body: {\n \"service\": \"googleaistudio\",\n \"service_settings\": {\n \"api_key\": \"api-key\",\n \"model_id\": \"model-id\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"completion\",\n \"inference_id\" => \"google_ai_studio_completion\",\n \"body\" => [\n \"service\" => \"googleaistudio\",\n \"service_settings\" => [\n \"api_key\" => \"api-key\",\n \"model_id\" => \"model-id\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"googleaistudio\",\"service_settings\":{\"api_key\":\"api-key\",\"model_id\":\"model-id\"}}' \"$ELASTICSEARCH_URL/_inference/completion/google_ai_studio_completion\"" } ] } @@ -20519,6 +26851,26 @@ { "lang": "Console", "source": "PUT _inference/text_embedding/google_vertex_ai_embeddingss\n{\n \"service\": \"googlevertexai\",\n \"service_settings\": {\n \"service_account_json\": \"service-account-json\",\n \"model_id\": \"model-id\",\n \"location\": \"location\",\n \"project_id\": \"project-id\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"google_vertex_ai_embeddingss\",\n inference_config={\n \"service\": \"googlevertexai\",\n \"service_settings\": {\n \"service_account_json\": \"service-account-json\",\n \"model_id\": \"model-id\",\n \"location\": \"location\",\n \"project_id\": \"project-id\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"google_vertex_ai_embeddingss\",\n inference_config: {\n service: \"googlevertexai\",\n service_settings: {\n service_account_json: \"service-account-json\",\n model_id: \"model-id\",\n location: \"location\",\n project_id: \"project-id\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"google_vertex_ai_embeddingss\",\n body: {\n \"service\": \"googlevertexai\",\n \"service_settings\": {\n \"service_account_json\": \"service-account-json\",\n \"model_id\": \"model-id\",\n \"location\": \"location\",\n \"project_id\": \"project-id\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"google_vertex_ai_embeddingss\",\n \"body\" => [\n \"service\" => \"googlevertexai\",\n \"service_settings\" => [\n \"service_account_json\" => \"service-account-json\",\n \"model_id\" => \"model-id\",\n \"location\" => \"location\",\n \"project_id\" => \"project-id\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"googlevertexai\",\"service_settings\":{\"service_account_json\":\"service-account-json\",\"model_id\":\"model-id\",\"location\":\"location\",\"project_id\":\"project-id\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/google_vertex_ai_embeddingss\"" } ] } @@ -20603,6 +26955,26 @@ { "lang": "Console", "source": "PUT _inference/text_embedding/hugging-face-embeddings\n{\n \"service\": \"hugging_face\",\n \"service_settings\": {\n \"api_key\": \"hugging-face-access-token\", \n \"url\": \"url-endpoint\" \n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"hugging-face-embeddings\",\n inference_config={\n \"service\": \"hugging_face\",\n \"service_settings\": {\n \"api_key\": \"hugging-face-access-token\",\n \"url\": \"url-endpoint\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"hugging-face-embeddings\",\n inference_config: {\n service: \"hugging_face\",\n service_settings: {\n api_key: \"hugging-face-access-token\",\n url: \"url-endpoint\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"hugging-face-embeddings\",\n body: {\n \"service\": \"hugging_face\",\n \"service_settings\": {\n \"api_key\": \"hugging-face-access-token\",\n \"url\": \"url-endpoint\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"hugging-face-embeddings\",\n \"body\" => [\n \"service\" => \"hugging_face\",\n \"service_settings\" => [\n \"api_key\" => \"hugging-face-access-token\",\n \"url\" => \"url-endpoint\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"hugging_face\",\"service_settings\":{\"api_key\":\"hugging-face-access-token\",\"url\":\"url-endpoint\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/hugging-face-embeddings\"" } ] } @@ -20695,6 +27067,26 @@ { "lang": "Console", "source": "PUT _inference/text_embedding/jinaai-embeddings\n{\n \"service\": \"jinaai\",\n \"service_settings\": {\n \"model_id\": \"jina-embeddings-v3\",\n \"api_key\": \"JinaAi-Api-key\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"jinaai-embeddings\",\n inference_config={\n \"service\": \"jinaai\",\n \"service_settings\": {\n \"model_id\": \"jina-embeddings-v3\",\n \"api_key\": \"JinaAi-Api-key\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"jinaai-embeddings\",\n inference_config: {\n service: \"jinaai\",\n service_settings: {\n model_id: \"jina-embeddings-v3\",\n api_key: \"JinaAi-Api-key\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"jinaai-embeddings\",\n body: {\n \"service\": \"jinaai\",\n \"service_settings\": {\n \"model_id\": \"jina-embeddings-v3\",\n \"api_key\": \"JinaAi-Api-key\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"jinaai-embeddings\",\n \"body\" => [\n \"service\" => \"jinaai\",\n \"service_settings\" => [\n \"model_id\" => \"jina-embeddings-v3\",\n \"api_key\" => \"JinaAi-Api-key\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"jinaai\",\"service_settings\":{\"model_id\":\"jina-embeddings-v3\",\"api_key\":\"JinaAi-Api-key\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/jinaai-embeddings\"" } ] } @@ -20778,6 +27170,26 @@ { "lang": "Console", "source": "PUT _inference/text_embedding/mistral-embeddings-test\n{\n \"service\": \"mistral\",\n \"service_settings\": {\n \"api_key\": \"Mistral-API-Key\",\n \"model\": \"mistral-embed\" \n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"mistral-embeddings-test\",\n inference_config={\n \"service\": \"mistral\",\n \"service_settings\": {\n \"api_key\": \"Mistral-API-Key\",\n \"model\": \"mistral-embed\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"mistral-embeddings-test\",\n inference_config: {\n service: \"mistral\",\n service_settings: {\n api_key: \"Mistral-API-Key\",\n model: \"mistral-embed\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"mistral-embeddings-test\",\n body: {\n \"service\": \"mistral\",\n \"service_settings\": {\n \"api_key\": \"Mistral-API-Key\",\n \"model\": \"mistral-embed\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"mistral-embeddings-test\",\n \"body\" => [\n \"service\" => \"mistral\",\n \"service_settings\" => [\n \"api_key\" => \"Mistral-API-Key\",\n \"model\" => \"mistral-embed\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"mistral\",\"service_settings\":{\"api_key\":\"Mistral-API-Key\",\"model\":\"mistral-embed\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/mistral-embeddings-test\"" } ] } @@ -20870,6 +27282,26 @@ { "lang": "Console", "source": "PUT _inference/text_embedding/openai-embeddings\n{\n \"service\": \"openai\",\n \"service_settings\": {\n \"api_key\": \"OpenAI-API-Key\",\n \"model_id\": \"text-embedding-3-small\",\n \"dimensions\": 128\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"openai-embeddings\",\n inference_config={\n \"service\": \"openai\",\n \"service_settings\": {\n \"api_key\": \"OpenAI-API-Key\",\n \"model_id\": \"text-embedding-3-small\",\n \"dimensions\": 128\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"openai-embeddings\",\n inference_config: {\n service: \"openai\",\n service_settings: {\n api_key: \"OpenAI-API-Key\",\n model_id: \"text-embedding-3-small\",\n dimensions: 128,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"openai-embeddings\",\n body: {\n \"service\": \"openai\",\n \"service_settings\": {\n \"api_key\": \"OpenAI-API-Key\",\n \"model_id\": \"text-embedding-3-small\",\n \"dimensions\": 128\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"openai-embeddings\",\n \"body\" => [\n \"service\" => \"openai\",\n \"service_settings\" => [\n \"api_key\" => \"OpenAI-API-Key\",\n \"model_id\" => \"text-embedding-3-small\",\n \"dimensions\" => 128,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"openai\",\"service_settings\":{\"api_key\":\"OpenAI-API-Key\",\"model_id\":\"text-embedding-3-small\",\"dimensions\":128}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/openai-embeddings\"" } ] } @@ -20962,6 +27394,26 @@ { "lang": "Console", "source": "PUT _inference/text_embedding/openai-embeddings\n{\n \"service\": \"voyageai\",\n \"service_settings\": {\n \"model_id\": \"voyage-3-large\",\n \"dimensions\": 512\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"openai-embeddings\",\n inference_config={\n \"service\": \"voyageai\",\n \"service_settings\": {\n \"model_id\": \"voyage-3-large\",\n \"dimensions\": 512\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"openai-embeddings\",\n inference_config: {\n service: \"voyageai\",\n service_settings: {\n model_id: \"voyage-3-large\",\n dimensions: 512,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"openai-embeddings\",\n body: {\n \"service\": \"voyageai\",\n \"service_settings\": {\n \"model_id\": \"voyage-3-large\",\n \"dimensions\": 512\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"openai-embeddings\",\n \"body\" => [\n \"service\" => \"voyageai\",\n \"service_settings\" => [\n \"model_id\" => \"voyage-3-large\",\n \"dimensions\" => 512,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"voyageai\",\"service_settings\":{\"model_id\":\"voyage-3-large\",\"dimensions\":512}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/openai-embeddings\"" } ] } @@ -21042,6 +27494,26 @@ { "lang": "Console", "source": "PUT _inference/text_embedding/watsonx-embeddings\n{\n \"service\": \"watsonxai\",\n \"service_settings\": {\n \"api_key\": \"Watsonx-API-Key\", \n \"url\": \"Wastonx-URL\", \n \"model_id\": \"ibm/slate-30m-english-rtrvr\",\n \"project_id\": \"IBM-Cloud-ID\", \n \"api_version\": \"2024-03-14\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"watsonx-embeddings\",\n inference_config={\n \"service\": \"watsonxai\",\n \"service_settings\": {\n \"api_key\": \"Watsonx-API-Key\",\n \"url\": \"Wastonx-URL\",\n \"model_id\": \"ibm/slate-30m-english-rtrvr\",\n \"project_id\": \"IBM-Cloud-ID\",\n \"api_version\": \"2024-03-14\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"watsonx-embeddings\",\n inference_config: {\n service: \"watsonxai\",\n service_settings: {\n api_key: \"Watsonx-API-Key\",\n url: \"Wastonx-URL\",\n model_id: \"ibm/slate-30m-english-rtrvr\",\n project_id: \"IBM-Cloud-ID\",\n api_version: \"2024-03-14\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"watsonx-embeddings\",\n body: {\n \"service\": \"watsonxai\",\n \"service_settings\": {\n \"api_key\": \"Watsonx-API-Key\",\n \"url\": \"Wastonx-URL\",\n \"model_id\": \"ibm/slate-30m-english-rtrvr\",\n \"project_id\": \"IBM-Cloud-ID\",\n \"api_version\": \"2024-03-14\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"watsonx-embeddings\",\n \"body\" => [\n \"service\" => \"watsonxai\",\n \"service_settings\" => [\n \"api_key\" => \"Watsonx-API-Key\",\n \"url\" => \"Wastonx-URL\",\n \"model_id\" => \"ibm/slate-30m-english-rtrvr\",\n \"project_id\" => \"IBM-Cloud-ID\",\n \"api_version\" => \"2024-03-14\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"watsonxai\",\"service_settings\":{\"api_key\":\"Watsonx-API-Key\",\"url\":\"Wastonx-URL\",\"model_id\":\"ibm/slate-30m-english-rtrvr\",\"project_id\":\"IBM-Cloud-ID\",\"api_version\":\"2024-03-14\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/watsonx-embeddings\"" } ] } @@ -21144,6 +27616,26 @@ { "lang": "Console", "source": "POST _inference/rerank/cohere_rerank\n{\n \"input\": [\"luke\", \"like\", \"leia\", \"chewy\",\"r2d2\", \"star\", \"wars\"],\n \"query\": \"star wars main character\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.rerank(\n inference_id=\"cohere_rerank\",\n input=[\n \"luke\",\n \"like\",\n \"leia\",\n \"chewy\",\n \"r2d2\",\n \"star\",\n \"wars\"\n ],\n query=\"star wars main character\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.rerank({\n inference_id: \"cohere_rerank\",\n input: [\"luke\", \"like\", \"leia\", \"chewy\", \"r2d2\", \"star\", \"wars\"],\n query: \"star wars main character\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.rerank(\n inference_id: \"cohere_rerank\",\n body: {\n \"input\": [\n \"luke\",\n \"like\",\n \"leia\",\n \"chewy\",\n \"r2d2\",\n \"star\",\n \"wars\"\n ],\n \"query\": \"star wars main character\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->rerank([\n \"inference_id\" => \"cohere_rerank\",\n \"body\" => [\n \"input\" => array(\n \"luke\",\n \"like\",\n \"leia\",\n \"chewy\",\n \"r2d2\",\n \"star\",\n \"wars\",\n ),\n \"query\" => \"star wars main character\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"input\":[\"luke\",\"like\",\"leia\",\"chewy\",\"r2d2\",\"star\",\"wars\"],\"query\":\"star wars main character\"}' \"$ELASTICSEARCH_URL/_inference/rerank/cohere_rerank\"" } ] } @@ -21240,6 +27732,26 @@ { "lang": "Console", "source": "POST _inference/sparse_embedding/my-elser-model\n{\n \"input\": \"The sky above the port was the color of television tuned to a dead channel.\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.sparse_embedding(\n inference_id=\"my-elser-model\",\n input=\"The sky above the port was the color of television tuned to a dead channel.\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.sparseEmbedding({\n inference_id: \"my-elser-model\",\n input:\n \"The sky above the port was the color of television tuned to a dead channel.\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.sparse_embedding(\n inference_id: \"my-elser-model\",\n body: {\n \"input\": \"The sky above the port was the color of television tuned to a dead channel.\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->sparseEmbedding([\n \"inference_id\" => \"my-elser-model\",\n \"body\" => [\n \"input\" => \"The sky above the port was the color of television tuned to a dead channel.\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"input\":\"The sky above the port was the color of television tuned to a dead channel.\"}' \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"" } ] } @@ -21320,6 +27832,26 @@ { "lang": "Console", "source": "POST _inference/completion/openai-completion/_stream\n{\n \"input\": \"What is Elastic?\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.stream_completion(\n inference_id=\"openai-completion\",\n input=\"What is Elastic?\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.streamCompletion({\n inference_id: \"openai-completion\",\n input: \"What is Elastic?\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.stream_completion(\n inference_id: \"openai-completion\",\n body: {\n \"input\": \"What is Elastic?\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->streamCompletion([\n \"inference_id\" => \"openai-completion\",\n \"body\" => [\n \"input\" => \"What is Elastic?\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"input\":\"What is Elastic?\"}' \"$ELASTICSEARCH_URL/_inference/completion/openai-completion/_stream\"" } ] } @@ -21416,6 +27948,26 @@ { "lang": "Console", "source": "POST _inference/text_embedding/my-cohere-endpoint\n{\n \"input\": \"The sky above the port was the color of television tuned to a dead channel.\",\n \"task_settings\": {\n \"input_type\": \"ingest\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.text_embedding(\n inference_id=\"my-cohere-endpoint\",\n input=\"The sky above the port was the color of television tuned to a dead channel.\",\n task_settings={\n \"input_type\": \"ingest\"\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.textEmbedding({\n inference_id: \"my-cohere-endpoint\",\n input:\n \"The sky above the port was the color of television tuned to a dead channel.\",\n task_settings: {\n input_type: \"ingest\",\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.text_embedding(\n inference_id: \"my-cohere-endpoint\",\n body: {\n \"input\": \"The sky above the port was the color of television tuned to a dead channel.\",\n \"task_settings\": {\n \"input_type\": \"ingest\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->textEmbedding([\n \"inference_id\" => \"my-cohere-endpoint\",\n \"body\" => [\n \"input\" => \"The sky above the port was the color of television tuned to a dead channel.\",\n \"task_settings\" => [\n \"input_type\" => \"ingest\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"input\":\"The sky above the port was the color of television tuned to a dead channel.\",\"task_settings\":{\"input_type\":\"ingest\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/my-cohere-endpoint\"" } ] } @@ -21446,6 +27998,26 @@ { "lang": "Console", "source": "PUT _inference/my-inference-endpoint/_update\n{\n \"service_settings\": {\n \"api_key\": \"\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.update(\n inference_id=\"my-inference-endpoint\",\n inference_config={\n \"service_settings\": {\n \"api_key\": \"\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.update({\n inference_id: \"my-inference-endpoint\",\n inference_config: {\n service_settings: {\n api_key: \"\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.update(\n inference_id: \"my-inference-endpoint\",\n body: {\n \"service_settings\": {\n \"api_key\": \"\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->update([\n \"inference_id\" => \"my-inference-endpoint\",\n \"body\" => [\n \"service_settings\" => [\n \"api_key\" => \"\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service_settings\":{\"api_key\":\"\"}}' \"$ELASTICSEARCH_URL/_inference/my-inference-endpoint/_update\"" } ] } @@ -21479,6 +28051,26 @@ { "lang": "Console", "source": "PUT _inference/my-inference-endpoint/_update\n{\n \"service_settings\": {\n \"api_key\": \"\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.update(\n inference_id=\"my-inference-endpoint\",\n inference_config={\n \"service_settings\": {\n \"api_key\": \"\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.update({\n inference_id: \"my-inference-endpoint\",\n inference_config: {\n service_settings: {\n api_key: \"\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.update(\n inference_id: \"my-inference-endpoint\",\n body: {\n \"service_settings\": {\n \"api_key\": \"\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->update([\n \"inference_id\" => \"my-inference-endpoint\",\n \"body\" => [\n \"service_settings\" => [\n \"api_key\" => \"\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service_settings\":{\"api_key\":\"\"}}' \"$ELASTICSEARCH_URL/_inference/my-inference-endpoint/_update\"" } ] } @@ -21537,6 +28129,26 @@ { "lang": "Console", "source": "GET /\n" + }, + { + "lang": "Python", + "source": "resp = client.info()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.info();" + }, + { + "lang": "Ruby", + "source": "response = client.info" + }, + { + "lang": "PHP", + "source": "$resp = $client->info();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/\"" } ] }, @@ -21734,6 +28346,26 @@ { "lang": "Console", "source": "GET /_ingest/ip_location/database/my-database-id\n" + }, + { + "lang": "Python", + "source": "resp = client.ingest.get_ip_location_database(\n id=\"my-database-id\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ingest.getIpLocationDatabase({\n id: \"my-database-id\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ingest.get_ip_location_database(\n id: \"my-database-id\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ingest()->getIpLocationDatabase([\n \"id\" => \"my-database-id\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ingest/ip_location/database/my-database-id\"" } ] }, @@ -21810,6 +28442,26 @@ { "lang": "Console", "source": "PUT _ingest/ip_location/database/my-database-1\n{\n \"name\": \"GeoIP2-Domain\",\n \"maxmind\": {\n \"account_id\": \"1234567\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ingest.put_ip_location_database(\n id=\"my-database-1\",\n configuration={\n \"name\": \"GeoIP2-Domain\",\n \"maxmind\": {\n \"account_id\": \"1234567\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ingest.putIpLocationDatabase({\n id: \"my-database-1\",\n configuration: {\n name: \"GeoIP2-Domain\",\n maxmind: {\n account_id: \"1234567\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ingest.put_ip_location_database(\n id: \"my-database-1\",\n body: {\n \"name\": \"GeoIP2-Domain\",\n \"maxmind\": {\n \"account_id\": \"1234567\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ingest()->putIpLocationDatabase([\n \"id\" => \"my-database-1\",\n \"body\" => [\n \"name\" => \"GeoIP2-Domain\",\n \"maxmind\" => [\n \"account_id\" => \"1234567\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"name\":\"GeoIP2-Domain\",\"maxmind\":{\"account_id\":\"1234567\"}}' \"$ELASTICSEARCH_URL/_ingest/ip_location/database/my-database-1\"" } ] }, @@ -21870,6 +28522,26 @@ { "lang": "Console", "source": "DELETE /_ingest/ip_location/database/my-database-id\n" + }, + { + "lang": "Python", + "source": "resp = client.ingest.delete_ip_location_database(\n id=\"my-database-id\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ingest.deleteIpLocationDatabase({\n id: \"my-database-id\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ingest.delete_ip_location_database(\n id: \"my-database-id\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ingest()->deleteIpLocationDatabase([\n \"id\" => \"my-database-id\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ingest/ip_location/database/my-database-id\"" } ] } @@ -21906,6 +28578,26 @@ { "lang": "Console", "source": "GET /_ingest/pipeline/my-pipeline-id\n" + }, + { + "lang": "Python", + "source": "resp = client.ingest.get_pipeline(\n id=\"my-pipeline-id\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ingest.getPipeline({\n id: \"my-pipeline-id\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ingest.get_pipeline(\n id: \"my-pipeline-id\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ingest()->getPipeline([\n \"id\" => \"my-pipeline-id\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ingest/pipeline/my-pipeline-id\"" } ] }, @@ -22030,6 +28722,26 @@ { "lang": "Console", "source": "PUT _ingest/pipeline/my-pipeline-id\n{\n \"description\" : \"My optional pipeline description\",\n \"processors\" : [\n {\n \"set\" : {\n \"description\" : \"My optional processor description\",\n \"field\": \"my-keyword-field\",\n \"value\": \"foo\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.ingest.put_pipeline(\n id=\"my-pipeline-id\",\n description=\"My optional pipeline description\",\n processors=[\n {\n \"set\": {\n \"description\": \"My optional processor description\",\n \"field\": \"my-keyword-field\",\n \"value\": \"foo\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ingest.putPipeline({\n id: \"my-pipeline-id\",\n description: \"My optional pipeline description\",\n processors: [\n {\n set: {\n description: \"My optional processor description\",\n field: \"my-keyword-field\",\n value: \"foo\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ingest.put_pipeline(\n id: \"my-pipeline-id\",\n body: {\n \"description\": \"My optional pipeline description\",\n \"processors\": [\n {\n \"set\": {\n \"description\": \"My optional processor description\",\n \"field\": \"my-keyword-field\",\n \"value\": \"foo\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ingest()->putPipeline([\n \"id\" => \"my-pipeline-id\",\n \"body\" => [\n \"description\" => \"My optional pipeline description\",\n \"processors\" => array(\n [\n \"set\" => [\n \"description\" => \"My optional processor description\",\n \"field\" => \"my-keyword-field\",\n \"value\" => \"foo\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"My optional pipeline description\",\"processors\":[{\"set\":{\"description\":\"My optional processor description\",\"field\":\"my-keyword-field\",\"value\":\"foo\"}}]}' \"$ELASTICSEARCH_URL/_ingest/pipeline/my-pipeline-id\"" } ] }, @@ -22093,6 +28805,26 @@ { "lang": "Console", "source": "DELETE /_ingest/pipeline/my-pipeline-id\n" + }, + { + "lang": "Python", + "source": "resp = client.ingest.delete_pipeline(\n id=\"my-pipeline-id\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ingest.deletePipeline({\n id: \"my-pipeline-id\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ingest.delete_pipeline(\n id: \"my-pipeline-id\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ingest()->deletePipeline([\n \"id\" => \"my-pipeline-id\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ingest/pipeline/my-pipeline-id\"" } ] } @@ -22141,6 +28873,26 @@ { "lang": "Console", "source": "GET _ingest/geoip/stats\n" + }, + { + "lang": "Python", + "source": "resp = client.ingest.geo_ip_stats()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ingest.geoIpStats();" + }, + { + "lang": "Ruby", + "source": "response = client.ingest.geo_ip_stats" + }, + { + "lang": "PHP", + "source": "$resp = $client->ingest()->geoIpStats();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ingest/geoip/stats\"" } ] } @@ -22184,6 +28936,26 @@ { "lang": "Console", "source": "GET /_ingest/ip_location/database/my-database-id\n" + }, + { + "lang": "Python", + "source": "resp = client.ingest.get_ip_location_database(\n id=\"my-database-id\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ingest.getIpLocationDatabase({\n id: \"my-database-id\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ingest.get_ip_location_database(\n id: \"my-database-id\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ingest()->getIpLocationDatabase([\n \"id\" => \"my-database-id\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ingest/ip_location/database/my-database-id\"" } ] } @@ -22217,6 +28989,26 @@ { "lang": "Console", "source": "GET /_ingest/pipeline/my-pipeline-id\n" + }, + { + "lang": "Python", + "source": "resp = client.ingest.get_pipeline(\n id=\"my-pipeline-id\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ingest.getPipeline({\n id: \"my-pipeline-id\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ingest.get_pipeline(\n id: \"my-pipeline-id\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ingest()->getPipeline([\n \"id\" => \"my-pipeline-id\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ingest/pipeline/my-pipeline-id\"" } ] } @@ -22260,6 +29052,26 @@ { "lang": "Console", "source": "GET _ingest/processor/grok\n" + }, + { + "lang": "Python", + "source": "resp = client.ingest.processor_grok()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ingest.processorGrok();" + }, + { + "lang": "Ruby", + "source": "response = client.ingest.processor_grok" + }, + { + "lang": "PHP", + "source": "$resp = $client->ingest()->processorGrok();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ingest/processor/grok\"" } ] } @@ -22290,6 +29102,26 @@ { "lang": "Console", "source": "POST /_ingest/pipeline/_simulate\n{\n \"pipeline\" :\n {\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\" : {\n \"field\" : \"field2\",\n \"value\" : \"_value\"\n }\n }\n ]\n },\n \"docs\": [\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.ingest.simulate(\n pipeline={\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\": {\n \"field\": \"field2\",\n \"value\": \"_value\"\n }\n }\n ]\n },\n docs=[\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ingest.simulate({\n pipeline: {\n description: \"_description\",\n processors: [\n {\n set: {\n field: \"field2\",\n value: \"_value\",\n },\n },\n ],\n },\n docs: [\n {\n _index: \"index\",\n _id: \"id\",\n _source: {\n foo: \"bar\",\n },\n },\n {\n _index: \"index\",\n _id: \"id\",\n _source: {\n foo: \"rab\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ingest.simulate(\n body: {\n \"pipeline\": {\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\": {\n \"field\": \"field2\",\n \"value\": \"_value\"\n }\n }\n ]\n },\n \"docs\": [\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ingest()->simulate([\n \"body\" => [\n \"pipeline\" => [\n \"description\" => \"_description\",\n \"processors\" => array(\n [\n \"set\" => [\n \"field\" => \"field2\",\n \"value\" => \"_value\",\n ],\n ],\n ),\n ],\n \"docs\" => array(\n [\n \"_index\" => \"index\",\n \"_id\" => \"id\",\n \"_source\" => [\n \"foo\" => \"bar\",\n ],\n ],\n [\n \"_index\" => \"index\",\n \"_id\" => \"id\",\n \"_source\" => [\n \"foo\" => \"rab\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"pipeline\":{\"description\":\"_description\",\"processors\":[{\"set\":{\"field\":\"field2\",\"value\":\"_value\"}}]},\"docs\":[{\"_index\":\"index\",\"_id\":\"id\",\"_source\":{\"foo\":\"bar\"}},{\"_index\":\"index\",\"_id\":\"id\",\"_source\":{\"foo\":\"rab\"}}]}' \"$ELASTICSEARCH_URL/_ingest/pipeline/_simulate\"" } ] }, @@ -22318,6 +29150,26 @@ { "lang": "Console", "source": "POST /_ingest/pipeline/_simulate\n{\n \"pipeline\" :\n {\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\" : {\n \"field\" : \"field2\",\n \"value\" : \"_value\"\n }\n }\n ]\n },\n \"docs\": [\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.ingest.simulate(\n pipeline={\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\": {\n \"field\": \"field2\",\n \"value\": \"_value\"\n }\n }\n ]\n },\n docs=[\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ingest.simulate({\n pipeline: {\n description: \"_description\",\n processors: [\n {\n set: {\n field: \"field2\",\n value: \"_value\",\n },\n },\n ],\n },\n docs: [\n {\n _index: \"index\",\n _id: \"id\",\n _source: {\n foo: \"bar\",\n },\n },\n {\n _index: \"index\",\n _id: \"id\",\n _source: {\n foo: \"rab\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ingest.simulate(\n body: {\n \"pipeline\": {\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\": {\n \"field\": \"field2\",\n \"value\": \"_value\"\n }\n }\n ]\n },\n \"docs\": [\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ingest()->simulate([\n \"body\" => [\n \"pipeline\" => [\n \"description\" => \"_description\",\n \"processors\" => array(\n [\n \"set\" => [\n \"field\" => \"field2\",\n \"value\" => \"_value\",\n ],\n ],\n ),\n ],\n \"docs\" => array(\n [\n \"_index\" => \"index\",\n \"_id\" => \"id\",\n \"_source\" => [\n \"foo\" => \"bar\",\n ],\n ],\n [\n \"_index\" => \"index\",\n \"_id\" => \"id\",\n \"_source\" => [\n \"foo\" => \"rab\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"pipeline\":{\"description\":\"_description\",\"processors\":[{\"set\":{\"field\":\"field2\",\"value\":\"_value\"}}]},\"docs\":[{\"_index\":\"index\",\"_id\":\"id\",\"_source\":{\"foo\":\"bar\"}},{\"_index\":\"index\",\"_id\":\"id\",\"_source\":{\"foo\":\"rab\"}}]}' \"$ELASTICSEARCH_URL/_ingest/pipeline/_simulate\"" } ] } @@ -22351,6 +29203,26 @@ { "lang": "Console", "source": "POST /_ingest/pipeline/_simulate\n{\n \"pipeline\" :\n {\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\" : {\n \"field\" : \"field2\",\n \"value\" : \"_value\"\n }\n }\n ]\n },\n \"docs\": [\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.ingest.simulate(\n pipeline={\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\": {\n \"field\": \"field2\",\n \"value\": \"_value\"\n }\n }\n ]\n },\n docs=[\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ingest.simulate({\n pipeline: {\n description: \"_description\",\n processors: [\n {\n set: {\n field: \"field2\",\n value: \"_value\",\n },\n },\n ],\n },\n docs: [\n {\n _index: \"index\",\n _id: \"id\",\n _source: {\n foo: \"bar\",\n },\n },\n {\n _index: \"index\",\n _id: \"id\",\n _source: {\n foo: \"rab\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ingest.simulate(\n body: {\n \"pipeline\": {\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\": {\n \"field\": \"field2\",\n \"value\": \"_value\"\n }\n }\n ]\n },\n \"docs\": [\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ingest()->simulate([\n \"body\" => [\n \"pipeline\" => [\n \"description\" => \"_description\",\n \"processors\" => array(\n [\n \"set\" => [\n \"field\" => \"field2\",\n \"value\" => \"_value\",\n ],\n ],\n ),\n ],\n \"docs\" => array(\n [\n \"_index\" => \"index\",\n \"_id\" => \"id\",\n \"_source\" => [\n \"foo\" => \"bar\",\n ],\n ],\n [\n \"_index\" => \"index\",\n \"_id\" => \"id\",\n \"_source\" => [\n \"foo\" => \"rab\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"pipeline\":{\"description\":\"_description\",\"processors\":[{\"set\":{\"field\":\"field2\",\"value\":\"_value\"}}]},\"docs\":[{\"_index\":\"index\",\"_id\":\"id\",\"_source\":{\"foo\":\"bar\"}},{\"_index\":\"index\",\"_id\":\"id\",\"_source\":{\"foo\":\"rab\"}}]}' \"$ELASTICSEARCH_URL/_ingest/pipeline/_simulate\"" } ] }, @@ -22382,6 +29254,26 @@ { "lang": "Console", "source": "POST /_ingest/pipeline/_simulate\n{\n \"pipeline\" :\n {\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\" : {\n \"field\" : \"field2\",\n \"value\" : \"_value\"\n }\n }\n ]\n },\n \"docs\": [\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.ingest.simulate(\n pipeline={\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\": {\n \"field\": \"field2\",\n \"value\": \"_value\"\n }\n }\n ]\n },\n docs=[\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ingest.simulate({\n pipeline: {\n description: \"_description\",\n processors: [\n {\n set: {\n field: \"field2\",\n value: \"_value\",\n },\n },\n ],\n },\n docs: [\n {\n _index: \"index\",\n _id: \"id\",\n _source: {\n foo: \"bar\",\n },\n },\n {\n _index: \"index\",\n _id: \"id\",\n _source: {\n foo: \"rab\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ingest.simulate(\n body: {\n \"pipeline\": {\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\": {\n \"field\": \"field2\",\n \"value\": \"_value\"\n }\n }\n ]\n },\n \"docs\": [\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ingest()->simulate([\n \"body\" => [\n \"pipeline\" => [\n \"description\" => \"_description\",\n \"processors\" => array(\n [\n \"set\" => [\n \"field\" => \"field2\",\n \"value\" => \"_value\",\n ],\n ],\n ),\n ],\n \"docs\" => array(\n [\n \"_index\" => \"index\",\n \"_id\" => \"id\",\n \"_source\" => [\n \"foo\" => \"bar\",\n ],\n ],\n [\n \"_index\" => \"index\",\n \"_id\" => \"id\",\n \"_source\" => [\n \"foo\" => \"rab\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"pipeline\":{\"description\":\"_description\",\"processors\":[{\"set\":{\"field\":\"field2\",\"value\":\"_value\"}}]},\"docs\":[{\"_index\":\"index\",\"_id\":\"id\",\"_source\":{\"foo\":\"bar\"}},{\"_index\":\"index\",\"_id\":\"id\",\"_source\":{\"foo\":\"rab\"}}]}' \"$ELASTICSEARCH_URL/_ingest/pipeline/_simulate\"" } ] } @@ -22446,6 +29338,26 @@ { "lang": "Console", "source": "GET /_license\n" + }, + { + "lang": "Python", + "source": "resp = client.license.get()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.license.get();" + }, + { + "lang": "Ruby", + "source": "response = client.license.get" + }, + { + "lang": "PHP", + "source": "$resp = $client->license()->get();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_license\"" } ] }, @@ -22479,6 +29391,26 @@ { "lang": "Console", "source": "PUT _license\n{\n \"licenses\": [\n {\n \"uid\":\"893361dc-9749-4997-93cb-802e3d7fa4xx\",\n \"type\":\"basic\",\n \"issue_date_in_millis\":1411948800000,\n \"expiry_date_in_millis\":1914278399999,\n \"max_nodes\":1,\n \"issued_to\":\"issuedTo\",\n \"issuer\":\"issuer\",\n \"signature\":\"xx\"\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.license.post(\n licenses=[\n {\n \"uid\": \"893361dc-9749-4997-93cb-802e3d7fa4xx\",\n \"type\": \"basic\",\n \"issue_date_in_millis\": 1411948800000,\n \"expiry_date_in_millis\": 1914278399999,\n \"max_nodes\": 1,\n \"issued_to\": \"issuedTo\",\n \"issuer\": \"issuer\",\n \"signature\": \"xx\"\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.license.post({\n licenses: [\n {\n uid: \"893361dc-9749-4997-93cb-802e3d7fa4xx\",\n type: \"basic\",\n issue_date_in_millis: 1411948800000,\n expiry_date_in_millis: 1914278399999,\n max_nodes: 1,\n issued_to: \"issuedTo\",\n issuer: \"issuer\",\n signature: \"xx\",\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.license.post(\n body: {\n \"licenses\": [\n {\n \"uid\": \"893361dc-9749-4997-93cb-802e3d7fa4xx\",\n \"type\": \"basic\",\n \"issue_date_in_millis\": 1411948800000,\n \"expiry_date_in_millis\": 1914278399999,\n \"max_nodes\": 1,\n \"issued_to\": \"issuedTo\",\n \"issuer\": \"issuer\",\n \"signature\": \"xx\"\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->license()->post([\n \"body\" => [\n \"licenses\" => array(\n [\n \"uid\" => \"893361dc-9749-4997-93cb-802e3d7fa4xx\",\n \"type\" => \"basic\",\n \"issue_date_in_millis\" => 1411948800000,\n \"expiry_date_in_millis\" => 1914278399999,\n \"max_nodes\" => 1,\n \"issued_to\" => \"issuedTo\",\n \"issuer\" => \"issuer\",\n \"signature\" => \"xx\",\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"licenses\":[{\"uid\":\"893361dc-9749-4997-93cb-802e3d7fa4xx\",\"type\":\"basic\",\"issue_date_in_millis\":1411948800000,\"expiry_date_in_millis\":1914278399999,\"max_nodes\":1,\"issued_to\":\"issuedTo\",\"issuer\":\"issuer\",\"signature\":\"xx\"}]}' \"$ELASTICSEARCH_URL/_license\"" } ] }, @@ -22512,6 +29444,26 @@ { "lang": "Console", "source": "PUT _license\n{\n \"licenses\": [\n {\n \"uid\":\"893361dc-9749-4997-93cb-802e3d7fa4xx\",\n \"type\":\"basic\",\n \"issue_date_in_millis\":1411948800000,\n \"expiry_date_in_millis\":1914278399999,\n \"max_nodes\":1,\n \"issued_to\":\"issuedTo\",\n \"issuer\":\"issuer\",\n \"signature\":\"xx\"\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.license.post(\n licenses=[\n {\n \"uid\": \"893361dc-9749-4997-93cb-802e3d7fa4xx\",\n \"type\": \"basic\",\n \"issue_date_in_millis\": 1411948800000,\n \"expiry_date_in_millis\": 1914278399999,\n \"max_nodes\": 1,\n \"issued_to\": \"issuedTo\",\n \"issuer\": \"issuer\",\n \"signature\": \"xx\"\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.license.post({\n licenses: [\n {\n uid: \"893361dc-9749-4997-93cb-802e3d7fa4xx\",\n type: \"basic\",\n issue_date_in_millis: 1411948800000,\n expiry_date_in_millis: 1914278399999,\n max_nodes: 1,\n issued_to: \"issuedTo\",\n issuer: \"issuer\",\n signature: \"xx\",\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.license.post(\n body: {\n \"licenses\": [\n {\n \"uid\": \"893361dc-9749-4997-93cb-802e3d7fa4xx\",\n \"type\": \"basic\",\n \"issue_date_in_millis\": 1411948800000,\n \"expiry_date_in_millis\": 1914278399999,\n \"max_nodes\": 1,\n \"issued_to\": \"issuedTo\",\n \"issuer\": \"issuer\",\n \"signature\": \"xx\"\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->license()->post([\n \"body\" => [\n \"licenses\" => array(\n [\n \"uid\" => \"893361dc-9749-4997-93cb-802e3d7fa4xx\",\n \"type\" => \"basic\",\n \"issue_date_in_millis\" => 1411948800000,\n \"expiry_date_in_millis\" => 1914278399999,\n \"max_nodes\" => 1,\n \"issued_to\" => \"issuedTo\",\n \"issuer\" => \"issuer\",\n \"signature\" => \"xx\",\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"licenses\":[{\"uid\":\"893361dc-9749-4997-93cb-802e3d7fa4xx\",\"type\":\"basic\",\"issue_date_in_millis\":1411948800000,\"expiry_date_in_millis\":1914278399999,\"max_nodes\":1,\"issued_to\":\"issuedTo\",\"issuer\":\"issuer\",\"signature\":\"xx\"}]}' \"$ELASTICSEARCH_URL/_license\"" } ] }, @@ -22563,6 +29515,26 @@ { "lang": "Console", "source": "DELETE /_license\n" + }, + { + "lang": "Python", + "source": "resp = client.license.delete()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.license.delete();" + }, + { + "lang": "Ruby", + "source": "response = client.license.delete" + }, + { + "lang": "PHP", + "source": "$resp = $client->license()->delete();" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_license\"" } ] } @@ -22606,6 +29578,26 @@ { "lang": "Console", "source": "GET /_license/basic_status\n" + }, + { + "lang": "Python", + "source": "resp = client.license.get_basic_status()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.license.getBasicStatus();" + }, + { + "lang": "Ruby", + "source": "response = client.license.get_basic_status" + }, + { + "lang": "PHP", + "source": "$resp = $client->license()->getBasicStatus();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_license/basic_status\"" } ] } @@ -22649,6 +29641,26 @@ { "lang": "Console", "source": "GET /_license/trial_status\n" + }, + { + "lang": "Python", + "source": "resp = client.license.get_trial_status()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.license.getTrialStatus();" + }, + { + "lang": "Ruby", + "source": "response = client.license.get_trial_status" + }, + { + "lang": "PHP", + "source": "$resp = $client->license()->getTrialStatus();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_license/trial_status\"" } ] } @@ -22750,6 +29762,26 @@ { "lang": "Console", "source": "POST /_license/start_basic?acknowledge=true\n" + }, + { + "lang": "Python", + "source": "resp = client.license.post_start_basic(\n acknowledge=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.license.postStartBasic({\n acknowledge: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.license.post_start_basic(\n acknowledge: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->license()->postStartBasic([\n \"acknowledge\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_license/start_basic?acknowledge=true\"" } ] } @@ -22834,6 +29866,26 @@ { "lang": "Console", "source": "POST /_license/start_trial?acknowledge=true\n" + }, + { + "lang": "Python", + "source": "resp = client.license.post_start_trial(\n acknowledge=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.license.postStartTrial({\n acknowledge: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.license.post_start_trial(\n acknowledge: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->license()->postStartTrial([\n \"acknowledge\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_license/start_trial?acknowledge=true\"" } ] } @@ -22864,6 +29916,26 @@ { "lang": "Console", "source": "GET _logstash/pipeline/my_pipeline\n" + }, + { + "lang": "Python", + "source": "resp = client.logstash.get_pipeline(\n id=\"my_pipeline\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.logstash.getPipeline({\n id: \"my_pipeline\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.logstash.get_pipeline(\n id: \"my_pipeline\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->logstash()->getPipeline([\n \"id\" => \"my_pipeline\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_logstash/pipeline/my_pipeline\"" } ] }, @@ -22920,6 +29992,26 @@ { "lang": "Console", "source": "PUT _logstash/pipeline/my_pipeline\n{\n \"description\": \"Sample pipeline for illustration purposes\",\n \"last_modified\": \"2021-01-02T02:50:51.250Z\",\n \"pipeline_metadata\": {\n \"type\": \"logstash_pipeline\",\n \"version\": 1\n },\n \"username\": \"elastic\",\n \"pipeline\": \"input {}\\\\n filter { grok {} }\\\\n output {}\",\n \"pipeline_settings\": {\n \"pipeline.workers\": 1,\n \"pipeline.batch.size\": 125,\n \"pipeline.batch.delay\": 50,\n \"queue.type\": \"memory\",\n \"queue.max_bytes\": \"1gb\",\n \"queue.checkpoint.writes\": 1024\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.logstash.put_pipeline(\n id=\"my_pipeline\",\n pipeline={\n \"description\": \"Sample pipeline for illustration purposes\",\n \"last_modified\": \"2021-01-02T02:50:51.250Z\",\n \"pipeline_metadata\": {\n \"type\": \"logstash_pipeline\",\n \"version\": 1\n },\n \"username\": \"elastic\",\n \"pipeline\": \"input {}\\\\n filter { grok {} }\\\\n output {}\",\n \"pipeline_settings\": {\n \"pipeline.workers\": 1,\n \"pipeline.batch.size\": 125,\n \"pipeline.batch.delay\": 50,\n \"queue.type\": \"memory\",\n \"queue.max_bytes\": \"1gb\",\n \"queue.checkpoint.writes\": 1024\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.logstash.putPipeline({\n id: \"my_pipeline\",\n pipeline: {\n description: \"Sample pipeline for illustration purposes\",\n last_modified: \"2021-01-02T02:50:51.250Z\",\n pipeline_metadata: {\n type: \"logstash_pipeline\",\n version: 1,\n },\n username: \"elastic\",\n pipeline: \"input {}\\\\n filter { grok {} }\\\\n output {}\",\n pipeline_settings: {\n \"pipeline.workers\": 1,\n \"pipeline.batch.size\": 125,\n \"pipeline.batch.delay\": 50,\n \"queue.type\": \"memory\",\n \"queue.max_bytes\": \"1gb\",\n \"queue.checkpoint.writes\": 1024,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.logstash.put_pipeline(\n id: \"my_pipeline\",\n body: {\n \"description\": \"Sample pipeline for illustration purposes\",\n \"last_modified\": \"2021-01-02T02:50:51.250Z\",\n \"pipeline_metadata\": {\n \"type\": \"logstash_pipeline\",\n \"version\": 1\n },\n \"username\": \"elastic\",\n \"pipeline\": \"input {}\\\\n filter { grok {} }\\\\n output {}\",\n \"pipeline_settings\": {\n \"pipeline.workers\": 1,\n \"pipeline.batch.size\": 125,\n \"pipeline.batch.delay\": 50,\n \"queue.type\": \"memory\",\n \"queue.max_bytes\": \"1gb\",\n \"queue.checkpoint.writes\": 1024\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->logstash()->putPipeline([\n \"id\" => \"my_pipeline\",\n \"body\" => [\n \"description\" => \"Sample pipeline for illustration purposes\",\n \"last_modified\" => \"2021-01-02T02:50:51.250Z\",\n \"pipeline_metadata\" => [\n \"type\" => \"logstash_pipeline\",\n \"version\" => 1,\n ],\n \"username\" => \"elastic\",\n \"pipeline\" => \"input {}\\\\n filter { grok {} }\\\\n output {}\",\n \"pipeline_settings\" => [\n \"pipeline.workers\" => 1,\n \"pipeline.batch.size\" => 125,\n \"pipeline.batch.delay\" => 50,\n \"queue.type\" => \"memory\",\n \"queue.max_bytes\" => \"1gb\",\n \"queue.checkpoint.writes\" => 1024,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"Sample pipeline for illustration purposes\",\"last_modified\":\"2021-01-02T02:50:51.250Z\",\"pipeline_metadata\":{\"type\":\"logstash_pipeline\",\"version\":1},\"username\":\"elastic\",\"pipeline\":\"input {}\\\\n filter { grok {} }\\\\n output {}\",\"pipeline_settings\":{\"pipeline.workers\":1,\"pipeline.batch.size\":125,\"pipeline.batch.delay\":50,\"queue.type\":\"memory\",\"queue.max_bytes\":\"1gb\",\"queue.checkpoint.writes\":1024}}' \"$ELASTICSEARCH_URL/_logstash/pipeline/my_pipeline\"" } ] }, @@ -22959,6 +30051,26 @@ { "lang": "Console", "source": "DELETE _logstash/pipeline/my_pipeline\n" + }, + { + "lang": "Python", + "source": "resp = client.logstash.delete_pipeline(\n id=\"my_pipeline\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.logstash.deletePipeline({\n id: \"my_pipeline\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.logstash.delete_pipeline(\n id: \"my_pipeline\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->logstash()->deletePipeline([\n \"id\" => \"my_pipeline\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_logstash/pipeline/my_pipeline\"" } ] } @@ -22984,6 +30096,26 @@ { "lang": "Console", "source": "GET _logstash/pipeline/my_pipeline\n" + }, + { + "lang": "Python", + "source": "resp = client.logstash.get_pipeline(\n id=\"my_pipeline\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.logstash.getPipeline({\n id: \"my_pipeline\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.logstash.get_pipeline(\n id: \"my_pipeline\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->logstash()->getPipeline([\n \"id\" => \"my_pipeline\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_logstash/pipeline/my_pipeline\"" } ] } @@ -23035,6 +30167,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_mget\n{\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.mget(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.mget({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"1\",\n },\n {\n _id: \"2\",\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.mget(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->mget([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"1\",\n ],\n [\n \"_id\" => \"2\",\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":\"1\"},{\"_id\":\"2\"}]}' \"$ELASTICSEARCH_URL/my-index-000001/_mget\"" } ] }, @@ -23084,6 +30236,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_mget\n{\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.mget(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.mget({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"1\",\n },\n {\n _id: \"2\",\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.mget(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->mget([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"1\",\n ],\n [\n \"_id\" => \"2\",\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":\"1\"},{\"_id\":\"2\"}]}' \"$ELASTICSEARCH_URL/my-index-000001/_mget\"" } ] } @@ -23138,6 +30310,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_mget\n{\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.mget(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.mget({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"1\",\n },\n {\n _id: \"2\",\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.mget(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->mget([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"1\",\n ],\n [\n \"_id\" => \"2\",\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":\"1\"},{\"_id\":\"2\"}]}' \"$ELASTICSEARCH_URL/my-index-000001/_mget\"" } ] }, @@ -23190,6 +30382,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_mget\n{\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.mget(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.mget({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"1\",\n },\n {\n _id: \"2\",\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.mget(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->mget([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"1\",\n ],\n [\n \"_id\" => \"2\",\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":\"1\"},{\"_id\":\"2\"}]}' \"$ELASTICSEARCH_URL/my-index-000001/_mget\"" } ] } @@ -23212,6 +30424,26 @@ { "lang": "Console", "source": "GET /_migration/deprecations\n" + }, + { + "lang": "Python", + "source": "resp = client.migration.deprecations()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.migration.deprecations();" + }, + { + "lang": "Ruby", + "source": "response = client.migration.deprecations" + }, + { + "lang": "PHP", + "source": "$resp = $client->migration()->deprecations();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_migration/deprecations\"" } ] } @@ -23239,6 +30471,26 @@ { "lang": "Console", "source": "GET /_migration/deprecations\n" + }, + { + "lang": "Python", + "source": "resp = client.migration.deprecations()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.migration.deprecations();" + }, + { + "lang": "Ruby", + "source": "response = client.migration.deprecations" + }, + { + "lang": "PHP", + "source": "$resp = $client->migration()->deprecations();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_migration/deprecations\"" } ] } @@ -23289,6 +30541,26 @@ { "lang": "Console", "source": "GET /_migration/system_features\n" + }, + { + "lang": "Python", + "source": "resp = client.migration.get_feature_upgrade_status()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.migration.getFeatureUpgradeStatus();" + }, + { + "lang": "Ruby", + "source": "response = client.migration.get_feature_upgrade_status" + }, + { + "lang": "PHP", + "source": "$resp = $client->migration()->getFeatureUpgradeStatus();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_migration/system_features\"" } ] }, @@ -23337,6 +30609,26 @@ { "lang": "Console", "source": "POST /_migration/system_features\n" + }, + { + "lang": "Python", + "source": "resp = client.migration.post_feature_upgrade()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.migration.postFeatureUpgrade();" + }, + { + "lang": "Ruby", + "source": "response = client.migration.post_feature_upgrade" + }, + { + "lang": "PHP", + "source": "$resp = $client->migration()->postFeatureUpgrade();" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_migration/system_features\"" } ] } @@ -23393,6 +30685,26 @@ { "lang": "Console", "source": "POST _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/cache/_clear\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.clear_trained_model_deployment_cache(\n model_id=\"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.clearTrainedModelDeploymentCache({\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.clear_trained_model_deployment_cache(\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->clearTrainedModelDeploymentCache([\n \"model_id\" => \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/cache/_clear\"" } ] } @@ -23501,6 +30813,26 @@ { "lang": "Console", "source": "POST _ml/anomaly_detectors/low_request_rate/_close\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.close_job(\n job_id=\"low_request_rate\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.closeJob({\n job_id: \"low_request_rate\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.close_job(\n job_id: \"low_request_rate\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->closeJob([\n \"job_id\" => \"low_request_rate\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_close\"" } ] } @@ -23537,6 +30869,26 @@ { "lang": "Console", "source": "GET _ml/calendars/planned-outages\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_calendars(\n calendar_id=\"planned-outages\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getCalendars({\n calendar_id: \"planned-outages\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_calendars(\n calendar_id: \"planned-outages\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getCalendars([\n \"calendar_id\" => \"planned-outages\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages\"" } ] }, @@ -23615,6 +30967,26 @@ { "lang": "Console", "source": "PUT _ml/calendars/planned-outages\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.put_calendar(\n calendar_id=\"planned-outages\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.putCalendar({\n calendar_id: \"planned-outages\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.put_calendar(\n calendar_id: \"planned-outages\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->putCalendar([\n \"calendar_id\" => \"planned-outages\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages\"" } ] }, @@ -23649,6 +31021,26 @@ { "lang": "Console", "source": "GET _ml/calendars/planned-outages\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_calendars(\n calendar_id=\"planned-outages\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getCalendars({\n calendar_id: \"planned-outages\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_calendars(\n calendar_id: \"planned-outages\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getCalendars([\n \"calendar_id\" => \"planned-outages\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages\"" } ] }, @@ -23695,6 +31087,26 @@ { "lang": "Console", "source": "DELETE _ml/calendars/planned-outages\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.delete_calendar(\n calendar_id=\"planned-outages\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.deleteCalendar({\n calendar_id: \"planned-outages\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.delete_calendar(\n calendar_id: \"planned-outages\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->deleteCalendar([\n \"calendar_id\" => \"planned-outages\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages\"" } ] } @@ -23753,6 +31165,26 @@ { "lang": "Console", "source": "DELETE _ml/calendars/planned-outages/events/LS8LJGEBMTCMA-qz49st\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.delete_calendar_event(\n calendar_id=\"planned-outages\",\n event_id=\"LS8LJGEBMTCMA-qz49st\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.deleteCalendarEvent({\n calendar_id: \"planned-outages\",\n event_id: \"LS8LJGEBMTCMA-qz49st\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.delete_calendar_event(\n calendar_id: \"planned-outages\",\n event_id: \"LS8LJGEBMTCMA-qz49st\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->deleteCalendarEvent([\n \"calendar_id\" => \"planned-outages\",\n \"event_id\" => \"LS8LJGEBMTCMA-qz49st\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages/events/LS8LJGEBMTCMA-qz49st\"" } ] } @@ -23822,6 +31254,26 @@ { "lang": "Console", "source": "PUT _ml/calendars/planned-outages/jobs/total-requests\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.put_calendar_job(\n calendar_id=\"planned-outages\",\n job_id=\"total-requests\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.putCalendarJob({\n calendar_id: \"planned-outages\",\n job_id: \"total-requests\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.put_calendar_job(\n calendar_id: \"planned-outages\",\n job_id: \"total-requests\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->putCalendarJob([\n \"calendar_id\" => \"planned-outages\",\n \"job_id\" => \"total-requests\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages/jobs/total-requests\"" } ] }, @@ -23895,6 +31347,26 @@ { "lang": "Console", "source": "DELETE _ml/calendars/planned-outages/jobs/total-requests\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.delete_calendar_job(\n calendar_id=\"planned-outages\",\n job_id=\"total-requests\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.deleteCalendarJob({\n calendar_id: \"planned-outages\",\n job_id: \"total-requests\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.delete_calendar_job(\n calendar_id: \"planned-outages\",\n job_id: \"total-requests\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->deleteCalendarJob([\n \"calendar_id\" => \"planned-outages\",\n \"job_id\" => \"total-requests\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages/jobs/total-requests\"" } ] } @@ -23934,6 +31406,26 @@ { "lang": "Console", "source": "GET _ml/data_frame/analytics/loganalytics\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_data_frame_analytics(\n id=\"loganalytics\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getDataFrameAnalytics({\n id: \"loganalytics\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_data_frame_analytics(\n id: \"loganalytics\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics\"" } ] }, @@ -24086,6 +31578,26 @@ { "lang": "Console", "source": "PUT _ml/data_frame/analytics/model-flight-delays-pre\n{\n \"source\": {\n \"index\": [\n \"kibana_sample_data_flights\"\n ],\n \"query\": {\n \"range\": {\n \"DistanceKilometers\": {\n \"gt\": 0\n }\n }\n },\n \"_source\": {\n \"includes\": [],\n \"excludes\": [\n \"FlightDelay\",\n \"FlightDelayType\"\n ]\n }\n },\n \"dest\": {\n \"index\": \"df-flight-delays\",\n \"results_field\": \"ml-results\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"FlightDelayMin\",\n \"training_percent\": 90\n }\n },\n \"analyzed_fields\": {\n \"includes\": [],\n \"excludes\": [\n \"FlightNum\"\n ]\n },\n \"model_memory_limit\": \"100mb\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.put_data_frame_analytics(\n id=\"model-flight-delays-pre\",\n source={\n \"index\": [\n \"kibana_sample_data_flights\"\n ],\n \"query\": {\n \"range\": {\n \"DistanceKilometers\": {\n \"gt\": 0\n }\n }\n },\n \"_source\": {\n \"includes\": [],\n \"excludes\": [\n \"FlightDelay\",\n \"FlightDelayType\"\n ]\n }\n },\n dest={\n \"index\": \"df-flight-delays\",\n \"results_field\": \"ml-results\"\n },\n analysis={\n \"regression\": {\n \"dependent_variable\": \"FlightDelayMin\",\n \"training_percent\": 90\n }\n },\n analyzed_fields={\n \"includes\": [],\n \"excludes\": [\n \"FlightNum\"\n ]\n },\n model_memory_limit=\"100mb\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.putDataFrameAnalytics({\n id: \"model-flight-delays-pre\",\n source: {\n index: [\"kibana_sample_data_flights\"],\n query: {\n range: {\n DistanceKilometers: {\n gt: 0,\n },\n },\n },\n _source: {\n includes: [],\n excludes: [\"FlightDelay\", \"FlightDelayType\"],\n },\n },\n dest: {\n index: \"df-flight-delays\",\n results_field: \"ml-results\",\n },\n analysis: {\n regression: {\n dependent_variable: \"FlightDelayMin\",\n training_percent: 90,\n },\n },\n analyzed_fields: {\n includes: [],\n excludes: [\"FlightNum\"],\n },\n model_memory_limit: \"100mb\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.put_data_frame_analytics(\n id: \"model-flight-delays-pre\",\n body: {\n \"source\": {\n \"index\": [\n \"kibana_sample_data_flights\"\n ],\n \"query\": {\n \"range\": {\n \"DistanceKilometers\": {\n \"gt\": 0\n }\n }\n },\n \"_source\": {\n \"includes\": [],\n \"excludes\": [\n \"FlightDelay\",\n \"FlightDelayType\"\n ]\n }\n },\n \"dest\": {\n \"index\": \"df-flight-delays\",\n \"results_field\": \"ml-results\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"FlightDelayMin\",\n \"training_percent\": 90\n }\n },\n \"analyzed_fields\": {\n \"includes\": [],\n \"excludes\": [\n \"FlightNum\"\n ]\n },\n \"model_memory_limit\": \"100mb\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->putDataFrameAnalytics([\n \"id\" => \"model-flight-delays-pre\",\n \"body\" => [\n \"source\" => [\n \"index\" => array(\n \"kibana_sample_data_flights\",\n ),\n \"query\" => [\n \"range\" => [\n \"DistanceKilometers\" => [\n \"gt\" => 0,\n ],\n ],\n ],\n \"_source\" => [\n \"includes\" => array(\n ),\n \"excludes\" => array(\n \"FlightDelay\",\n \"FlightDelayType\",\n ),\n ],\n ],\n \"dest\" => [\n \"index\" => \"df-flight-delays\",\n \"results_field\" => \"ml-results\",\n ],\n \"analysis\" => [\n \"regression\" => [\n \"dependent_variable\" => \"FlightDelayMin\",\n \"training_percent\" => 90,\n ],\n ],\n \"analyzed_fields\" => [\n \"includes\" => array(\n ),\n \"excludes\" => array(\n \"FlightNum\",\n ),\n ],\n \"model_memory_limit\" => \"100mb\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":[\"kibana_sample_data_flights\"],\"query\":{\"range\":{\"DistanceKilometers\":{\"gt\":0}}},\"_source\":{\"includes\":[],\"excludes\":[\"FlightDelay\",\"FlightDelayType\"]}},\"dest\":{\"index\":\"df-flight-delays\",\"results_field\":\"ml-results\"},\"analysis\":{\"regression\":{\"dependent_variable\":\"FlightDelayMin\",\"training_percent\":90}},\"analyzed_fields\":{\"includes\":[],\"excludes\":[\"FlightNum\"]},\"model_memory_limit\":\"100mb\"}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/model-flight-delays-pre\"" } ] }, @@ -24152,6 +31664,26 @@ { "lang": "Console", "source": "DELETE _ml/data_frame/analytics/loganalytics\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.delete_data_frame_analytics(\n id=\"loganalytics\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.deleteDataFrameAnalytics({\n id: \"loganalytics\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.delete_data_frame_analytics(\n id: \"loganalytics\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->deleteDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics\"" } ] } @@ -24185,6 +31717,26 @@ { "lang": "Console", "source": "GET _ml/datafeeds/datafeed-high_sum_total_sales\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_datafeeds(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getDatafeeds({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_datafeeds(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getDatafeeds([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales\"" } ] }, @@ -24193,7 +31745,7 @@ "ml anomaly" ], "summary": "Create a datafeed", - "description": "Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job.\nYou can associate only one datafeed with each anomaly detection job.\nThe datafeed contains a query that runs at a defined interval (`frequency`).\nIf you are concerned about delayed data, you can add a delay (`query_delay') at each interval.\nBy default, the datafeed uses the following query: `{\"match_all\": {\"boost\": 1}}`.\n\nWhen Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had\nat the time of creation and runs the query using those same roles. If you provide secondary authorization headers,\nthose credentials are used instead.\nYou must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed\ndirectly to the `.ml-config` index. Do not give users `write` privileges on the `.ml-config` index.\n ##Required authorization\n* Index privileges: `read`* Cluster privileges: `manage_ml`", + "description": "Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job.\nYou can associate only one datafeed with each anomaly detection job.\nThe datafeed contains a query that runs at a defined interval (`frequency`).\nIf you are concerned about delayed data, you can add a delay (`query_delay`) at each interval.\nBy default, the datafeed uses the following query: `{\"match_all\": {\"boost\": 1}}`.\n\nWhen Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had\nat the time of creation and runs the query using those same roles. If you provide secondary authorization headers,\nthose credentials are used instead.\nYou must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed\ndirectly to the `.ml-config` index. Do not give users `write` privileges on the `.ml-config` index.\n ##Required authorization\n* Index privileges: `read`* Cluster privileges: `manage_ml`", "operationId": "ml-put-datafeed", "parameters": [ { @@ -24400,6 +31952,26 @@ { "lang": "Console", "source": "PUT _ml/datafeeds/datafeed-test-job?pretty\n{\n \"indices\": [\n \"kibana_sample_data_logs\"\n ],\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ]\n }\n },\n \"job_id\": \"test-job\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.put_datafeed(\n datafeed_id=\"datafeed-test-job\",\n pretty=True,\n indices=[\n \"kibana_sample_data_logs\"\n ],\n query={\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ]\n }\n },\n job_id=\"test-job\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.putDatafeed({\n datafeed_id: \"datafeed-test-job\",\n pretty: \"true\",\n indices: [\"kibana_sample_data_logs\"],\n query: {\n bool: {\n must: [\n {\n match_all: {},\n },\n ],\n },\n },\n job_id: \"test-job\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.put_datafeed(\n datafeed_id: \"datafeed-test-job\",\n pretty: \"true\",\n body: {\n \"indices\": [\n \"kibana_sample_data_logs\"\n ],\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ]\n }\n },\n \"job_id\": \"test-job\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->putDatafeed([\n \"datafeed_id\" => \"datafeed-test-job\",\n \"pretty\" => \"true\",\n \"body\" => [\n \"indices\" => array(\n \"kibana_sample_data_logs\",\n ),\n \"query\" => [\n \"bool\" => [\n \"must\" => array(\n [\n \"match_all\" => new ArrayObject([]),\n ],\n ),\n ],\n ],\n \"job_id\" => \"test-job\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"indices\":[\"kibana_sample_data_logs\"],\"query\":{\"bool\":{\"must\":[{\"match_all\":{}}]}},\"job_id\":\"test-job\"}' \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-test-job?pretty\"" } ] }, @@ -24456,6 +32028,26 @@ { "lang": "Console", "source": "DELETE _ml/datafeeds/datafeed-total-requests\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.delete_datafeed(\n datafeed_id=\"datafeed-total-requests\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.deleteDatafeed({\n datafeed_id: \"datafeed-total-requests\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.delete_datafeed(\n datafeed_id: \"datafeed-total-requests\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->deleteDatafeed([\n \"datafeed_id\" => \"datafeed-total-requests\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-total-requests\"" } ] } @@ -24492,6 +32084,26 @@ { "lang": "Console", "source": "DELETE _ml/_delete_expired_data?timeout=1h\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.delete_expired_data(\n timeout=\"1h\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.deleteExpiredData({\n timeout: \"1h\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.delete_expired_data(\n timeout: \"1h\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->deleteExpiredData([\n \"timeout\" => \"1h\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/_delete_expired_data?timeout=1h\"" } ] } @@ -24525,6 +32137,26 @@ { "lang": "Console", "source": "DELETE _ml/_delete_expired_data?timeout=1h\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.delete_expired_data(\n timeout=\"1h\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.deleteExpiredData({\n timeout: \"1h\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.delete_expired_data(\n timeout: \"1h\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->deleteExpiredData([\n \"timeout\" => \"1h\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/_delete_expired_data?timeout=1h\"" } ] } @@ -24558,6 +32190,26 @@ { "lang": "Console", "source": "GET _ml/filters/safe_domains\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_filters(\n filter_id=\"safe_domains\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getFilters({\n filter_id: \"safe_domains\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_filters(\n filter_id: \"safe_domains\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getFilters([\n \"filter_id\" => \"safe_domains\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/filters/safe_domains\"" } ] }, @@ -24646,6 +32298,26 @@ { "lang": "Console", "source": "PUT _ml/filters/safe_domains\n{\n \"description\": \"A list of safe domains\",\n \"items\": [\"*.google.com\", \"wikipedia.org\"]\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.put_filter(\n filter_id=\"safe_domains\",\n description=\"A list of safe domains\",\n items=[\n \"*.google.com\",\n \"wikipedia.org\"\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.putFilter({\n filter_id: \"safe_domains\",\n description: \"A list of safe domains\",\n items: [\"*.google.com\", \"wikipedia.org\"],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.put_filter(\n filter_id: \"safe_domains\",\n body: {\n \"description\": \"A list of safe domains\",\n \"items\": [\n \"*.google.com\",\n \"wikipedia.org\"\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->putFilter([\n \"filter_id\" => \"safe_domains\",\n \"body\" => [\n \"description\" => \"A list of safe domains\",\n \"items\" => array(\n \"*.google.com\",\n \"wikipedia.org\",\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"A list of safe domains\",\"items\":[\"*.google.com\",\"wikipedia.org\"]}' \"$ELASTICSEARCH_URL/_ml/filters/safe_domains\"" } ] }, @@ -24692,6 +32364,26 @@ { "lang": "Console", "source": "DELETE _ml/filters/safe_domains\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.delete_filter(\n filter_id=\"safe_domains\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.deleteFilter({\n filter_id: \"safe_domains\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.delete_filter(\n filter_id: \"safe_domains\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->deleteFilter([\n \"filter_id\" => \"safe_domains\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/filters/safe_domains\"" } ] } @@ -24803,6 +32495,26 @@ { "lang": "Console", "source": "POST _ml/anomaly_detectors/low_request_rate/_forecast\n{\n \"duration\": \"10d\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.forecast(\n job_id=\"low_request_rate\",\n duration=\"10d\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.forecast({\n job_id: \"low_request_rate\",\n duration: \"10d\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.forecast(\n job_id: \"low_request_rate\",\n body: {\n \"duration\": \"10d\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->forecast([\n \"job_id\" => \"low_request_rate\",\n \"body\" => [\n \"duration\" => \"10d\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"duration\":\"10d\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_forecast\"" } ] }, @@ -24834,6 +32546,26 @@ { "lang": "Console", "source": "DELETE _ml/anomaly_detectors/total-requests/_forecast/_all\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.delete_forecast(\n job_id=\"total-requests\",\n forecast_id=\"_all\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.deleteForecast({\n job_id: \"total-requests\",\n forecast_id: \"_all\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.delete_forecast(\n job_id: \"total-requests\",\n forecast_id: \"_all\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->deleteForecast([\n \"job_id\" => \"total-requests\",\n \"forecast_id\" => \"_all\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/total-requests/_forecast/_all\"" } ] } @@ -24870,6 +32602,26 @@ { "lang": "Console", "source": "DELETE _ml/anomaly_detectors/total-requests/_forecast/_all\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.delete_forecast(\n job_id=\"total-requests\",\n forecast_id=\"_all\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.deleteForecast({\n job_id: \"total-requests\",\n forecast_id: \"_all\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.delete_forecast(\n job_id: \"total-requests\",\n forecast_id: \"_all\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->deleteForecast([\n \"job_id\" => \"total-requests\",\n \"forecast_id\" => \"_all\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/total-requests/_forecast/_all\"" } ] } @@ -24903,6 +32655,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/high_sum_total_sales\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_jobs(\n job_id=\"high_sum_total_sales\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getJobs({\n job_id: \"high_sum_total_sales\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_jobs(\n job_id: \"high_sum_total_sales\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getJobs([\n \"job_id\" => \"high_sum_total_sales\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/high_sum_total_sales\"" } ] }, @@ -25142,7 +32914,33 @@ } } }, - "x-state": "Added in 5.4.0" + "x-state": "Added in 5.4.0", + "x-codeSamples": [ + { + "lang": "Console", + "source": "PUT /_ml/anomaly_detectors/job-01\n{\n \"analysis_config\": {\n \"bucket_span\": \"15m\",\n \"detectors\": [\n {\n \"detector_description\": \"Sum of bytes\",\n \"function\": \"sum\",\n \"field_name\": \"bytes\"\n }\n ]\n },\n \"data_description\": {\n \"time_field\": \"timestamp\",\n \"time_format\": \"epoch_ms\"\n },\n \"analysis_limits\": {\n \"model_memory_limit\": \"11MB\"\n },\n \"model_plot_config\": {\n \"enabled\": true,\n \"annotations_enabled\": true\n },\n \"results_index_name\": \"test-job1\",\n \"datafeed_config\": {\n \"indices\": [\n \"kibana_sample_data_logs\"\n ],\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ]\n }\n },\n \"runtime_mappings\": {\n \"hour_of_day\": {\n \"type\": \"long\",\n \"script\": {\n \"source\": \"emit(doc['timestamp'].value.getHour());\"\n }\n }\n },\n \"datafeed_id\": \"datafeed-test-job1\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.put_job(\n job_id=\"job-01\",\n analysis_config={\n \"bucket_span\": \"15m\",\n \"detectors\": [\n {\n \"detector_description\": \"Sum of bytes\",\n \"function\": \"sum\",\n \"field_name\": \"bytes\"\n }\n ]\n },\n data_description={\n \"time_field\": \"timestamp\",\n \"time_format\": \"epoch_ms\"\n },\n analysis_limits={\n \"model_memory_limit\": \"11MB\"\n },\n model_plot_config={\n \"enabled\": True,\n \"annotations_enabled\": True\n },\n results_index_name=\"test-job1\",\n datafeed_config={\n \"indices\": [\n \"kibana_sample_data_logs\"\n ],\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ]\n }\n },\n \"runtime_mappings\": {\n \"hour_of_day\": {\n \"type\": \"long\",\n \"script\": {\n \"source\": \"emit(doc['timestamp'].value.getHour());\"\n }\n }\n },\n \"datafeed_id\": \"datafeed-test-job1\"\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.putJob({\n job_id: \"job-01\",\n analysis_config: {\n bucket_span: \"15m\",\n detectors: [\n {\n detector_description: \"Sum of bytes\",\n function: \"sum\",\n field_name: \"bytes\",\n },\n ],\n },\n data_description: {\n time_field: \"timestamp\",\n time_format: \"epoch_ms\",\n },\n analysis_limits: {\n model_memory_limit: \"11MB\",\n },\n model_plot_config: {\n enabled: true,\n annotations_enabled: true,\n },\n results_index_name: \"test-job1\",\n datafeed_config: {\n indices: [\"kibana_sample_data_logs\"],\n query: {\n bool: {\n must: [\n {\n match_all: {},\n },\n ],\n },\n },\n runtime_mappings: {\n hour_of_day: {\n type: \"long\",\n script: {\n source: \"emit(doc['timestamp'].value.getHour());\",\n },\n },\n },\n datafeed_id: \"datafeed-test-job1\",\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.put_job(\n job_id: \"job-01\",\n body: {\n \"analysis_config\": {\n \"bucket_span\": \"15m\",\n \"detectors\": [\n {\n \"detector_description\": \"Sum of bytes\",\n \"function\": \"sum\",\n \"field_name\": \"bytes\"\n }\n ]\n },\n \"data_description\": {\n \"time_field\": \"timestamp\",\n \"time_format\": \"epoch_ms\"\n },\n \"analysis_limits\": {\n \"model_memory_limit\": \"11MB\"\n },\n \"model_plot_config\": {\n \"enabled\": true,\n \"annotations_enabled\": true\n },\n \"results_index_name\": \"test-job1\",\n \"datafeed_config\": {\n \"indices\": [\n \"kibana_sample_data_logs\"\n ],\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ]\n }\n },\n \"runtime_mappings\": {\n \"hour_of_day\": {\n \"type\": \"long\",\n \"script\": {\n \"source\": \"emit(doc['timestamp'].value.getHour());\"\n }\n }\n },\n \"datafeed_id\": \"datafeed-test-job1\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->putJob([\n \"job_id\" => \"job-01\",\n \"body\" => [\n \"analysis_config\" => [\n \"bucket_span\" => \"15m\",\n \"detectors\" => array(\n [\n \"detector_description\" => \"Sum of bytes\",\n \"function\" => \"sum\",\n \"field_name\" => \"bytes\",\n ],\n ),\n ],\n \"data_description\" => [\n \"time_field\" => \"timestamp\",\n \"time_format\" => \"epoch_ms\",\n ],\n \"analysis_limits\" => [\n \"model_memory_limit\" => \"11MB\",\n ],\n \"model_plot_config\" => [\n \"enabled\" => true,\n \"annotations_enabled\" => true,\n ],\n \"results_index_name\" => \"test-job1\",\n \"datafeed_config\" => [\n \"indices\" => array(\n \"kibana_sample_data_logs\",\n ),\n \"query\" => [\n \"bool\" => [\n \"must\" => array(\n [\n \"match_all\" => new ArrayObject([]),\n ],\n ),\n ],\n ],\n \"runtime_mappings\" => [\n \"hour_of_day\" => [\n \"type\" => \"long\",\n \"script\" => [\n \"source\" => \"emit(doc['timestamp'].value.getHour());\",\n ],\n ],\n ],\n \"datafeed_id\" => \"datafeed-test-job1\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"analysis_config\":{\"bucket_span\":\"15m\",\"detectors\":[{\"detector_description\":\"Sum of bytes\",\"function\":\"sum\",\"field_name\":\"bytes\"}]},\"data_description\":{\"time_field\":\"timestamp\",\"time_format\":\"epoch_ms\"},\"analysis_limits\":{\"model_memory_limit\":\"11MB\"},\"model_plot_config\":{\"enabled\":true,\"annotations_enabled\":true},\"results_index_name\":\"test-job1\",\"datafeed_config\":{\"indices\":[\"kibana_sample_data_logs\"],\"query\":{\"bool\":{\"must\":[{\"match_all\":{}}]}},\"runtime_mappings\":{\"hour_of_day\":{\"type\":\"long\",\"script\":{\"source\":\"emit(doc['\"'\"'timestamp'\"'\"'].value.getHour());\"}}},\"datafeed_id\":\"datafeed-test-job1\"}}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/job-01\"" + } + ] }, "delete": { "tags": [ @@ -25223,6 +33021,26 @@ { "lang": "Console", "source": "DELETE _ml/anomaly_detectors/total-requests\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.delete_job(\n job_id=\"total-requests\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.deleteJob({\n job_id: \"total-requests\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.delete_job(\n job_id: \"total-requests\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->deleteJob([\n \"job_id\" => \"total-requests\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/total-requests\"" } ] } @@ -25274,6 +33092,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/high_sum_total_sales/model_snapshots\n{\n \"start\": \"1575402236000\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_model_snapshots(\n job_id=\"high_sum_total_sales\",\n start=\"1575402236000\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getModelSnapshots({\n job_id: \"high_sum_total_sales\",\n start: 1575402236000,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_model_snapshots(\n job_id: \"high_sum_total_sales\",\n body: {\n \"start\": \"1575402236000\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getModelSnapshots([\n \"job_id\" => \"high_sum_total_sales\",\n \"body\" => [\n \"start\" => \"1575402236000\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"start\":\"1575402236000\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/high_sum_total_sales/model_snapshots\"" } ] }, @@ -25323,6 +33161,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/high_sum_total_sales/model_snapshots\n{\n \"start\": \"1575402236000\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_model_snapshots(\n job_id=\"high_sum_total_sales\",\n start=\"1575402236000\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getModelSnapshots({\n job_id: \"high_sum_total_sales\",\n start: 1575402236000,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_model_snapshots(\n job_id: \"high_sum_total_sales\",\n body: {\n \"start\": \"1575402236000\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getModelSnapshots([\n \"job_id\" => \"high_sum_total_sales\",\n \"body\" => [\n \"start\" => \"1575402236000\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"start\":\"1575402236000\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/high_sum_total_sales/model_snapshots\"" } ] }, @@ -25380,6 +33238,26 @@ { "lang": "Console", "source": "DELETE _ml/anomaly_detectors/farequote/model_snapshots/1491948163\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.delete_model_snapshot(\n job_id=\"farequote\",\n snapshot_id=\"1491948163\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.deleteModelSnapshot({\n job_id: \"farequote\",\n snapshot_id: 1491948163,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.delete_model_snapshot(\n job_id: \"farequote\",\n snapshot_id: \"1491948163\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->deleteModelSnapshot([\n \"job_id\" => \"farequote\",\n \"snapshot_id\" => \"1491948163\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/farequote/model_snapshots/1491948163\"" } ] } @@ -25428,6 +33306,26 @@ { "lang": "Console", "source": "GET _ml/trained_models/\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_trained_models()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getTrainedModels();" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_trained_models" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getTrainedModels();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/\"" } ] }, @@ -25602,6 +33500,26 @@ { "lang": "Console", "source": "DELETE _ml/trained_models/regression-job-one-1574775307356\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.delete_trained_model(\n model_id=\"regression-job-one-1574775307356\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.deleteTrainedModel({\n model_id: \"regression-job-one-1574775307356\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.delete_trained_model(\n model_id: \"regression-job-one-1574775307356\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->deleteTrainedModel([\n \"model_id\" => \"regression-job-one-1574775307356\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/regression-job-one-1574775307356\"" } ] } @@ -25665,6 +33583,26 @@ { "lang": "Console", "source": "PUT _ml/trained_models/flight-delay-prediction-1574775339910/model_aliases/flight_delay_model\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.put_trained_model_alias(\n model_id=\"flight-delay-prediction-1574775339910\",\n model_alias=\"flight_delay_model\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.putTrainedModelAlias({\n model_id: \"flight-delay-prediction-1574775339910\",\n model_alias: \"flight_delay_model\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.put_trained_model_alias(\n model_id: \"flight-delay-prediction-1574775339910\",\n model_alias: \"flight_delay_model\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->putTrainedModelAlias([\n \"model_id\" => \"flight-delay-prediction-1574775339910\",\n \"model_alias\" => \"flight_delay_model\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/flight-delay-prediction-1574775339910/model_aliases/flight_delay_model\"" } ] }, @@ -25722,6 +33660,26 @@ { "lang": "Console", "source": "DELETE _ml/trained_models/flight-delay-prediction-1574775339910/model_aliases/flight_delay_model\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.delete_trained_model_alias(\n model_id=\"flight-delay-prediction-1574775339910\",\n model_alias=\"flight_delay_model\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.deleteTrainedModelAlias({\n model_id: \"flight-delay-prediction-1574775339910\",\n model_alias: \"flight_delay_model\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.delete_trained_model_alias(\n model_id: \"flight-delay-prediction-1574775339910\",\n model_alias: \"flight_delay_model\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->deleteTrainedModelAlias([\n \"model_id\" => \"flight-delay-prediction-1574775339910\",\n \"model_alias\" => \"flight_delay_model\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/flight-delay-prediction-1574775339910/model_aliases/flight_delay_model\"" } ] } @@ -25800,6 +33758,26 @@ { "lang": "Console", "source": "POST _ml/anomaly_detectors/_estimate_model_memory\n{\n \"analysis_config\": {\n \"bucket_span\": \"5m\",\n \"detectors\": [\n {\n \"function\": \"sum\",\n \"field_name\": \"bytes\",\n \"by_field_name\": \"status\",\n \"partition_field_name\": \"app\"\n }\n ],\n \"influencers\": [\n \"source_ip\",\n \"dest_ip\"\n ]\n },\n \"overall_cardinality\": {\n \"status\": 10,\n \"app\": 50\n },\n \"max_bucket_cardinality\": {\n \"source_ip\": 300,\n \"dest_ip\": 30\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.estimate_model_memory(\n analysis_config={\n \"bucket_span\": \"5m\",\n \"detectors\": [\n {\n \"function\": \"sum\",\n \"field_name\": \"bytes\",\n \"by_field_name\": \"status\",\n \"partition_field_name\": \"app\"\n }\n ],\n \"influencers\": [\n \"source_ip\",\n \"dest_ip\"\n ]\n },\n overall_cardinality={\n \"status\": 10,\n \"app\": 50\n },\n max_bucket_cardinality={\n \"source_ip\": 300,\n \"dest_ip\": 30\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.estimateModelMemory({\n analysis_config: {\n bucket_span: \"5m\",\n detectors: [\n {\n function: \"sum\",\n field_name: \"bytes\",\n by_field_name: \"status\",\n partition_field_name: \"app\",\n },\n ],\n influencers: [\"source_ip\", \"dest_ip\"],\n },\n overall_cardinality: {\n status: 10,\n app: 50,\n },\n max_bucket_cardinality: {\n source_ip: 300,\n dest_ip: 30,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.estimate_model_memory(\n body: {\n \"analysis_config\": {\n \"bucket_span\": \"5m\",\n \"detectors\": [\n {\n \"function\": \"sum\",\n \"field_name\": \"bytes\",\n \"by_field_name\": \"status\",\n \"partition_field_name\": \"app\"\n }\n ],\n \"influencers\": [\n \"source_ip\",\n \"dest_ip\"\n ]\n },\n \"overall_cardinality\": {\n \"status\": 10,\n \"app\": 50\n },\n \"max_bucket_cardinality\": {\n \"source_ip\": 300,\n \"dest_ip\": 30\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->estimateModelMemory([\n \"body\" => [\n \"analysis_config\" => [\n \"bucket_span\" => \"5m\",\n \"detectors\" => array(\n [\n \"function\" => \"sum\",\n \"field_name\" => \"bytes\",\n \"by_field_name\" => \"status\",\n \"partition_field_name\" => \"app\",\n ],\n ),\n \"influencers\" => array(\n \"source_ip\",\n \"dest_ip\",\n ),\n ],\n \"overall_cardinality\" => [\n \"status\" => 10,\n \"app\" => 50,\n ],\n \"max_bucket_cardinality\" => [\n \"source_ip\" => 300,\n \"dest_ip\" => 30,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"analysis_config\":{\"bucket_span\":\"5m\",\"detectors\":[{\"function\":\"sum\",\"field_name\":\"bytes\",\"by_field_name\":\"status\",\"partition_field_name\":\"app\"}],\"influencers\":[\"source_ip\",\"dest_ip\"]},\"overall_cardinality\":{\"status\":10,\"app\":50},\"max_bucket_cardinality\":{\"source_ip\":300,\"dest_ip\":30}}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/_estimate_model_memory\"" } ] } @@ -25909,6 +33887,26 @@ { "lang": "Console", "source": "POST _ml/data_frame/_evaluate\n{\n \"index\": \"animal_classification\",\n \"evaluation\": {\n \"classification\": {\n \"actual_field\": \"animal_class\",\n \"predicted_field\": \"ml.animal_class_prediction\",\n \"metrics\": {\n \"multiclass_confusion_matrix\": {}\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.evaluate_data_frame(\n index=\"animal_classification\",\n evaluation={\n \"classification\": {\n \"actual_field\": \"animal_class\",\n \"predicted_field\": \"ml.animal_class_prediction\",\n \"metrics\": {\n \"multiclass_confusion_matrix\": {}\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.evaluateDataFrame({\n index: \"animal_classification\",\n evaluation: {\n classification: {\n actual_field: \"animal_class\",\n predicted_field: \"ml.animal_class_prediction\",\n metrics: {\n multiclass_confusion_matrix: {},\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.evaluate_data_frame(\n body: {\n \"index\": \"animal_classification\",\n \"evaluation\": {\n \"classification\": {\n \"actual_field\": \"animal_class\",\n \"predicted_field\": \"ml.animal_class_prediction\",\n \"metrics\": {\n \"multiclass_confusion_matrix\": {}\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->evaluateDataFrame([\n \"body\" => [\n \"index\" => \"animal_classification\",\n \"evaluation\" => [\n \"classification\" => [\n \"actual_field\" => \"animal_class\",\n \"predicted_field\" => \"ml.animal_class_prediction\",\n \"metrics\" => [\n \"multiclass_confusion_matrix\" => new ArrayObject([]),\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index\":\"animal_classification\",\"evaluation\":{\"classification\":{\"actual_field\":\"animal_class\",\"predicted_field\":\"ml.animal_class_prediction\",\"metrics\":{\"multiclass_confusion_matrix\":{}}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/_evaluate\"" } ] } @@ -25934,6 +33932,26 @@ { "lang": "Console", "source": "POST _ml/data_frame/analytics/_explain\n{\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.explain_data_frame_analytics(\n source={\n \"index\": \"houses_sold_last_10_yrs\"\n },\n analysis={\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.explainDataFrameAnalytics({\n source: {\n index: \"houses_sold_last_10_yrs\",\n },\n analysis: {\n regression: {\n dependent_variable: \"price\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.explain_data_frame_analytics(\n body: {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->explainDataFrameAnalytics([\n \"body\" => [\n \"source\" => [\n \"index\" => \"houses_sold_last_10_yrs\",\n ],\n \"analysis\" => [\n \"regression\" => [\n \"dependent_variable\" => \"price\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"houses_sold_last_10_yrs\"},\"analysis\":{\"regression\":{\"dependent_variable\":\"price\"}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/_explain\"" } ] }, @@ -25957,6 +33975,26 @@ { "lang": "Console", "source": "POST _ml/data_frame/analytics/_explain\n{\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.explain_data_frame_analytics(\n source={\n \"index\": \"houses_sold_last_10_yrs\"\n },\n analysis={\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.explainDataFrameAnalytics({\n source: {\n index: \"houses_sold_last_10_yrs\",\n },\n analysis: {\n regression: {\n dependent_variable: \"price\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.explain_data_frame_analytics(\n body: {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->explainDataFrameAnalytics([\n \"body\" => [\n \"source\" => [\n \"index\" => \"houses_sold_last_10_yrs\",\n ],\n \"analysis\" => [\n \"regression\" => [\n \"dependent_variable\" => \"price\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"houses_sold_last_10_yrs\"},\"analysis\":{\"regression\":{\"dependent_variable\":\"price\"}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/_explain\"" } ] } @@ -25987,6 +34025,26 @@ { "lang": "Console", "source": "POST _ml/data_frame/analytics/_explain\n{\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.explain_data_frame_analytics(\n source={\n \"index\": \"houses_sold_last_10_yrs\"\n },\n analysis={\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.explainDataFrameAnalytics({\n source: {\n index: \"houses_sold_last_10_yrs\",\n },\n analysis: {\n regression: {\n dependent_variable: \"price\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.explain_data_frame_analytics(\n body: {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->explainDataFrameAnalytics([\n \"body\" => [\n \"source\" => [\n \"index\" => \"houses_sold_last_10_yrs\",\n ],\n \"analysis\" => [\n \"regression\" => [\n \"dependent_variable\" => \"price\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"houses_sold_last_10_yrs\"},\"analysis\":{\"regression\":{\"dependent_variable\":\"price\"}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/_explain\"" } ] }, @@ -26015,6 +34073,26 @@ { "lang": "Console", "source": "POST _ml/data_frame/analytics/_explain\n{\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.explain_data_frame_analytics(\n source={\n \"index\": \"houses_sold_last_10_yrs\"\n },\n analysis={\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.explainDataFrameAnalytics({\n source: {\n index: \"houses_sold_last_10_yrs\",\n },\n analysis: {\n regression: {\n dependent_variable: \"price\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.explain_data_frame_analytics(\n body: {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->explainDataFrameAnalytics([\n \"body\" => [\n \"source\" => [\n \"index\" => \"houses_sold_last_10_yrs\",\n ],\n \"analysis\" => [\n \"regression\" => [\n \"dependent_variable\" => \"price\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"houses_sold_last_10_yrs\"},\"analysis\":{\"regression\":{\"dependent_variable\":\"price\"}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/_explain\"" } ] } @@ -26152,6 +34230,26 @@ { "lang": "Console", "source": "POST _ml/anomaly_detectors/low_request_rate/_flush\n{\n \"calc_interim\": true\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.flush_job(\n job_id=\"low_request_rate\",\n calc_interim=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.flushJob({\n job_id: \"low_request_rate\",\n calc_interim: true,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.flush_job(\n job_id: \"low_request_rate\",\n body: {\n \"calc_interim\": true\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->flushJob([\n \"job_id\" => \"low_request_rate\",\n \"body\" => [\n \"calc_interim\" => true,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"calc_interim\":true}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_flush\"" } ] } @@ -26212,6 +34310,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/low_request_rate/results/buckets\n{\n \"anomaly_score\": 80,\n \"start\": \"1454530200001\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_buckets(\n job_id=\"low_request_rate\",\n anomaly_score=80,\n start=\"1454530200001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getBuckets({\n job_id: \"low_request_rate\",\n anomaly_score: 80,\n start: 1454530200001,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_buckets(\n job_id: \"low_request_rate\",\n body: {\n \"anomaly_score\": 80,\n \"start\": \"1454530200001\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getBuckets([\n \"job_id\" => \"low_request_rate\",\n \"body\" => [\n \"anomaly_score\" => 80,\n \"start\" => \"1454530200001\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"anomaly_score\":80,\"start\":\"1454530200001\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/results/buckets\"" } ] }, @@ -26270,6 +34388,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/low_request_rate/results/buckets\n{\n \"anomaly_score\": 80,\n \"start\": \"1454530200001\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_buckets(\n job_id=\"low_request_rate\",\n anomaly_score=80,\n start=\"1454530200001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getBuckets({\n job_id: \"low_request_rate\",\n anomaly_score: 80,\n start: 1454530200001,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_buckets(\n job_id: \"low_request_rate\",\n body: {\n \"anomaly_score\": 80,\n \"start\": \"1454530200001\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getBuckets([\n \"job_id\" => \"low_request_rate\",\n \"body\" => [\n \"anomaly_score\" => 80,\n \"start\" => \"1454530200001\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"anomaly_score\":80,\"start\":\"1454530200001\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/results/buckets\"" } ] } @@ -26327,6 +34465,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/low_request_rate/results/buckets\n{\n \"anomaly_score\": 80,\n \"start\": \"1454530200001\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_buckets(\n job_id=\"low_request_rate\",\n anomaly_score=80,\n start=\"1454530200001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getBuckets({\n job_id: \"low_request_rate\",\n anomaly_score: 80,\n start: 1454530200001,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_buckets(\n job_id: \"low_request_rate\",\n body: {\n \"anomaly_score\": 80,\n \"start\": \"1454530200001\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getBuckets([\n \"job_id\" => \"low_request_rate\",\n \"body\" => [\n \"anomaly_score\" => 80,\n \"start\" => \"1454530200001\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"anomaly_score\":80,\"start\":\"1454530200001\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/results/buckets\"" } ] }, @@ -26382,6 +34540,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/low_request_rate/results/buckets\n{\n \"anomaly_score\": 80,\n \"start\": \"1454530200001\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_buckets(\n job_id=\"low_request_rate\",\n anomaly_score=80,\n start=\"1454530200001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getBuckets({\n job_id: \"low_request_rate\",\n anomaly_score: 80,\n start: 1454530200001,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_buckets(\n job_id: \"low_request_rate\",\n body: {\n \"anomaly_score\": 80,\n \"start\": \"1454530200001\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getBuckets([\n \"job_id\" => \"low_request_rate\",\n \"body\" => [\n \"anomaly_score\" => 80,\n \"start\" => \"1454530200001\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"anomaly_score\":80,\"start\":\"1454530200001\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/results/buckets\"" } ] } @@ -26489,6 +34667,26 @@ { "lang": "Console", "source": "GET _ml/calendars/planned-outages/events\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_calendar_events(\n calendar_id=\"planned-outages\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getCalendarEvents({\n calendar_id: \"planned-outages\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_calendar_events(\n calendar_id: \"planned-outages\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getCalendarEvents([\n \"calendar_id\" => \"planned-outages\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages/events\"" } ] }, @@ -26568,6 +34766,26 @@ { "lang": "Console", "source": "POST _ml/calendars/planned-outages/events\n{\n \"events\" : [\n {\"description\": \"event 1\", \"start_time\": 1513641600000, \"end_time\": 1513728000000},\n {\"description\": \"event 2\", \"start_time\": 1513814400000, \"end_time\": 1513900800000},\n {\"description\": \"event 3\", \"start_time\": 1514160000000, \"end_time\": 1514246400000}\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.post_calendar_events(\n calendar_id=\"planned-outages\",\n events=[\n {\n \"description\": \"event 1\",\n \"start_time\": 1513641600000,\n \"end_time\": 1513728000000\n },\n {\n \"description\": \"event 2\",\n \"start_time\": 1513814400000,\n \"end_time\": 1513900800000\n },\n {\n \"description\": \"event 3\",\n \"start_time\": 1514160000000,\n \"end_time\": 1514246400000\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.postCalendarEvents({\n calendar_id: \"planned-outages\",\n events: [\n {\n description: \"event 1\",\n start_time: 1513641600000,\n end_time: 1513728000000,\n },\n {\n description: \"event 2\",\n start_time: 1513814400000,\n end_time: 1513900800000,\n },\n {\n description: \"event 3\",\n start_time: 1514160000000,\n end_time: 1514246400000,\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.post_calendar_events(\n calendar_id: \"planned-outages\",\n body: {\n \"events\": [\n {\n \"description\": \"event 1\",\n \"start_time\": 1513641600000,\n \"end_time\": 1513728000000\n },\n {\n \"description\": \"event 2\",\n \"start_time\": 1513814400000,\n \"end_time\": 1513900800000\n },\n {\n \"description\": \"event 3\",\n \"start_time\": 1514160000000,\n \"end_time\": 1514246400000\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->postCalendarEvents([\n \"calendar_id\" => \"planned-outages\",\n \"body\" => [\n \"events\" => array(\n [\n \"description\" => \"event 1\",\n \"start_time\" => 1513641600000,\n \"end_time\" => 1513728000000,\n ],\n [\n \"description\" => \"event 2\",\n \"start_time\" => 1513814400000,\n \"end_time\" => 1513900800000,\n ],\n [\n \"description\" => \"event 3\",\n \"start_time\" => 1514160000000,\n \"end_time\" => 1514246400000,\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"events\":[{\"description\":\"event 1\",\"start_time\":1513641600000,\"end_time\":1513728000000},{\"description\":\"event 2\",\"start_time\":1513814400000,\"end_time\":1513900800000},{\"description\":\"event 3\",\"start_time\":1514160000000,\"end_time\":1514246400000}]}' \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages/events\"" } ] } @@ -26601,6 +34819,26 @@ { "lang": "Console", "source": "GET _ml/calendars/planned-outages\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_calendars(\n calendar_id=\"planned-outages\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getCalendars({\n calendar_id: \"planned-outages\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_calendars(\n calendar_id: \"planned-outages\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getCalendars([\n \"calendar_id\" => \"planned-outages\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages\"" } ] }, @@ -26632,6 +34870,26 @@ { "lang": "Console", "source": "GET _ml/calendars/planned-outages\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_calendars(\n calendar_id=\"planned-outages\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getCalendars({\n calendar_id: \"planned-outages\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_calendars(\n calendar_id: \"planned-outages\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getCalendars([\n \"calendar_id\" => \"planned-outages\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages\"" } ] } @@ -26674,6 +34932,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/esxi_log/results/categories\n{\n \"page\":{\n \"size\": 1\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_categories(\n job_id=\"esxi_log\",\n page={\n \"size\": 1\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getCategories({\n job_id: \"esxi_log\",\n page: {\n size: 1,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_categories(\n job_id: \"esxi_log\",\n body: {\n \"page\": {\n \"size\": 1\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getCategories([\n \"job_id\" => \"esxi_log\",\n \"body\" => [\n \"page\" => [\n \"size\" => 1,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"page\":{\"size\":1}}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/esxi_log/results/categories\"" } ] }, @@ -26714,6 +34992,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/esxi_log/results/categories\n{\n \"page\":{\n \"size\": 1\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_categories(\n job_id=\"esxi_log\",\n page={\n \"size\": 1\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getCategories({\n job_id: \"esxi_log\",\n page: {\n size: 1,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_categories(\n job_id: \"esxi_log\",\n body: {\n \"page\": {\n \"size\": 1\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getCategories([\n \"job_id\" => \"esxi_log\",\n \"body\" => [\n \"page\" => [\n \"size\" => 1,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"page\":{\"size\":1}}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/esxi_log/results/categories\"" } ] } @@ -26753,6 +35051,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/esxi_log/results/categories\n{\n \"page\":{\n \"size\": 1\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_categories(\n job_id=\"esxi_log\",\n page={\n \"size\": 1\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getCategories({\n job_id: \"esxi_log\",\n page: {\n size: 1,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_categories(\n job_id: \"esxi_log\",\n body: {\n \"page\": {\n \"size\": 1\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getCategories([\n \"job_id\" => \"esxi_log\",\n \"body\" => [\n \"page\" => [\n \"size\" => 1,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"page\":{\"size\":1}}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/esxi_log/results/categories\"" } ] }, @@ -26790,6 +35108,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/esxi_log/results/categories\n{\n \"page\":{\n \"size\": 1\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_categories(\n job_id=\"esxi_log\",\n page={\n \"size\": 1\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getCategories({\n job_id: \"esxi_log\",\n page: {\n size: 1,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_categories(\n job_id: \"esxi_log\",\n body: {\n \"page\": {\n \"size\": 1\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getCategories([\n \"job_id\" => \"esxi_log\",\n \"body\" => [\n \"page\" => [\n \"size\" => 1,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"page\":{\"size\":1}}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/esxi_log/results/categories\"" } ] } @@ -26826,6 +35164,26 @@ { "lang": "Console", "source": "GET _ml/data_frame/analytics/loganalytics\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_data_frame_analytics(\n id=\"loganalytics\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getDataFrameAnalytics({\n id: \"loganalytics\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_data_frame_analytics(\n id: \"loganalytics\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics\"" } ] } @@ -26862,6 +35220,26 @@ { "lang": "Console", "source": "GET _ml/data_frame/analytics/weblog-outliers/_stats\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_data_frame_analytics_stats(\n id=\"weblog-outliers\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getDataFrameAnalyticsStats({\n id: \"weblog-outliers\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_data_frame_analytics_stats(\n id: \"weblog-outliers\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getDataFrameAnalyticsStats([\n \"id\" => \"weblog-outliers\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/weblog-outliers/_stats\"" } ] } @@ -26901,6 +35279,26 @@ { "lang": "Console", "source": "GET _ml/data_frame/analytics/weblog-outliers/_stats\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_data_frame_analytics_stats(\n id=\"weblog-outliers\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getDataFrameAnalyticsStats({\n id: \"weblog-outliers\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_data_frame_analytics_stats(\n id: \"weblog-outliers\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getDataFrameAnalyticsStats([\n \"id\" => \"weblog-outliers\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/weblog-outliers/_stats\"" } ] } @@ -26931,6 +35329,26 @@ { "lang": "Console", "source": "GET _ml/datafeeds/datafeed-high_sum_total_sales/_stats\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_datafeed_stats(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getDatafeedStats({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_datafeed_stats(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getDatafeedStats([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales/_stats\"" } ] } @@ -26958,6 +35376,26 @@ { "lang": "Console", "source": "GET _ml/datafeeds/datafeed-high_sum_total_sales/_stats\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_datafeed_stats(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getDatafeedStats({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_datafeed_stats(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getDatafeedStats([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales/_stats\"" } ] } @@ -26988,6 +35426,26 @@ { "lang": "Console", "source": "GET _ml/datafeeds/datafeed-high_sum_total_sales\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_datafeeds(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getDatafeeds({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_datafeeds(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getDatafeeds([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales\"" } ] } @@ -27018,6 +35476,26 @@ { "lang": "Console", "source": "GET _ml/filters/safe_domains\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_filters(\n filter_id=\"safe_domains\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getFilters({\n filter_id: \"safe_domains\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_filters(\n filter_id: \"safe_domains\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getFilters([\n \"filter_id\" => \"safe_domains\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/filters/safe_domains\"" } ] } @@ -27072,6 +35550,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/high_sum_total_sales/results/influencers\n{\n \"sort\": \"influencer_score\",\n \"desc\": true\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_influencers(\n job_id=\"high_sum_total_sales\",\n sort=\"influencer_score\",\n desc=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getInfluencers({\n job_id: \"high_sum_total_sales\",\n sort: \"influencer_score\",\n desc: true,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_influencers(\n job_id: \"high_sum_total_sales\",\n body: {\n \"sort\": \"influencer_score\",\n \"desc\": true\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getInfluencers([\n \"job_id\" => \"high_sum_total_sales\",\n \"body\" => [\n \"sort\" => \"influencer_score\",\n \"desc\" => true,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"sort\":\"influencer_score\",\"desc\":true}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/high_sum_total_sales/results/influencers\"" } ] }, @@ -27124,6 +35622,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/high_sum_total_sales/results/influencers\n{\n \"sort\": \"influencer_score\",\n \"desc\": true\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_influencers(\n job_id=\"high_sum_total_sales\",\n sort=\"influencer_score\",\n desc=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getInfluencers({\n job_id: \"high_sum_total_sales\",\n sort: \"influencer_score\",\n desc: true,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_influencers(\n job_id: \"high_sum_total_sales\",\n body: {\n \"sort\": \"influencer_score\",\n \"desc\": true\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getInfluencers([\n \"job_id\" => \"high_sum_total_sales\",\n \"body\" => [\n \"sort\" => \"influencer_score\",\n \"desc\" => true,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"sort\":\"influencer_score\",\"desc\":true}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/high_sum_total_sales/results/influencers\"" } ] } @@ -27151,6 +35669,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/low_request_rate/_stats\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_job_stats(\n job_id=\"low_request_rate\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getJobStats({\n job_id: \"low_request_rate\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_job_stats(\n job_id: \"low_request_rate\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getJobStats([\n \"job_id\" => \"low_request_rate\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_stats\"" } ] } @@ -27181,6 +35719,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/low_request_rate/_stats\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_job_stats(\n job_id=\"low_request_rate\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getJobStats({\n job_id: \"low_request_rate\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_job_stats(\n job_id: \"low_request_rate\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getJobStats([\n \"job_id\" => \"low_request_rate\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_stats\"" } ] } @@ -27211,6 +35769,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/high_sum_total_sales\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_jobs(\n job_id=\"high_sum_total_sales\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getJobs({\n job_id: \"high_sum_total_sales\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_jobs(\n job_id: \"high_sum_total_sales\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getJobs([\n \"job_id\" => \"high_sum_total_sales\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/high_sum_total_sales\"" } ] } @@ -27241,6 +35819,26 @@ { "lang": "Console", "source": "GET _ml/memory/_stats?human\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_memory_stats(\n human=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getMemoryStats({\n human: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_memory_stats(\n human: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getMemoryStats([\n \"human\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/memory/_stats?human\"" } ] } @@ -27274,6 +35872,26 @@ { "lang": "Console", "source": "GET _ml/memory/_stats?human\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_memory_stats(\n human=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getMemoryStats({\n human: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_memory_stats(\n human: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getMemoryStats([\n \"human\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/memory/_stats?human\"" } ] } @@ -27352,6 +35970,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/low_request_rate/model_snapshots/_all/_upgrade/_stats\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_model_snapshot_upgrade_stats(\n job_id=\"low_request_rate\",\n snapshot_id=\"_all\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getModelSnapshotUpgradeStats({\n job_id: \"low_request_rate\",\n snapshot_id: \"_all\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_model_snapshot_upgrade_stats(\n job_id: \"low_request_rate\",\n snapshot_id: \"_all\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getModelSnapshotUpgradeStats([\n \"job_id\" => \"low_request_rate\",\n \"snapshot_id\" => \"_all\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/model_snapshots/_all/_upgrade/_stats\"" } ] } @@ -27400,6 +36038,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/high_sum_total_sales/model_snapshots\n{\n \"start\": \"1575402236000\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_model_snapshots(\n job_id=\"high_sum_total_sales\",\n start=\"1575402236000\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getModelSnapshots({\n job_id: \"high_sum_total_sales\",\n start: 1575402236000,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_model_snapshots(\n job_id: \"high_sum_total_sales\",\n body: {\n \"start\": \"1575402236000\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getModelSnapshots([\n \"job_id\" => \"high_sum_total_sales\",\n \"body\" => [\n \"start\" => \"1575402236000\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"start\":\"1575402236000\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/high_sum_total_sales/model_snapshots\"" } ] }, @@ -27446,6 +36104,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/high_sum_total_sales/model_snapshots\n{\n \"start\": \"1575402236000\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_model_snapshots(\n job_id=\"high_sum_total_sales\",\n start=\"1575402236000\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getModelSnapshots({\n job_id: \"high_sum_total_sales\",\n start: 1575402236000,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_model_snapshots(\n job_id: \"high_sum_total_sales\",\n body: {\n \"start\": \"1575402236000\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getModelSnapshots([\n \"job_id\" => \"high_sum_total_sales\",\n \"body\" => [\n \"start\" => \"1575402236000\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"start\":\"1575402236000\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/high_sum_total_sales/model_snapshots\"" } ] } @@ -27497,6 +36175,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/job-*/results/overall_buckets\n{\n \"overall_score\": 80,\n \"start\": \"1403532000000\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_overall_buckets(\n job_id=\"job-*\",\n overall_score=80,\n start=\"1403532000000\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getOverallBuckets({\n job_id: \"job-*\",\n overall_score: 80,\n start: 1403532000000,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_overall_buckets(\n job_id: \"job-*\",\n body: {\n \"overall_score\": 80,\n \"start\": \"1403532000000\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getOverallBuckets([\n \"job_id\" => \"job-*\",\n \"body\" => [\n \"overall_score\" => 80,\n \"start\" => \"1403532000000\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"overall_score\":80,\"start\":\"1403532000000\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/job-*/results/overall_buckets\"" } ] }, @@ -27546,6 +36244,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/job-*/results/overall_buckets\n{\n \"overall_score\": 80,\n \"start\": \"1403532000000\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_overall_buckets(\n job_id=\"job-*\",\n overall_score=80,\n start=\"1403532000000\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getOverallBuckets({\n job_id: \"job-*\",\n overall_score: 80,\n start: 1403532000000,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_overall_buckets(\n job_id: \"job-*\",\n body: {\n \"overall_score\": 80,\n \"start\": \"1403532000000\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getOverallBuckets([\n \"job_id\" => \"job-*\",\n \"body\" => [\n \"overall_score\" => 80,\n \"start\" => \"1403532000000\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"overall_score\":80,\"start\":\"1403532000000\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/job-*/results/overall_buckets\"" } ] } @@ -27600,6 +36318,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/low_request_rate/results/records\n{\n \"sort\": \"record_score\",\n \"desc\": true,\n \"start\": \"1454944100000\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_records(\n job_id=\"low_request_rate\",\n sort=\"record_score\",\n desc=True,\n start=\"1454944100000\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getRecords({\n job_id: \"low_request_rate\",\n sort: \"record_score\",\n desc: true,\n start: 1454944100000,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_records(\n job_id: \"low_request_rate\",\n body: {\n \"sort\": \"record_score\",\n \"desc\": true,\n \"start\": \"1454944100000\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getRecords([\n \"job_id\" => \"low_request_rate\",\n \"body\" => [\n \"sort\" => \"record_score\",\n \"desc\" => true,\n \"start\" => \"1454944100000\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"sort\":\"record_score\",\"desc\":true,\"start\":\"1454944100000\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/results/records\"" } ] }, @@ -27652,6 +36390,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/low_request_rate/results/records\n{\n \"sort\": \"record_score\",\n \"desc\": true,\n \"start\": \"1454944100000\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_records(\n job_id=\"low_request_rate\",\n sort=\"record_score\",\n desc=True,\n start=\"1454944100000\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getRecords({\n job_id: \"low_request_rate\",\n sort: \"record_score\",\n desc: true,\n start: 1454944100000,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_records(\n job_id: \"low_request_rate\",\n body: {\n \"sort\": \"record_score\",\n \"desc\": true,\n \"start\": \"1454944100000\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getRecords([\n \"job_id\" => \"low_request_rate\",\n \"body\" => [\n \"sort\" => \"record_score\",\n \"desc\" => true,\n \"start\" => \"1454944100000\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"sort\":\"record_score\",\"desc\":true,\"start\":\"1454944100000\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/results/records\"" } ] } @@ -27697,6 +36455,26 @@ { "lang": "Console", "source": "GET _ml/trained_models/\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_trained_models()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getTrainedModels();" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_trained_models" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getTrainedModels();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/\"" } ] } @@ -27733,6 +36511,26 @@ { "lang": "Console", "source": "GET _ml/trained_models/_stats\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_trained_models_stats()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getTrainedModelsStats();" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_trained_models_stats" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getTrainedModelsStats();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/_stats\"" } ] } @@ -27766,6 +36564,26 @@ { "lang": "Console", "source": "GET _ml/trained_models/_stats\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_trained_models_stats()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getTrainedModelsStats();" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_trained_models_stats" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getTrainedModelsStats();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/_stats\"" } ] } @@ -27862,6 +36680,26 @@ { "lang": "Console", "source": "POST _ml/trained_models/lang_ident_model_1/_infer\n{\n \"docs\":[{\"text\": \"The fool doth think he is wise, but the wise man knows himself to be a fool.\"}]\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.infer_trained_model(\n model_id=\"lang_ident_model_1\",\n docs=[\n {\n \"text\": \"The fool doth think he is wise, but the wise man knows himself to be a fool.\"\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.inferTrainedModel({\n model_id: \"lang_ident_model_1\",\n docs: [\n {\n text: \"The fool doth think he is wise, but the wise man knows himself to be a fool.\",\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.infer_trained_model(\n model_id: \"lang_ident_model_1\",\n body: {\n \"docs\": [\n {\n \"text\": \"The fool doth think he is wise, but the wise man knows himself to be a fool.\"\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->inferTrainedModel([\n \"model_id\" => \"lang_ident_model_1\",\n \"body\" => [\n \"docs\" => array(\n [\n \"text\" => \"The fool doth think he is wise, but the wise man knows himself to be a fool.\",\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"text\":\"The fool doth think he is wise, but the wise man knows himself to be a fool.\"}]}' \"$ELASTICSEARCH_URL/_ml/trained_models/lang_ident_model_1/_infer\"" } ] } @@ -27911,6 +36749,26 @@ { "lang": "Console", "source": "GET _ml/info\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.info()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.info();" + }, + { + "lang": "Ruby", + "source": "response = client.ml.info" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->info();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/info\"" } ] } @@ -27996,7 +36854,33 @@ } } }, - "x-state": "Added in 5.4.0" + "x-state": "Added in 5.4.0", + "x-codeSamples": [ + { + "lang": "Console", + "source": "POST /_ml/anomaly_detectors/job-01/_open\n{\n \"timeout\": \"35m\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.open_job(\n job_id=\"job-01\",\n timeout=\"35m\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.openJob({\n job_id: \"job-01\",\n timeout: \"35m\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.open_job(\n job_id: \"job-01\",\n body: {\n \"timeout\": \"35m\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->openJob([\n \"job_id\" => \"job-01\",\n \"body\" => [\n \"timeout\" => \"35m\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"timeout\":\"35m\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/job-01/_open\"" + } + ] } }, "/_ml/anomaly_detectors/{job_id}/_data": { @@ -28160,6 +37044,26 @@ { "lang": "Console", "source": "POST _ml/data_frame/analytics/_preview\n{\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.preview_data_frame_analytics(\n config={\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.previewDataFrameAnalytics({\n config: {\n source: {\n index: \"houses_sold_last_10_yrs\",\n },\n analysis: {\n regression: {\n dependent_variable: \"price\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.preview_data_frame_analytics(\n body: {\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->previewDataFrameAnalytics([\n \"body\" => [\n \"config\" => [\n \"source\" => [\n \"index\" => \"houses_sold_last_10_yrs\",\n ],\n \"analysis\" => [\n \"regression\" => [\n \"dependent_variable\" => \"price\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"config\":{\"source\":{\"index\":\"houses_sold_last_10_yrs\"},\"analysis\":{\"regression\":{\"dependent_variable\":\"price\"}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/_preview\"" } ] }, @@ -28183,6 +37087,26 @@ { "lang": "Console", "source": "POST _ml/data_frame/analytics/_preview\n{\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.preview_data_frame_analytics(\n config={\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.previewDataFrameAnalytics({\n config: {\n source: {\n index: \"houses_sold_last_10_yrs\",\n },\n analysis: {\n regression: {\n dependent_variable: \"price\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.preview_data_frame_analytics(\n body: {\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->previewDataFrameAnalytics([\n \"body\" => [\n \"config\" => [\n \"source\" => [\n \"index\" => \"houses_sold_last_10_yrs\",\n ],\n \"analysis\" => [\n \"regression\" => [\n \"dependent_variable\" => \"price\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"config\":{\"source\":{\"index\":\"houses_sold_last_10_yrs\"},\"analysis\":{\"regression\":{\"dependent_variable\":\"price\"}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/_preview\"" } ] } @@ -28213,6 +37137,26 @@ { "lang": "Console", "source": "POST _ml/data_frame/analytics/_preview\n{\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.preview_data_frame_analytics(\n config={\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.previewDataFrameAnalytics({\n config: {\n source: {\n index: \"houses_sold_last_10_yrs\",\n },\n analysis: {\n regression: {\n dependent_variable: \"price\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.preview_data_frame_analytics(\n body: {\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->previewDataFrameAnalytics([\n \"body\" => [\n \"config\" => [\n \"source\" => [\n \"index\" => \"houses_sold_last_10_yrs\",\n ],\n \"analysis\" => [\n \"regression\" => [\n \"dependent_variable\" => \"price\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"config\":{\"source\":{\"index\":\"houses_sold_last_10_yrs\"},\"analysis\":{\"regression\":{\"dependent_variable\":\"price\"}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/_preview\"" } ] }, @@ -28241,6 +37185,26 @@ { "lang": "Console", "source": "POST _ml/data_frame/analytics/_preview\n{\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.preview_data_frame_analytics(\n config={\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.previewDataFrameAnalytics({\n config: {\n source: {\n index: \"houses_sold_last_10_yrs\",\n },\n analysis: {\n regression: {\n dependent_variable: \"price\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.preview_data_frame_analytics(\n body: {\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->previewDataFrameAnalytics([\n \"body\" => [\n \"config\" => [\n \"source\" => [\n \"index\" => \"houses_sold_last_10_yrs\",\n ],\n \"analysis\" => [\n \"regression\" => [\n \"dependent_variable\" => \"price\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"config\":{\"source\":{\"index\":\"houses_sold_last_10_yrs\"},\"analysis\":{\"regression\":{\"dependent_variable\":\"price\"}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/_preview\"" } ] } @@ -28277,6 +37241,26 @@ { "lang": "Console", "source": "GET _ml/datafeeds/datafeed-high_sum_total_sales/_preview\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.preview_datafeed(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.previewDatafeed({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.preview_datafeed(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->previewDatafeed([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales/_preview\"" } ] }, @@ -28311,6 +37295,26 @@ { "lang": "Console", "source": "GET _ml/datafeeds/datafeed-high_sum_total_sales/_preview\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.preview_datafeed(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.previewDatafeed({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.preview_datafeed(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->previewDatafeed([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales/_preview\"" } ] } @@ -28344,6 +37348,26 @@ { "lang": "Console", "source": "GET _ml/datafeeds/datafeed-high_sum_total_sales/_preview\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.preview_datafeed(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.previewDatafeed({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.preview_datafeed(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->previewDatafeed([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales/_preview\"" } ] }, @@ -28375,6 +37399,26 @@ { "lang": "Console", "source": "GET _ml/datafeeds/datafeed-high_sum_total_sales/_preview\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.preview_datafeed(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.previewDatafeed({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.preview_datafeed(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->previewDatafeed([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales/_preview\"" } ] } @@ -28463,6 +37507,26 @@ { "lang": "Console", "source": "PUT _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/definition/0\n{\n \"definition\": \"...\",\n \"total_definition_length\": 265632637,\n \"total_parts\": 64\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.put_trained_model_definition_part(\n model_id=\"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n part=\"0\",\n definition=\"...\",\n total_definition_length=265632637,\n total_parts=64,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.putTrainedModelDefinitionPart({\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n part: 0,\n definition: \"...\",\n total_definition_length: 265632637,\n total_parts: 64,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.put_trained_model_definition_part(\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n part: \"0\",\n body: {\n \"definition\": \"...\",\n \"total_definition_length\": 265632637,\n \"total_parts\": 64\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->putTrainedModelDefinitionPart([\n \"model_id\" => \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n \"part\" => \"0\",\n \"body\" => [\n \"definition\" => \"...\",\n \"total_definition_length\" => 265632637,\n \"total_parts\" => 64,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"definition\":\"...\",\"total_definition_length\":265632637,\"total_parts\":64}' \"$ELASTICSEARCH_URL/_ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/definition/0\"" } ] } @@ -28523,7 +37587,7 @@ "examples": { "MlPutTrainedModelVocabularyExample1": { "description": "An example body for a `PUT _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/vocabulary` request.", - "value": "{\n \"vocabulary\": [\n \"[PAD]\",\n \"[unused0]\",\n ...\n ]\n}" + "value": "{\n \"vocabulary\": [\n \"[PAD]\",\n \"[unused0]\",\n ]\n}" } } } @@ -28546,7 +37610,27 @@ "x-codeSamples": [ { "lang": "Console", - "source": "PUT _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/vocabulary\n{\n \"vocabulary\": [\n \"[PAD]\",\n \"[unused0]\",\n ...\n ]\n}" + "source": "PUT _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/vocabulary\n{\n \"vocabulary\": [\n \"[PAD]\",\n \"[unused0]\",\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.put_trained_model_vocabulary(\n model_id=\"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n vocabulary=[\n \"[PAD]\",\n \"[unused0]\"\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.putTrainedModelVocabulary({\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n vocabulary: [\"[PAD]\", \"[unused0]\"],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.put_trained_model_vocabulary(\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n body: {\n \"vocabulary\": [\n \"[PAD]\",\n \"[unused0]\"\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->putTrainedModelVocabulary([\n \"model_id\" => \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n \"body\" => [\n \"vocabulary\" => array(\n \"[PAD]\",\n \"[unused0]\",\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"vocabulary\":[\"[PAD]\",\"[unused0]\"]}' \"$ELASTICSEARCH_URL/_ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/vocabulary\"" } ] } @@ -28609,6 +37693,26 @@ { "lang": "Console", "source": "POST _ml/anomaly_detectors/total-requests/_reset\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.reset_job(\n job_id=\"total-requests\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.resetJob({\n job_id: \"total-requests\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.reset_job(\n job_id: \"total-requests\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->resetJob([\n \"job_id\" => \"total-requests\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/total-requests/_reset\"" } ] } @@ -28701,6 +37805,26 @@ { "lang": "Console", "source": "POST _ml/anomaly_detectors/low_request_rate/model_snapshots/1637092688/_revert\n{\n \"delete_intervening_results\": true\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.revert_model_snapshot(\n job_id=\"low_request_rate\",\n snapshot_id=\"1637092688\",\n delete_intervening_results=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.revertModelSnapshot({\n job_id: \"low_request_rate\",\n snapshot_id: 1637092688,\n delete_intervening_results: true,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.revert_model_snapshot(\n job_id: \"low_request_rate\",\n snapshot_id: \"1637092688\",\n body: {\n \"delete_intervening_results\": true\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->revertModelSnapshot([\n \"job_id\" => \"low_request_rate\",\n \"snapshot_id\" => \"1637092688\",\n \"body\" => [\n \"delete_intervening_results\" => true,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"delete_intervening_results\":true}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/model_snapshots/1637092688/_revert\"" } ] } @@ -28752,6 +37876,26 @@ { "lang": "Console", "source": "POST _ml/set_upgrade_mode?enabled=true\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.set_upgrade_mode(\n enabled=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.setUpgradeMode({\n enabled: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.set_upgrade_mode(\n enabled: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->setUpgradeMode([\n \"enabled\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/set_upgrade_mode?enabled=true\"" } ] } @@ -28816,6 +37960,26 @@ { "lang": "Console", "source": "POST _ml/data_frame/analytics/loganalytics/_start\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.start_data_frame_analytics(\n id=\"loganalytics\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.startDataFrameAnalytics({\n id: \"loganalytics\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.start_data_frame_analytics(\n id: \"loganalytics\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->startDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics/_start\"" } ] } @@ -28927,6 +38091,26 @@ { "lang": "Console", "source": "POST _ml/datafeeds/datafeed-low_request_rate/_start\n{\n \"start\": \"2019-04-07T18:22:16Z\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.start_datafeed(\n datafeed_id=\"datafeed-low_request_rate\",\n start=\"2019-04-07T18:22:16Z\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.startDatafeed({\n datafeed_id: \"datafeed-low_request_rate\",\n start: \"2019-04-07T18:22:16Z\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.start_datafeed(\n datafeed_id: \"datafeed-low_request_rate\",\n body: {\n \"start\": \"2019-04-07T18:22:16Z\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->startDatafeed([\n \"datafeed_id\" => \"datafeed-low_request_rate\",\n \"body\" => [\n \"start\" => \"2019-04-07T18:22:16Z\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"start\":\"2019-04-07T18:22:16Z\"}' \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-low_request_rate/_start\"" } ] } @@ -29071,6 +38255,26 @@ { "lang": "Console", "source": "POST _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_start?wait_for=started&timeout=1m\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.start_trained_model_deployment(\n model_id=\"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n wait_for=\"started\",\n timeout=\"1m\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.startTrainedModelDeployment({\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n wait_for: \"started\",\n timeout: \"1m\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.start_trained_model_deployment(\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n wait_for: \"started\",\n timeout: \"1m\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->startTrainedModelDeployment([\n \"model_id\" => \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n \"wait_for\" => \"started\",\n \"timeout\" => \"1m\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_start?wait_for=started&timeout=1m\"" } ] } @@ -29151,6 +38355,26 @@ { "lang": "Console", "source": "POST _ml/data_frame/analytics/loganalytics/_stop\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.stop_data_frame_analytics(\n id=\"loganalytics\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.stopDataFrameAnalytics({\n id: \"loganalytics\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.stop_data_frame_analytics(\n id: \"loganalytics\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->stopDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics/_stop\"" } ] } @@ -29259,6 +38483,26 @@ { "lang": "Console", "source": "POST _ml/datafeeds/datafeed-low_request_rate/_stop\n{\n \"timeout\": \"30s\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.stop_datafeed(\n datafeed_id=\"datafeed-low_request_rate\",\n timeout=\"30s\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.stopDatafeed({\n datafeed_id: \"datafeed-low_request_rate\",\n timeout: \"30s\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.stop_datafeed(\n datafeed_id: \"datafeed-low_request_rate\",\n body: {\n \"timeout\": \"30s\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->stopDatafeed([\n \"datafeed_id\" => \"datafeed-low_request_rate\",\n \"body\" => [\n \"timeout\" => \"30s\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"timeout\":\"30s\"}' \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-low_request_rate/_stop\"" } ] } @@ -29329,6 +38573,26 @@ { "lang": "Console", "source": "POST _ml/trained_models/my_model_for_search/deployment/_stop\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.stop_trained_model_deployment(\n model_id=\"my_model_for_search\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.stopTrainedModelDeployment({\n model_id: \"my_model_for_search\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.stop_trained_model_deployment(\n model_id: \"my_model_for_search\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->stopTrainedModelDeployment([\n \"model_id\" => \"my_model_for_search\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/my_model_for_search/deployment/_stop\"" } ] } @@ -29454,6 +38718,26 @@ { "lang": "Console", "source": "POST _ml/data_frame/analytics/loganalytics/_update\n{\n \"model_memory_limit\": \"200mb\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.update_data_frame_analytics(\n id=\"loganalytics\",\n model_memory_limit=\"200mb\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.updateDataFrameAnalytics({\n id: \"loganalytics\",\n model_memory_limit: \"200mb\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.update_data_frame_analytics(\n id: \"loganalytics\",\n body: {\n \"model_memory_limit\": \"200mb\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->updateDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n \"body\" => [\n \"model_memory_limit\" => \"200mb\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"model_memory_limit\":\"200mb\"}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics/_update\"" } ] } @@ -29672,6 +38956,26 @@ { "lang": "Console", "source": "POST _ml/datafeeds/datafeed-test-job/_update\n{\n \"query\": {\n \"term\": {\n \"geo.src\": \"US\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.update_datafeed(\n datafeed_id=\"datafeed-test-job\",\n query={\n \"term\": {\n \"geo.src\": \"US\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.updateDatafeed({\n datafeed_id: \"datafeed-test-job\",\n query: {\n term: {\n \"geo.src\": \"US\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.update_datafeed(\n datafeed_id: \"datafeed-test-job\",\n body: {\n \"query\": {\n \"term\": {\n \"geo.src\": \"US\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->updateDatafeed([\n \"datafeed_id\" => \"datafeed-test-job\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"geo.src\" => \"US\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"geo.src\":\"US\"}}}' \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-test-job/_update\"" } ] } @@ -29769,6 +39073,26 @@ { "lang": "Console", "source": "POST _ml/filters/safe_domains/_update\n{\n \"description\": \"Updated list of domains\",\n \"add_items\": [\"*.myorg.com\"],\n \"remove_items\": [\"wikipedia.org\"]\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.update_filter(\n filter_id=\"safe_domains\",\n description=\"Updated list of domains\",\n add_items=[\n \"*.myorg.com\"\n ],\n remove_items=[\n \"wikipedia.org\"\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.updateFilter({\n filter_id: \"safe_domains\",\n description: \"Updated list of domains\",\n add_items: [\"*.myorg.com\"],\n remove_items: [\"wikipedia.org\"],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.update_filter(\n filter_id: \"safe_domains\",\n body: {\n \"description\": \"Updated list of domains\",\n \"add_items\": [\n \"*.myorg.com\"\n ],\n \"remove_items\": [\n \"wikipedia.org\"\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->updateFilter([\n \"filter_id\" => \"safe_domains\",\n \"body\" => [\n \"description\" => \"Updated list of domains\",\n \"add_items\" => array(\n \"*.myorg.com\",\n ),\n \"remove_items\" => array(\n \"wikipedia.org\",\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"Updated list of domains\",\"add_items\":[\"*.myorg.com\"],\"remove_items\":[\"wikipedia.org\"]}' \"$ELASTICSEARCH_URL/_ml/filters/safe_domains/_update\"" } ] } @@ -29979,6 +39303,26 @@ { "lang": "Console", "source": "POST _ml/anomaly_detectors/low_request_rate/_update\n{\n \"description\":\"An updated job\",\n \"detectors\": {\n \"detector_index\": 0,\n \"description\": \"An updated detector description\"\n },\n \"groups\": [\"kibana_sample_data\",\"kibana_sample_web_logs\"],\n \"model_plot_config\": {\n \"enabled\": true\n },\n \"renormalization_window_days\": 30,\n \"background_persist_interval\": \"2h\",\n \"model_snapshot_retention_days\": 7,\n \"results_retention_days\": 60\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.update_job(\n job_id=\"low_request_rate\",\n description=\"An updated job\",\n detectors={\n \"detector_index\": 0,\n \"description\": \"An updated detector description\"\n },\n groups=[\n \"kibana_sample_data\",\n \"kibana_sample_web_logs\"\n ],\n model_plot_config={\n \"enabled\": True\n },\n renormalization_window_days=30,\n background_persist_interval=\"2h\",\n model_snapshot_retention_days=7,\n results_retention_days=60,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.updateJob({\n job_id: \"low_request_rate\",\n description: \"An updated job\",\n detectors: {\n detector_index: 0,\n description: \"An updated detector description\",\n },\n groups: [\"kibana_sample_data\", \"kibana_sample_web_logs\"],\n model_plot_config: {\n enabled: true,\n },\n renormalization_window_days: 30,\n background_persist_interval: \"2h\",\n model_snapshot_retention_days: 7,\n results_retention_days: 60,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.update_job(\n job_id: \"low_request_rate\",\n body: {\n \"description\": \"An updated job\",\n \"detectors\": {\n \"detector_index\": 0,\n \"description\": \"An updated detector description\"\n },\n \"groups\": [\n \"kibana_sample_data\",\n \"kibana_sample_web_logs\"\n ],\n \"model_plot_config\": {\n \"enabled\": true\n },\n \"renormalization_window_days\": 30,\n \"background_persist_interval\": \"2h\",\n \"model_snapshot_retention_days\": 7,\n \"results_retention_days\": 60\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->updateJob([\n \"job_id\" => \"low_request_rate\",\n \"body\" => [\n \"description\" => \"An updated job\",\n \"detectors\" => [\n \"detector_index\" => 0,\n \"description\" => \"An updated detector description\",\n ],\n \"groups\" => array(\n \"kibana_sample_data\",\n \"kibana_sample_web_logs\",\n ),\n \"model_plot_config\" => [\n \"enabled\" => true,\n ],\n \"renormalization_window_days\" => 30,\n \"background_persist_interval\" => \"2h\",\n \"model_snapshot_retention_days\" => 7,\n \"results_retention_days\" => 60,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"An updated job\",\"detectors\":{\"detector_index\":0,\"description\":\"An updated detector description\"},\"groups\":[\"kibana_sample_data\",\"kibana_sample_web_logs\"],\"model_plot_config\":{\"enabled\":true},\"renormalization_window_days\":30,\"background_persist_interval\":\"2h\",\"model_snapshot_retention_days\":7,\"results_retention_days\":60}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_update\"" } ] } @@ -30070,6 +39414,26 @@ { "lang": "Console", "source": "POST\n_ml/anomaly_detectors/it_ops_new_logs/model_snapshots/1491852978/_update\n{\n \"description\": \"Snapshot 1\",\n \"retain\": true\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.update_model_snapshot(\n job_id=\"it_ops_new_logs\",\n snapshot_id=\"1491852978\",\n description=\"Snapshot 1\",\n retain=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.updateModelSnapshot({\n job_id: \"it_ops_new_logs\",\n snapshot_id: 1491852978,\n description: \"Snapshot 1\",\n retain: true,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.update_model_snapshot(\n job_id: \"it_ops_new_logs\",\n snapshot_id: \"1491852978\",\n body: {\n \"description\": \"Snapshot 1\",\n \"retain\": true\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->updateModelSnapshot([\n \"job_id\" => \"it_ops_new_logs\",\n \"snapshot_id\" => \"1491852978\",\n \"body\" => [\n \"description\" => \"Snapshot 1\",\n \"retain\" => true,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"Snapshot 1\",\"retain\":true}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/it_ops_new_logs/model_snapshots/1491852978/_update\"" } ] } @@ -30155,6 +39519,26 @@ { "lang": "Console", "source": "POST _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_update\n{\n \"number_of_allocations\": 4\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.update_trained_model_deployment(\n model_id=\"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n number_of_allocations=4,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.updateTrainedModelDeployment({\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n number_of_allocations: 4,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.update_trained_model_deployment(\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n body: {\n \"number_of_allocations\": 4\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->updateTrainedModelDeployment([\n \"model_id\" => \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n \"body\" => [\n \"number_of_allocations\" => 4,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"number_of_allocations\":4}' \"$ELASTICSEARCH_URL/_ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_update\"" } ] } @@ -30241,6 +39625,26 @@ { "lang": "Console", "source": "POST _ml/anomaly_detectors/low_request_rate/model_snapshots/1828371/_upgrade?timeout=45m&wait_for_completion=true\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.upgrade_job_snapshot(\n job_id=\"low_request_rate\",\n snapshot_id=\"1828371\",\n timeout=\"45m\",\n wait_for_completion=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.upgradeJobSnapshot({\n job_id: \"low_request_rate\",\n snapshot_id: 1828371,\n timeout: \"45m\",\n wait_for_completion: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.upgrade_job_snapshot(\n job_id: \"low_request_rate\",\n snapshot_id: \"1828371\",\n timeout: \"45m\",\n wait_for_completion: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->upgradeJobSnapshot([\n \"job_id\" => \"low_request_rate\",\n \"snapshot_id\" => \"1828371\",\n \"timeout\" => \"45m\",\n \"wait_for_completion\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/model_snapshots/1828371/_upgrade?timeout=45m&wait_for_completion=true\"" } ] } @@ -30307,6 +39711,26 @@ { "lang": "Console", "source": "GET my-index-000001/_msearch\n{ }\n{\"query\" : {\"match\" : { \"message\": \"this is a test\"}}}\n{\"index\": \"my-index-000002\"}\n{\"query\" : {\"match_all\" : {}}}" + }, + { + "lang": "Python", + "source": "resp = client.msearch(\n index=\"my-index-000001\",\n searches=[\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.msearch({\n index: \"my-index-000001\",\n searches: [\n {},\n {\n query: {\n match: {\n message: \"this is a test\",\n },\n },\n },\n {\n index: \"my-index-000002\",\n },\n {\n query: {\n match_all: {},\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.msearch(\n index: \"my-index-000001\",\n body: [\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->msearch([\n \"index\" => \"my-index-000001\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"query\" => [\n \"match\" => [\n \"message\" => \"this is a test\",\n ],\n ],\n ],\n [\n \"index\" => \"my-index-000002\",\n ],\n [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{},{\"query\":{\"match\":{\"message\":\"this is a test\"}}},{\"index\":\"my-index-000002\"},{\"query\":{\"match_all\":{}}}]' \"$ELASTICSEARCH_URL/my-index-000001/_msearch\"" } ] }, @@ -30371,6 +39795,26 @@ { "lang": "Console", "source": "GET my-index-000001/_msearch\n{ }\n{\"query\" : {\"match\" : { \"message\": \"this is a test\"}}}\n{\"index\": \"my-index-000002\"}\n{\"query\" : {\"match_all\" : {}}}" + }, + { + "lang": "Python", + "source": "resp = client.msearch(\n index=\"my-index-000001\",\n searches=[\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.msearch({\n index: \"my-index-000001\",\n searches: [\n {},\n {\n query: {\n match: {\n message: \"this is a test\",\n },\n },\n },\n {\n index: \"my-index-000002\",\n },\n {\n query: {\n match_all: {},\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.msearch(\n index: \"my-index-000001\",\n body: [\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->msearch([\n \"index\" => \"my-index-000001\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"query\" => [\n \"match\" => [\n \"message\" => \"this is a test\",\n ],\n ],\n ],\n [\n \"index\" => \"my-index-000002\",\n ],\n [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{},{\"query\":{\"match\":{\"message\":\"this is a test\"}}},{\"index\":\"my-index-000002\"},{\"query\":{\"match_all\":{}}}]' \"$ELASTICSEARCH_URL/my-index-000001/_msearch\"" } ] } @@ -30440,6 +39884,26 @@ { "lang": "Console", "source": "GET my-index-000001/_msearch\n{ }\n{\"query\" : {\"match\" : { \"message\": \"this is a test\"}}}\n{\"index\": \"my-index-000002\"}\n{\"query\" : {\"match_all\" : {}}}" + }, + { + "lang": "Python", + "source": "resp = client.msearch(\n index=\"my-index-000001\",\n searches=[\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.msearch({\n index: \"my-index-000001\",\n searches: [\n {},\n {\n query: {\n match: {\n message: \"this is a test\",\n },\n },\n },\n {\n index: \"my-index-000002\",\n },\n {\n query: {\n match_all: {},\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.msearch(\n index: \"my-index-000001\",\n body: [\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->msearch([\n \"index\" => \"my-index-000001\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"query\" => [\n \"match\" => [\n \"message\" => \"this is a test\",\n ],\n ],\n ],\n [\n \"index\" => \"my-index-000002\",\n ],\n [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{},{\"query\":{\"match\":{\"message\":\"this is a test\"}}},{\"index\":\"my-index-000002\"},{\"query\":{\"match_all\":{}}}]' \"$ELASTICSEARCH_URL/my-index-000001/_msearch\"" } ] }, @@ -30507,6 +39971,26 @@ { "lang": "Console", "source": "GET my-index-000001/_msearch\n{ }\n{\"query\" : {\"match\" : { \"message\": \"this is a test\"}}}\n{\"index\": \"my-index-000002\"}\n{\"query\" : {\"match_all\" : {}}}" + }, + { + "lang": "Python", + "source": "resp = client.msearch(\n index=\"my-index-000001\",\n searches=[\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.msearch({\n index: \"my-index-000001\",\n searches: [\n {},\n {\n query: {\n match: {\n message: \"this is a test\",\n },\n },\n },\n {\n index: \"my-index-000002\",\n },\n {\n query: {\n match_all: {},\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.msearch(\n index: \"my-index-000001\",\n body: [\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->msearch([\n \"index\" => \"my-index-000001\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"query\" => [\n \"match\" => [\n \"message\" => \"this is a test\",\n ],\n ],\n ],\n [\n \"index\" => \"my-index-000002\",\n ],\n [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{},{\"query\":{\"match\":{\"message\":\"this is a test\"}}},{\"index\":\"my-index-000002\"},{\"query\":{\"match_all\":{}}}]' \"$ELASTICSEARCH_URL/my-index-000001/_msearch\"" } ] } @@ -30552,6 +40036,26 @@ { "lang": "Console", "source": "GET my-index/_msearch/template\n{ }\n{ \"id\": \"my-search-template\", \"params\": { \"query_string\": \"hello world\", \"from\": 0, \"size\": 10 }}\n{ }\n{ \"id\": \"my-other-search-template\", \"params\": { \"query_type\": \"match_all\" }}" + }, + { + "lang": "Python", + "source": "resp = client.msearch_template(\n index=\"my-index\",\n search_templates=[\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.msearchTemplate({\n index: \"my-index\",\n search_templates: [\n {},\n {\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 0,\n size: 10,\n },\n },\n {},\n {\n id: \"my-other-search-template\",\n params: {\n query_type: \"match_all\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.msearch_template(\n index: \"my-index\",\n body: [\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->msearchTemplate([\n \"index\" => \"my-index\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 0,\n \"size\" => 10,\n ],\n ],\n new ArrayObject([]),\n [\n \"id\" => \"my-other-search-template\",\n \"params\" => [\n \"query_type\" => \"match_all\",\n ],\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{},{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":0,\"size\":10}},{},{\"id\":\"my-other-search-template\",\"params\":{\"query_type\":\"match_all\"}}]' \"$ELASTICSEARCH_URL/my-index/_msearch/template\"" } ] }, @@ -30595,6 +40099,26 @@ { "lang": "Console", "source": "GET my-index/_msearch/template\n{ }\n{ \"id\": \"my-search-template\", \"params\": { \"query_string\": \"hello world\", \"from\": 0, \"size\": 10 }}\n{ }\n{ \"id\": \"my-other-search-template\", \"params\": { \"query_type\": \"match_all\" }}" + }, + { + "lang": "Python", + "source": "resp = client.msearch_template(\n index=\"my-index\",\n search_templates=[\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.msearchTemplate({\n index: \"my-index\",\n search_templates: [\n {},\n {\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 0,\n size: 10,\n },\n },\n {},\n {\n id: \"my-other-search-template\",\n params: {\n query_type: \"match_all\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.msearch_template(\n index: \"my-index\",\n body: [\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->msearchTemplate([\n \"index\" => \"my-index\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 0,\n \"size\" => 10,\n ],\n ],\n new ArrayObject([]),\n [\n \"id\" => \"my-other-search-template\",\n \"params\" => [\n \"query_type\" => \"match_all\",\n ],\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{},{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":0,\"size\":10}},{},{\"id\":\"my-other-search-template\",\"params\":{\"query_type\":\"match_all\"}}]' \"$ELASTICSEARCH_URL/my-index/_msearch/template\"" } ] } @@ -30643,6 +40167,26 @@ { "lang": "Console", "source": "GET my-index/_msearch/template\n{ }\n{ \"id\": \"my-search-template\", \"params\": { \"query_string\": \"hello world\", \"from\": 0, \"size\": 10 }}\n{ }\n{ \"id\": \"my-other-search-template\", \"params\": { \"query_type\": \"match_all\" }}" + }, + { + "lang": "Python", + "source": "resp = client.msearch_template(\n index=\"my-index\",\n search_templates=[\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.msearchTemplate({\n index: \"my-index\",\n search_templates: [\n {},\n {\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 0,\n size: 10,\n },\n },\n {},\n {\n id: \"my-other-search-template\",\n params: {\n query_type: \"match_all\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.msearch_template(\n index: \"my-index\",\n body: [\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->msearchTemplate([\n \"index\" => \"my-index\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 0,\n \"size\" => 10,\n ],\n ],\n new ArrayObject([]),\n [\n \"id\" => \"my-other-search-template\",\n \"params\" => [\n \"query_type\" => \"match_all\",\n ],\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{},{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":0,\"size\":10}},{},{\"id\":\"my-other-search-template\",\"params\":{\"query_type\":\"match_all\"}}]' \"$ELASTICSEARCH_URL/my-index/_msearch/template\"" } ] }, @@ -30689,6 +40233,26 @@ { "lang": "Console", "source": "GET my-index/_msearch/template\n{ }\n{ \"id\": \"my-search-template\", \"params\": { \"query_string\": \"hello world\", \"from\": 0, \"size\": 10 }}\n{ }\n{ \"id\": \"my-other-search-template\", \"params\": { \"query_type\": \"match_all\" }}" + }, + { + "lang": "Python", + "source": "resp = client.msearch_template(\n index=\"my-index\",\n search_templates=[\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.msearchTemplate({\n index: \"my-index\",\n search_templates: [\n {},\n {\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 0,\n size: 10,\n },\n },\n {},\n {\n id: \"my-other-search-template\",\n params: {\n query_type: \"match_all\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.msearch_template(\n index: \"my-index\",\n body: [\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->msearchTemplate([\n \"index\" => \"my-index\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 0,\n \"size\" => 10,\n ],\n ],\n new ArrayObject([]),\n [\n \"id\" => \"my-other-search-template\",\n \"params\" => [\n \"query_type\" => \"match_all\",\n ],\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{},{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":0,\"size\":10}},{},{\"id\":\"my-other-search-template\",\"params\":{\"query_type\":\"match_all\"}}]' \"$ELASTICSEARCH_URL/my-index/_msearch/template\"" } ] } @@ -30751,6 +40315,26 @@ { "lang": "Console", "source": "POST /my-index-000001/_mtermvectors\n{\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.mtermvectors(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": True\n },\n {\n \"_id\": \"1\"\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.mtermvectors({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"2\",\n fields: [\"message\"],\n term_statistics: true,\n },\n {\n _id: \"1\",\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.mtermvectors(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->mtermvectors([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"2\",\n \"fields\" => array(\n \"message\",\n ),\n \"term_statistics\" => true,\n ],\n [\n \"_id\" => \"1\",\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":\"2\",\"fields\":[\"message\"],\"term_statistics\":true},{\"_id\":\"1\"}]}' \"$ELASTICSEARCH_URL/my-index-000001/_mtermvectors\"" } ] }, @@ -30811,6 +40395,26 @@ { "lang": "Console", "source": "POST /my-index-000001/_mtermvectors\n{\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.mtermvectors(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": True\n },\n {\n \"_id\": \"1\"\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.mtermvectors({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"2\",\n fields: [\"message\"],\n term_statistics: true,\n },\n {\n _id: \"1\",\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.mtermvectors(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->mtermvectors([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"2\",\n \"fields\" => array(\n \"message\",\n ),\n \"term_statistics\" => true,\n ],\n [\n \"_id\" => \"1\",\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":\"2\",\"fields\":[\"message\"],\"term_statistics\":true},{\"_id\":\"1\"}]}' \"$ELASTICSEARCH_URL/my-index-000001/_mtermvectors\"" } ] } @@ -30876,6 +40480,26 @@ { "lang": "Console", "source": "POST /my-index-000001/_mtermvectors\n{\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.mtermvectors(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": True\n },\n {\n \"_id\": \"1\"\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.mtermvectors({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"2\",\n fields: [\"message\"],\n term_statistics: true,\n },\n {\n _id: \"1\",\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.mtermvectors(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->mtermvectors([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"2\",\n \"fields\" => array(\n \"message\",\n ),\n \"term_statistics\" => true,\n ],\n [\n \"_id\" => \"1\",\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":\"2\",\"fields\":[\"message\"],\"term_statistics\":true},{\"_id\":\"1\"}]}' \"$ELASTICSEARCH_URL/my-index-000001/_mtermvectors\"" } ] }, @@ -30939,6 +40563,26 @@ { "lang": "Console", "source": "POST /my-index-000001/_mtermvectors\n{\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.mtermvectors(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": True\n },\n {\n \"_id\": \"1\"\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.mtermvectors({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"2\",\n fields: [\"message\"],\n term_statistics: true,\n },\n {\n _id: \"1\",\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.mtermvectors(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->mtermvectors([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"2\",\n \"fields\" => array(\n \"message\",\n ),\n \"term_statistics\" => true,\n ],\n [\n \"_id\" => \"1\",\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":\"2\",\"fields\":[\"message\"],\"term_statistics\":true},{\"_id\":\"1\"}]}' \"$ELASTICSEARCH_URL/my-index-000001/_mtermvectors\"" } ] } @@ -31066,6 +40710,26 @@ { "lang": "Console", "source": "GET /_nodes/hot_threads\n" + }, + { + "lang": "Python", + "source": "resp = client.nodes.hot_threads()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.nodes.hotThreads();" + }, + { + "lang": "Ruby", + "source": "response = client.nodes.hot_threads" + }, + { + "lang": "PHP", + "source": "$resp = $client->nodes()->hotThreads();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/hot_threads\"" } ] } @@ -31113,6 +40777,26 @@ { "lang": "Console", "source": "GET /_nodes/hot_threads\n" + }, + { + "lang": "Python", + "source": "resp = client.nodes.hot_threads()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.nodes.hotThreads();" + }, + { + "lang": "Ruby", + "source": "response = client.nodes.hot_threads" + }, + { + "lang": "PHP", + "source": "$resp = $client->nodes()->hotThreads();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/hot_threads\"" } ] } @@ -31143,6 +40827,26 @@ { "lang": "Console", "source": "GET _nodes/_all/jvm\n" + }, + { + "lang": "Python", + "source": "resp = client.nodes.info(\n node_id=\"_all\",\n metric=\"jvm\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.nodes.info({\n node_id: \"_all\",\n metric: \"jvm\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.nodes.info(\n node_id: \"_all\",\n metric: \"jvm\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->nodes()->info([\n \"node_id\" => \"_all\",\n \"metric\" => \"jvm\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/_all/jvm\"" } ] } @@ -31176,6 +40880,26 @@ { "lang": "Console", "source": "GET _nodes/_all/jvm\n" + }, + { + "lang": "Python", + "source": "resp = client.nodes.info(\n node_id=\"_all\",\n metric=\"jvm\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.nodes.info({\n node_id: \"_all\",\n metric: \"jvm\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.nodes.info(\n node_id: \"_all\",\n metric: \"jvm\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->nodes()->info([\n \"node_id\" => \"_all\",\n \"metric\" => \"jvm\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/_all/jvm\"" } ] } @@ -31209,6 +40933,26 @@ { "lang": "Console", "source": "GET _nodes/_all/jvm\n" + }, + { + "lang": "Python", + "source": "resp = client.nodes.info(\n node_id=\"_all\",\n metric=\"jvm\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.nodes.info({\n node_id: \"_all\",\n metric: \"jvm\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.nodes.info(\n node_id: \"_all\",\n metric: \"jvm\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->nodes()->info([\n \"node_id\" => \"_all\",\n \"metric\" => \"jvm\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/_all/jvm\"" } ] } @@ -31245,6 +40989,26 @@ { "lang": "Console", "source": "GET _nodes/_all/jvm\n" + }, + { + "lang": "Python", + "source": "resp = client.nodes.info(\n node_id=\"_all\",\n metric=\"jvm\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.nodes.info({\n node_id: \"_all\",\n metric: \"jvm\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.nodes.info(\n node_id: \"_all\",\n metric: \"jvm\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->nodes()->info([\n \"node_id\" => \"_all\",\n \"metric\" => \"jvm\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/_all/jvm\"" } ] } @@ -31275,6 +41039,26 @@ { "lang": "Console", "source": "POST _nodes/reload_secure_settings\n{\n \"secure_settings_password\": \"keystore-password\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.nodes.reload_secure_settings(\n secure_settings_password=\"keystore-password\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.nodes.reloadSecureSettings({\n secure_settings_password: \"keystore-password\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.nodes.reload_secure_settings(\n body: {\n \"secure_settings_password\": \"keystore-password\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->nodes()->reloadSecureSettings([\n \"body\" => [\n \"secure_settings_password\" => \"keystore-password\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"secure_settings_password\":\"keystore-password\"}' \"$ELASTICSEARCH_URL/_nodes/reload_secure_settings\"" } ] } @@ -31308,72 +41092,39 @@ { "lang": "Console", "source": "POST _nodes/reload_secure_settings\n{\n \"secure_settings_password\": \"keystore-password\"\n}" - } - ] - } - }, - "/_nodes/stats": { - "get": { - "tags": [ - "cluster" - ], - "summary": "Get node statistics", - "description": "Get statistics for nodes in a cluster.\nBy default, all stats are returned. You can limit the returned information by using metrics.\n ##Required authorization\n* Cluster privileges: `monitor`,`manage`", - "operationId": "nodes-stats", - "parameters": [ - { - "$ref": "#/components/parameters/nodes.stats-completion_fields" - }, - { - "$ref": "#/components/parameters/nodes.stats-fielddata_fields" - }, - { - "$ref": "#/components/parameters/nodes.stats-fields" }, { - "$ref": "#/components/parameters/nodes.stats-groups" - }, - { - "$ref": "#/components/parameters/nodes.stats-include_segment_file_sizes" + "lang": "Python", + "source": "resp = client.nodes.reload_secure_settings(\n secure_settings_password=\"keystore-password\",\n)" }, { - "$ref": "#/components/parameters/nodes.stats-level" + "lang": "JavaScript", + "source": "const response = await client.nodes.reloadSecureSettings({\n secure_settings_password: \"keystore-password\",\n});" }, { - "$ref": "#/components/parameters/nodes.stats-timeout" + "lang": "Ruby", + "source": "response = client.nodes.reload_secure_settings(\n body: {\n \"secure_settings_password\": \"keystore-password\"\n }\n)" }, { - "$ref": "#/components/parameters/nodes.stats-types" + "lang": "PHP", + "source": "$resp = $client->nodes()->reloadSecureSettings([\n \"body\" => [\n \"secure_settings_password\" => \"keystore-password\",\n ],\n]);" }, { - "$ref": "#/components/parameters/nodes.stats-include_unloaded_segments" - } - ], - "responses": { - "200": { - "$ref": "#/components/responses/nodes.stats-200" - } - }, - "x-codeSamples": [ - { - "lang": "Console", - "source": "GET _nodes/stats/process?filter_path=**.max_file_descriptors\n" + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"secure_settings_password\":\"keystore-password\"}' \"$ELASTICSEARCH_URL/_nodes/reload_secure_settings\"" } ] } }, - "/_nodes/{node_id}/stats": { + "/_nodes/stats": { "get": { "tags": [ "cluster" ], "summary": "Get node statistics", "description": "Get statistics for nodes in a cluster.\nBy default, all stats are returned. You can limit the returned information by using metrics.\n ##Required authorization\n* Cluster privileges: `monitor`,`manage`", - "operationId": "nodes-stats-1", + "operationId": "nodes-stats", "parameters": [ - { - "$ref": "#/components/parameters/nodes.stats-node_id" - }, { "$ref": "#/components/parameters/nodes.stats-completion_fields" }, @@ -31411,78 +41162,42 @@ { "lang": "Console", "source": "GET _nodes/stats/process?filter_path=**.max_file_descriptors\n" - } - ] - } - }, - "/_nodes/stats/{metric}": { - "get": { - "tags": [ - "cluster" - ], - "summary": "Get node statistics", - "description": "Get statistics for nodes in a cluster.\nBy default, all stats are returned. You can limit the returned information by using metrics.\n ##Required authorization\n* Cluster privileges: `monitor`,`manage`", - "operationId": "nodes-stats-2", - "parameters": [ - { - "$ref": "#/components/parameters/nodes.stats-metric" - }, - { - "$ref": "#/components/parameters/nodes.stats-completion_fields" }, { - "$ref": "#/components/parameters/nodes.stats-fielddata_fields" - }, - { - "$ref": "#/components/parameters/nodes.stats-fields" - }, - { - "$ref": "#/components/parameters/nodes.stats-groups" - }, - { - "$ref": "#/components/parameters/nodes.stats-include_segment_file_sizes" + "lang": "Python", + "source": "resp = client.nodes.stats(\n metric=\"process\",\n filter_path=\"**.max_file_descriptors\",\n)" }, { - "$ref": "#/components/parameters/nodes.stats-level" + "lang": "JavaScript", + "source": "const response = await client.nodes.stats({\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\",\n});" }, { - "$ref": "#/components/parameters/nodes.stats-timeout" + "lang": "Ruby", + "source": "response = client.nodes.stats(\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\"\n)" }, { - "$ref": "#/components/parameters/nodes.stats-types" + "lang": "PHP", + "source": "$resp = $client->nodes()->stats([\n \"metric\" => \"process\",\n \"filter_path\" => \"**.max_file_descriptors\",\n]);" }, { - "$ref": "#/components/parameters/nodes.stats-include_unloaded_segments" - } - ], - "responses": { - "200": { - "$ref": "#/components/responses/nodes.stats-200" - } - }, - "x-codeSamples": [ - { - "lang": "Console", - "source": "GET _nodes/stats/process?filter_path=**.max_file_descriptors\n" + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/stats/process?filter_path=**.max_file_descriptors\"" } ] } }, - "/_nodes/{node_id}/stats/{metric}": { + "/_nodes/{node_id}/stats": { "get": { "tags": [ "cluster" ], "summary": "Get node statistics", "description": "Get statistics for nodes in a cluster.\nBy default, all stats are returned. You can limit the returned information by using metrics.\n ##Required authorization\n* Cluster privileges: `monitor`,`manage`", - "operationId": "nodes-stats-3", + "operationId": "nodes-stats-1", "parameters": [ { "$ref": "#/components/parameters/nodes.stats-node_id" }, - { - "$ref": "#/components/parameters/nodes.stats-metric" - }, { "$ref": "#/components/parameters/nodes.stats-completion_fields" }, @@ -31520,6 +41235,175 @@ { "lang": "Console", "source": "GET _nodes/stats/process?filter_path=**.max_file_descriptors\n" + }, + { + "lang": "Python", + "source": "resp = client.nodes.stats(\n metric=\"process\",\n filter_path=\"**.max_file_descriptors\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.nodes.stats({\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.nodes.stats(\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->nodes()->stats([\n \"metric\" => \"process\",\n \"filter_path\" => \"**.max_file_descriptors\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/stats/process?filter_path=**.max_file_descriptors\"" + } + ] + } + }, + "/_nodes/stats/{metric}": { + "get": { + "tags": [ + "cluster" + ], + "summary": "Get node statistics", + "description": "Get statistics for nodes in a cluster.\nBy default, all stats are returned. You can limit the returned information by using metrics.\n ##Required authorization\n* Cluster privileges: `monitor`,`manage`", + "operationId": "nodes-stats-2", + "parameters": [ + { + "$ref": "#/components/parameters/nodes.stats-metric" + }, + { + "$ref": "#/components/parameters/nodes.stats-completion_fields" + }, + { + "$ref": "#/components/parameters/nodes.stats-fielddata_fields" + }, + { + "$ref": "#/components/parameters/nodes.stats-fields" + }, + { + "$ref": "#/components/parameters/nodes.stats-groups" + }, + { + "$ref": "#/components/parameters/nodes.stats-include_segment_file_sizes" + }, + { + "$ref": "#/components/parameters/nodes.stats-level" + }, + { + "$ref": "#/components/parameters/nodes.stats-timeout" + }, + { + "$ref": "#/components/parameters/nodes.stats-types" + }, + { + "$ref": "#/components/parameters/nodes.stats-include_unloaded_segments" + } + ], + "responses": { + "200": { + "$ref": "#/components/responses/nodes.stats-200" + } + }, + "x-codeSamples": [ + { + "lang": "Console", + "source": "GET _nodes/stats/process?filter_path=**.max_file_descriptors\n" + }, + { + "lang": "Python", + "source": "resp = client.nodes.stats(\n metric=\"process\",\n filter_path=\"**.max_file_descriptors\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.nodes.stats({\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.nodes.stats(\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->nodes()->stats([\n \"metric\" => \"process\",\n \"filter_path\" => \"**.max_file_descriptors\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/stats/process?filter_path=**.max_file_descriptors\"" + } + ] + } + }, + "/_nodes/{node_id}/stats/{metric}": { + "get": { + "tags": [ + "cluster" + ], + "summary": "Get node statistics", + "description": "Get statistics for nodes in a cluster.\nBy default, all stats are returned. You can limit the returned information by using metrics.\n ##Required authorization\n* Cluster privileges: `monitor`,`manage`", + "operationId": "nodes-stats-3", + "parameters": [ + { + "$ref": "#/components/parameters/nodes.stats-node_id" + }, + { + "$ref": "#/components/parameters/nodes.stats-metric" + }, + { + "$ref": "#/components/parameters/nodes.stats-completion_fields" + }, + { + "$ref": "#/components/parameters/nodes.stats-fielddata_fields" + }, + { + "$ref": "#/components/parameters/nodes.stats-fields" + }, + { + "$ref": "#/components/parameters/nodes.stats-groups" + }, + { + "$ref": "#/components/parameters/nodes.stats-include_segment_file_sizes" + }, + { + "$ref": "#/components/parameters/nodes.stats-level" + }, + { + "$ref": "#/components/parameters/nodes.stats-timeout" + }, + { + "$ref": "#/components/parameters/nodes.stats-types" + }, + { + "$ref": "#/components/parameters/nodes.stats-include_unloaded_segments" + } + ], + "responses": { + "200": { + "$ref": "#/components/responses/nodes.stats-200" + } + }, + "x-codeSamples": [ + { + "lang": "Console", + "source": "GET _nodes/stats/process?filter_path=**.max_file_descriptors\n" + }, + { + "lang": "Python", + "source": "resp = client.nodes.stats(\n metric=\"process\",\n filter_path=\"**.max_file_descriptors\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.nodes.stats({\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.nodes.stats(\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->nodes()->stats([\n \"metric\" => \"process\",\n \"filter_path\" => \"**.max_file_descriptors\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/stats/process?filter_path=**.max_file_descriptors\"" } ] } @@ -31576,6 +41460,26 @@ { "lang": "Console", "source": "GET _nodes/stats/process?filter_path=**.max_file_descriptors\n" + }, + { + "lang": "Python", + "source": "resp = client.nodes.stats(\n metric=\"process\",\n filter_path=\"**.max_file_descriptors\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.nodes.stats({\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.nodes.stats(\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->nodes()->stats([\n \"metric\" => \"process\",\n \"filter_path\" => \"**.max_file_descriptors\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/stats/process?filter_path=**.max_file_descriptors\"" } ] } @@ -31635,6 +41539,26 @@ { "lang": "Console", "source": "GET _nodes/stats/process?filter_path=**.max_file_descriptors\n" + }, + { + "lang": "Python", + "source": "resp = client.nodes.stats(\n metric=\"process\",\n filter_path=\"**.max_file_descriptors\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.nodes.stats({\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.nodes.stats(\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->nodes()->stats([\n \"metric\" => \"process\",\n \"filter_path\" => \"**.max_file_descriptors\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/stats/process?filter_path=**.max_file_descriptors\"" } ] } @@ -31662,6 +41586,26 @@ { "lang": "Console", "source": "GET _nodes/usage\n" + }, + { + "lang": "Python", + "source": "resp = client.nodes.usage()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.nodes.usage();" + }, + { + "lang": "Ruby", + "source": "response = client.nodes.usage" + }, + { + "lang": "PHP", + "source": "$resp = $client->nodes()->usage();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/usage\"" } ] } @@ -31692,6 +41636,26 @@ { "lang": "Console", "source": "GET _nodes/usage\n" + }, + { + "lang": "Python", + "source": "resp = client.nodes.usage()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.nodes.usage();" + }, + { + "lang": "Ruby", + "source": "response = client.nodes.usage" + }, + { + "lang": "PHP", + "source": "$resp = $client->nodes()->usage();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/usage\"" } ] } @@ -31722,6 +41686,26 @@ { "lang": "Console", "source": "GET _nodes/usage\n" + }, + { + "lang": "Python", + "source": "resp = client.nodes.usage()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.nodes.usage();" + }, + { + "lang": "Ruby", + "source": "response = client.nodes.usage" + }, + { + "lang": "PHP", + "source": "$resp = $client->nodes()->usage();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/usage\"" } ] } @@ -31755,6 +41739,26 @@ { "lang": "Console", "source": "GET _nodes/usage\n" + }, + { + "lang": "Python", + "source": "resp = client.nodes.usage()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.nodes.usage();" + }, + { + "lang": "Ruby", + "source": "response = client.nodes.usage" + }, + { + "lang": "PHP", + "source": "$resp = $client->nodes()->usage();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/usage\"" } ] } @@ -31900,6 +41904,26 @@ { "lang": "Console", "source": "POST /my-index-000001/_pit?keep_alive=1m&allow_partial_search_results=true\n" + }, + { + "lang": "Python", + "source": "resp = client.open_point_in_time(\n index=\"my-index-000001\",\n keep_alive=\"1m\",\n allow_partial_search_results=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.openPointInTime({\n index: \"my-index-000001\",\n keep_alive: \"1m\",\n allow_partial_search_results: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.open_point_in_time(\n index: \"my-index-000001\",\n keep_alive: \"1m\",\n allow_partial_search_results: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->openPointInTime([\n \"index\" => \"my-index-000001\",\n \"keep_alive\" => \"1m\",\n \"allow_partial_search_results\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_pit?keep_alive=1m&allow_partial_search_results=true\"" } ] } @@ -31944,6 +41968,26 @@ { "lang": "Console", "source": "PUT _scripts/my-search-template\n{\n \"script\": {\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.put_script(\n id=\"my-search-template\",\n script={\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.putScript({\n id: \"my-search-template\",\n script: {\n lang: \"mustache\",\n source: {\n query: {\n match: {\n message: \"{{query_string}}\",\n },\n },\n from: \"{{from}}\",\n size: \"{{size}}\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.put_script(\n id: \"my-search-template\",\n body: {\n \"script\": {\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->putScript([\n \"id\" => \"my-search-template\",\n \"body\" => [\n \"script\" => [\n \"lang\" => \"mustache\",\n \"source\" => [\n \"query\" => [\n \"match\" => [\n \"message\" => \"{{query_string}}\",\n ],\n ],\n \"from\" => \"{{from}}\",\n \"size\" => \"{{size}}\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"lang\":\"mustache\",\"source\":{\"query\":{\"match\":{\"message\":\"{{query_string}}\"}},\"from\":\"{{from}}\",\"size\":\"{{size}}\"}}}' \"$ELASTICSEARCH_URL/_scripts/my-search-template\"" } ] }, @@ -31986,6 +42030,26 @@ { "lang": "Console", "source": "PUT _scripts/my-search-template\n{\n \"script\": {\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.put_script(\n id=\"my-search-template\",\n script={\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.putScript({\n id: \"my-search-template\",\n script: {\n lang: \"mustache\",\n source: {\n query: {\n match: {\n message: \"{{query_string}}\",\n },\n },\n from: \"{{from}}\",\n size: \"{{size}}\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.put_script(\n id: \"my-search-template\",\n body: {\n \"script\": {\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->putScript([\n \"id\" => \"my-search-template\",\n \"body\" => [\n \"script\" => [\n \"lang\" => \"mustache\",\n \"source\" => [\n \"query\" => [\n \"match\" => [\n \"message\" => \"{{query_string}}\",\n ],\n ],\n \"from\" => \"{{from}}\",\n \"size\" => \"{{size}}\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"lang\":\"mustache\",\"source\":{\"query\":{\"match\":{\"message\":\"{{query_string}}\"}},\"from\":\"{{from}}\",\"size\":\"{{size}}\"}}}' \"$ELASTICSEARCH_URL/_scripts/my-search-template\"" } ] } @@ -32048,6 +42112,26 @@ { "lang": "Console", "source": "GET _query_rules/my-ruleset/_rule/my-rule1\n" + }, + { + "lang": "Python", + "source": "resp = client.query_rules.get_rule(\n ruleset_id=\"my-ruleset\",\n rule_id=\"my-rule1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.queryRules.getRule({\n ruleset_id: \"my-ruleset\",\n rule_id: \"my-rule1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.query_rules.get_rule(\n ruleset_id: \"my-ruleset\",\n rule_id: \"my-rule1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->queryRules()->getRule([\n \"ruleset_id\" => \"my-ruleset\",\n \"rule_id\" => \"my-rule1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/my-ruleset/_rule/my-rule1\"" } ] }, @@ -32153,6 +42237,26 @@ { "lang": "Console", "source": "POST _query_rules/my-ruleset/_test\n{\n \"match_criteria\": {\n \"query_string\": \"puggles\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.query_rules.test(\n ruleset_id=\"my-ruleset\",\n match_criteria={\n \"query_string\": \"puggles\"\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.queryRules.test({\n ruleset_id: \"my-ruleset\",\n match_criteria: {\n query_string: \"puggles\",\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.query_rules.test(\n ruleset_id: \"my-ruleset\",\n body: {\n \"match_criteria\": {\n \"query_string\": \"puggles\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->queryRules()->test([\n \"ruleset_id\" => \"my-ruleset\",\n \"body\" => [\n \"match_criteria\" => [\n \"query_string\" => \"puggles\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"match_criteria\":{\"query_string\":\"puggles\"}}' \"$ELASTICSEARCH_URL/_query_rules/my-ruleset/_test\"" } ] }, @@ -32204,6 +42308,26 @@ { "lang": "Console", "source": "DELETE _query_rules/my-ruleset/_rule/my-rule1\n" + }, + { + "lang": "Python", + "source": "resp = client.query_rules.delete_rule(\n ruleset_id=\"my-ruleset\",\n rule_id=\"my-rule1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.queryRules.deleteRule({\n ruleset_id: \"my-ruleset\",\n rule_id: \"my-rule1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.query_rules.delete_rule(\n ruleset_id: \"my-ruleset\",\n rule_id: \"my-rule1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->queryRules()->deleteRule([\n \"ruleset_id\" => \"my-ruleset\",\n \"rule_id\" => \"my-rule1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/my-ruleset/_rule/my-rule1\"" } ] } @@ -32252,6 +42376,26 @@ { "lang": "Console", "source": "GET _query_rules/my-ruleset/\n" + }, + { + "lang": "Python", + "source": "resp = client.query_rules.get_ruleset(\n ruleset_id=\"my-ruleset\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.queryRules.getRuleset({\n ruleset_id: \"my-ruleset\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.query_rules.get_ruleset(\n ruleset_id: \"my-ruleset\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->queryRules()->getRuleset([\n \"ruleset_id\" => \"my-ruleset\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/my-ruleset/\"" } ] }, @@ -32337,6 +42481,26 @@ { "lang": "Console", "source": "PUT _query_rules/my-ruleset\n{\n \"rules\": [\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [ \"pugs\", \"puggles\" ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [ \"us\" ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [ \"rescue dogs\" ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.query_rules.put_ruleset(\n ruleset_id=\"my-ruleset\",\n rules=[\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"pugs\",\n \"puggles\"\n ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [\n \"us\"\n ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"rescue dogs\"\n ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.queryRules.putRuleset({\n ruleset_id: \"my-ruleset\",\n rules: [\n {\n rule_id: \"my-rule1\",\n type: \"pinned\",\n criteria: [\n {\n type: \"contains\",\n metadata: \"user_query\",\n values: [\"pugs\", \"puggles\"],\n },\n {\n type: \"exact\",\n metadata: \"user_country\",\n values: [\"us\"],\n },\n ],\n actions: {\n ids: [\"id1\", \"id2\"],\n },\n },\n {\n rule_id: \"my-rule2\",\n type: \"pinned\",\n criteria: [\n {\n type: \"fuzzy\",\n metadata: \"user_query\",\n values: [\"rescue dogs\"],\n },\n ],\n actions: {\n docs: [\n {\n _index: \"index1\",\n _id: \"id3\",\n },\n {\n _index: \"index2\",\n _id: \"id4\",\n },\n ],\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.query_rules.put_ruleset(\n ruleset_id: \"my-ruleset\",\n body: {\n \"rules\": [\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"pugs\",\n \"puggles\"\n ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [\n \"us\"\n ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"rescue dogs\"\n ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->queryRules()->putRuleset([\n \"ruleset_id\" => \"my-ruleset\",\n \"body\" => [\n \"rules\" => array(\n [\n \"rule_id\" => \"my-rule1\",\n \"type\" => \"pinned\",\n \"criteria\" => array(\n [\n \"type\" => \"contains\",\n \"metadata\" => \"user_query\",\n \"values\" => array(\n \"pugs\",\n \"puggles\",\n ),\n ],\n [\n \"type\" => \"exact\",\n \"metadata\" => \"user_country\",\n \"values\" => array(\n \"us\",\n ),\n ],\n ),\n \"actions\" => [\n \"ids\" => array(\n \"id1\",\n \"id2\",\n ),\n ],\n ],\n [\n \"rule_id\" => \"my-rule2\",\n \"type\" => \"pinned\",\n \"criteria\" => array(\n [\n \"type\" => \"fuzzy\",\n \"metadata\" => \"user_query\",\n \"values\" => array(\n \"rescue dogs\",\n ),\n ],\n ),\n \"actions\" => [\n \"docs\" => array(\n [\n \"_index\" => \"index1\",\n \"_id\" => \"id3\",\n ],\n [\n \"_index\" => \"index2\",\n \"_id\" => \"id4\",\n ],\n ),\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"rules\":[{\"rule_id\":\"my-rule1\",\"type\":\"pinned\",\"criteria\":[{\"type\":\"contains\",\"metadata\":\"user_query\",\"values\":[\"pugs\",\"puggles\"]},{\"type\":\"exact\",\"metadata\":\"user_country\",\"values\":[\"us\"]}],\"actions\":{\"ids\":[\"id1\",\"id2\"]}},{\"rule_id\":\"my-rule2\",\"type\":\"pinned\",\"criteria\":[{\"type\":\"fuzzy\",\"metadata\":\"user_query\",\"values\":[\"rescue dogs\"]}],\"actions\":{\"docs\":[{\"_index\":\"index1\",\"_id\":\"id3\"},{\"_index\":\"index2\",\"_id\":\"id4\"}]}}]}' \"$ELASTICSEARCH_URL/_query_rules/my-ruleset\"" } ] }, @@ -32377,6 +42541,26 @@ { "lang": "Console", "source": "DELETE _query_rules/my-ruleset/\n" + }, + { + "lang": "Python", + "source": "resp = client.query_rules.delete_ruleset(\n ruleset_id=\"my-ruleset\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.queryRules.deleteRuleset({\n ruleset_id: \"my-ruleset\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.query_rules.delete_ruleset(\n ruleset_id: \"my-ruleset\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->queryRules()->deleteRuleset([\n \"ruleset_id\" => \"my-ruleset\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/my-ruleset/\"" } ] } @@ -32449,6 +42633,26 @@ { "lang": "Console", "source": "GET _query_rules/?from=0&size=3\n" + }, + { + "lang": "Python", + "source": "resp = client.query_rules.list_rulesets(\n from=\"0\",\n size=\"3\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.queryRules.listRulesets({\n from: 0,\n size: 3,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.query_rules.list_rulesets(\n from: \"0\",\n size: \"3\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->queryRules()->listRulesets([\n \"from\" => \"0\",\n \"size\" => \"3\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/?from=0&size=3\"" } ] } @@ -32540,6 +42744,26 @@ { "lang": "Console", "source": "PUT _query_rules/my-ruleset\n{\n \"rules\": [\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [ \"pugs\", \"puggles\" ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [ \"us\" ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [ \"rescue dogs\" ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.query_rules.put_ruleset(\n ruleset_id=\"my-ruleset\",\n rules=[\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"pugs\",\n \"puggles\"\n ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [\n \"us\"\n ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"rescue dogs\"\n ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.queryRules.putRuleset({\n ruleset_id: \"my-ruleset\",\n rules: [\n {\n rule_id: \"my-rule1\",\n type: \"pinned\",\n criteria: [\n {\n type: \"contains\",\n metadata: \"user_query\",\n values: [\"pugs\", \"puggles\"],\n },\n {\n type: \"exact\",\n metadata: \"user_country\",\n values: [\"us\"],\n },\n ],\n actions: {\n ids: [\"id1\", \"id2\"],\n },\n },\n {\n rule_id: \"my-rule2\",\n type: \"pinned\",\n criteria: [\n {\n type: \"fuzzy\",\n metadata: \"user_query\",\n values: [\"rescue dogs\"],\n },\n ],\n actions: {\n docs: [\n {\n _index: \"index1\",\n _id: \"id3\",\n },\n {\n _index: \"index2\",\n _id: \"id4\",\n },\n ],\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.query_rules.put_ruleset(\n ruleset_id: \"my-ruleset\",\n body: {\n \"rules\": [\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"pugs\",\n \"puggles\"\n ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [\n \"us\"\n ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"rescue dogs\"\n ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->queryRules()->putRuleset([\n \"ruleset_id\" => \"my-ruleset\",\n \"body\" => [\n \"rules\" => array(\n [\n \"rule_id\" => \"my-rule1\",\n \"type\" => \"pinned\",\n \"criteria\" => array(\n [\n \"type\" => \"contains\",\n \"metadata\" => \"user_query\",\n \"values\" => array(\n \"pugs\",\n \"puggles\",\n ),\n ],\n [\n \"type\" => \"exact\",\n \"metadata\" => \"user_country\",\n \"values\" => array(\n \"us\",\n ),\n ],\n ),\n \"actions\" => [\n \"ids\" => array(\n \"id1\",\n \"id2\",\n ),\n ],\n ],\n [\n \"rule_id\" => \"my-rule2\",\n \"type\" => \"pinned\",\n \"criteria\" => array(\n [\n \"type\" => \"fuzzy\",\n \"metadata\" => \"user_query\",\n \"values\" => array(\n \"rescue dogs\",\n ),\n ],\n ),\n \"actions\" => [\n \"docs\" => array(\n [\n \"_index\" => \"index1\",\n \"_id\" => \"id3\",\n ],\n [\n \"_index\" => \"index2\",\n \"_id\" => \"id4\",\n ],\n ),\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"rules\":[{\"rule_id\":\"my-rule1\",\"type\":\"pinned\",\"criteria\":[{\"type\":\"contains\",\"metadata\":\"user_query\",\"values\":[\"pugs\",\"puggles\"]},{\"type\":\"exact\",\"metadata\":\"user_country\",\"values\":[\"us\"]}],\"actions\":{\"ids\":[\"id1\",\"id2\"]}},{\"rule_id\":\"my-rule2\",\"type\":\"pinned\",\"criteria\":[{\"type\":\"fuzzy\",\"metadata\":\"user_query\",\"values\":[\"rescue dogs\"]}],\"actions\":{\"docs\":[{\"_index\":\"index1\",\"_id\":\"id3\"},{\"_index\":\"index2\",\"_id\":\"id4\"}]}}]}' \"$ELASTICSEARCH_URL/_query_rules/my-ruleset\"" } ] } @@ -32579,6 +42803,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_rank_eval\n{\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": { \"query\": { \"match_all\": {} } },\n \"ratings\": []\n } ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.rank_eval(\n index=\"my-index-000001\",\n requests=[\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n metric={\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": False\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.rankEval({\n index: \"my-index-000001\",\n requests: [\n {\n id: \"JFK query\",\n request: {\n query: {\n match_all: {},\n },\n },\n ratings: [],\n },\n ],\n metric: {\n precision: {\n k: 20,\n relevant_rating_threshold: 1,\n ignore_unlabeled: false,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.rank_eval(\n index: \"my-index-000001\",\n body: {\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->rankEval([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"requests\" => array(\n [\n \"id\" => \"JFK query\",\n \"request\" => [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n \"ratings\" => array(\n ),\n ],\n ),\n \"metric\" => [\n \"precision\" => [\n \"k\" => 20,\n \"relevant_rating_threshold\" => 1,\n \"ignore_unlabeled\" => false,\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"requests\":[{\"id\":\"JFK query\",\"request\":{\"query\":{\"match_all\":{}}},\"ratings\":[]}],\"metric\":{\"precision\":{\"k\":20,\"relevant_rating_threshold\":1,\"ignore_unlabeled\":false}}}' \"$ELASTICSEARCH_URL/my-index-000001/_rank_eval\"" } ] }, @@ -32616,6 +42860,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_rank_eval\n{\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": { \"query\": { \"match_all\": {} } },\n \"ratings\": []\n } ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.rank_eval(\n index=\"my-index-000001\",\n requests=[\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n metric={\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": False\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.rankEval({\n index: \"my-index-000001\",\n requests: [\n {\n id: \"JFK query\",\n request: {\n query: {\n match_all: {},\n },\n },\n ratings: [],\n },\n ],\n metric: {\n precision: {\n k: 20,\n relevant_rating_threshold: 1,\n ignore_unlabeled: false,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.rank_eval(\n index: \"my-index-000001\",\n body: {\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->rankEval([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"requests\" => array(\n [\n \"id\" => \"JFK query\",\n \"request\" => [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n \"ratings\" => array(\n ),\n ],\n ),\n \"metric\" => [\n \"precision\" => [\n \"k\" => 20,\n \"relevant_rating_threshold\" => 1,\n \"ignore_unlabeled\" => false,\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"requests\":[{\"id\":\"JFK query\",\"request\":{\"query\":{\"match_all\":{}}},\"ratings\":[]}],\"metric\":{\"precision\":{\"k\":20,\"relevant_rating_threshold\":1,\"ignore_unlabeled\":false}}}' \"$ELASTICSEARCH_URL/my-index-000001/_rank_eval\"" } ] } @@ -32658,6 +42922,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_rank_eval\n{\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": { \"query\": { \"match_all\": {} } },\n \"ratings\": []\n } ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.rank_eval(\n index=\"my-index-000001\",\n requests=[\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n metric={\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": False\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.rankEval({\n index: \"my-index-000001\",\n requests: [\n {\n id: \"JFK query\",\n request: {\n query: {\n match_all: {},\n },\n },\n ratings: [],\n },\n ],\n metric: {\n precision: {\n k: 20,\n relevant_rating_threshold: 1,\n ignore_unlabeled: false,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.rank_eval(\n index: \"my-index-000001\",\n body: {\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->rankEval([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"requests\" => array(\n [\n \"id\" => \"JFK query\",\n \"request\" => [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n \"ratings\" => array(\n ),\n ],\n ),\n \"metric\" => [\n \"precision\" => [\n \"k\" => 20,\n \"relevant_rating_threshold\" => 1,\n \"ignore_unlabeled\" => false,\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"requests\":[{\"id\":\"JFK query\",\"request\":{\"query\":{\"match_all\":{}}},\"ratings\":[]}],\"metric\":{\"precision\":{\"k\":20,\"relevant_rating_threshold\":1,\"ignore_unlabeled\":false}}}' \"$ELASTICSEARCH_URL/my-index-000001/_rank_eval\"" } ] }, @@ -32698,6 +42982,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_rank_eval\n{\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": { \"query\": { \"match_all\": {} } },\n \"ratings\": []\n } ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.rank_eval(\n index=\"my-index-000001\",\n requests=[\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n metric={\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": False\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.rankEval({\n index: \"my-index-000001\",\n requests: [\n {\n id: \"JFK query\",\n request: {\n query: {\n match_all: {},\n },\n },\n ratings: [],\n },\n ],\n metric: {\n precision: {\n k: 20,\n relevant_rating_threshold: 1,\n ignore_unlabeled: false,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.rank_eval(\n index: \"my-index-000001\",\n body: {\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->rankEval([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"requests\" => array(\n [\n \"id\" => \"JFK query\",\n \"request\" => [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n \"ratings\" => array(\n ),\n ],\n ),\n \"metric\" => [\n \"precision\" => [\n \"k\" => 20,\n \"relevant_rating_threshold\" => 1,\n \"ignore_unlabeled\" => false,\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"requests\":[{\"id\":\"JFK query\",\"request\":{\"query\":{\"match_all\":{}}},\"ratings\":[]}],\"metric\":{\"precision\":{\"k\":20,\"relevant_rating_threshold\":1,\"ignore_unlabeled\":false}}}' \"$ELASTICSEARCH_URL/my-index-000001/_rank_eval\"" } ] } @@ -32974,6 +43278,26 @@ { "lang": "Console", "source": "POST _reindex\n{\n \"source\": {\n \"index\": [\"my-index-000001\", \"my-index-000002\"]\n },\n \"dest\": {\n \"index\": \"my-new-index-000002\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.reindex(\n source={\n \"index\": [\n \"my-index-000001\",\n \"my-index-000002\"\n ]\n },\n dest={\n \"index\": \"my-new-index-000002\"\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.reindex({\n source: {\n index: [\"my-index-000001\", \"my-index-000002\"],\n },\n dest: {\n index: \"my-new-index-000002\",\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.reindex(\n body: {\n \"source\": {\n \"index\": [\n \"my-index-000001\",\n \"my-index-000002\"\n ]\n },\n \"dest\": {\n \"index\": \"my-new-index-000002\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->reindex([\n \"body\" => [\n \"source\" => [\n \"index\" => array(\n \"my-index-000001\",\n \"my-index-000002\",\n ),\n ],\n \"dest\" => [\n \"index\" => \"my-new-index-000002\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":[\"my-index-000001\",\"my-index-000002\"]},\"dest\":{\"index\":\"my-new-index-000002\"}}' \"$ELASTICSEARCH_URL/_reindex\"" } ] } @@ -33037,6 +43361,26 @@ { "lang": "Console", "source": "POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1\n" + }, + { + "lang": "Python", + "source": "resp = client.reindex_rethrottle(\n task_id=\"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second=\"-1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.reindexRethrottle({\n task_id: \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second: \"-1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.reindex_rethrottle(\n task_id: \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second: \"-1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->reindexRethrottle([\n \"task_id\" => \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n \"requests_per_second\" => \"-1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1\"" } ] } @@ -33061,6 +43405,26 @@ { "lang": "Console", "source": "POST _render/template\n{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.render_search_template(\n id=\"my-search-template\",\n params={\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.renderSearchTemplate({\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 20,\n size: 10,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.render_search_template(\n body: {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->renderSearchTemplate([\n \"body\" => [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 20,\n \"size\" => 10,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":20,\"size\":10}}' \"$ELASTICSEARCH_URL/_render/template\"" } ] }, @@ -33083,6 +43447,26 @@ { "lang": "Console", "source": "POST _render/template\n{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.render_search_template(\n id=\"my-search-template\",\n params={\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.renderSearchTemplate({\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 20,\n size: 10,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.render_search_template(\n body: {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->renderSearchTemplate([\n \"body\" => [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 20,\n \"size\" => 10,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":20,\"size\":10}}' \"$ELASTICSEARCH_URL/_render/template\"" } ] } @@ -33112,6 +43496,26 @@ { "lang": "Console", "source": "POST _render/template\n{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.render_search_template(\n id=\"my-search-template\",\n params={\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.renderSearchTemplate({\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 20,\n size: 10,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.render_search_template(\n body: {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->renderSearchTemplate([\n \"body\" => [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 20,\n \"size\" => 10,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":20,\"size\":10}}' \"$ELASTICSEARCH_URL/_render/template\"" } ] }, @@ -33139,6 +43543,26 @@ { "lang": "Console", "source": "POST _render/template\n{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.render_search_template(\n id=\"my-search-template\",\n params={\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.renderSearchTemplate({\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 20,\n size: 10,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.render_search_template(\n body: {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->renderSearchTemplate([\n \"body\" => [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 20,\n \"size\" => 10,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":20,\"size\":10}}' \"$ELASTICSEARCH_URL/_render/template\"" } ] } @@ -33167,6 +43591,26 @@ { "lang": "Console", "source": "GET _rollup/job/sensor\n" + }, + { + "lang": "Python", + "source": "resp = client.rollup.get_jobs(\n id=\"sensor\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.rollup.getJobs({\n id: \"sensor\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.rollup.get_jobs(\n id: \"sensor\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->rollup()->getJobs([\n \"id\" => \"sensor\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_rollup/job/sensor\"" } ] }, @@ -33269,6 +43713,26 @@ { "lang": "Console", "source": "PUT _rollup/job/sensor\n{\n \"index_pattern\": \"sensor-*\",\n \"rollup_index\": \"sensor_rollup\",\n \"cron\": \"*/30 * * * * ?\",\n \"page_size\": 1000,\n \"groups\": {\n \"date_histogram\": {\n \"field\": \"timestamp\",\n \"fixed_interval\": \"1h\",\n \"delay\": \"7d\"\n },\n \"terms\": {\n \"fields\": [ \"node\" ]\n }\n },\n \"metrics\": [\n {\n \"field\": \"temperature\",\n \"metrics\": [ \"min\", \"max\", \"sum\" ]\n },\n {\n \"field\": \"voltage\",\n \"metrics\": [ \"avg\" ]\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.rollup.put_job(\n id=\"sensor\",\n index_pattern=\"sensor-*\",\n rollup_index=\"sensor_rollup\",\n cron=\"*/30 * * * * ?\",\n page_size=1000,\n groups={\n \"date_histogram\": {\n \"field\": \"timestamp\",\n \"fixed_interval\": \"1h\",\n \"delay\": \"7d\"\n },\n \"terms\": {\n \"fields\": [\n \"node\"\n ]\n }\n },\n metrics=[\n {\n \"field\": \"temperature\",\n \"metrics\": [\n \"min\",\n \"max\",\n \"sum\"\n ]\n },\n {\n \"field\": \"voltage\",\n \"metrics\": [\n \"avg\"\n ]\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.rollup.putJob({\n id: \"sensor\",\n index_pattern: \"sensor-*\",\n rollup_index: \"sensor_rollup\",\n cron: \"*/30 * * * * ?\",\n page_size: 1000,\n groups: {\n date_histogram: {\n field: \"timestamp\",\n fixed_interval: \"1h\",\n delay: \"7d\",\n },\n terms: {\n fields: [\"node\"],\n },\n },\n metrics: [\n {\n field: \"temperature\",\n metrics: [\"min\", \"max\", \"sum\"],\n },\n {\n field: \"voltage\",\n metrics: [\"avg\"],\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.rollup.put_job(\n id: \"sensor\",\n body: {\n \"index_pattern\": \"sensor-*\",\n \"rollup_index\": \"sensor_rollup\",\n \"cron\": \"*/30 * * * * ?\",\n \"page_size\": 1000,\n \"groups\": {\n \"date_histogram\": {\n \"field\": \"timestamp\",\n \"fixed_interval\": \"1h\",\n \"delay\": \"7d\"\n },\n \"terms\": {\n \"fields\": [\n \"node\"\n ]\n }\n },\n \"metrics\": [\n {\n \"field\": \"temperature\",\n \"metrics\": [\n \"min\",\n \"max\",\n \"sum\"\n ]\n },\n {\n \"field\": \"voltage\",\n \"metrics\": [\n \"avg\"\n ]\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->rollup()->putJob([\n \"id\" => \"sensor\",\n \"body\" => [\n \"index_pattern\" => \"sensor-*\",\n \"rollup_index\" => \"sensor_rollup\",\n \"cron\" => \"*/30 * * * * ?\",\n \"page_size\" => 1000,\n \"groups\" => [\n \"date_histogram\" => [\n \"field\" => \"timestamp\",\n \"fixed_interval\" => \"1h\",\n \"delay\" => \"7d\",\n ],\n \"terms\" => [\n \"fields\" => array(\n \"node\",\n ),\n ],\n ],\n \"metrics\" => array(\n [\n \"field\" => \"temperature\",\n \"metrics\" => array(\n \"min\",\n \"max\",\n \"sum\",\n ),\n ],\n [\n \"field\" => \"voltage\",\n \"metrics\" => array(\n \"avg\",\n ),\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_pattern\":\"sensor-*\",\"rollup_index\":\"sensor_rollup\",\"cron\":\"*/30 * * * * ?\",\"page_size\":1000,\"groups\":{\"date_histogram\":{\"field\":\"timestamp\",\"fixed_interval\":\"1h\",\"delay\":\"7d\"},\"terms\":{\"fields\":[\"node\"]}},\"metrics\":[{\"field\":\"temperature\",\"metrics\":[\"min\",\"max\",\"sum\"]},{\"field\":\"voltage\",\"metrics\":[\"avg\"]}]}' \"$ELASTICSEARCH_URL/_rollup/job/sensor\"" } ] }, @@ -33330,6 +43794,26 @@ { "lang": "Console", "source": "DELETE _rollup/job/sensor\n" + }, + { + "lang": "Python", + "source": "resp = client.rollup.delete_job(\n id=\"sensor\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.rollup.deleteJob({\n id: \"sensor\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.rollup.delete_job(\n id: \"sensor\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->rollup()->deleteJob([\n \"id\" => \"sensor\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_rollup/job/sensor\"" } ] } @@ -33353,6 +43837,26 @@ { "lang": "Console", "source": "GET _rollup/job/sensor\n" + }, + { + "lang": "Python", + "source": "resp = client.rollup.get_jobs(\n id=\"sensor\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.rollup.getJobs({\n id: \"sensor\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.rollup.get_jobs(\n id: \"sensor\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->rollup()->getJobs([\n \"id\" => \"sensor\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_rollup/job/sensor\"" } ] } @@ -33381,6 +43885,26 @@ { "lang": "Console", "source": "GET _rollup/data/sensor-*\n" + }, + { + "lang": "Python", + "source": "resp = client.rollup.get_rollup_caps(\n id=\"sensor-*\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.rollup.getRollupCaps({\n id: \"sensor-*\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.rollup.get_rollup_caps(\n id: \"sensor-*\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->rollup()->getRollupCaps([\n \"id\" => \"sensor-*\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_rollup/data/sensor-*\"" } ] } @@ -33404,6 +43928,26 @@ { "lang": "Console", "source": "GET _rollup/data/sensor-*\n" + }, + { + "lang": "Python", + "source": "resp = client.rollup.get_rollup_caps(\n id=\"sensor-*\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.rollup.getRollupCaps({\n id: \"sensor-*\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.rollup.get_rollup_caps(\n id: \"sensor-*\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->rollup()->getRollupCaps([\n \"id\" => \"sensor-*\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_rollup/data/sensor-*\"" } ] } @@ -33456,6 +44000,26 @@ { "lang": "Console", "source": "GET /sensor_rollup/_rollup/data\n" + }, + { + "lang": "Python", + "source": "resp = client.rollup.get_rollup_index_caps(\n index=\"sensor_rollup\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.rollup.getRollupIndexCaps({\n index: \"sensor_rollup\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.rollup.get_rollup_index_caps(\n index: \"sensor_rollup\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->rollup()->getRollupIndexCaps([\n \"index\" => \"sensor_rollup\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/sensor_rollup/_rollup/data\"" } ] } @@ -33493,6 +44057,26 @@ { "lang": "Console", "source": "GET /sensor_rollup/_rollup_search\n{\n \"size\": 0,\n \"aggregations\": {\n \"max_temperature\": {\n \"max\": {\n \"field\": \"temperature\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.rollup.rollup_search(\n index=\"sensor_rollup\",\n size=0,\n aggregations={\n \"max_temperature\": {\n \"max\": {\n \"field\": \"temperature\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.rollup.rollupSearch({\n index: \"sensor_rollup\",\n size: 0,\n aggregations: {\n max_temperature: {\n max: {\n field: \"temperature\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.rollup.rollup_search(\n index: \"sensor_rollup\",\n body: {\n \"size\": 0,\n \"aggregations\": {\n \"max_temperature\": {\n \"max\": {\n \"field\": \"temperature\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->rollup()->rollupSearch([\n \"index\" => \"sensor_rollup\",\n \"body\" => [\n \"size\" => 0,\n \"aggregations\" => [\n \"max_temperature\" => [\n \"max\" => [\n \"field\" => \"temperature\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"size\":0,\"aggregations\":{\"max_temperature\":{\"max\":{\"field\":\"temperature\"}}}}' \"$ELASTICSEARCH_URL/sensor_rollup/_rollup_search\"" } ] }, @@ -33528,6 +44112,26 @@ { "lang": "Console", "source": "GET /sensor_rollup/_rollup_search\n{\n \"size\": 0,\n \"aggregations\": {\n \"max_temperature\": {\n \"max\": {\n \"field\": \"temperature\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.rollup.rollup_search(\n index=\"sensor_rollup\",\n size=0,\n aggregations={\n \"max_temperature\": {\n \"max\": {\n \"field\": \"temperature\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.rollup.rollupSearch({\n index: \"sensor_rollup\",\n size: 0,\n aggregations: {\n max_temperature: {\n max: {\n field: \"temperature\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.rollup.rollup_search(\n index: \"sensor_rollup\",\n body: {\n \"size\": 0,\n \"aggregations\": {\n \"max_temperature\": {\n \"max\": {\n \"field\": \"temperature\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->rollup()->rollupSearch([\n \"index\" => \"sensor_rollup\",\n \"body\" => [\n \"size\" => 0,\n \"aggregations\" => [\n \"max_temperature\" => [\n \"max\" => [\n \"field\" => \"temperature\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"size\":0,\"aggregations\":{\"max_temperature\":{\"max\":{\"field\":\"temperature\"}}}}' \"$ELASTICSEARCH_URL/sensor_rollup/_rollup_search\"" } ] } @@ -33585,6 +44189,26 @@ { "lang": "Console", "source": "POST _rollup/job/sensor/_start\n" + }, + { + "lang": "Python", + "source": "resp = client.rollup.start_job(\n id=\"sensor\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.rollup.startJob({\n id: \"sensor\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.rollup.start_job(\n id: \"sensor\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->rollup()->startJob([\n \"id\" => \"sensor\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_rollup/job/sensor/_start\"" } ] } @@ -33656,6 +44280,26 @@ { "lang": "Console", "source": "POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s\n" + }, + { + "lang": "Python", + "source": "resp = client.rollup.stop_job(\n id=\"sensor\",\n wait_for_completion=True,\n timeout=\"10s\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.rollup.stopJob({\n id: \"sensor\",\n wait_for_completion: \"true\",\n timeout: \"10s\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.rollup.stop_job(\n id: \"sensor\",\n wait_for_completion: \"true\",\n timeout: \"10s\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->rollup()->stopJob([\n \"id\" => \"sensor\",\n \"wait_for_completion\" => \"true\",\n \"timeout\" => \"10s\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s\"" } ] } @@ -33681,6 +44325,26 @@ { "lang": "Console", "source": "POST /_scripts/painless/_execute\n{\n \"script\": {\n \"source\": \"params.count / params.total\",\n \"params\": {\n \"count\": 100.0,\n \"total\": 1000.0\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.scripts_painless_execute(\n script={\n \"source\": \"params.count / params.total\",\n \"params\": {\n \"count\": 100,\n \"total\": 1000\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.scriptsPainlessExecute({\n script: {\n source: \"params.count / params.total\",\n params: {\n count: 100,\n total: 1000,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.scripts_painless_execute(\n body: {\n \"script\": {\n \"source\": \"params.count / params.total\",\n \"params\": {\n \"count\": 100,\n \"total\": 1000\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->scriptsPainlessExecute([\n \"body\" => [\n \"script\" => [\n \"source\" => \"params.count / params.total\",\n \"params\" => [\n \"count\" => 100,\n \"total\" => 1000,\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"source\":\"params.count / params.total\",\"params\":{\"count\":100,\"total\":1000}}}' \"$ELASTICSEARCH_URL/_scripts/painless/_execute\"" } ] }, @@ -33704,6 +44368,26 @@ { "lang": "Console", "source": "POST /_scripts/painless/_execute\n{\n \"script\": {\n \"source\": \"params.count / params.total\",\n \"params\": {\n \"count\": 100.0,\n \"total\": 1000.0\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.scripts_painless_execute(\n script={\n \"source\": \"params.count / params.total\",\n \"params\": {\n \"count\": 100,\n \"total\": 1000\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.scriptsPainlessExecute({\n script: {\n source: \"params.count / params.total\",\n params: {\n count: 100,\n total: 1000,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.scripts_painless_execute(\n body: {\n \"script\": {\n \"source\": \"params.count / params.total\",\n \"params\": {\n \"count\": 100,\n \"total\": 1000\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->scriptsPainlessExecute([\n \"body\" => [\n \"script\" => [\n \"source\" => \"params.count / params.total\",\n \"params\" => [\n \"count\" => 100,\n \"total\" => 1000,\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"source\":\"params.count / params.total\",\"params\":{\"count\":100,\"total\":1000}}}' \"$ELASTICSEARCH_URL/_scripts/painless/_execute\"" } ] } @@ -33862,6 +44546,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_search?from=40&size=20\n{\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search(\n index=\"my-index-000001\",\n from=\"40\",\n size=\"20\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.search({\n index: \"my-index-000001\",\n from: 40,\n size: 20,\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search(\n index: \"my-index-000001\",\n from: \"40\",\n size: \"20\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->search([\n \"index\" => \"my-index-000001\",\n \"from\" => \"40\",\n \"size\" => \"20\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_search?from=40&size=20\"" } ] }, @@ -34018,6 +44722,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_search?from=40&size=20\n{\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search(\n index=\"my-index-000001\",\n from=\"40\",\n size=\"20\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.search({\n index: \"my-index-000001\",\n from: 40,\n size: 20,\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search(\n index: \"my-index-000001\",\n from: \"40\",\n size: \"20\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->search([\n \"index\" => \"my-index-000001\",\n \"from\" => \"40\",\n \"size\" => \"20\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_search?from=40&size=20\"" } ] } @@ -34179,6 +44903,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_search?from=40&size=20\n{\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search(\n index=\"my-index-000001\",\n from=\"40\",\n size=\"20\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.search({\n index: \"my-index-000001\",\n from: 40,\n size: 20,\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search(\n index: \"my-index-000001\",\n from: \"40\",\n size: \"20\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->search([\n \"index\" => \"my-index-000001\",\n \"from\" => \"40\",\n \"size\" => \"20\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_search?from=40&size=20\"" } ] }, @@ -34338,6 +45082,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_search?from=40&size=20\n{\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search(\n index=\"my-index-000001\",\n from=\"40\",\n size=\"20\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.search({\n index: \"my-index-000001\",\n from: 40,\n size: 20,\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search(\n index: \"my-index-000001\",\n from: \"40\",\n size: \"20\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->search([\n \"index\" => \"my-index-000001\",\n \"from\" => \"40\",\n \"size\" => \"20\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_search?from=40&size=20\"" } ] } @@ -34386,6 +45150,26 @@ { "lang": "Console", "source": "GET _application/search_application/my-app/\n" + }, + { + "lang": "Python", + "source": "resp = client.search_application.get(\n name=\"my-app\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchApplication.get({\n name: \"my-app\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_application.get(\n name: \"my-app\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchApplication()->get([\n \"name\" => \"my-app\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/search_application/my-app/\"" } ] }, @@ -34460,6 +45244,26 @@ { "lang": "Console", "source": "PUT _application/search_application/my-app\n{\n \"indices\": [ \"index1\", \"index2\" ],\n \"template\": {\n \"script\": {\n \"source\": {\n \"query\": {\n \"query_string\": {\n \"query\": \"{{query_string}}\",\n \"default_field\": \"{{default_field}}\"\n }\n }\n },\n \"params\": {\n \"query_string\": \"*\",\n \"default_field\": \"*\"\n }\n },\n \"dictionary\": {\n \"properties\": {\n \"query_string\": {\n \"type\": \"string\"\n },\n \"default_field\": {\n \"type\": \"string\",\n \"enum\": [\n \"title\",\n \"description\"\n ]\n },\n \"additionalProperties\": false\n },\n \"required\": [\n \"query_string\"\n ]\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search_application.put(\n name=\"my-app\",\n search_application={\n \"indices\": [\n \"index1\",\n \"index2\"\n ],\n \"template\": {\n \"script\": {\n \"source\": {\n \"query\": {\n \"query_string\": {\n \"query\": \"{{query_string}}\",\n \"default_field\": \"{{default_field}}\"\n }\n }\n },\n \"params\": {\n \"query_string\": \"*\",\n \"default_field\": \"*\"\n }\n },\n \"dictionary\": {\n \"properties\": {\n \"query_string\": {\n \"type\": \"string\"\n },\n \"default_field\": {\n \"type\": \"string\",\n \"enum\": [\n \"title\",\n \"description\"\n ]\n },\n \"additionalProperties\": False\n },\n \"required\": [\n \"query_string\"\n ]\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchApplication.put({\n name: \"my-app\",\n search_application: {\n indices: [\"index1\", \"index2\"],\n template: {\n script: {\n source: {\n query: {\n query_string: {\n query: \"{{query_string}}\",\n default_field: \"{{default_field}}\",\n },\n },\n },\n params: {\n query_string: \"*\",\n default_field: \"*\",\n },\n },\n dictionary: {\n properties: {\n query_string: {\n type: \"string\",\n },\n default_field: {\n type: \"string\",\n enum: [\"title\", \"description\"],\n },\n additionalProperties: false,\n },\n required: [\"query_string\"],\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_application.put(\n name: \"my-app\",\n body: {\n \"indices\": [\n \"index1\",\n \"index2\"\n ],\n \"template\": {\n \"script\": {\n \"source\": {\n \"query\": {\n \"query_string\": {\n \"query\": \"{{query_string}}\",\n \"default_field\": \"{{default_field}}\"\n }\n }\n },\n \"params\": {\n \"query_string\": \"*\",\n \"default_field\": \"*\"\n }\n },\n \"dictionary\": {\n \"properties\": {\n \"query_string\": {\n \"type\": \"string\"\n },\n \"default_field\": {\n \"type\": \"string\",\n \"enum\": [\n \"title\",\n \"description\"\n ]\n },\n \"additionalProperties\": false\n },\n \"required\": [\n \"query_string\"\n ]\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchApplication()->put([\n \"name\" => \"my-app\",\n \"body\" => [\n \"indices\" => array(\n \"index1\",\n \"index2\",\n ),\n \"template\" => [\n \"script\" => [\n \"source\" => [\n \"query\" => [\n \"query_string\" => [\n \"query\" => \"{{query_string}}\",\n \"default_field\" => \"{{default_field}}\",\n ],\n ],\n ],\n \"params\" => [\n \"query_string\" => \"*\",\n \"default_field\" => \"*\",\n ],\n ],\n \"dictionary\" => [\n \"properties\" => [\n \"query_string\" => [\n \"type\" => \"string\",\n ],\n \"default_field\" => [\n \"type\" => \"string\",\n \"enum\" => array(\n \"title\",\n \"description\",\n ),\n ],\n \"additionalProperties\" => false,\n ],\n \"required\" => array(\n \"query_string\",\n ),\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"indices\":[\"index1\",\"index2\"],\"template\":{\"script\":{\"source\":{\"query\":{\"query_string\":{\"query\":\"{{query_string}}\",\"default_field\":\"{{default_field}}\"}}},\"params\":{\"query_string\":\"*\",\"default_field\":\"*\"}},\"dictionary\":{\"properties\":{\"query_string\":{\"type\":\"string\"},\"default_field\":{\"type\":\"string\",\"enum\":[\"title\",\"description\"]},\"additionalProperties\":false},\"required\":[\"query_string\"]}}}' \"$ELASTICSEARCH_URL/_application/search_application/my-app\"" } ] }, @@ -34500,6 +45304,26 @@ { "lang": "Console", "source": "DELETE _application/search_application/my-app/\n" + }, + { + "lang": "Python", + "source": "resp = client.search_application.delete(\n name=\"my-app\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchApplication.delete({\n name: \"my-app\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_application.delete(\n name: \"my-app\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchApplication()->delete([\n \"name\" => \"my-app\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/search_application/my-app/\"" } ] } @@ -34527,6 +45351,26 @@ { "lang": "Console", "source": "GET _application/analytics/my*\n" + }, + { + "lang": "Python", + "source": "resp = client.search_application.get_behavioral_analytics(\n name=\"my*\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchApplication.getBehavioralAnalytics({\n name: \"my*\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_application.get_behavioral_analytics(\n name: \"my*\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchApplication()->getBehavioralAnalytics([\n \"name\" => \"my*\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/analytics/my*\"" } ] }, @@ -34567,6 +45411,26 @@ { "lang": "Console", "source": "PUT _application/analytics/my_analytics_collection\n" + }, + { + "lang": "Python", + "source": "resp = client.search_application.put_behavioral_analytics(\n name=\"my_analytics_collection\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchApplication.putBehavioralAnalytics({\n name: \"my_analytics_collection\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_application.put_behavioral_analytics(\n name: \"my_analytics_collection\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchApplication()->putBehavioralAnalytics([\n \"name\" => \"my_analytics_collection\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/analytics/my_analytics_collection\"" } ] }, @@ -34608,6 +45472,26 @@ { "lang": "Console", "source": "DELETE _application/analytics/my_analytics_collection/\n" + }, + { + "lang": "Python", + "source": "resp = client.search_application.delete_behavioral_analytics(\n name=\"my_analytics_collection\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchApplication.deleteBehavioralAnalytics({\n name: \"my_analytics_collection\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_application.delete_behavioral_analytics(\n name: \"my_analytics_collection\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchApplication()->deleteBehavioralAnalytics([\n \"name\" => \"my_analytics_collection\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/analytics/my_analytics_collection/\"" } ] } @@ -34630,6 +45514,26 @@ { "lang": "Console", "source": "GET _application/analytics/my*\n" + }, + { + "lang": "Python", + "source": "resp = client.search_application.get_behavioral_analytics(\n name=\"my*\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchApplication.getBehavioralAnalytics({\n name: \"my*\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_application.get_behavioral_analytics(\n name: \"my*\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchApplication()->getBehavioralAnalytics([\n \"name\" => \"my*\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/analytics/my*\"" } ] } @@ -34712,6 +45616,26 @@ { "lang": "Console", "source": "GET _application/search_application?from=0&size=3&q=app*\n" + }, + { + "lang": "Python", + "source": "resp = client.search_application.list(\n from=\"0\",\n size=\"3\",\n q=\"app*\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchApplication.list({\n from: 0,\n size: 3,\n q: \"app*\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_application.list(\n from: \"0\",\n size: \"3\",\n q: \"app*\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchApplication()->list([\n \"from\" => \"0\",\n \"size\" => \"3\",\n \"q\" => \"app*\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/search_application?from=0&size=3&q=app*\"" } ] } @@ -34805,6 +45729,26 @@ { "lang": "Console", "source": "POST _application/analytics/my_analytics_collection/event/search_click\n{\n \"session\": {\n \"id\": \"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\"\n },\n \"user\": {\n \"id\": \"5f26f01a-bbee-4202-9298-81261067abbd\"\n },\n \"search\":{\n \"query\": \"search term\",\n \"results\": {\n \"items\": [\n {\n \"document\": {\n \"id\": \"123\",\n \"index\": \"products\"\n }\n }\n ],\n \"total_results\": 10\n },\n \"sort\": {\n \"name\": \"relevance\"\n },\n \"search_application\": \"website\"\n },\n \"document\":{\n \"id\": \"123\",\n \"index\": \"products\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search_application.post_behavioral_analytics_event(\n collection_name=\"my_analytics_collection\",\n event_type=\"search_click\",\n payload={\n \"session\": {\n \"id\": \"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\"\n },\n \"user\": {\n \"id\": \"5f26f01a-bbee-4202-9298-81261067abbd\"\n },\n \"search\": {\n \"query\": \"search term\",\n \"results\": {\n \"items\": [\n {\n \"document\": {\n \"id\": \"123\",\n \"index\": \"products\"\n }\n }\n ],\n \"total_results\": 10\n },\n \"sort\": {\n \"name\": \"relevance\"\n },\n \"search_application\": \"website\"\n },\n \"document\": {\n \"id\": \"123\",\n \"index\": \"products\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchApplication.postBehavioralAnalyticsEvent({\n collection_name: \"my_analytics_collection\",\n event_type: \"search_click\",\n payload: {\n session: {\n id: \"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\",\n },\n user: {\n id: \"5f26f01a-bbee-4202-9298-81261067abbd\",\n },\n search: {\n query: \"search term\",\n results: {\n items: [\n {\n document: {\n id: \"123\",\n index: \"products\",\n },\n },\n ],\n total_results: 10,\n },\n sort: {\n name: \"relevance\",\n },\n search_application: \"website\",\n },\n document: {\n id: \"123\",\n index: \"products\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_application.post_behavioral_analytics_event(\n collection_name: \"my_analytics_collection\",\n event_type: \"search_click\",\n body: {\n \"session\": {\n \"id\": \"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\"\n },\n \"user\": {\n \"id\": \"5f26f01a-bbee-4202-9298-81261067abbd\"\n },\n \"search\": {\n \"query\": \"search term\",\n \"results\": {\n \"items\": [\n {\n \"document\": {\n \"id\": \"123\",\n \"index\": \"products\"\n }\n }\n ],\n \"total_results\": 10\n },\n \"sort\": {\n \"name\": \"relevance\"\n },\n \"search_application\": \"website\"\n },\n \"document\": {\n \"id\": \"123\",\n \"index\": \"products\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchApplication()->postBehavioralAnalyticsEvent([\n \"collection_name\" => \"my_analytics_collection\",\n \"event_type\" => \"search_click\",\n \"body\" => [\n \"session\" => [\n \"id\" => \"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\",\n ],\n \"user\" => [\n \"id\" => \"5f26f01a-bbee-4202-9298-81261067abbd\",\n ],\n \"search\" => [\n \"query\" => \"search term\",\n \"results\" => [\n \"items\" => array(\n [\n \"document\" => [\n \"id\" => \"123\",\n \"index\" => \"products\",\n ],\n ],\n ),\n \"total_results\" => 10,\n ],\n \"sort\" => [\n \"name\" => \"relevance\",\n ],\n \"search_application\" => \"website\",\n ],\n \"document\" => [\n \"id\" => \"123\",\n \"index\" => \"products\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"session\":{\"id\":\"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\"},\"user\":{\"id\":\"5f26f01a-bbee-4202-9298-81261067abbd\"},\"search\":{\"query\":\"search term\",\"results\":{\"items\":[{\"document\":{\"id\":\"123\",\"index\":\"products\"}}],\"total_results\":10},\"sort\":{\"name\":\"relevance\"},\"search_application\":\"website\"},\"document\":{\"id\":\"123\",\"index\":\"products\"}}' \"$ELASTICSEARCH_URL/_application/analytics/my_analytics_collection/event/search_click\"" } ] } @@ -34876,6 +45820,26 @@ { "lang": "Console", "source": "POST _application/search_application/my-app/_render_query\n{\n \"params\": {\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\n \"name\": \"title\",\n \"boost\": 5\n },\n {\n \"name\": \"description\",\n \"boost\": 1\n }\n ]\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search_application.render_query(\n name=\"my-app\",\n params={\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\n \"name\": \"title\",\n \"boost\": 5\n },\n {\n \"name\": \"description\",\n \"boost\": 1\n }\n ]\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchApplication.renderQuery({\n name: \"my-app\",\n params: {\n query_string: \"my first query\",\n text_fields: [\n {\n name: \"title\",\n boost: 5,\n },\n {\n name: \"description\",\n boost: 1,\n },\n ],\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_application.render_query(\n name: \"my-app\",\n body: {\n \"params\": {\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\n \"name\": \"title\",\n \"boost\": 5\n },\n {\n \"name\": \"description\",\n \"boost\": 1\n }\n ]\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchApplication()->renderQuery([\n \"name\" => \"my-app\",\n \"body\" => [\n \"params\" => [\n \"query_string\" => \"my first query\",\n \"text_fields\" => array(\n [\n \"name\" => \"title\",\n \"boost\" => 5,\n ],\n [\n \"name\" => \"description\",\n \"boost\" => 1,\n ],\n ),\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"params\":{\"query_string\":\"my first query\",\"text_fields\":[{\"name\":\"title\",\"boost\":5},{\"name\":\"description\",\"boost\":1}]}}' \"$ELASTICSEARCH_URL/_application/search_application/my-app/_render_query\"" } ] } @@ -34909,6 +45873,26 @@ { "lang": "Console", "source": "POST _application/search_application/my-app/_search\n{\n \"params\": {\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\"name\": \"title\", \"boost\": 5},\n {\"name\": \"description\", \"boost\": 1}\n ]\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search_application.search(\n name=\"my-app\",\n params={\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\n \"name\": \"title\",\n \"boost\": 5\n },\n {\n \"name\": \"description\",\n \"boost\": 1\n }\n ]\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchApplication.search({\n name: \"my-app\",\n params: {\n query_string: \"my first query\",\n text_fields: [\n {\n name: \"title\",\n boost: 5,\n },\n {\n name: \"description\",\n boost: 1,\n },\n ],\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_application.search(\n name: \"my-app\",\n body: {\n \"params\": {\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\n \"name\": \"title\",\n \"boost\": 5\n },\n {\n \"name\": \"description\",\n \"boost\": 1\n }\n ]\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchApplication()->search([\n \"name\" => \"my-app\",\n \"body\" => [\n \"params\" => [\n \"query_string\" => \"my first query\",\n \"text_fields\" => array(\n [\n \"name\" => \"title\",\n \"boost\" => 5,\n ],\n [\n \"name\" => \"description\",\n \"boost\" => 1,\n ],\n ),\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"params\":{\"query_string\":\"my first query\",\"text_fields\":[{\"name\":\"title\",\"boost\":5},{\"name\":\"description\",\"boost\":1}]}}' \"$ELASTICSEARCH_URL/_application/search_application/my-app/_search\"" } ] }, @@ -34940,6 +45924,26 @@ { "lang": "Console", "source": "POST _application/search_application/my-app/_search\n{\n \"params\": {\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\"name\": \"title\", \"boost\": 5},\n {\"name\": \"description\", \"boost\": 1}\n ]\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search_application.search(\n name=\"my-app\",\n params={\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\n \"name\": \"title\",\n \"boost\": 5\n },\n {\n \"name\": \"description\",\n \"boost\": 1\n }\n ]\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchApplication.search({\n name: \"my-app\",\n params: {\n query_string: \"my first query\",\n text_fields: [\n {\n name: \"title\",\n boost: 5,\n },\n {\n name: \"description\",\n boost: 1,\n },\n ],\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_application.search(\n name: \"my-app\",\n body: {\n \"params\": {\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\n \"name\": \"title\",\n \"boost\": 5\n },\n {\n \"name\": \"description\",\n \"boost\": 1\n }\n ]\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchApplication()->search([\n \"name\" => \"my-app\",\n \"body\" => [\n \"params\" => [\n \"query_string\" => \"my first query\",\n \"text_fields\" => array(\n [\n \"name\" => \"title\",\n \"boost\" => 5,\n ],\n [\n \"name\" => \"description\",\n \"boost\" => 1,\n ],\n ),\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"params\":{\"query_string\":\"my first query\",\"text_fields\":[{\"name\":\"title\",\"boost\":5},{\"name\":\"description\",\"boost\":1}]}}' \"$ELASTICSEARCH_URL/_application/search_application/my-app/_search\"" } ] } @@ -35006,6 +46010,26 @@ { "lang": "Console", "source": "GET museums/_mvt/location/13/4207/2692\n{\n \"grid_agg\": \"geotile\",\n \"grid_precision\": 2,\n \"fields\": [\n \"name\",\n \"price\"\n ],\n \"query\": {\n \"term\": {\n \"included\": true\n }\n },\n \"aggs\": {\n \"min_price\": {\n \"min\": {\n \"field\": \"price\"\n }\n },\n \"max_price\": {\n \"max\": {\n \"field\": \"price\"\n }\n },\n \"avg_price\": {\n \"avg\": {\n \"field\": \"price\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search_mvt(\n index=\"museums\",\n field=\"location\",\n zoom=\"13\",\n x=\"4207\",\n y=\"2692\",\n grid_agg=\"geotile\",\n grid_precision=2,\n fields=[\n \"name\",\n \"price\"\n ],\n query={\n \"term\": {\n \"included\": True\n }\n },\n aggs={\n \"min_price\": {\n \"min\": {\n \"field\": \"price\"\n }\n },\n \"max_price\": {\n \"max\": {\n \"field\": \"price\"\n }\n },\n \"avg_price\": {\n \"avg\": {\n \"field\": \"price\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchMvt({\n index: \"museums\",\n field: \"location\",\n zoom: 13,\n x: 4207,\n y: 2692,\n grid_agg: \"geotile\",\n grid_precision: 2,\n fields: [\"name\", \"price\"],\n query: {\n term: {\n included: true,\n },\n },\n aggs: {\n min_price: {\n min: {\n field: \"price\",\n },\n },\n max_price: {\n max: {\n field: \"price\",\n },\n },\n avg_price: {\n avg: {\n field: \"price\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_mvt(\n index: \"museums\",\n field: \"location\",\n zoom: \"13\",\n x: \"4207\",\n y: \"2692\",\n body: {\n \"grid_agg\": \"geotile\",\n \"grid_precision\": 2,\n \"fields\": [\n \"name\",\n \"price\"\n ],\n \"query\": {\n \"term\": {\n \"included\": true\n }\n },\n \"aggs\": {\n \"min_price\": {\n \"min\": {\n \"field\": \"price\"\n }\n },\n \"max_price\": {\n \"max\": {\n \"field\": \"price\"\n }\n },\n \"avg_price\": {\n \"avg\": {\n \"field\": \"price\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchMvt([\n \"index\" => \"museums\",\n \"field\" => \"location\",\n \"zoom\" => \"13\",\n \"x\" => \"4207\",\n \"y\" => \"2692\",\n \"body\" => [\n \"grid_agg\" => \"geotile\",\n \"grid_precision\" => 2,\n \"fields\" => array(\n \"name\",\n \"price\",\n ),\n \"query\" => [\n \"term\" => [\n \"included\" => true,\n ],\n ],\n \"aggs\" => [\n \"min_price\" => [\n \"min\" => [\n \"field\" => \"price\",\n ],\n ],\n \"max_price\" => [\n \"max\" => [\n \"field\" => \"price\",\n ],\n ],\n \"avg_price\" => [\n \"avg\" => [\n \"field\" => \"price\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"grid_agg\":\"geotile\",\"grid_precision\":2,\"fields\":[\"name\",\"price\"],\"query\":{\"term\":{\"included\":true}},\"aggs\":{\"min_price\":{\"min\":{\"field\":\"price\"}},\"max_price\":{\"max\":{\"field\":\"price\"}},\"avg_price\":{\"avg\":{\"field\":\"price\"}}}}' \"$ELASTICSEARCH_URL/museums/_mvt/location/13/4207/2692\"" } ] }, @@ -35070,6 +46094,26 @@ { "lang": "Console", "source": "GET museums/_mvt/location/13/4207/2692\n{\n \"grid_agg\": \"geotile\",\n \"grid_precision\": 2,\n \"fields\": [\n \"name\",\n \"price\"\n ],\n \"query\": {\n \"term\": {\n \"included\": true\n }\n },\n \"aggs\": {\n \"min_price\": {\n \"min\": {\n \"field\": \"price\"\n }\n },\n \"max_price\": {\n \"max\": {\n \"field\": \"price\"\n }\n },\n \"avg_price\": {\n \"avg\": {\n \"field\": \"price\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search_mvt(\n index=\"museums\",\n field=\"location\",\n zoom=\"13\",\n x=\"4207\",\n y=\"2692\",\n grid_agg=\"geotile\",\n grid_precision=2,\n fields=[\n \"name\",\n \"price\"\n ],\n query={\n \"term\": {\n \"included\": True\n }\n },\n aggs={\n \"min_price\": {\n \"min\": {\n \"field\": \"price\"\n }\n },\n \"max_price\": {\n \"max\": {\n \"field\": \"price\"\n }\n },\n \"avg_price\": {\n \"avg\": {\n \"field\": \"price\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchMvt({\n index: \"museums\",\n field: \"location\",\n zoom: 13,\n x: 4207,\n y: 2692,\n grid_agg: \"geotile\",\n grid_precision: 2,\n fields: [\"name\", \"price\"],\n query: {\n term: {\n included: true,\n },\n },\n aggs: {\n min_price: {\n min: {\n field: \"price\",\n },\n },\n max_price: {\n max: {\n field: \"price\",\n },\n },\n avg_price: {\n avg: {\n field: \"price\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_mvt(\n index: \"museums\",\n field: \"location\",\n zoom: \"13\",\n x: \"4207\",\n y: \"2692\",\n body: {\n \"grid_agg\": \"geotile\",\n \"grid_precision\": 2,\n \"fields\": [\n \"name\",\n \"price\"\n ],\n \"query\": {\n \"term\": {\n \"included\": true\n }\n },\n \"aggs\": {\n \"min_price\": {\n \"min\": {\n \"field\": \"price\"\n }\n },\n \"max_price\": {\n \"max\": {\n \"field\": \"price\"\n }\n },\n \"avg_price\": {\n \"avg\": {\n \"field\": \"price\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchMvt([\n \"index\" => \"museums\",\n \"field\" => \"location\",\n \"zoom\" => \"13\",\n \"x\" => \"4207\",\n \"y\" => \"2692\",\n \"body\" => [\n \"grid_agg\" => \"geotile\",\n \"grid_precision\" => 2,\n \"fields\" => array(\n \"name\",\n \"price\",\n ),\n \"query\" => [\n \"term\" => [\n \"included\" => true,\n ],\n ],\n \"aggs\" => [\n \"min_price\" => [\n \"min\" => [\n \"field\" => \"price\",\n ],\n ],\n \"max_price\" => [\n \"max\" => [\n \"field\" => \"price\",\n ],\n ],\n \"avg_price\" => [\n \"avg\" => [\n \"field\" => \"price\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"grid_agg\":\"geotile\",\"grid_precision\":2,\"fields\":[\"name\",\"price\"],\"query\":{\"term\":{\"included\":true}},\"aggs\":{\"min_price\":{\"min\":{\"field\":\"price\"}},\"max_price\":{\"max\":{\"field\":\"price\"}},\"avg_price\":{\"avg\":{\"field\":\"price\"}}}}' \"$ELASTICSEARCH_URL/museums/_mvt/location/13/4207/2692\"" } ] } @@ -35114,6 +46158,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_search_shards\n" + }, + { + "lang": "Python", + "source": "resp = client.search_shards(\n index=\"my-index-000001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchShards({\n index: \"my-index-000001\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_shards(\n index: \"my-index-000001\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchShards([\n \"index\" => \"my-index-000001\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_search_shards\"" } ] }, @@ -35156,6 +46220,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_search_shards\n" + }, + { + "lang": "Python", + "source": "resp = client.search_shards(\n index=\"my-index-000001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchShards({\n index: \"my-index-000001\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_shards(\n index: \"my-index-000001\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchShards([\n \"index\" => \"my-index-000001\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_search_shards\"" } ] } @@ -35203,6 +46287,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_search_shards\n" + }, + { + "lang": "Python", + "source": "resp = client.search_shards(\n index=\"my-index-000001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchShards({\n index: \"my-index-000001\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_shards(\n index: \"my-index-000001\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchShards([\n \"index\" => \"my-index-000001\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_search_shards\"" } ] }, @@ -35248,6 +46352,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_search_shards\n" + }, + { + "lang": "Python", + "source": "resp = client.search_shards(\n index=\"my-index-000001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchShards({\n index: \"my-index-000001\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_shards(\n index: \"my-index-000001\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchShards([\n \"index\" => \"my-index-000001\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_search_shards\"" } ] } @@ -35317,6 +46441,26 @@ { "lang": "Console", "source": "GET my-index/_search/template\n{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search_template(\n index=\"my-index\",\n id=\"my-search-template\",\n params={\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchTemplate({\n index: \"my-index\",\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 0,\n size: 10,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_template(\n index: \"my-index\",\n body: {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchTemplate([\n \"index\" => \"my-index\",\n \"body\" => [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 0,\n \"size\" => 10,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":0,\"size\":10}}' \"$ELASTICSEARCH_URL/my-index/_search/template\"" } ] }, @@ -35384,6 +46528,26 @@ { "lang": "Console", "source": "GET my-index/_search/template\n{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search_template(\n index=\"my-index\",\n id=\"my-search-template\",\n params={\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchTemplate({\n index: \"my-index\",\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 0,\n size: 10,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_template(\n index: \"my-index\",\n body: {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchTemplate([\n \"index\" => \"my-index\",\n \"body\" => [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 0,\n \"size\" => 10,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":0,\"size\":10}}' \"$ELASTICSEARCH_URL/my-index/_search/template\"" } ] } @@ -35456,6 +46620,26 @@ { "lang": "Console", "source": "GET my-index/_search/template\n{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search_template(\n index=\"my-index\",\n id=\"my-search-template\",\n params={\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchTemplate({\n index: \"my-index\",\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 0,\n size: 10,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_template(\n index: \"my-index\",\n body: {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchTemplate([\n \"index\" => \"my-index\",\n \"body\" => [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 0,\n \"size\" => 10,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":0,\"size\":10}}' \"$ELASTICSEARCH_URL/my-index/_search/template\"" } ] }, @@ -35526,6 +46710,26 @@ { "lang": "Console", "source": "GET my-index/_search/template\n{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search_template(\n index=\"my-index\",\n id=\"my-search-template\",\n params={\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchTemplate({\n index: \"my-index\",\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 0,\n size: 10,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_template(\n index: \"my-index\",\n body: {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchTemplate([\n \"index\" => \"my-index\",\n \"body\" => [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 0,\n \"size\" => 10,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":0,\"size\":10}}' \"$ELASTICSEARCH_URL/my-index/_search/template\"" } ] } @@ -35556,6 +46760,26 @@ { "lang": "Console", "source": "GET /_searchable_snapshots/cache/stats\n" + }, + { + "lang": "Python", + "source": "resp = client.searchable_snapshots.cache_stats()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchableSnapshots.cacheStats();" + }, + { + "lang": "Ruby", + "source": "response = client.searchable_snapshots.cache_stats" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchableSnapshots()->cacheStats();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_searchable_snapshots/cache/stats\"" } ] } @@ -35589,6 +46813,26 @@ { "lang": "Console", "source": "GET /_searchable_snapshots/cache/stats\n" + }, + { + "lang": "Python", + "source": "resp = client.searchable_snapshots.cache_stats()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchableSnapshots.cacheStats();" + }, + { + "lang": "Ruby", + "source": "response = client.searchable_snapshots.cache_stats" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchableSnapshots()->cacheStats();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_searchable_snapshots/cache/stats\"" } ] } @@ -35625,6 +46869,26 @@ { "lang": "Console", "source": "POST /my-index/_searchable_snapshots/cache/clear\n" + }, + { + "lang": "Python", + "source": "resp = client.searchable_snapshots.clear_cache(\n index=\"my-index\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchableSnapshots.clearCache({\n index: \"my-index\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.searchable_snapshots.clear_cache(\n index: \"my-index\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchableSnapshots()->clearCache([\n \"index\" => \"my-index\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index/_searchable_snapshots/cache/clear\"" } ] } @@ -35664,6 +46928,26 @@ { "lang": "Console", "source": "POST /my-index/_searchable_snapshots/cache/clear\n" + }, + { + "lang": "Python", + "source": "resp = client.searchable_snapshots.clear_cache(\n index=\"my-index\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchableSnapshots.clearCache({\n index: \"my-index\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.searchable_snapshots.clear_cache(\n index: \"my-index\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchableSnapshots()->clearCache([\n \"index\" => \"my-index\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index/_searchable_snapshots/cache/clear\"" } ] } @@ -35796,6 +47080,26 @@ { "lang": "Console", "source": "POST /_snapshot/my_repository/my_snapshot/_mount?wait_for_completion=true\n{\n \"index\": \"my_docs\",\n \"renamed_index\": \"docs\",\n \"index_settings\": {\n \"index.number_of_replicas\": 0\n },\n \"ignore_index_settings\": [ \"index.refresh_interval\" ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.searchable_snapshots.mount(\n repository=\"my_repository\",\n snapshot=\"my_snapshot\",\n wait_for_completion=True,\n index=\"my_docs\",\n renamed_index=\"docs\",\n index_settings={\n \"index.number_of_replicas\": 0\n },\n ignore_index_settings=[\n \"index.refresh_interval\"\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchableSnapshots.mount({\n repository: \"my_repository\",\n snapshot: \"my_snapshot\",\n wait_for_completion: \"true\",\n index: \"my_docs\",\n renamed_index: \"docs\",\n index_settings: {\n \"index.number_of_replicas\": 0,\n },\n ignore_index_settings: [\"index.refresh_interval\"],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.searchable_snapshots.mount(\n repository: \"my_repository\",\n snapshot: \"my_snapshot\",\n wait_for_completion: \"true\",\n body: {\n \"index\": \"my_docs\",\n \"renamed_index\": \"docs\",\n \"index_settings\": {\n \"index.number_of_replicas\": 0\n },\n \"ignore_index_settings\": [\n \"index.refresh_interval\"\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchableSnapshots()->mount([\n \"repository\" => \"my_repository\",\n \"snapshot\" => \"my_snapshot\",\n \"wait_for_completion\" => \"true\",\n \"body\" => [\n \"index\" => \"my_docs\",\n \"renamed_index\" => \"docs\",\n \"index_settings\" => [\n \"index.number_of_replicas\" => 0,\n ],\n \"ignore_index_settings\" => array(\n \"index.refresh_interval\",\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index\":\"my_docs\",\"renamed_index\":\"docs\",\"index_settings\":{\"index.number_of_replicas\":0},\"ignore_index_settings\":[\"index.refresh_interval\"]}' \"$ELASTICSEARCH_URL/_snapshot/my_repository/my_snapshot/_mount?wait_for_completion=true\"" } ] } @@ -35823,6 +47127,26 @@ { "lang": "Console", "source": "GET /my-index/_searchable_snapshots/stats\n" + }, + { + "lang": "Python", + "source": "resp = client.searchable_snapshots.stats(\n index=\"my-index\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchableSnapshots.stats({\n index: \"my-index\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.searchable_snapshots.stats(\n index: \"my-index\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchableSnapshots()->stats([\n \"index\" => \"my-index\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index/_searchable_snapshots/stats\"" } ] } @@ -35853,6 +47177,26 @@ { "lang": "Console", "source": "GET /my-index/_searchable_snapshots/stats\n" + }, + { + "lang": "Python", + "source": "resp = client.searchable_snapshots.stats(\n index=\"my-index\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchableSnapshots.stats({\n index: \"my-index\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.searchable_snapshots.stats(\n index: \"my-index\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchableSnapshots()->stats([\n \"index\" => \"my-index\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index/_searchable_snapshots/stats\"" } ] } @@ -35924,6 +47268,26 @@ { "lang": "Console", "source": "POST /_security/profile/_activate\n{\n \"grant_type\": \"password\",\n \"username\" : \"jacknich\",\n \"password\" : \"l0ng-r4nd0m-p@ssw0rd\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.activate_user_profile(\n grant_type=\"password\",\n username=\"jacknich\",\n password=\"l0ng-r4nd0m-p@ssw0rd\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.activateUserProfile({\n grant_type: \"password\",\n username: \"jacknich\",\n password: \"l0ng-r4nd0m-p@ssw0rd\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.activate_user_profile(\n body: {\n \"grant_type\": \"password\",\n \"username\": \"jacknich\",\n \"password\": \"l0ng-r4nd0m-p@ssw0rd\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->activateUserProfile([\n \"body\" => [\n \"grant_type\" => \"password\",\n \"username\" => \"jacknich\",\n \"password\" => \"l0ng-r4nd0m-p@ssw0rd\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"grant_type\":\"password\",\"username\":\"jacknich\",\"password\":\"l0ng-r4nd0m-p@ssw0rd\"}' \"$ELASTICSEARCH_URL/_security/profile/_activate\"" } ] } @@ -36022,6 +47386,26 @@ { "lang": "Console", "source": "GET /_security/_authenticate\n" + }, + { + "lang": "Python", + "source": "resp = client.security.authenticate()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.authenticate();" + }, + { + "lang": "Ruby", + "source": "response = client.security.authenticate" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->authenticate();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/_authenticate\"" } ] } @@ -36043,6 +47427,26 @@ { "lang": "Console", "source": "GET /_security/role/my_admin_role\n" + }, + { + "lang": "Python", + "source": "resp = client.security.get_role(\n name=\"my_admin_role\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.getRole({\n name: \"my_admin_role\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.get_role(\n name: \"my_admin_role\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->getRole([\n \"name\" => \"my_admin_role\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/role/my_admin_role\"" } ] }, @@ -36159,6 +47563,26 @@ { "lang": "Console", "source": "POST /_security/role\n{\n \"roles\": {\n \"my_admin_role\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index1\",\n \"index2\"\n ],\n \"privileges\": [\n \"all\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n \"run_as\": [\n \"other_user\"\n ],\n \"metadata\": {\n \"version\": 1\n }\n },\n \"my_user_role\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index1\"\n ],\n \"privileges\": [\n \"read\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n \"run_as\": [\n \"other_user\"\n ],\n \"metadata\": {\n \"version\": 1\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.bulk_put_role(\n roles={\n \"my_admin_role\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index1\",\n \"index2\"\n ],\n \"privileges\": [\n \"all\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n \"run_as\": [\n \"other_user\"\n ],\n \"metadata\": {\n \"version\": 1\n }\n },\n \"my_user_role\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index1\"\n ],\n \"privileges\": [\n \"read\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n \"run_as\": [\n \"other_user\"\n ],\n \"metadata\": {\n \"version\": 1\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.bulkPutRole({\n roles: {\n my_admin_role: {\n cluster: [\"all\"],\n indices: [\n {\n names: [\"index1\", \"index2\"],\n privileges: [\"all\"],\n field_security: {\n grant: [\"title\", \"body\"],\n },\n query: '{\"match\": {\"title\": \"foo\"}}',\n },\n ],\n applications: [\n {\n application: \"myapp\",\n privileges: [\"admin\", \"read\"],\n resources: [\"*\"],\n },\n ],\n run_as: [\"other_user\"],\n metadata: {\n version: 1,\n },\n },\n my_user_role: {\n cluster: [\"all\"],\n indices: [\n {\n names: [\"index1\"],\n privileges: [\"read\"],\n field_security: {\n grant: [\"title\", \"body\"],\n },\n query: '{\"match\": {\"title\": \"foo\"}}',\n },\n ],\n applications: [\n {\n application: \"myapp\",\n privileges: [\"admin\", \"read\"],\n resources: [\"*\"],\n },\n ],\n run_as: [\"other_user\"],\n metadata: {\n version: 1,\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.bulk_put_role(\n body: {\n \"roles\": {\n \"my_admin_role\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index1\",\n \"index2\"\n ],\n \"privileges\": [\n \"all\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n \"run_as\": [\n \"other_user\"\n ],\n \"metadata\": {\n \"version\": 1\n }\n },\n \"my_user_role\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index1\"\n ],\n \"privileges\": [\n \"read\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n \"run_as\": [\n \"other_user\"\n ],\n \"metadata\": {\n \"version\": 1\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->bulkPutRole([\n \"body\" => [\n \"roles\" => [\n \"my_admin_role\" => [\n \"cluster\" => array(\n \"all\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index1\",\n \"index2\",\n ),\n \"privileges\" => array(\n \"all\",\n ),\n \"field_security\" => [\n \"grant\" => array(\n \"title\",\n \"body\",\n ),\n ],\n \"query\" => \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\",\n ],\n ),\n \"applications\" => array(\n [\n \"application\" => \"myapp\",\n \"privileges\" => array(\n \"admin\",\n \"read\",\n ),\n \"resources\" => array(\n \"*\",\n ),\n ],\n ),\n \"run_as\" => array(\n \"other_user\",\n ),\n \"metadata\" => [\n \"version\" => 1,\n ],\n ],\n \"my_user_role\" => [\n \"cluster\" => array(\n \"all\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index1\",\n ),\n \"privileges\" => array(\n \"read\",\n ),\n \"field_security\" => [\n \"grant\" => array(\n \"title\",\n \"body\",\n ),\n ],\n \"query\" => \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\",\n ],\n ),\n \"applications\" => array(\n [\n \"application\" => \"myapp\",\n \"privileges\" => array(\n \"admin\",\n \"read\",\n ),\n \"resources\" => array(\n \"*\",\n ),\n ],\n ),\n \"run_as\" => array(\n \"other_user\",\n ),\n \"metadata\" => [\n \"version\" => 1,\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"roles\":{\"my_admin_role\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index1\",\"index2\"],\"privileges\":[\"all\"],\"field_security\":{\"grant\":[\"title\",\"body\"]},\"query\":\"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"}],\"applications\":[{\"application\":\"myapp\",\"privileges\":[\"admin\",\"read\"],\"resources\":[\"*\"]}],\"run_as\":[\"other_user\"],\"metadata\":{\"version\":1}},\"my_user_role\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index1\"],\"privileges\":[\"read\"],\"field_security\":{\"grant\":[\"title\",\"body\"]},\"query\":\"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"}],\"applications\":[{\"application\":\"myapp\",\"privileges\":[\"admin\",\"read\"],\"resources\":[\"*\"]}],\"run_as\":[\"other_user\"],\"metadata\":{\"version\":1}}}}' \"$ELASTICSEARCH_URL/_security/role\"" } ] }, @@ -36263,6 +47687,26 @@ { "lang": "Console", "source": "DELETE /_security/role\n{\n \"names\": [\"my_admin_role\", \"my_user_role\"]\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.bulk_delete_role(\n names=[\n \"my_admin_role\",\n \"my_user_role\"\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.bulkDeleteRole({\n names: [\"my_admin_role\", \"my_user_role\"],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.bulk_delete_role(\n body: {\n \"names\": [\n \"my_admin_role\",\n \"my_user_role\"\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->bulkDeleteRole([\n \"body\" => [\n \"names\" => array(\n \"my_admin_role\",\n \"my_user_role\",\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"names\":[\"my_admin_role\",\"my_user_role\"]}' \"$ELASTICSEARCH_URL/_security/role\"" } ] } @@ -36366,7 +47810,33 @@ } } }, - "x-state": "Added in 8.5.0" + "x-state": "Added in 8.5.0", + "x-codeSamples": [ + { + "lang": "Console", + "source": "POST /_security/api_key/_bulk_update\n{\n \"ids\": [\n \"VuaCfGcBCdbkQm-e5aOx\",\n \"H3_AhoIBA9hmeQJdg7ij\"\n ],\n \"role_descriptors\": {\n \"role-a\": {\n \"indices\": [\n {\n \"names\": [\n \"*\"\n ],\n \"privileges\": [\n \"write\"\n ]\n }\n ]\n }\n },\n \"metadata\": {\n \"environment\": {\n \"level\": 2,\n \"trusted\": true,\n \"tags\": [\n \"production\"\n ]\n }\n },\n \"expiration\": \"30d\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.bulk_update_api_keys(\n ids=[\n \"VuaCfGcBCdbkQm-e5aOx\",\n \"H3_AhoIBA9hmeQJdg7ij\"\n ],\n role_descriptors={\n \"role-a\": {\n \"indices\": [\n {\n \"names\": [\n \"*\"\n ],\n \"privileges\": [\n \"write\"\n ]\n }\n ]\n }\n },\n metadata={\n \"environment\": {\n \"level\": 2,\n \"trusted\": True,\n \"tags\": [\n \"production\"\n ]\n }\n },\n expiration=\"30d\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.bulkUpdateApiKeys({\n ids: [\"VuaCfGcBCdbkQm-e5aOx\", \"H3_AhoIBA9hmeQJdg7ij\"],\n role_descriptors: {\n \"role-a\": {\n indices: [\n {\n names: [\"*\"],\n privileges: [\"write\"],\n },\n ],\n },\n },\n metadata: {\n environment: {\n level: 2,\n trusted: true,\n tags: [\"production\"],\n },\n },\n expiration: \"30d\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.bulk_update_api_keys(\n body: {\n \"ids\": [\n \"VuaCfGcBCdbkQm-e5aOx\",\n \"H3_AhoIBA9hmeQJdg7ij\"\n ],\n \"role_descriptors\": {\n \"role-a\": {\n \"indices\": [\n {\n \"names\": [\n \"*\"\n ],\n \"privileges\": [\n \"write\"\n ]\n }\n ]\n }\n },\n \"metadata\": {\n \"environment\": {\n \"level\": 2,\n \"trusted\": true,\n \"tags\": [\n \"production\"\n ]\n }\n },\n \"expiration\": \"30d\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->bulkUpdateApiKeys([\n \"body\" => [\n \"ids\" => array(\n \"VuaCfGcBCdbkQm-e5aOx\",\n \"H3_AhoIBA9hmeQJdg7ij\",\n ),\n \"role_descriptors\" => [\n \"role-a\" => [\n \"indices\" => array(\n [\n \"names\" => array(\n \"*\",\n ),\n \"privileges\" => array(\n \"write\",\n ),\n ],\n ),\n ],\n ],\n \"metadata\" => [\n \"environment\" => [\n \"level\" => 2,\n \"trusted\" => true,\n \"tags\" => array(\n \"production\",\n ),\n ],\n ],\n \"expiration\" => \"30d\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"ids\":[\"VuaCfGcBCdbkQm-e5aOx\",\"H3_AhoIBA9hmeQJdg7ij\"],\"role_descriptors\":{\"role-a\":{\"indices\":[{\"names\":[\"*\"],\"privileges\":[\"write\"]}]}},\"metadata\":{\"environment\":{\"level\":2,\"trusted\":true,\"tags\":[\"production\"]}},\"expiration\":\"30d\"}' \"$ELASTICSEARCH_URL/_security/api_key/_bulk_update\"" + } + ] } }, "/_security/user/{username}/_password": { @@ -36397,6 +47867,26 @@ { "lang": "Console", "source": "POST /_security/user/jacknich/_password\n{\n \"password\" : \"new-test-password\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.change_password(\n username=\"jacknich\",\n password=\"new-test-password\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.changePassword({\n username: \"jacknich\",\n password: \"new-test-password\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.change_password(\n username: \"jacknich\",\n body: {\n \"password\": \"new-test-password\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->changePassword([\n \"username\" => \"jacknich\",\n \"body\" => [\n \"password\" => \"new-test-password\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"password\":\"new-test-password\"}' \"$ELASTICSEARCH_URL/_security/user/jacknich/_password\"" } ] }, @@ -36427,6 +47917,26 @@ { "lang": "Console", "source": "POST /_security/user/jacknich/_password\n{\n \"password\" : \"new-test-password\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.change_password(\n username=\"jacknich\",\n password=\"new-test-password\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.changePassword({\n username: \"jacknich\",\n password: \"new-test-password\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.change_password(\n username: \"jacknich\",\n body: {\n \"password\": \"new-test-password\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->changePassword([\n \"username\" => \"jacknich\",\n \"body\" => [\n \"password\" => \"new-test-password\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"password\":\"new-test-password\"}' \"$ELASTICSEARCH_URL/_security/user/jacknich/_password\"" } ] } @@ -36456,6 +47966,26 @@ { "lang": "Console", "source": "POST /_security/user/jacknich/_password\n{\n \"password\" : \"new-test-password\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.change_password(\n username=\"jacknich\",\n password=\"new-test-password\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.changePassword({\n username: \"jacknich\",\n password: \"new-test-password\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.change_password(\n username: \"jacknich\",\n body: {\n \"password\": \"new-test-password\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->changePassword([\n \"username\" => \"jacknich\",\n \"body\" => [\n \"password\" => \"new-test-password\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"password\":\"new-test-password\"}' \"$ELASTICSEARCH_URL/_security/user/jacknich/_password\"" } ] }, @@ -36483,6 +48013,26 @@ { "lang": "Console", "source": "POST /_security/user/jacknich/_password\n{\n \"password\" : \"new-test-password\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.change_password(\n username=\"jacknich\",\n password=\"new-test-password\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.changePassword({\n username: \"jacknich\",\n password: \"new-test-password\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.change_password(\n username: \"jacknich\",\n body: {\n \"password\": \"new-test-password\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->changePassword([\n \"username\" => \"jacknich\",\n \"body\" => [\n \"password\" => \"new-test-password\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"password\":\"new-test-password\"}' \"$ELASTICSEARCH_URL/_security/user/jacknich/_password\"" } ] } @@ -36544,6 +48094,26 @@ { "lang": "Console", "source": "POST /_security/api_key/yVGMr3QByxdh1MSaicYx/_clear_cache\n" + }, + { + "lang": "Python", + "source": "resp = client.security.clear_api_key_cache(\n ids=\"yVGMr3QByxdh1MSaicYx\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.clearApiKeyCache({\n ids: \"yVGMr3QByxdh1MSaicYx\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.clear_api_key_cache(\n ids: \"yVGMr3QByxdh1MSaicYx\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->clearApiKeyCache([\n \"ids\" => \"yVGMr3QByxdh1MSaicYx\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/api_key/yVGMr3QByxdh1MSaicYx/_clear_cache\"" } ] } @@ -36605,6 +48175,26 @@ { "lang": "Console", "source": "POST /_security/privilege/myapp/_clear_cache\n" + }, + { + "lang": "Python", + "source": "resp = client.security.clear_cached_privileges(\n application=\"myapp\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.clearCachedPrivileges({\n application: \"myapp\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.clear_cached_privileges(\n application: \"myapp\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->clearCachedPrivileges([\n \"application\" => \"myapp\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/privilege/myapp/_clear_cache\"" } ] } @@ -36681,6 +48271,26 @@ { "lang": "Console", "source": "POST /_security/realm/default_file/_clear_cache\n" + }, + { + "lang": "Python", + "source": "resp = client.security.clear_cached_realms(\n realms=\"default_file\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.clearCachedRealms({\n realms: \"default_file\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.clear_cached_realms(\n realms: \"default_file\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->clearCachedRealms([\n \"realms\" => \"default_file\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/realm/default_file/_clear_cache\"" } ] } @@ -36741,6 +48351,26 @@ { "lang": "Console", "source": "POST /_security/role/my_admin_role/_clear_cache\n" + }, + { + "lang": "Python", + "source": "resp = client.security.clear_cached_roles(\n name=\"my_admin_role\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.clearCachedRoles({\n name: \"my_admin_role\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.clear_cached_roles(\n name: \"my_admin_role\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->clearCachedRoles([\n \"name\" => \"my_admin_role\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/role/my_admin_role/_clear_cache\"" } ] } @@ -36826,6 +48456,26 @@ { "lang": "Console", "source": "POST /_security/service/elastic/fleet-server/credential/token/token1/_clear_cache\n" + }, + { + "lang": "Python", + "source": "resp = client.security.clear_cached_service_tokens(\n namespace=\"elastic\",\n service=\"fleet-server\",\n name=\"token1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.clearCachedServiceTokens({\n namespace: \"elastic\",\n service: \"fleet-server\",\n name: \"token1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.clear_cached_service_tokens(\n namespace: \"elastic\",\n service: \"fleet-server\",\n name: \"token1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->clearCachedServiceTokens([\n \"namespace\" => \"elastic\",\n \"service\" => \"fleet-server\",\n \"name\" => \"token1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/service/elastic/fleet-server/credential/token/token1/_clear_cache\"" } ] } @@ -36960,6 +48610,26 @@ { "lang": "Console", "source": "GET /_security/api_key?username=myuser&realm_name=native1\n" + }, + { + "lang": "Python", + "source": "resp = client.security.get_api_key(\n username=\"myuser\",\n realm_name=\"native1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.getApiKey({\n username: \"myuser\",\n realm_name: \"native1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.get_api_key(\n username: \"myuser\",\n realm_name: \"native1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->getApiKey([\n \"username\" => \"myuser\",\n \"realm_name\" => \"native1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/api_key?username=myuser&realm_name=native1\"" } ] }, @@ -36991,6 +48661,26 @@ { "lang": "Console", "source": "POST /_security/api_key\n{\n \"name\": \"my-api-key\",\n \"expiration\": \"1d\", \n \"role_descriptors\": { \n \"role-a\": {\n \"cluster\": [\"all\"],\n \"indices\": [\n {\n \"names\": [\"index-a*\"],\n \"privileges\": [\"read\"]\n }\n ]\n },\n \"role-b\": {\n \"cluster\": [\"all\"],\n \"indices\": [\n {\n \"names\": [\"index-b*\"],\n \"privileges\": [\"all\"]\n }\n ]\n }\n },\n \"metadata\": {\n \"application\": \"my-application\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": true,\n \"tags\": [\"dev\", \"staging\"]\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.create_api_key(\n name=\"my-api-key\",\n expiration=\"1d\",\n role_descriptors={\n \"role-a\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-a*\"\n ],\n \"privileges\": [\n \"read\"\n ]\n }\n ]\n },\n \"role-b\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-b*\"\n ],\n \"privileges\": [\n \"all\"\n ]\n }\n ]\n }\n },\n metadata={\n \"application\": \"my-application\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": True,\n \"tags\": [\n \"dev\",\n \"staging\"\n ]\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.createApiKey({\n name: \"my-api-key\",\n expiration: \"1d\",\n role_descriptors: {\n \"role-a\": {\n cluster: [\"all\"],\n indices: [\n {\n names: [\"index-a*\"],\n privileges: [\"read\"],\n },\n ],\n },\n \"role-b\": {\n cluster: [\"all\"],\n indices: [\n {\n names: [\"index-b*\"],\n privileges: [\"all\"],\n },\n ],\n },\n },\n metadata: {\n application: \"my-application\",\n environment: {\n level: 1,\n trusted: true,\n tags: [\"dev\", \"staging\"],\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.create_api_key(\n body: {\n \"name\": \"my-api-key\",\n \"expiration\": \"1d\",\n \"role_descriptors\": {\n \"role-a\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-a*\"\n ],\n \"privileges\": [\n \"read\"\n ]\n }\n ]\n },\n \"role-b\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-b*\"\n ],\n \"privileges\": [\n \"all\"\n ]\n }\n ]\n }\n },\n \"metadata\": {\n \"application\": \"my-application\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": true,\n \"tags\": [\n \"dev\",\n \"staging\"\n ]\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->createApiKey([\n \"body\" => [\n \"name\" => \"my-api-key\",\n \"expiration\" => \"1d\",\n \"role_descriptors\" => [\n \"role-a\" => [\n \"cluster\" => array(\n \"all\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index-a*\",\n ),\n \"privileges\" => array(\n \"read\",\n ),\n ],\n ),\n ],\n \"role-b\" => [\n \"cluster\" => array(\n \"all\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index-b*\",\n ),\n \"privileges\" => array(\n \"all\",\n ),\n ],\n ),\n ],\n ],\n \"metadata\" => [\n \"application\" => \"my-application\",\n \"environment\" => [\n \"level\" => 1,\n \"trusted\" => true,\n \"tags\" => array(\n \"dev\",\n \"staging\",\n ),\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"name\":\"my-api-key\",\"expiration\":\"1d\",\"role_descriptors\":{\"role-a\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index-a*\"],\"privileges\":[\"read\"]}]},\"role-b\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index-b*\"],\"privileges\":[\"all\"]}]}},\"metadata\":{\"application\":\"my-application\",\"environment\":{\"level\":1,\"trusted\":true,\"tags\":[\"dev\",\"staging\"]}}}' \"$ELASTICSEARCH_URL/_security/api_key\"" } ] }, @@ -37022,6 +48712,26 @@ { "lang": "Console", "source": "POST /_security/api_key\n{\n \"name\": \"my-api-key\",\n \"expiration\": \"1d\", \n \"role_descriptors\": { \n \"role-a\": {\n \"cluster\": [\"all\"],\n \"indices\": [\n {\n \"names\": [\"index-a*\"],\n \"privileges\": [\"read\"]\n }\n ]\n },\n \"role-b\": {\n \"cluster\": [\"all\"],\n \"indices\": [\n {\n \"names\": [\"index-b*\"],\n \"privileges\": [\"all\"]\n }\n ]\n }\n },\n \"metadata\": {\n \"application\": \"my-application\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": true,\n \"tags\": [\"dev\", \"staging\"]\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.create_api_key(\n name=\"my-api-key\",\n expiration=\"1d\",\n role_descriptors={\n \"role-a\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-a*\"\n ],\n \"privileges\": [\n \"read\"\n ]\n }\n ]\n },\n \"role-b\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-b*\"\n ],\n \"privileges\": [\n \"all\"\n ]\n }\n ]\n }\n },\n metadata={\n \"application\": \"my-application\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": True,\n \"tags\": [\n \"dev\",\n \"staging\"\n ]\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.createApiKey({\n name: \"my-api-key\",\n expiration: \"1d\",\n role_descriptors: {\n \"role-a\": {\n cluster: [\"all\"],\n indices: [\n {\n names: [\"index-a*\"],\n privileges: [\"read\"],\n },\n ],\n },\n \"role-b\": {\n cluster: [\"all\"],\n indices: [\n {\n names: [\"index-b*\"],\n privileges: [\"all\"],\n },\n ],\n },\n },\n metadata: {\n application: \"my-application\",\n environment: {\n level: 1,\n trusted: true,\n tags: [\"dev\", \"staging\"],\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.create_api_key(\n body: {\n \"name\": \"my-api-key\",\n \"expiration\": \"1d\",\n \"role_descriptors\": {\n \"role-a\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-a*\"\n ],\n \"privileges\": [\n \"read\"\n ]\n }\n ]\n },\n \"role-b\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-b*\"\n ],\n \"privileges\": [\n \"all\"\n ]\n }\n ]\n }\n },\n \"metadata\": {\n \"application\": \"my-application\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": true,\n \"tags\": [\n \"dev\",\n \"staging\"\n ]\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->createApiKey([\n \"body\" => [\n \"name\" => \"my-api-key\",\n \"expiration\" => \"1d\",\n \"role_descriptors\" => [\n \"role-a\" => [\n \"cluster\" => array(\n \"all\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index-a*\",\n ),\n \"privileges\" => array(\n \"read\",\n ),\n ],\n ),\n ],\n \"role-b\" => [\n \"cluster\" => array(\n \"all\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index-b*\",\n ),\n \"privileges\" => array(\n \"all\",\n ),\n ],\n ),\n ],\n ],\n \"metadata\" => [\n \"application\" => \"my-application\",\n \"environment\" => [\n \"level\" => 1,\n \"trusted\" => true,\n \"tags\" => array(\n \"dev\",\n \"staging\",\n ),\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"name\":\"my-api-key\",\"expiration\":\"1d\",\"role_descriptors\":{\"role-a\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index-a*\"],\"privileges\":[\"read\"]}]},\"role-b\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index-b*\"],\"privileges\":[\"all\"]}]}},\"metadata\":{\"application\":\"my-application\",\"environment\":{\"level\":1,\"trusted\":true,\"tags\":[\"dev\",\"staging\"]}}}' \"$ELASTICSEARCH_URL/_security/api_key\"" } ] }, @@ -37155,6 +48865,26 @@ { "lang": "Console", "source": "DELETE /_security/api_key\n{\n \"ids\" : [ \"VuaCfGcBCdbkQm-e5aOx\" ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.invalidate_api_key(\n ids=[\n \"VuaCfGcBCdbkQm-e5aOx\"\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.invalidateApiKey({\n ids: [\"VuaCfGcBCdbkQm-e5aOx\"],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.invalidate_api_key(\n body: {\n \"ids\": [\n \"VuaCfGcBCdbkQm-e5aOx\"\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->invalidateApiKey([\n \"body\" => [\n \"ids\" => array(\n \"VuaCfGcBCdbkQm-e5aOx\",\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"ids\":[\"VuaCfGcBCdbkQm-e5aOx\"]}' \"$ELASTICSEARCH_URL/_security/api_key\"" } ] } @@ -37251,6 +48981,26 @@ { "lang": "Console", "source": "POST /_security/cross_cluster/api_key\n{\n \"name\": \"my-cross-cluster-api-key\",\n \"expiration\": \"1d\", \n \"access\": {\n \"search\": [ \n {\n \"names\": [\"logs*\"]\n }\n ],\n \"replication\": [ \n {\n \"names\": [\"archive*\"]\n }\n ]\n },\n \"metadata\": {\n \"description\": \"phase one\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": true,\n \"tags\": [\"dev\", \"staging\"]\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.create_cross_cluster_api_key(\n name=\"my-cross-cluster-api-key\",\n expiration=\"1d\",\n access={\n \"search\": [\n {\n \"names\": [\n \"logs*\"\n ]\n }\n ],\n \"replication\": [\n {\n \"names\": [\n \"archive*\"\n ]\n }\n ]\n },\n metadata={\n \"description\": \"phase one\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": True,\n \"tags\": [\n \"dev\",\n \"staging\"\n ]\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.createCrossClusterApiKey({\n name: \"my-cross-cluster-api-key\",\n expiration: \"1d\",\n access: {\n search: [\n {\n names: [\"logs*\"],\n },\n ],\n replication: [\n {\n names: [\"archive*\"],\n },\n ],\n },\n metadata: {\n description: \"phase one\",\n environment: {\n level: 1,\n trusted: true,\n tags: [\"dev\", \"staging\"],\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.create_cross_cluster_api_key(\n body: {\n \"name\": \"my-cross-cluster-api-key\",\n \"expiration\": \"1d\",\n \"access\": {\n \"search\": [\n {\n \"names\": [\n \"logs*\"\n ]\n }\n ],\n \"replication\": [\n {\n \"names\": [\n \"archive*\"\n ]\n }\n ]\n },\n \"metadata\": {\n \"description\": \"phase one\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": true,\n \"tags\": [\n \"dev\",\n \"staging\"\n ]\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->createCrossClusterApiKey([\n \"body\" => [\n \"name\" => \"my-cross-cluster-api-key\",\n \"expiration\" => \"1d\",\n \"access\" => [\n \"search\" => array(\n [\n \"names\" => array(\n \"logs*\",\n ),\n ],\n ),\n \"replication\" => array(\n [\n \"names\" => array(\n \"archive*\",\n ),\n ],\n ),\n ],\n \"metadata\" => [\n \"description\" => \"phase one\",\n \"environment\" => [\n \"level\" => 1,\n \"trusted\" => true,\n \"tags\" => array(\n \"dev\",\n \"staging\",\n ),\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"name\":\"my-cross-cluster-api-key\",\"expiration\":\"1d\",\"access\":{\"search\":[{\"names\":[\"logs*\"]}],\"replication\":[{\"names\":[\"archive*\"]}]},\"metadata\":{\"description\":\"phase one\",\"environment\":{\"level\":1,\"trusted\":true,\"tags\":[\"dev\",\"staging\"]}}}' \"$ELASTICSEARCH_URL/_security/cross_cluster/api_key\"" } ] } @@ -37289,6 +49039,26 @@ { "lang": "Console", "source": "POST /_security/service/elastic/fleet-server/credential/token/token1\n" + }, + { + "lang": "Python", + "source": "resp = client.security.create_service_token(\n namespace=\"elastic\",\n service=\"fleet-server\",\n name=\"token1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.createServiceToken({\n namespace: \"elastic\",\n service: \"fleet-server\",\n name: \"token1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.create_service_token(\n namespace: \"elastic\",\n service: \"fleet-server\",\n name: \"token1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->createServiceToken([\n \"namespace\" => \"elastic\",\n \"service\" => \"fleet-server\",\n \"name\" => \"token1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/service/elastic/fleet-server/credential/token/token1\"" } ] }, @@ -37325,6 +49095,26 @@ { "lang": "Console", "source": "POST /_security/service/elastic/fleet-server/credential/token/token1\n" + }, + { + "lang": "Python", + "source": "resp = client.security.create_service_token(\n namespace=\"elastic\",\n service=\"fleet-server\",\n name=\"token1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.createServiceToken({\n namespace: \"elastic\",\n service: \"fleet-server\",\n name: \"token1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.create_service_token(\n namespace: \"elastic\",\n service: \"fleet-server\",\n name: \"token1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->createServiceToken([\n \"namespace\" => \"elastic\",\n \"service\" => \"fleet-server\",\n \"name\" => \"token1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/service/elastic/fleet-server/credential/token/token1\"" } ] }, @@ -37415,6 +49205,26 @@ { "lang": "Console", "source": "DELETE /_security/service/elastic/fleet-server/credential/token/token42\n" + }, + { + "lang": "Python", + "source": "resp = client.security.delete_service_token(\n namespace=\"elastic\",\n service=\"fleet-server\",\n name=\"token42\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.deleteServiceToken({\n namespace: \"elastic\",\n service: \"fleet-server\",\n name: \"token42\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.delete_service_token(\n namespace: \"elastic\",\n service: \"fleet-server\",\n name: \"token42\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->deleteServiceToken([\n \"namespace\" => \"elastic\",\n \"service\" => \"fleet-server\",\n \"name\" => \"token42\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/service/elastic/fleet-server/credential/token/token42\"" } ] } @@ -37450,6 +49260,26 @@ { "lang": "Console", "source": "POST /_security/service/elastic/fleet-server/credential/token/token1\n" + }, + { + "lang": "Python", + "source": "resp = client.security.create_service_token(\n namespace=\"elastic\",\n service=\"fleet-server\",\n name=\"token1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.createServiceToken({\n namespace: \"elastic\",\n service: \"fleet-server\",\n name: \"token1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.create_service_token(\n namespace: \"elastic\",\n service: \"fleet-server\",\n name: \"token1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->createServiceToken([\n \"namespace\" => \"elastic\",\n \"service\" => \"fleet-server\",\n \"name\" => \"token1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/service/elastic/fleet-server/credential/token/token1\"" } ] } @@ -37533,7 +49363,33 @@ } } }, - "x-state": "Added in 7.4.0" + "x-state": "Added in 7.4.0", + "x-codeSamples": [ + { + "lang": "Console", + "source": "POST /_security/delegate_pki\n{\n\"x509_certificate_chain\": [\"MIIDeDCCAmCgAwIBAgIUBzj/nGGKxP2iXawsSquHmQjCJmMwDQYJKoZIhvcNAQELBQAwUzErMCkGA1UEAxMiRWxhc3RpY3NlYXJjaCBUZXN0IEludGVybWVkaWF0ZSBDQTEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMB4XDTIzMDcxODE5MjkwNloXDTQzMDcxMzE5MjkwNlowSjEiMCAGA1UEAxMZRWxhc3RpY3NlYXJjaCBUZXN0IENsaWVudDEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAllHL4pQkkfwAm/oLkxYYO+r950DEy1bjH+4viCHzNADLCTWO+lOZJVlNx7QEzJE3QGMdif9CCBBxQFMapA7oUFCLq84fPSQQu5AnvvbltVD9nwVtCs+9ZGDjMKsz98RhSLMFIkxdxi6HkQ3Lfa4ZSI4lvba4oo+T/GveazBDS+NgmKyq00EOXt3tWi1G9vEVItommzXWfv0agJWzVnLMldwkPqsw0W7zrpyT7FZS4iLbQADGceOW8fiauOGMkscu9zAnDR/SbWl/chYioQOdw6ndFLn1YIFPd37xL0WsdsldTpn0vH3YfzgLMffT/3P6YlwBegWzsx6FnM/93Ecb4wIDAQABo00wSzAJBgNVHRMEAjAAMB0GA1UdDgQWBBQKNRwjW+Ad/FN1Rpoqme/5+jrFWzAfBgNVHSMEGDAWgBRcya0c0x/PaI7MbmJVIylWgLqXNjANBgkqhkiG9w0BAQsFAAOCAQEACZ3PF7Uqu47lplXHP6YlzYL2jL0D28hpj5lGtdha4Muw1m/BjDb0Pu8l0NQ1z3AP6AVcvjNDkQq6Y5jeSz0bwQlealQpYfo7EMXjOidrft1GbqOMFmTBLpLA9SvwYGobSTXWTkJzonqVaTcf80HpMgM2uEhodwTcvz6v1WEfeT/HMjmdIsq4ImrOL9RNrcZG6nWfw0HR3JNOgrbfyEztEI471jHznZ336OEcyX7gQuvHE8tOv5+oD1d7s3Xg1yuFp+Ynh+FfOi3hPCuaHA+7F6fLmzMDLVUBAllugst1C3U+L/paD7tqIa4ka+KNPCbSfwazmJrt4XNiivPR4hwH5g==\"]\n}" + }, + { + "lang": "Python", + "source": "resp = client.perform_request(\n \"POST\",\n \"/_security/delegate_pki\",\n headers={\"Content-Type\": \"application/json\"},\n body={\n \"x509_certificate_chain\": [\n \"MIIDeDCCAmCgAwIBAgIUBzj/nGGKxP2iXawsSquHmQjCJmMwDQYJKoZIhvcNAQELBQAwUzErMCkGA1UEAxMiRWxhc3RpY3NlYXJjaCBUZXN0IEludGVybWVkaWF0ZSBDQTEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMB4XDTIzMDcxODE5MjkwNloXDTQzMDcxMzE5MjkwNlowSjEiMCAGA1UEAxMZRWxhc3RpY3NlYXJjaCBUZXN0IENsaWVudDEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAllHL4pQkkfwAm/oLkxYYO+r950DEy1bjH+4viCHzNADLCTWO+lOZJVlNx7QEzJE3QGMdif9CCBBxQFMapA7oUFCLq84fPSQQu5AnvvbltVD9nwVtCs+9ZGDjMKsz98RhSLMFIkxdxi6HkQ3Lfa4ZSI4lvba4oo+T/GveazBDS+NgmKyq00EOXt3tWi1G9vEVItommzXWfv0agJWzVnLMldwkPqsw0W7zrpyT7FZS4iLbQADGceOW8fiauOGMkscu9zAnDR/SbWl/chYioQOdw6ndFLn1YIFPd37xL0WsdsldTpn0vH3YfzgLMffT/3P6YlwBegWzsx6FnM/93Ecb4wIDAQABo00wSzAJBgNVHRMEAjAAMB0GA1UdDgQWBBQKNRwjW+Ad/FN1Rpoqme/5+jrFWzAfBgNVHSMEGDAWgBRcya0c0x/PaI7MbmJVIylWgLqXNjANBgkqhkiG9w0BAQsFAAOCAQEACZ3PF7Uqu47lplXHP6YlzYL2jL0D28hpj5lGtdha4Muw1m/BjDb0Pu8l0NQ1z3AP6AVcvjNDkQq6Y5jeSz0bwQlealQpYfo7EMXjOidrft1GbqOMFmTBLpLA9SvwYGobSTXWTkJzonqVaTcf80HpMgM2uEhodwTcvz6v1WEfeT/HMjmdIsq4ImrOL9RNrcZG6nWfw0HR3JNOgrbfyEztEI471jHznZ336OEcyX7gQuvHE8tOv5+oD1d7s3Xg1yuFp+Ynh+FfOi3hPCuaHA+7F6fLmzMDLVUBAllugst1C3U+L/paD7tqIa4ka+KNPCbSfwazmJrt4XNiivPR4hwH5g==\"\n ]\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transport.request({\n method: \"POST\",\n path: \"/_security/delegate_pki\",\n body: {\n x509_certificate_chain: [\n \"MIIDeDCCAmCgAwIBAgIUBzj/nGGKxP2iXawsSquHmQjCJmMwDQYJKoZIhvcNAQELBQAwUzErMCkGA1UEAxMiRWxhc3RpY3NlYXJjaCBUZXN0IEludGVybWVkaWF0ZSBDQTEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMB4XDTIzMDcxODE5MjkwNloXDTQzMDcxMzE5MjkwNlowSjEiMCAGA1UEAxMZRWxhc3RpY3NlYXJjaCBUZXN0IENsaWVudDEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAllHL4pQkkfwAm/oLkxYYO+r950DEy1bjH+4viCHzNADLCTWO+lOZJVlNx7QEzJE3QGMdif9CCBBxQFMapA7oUFCLq84fPSQQu5AnvvbltVD9nwVtCs+9ZGDjMKsz98RhSLMFIkxdxi6HkQ3Lfa4ZSI4lvba4oo+T/GveazBDS+NgmKyq00EOXt3tWi1G9vEVItommzXWfv0agJWzVnLMldwkPqsw0W7zrpyT7FZS4iLbQADGceOW8fiauOGMkscu9zAnDR/SbWl/chYioQOdw6ndFLn1YIFPd37xL0WsdsldTpn0vH3YfzgLMffT/3P6YlwBegWzsx6FnM/93Ecb4wIDAQABo00wSzAJBgNVHRMEAjAAMB0GA1UdDgQWBBQKNRwjW+Ad/FN1Rpoqme/5+jrFWzAfBgNVHSMEGDAWgBRcya0c0x/PaI7MbmJVIylWgLqXNjANBgkqhkiG9w0BAQsFAAOCAQEACZ3PF7Uqu47lplXHP6YlzYL2jL0D28hpj5lGtdha4Muw1m/BjDb0Pu8l0NQ1z3AP6AVcvjNDkQq6Y5jeSz0bwQlealQpYfo7EMXjOidrft1GbqOMFmTBLpLA9SvwYGobSTXWTkJzonqVaTcf80HpMgM2uEhodwTcvz6v1WEfeT/HMjmdIsq4ImrOL9RNrcZG6nWfw0HR3JNOgrbfyEztEI471jHznZ336OEcyX7gQuvHE8tOv5+oD1d7s3Xg1yuFp+Ynh+FfOi3hPCuaHA+7F6fLmzMDLVUBAllugst1C3U+L/paD7tqIa4ka+KNPCbSfwazmJrt4XNiivPR4hwH5g==\",\n ],\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.perform_request(\n \"POST\",\n \"/_security/delegate_pki\",\n {},\n {\n \"x509_certificate_chain\": [\n \"MIIDeDCCAmCgAwIBAgIUBzj/nGGKxP2iXawsSquHmQjCJmMwDQYJKoZIhvcNAQELBQAwUzErMCkGA1UEAxMiRWxhc3RpY3NlYXJjaCBUZXN0IEludGVybWVkaWF0ZSBDQTEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMB4XDTIzMDcxODE5MjkwNloXDTQzMDcxMzE5MjkwNlowSjEiMCAGA1UEAxMZRWxhc3RpY3NlYXJjaCBUZXN0IENsaWVudDEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAllHL4pQkkfwAm/oLkxYYO+r950DEy1bjH+4viCHzNADLCTWO+lOZJVlNx7QEzJE3QGMdif9CCBBxQFMapA7oUFCLq84fPSQQu5AnvvbltVD9nwVtCs+9ZGDjMKsz98RhSLMFIkxdxi6HkQ3Lfa4ZSI4lvba4oo+T/GveazBDS+NgmKyq00EOXt3tWi1G9vEVItommzXWfv0agJWzVnLMldwkPqsw0W7zrpyT7FZS4iLbQADGceOW8fiauOGMkscu9zAnDR/SbWl/chYioQOdw6ndFLn1YIFPd37xL0WsdsldTpn0vH3YfzgLMffT/3P6YlwBegWzsx6FnM/93Ecb4wIDAQABo00wSzAJBgNVHRMEAjAAMB0GA1UdDgQWBBQKNRwjW+Ad/FN1Rpoqme/5+jrFWzAfBgNVHSMEGDAWgBRcya0c0x/PaI7MbmJVIylWgLqXNjANBgkqhkiG9w0BAQsFAAOCAQEACZ3PF7Uqu47lplXHP6YlzYL2jL0D28hpj5lGtdha4Muw1m/BjDb0Pu8l0NQ1z3AP6AVcvjNDkQq6Y5jeSz0bwQlealQpYfo7EMXjOidrft1GbqOMFmTBLpLA9SvwYGobSTXWTkJzonqVaTcf80HpMgM2uEhodwTcvz6v1WEfeT/HMjmdIsq4ImrOL9RNrcZG6nWfw0HR3JNOgrbfyEztEI471jHznZ336OEcyX7gQuvHE8tOv5+oD1d7s3Xg1yuFp+Ynh+FfOi3hPCuaHA+7F6fLmzMDLVUBAllugst1C3U+L/paD7tqIa4ka+KNPCbSfwazmJrt4XNiivPR4hwH5g==\"\n ]\n },\n { \"Content-Type\": \"application/json\" },\n)" + }, + { + "lang": "PHP", + "source": "$requestFactory = Psr17FactoryDiscovery::findRequestFactory();\n$streamFactory = Psr17FactoryDiscovery::findStreamFactory();\n$request = $requestFactory->createRequest(\n \"POST\",\n \"/_security/delegate_pki\",\n);\n$request = $request->withHeader(\"Content-Type\", \"application/json\");\n$request = $request->withBody($streamFactory->createStream(\n json_encode([\n \"x509_certificate_chain\" => array(\n \"MIIDeDCCAmCgAwIBAgIUBzj/nGGKxP2iXawsSquHmQjCJmMwDQYJKoZIhvcNAQELBQAwUzErMCkGA1UEAxMiRWxhc3RpY3NlYXJjaCBUZXN0IEludGVybWVkaWF0ZSBDQTEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMB4XDTIzMDcxODE5MjkwNloXDTQzMDcxMzE5MjkwNlowSjEiMCAGA1UEAxMZRWxhc3RpY3NlYXJjaCBUZXN0IENsaWVudDEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAllHL4pQkkfwAm/oLkxYYO+r950DEy1bjH+4viCHzNADLCTWO+lOZJVlNx7QEzJE3QGMdif9CCBBxQFMapA7oUFCLq84fPSQQu5AnvvbltVD9nwVtCs+9ZGDjMKsz98RhSLMFIkxdxi6HkQ3Lfa4ZSI4lvba4oo+T/GveazBDS+NgmKyq00EOXt3tWi1G9vEVItommzXWfv0agJWzVnLMldwkPqsw0W7zrpyT7FZS4iLbQADGceOW8fiauOGMkscu9zAnDR/SbWl/chYioQOdw6ndFLn1YIFPd37xL0WsdsldTpn0vH3YfzgLMffT/3P6YlwBegWzsx6FnM/93Ecb4wIDAQABo00wSzAJBgNVHRMEAjAAMB0GA1UdDgQWBBQKNRwjW+Ad/FN1Rpoqme/5+jrFWzAfBgNVHSMEGDAWgBRcya0c0x/PaI7MbmJVIylWgLqXNjANBgkqhkiG9w0BAQsFAAOCAQEACZ3PF7Uqu47lplXHP6YlzYL2jL0D28hpj5lGtdha4Muw1m/BjDb0Pu8l0NQ1z3AP6AVcvjNDkQq6Y5jeSz0bwQlealQpYfo7EMXjOidrft1GbqOMFmTBLpLA9SvwYGobSTXWTkJzonqVaTcf80HpMgM2uEhodwTcvz6v1WEfeT/HMjmdIsq4ImrOL9RNrcZG6nWfw0HR3JNOgrbfyEztEI471jHznZ336OEcyX7gQuvHE8tOv5+oD1d7s3Xg1yuFp+Ynh+FfOi3hPCuaHA+7F6fLmzMDLVUBAllugst1C3U+L/paD7tqIa4ka+KNPCbSfwazmJrt4XNiivPR4hwH5g==\",\n ),\n ]),\n));\n$resp = $client->sendRequest($request);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"x509_certificate_chain\":[\"MIIDeDCCAmCgAwIBAgIUBzj/nGGKxP2iXawsSquHmQjCJmMwDQYJKoZIhvcNAQELBQAwUzErMCkGA1UEAxMiRWxhc3RpY3NlYXJjaCBUZXN0IEludGVybWVkaWF0ZSBDQTEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMB4XDTIzMDcxODE5MjkwNloXDTQzMDcxMzE5MjkwNlowSjEiMCAGA1UEAxMZRWxhc3RpY3NlYXJjaCBUZXN0IENsaWVudDEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAllHL4pQkkfwAm/oLkxYYO+r950DEy1bjH+4viCHzNADLCTWO+lOZJVlNx7QEzJE3QGMdif9CCBBxQFMapA7oUFCLq84fPSQQu5AnvvbltVD9nwVtCs+9ZGDjMKsz98RhSLMFIkxdxi6HkQ3Lfa4ZSI4lvba4oo+T/GveazBDS+NgmKyq00EOXt3tWi1G9vEVItommzXWfv0agJWzVnLMldwkPqsw0W7zrpyT7FZS4iLbQADGceOW8fiauOGMkscu9zAnDR/SbWl/chYioQOdw6ndFLn1YIFPd37xL0WsdsldTpn0vH3YfzgLMffT/3P6YlwBegWzsx6FnM/93Ecb4wIDAQABo00wSzAJBgNVHRMEAjAAMB0GA1UdDgQWBBQKNRwjW+Ad/FN1Rpoqme/5+jrFWzAfBgNVHSMEGDAWgBRcya0c0x/PaI7MbmJVIylWgLqXNjANBgkqhkiG9w0BAQsFAAOCAQEACZ3PF7Uqu47lplXHP6YlzYL2jL0D28hpj5lGtdha4Muw1m/BjDb0Pu8l0NQ1z3AP6AVcvjNDkQq6Y5jeSz0bwQlealQpYfo7EMXjOidrft1GbqOMFmTBLpLA9SvwYGobSTXWTkJzonqVaTcf80HpMgM2uEhodwTcvz6v1WEfeT/HMjmdIsq4ImrOL9RNrcZG6nWfw0HR3JNOgrbfyEztEI471jHznZ336OEcyX7gQuvHE8tOv5+oD1d7s3Xg1yuFp+Ynh+FfOi3hPCuaHA+7F6fLmzMDLVUBAllugst1C3U+L/paD7tqIa4ka+KNPCbSfwazmJrt4XNiivPR4hwH5g==\"]}' \"$ELASTICSEARCH_URL/_security/delegate_pki\"" + } + ] } }, "/_security/privilege/{application}/{name}": { @@ -37565,6 +49421,26 @@ { "lang": "Console", "source": "GET /_security/privilege/myapp/read\n" + }, + { + "lang": "Python", + "source": "resp = client.security.get_privileges(\n application=\"myapp\",\n name=\"read\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.getPrivileges({\n application: \"myapp\",\n name: \"read\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.get_privileges(\n application: \"myapp\",\n name: \"read\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->getPrivileges([\n \"application\" => \"myapp\",\n \"name\" => \"read\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/privilege/myapp/read\"" } ] }, @@ -37641,6 +49517,26 @@ { "lang": "Console", "source": "DELETE /_security/privilege/myapp/read\n" + }, + { + "lang": "Python", + "source": "resp = client.security.delete_privileges(\n application=\"myapp\",\n name=\"read\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.deletePrivileges({\n application: \"myapp\",\n name: \"read\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.delete_privileges(\n application: \"myapp\",\n name: \"read\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->deletePrivileges([\n \"application\" => \"myapp\",\n \"name\" => \"read\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/privilege/myapp/read\"" } ] } @@ -37667,6 +49563,26 @@ { "lang": "Console", "source": "GET /_security/role/my_admin_role\n" + }, + { + "lang": "Python", + "source": "resp = client.security.get_role(\n name=\"my_admin_role\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.getRole({\n name: \"my_admin_role\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.get_role(\n name: \"my_admin_role\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->getRole([\n \"name\" => \"my_admin_role\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/role/my_admin_role\"" } ] }, @@ -37700,6 +49616,26 @@ { "lang": "Console", "source": "POST /_security/role/my_admin_role\n{\n \"description\": \"Grants full access to all management features within the cluster.\",\n \"cluster\": [\"all\"],\n \"indices\": [\n {\n \"names\": [ \"index1\", \"index2\" ],\n \"privileges\": [\"all\"],\n \"field_security\" : { // optional\n \"grant\" : [ \"title\", \"body\" ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\" // optional\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [ \"admin\", \"read\" ],\n \"resources\": [ \"*\" ]\n }\n ],\n \"run_as\": [ \"other_user\" ], // optional\n \"metadata\" : { // optional\n \"version\" : 1\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.put_role(\n name=\"my_admin_role\",\n description=\"Grants full access to all management features within the cluster.\",\n cluster=[\n \"all\"\n ],\n indices=[\n {\n \"names\": [\n \"index1\",\n \"index2\"\n ],\n \"privileges\": [\n \"all\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n applications=[\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n run_as=[\n \"other_user\"\n ],\n metadata={\n \"version\": 1\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.putRole({\n name: \"my_admin_role\",\n description:\n \"Grants full access to all management features within the cluster.\",\n cluster: [\"all\"],\n indices: [\n {\n names: [\"index1\", \"index2\"],\n privileges: [\"all\"],\n field_security: {\n grant: [\"title\", \"body\"],\n },\n query: '{\"match\": {\"title\": \"foo\"}}',\n },\n ],\n applications: [\n {\n application: \"myapp\",\n privileges: [\"admin\", \"read\"],\n resources: [\"*\"],\n },\n ],\n run_as: [\"other_user\"],\n metadata: {\n version: 1,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.put_role(\n name: \"my_admin_role\",\n body: {\n \"description\": \"Grants full access to all management features within the cluster.\",\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index1\",\n \"index2\"\n ],\n \"privileges\": [\n \"all\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n \"run_as\": [\n \"other_user\"\n ],\n \"metadata\": {\n \"version\": 1\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->putRole([\n \"name\" => \"my_admin_role\",\n \"body\" => [\n \"description\" => \"Grants full access to all management features within the cluster.\",\n \"cluster\" => array(\n \"all\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index1\",\n \"index2\",\n ),\n \"privileges\" => array(\n \"all\",\n ),\n \"field_security\" => [\n \"grant\" => array(\n \"title\",\n \"body\",\n ),\n ],\n \"query\" => \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\",\n ],\n ),\n \"applications\" => array(\n [\n \"application\" => \"myapp\",\n \"privileges\" => array(\n \"admin\",\n \"read\",\n ),\n \"resources\" => array(\n \"*\",\n ),\n ],\n ),\n \"run_as\" => array(\n \"other_user\",\n ),\n \"metadata\" => [\n \"version\" => 1,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"Grants full access to all management features within the cluster.\",\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index1\",\"index2\"],\"privileges\":[\"all\"],\"field_security\":{\"grant\":[\"title\",\"body\"]},\"query\":\"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"}],\"applications\":[{\"application\":\"myapp\",\"privileges\":[\"admin\",\"read\"],\"resources\":[\"*\"]}],\"run_as\":[\"other_user\"],\"metadata\":{\"version\":1}}' \"$ELASTICSEARCH_URL/_security/role/my_admin_role\"" } ] }, @@ -37733,6 +49669,26 @@ { "lang": "Console", "source": "POST /_security/role/my_admin_role\n{\n \"description\": \"Grants full access to all management features within the cluster.\",\n \"cluster\": [\"all\"],\n \"indices\": [\n {\n \"names\": [ \"index1\", \"index2\" ],\n \"privileges\": [\"all\"],\n \"field_security\" : { // optional\n \"grant\" : [ \"title\", \"body\" ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\" // optional\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [ \"admin\", \"read\" ],\n \"resources\": [ \"*\" ]\n }\n ],\n \"run_as\": [ \"other_user\" ], // optional\n \"metadata\" : { // optional\n \"version\" : 1\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.put_role(\n name=\"my_admin_role\",\n description=\"Grants full access to all management features within the cluster.\",\n cluster=[\n \"all\"\n ],\n indices=[\n {\n \"names\": [\n \"index1\",\n \"index2\"\n ],\n \"privileges\": [\n \"all\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n applications=[\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n run_as=[\n \"other_user\"\n ],\n metadata={\n \"version\": 1\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.putRole({\n name: \"my_admin_role\",\n description:\n \"Grants full access to all management features within the cluster.\",\n cluster: [\"all\"],\n indices: [\n {\n names: [\"index1\", \"index2\"],\n privileges: [\"all\"],\n field_security: {\n grant: [\"title\", \"body\"],\n },\n query: '{\"match\": {\"title\": \"foo\"}}',\n },\n ],\n applications: [\n {\n application: \"myapp\",\n privileges: [\"admin\", \"read\"],\n resources: [\"*\"],\n },\n ],\n run_as: [\"other_user\"],\n metadata: {\n version: 1,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.put_role(\n name: \"my_admin_role\",\n body: {\n \"description\": \"Grants full access to all management features within the cluster.\",\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index1\",\n \"index2\"\n ],\n \"privileges\": [\n \"all\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n \"run_as\": [\n \"other_user\"\n ],\n \"metadata\": {\n \"version\": 1\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->putRole([\n \"name\" => \"my_admin_role\",\n \"body\" => [\n \"description\" => \"Grants full access to all management features within the cluster.\",\n \"cluster\" => array(\n \"all\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index1\",\n \"index2\",\n ),\n \"privileges\" => array(\n \"all\",\n ),\n \"field_security\" => [\n \"grant\" => array(\n \"title\",\n \"body\",\n ),\n ],\n \"query\" => \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\",\n ],\n ),\n \"applications\" => array(\n [\n \"application\" => \"myapp\",\n \"privileges\" => array(\n \"admin\",\n \"read\",\n ),\n \"resources\" => array(\n \"*\",\n ),\n ],\n ),\n \"run_as\" => array(\n \"other_user\",\n ),\n \"metadata\" => [\n \"version\" => 1,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"Grants full access to all management features within the cluster.\",\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index1\",\"index2\"],\"privileges\":[\"all\"],\"field_security\":{\"grant\":[\"title\",\"body\"]},\"query\":\"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"}],\"applications\":[{\"application\":\"myapp\",\"privileges\":[\"admin\",\"read\"],\"resources\":[\"*\"]}],\"run_as\":[\"other_user\"],\"metadata\":{\"version\":1}}' \"$ELASTICSEARCH_URL/_security/role/my_admin_role\"" } ] }, @@ -37797,6 +49753,26 @@ { "lang": "Console", "source": "DELETE /_security/role/my_admin_role\n" + }, + { + "lang": "Python", + "source": "resp = client.security.delete_role(\n name=\"my_admin_role\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.deleteRole({\n name: \"my_admin_role\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.delete_role(\n name: \"my_admin_role\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->deleteRole([\n \"name\" => \"my_admin_role\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/role/my_admin_role\"" } ] } @@ -37827,6 +49803,26 @@ { "lang": "Console", "source": "GET /_security/role_mapping/mapping1\n" + }, + { + "lang": "Python", + "source": "resp = client.security.get_role_mapping(\n name=\"mapping1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.getRoleMapping({\n name: \"mapping1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.get_role_mapping(\n name: \"mapping1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->getRoleMapping([\n \"name\" => \"mapping1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/role_mapping/mapping1\"" } ] }, @@ -37861,6 +49857,26 @@ { "lang": "Console", "source": "POST /_security/role_mapping/mapping1\n{\n \"roles\": [ \"user\"],\n \"enabled\": true, \n \"rules\": {\n \"field\" : { \"username\" : \"*\" }\n },\n \"metadata\" : { \n \"version\" : 1\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.put_role_mapping(\n name=\"mapping1\",\n roles=[\n \"user\"\n ],\n enabled=True,\n rules={\n \"field\": {\n \"username\": \"*\"\n }\n },\n metadata={\n \"version\": 1\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.putRoleMapping({\n name: \"mapping1\",\n roles: [\"user\"],\n enabled: true,\n rules: {\n field: {\n username: \"*\",\n },\n },\n metadata: {\n version: 1,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.put_role_mapping(\n name: \"mapping1\",\n body: {\n \"roles\": [\n \"user\"\n ],\n \"enabled\": true,\n \"rules\": {\n \"field\": {\n \"username\": \"*\"\n }\n },\n \"metadata\": {\n \"version\": 1\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->putRoleMapping([\n \"name\" => \"mapping1\",\n \"body\" => [\n \"roles\" => array(\n \"user\",\n ),\n \"enabled\" => true,\n \"rules\" => [\n \"field\" => [\n \"username\" => \"*\",\n ],\n ],\n \"metadata\" => [\n \"version\" => 1,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"roles\":[\"user\"],\"enabled\":true,\"rules\":{\"field\":{\"username\":\"*\"}},\"metadata\":{\"version\":1}}' \"$ELASTICSEARCH_URL/_security/role_mapping/mapping1\"" } ] }, @@ -37895,6 +49911,26 @@ { "lang": "Console", "source": "POST /_security/role_mapping/mapping1\n{\n \"roles\": [ \"user\"],\n \"enabled\": true, \n \"rules\": {\n \"field\" : { \"username\" : \"*\" }\n },\n \"metadata\" : { \n \"version\" : 1\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.put_role_mapping(\n name=\"mapping1\",\n roles=[\n \"user\"\n ],\n enabled=True,\n rules={\n \"field\": {\n \"username\": \"*\"\n }\n },\n metadata={\n \"version\": 1\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.putRoleMapping({\n name: \"mapping1\",\n roles: [\"user\"],\n enabled: true,\n rules: {\n field: {\n username: \"*\",\n },\n },\n metadata: {\n version: 1,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.put_role_mapping(\n name: \"mapping1\",\n body: {\n \"roles\": [\n \"user\"\n ],\n \"enabled\": true,\n \"rules\": {\n \"field\": {\n \"username\": \"*\"\n }\n },\n \"metadata\": {\n \"version\": 1\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->putRoleMapping([\n \"name\" => \"mapping1\",\n \"body\" => [\n \"roles\" => array(\n \"user\",\n ),\n \"enabled\" => true,\n \"rules\" => [\n \"field\" => [\n \"username\" => \"*\",\n ],\n ],\n \"metadata\" => [\n \"version\" => 1,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"roles\":[\"user\"],\"enabled\":true,\"rules\":{\"field\":{\"username\":\"*\"}},\"metadata\":{\"version\":1}}' \"$ELASTICSEARCH_URL/_security/role_mapping/mapping1\"" } ] }, @@ -37963,6 +49999,26 @@ { "lang": "Console", "source": "DELETE /_security/role_mapping/mapping1\n" + }, + { + "lang": "Python", + "source": "resp = client.security.delete_role_mapping(\n name=\"mapping1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.deleteRoleMapping({\n name: \"mapping1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.delete_role_mapping(\n name: \"mapping1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->deleteRoleMapping([\n \"name\" => \"mapping1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/role_mapping/mapping1\"" } ] } @@ -37992,6 +50048,26 @@ { "lang": "Console", "source": "GET /_security/user/jacknich?with_profile_uid=true\n" + }, + { + "lang": "Python", + "source": "resp = client.security.get_user(\n username=\"jacknich\",\n with_profile_uid=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.getUser({\n username: \"jacknich\",\n with_profile_uid: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.get_user(\n username: \"jacknich\",\n with_profile_uid: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->getUser([\n \"username\" => \"jacknich\",\n \"with_profile_uid\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/user/jacknich?with_profile_uid=true\"" } ] }, @@ -38022,6 +50098,26 @@ { "lang": "Console", "source": "POST /_security/user/jacknich\n{\n \"password\" : \"l0ng-r4nd0m-p@ssw0rd\",\n \"roles\" : [ \"admin\", \"other_role1\" ],\n \"full_name\" : \"Jack Nicholson\",\n \"email\" : \"jacknich@example.com\",\n \"metadata\" : {\n \"intelligence\" : 7\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.put_user(\n username=\"jacknich\",\n password=\"l0ng-r4nd0m-p@ssw0rd\",\n roles=[\n \"admin\",\n \"other_role1\"\n ],\n full_name=\"Jack Nicholson\",\n email=\"jacknich@example.com\",\n metadata={\n \"intelligence\": 7\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.putUser({\n username: \"jacknich\",\n password: \"l0ng-r4nd0m-p@ssw0rd\",\n roles: [\"admin\", \"other_role1\"],\n full_name: \"Jack Nicholson\",\n email: \"jacknich@example.com\",\n metadata: {\n intelligence: 7,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.put_user(\n username: \"jacknich\",\n body: {\n \"password\": \"l0ng-r4nd0m-p@ssw0rd\",\n \"roles\": [\n \"admin\",\n \"other_role1\"\n ],\n \"full_name\": \"Jack Nicholson\",\n \"email\": \"jacknich@example.com\",\n \"metadata\": {\n \"intelligence\": 7\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->putUser([\n \"username\" => \"jacknich\",\n \"body\" => [\n \"password\" => \"l0ng-r4nd0m-p@ssw0rd\",\n \"roles\" => array(\n \"admin\",\n \"other_role1\",\n ),\n \"full_name\" => \"Jack Nicholson\",\n \"email\" => \"jacknich@example.com\",\n \"metadata\" => [\n \"intelligence\" => 7,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"password\":\"l0ng-r4nd0m-p@ssw0rd\",\"roles\":[\"admin\",\"other_role1\"],\"full_name\":\"Jack Nicholson\",\"email\":\"jacknich@example.com\",\"metadata\":{\"intelligence\":7}}' \"$ELASTICSEARCH_URL/_security/user/jacknich\"" } ] }, @@ -38052,6 +50148,26 @@ { "lang": "Console", "source": "POST /_security/user/jacknich\n{\n \"password\" : \"l0ng-r4nd0m-p@ssw0rd\",\n \"roles\" : [ \"admin\", \"other_role1\" ],\n \"full_name\" : \"Jack Nicholson\",\n \"email\" : \"jacknich@example.com\",\n \"metadata\" : {\n \"intelligence\" : 7\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.put_user(\n username=\"jacknich\",\n password=\"l0ng-r4nd0m-p@ssw0rd\",\n roles=[\n \"admin\",\n \"other_role1\"\n ],\n full_name=\"Jack Nicholson\",\n email=\"jacknich@example.com\",\n metadata={\n \"intelligence\": 7\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.putUser({\n username: \"jacknich\",\n password: \"l0ng-r4nd0m-p@ssw0rd\",\n roles: [\"admin\", \"other_role1\"],\n full_name: \"Jack Nicholson\",\n email: \"jacknich@example.com\",\n metadata: {\n intelligence: 7,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.put_user(\n username: \"jacknich\",\n body: {\n \"password\": \"l0ng-r4nd0m-p@ssw0rd\",\n \"roles\": [\n \"admin\",\n \"other_role1\"\n ],\n \"full_name\": \"Jack Nicholson\",\n \"email\": \"jacknich@example.com\",\n \"metadata\": {\n \"intelligence\": 7\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->putUser([\n \"username\" => \"jacknich\",\n \"body\" => [\n \"password\" => \"l0ng-r4nd0m-p@ssw0rd\",\n \"roles\" => array(\n \"admin\",\n \"other_role1\",\n ),\n \"full_name\" => \"Jack Nicholson\",\n \"email\" => \"jacknich@example.com\",\n \"metadata\" => [\n \"intelligence\" => 7,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"password\":\"l0ng-r4nd0m-p@ssw0rd\",\"roles\":[\"admin\",\"other_role1\"],\"full_name\":\"Jack Nicholson\",\"email\":\"jacknich@example.com\",\"metadata\":{\"intelligence\":7}}' \"$ELASTICSEARCH_URL/_security/user/jacknich\"" } ] }, @@ -38116,6 +50232,26 @@ { "lang": "Console", "source": "DELETE /_security/user/jacknich\n" + }, + { + "lang": "Python", + "source": "resp = client.security.delete_user(\n username=\"jacknich\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.deleteUser({\n username: \"jacknich\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.delete_user(\n username: \"jacknich\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->deleteUser([\n \"username\" => \"jacknich\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/user/jacknich\"" } ] } @@ -38145,6 +50281,26 @@ { "lang": "Console", "source": "PUT /_security/user/jacknich/_disable\n" + }, + { + "lang": "Python", + "source": "resp = client.security.disable_user(\n username=\"jacknich\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.disableUser({\n username: \"jacknich\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.disable_user(\n username: \"jacknich\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->disableUser([\n \"username\" => \"jacknich\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/user/jacknich/_disable\"" } ] }, @@ -38172,6 +50328,26 @@ { "lang": "Console", "source": "PUT /_security/user/jacknich/_disable\n" + }, + { + "lang": "Python", + "source": "resp = client.security.disable_user(\n username=\"jacknich\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.disableUser({\n username: \"jacknich\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.disable_user(\n username: \"jacknich\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->disableUser([\n \"username\" => \"jacknich\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/user/jacknich/_disable\"" } ] } @@ -38202,6 +50378,26 @@ { "lang": "Console", "source": "POST /_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0/_disable\n" + }, + { + "lang": "Python", + "source": "resp = client.security.disable_user_profile(\n uid=\"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.disableUserProfile({\n uid: \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.disable_user_profile(\n uid: \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->disableUserProfile([\n \"uid\" => \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0/_disable\"" } ] }, @@ -38230,6 +50426,26 @@ { "lang": "Console", "source": "POST /_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0/_disable\n" + }, + { + "lang": "Python", + "source": "resp = client.security.disable_user_profile(\n uid=\"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.disableUserProfile({\n uid: \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.disable_user_profile(\n uid: \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->disableUserProfile([\n \"uid\" => \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0/_disable\"" } ] } @@ -38259,6 +50475,26 @@ { "lang": "Console", "source": "PUT _security/user/logstash_system/_enable\n" + }, + { + "lang": "Python", + "source": "resp = client.security.enable_user(\n username=\"logstash_system\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.enableUser({\n username: \"logstash_system\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.enable_user(\n username: \"logstash_system\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->enableUser([\n \"username\" => \"logstash_system\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/user/logstash_system/_enable\"" } ] }, @@ -38286,6 +50522,26 @@ { "lang": "Console", "source": "PUT _security/user/logstash_system/_enable\n" + }, + { + "lang": "Python", + "source": "resp = client.security.enable_user(\n username=\"logstash_system\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.enableUser({\n username: \"logstash_system\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.enable_user(\n username: \"logstash_system\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->enableUser([\n \"username\" => \"logstash_system\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/user/logstash_system/_enable\"" } ] } @@ -38316,6 +50572,26 @@ { "lang": "Console", "source": "POST /_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0/_enable\n" + }, + { + "lang": "Python", + "source": "resp = client.security.enable_user_profile(\n uid=\"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.enableUserProfile({\n uid: \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.enable_user_profile(\n uid: \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->enableUserProfile([\n \"uid\" => \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0/_enable\"" } ] }, @@ -38344,6 +50620,26 @@ { "lang": "Console", "source": "POST /_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0/_enable\n" + }, + { + "lang": "Python", + "source": "resp = client.security.enable_user_profile(\n uid=\"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.enableUserProfile({\n uid: \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.enable_user_profile(\n uid: \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->enableUserProfile([\n \"uid\" => \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0/_enable\"" } ] } @@ -38392,6 +50688,26 @@ { "lang": "Console", "source": "GET /_security/enroll/kibana\n" + }, + { + "lang": "Python", + "source": "resp = client.security.enroll_kibana()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.enrollKibana();" + }, + { + "lang": "Ruby", + "source": "response = client.security.enroll_kibana" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->enrollKibana();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/enroll/kibana\"" } ] } @@ -38524,6 +50840,26 @@ { "lang": "Console", "source": "GET /_security/privilege/_builtin\n" + }, + { + "lang": "Python", + "source": "resp = client.security.get_builtin_privileges()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.getBuiltinPrivileges();" + }, + { + "lang": "Ruby", + "source": "response = client.security.get_builtin_privileges" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->getBuiltinPrivileges();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/privilege/_builtin\"" } ] } @@ -38549,6 +50885,26 @@ { "lang": "Console", "source": "GET /_security/privilege/myapp/read\n" + }, + { + "lang": "Python", + "source": "resp = client.security.get_privileges(\n application=\"myapp\",\n name=\"read\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.getPrivileges({\n application: \"myapp\",\n name: \"read\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.get_privileges(\n application: \"myapp\",\n name: \"read\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->getPrivileges([\n \"application\" => \"myapp\",\n \"name\" => \"read\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/privilege/myapp/read\"" } ] }, @@ -38580,6 +50936,26 @@ { "lang": "Console", "source": "PUT /_security/privilege\n{\n \"myapp\": {\n \"read\": {\n \"actions\": [ \n \"data:read/*\" , \n \"action:login\" ],\n \"metadata\": { \n \"description\": \"Read access to myapp\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.put_privileges(\n privileges={\n \"myapp\": {\n \"read\": {\n \"actions\": [\n \"data:read/*\",\n \"action:login\"\n ],\n \"metadata\": {\n \"description\": \"Read access to myapp\"\n }\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.putPrivileges({\n privileges: {\n myapp: {\n read: {\n actions: [\"data:read/*\", \"action:login\"],\n metadata: {\n description: \"Read access to myapp\",\n },\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.put_privileges(\n body: {\n \"myapp\": {\n \"read\": {\n \"actions\": [\n \"data:read/*\",\n \"action:login\"\n ],\n \"metadata\": {\n \"description\": \"Read access to myapp\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->putPrivileges([\n \"body\" => [\n \"myapp\" => [\n \"read\" => [\n \"actions\" => array(\n \"data:read/*\",\n \"action:login\",\n ),\n \"metadata\" => [\n \"description\" => \"Read access to myapp\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"myapp\":{\"read\":{\"actions\":[\"data:read/*\",\"action:login\"],\"metadata\":{\"description\":\"Read access to myapp\"}}}}' \"$ELASTICSEARCH_URL/_security/privilege\"" } ] }, @@ -38611,6 +50987,26 @@ { "lang": "Console", "source": "PUT /_security/privilege\n{\n \"myapp\": {\n \"read\": {\n \"actions\": [ \n \"data:read/*\" , \n \"action:login\" ],\n \"metadata\": { \n \"description\": \"Read access to myapp\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.put_privileges(\n privileges={\n \"myapp\": {\n \"read\": {\n \"actions\": [\n \"data:read/*\",\n \"action:login\"\n ],\n \"metadata\": {\n \"description\": \"Read access to myapp\"\n }\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.putPrivileges({\n privileges: {\n myapp: {\n read: {\n actions: [\"data:read/*\", \"action:login\"],\n metadata: {\n description: \"Read access to myapp\",\n },\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.put_privileges(\n body: {\n \"myapp\": {\n \"read\": {\n \"actions\": [\n \"data:read/*\",\n \"action:login\"\n ],\n \"metadata\": {\n \"description\": \"Read access to myapp\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->putPrivileges([\n \"body\" => [\n \"myapp\" => [\n \"read\" => [\n \"actions\" => array(\n \"data:read/*\",\n \"action:login\",\n ),\n \"metadata\" => [\n \"description\" => \"Read access to myapp\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"myapp\":{\"read\":{\"actions\":[\"data:read/*\",\"action:login\"],\"metadata\":{\"description\":\"Read access to myapp\"}}}}' \"$ELASTICSEARCH_URL/_security/privilege\"" } ] } @@ -38641,6 +51037,26 @@ { "lang": "Console", "source": "GET /_security/privilege/myapp/read\n" + }, + { + "lang": "Python", + "source": "resp = client.security.get_privileges(\n application=\"myapp\",\n name=\"read\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.getPrivileges({\n application: \"myapp\",\n name: \"read\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.get_privileges(\n application: \"myapp\",\n name: \"read\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->getPrivileges([\n \"application\" => \"myapp\",\n \"name\" => \"read\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/privilege/myapp/read\"" } ] } @@ -38666,6 +51082,26 @@ { "lang": "Console", "source": "GET /_security/role_mapping/mapping1\n" + }, + { + "lang": "Python", + "source": "resp = client.security.get_role_mapping(\n name=\"mapping1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.getRoleMapping({\n name: \"mapping1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.get_role_mapping(\n name: \"mapping1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->getRoleMapping([\n \"name\" => \"mapping1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/role_mapping/mapping1\"" } ] } @@ -38699,6 +51135,26 @@ { "lang": "Console", "source": "GET /_security/service/elastic/fleet-server\n" + }, + { + "lang": "Python", + "source": "resp = client.security.get_service_accounts(\n namespace=\"elastic\",\n service=\"fleet-server\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.getServiceAccounts({\n namespace: \"elastic\",\n service: \"fleet-server\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.get_service_accounts(\n namespace: \"elastic\",\n service: \"fleet-server\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->getServiceAccounts([\n \"namespace\" => \"elastic\",\n \"service\" => \"fleet-server\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/service/elastic/fleet-server\"" } ] } @@ -38729,6 +51185,26 @@ { "lang": "Console", "source": "GET /_security/service/elastic/fleet-server\n" + }, + { + "lang": "Python", + "source": "resp = client.security.get_service_accounts(\n namespace=\"elastic\",\n service=\"fleet-server\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.getServiceAccounts({\n namespace: \"elastic\",\n service: \"fleet-server\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.get_service_accounts(\n namespace: \"elastic\",\n service: \"fleet-server\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->getServiceAccounts([\n \"namespace\" => \"elastic\",\n \"service\" => \"fleet-server\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/service/elastic/fleet-server\"" } ] } @@ -38754,6 +51230,26 @@ { "lang": "Console", "source": "GET /_security/service/elastic/fleet-server\n" + }, + { + "lang": "Python", + "source": "resp = client.security.get_service_accounts(\n namespace=\"elastic\",\n service=\"fleet-server\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.getServiceAccounts({\n namespace: \"elastic\",\n service: \"fleet-server\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.get_service_accounts(\n namespace: \"elastic\",\n service: \"fleet-server\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->getServiceAccounts([\n \"namespace\" => \"elastic\",\n \"service\" => \"fleet-server\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/service/elastic/fleet-server\"" } ] } @@ -38839,6 +51335,26 @@ { "lang": "Console", "source": "GET /_security/service/elastic/fleet-server/credential\n" + }, + { + "lang": "Python", + "source": "resp = client.security.get_service_credentials(\n namespace=\"elastic\",\n service=\"fleet-server\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.getServiceCredentials({\n namespace: \"elastic\",\n service: \"fleet-server\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.get_service_credentials(\n namespace: \"elastic\",\n service: \"fleet-server\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->getServiceCredentials([\n \"namespace\" => \"elastic\",\n \"service\" => \"fleet-server\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/service/elastic/fleet-server/credential\"" } ] } @@ -38895,6 +51411,26 @@ { "lang": "Console", "source": "GET /_security/settings\n" + }, + { + "lang": "Python", + "source": "resp = client.security.get_settings()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.getSettings();" + }, + { + "lang": "Ruby", + "source": "response = client.security.get_settings" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->getSettings();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/settings\"" } ] }, @@ -38978,6 +51514,26 @@ { "lang": "Console", "source": "PUT /_security/settings\n{\n \"security\": {\n \"index.auto_expand_replicas\": \"0-all\"\n },\n \"security-tokens\": {\n \"index.auto_expand_replicas\": \"0-all\"\n },\n \"security-profile\": {\n \"index.auto_expand_replicas\": \"0-all\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.update_settings(\n security={\n \"index.auto_expand_replicas\": \"0-all\"\n },\n security-tokens={\n \"index.auto_expand_replicas\": \"0-all\"\n },\n security-profile={\n \"index.auto_expand_replicas\": \"0-all\"\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.updateSettings({\n security: {\n \"index.auto_expand_replicas\": \"0-all\",\n },\n \"security-tokens\": {\n \"index.auto_expand_replicas\": \"0-all\",\n },\n \"security-profile\": {\n \"index.auto_expand_replicas\": \"0-all\",\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.update_settings(\n body: {\n \"security\": {\n \"index.auto_expand_replicas\": \"0-all\"\n },\n \"security-tokens\": {\n \"index.auto_expand_replicas\": \"0-all\"\n },\n \"security-profile\": {\n \"index.auto_expand_replicas\": \"0-all\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->updateSettings([\n \"body\" => [\n \"security\" => [\n \"index.auto_expand_replicas\" => \"0-all\",\n ],\n \"security-tokens\" => [\n \"index.auto_expand_replicas\" => \"0-all\",\n ],\n \"security-profile\" => [\n \"index.auto_expand_replicas\" => \"0-all\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"security\":{\"index.auto_expand_replicas\":\"0-all\"},\"security-tokens\":{\"index.auto_expand_replicas\":\"0-all\"},\"security-profile\":{\"index.auto_expand_replicas\":\"0-all\"}}' \"$ELASTICSEARCH_URL/_security/settings\"" } ] } @@ -39096,6 +51652,26 @@ { "lang": "Console", "source": "POST /_security/oauth2/token\n{\n \"grant_type\" : \"client_credentials\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.get_token(\n grant_type=\"client_credentials\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.getToken({\n grant_type: \"client_credentials\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.get_token(\n body: {\n \"grant_type\": \"client_credentials\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->getToken([\n \"body\" => [\n \"grant_type\" => \"client_credentials\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"grant_type\":\"client_credentials\"}' \"$ELASTICSEARCH_URL/_security/oauth2/token\"" } ] }, @@ -39208,6 +51784,26 @@ { "lang": "Console", "source": "DELETE /_security/oauth2/token\n{\n \"token\" : \"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.invalidate_token(\n token=\"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.invalidateToken({\n token:\n \"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.invalidate_token(\n body: {\n \"token\": \"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->invalidateToken([\n \"body\" => [\n \"token\" => \"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"token\":\"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\"}' \"$ELASTICSEARCH_URL/_security/oauth2/token\"" } ] } @@ -39234,6 +51830,26 @@ { "lang": "Console", "source": "GET /_security/user/jacknich?with_profile_uid=true\n" + }, + { + "lang": "Python", + "source": "resp = client.security.get_user(\n username=\"jacknich\",\n with_profile_uid=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.getUser({\n username: \"jacknich\",\n with_profile_uid: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.get_user(\n username: \"jacknich\",\n with_profile_uid: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->getUser([\n \"username\" => \"jacknich\",\n \"with_profile_uid\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/user/jacknich?with_profile_uid=true\"" } ] } @@ -39359,6 +51975,26 @@ { "lang": "Console", "source": "GET /_security/user/_privileges\n" + }, + { + "lang": "Python", + "source": "resp = client.security.get_user_privileges()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.getUserPrivileges();" + }, + { + "lang": "Ruby", + "source": "response = client.security.get_user_privileges" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->getUserPrivileges();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/user/_privileges\"" } ] } @@ -39463,6 +52099,26 @@ { "lang": "Console", "source": "GET /_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\n" + }, + { + "lang": "Python", + "source": "resp = client.security.get_user_profile(\n uid=\"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.getUserProfile({\n uid: \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.get_user_profile(\n uid: \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->getUserProfile([\n \"uid\" => \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"" } ] } @@ -39562,6 +52218,26 @@ { "lang": "Console", "source": "POST /_security/api_key/grant\n{\n \"grant_type\": \"password\",\n \"username\" : \"test_admin\",\n \"password\" : \"x-pack-test-password\",\n \"api_key\" : {\n \"name\": \"my-api-key\",\n \"expiration\": \"1d\",\n \"role_descriptors\": {\n \"role-a\": {\n \"cluster\": [\"all\"],\n \"indices\": [\n {\n \"names\": [\"index-a*\"],\n \"privileges\": [\"read\"]\n }\n ]\n },\n \"role-b\": {\n \"cluster\": [\"all\"],\n \"indices\": [\n {\n \"names\": [\"index-b*\"],\n \"privileges\": [\"all\"]\n }\n ]\n }\n },\n \"metadata\": {\n \"application\": \"my-application\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": true,\n \"tags\": [\"dev\", \"staging\"]\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.grant_api_key(\n grant_type=\"password\",\n username=\"test_admin\",\n password=\"x-pack-test-password\",\n api_key={\n \"name\": \"my-api-key\",\n \"expiration\": \"1d\",\n \"role_descriptors\": {\n \"role-a\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-a*\"\n ],\n \"privileges\": [\n \"read\"\n ]\n }\n ]\n },\n \"role-b\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-b*\"\n ],\n \"privileges\": [\n \"all\"\n ]\n }\n ]\n }\n },\n \"metadata\": {\n \"application\": \"my-application\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": True,\n \"tags\": [\n \"dev\",\n \"staging\"\n ]\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.grantApiKey({\n grant_type: \"password\",\n username: \"test_admin\",\n password: \"x-pack-test-password\",\n api_key: {\n name: \"my-api-key\",\n expiration: \"1d\",\n role_descriptors: {\n \"role-a\": {\n cluster: [\"all\"],\n indices: [\n {\n names: [\"index-a*\"],\n privileges: [\"read\"],\n },\n ],\n },\n \"role-b\": {\n cluster: [\"all\"],\n indices: [\n {\n names: [\"index-b*\"],\n privileges: [\"all\"],\n },\n ],\n },\n },\n metadata: {\n application: \"my-application\",\n environment: {\n level: 1,\n trusted: true,\n tags: [\"dev\", \"staging\"],\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.grant_api_key(\n body: {\n \"grant_type\": \"password\",\n \"username\": \"test_admin\",\n \"password\": \"x-pack-test-password\",\n \"api_key\": {\n \"name\": \"my-api-key\",\n \"expiration\": \"1d\",\n \"role_descriptors\": {\n \"role-a\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-a*\"\n ],\n \"privileges\": [\n \"read\"\n ]\n }\n ]\n },\n \"role-b\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-b*\"\n ],\n \"privileges\": [\n \"all\"\n ]\n }\n ]\n }\n },\n \"metadata\": {\n \"application\": \"my-application\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": true,\n \"tags\": [\n \"dev\",\n \"staging\"\n ]\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->grantApiKey([\n \"body\" => [\n \"grant_type\" => \"password\",\n \"username\" => \"test_admin\",\n \"password\" => \"x-pack-test-password\",\n \"api_key\" => [\n \"name\" => \"my-api-key\",\n \"expiration\" => \"1d\",\n \"role_descriptors\" => [\n \"role-a\" => [\n \"cluster\" => array(\n \"all\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index-a*\",\n ),\n \"privileges\" => array(\n \"read\",\n ),\n ],\n ),\n ],\n \"role-b\" => [\n \"cluster\" => array(\n \"all\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index-b*\",\n ),\n \"privileges\" => array(\n \"all\",\n ),\n ],\n ),\n ],\n ],\n \"metadata\" => [\n \"application\" => \"my-application\",\n \"environment\" => [\n \"level\" => 1,\n \"trusted\" => true,\n \"tags\" => array(\n \"dev\",\n \"staging\",\n ),\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"grant_type\":\"password\",\"username\":\"test_admin\",\"password\":\"x-pack-test-password\",\"api_key\":{\"name\":\"my-api-key\",\"expiration\":\"1d\",\"role_descriptors\":{\"role-a\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index-a*\"],\"privileges\":[\"read\"]}]},\"role-b\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index-b*\"],\"privileges\":[\"all\"]}]}},\"metadata\":{\"application\":\"my-application\",\"environment\":{\"level\":1,\"trusted\":true,\"tags\":[\"dev\",\"staging\"]}}}}' \"$ELASTICSEARCH_URL/_security/api_key/grant\"" } ] } @@ -39590,6 +52266,26 @@ { "lang": "Console", "source": "GET /_security/user/_has_privileges\n{\n \"cluster\": [ \"monitor\", \"manage\" ],\n \"index\" : [\n {\n \"names\": [ \"suppliers\", \"products\" ],\n \"privileges\": [ \"read\" ]\n },\n {\n \"names\": [ \"inventory\" ],\n \"privileges\" : [ \"read\", \"write\" ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\" : [ \"read\", \"data:write/inventory\" ],\n \"resources\" : [ \"product/1852563\" ]\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.has_privileges(\n cluster=[\n \"monitor\",\n \"manage\"\n ],\n index=[\n {\n \"names\": [\n \"suppliers\",\n \"products\"\n ],\n \"privileges\": [\n \"read\"\n ]\n },\n {\n \"names\": [\n \"inventory\"\n ],\n \"privileges\": [\n \"read\",\n \"write\"\n ]\n }\n ],\n application=[\n {\n \"application\": \"inventory_manager\",\n \"privileges\": [\n \"read\",\n \"data:write/inventory\"\n ],\n \"resources\": [\n \"product/1852563\"\n ]\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.hasPrivileges({\n cluster: [\"monitor\", \"manage\"],\n index: [\n {\n names: [\"suppliers\", \"products\"],\n privileges: [\"read\"],\n },\n {\n names: [\"inventory\"],\n privileges: [\"read\", \"write\"],\n },\n ],\n application: [\n {\n application: \"inventory_manager\",\n privileges: [\"read\", \"data:write/inventory\"],\n resources: [\"product/1852563\"],\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.has_privileges(\n body: {\n \"cluster\": [\n \"monitor\",\n \"manage\"\n ],\n \"index\": [\n {\n \"names\": [\n \"suppliers\",\n \"products\"\n ],\n \"privileges\": [\n \"read\"\n ]\n },\n {\n \"names\": [\n \"inventory\"\n ],\n \"privileges\": [\n \"read\",\n \"write\"\n ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\": [\n \"read\",\n \"data:write/inventory\"\n ],\n \"resources\": [\n \"product/1852563\"\n ]\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->hasPrivileges([\n \"body\" => [\n \"cluster\" => array(\n \"monitor\",\n \"manage\",\n ),\n \"index\" => array(\n [\n \"names\" => array(\n \"suppliers\",\n \"products\",\n ),\n \"privileges\" => array(\n \"read\",\n ),\n ],\n [\n \"names\" => array(\n \"inventory\",\n ),\n \"privileges\" => array(\n \"read\",\n \"write\",\n ),\n ],\n ),\n \"application\" => array(\n [\n \"application\" => \"inventory_manager\",\n \"privileges\" => array(\n \"read\",\n \"data:write/inventory\",\n ),\n \"resources\" => array(\n \"product/1852563\",\n ),\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"cluster\":[\"monitor\",\"manage\"],\"index\":[{\"names\":[\"suppliers\",\"products\"],\"privileges\":[\"read\"]},{\"names\":[\"inventory\"],\"privileges\":[\"read\",\"write\"]}],\"application\":[{\"application\":\"inventory_manager\",\"privileges\":[\"read\",\"data:write/inventory\"],\"resources\":[\"product/1852563\"]}]}' \"$ELASTICSEARCH_URL/_security/user/_has_privileges\"" } ] }, @@ -39616,6 +52312,26 @@ { "lang": "Console", "source": "GET /_security/user/_has_privileges\n{\n \"cluster\": [ \"monitor\", \"manage\" ],\n \"index\" : [\n {\n \"names\": [ \"suppliers\", \"products\" ],\n \"privileges\": [ \"read\" ]\n },\n {\n \"names\": [ \"inventory\" ],\n \"privileges\" : [ \"read\", \"write\" ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\" : [ \"read\", \"data:write/inventory\" ],\n \"resources\" : [ \"product/1852563\" ]\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.has_privileges(\n cluster=[\n \"monitor\",\n \"manage\"\n ],\n index=[\n {\n \"names\": [\n \"suppliers\",\n \"products\"\n ],\n \"privileges\": [\n \"read\"\n ]\n },\n {\n \"names\": [\n \"inventory\"\n ],\n \"privileges\": [\n \"read\",\n \"write\"\n ]\n }\n ],\n application=[\n {\n \"application\": \"inventory_manager\",\n \"privileges\": [\n \"read\",\n \"data:write/inventory\"\n ],\n \"resources\": [\n \"product/1852563\"\n ]\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.hasPrivileges({\n cluster: [\"monitor\", \"manage\"],\n index: [\n {\n names: [\"suppliers\", \"products\"],\n privileges: [\"read\"],\n },\n {\n names: [\"inventory\"],\n privileges: [\"read\", \"write\"],\n },\n ],\n application: [\n {\n application: \"inventory_manager\",\n privileges: [\"read\", \"data:write/inventory\"],\n resources: [\"product/1852563\"],\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.has_privileges(\n body: {\n \"cluster\": [\n \"monitor\",\n \"manage\"\n ],\n \"index\": [\n {\n \"names\": [\n \"suppliers\",\n \"products\"\n ],\n \"privileges\": [\n \"read\"\n ]\n },\n {\n \"names\": [\n \"inventory\"\n ],\n \"privileges\": [\n \"read\",\n \"write\"\n ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\": [\n \"read\",\n \"data:write/inventory\"\n ],\n \"resources\": [\n \"product/1852563\"\n ]\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->hasPrivileges([\n \"body\" => [\n \"cluster\" => array(\n \"monitor\",\n \"manage\",\n ),\n \"index\" => array(\n [\n \"names\" => array(\n \"suppliers\",\n \"products\",\n ),\n \"privileges\" => array(\n \"read\",\n ),\n ],\n [\n \"names\" => array(\n \"inventory\",\n ),\n \"privileges\" => array(\n \"read\",\n \"write\",\n ),\n ],\n ),\n \"application\" => array(\n [\n \"application\" => \"inventory_manager\",\n \"privileges\" => array(\n \"read\",\n \"data:write/inventory\",\n ),\n \"resources\" => array(\n \"product/1852563\",\n ),\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"cluster\":[\"monitor\",\"manage\"],\"index\":[{\"names\":[\"suppliers\",\"products\"],\"privileges\":[\"read\"]},{\"names\":[\"inventory\"],\"privileges\":[\"read\",\"write\"]}],\"application\":[{\"application\":\"inventory_manager\",\"privileges\":[\"read\",\"data:write/inventory\"],\"resources\":[\"product/1852563\"]}]}' \"$ELASTICSEARCH_URL/_security/user/_has_privileges\"" } ] } @@ -39649,6 +52365,26 @@ { "lang": "Console", "source": "GET /_security/user/_has_privileges\n{\n \"cluster\": [ \"monitor\", \"manage\" ],\n \"index\" : [\n {\n \"names\": [ \"suppliers\", \"products\" ],\n \"privileges\": [ \"read\" ]\n },\n {\n \"names\": [ \"inventory\" ],\n \"privileges\" : [ \"read\", \"write\" ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\" : [ \"read\", \"data:write/inventory\" ],\n \"resources\" : [ \"product/1852563\" ]\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.has_privileges(\n cluster=[\n \"monitor\",\n \"manage\"\n ],\n index=[\n {\n \"names\": [\n \"suppliers\",\n \"products\"\n ],\n \"privileges\": [\n \"read\"\n ]\n },\n {\n \"names\": [\n \"inventory\"\n ],\n \"privileges\": [\n \"read\",\n \"write\"\n ]\n }\n ],\n application=[\n {\n \"application\": \"inventory_manager\",\n \"privileges\": [\n \"read\",\n \"data:write/inventory\"\n ],\n \"resources\": [\n \"product/1852563\"\n ]\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.hasPrivileges({\n cluster: [\"monitor\", \"manage\"],\n index: [\n {\n names: [\"suppliers\", \"products\"],\n privileges: [\"read\"],\n },\n {\n names: [\"inventory\"],\n privileges: [\"read\", \"write\"],\n },\n ],\n application: [\n {\n application: \"inventory_manager\",\n privileges: [\"read\", \"data:write/inventory\"],\n resources: [\"product/1852563\"],\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.has_privileges(\n body: {\n \"cluster\": [\n \"monitor\",\n \"manage\"\n ],\n \"index\": [\n {\n \"names\": [\n \"suppliers\",\n \"products\"\n ],\n \"privileges\": [\n \"read\"\n ]\n },\n {\n \"names\": [\n \"inventory\"\n ],\n \"privileges\": [\n \"read\",\n \"write\"\n ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\": [\n \"read\",\n \"data:write/inventory\"\n ],\n \"resources\": [\n \"product/1852563\"\n ]\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->hasPrivileges([\n \"body\" => [\n \"cluster\" => array(\n \"monitor\",\n \"manage\",\n ),\n \"index\" => array(\n [\n \"names\" => array(\n \"suppliers\",\n \"products\",\n ),\n \"privileges\" => array(\n \"read\",\n ),\n ],\n [\n \"names\" => array(\n \"inventory\",\n ),\n \"privileges\" => array(\n \"read\",\n \"write\",\n ),\n ],\n ),\n \"application\" => array(\n [\n \"application\" => \"inventory_manager\",\n \"privileges\" => array(\n \"read\",\n \"data:write/inventory\",\n ),\n \"resources\" => array(\n \"product/1852563\",\n ),\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"cluster\":[\"monitor\",\"manage\"],\"index\":[{\"names\":[\"suppliers\",\"products\"],\"privileges\":[\"read\"]},{\"names\":[\"inventory\"],\"privileges\":[\"read\",\"write\"]}],\"application\":[{\"application\":\"inventory_manager\",\"privileges\":[\"read\",\"data:write/inventory\"],\"resources\":[\"product/1852563\"]}]}' \"$ELASTICSEARCH_URL/_security/user/_has_privileges\"" } ] }, @@ -39680,6 +52416,26 @@ { "lang": "Console", "source": "GET /_security/user/_has_privileges\n{\n \"cluster\": [ \"monitor\", \"manage\" ],\n \"index\" : [\n {\n \"names\": [ \"suppliers\", \"products\" ],\n \"privileges\": [ \"read\" ]\n },\n {\n \"names\": [ \"inventory\" ],\n \"privileges\" : [ \"read\", \"write\" ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\" : [ \"read\", \"data:write/inventory\" ],\n \"resources\" : [ \"product/1852563\" ]\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.has_privileges(\n cluster=[\n \"monitor\",\n \"manage\"\n ],\n index=[\n {\n \"names\": [\n \"suppliers\",\n \"products\"\n ],\n \"privileges\": [\n \"read\"\n ]\n },\n {\n \"names\": [\n \"inventory\"\n ],\n \"privileges\": [\n \"read\",\n \"write\"\n ]\n }\n ],\n application=[\n {\n \"application\": \"inventory_manager\",\n \"privileges\": [\n \"read\",\n \"data:write/inventory\"\n ],\n \"resources\": [\n \"product/1852563\"\n ]\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.hasPrivileges({\n cluster: [\"monitor\", \"manage\"],\n index: [\n {\n names: [\"suppliers\", \"products\"],\n privileges: [\"read\"],\n },\n {\n names: [\"inventory\"],\n privileges: [\"read\", \"write\"],\n },\n ],\n application: [\n {\n application: \"inventory_manager\",\n privileges: [\"read\", \"data:write/inventory\"],\n resources: [\"product/1852563\"],\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.has_privileges(\n body: {\n \"cluster\": [\n \"monitor\",\n \"manage\"\n ],\n \"index\": [\n {\n \"names\": [\n \"suppliers\",\n \"products\"\n ],\n \"privileges\": [\n \"read\"\n ]\n },\n {\n \"names\": [\n \"inventory\"\n ],\n \"privileges\": [\n \"read\",\n \"write\"\n ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\": [\n \"read\",\n \"data:write/inventory\"\n ],\n \"resources\": [\n \"product/1852563\"\n ]\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->hasPrivileges([\n \"body\" => [\n \"cluster\" => array(\n \"monitor\",\n \"manage\",\n ),\n \"index\" => array(\n [\n \"names\" => array(\n \"suppliers\",\n \"products\",\n ),\n \"privileges\" => array(\n \"read\",\n ),\n ],\n [\n \"names\" => array(\n \"inventory\",\n ),\n \"privileges\" => array(\n \"read\",\n \"write\",\n ),\n ],\n ),\n \"application\" => array(\n [\n \"application\" => \"inventory_manager\",\n \"privileges\" => array(\n \"read\",\n \"data:write/inventory\",\n ),\n \"resources\" => array(\n \"product/1852563\",\n ),\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"cluster\":[\"monitor\",\"manage\"],\"index\":[{\"names\":[\"suppliers\",\"products\"],\"privileges\":[\"read\"]},{\"names\":[\"inventory\"],\"privileges\":[\"read\",\"write\"]}],\"application\":[{\"application\":\"inventory_manager\",\"privileges\":[\"read\",\"data:write/inventory\"],\"resources\":[\"product/1852563\"]}]}' \"$ELASTICSEARCH_URL/_security/user/_has_privileges\"" } ] } @@ -39708,6 +52464,26 @@ { "lang": "Console", "source": "POST /_security/profile/_has_privileges\n{\n \"uids\": [\n \"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0\",\n \"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1\",\n \"u_does-not-exist_0\"\n ],\n \"privileges\": {\n \"cluster\": [ \"monitor\", \"create_snapshot\", \"manage_ml\" ],\n \"index\" : [\n {\n \"names\": [ \"suppliers\", \"products\" ],\n \"privileges\": [ \"create_doc\"]\n },\n {\n \"names\": [ \"inventory\" ],\n \"privileges\" : [ \"read\", \"write\" ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\" : [ \"read\", \"data:write/inventory\" ],\n \"resources\" : [ \"product/1852563\" ]\n }\n ]\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.has_privileges_user_profile(\n uids=[\n \"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0\",\n \"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1\",\n \"u_does-not-exist_0\"\n ],\n privileges={\n \"cluster\": [\n \"monitor\",\n \"create_snapshot\",\n \"manage_ml\"\n ],\n \"index\": [\n {\n \"names\": [\n \"suppliers\",\n \"products\"\n ],\n \"privileges\": [\n \"create_doc\"\n ]\n },\n {\n \"names\": [\n \"inventory\"\n ],\n \"privileges\": [\n \"read\",\n \"write\"\n ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\": [\n \"read\",\n \"data:write/inventory\"\n ],\n \"resources\": [\n \"product/1852563\"\n ]\n }\n ]\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.hasPrivilegesUserProfile({\n uids: [\n \"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0\",\n \"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1\",\n \"u_does-not-exist_0\",\n ],\n privileges: {\n cluster: [\"monitor\", \"create_snapshot\", \"manage_ml\"],\n index: [\n {\n names: [\"suppliers\", \"products\"],\n privileges: [\"create_doc\"],\n },\n {\n names: [\"inventory\"],\n privileges: [\"read\", \"write\"],\n },\n ],\n application: [\n {\n application: \"inventory_manager\",\n privileges: [\"read\", \"data:write/inventory\"],\n resources: [\"product/1852563\"],\n },\n ],\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.has_privileges_user_profile(\n body: {\n \"uids\": [\n \"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0\",\n \"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1\",\n \"u_does-not-exist_0\"\n ],\n \"privileges\": {\n \"cluster\": [\n \"monitor\",\n \"create_snapshot\",\n \"manage_ml\"\n ],\n \"index\": [\n {\n \"names\": [\n \"suppliers\",\n \"products\"\n ],\n \"privileges\": [\n \"create_doc\"\n ]\n },\n {\n \"names\": [\n \"inventory\"\n ],\n \"privileges\": [\n \"read\",\n \"write\"\n ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\": [\n \"read\",\n \"data:write/inventory\"\n ],\n \"resources\": [\n \"product/1852563\"\n ]\n }\n ]\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->hasPrivilegesUserProfile([\n \"body\" => [\n \"uids\" => array(\n \"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0\",\n \"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1\",\n \"u_does-not-exist_0\",\n ),\n \"privileges\" => [\n \"cluster\" => array(\n \"monitor\",\n \"create_snapshot\",\n \"manage_ml\",\n ),\n \"index\" => array(\n [\n \"names\" => array(\n \"suppliers\",\n \"products\",\n ),\n \"privileges\" => array(\n \"create_doc\",\n ),\n ],\n [\n \"names\" => array(\n \"inventory\",\n ),\n \"privileges\" => array(\n \"read\",\n \"write\",\n ),\n ],\n ),\n \"application\" => array(\n [\n \"application\" => \"inventory_manager\",\n \"privileges\" => array(\n \"read\",\n \"data:write/inventory\",\n ),\n \"resources\" => array(\n \"product/1852563\",\n ),\n ],\n ),\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"uids\":[\"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0\",\"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1\",\"u_does-not-exist_0\"],\"privileges\":{\"cluster\":[\"monitor\",\"create_snapshot\",\"manage_ml\"],\"index\":[{\"names\":[\"suppliers\",\"products\"],\"privileges\":[\"create_doc\"]},{\"names\":[\"inventory\"],\"privileges\":[\"read\",\"write\"]}],\"application\":[{\"application\":\"inventory_manager\",\"privileges\":[\"read\",\"data:write/inventory\"],\"resources\":[\"product/1852563\"]}]}}' \"$ELASTICSEARCH_URL/_security/profile/_has_privileges\"" } ] }, @@ -39734,6 +52510,26 @@ { "lang": "Console", "source": "POST /_security/profile/_has_privileges\n{\n \"uids\": [\n \"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0\",\n \"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1\",\n \"u_does-not-exist_0\"\n ],\n \"privileges\": {\n \"cluster\": [ \"monitor\", \"create_snapshot\", \"manage_ml\" ],\n \"index\" : [\n {\n \"names\": [ \"suppliers\", \"products\" ],\n \"privileges\": [ \"create_doc\"]\n },\n {\n \"names\": [ \"inventory\" ],\n \"privileges\" : [ \"read\", \"write\" ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\" : [ \"read\", \"data:write/inventory\" ],\n \"resources\" : [ \"product/1852563\" ]\n }\n ]\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.has_privileges_user_profile(\n uids=[\n \"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0\",\n \"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1\",\n \"u_does-not-exist_0\"\n ],\n privileges={\n \"cluster\": [\n \"monitor\",\n \"create_snapshot\",\n \"manage_ml\"\n ],\n \"index\": [\n {\n \"names\": [\n \"suppliers\",\n \"products\"\n ],\n \"privileges\": [\n \"create_doc\"\n ]\n },\n {\n \"names\": [\n \"inventory\"\n ],\n \"privileges\": [\n \"read\",\n \"write\"\n ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\": [\n \"read\",\n \"data:write/inventory\"\n ],\n \"resources\": [\n \"product/1852563\"\n ]\n }\n ]\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.hasPrivilegesUserProfile({\n uids: [\n \"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0\",\n \"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1\",\n \"u_does-not-exist_0\",\n ],\n privileges: {\n cluster: [\"monitor\", \"create_snapshot\", \"manage_ml\"],\n index: [\n {\n names: [\"suppliers\", \"products\"],\n privileges: [\"create_doc\"],\n },\n {\n names: [\"inventory\"],\n privileges: [\"read\", \"write\"],\n },\n ],\n application: [\n {\n application: \"inventory_manager\",\n privileges: [\"read\", \"data:write/inventory\"],\n resources: [\"product/1852563\"],\n },\n ],\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.has_privileges_user_profile(\n body: {\n \"uids\": [\n \"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0\",\n \"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1\",\n \"u_does-not-exist_0\"\n ],\n \"privileges\": {\n \"cluster\": [\n \"monitor\",\n \"create_snapshot\",\n \"manage_ml\"\n ],\n \"index\": [\n {\n \"names\": [\n \"suppliers\",\n \"products\"\n ],\n \"privileges\": [\n \"create_doc\"\n ]\n },\n {\n \"names\": [\n \"inventory\"\n ],\n \"privileges\": [\n \"read\",\n \"write\"\n ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\": [\n \"read\",\n \"data:write/inventory\"\n ],\n \"resources\": [\n \"product/1852563\"\n ]\n }\n ]\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->hasPrivilegesUserProfile([\n \"body\" => [\n \"uids\" => array(\n \"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0\",\n \"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1\",\n \"u_does-not-exist_0\",\n ),\n \"privileges\" => [\n \"cluster\" => array(\n \"monitor\",\n \"create_snapshot\",\n \"manage_ml\",\n ),\n \"index\" => array(\n [\n \"names\" => array(\n \"suppliers\",\n \"products\",\n ),\n \"privileges\" => array(\n \"create_doc\",\n ),\n ],\n [\n \"names\" => array(\n \"inventory\",\n ),\n \"privileges\" => array(\n \"read\",\n \"write\",\n ),\n ],\n ),\n \"application\" => array(\n [\n \"application\" => \"inventory_manager\",\n \"privileges\" => array(\n \"read\",\n \"data:write/inventory\",\n ),\n \"resources\" => array(\n \"product/1852563\",\n ),\n ],\n ),\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"uids\":[\"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0\",\"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1\",\"u_does-not-exist_0\"],\"privileges\":{\"cluster\":[\"monitor\",\"create_snapshot\",\"manage_ml\"],\"index\":[{\"names\":[\"suppliers\",\"products\"],\"privileges\":[\"create_doc\"]},{\"names\":[\"inventory\"],\"privileges\":[\"read\",\"write\"]}],\"application\":[{\"application\":\"inventory_manager\",\"privileges\":[\"read\",\"data:write/inventory\"],\"resources\":[\"product/1852563\"]}]}}' \"$ELASTICSEARCH_URL/_security/profile/_has_privileges\"" } ] } @@ -39831,6 +52627,26 @@ { "lang": "Console", "source": "POST /_security/oidc/authenticate\n{\n \"redirect_uri\" : \"https://oidc-kibana.elastic.co:5603/api/security/oidc/callback?code=jtI3Ntt8v3_XvcLzCFGq&state=4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\n \"state\" : \"4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\n \"nonce\" : \"WaBPH0KqPVdG5HHdSxPRjfoZbXMCicm5v1OiAj0DUFM\",\n \"realm\" : \"oidc1\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.oidc_authenticate(\n redirect_uri=\"https://oidc-kibana.elastic.co:5603/api/security/oidc/callback?code=jtI3Ntt8v3_XvcLzCFGq&state=4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\n state=\"4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\n nonce=\"WaBPH0KqPVdG5HHdSxPRjfoZbXMCicm5v1OiAj0DUFM\",\n realm=\"oidc1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.oidcAuthenticate({\n redirect_uri:\n \"https://oidc-kibana.elastic.co:5603/api/security/oidc/callback?code=jtI3Ntt8v3_XvcLzCFGq&state=4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\n state: \"4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\n nonce: \"WaBPH0KqPVdG5HHdSxPRjfoZbXMCicm5v1OiAj0DUFM\",\n realm: \"oidc1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.oidc_authenticate(\n body: {\n \"redirect_uri\": \"https://oidc-kibana.elastic.co:5603/api/security/oidc/callback?code=jtI3Ntt8v3_XvcLzCFGq&state=4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\n \"state\": \"4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\n \"nonce\": \"WaBPH0KqPVdG5HHdSxPRjfoZbXMCicm5v1OiAj0DUFM\",\n \"realm\": \"oidc1\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->oidcAuthenticate([\n \"body\" => [\n \"redirect_uri\" => \"https://oidc-kibana.elastic.co:5603/api/security/oidc/callback?code=jtI3Ntt8v3_XvcLzCFGq&state=4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\n \"state\" => \"4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\n \"nonce\" => \"WaBPH0KqPVdG5HHdSxPRjfoZbXMCicm5v1OiAj0DUFM\",\n \"realm\" => \"oidc1\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"redirect_uri\":\"https://oidc-kibana.elastic.co:5603/api/security/oidc/callback?code=jtI3Ntt8v3_XvcLzCFGq&state=4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\"state\":\"4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\"nonce\":\"WaBPH0KqPVdG5HHdSxPRjfoZbXMCicm5v1OiAj0DUFM\",\"realm\":\"oidc1\"}' \"$ELASTICSEARCH_URL/_security/oidc/authenticate\"" } ] } @@ -39903,6 +52719,26 @@ { "lang": "Console", "source": "POST /_security/oidc/logout\n{\n \"token\" : \"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\n \"refresh_token\": \"vLBPvmAB6KvwvJZr27cS\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.oidc_logout(\n token=\"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\n refresh_token=\"vLBPvmAB6KvwvJZr27cS\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.oidcLogout({\n token:\n \"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\n refresh_token: \"vLBPvmAB6KvwvJZr27cS\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.oidc_logout(\n body: {\n \"token\": \"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\n \"refresh_token\": \"vLBPvmAB6KvwvJZr27cS\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->oidcLogout([\n \"body\" => [\n \"token\" => \"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\n \"refresh_token\" => \"vLBPvmAB6KvwvJZr27cS\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"token\":\"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\"refresh_token\":\"vLBPvmAB6KvwvJZr27cS\"}' \"$ELASTICSEARCH_URL/_security/oidc/logout\"" } ] } @@ -40007,6 +52843,26 @@ { "lang": "Console", "source": "POST /_security/oidc/prepare\n{\n \"realm\" : \"oidc1\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.oidc_prepare_authentication(\n realm=\"oidc1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.oidcPrepareAuthentication({\n realm: \"oidc1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.oidc_prepare_authentication(\n body: {\n \"realm\": \"oidc1\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->oidcPrepareAuthentication([\n \"body\" => [\n \"realm\" => \"oidc1\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"realm\":\"oidc1\"}' \"$ELASTICSEARCH_URL/_security/oidc/prepare\"" } ] } @@ -40043,6 +52899,26 @@ { "lang": "Console", "source": "GET /_security/_query/api_key?with_limited_by=true\n{\n \"query\": {\n \"ids\": {\n \"values\": [\n \"VuaCfGcBCdbkQm-e5aOx\"\n ]\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.query_api_keys(\n with_limited_by=True,\n query={\n \"ids\": {\n \"values\": [\n \"VuaCfGcBCdbkQm-e5aOx\"\n ]\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.queryApiKeys({\n with_limited_by: \"true\",\n query: {\n ids: {\n values: [\"VuaCfGcBCdbkQm-e5aOx\"],\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.query_api_keys(\n with_limited_by: \"true\",\n body: {\n \"query\": {\n \"ids\": {\n \"values\": [\n \"VuaCfGcBCdbkQm-e5aOx\"\n ]\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->queryApiKeys([\n \"with_limited_by\" => \"true\",\n \"body\" => [\n \"query\" => [\n \"ids\" => [\n \"values\" => array(\n \"VuaCfGcBCdbkQm-e5aOx\",\n ),\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"ids\":{\"values\":[\"VuaCfGcBCdbkQm-e5aOx\"]}}}' \"$ELASTICSEARCH_URL/_security/_query/api_key?with_limited_by=true\"" } ] }, @@ -40077,6 +52953,26 @@ { "lang": "Console", "source": "GET /_security/_query/api_key?with_limited_by=true\n{\n \"query\": {\n \"ids\": {\n \"values\": [\n \"VuaCfGcBCdbkQm-e5aOx\"\n ]\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.query_api_keys(\n with_limited_by=True,\n query={\n \"ids\": {\n \"values\": [\n \"VuaCfGcBCdbkQm-e5aOx\"\n ]\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.queryApiKeys({\n with_limited_by: \"true\",\n query: {\n ids: {\n values: [\"VuaCfGcBCdbkQm-e5aOx\"],\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.query_api_keys(\n with_limited_by: \"true\",\n body: {\n \"query\": {\n \"ids\": {\n \"values\": [\n \"VuaCfGcBCdbkQm-e5aOx\"\n ]\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->queryApiKeys([\n \"with_limited_by\" => \"true\",\n \"body\" => [\n \"query\" => [\n \"ids\" => [\n \"values\" => array(\n \"VuaCfGcBCdbkQm-e5aOx\",\n ),\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"ids\":{\"values\":[\"VuaCfGcBCdbkQm-e5aOx\"]}}}' \"$ELASTICSEARCH_URL/_security/_query/api_key?with_limited_by=true\"" } ] } @@ -40102,6 +52998,26 @@ { "lang": "Console", "source": "POST /_security/_query/role\n{\n \"sort\": [\"name\"]\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.query_role(\n sort=[\n \"name\"\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.queryRole({\n sort: [\"name\"],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.query_role(\n body: {\n \"sort\": [\n \"name\"\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->queryRole([\n \"body\" => [\n \"sort\" => array(\n \"name\",\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"sort\":[\"name\"]}' \"$ELASTICSEARCH_URL/_security/_query/role\"" } ] }, @@ -40125,6 +53041,26 @@ { "lang": "Console", "source": "POST /_security/_query/role\n{\n \"sort\": [\"name\"]\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.query_role(\n sort=[\n \"name\"\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.queryRole({\n sort: [\"name\"],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.query_role(\n body: {\n \"sort\": [\n \"name\"\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->queryRole([\n \"body\" => [\n \"sort\" => array(\n \"name\",\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"sort\":[\"name\"]}' \"$ELASTICSEARCH_URL/_security/_query/role\"" } ] } @@ -40155,6 +53091,26 @@ { "lang": "Console", "source": "POST /_security/_query/user?with_profile_uid=true\n{\n \"query\": {\n \"prefix\": {\n \"roles\": \"other\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.query_user(\n with_profile_uid=True,\n query={\n \"prefix\": {\n \"roles\": \"other\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.queryUser({\n with_profile_uid: \"true\",\n query: {\n prefix: {\n roles: \"other\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.query_user(\n with_profile_uid: \"true\",\n body: {\n \"query\": {\n \"prefix\": {\n \"roles\": \"other\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->queryUser([\n \"with_profile_uid\" => \"true\",\n \"body\" => [\n \"query\" => [\n \"prefix\" => [\n \"roles\" => \"other\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"prefix\":{\"roles\":\"other\"}}}' \"$ELASTICSEARCH_URL/_security/_query/user?with_profile_uid=true\"" } ] }, @@ -40183,6 +53139,26 @@ { "lang": "Console", "source": "POST /_security/_query/user?with_profile_uid=true\n{\n \"query\": {\n \"prefix\": {\n \"roles\": \"other\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.query_user(\n with_profile_uid=True,\n query={\n \"prefix\": {\n \"roles\": \"other\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.queryUser({\n with_profile_uid: \"true\",\n query: {\n prefix: {\n roles: \"other\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.query_user(\n with_profile_uid: \"true\",\n body: {\n \"query\": {\n \"prefix\": {\n \"roles\": \"other\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->queryUser([\n \"with_profile_uid\" => \"true\",\n \"body\" => [\n \"query\" => [\n \"prefix\" => [\n \"roles\" => \"other\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"prefix\":{\"roles\":\"other\"}}}' \"$ELASTICSEARCH_URL/_security/_query/user?with_profile_uid=true\"" } ] } @@ -40283,6 +53259,26 @@ { "lang": "Console", "source": "POST /_security/saml/authenticate\n{\n \"content\" : \"PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....\",\n \"ids\" : [\"4fee3b046395c4e751011e97f8900b5273d56685\"]\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.saml_authenticate(\n content=\"PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....\",\n ids=[\n \"4fee3b046395c4e751011e97f8900b5273d56685\"\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.samlAuthenticate({\n content:\n \"PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....\",\n ids: [\"4fee3b046395c4e751011e97f8900b5273d56685\"],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.saml_authenticate(\n body: {\n \"content\": \"PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....\",\n \"ids\": [\n \"4fee3b046395c4e751011e97f8900b5273d56685\"\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->samlAuthenticate([\n \"body\" => [\n \"content\" => \"PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....\",\n \"ids\" => array(\n \"4fee3b046395c4e751011e97f8900b5273d56685\",\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"content\":\"PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....\",\"ids\":[\"4fee3b046395c4e751011e97f8900b5273d56685\"]}' \"$ELASTICSEARCH_URL/_security/saml/authenticate\"" } ] } @@ -40354,6 +53350,26 @@ { "lang": "Console", "source": "POST /_security/saml/complete_logout\n{\n \"realm\": \"saml1\",\n \"ids\": [ \"_1c368075e0b3...\" ],\n \"query_string\": \"SAMLResponse=fZHLasMwEEVbfb1bf...&SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=CuCmFn%2BLqnaZGZJqK...\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.saml_complete_logout(\n realm=\"saml1\",\n ids=[\n \"_1c368075e0b3...\"\n ],\n query_string=\"SAMLResponse=fZHLasMwEEVbfb1bf...&SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=CuCmFn%2BLqnaZGZJqK...\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.samlCompleteLogout({\n realm: \"saml1\",\n ids: [\"_1c368075e0b3...\"],\n query_string:\n \"SAMLResponse=fZHLasMwEEVbfb1bf...&SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=CuCmFn%2BLqnaZGZJqK...\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.saml_complete_logout(\n body: {\n \"realm\": \"saml1\",\n \"ids\": [\n \"_1c368075e0b3...\"\n ],\n \"query_string\": \"SAMLResponse=fZHLasMwEEVbfb1bf...&SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=CuCmFn%2BLqnaZGZJqK...\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->samlCompleteLogout([\n \"body\" => [\n \"realm\" => \"saml1\",\n \"ids\" => array(\n \"_1c368075e0b3...\",\n ),\n \"query_string\" => \"SAMLResponse=fZHLasMwEEVbfb1bf...&SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=CuCmFn%2BLqnaZGZJqK...\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"realm\":\"saml1\",\"ids\":[\"_1c368075e0b3...\"],\"query_string\":\"SAMLResponse=fZHLasMwEEVbfb1bf...&SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=CuCmFn%2BLqnaZGZJqK...\"}' \"$ELASTICSEARCH_URL/_security/saml/complete_logout\"" } ] } @@ -40444,6 +53460,26 @@ { "lang": "Console", "source": "POST /_security/saml/invalidate\n{\n \"query_string\" : \"SAMLRequest=nZFda4MwFIb%2FiuS%2BmviRpqFaClKQdbvo2g12M2KMraCJ9cRR9utnW4Wyi13sMie873MeznJ1aWrnS3VQGR0j4mLkKC1NUeljjA77zYyhVbIE0dR%2By7fmaHq7U%2BdegXWGpAZ%2B%2F4pR32luBFTAtWgUcCv56%2Fp5y30X87Yz1khTIycdgpUW9kY7WdsC9zxoXTvMvWuVV98YyMnSGH2SYE5pwALBIr9QKiwDGpW0oGVUznGeMyJZKFkQ4jBf5HnhUymjIhzCAL3KNFihbYx8TBYzzGaY7EnIyZwHzCWMfiDnbRIftkSjJr%2BFu0e9v%2B0EgOquRiiZjKpiVFp6j50T4WXoyNJ%2FEWC9fdqc1t%2F1%2B2F3aUpjzhPiXpqMz1%2FHSn4A&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256&Signature=MsAYz2NFdovMG2mXf6TSpu5vlQQyEJAg%2B4KCwBqJTmrb3yGXKUtIgvjqf88eCAK32v3eN8vupjPC8LglYmke1ZnjK0%2FKxzkvSjTVA7mMQe2AQdKbkyC038zzRq%2FYHcjFDE%2Bz0qISwSHZY2NyLePmwU7SexEXnIz37jKC6NMEhus%3D\",\n \"realm\" : \"saml1\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.saml_invalidate(\n query_string=\"SAMLRequest=nZFda4MwFIb%2FiuS%2BmviRpqFaClKQdbvo2g12M2KMraCJ9cRR9utnW4Wyi13sMie873MeznJ1aWrnS3VQGR0j4mLkKC1NUeljjA77zYyhVbIE0dR%2By7fmaHq7U%2BdegXWGpAZ%2B%2F4pR32luBFTAtWgUcCv56%2Fp5y30X87Yz1khTIycdgpUW9kY7WdsC9zxoXTvMvWuVV98YyMnSGH2SYE5pwALBIr9QKiwDGpW0oGVUznGeMyJZKFkQ4jBf5HnhUymjIhzCAL3KNFihbYx8TBYzzGaY7EnIyZwHzCWMfiDnbRIftkSjJr%2BFu0e9v%2B0EgOquRiiZjKpiVFp6j50T4WXoyNJ%2FEWC9fdqc1t%2F1%2B2F3aUpjzhPiXpqMz1%2FHSn4A&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256&Signature=MsAYz2NFdovMG2mXf6TSpu5vlQQyEJAg%2B4KCwBqJTmrb3yGXKUtIgvjqf88eCAK32v3eN8vupjPC8LglYmke1ZnjK0%2FKxzkvSjTVA7mMQe2AQdKbkyC038zzRq%2FYHcjFDE%2Bz0qISwSHZY2NyLePmwU7SexEXnIz37jKC6NMEhus%3D\",\n realm=\"saml1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.samlInvalidate({\n query_string:\n \"SAMLRequest=nZFda4MwFIb%2FiuS%2BmviRpqFaClKQdbvo2g12M2KMraCJ9cRR9utnW4Wyi13sMie873MeznJ1aWrnS3VQGR0j4mLkKC1NUeljjA77zYyhVbIE0dR%2By7fmaHq7U%2BdegXWGpAZ%2B%2F4pR32luBFTAtWgUcCv56%2Fp5y30X87Yz1khTIycdgpUW9kY7WdsC9zxoXTvMvWuVV98YyMnSGH2SYE5pwALBIr9QKiwDGpW0oGVUznGeMyJZKFkQ4jBf5HnhUymjIhzCAL3KNFihbYx8TBYzzGaY7EnIyZwHzCWMfiDnbRIftkSjJr%2BFu0e9v%2B0EgOquRiiZjKpiVFp6j50T4WXoyNJ%2FEWC9fdqc1t%2F1%2B2F3aUpjzhPiXpqMz1%2FHSn4A&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256&Signature=MsAYz2NFdovMG2mXf6TSpu5vlQQyEJAg%2B4KCwBqJTmrb3yGXKUtIgvjqf88eCAK32v3eN8vupjPC8LglYmke1ZnjK0%2FKxzkvSjTVA7mMQe2AQdKbkyC038zzRq%2FYHcjFDE%2Bz0qISwSHZY2NyLePmwU7SexEXnIz37jKC6NMEhus%3D\",\n realm: \"saml1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.saml_invalidate(\n body: {\n \"query_string\": \"SAMLRequest=nZFda4MwFIb%2FiuS%2BmviRpqFaClKQdbvo2g12M2KMraCJ9cRR9utnW4Wyi13sMie873MeznJ1aWrnS3VQGR0j4mLkKC1NUeljjA77zYyhVbIE0dR%2By7fmaHq7U%2BdegXWGpAZ%2B%2F4pR32luBFTAtWgUcCv56%2Fp5y30X87Yz1khTIycdgpUW9kY7WdsC9zxoXTvMvWuVV98YyMnSGH2SYE5pwALBIr9QKiwDGpW0oGVUznGeMyJZKFkQ4jBf5HnhUymjIhzCAL3KNFihbYx8TBYzzGaY7EnIyZwHzCWMfiDnbRIftkSjJr%2BFu0e9v%2B0EgOquRiiZjKpiVFp6j50T4WXoyNJ%2FEWC9fdqc1t%2F1%2B2F3aUpjzhPiXpqMz1%2FHSn4A&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256&Signature=MsAYz2NFdovMG2mXf6TSpu5vlQQyEJAg%2B4KCwBqJTmrb3yGXKUtIgvjqf88eCAK32v3eN8vupjPC8LglYmke1ZnjK0%2FKxzkvSjTVA7mMQe2AQdKbkyC038zzRq%2FYHcjFDE%2Bz0qISwSHZY2NyLePmwU7SexEXnIz37jKC6NMEhus%3D\",\n \"realm\": \"saml1\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->samlInvalidate([\n \"body\" => [\n \"query_string\" => \"SAMLRequest=nZFda4MwFIb%2FiuS%2BmviRpqFaClKQdbvo2g12M2KMraCJ9cRR9utnW4Wyi13sMie873MeznJ1aWrnS3VQGR0j4mLkKC1NUeljjA77zYyhVbIE0dR%2By7fmaHq7U%2BdegXWGpAZ%2B%2F4pR32luBFTAtWgUcCv56%2Fp5y30X87Yz1khTIycdgpUW9kY7WdsC9zxoXTvMvWuVV98YyMnSGH2SYE5pwALBIr9QKiwDGpW0oGVUznGeMyJZKFkQ4jBf5HnhUymjIhzCAL3KNFihbYx8TBYzzGaY7EnIyZwHzCWMfiDnbRIftkSjJr%2BFu0e9v%2B0EgOquRiiZjKpiVFp6j50T4WXoyNJ%2FEWC9fdqc1t%2F1%2B2F3aUpjzhPiXpqMz1%2FHSn4A&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256&Signature=MsAYz2NFdovMG2mXf6TSpu5vlQQyEJAg%2B4KCwBqJTmrb3yGXKUtIgvjqf88eCAK32v3eN8vupjPC8LglYmke1ZnjK0%2FKxzkvSjTVA7mMQe2AQdKbkyC038zzRq%2FYHcjFDE%2Bz0qISwSHZY2NyLePmwU7SexEXnIz37jKC6NMEhus%3D\",\n \"realm\" => \"saml1\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query_string\":\"SAMLRequest=nZFda4MwFIb%2FiuS%2BmviRpqFaClKQdbvo2g12M2KMraCJ9cRR9utnW4Wyi13sMie873MeznJ1aWrnS3VQGR0j4mLkKC1NUeljjA77zYyhVbIE0dR%2By7fmaHq7U%2BdegXWGpAZ%2B%2F4pR32luBFTAtWgUcCv56%2Fp5y30X87Yz1khTIycdgpUW9kY7WdsC9zxoXTvMvWuVV98YyMnSGH2SYE5pwALBIr9QKiwDGpW0oGVUznGeMyJZKFkQ4jBf5HnhUymjIhzCAL3KNFihbYx8TBYzzGaY7EnIyZwHzCWMfiDnbRIftkSjJr%2BFu0e9v%2B0EgOquRiiZjKpiVFp6j50T4WXoyNJ%2FEWC9fdqc1t%2F1%2B2F3aUpjzhPiXpqMz1%2FHSn4A&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256&Signature=MsAYz2NFdovMG2mXf6TSpu5vlQQyEJAg%2B4KCwBqJTmrb3yGXKUtIgvjqf88eCAK32v3eN8vupjPC8LglYmke1ZnjK0%2FKxzkvSjTVA7mMQe2AQdKbkyC038zzRq%2FYHcjFDE%2Bz0qISwSHZY2NyLePmwU7SexEXnIz37jKC6NMEhus%3D\",\"realm\":\"saml1\"}' \"$ELASTICSEARCH_URL/_security/saml/invalidate\"" } ] } @@ -40520,6 +53556,26 @@ { "lang": "Console", "source": "POST /_security/saml/logout\n{\n \"token\" : \"46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3\",\n \"refresh_token\" : \"mJdXLtmvTUSpoLwMvdBt_w\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.saml_logout(\n token=\"46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3\",\n refresh_token=\"mJdXLtmvTUSpoLwMvdBt_w\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.samlLogout({\n token: \"46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3\",\n refresh_token: \"mJdXLtmvTUSpoLwMvdBt_w\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.saml_logout(\n body: {\n \"token\": \"46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3\",\n \"refresh_token\": \"mJdXLtmvTUSpoLwMvdBt_w\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->samlLogout([\n \"body\" => [\n \"token\" => \"46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3\",\n \"refresh_token\" => \"mJdXLtmvTUSpoLwMvdBt_w\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"token\":\"46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3\",\"refresh_token\":\"mJdXLtmvTUSpoLwMvdBt_w\"}' \"$ELASTICSEARCH_URL/_security/saml/logout\"" } ] } @@ -40612,6 +53668,26 @@ { "lang": "Console", "source": "POST /_security/saml/prepare\n{\n \"realm\" : \"saml1\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.saml_prepare_authentication(\n realm=\"saml1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.samlPrepareAuthentication({\n realm: \"saml1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.saml_prepare_authentication(\n body: {\n \"realm\": \"saml1\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->samlPrepareAuthentication([\n \"body\" => [\n \"realm\" => \"saml1\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"realm\":\"saml1\"}' \"$ELASTICSEARCH_URL/_security/saml/prepare\"" } ] } @@ -40669,6 +53745,26 @@ { "lang": "Console", "source": "POST /_security/profile/u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0/_data\n" + }, + { + "lang": "Python", + "source": "resp = client.security.update_user_profile_data(\n uid=\"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.updateUserProfileData({\n uid: \"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.update_user_profile_data(\n uid: \"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->updateUserProfileData([\n \"uid\" => \"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/profile/u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0/_data\"" } ] } @@ -40699,6 +53795,26 @@ { "lang": "Console", "source": "POST /_security/profile/_suggest\n{\n \"name\": \"jack\", \n \"hint\": {\n \"uids\": [ \n \"u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0\",\n \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"\n ],\n \"labels\": {\n \"direction\": [\"north\", \"east\"] \n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.suggest_user_profiles(\n name=\"jack\",\n hint={\n \"uids\": [\n \"u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0\",\n \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"\n ],\n \"labels\": {\n \"direction\": [\n \"north\",\n \"east\"\n ]\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.suggestUserProfiles({\n name: \"jack\",\n hint: {\n uids: [\n \"u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0\",\n \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n ],\n labels: {\n direction: [\"north\", \"east\"],\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.suggest_user_profiles(\n body: {\n \"name\": \"jack\",\n \"hint\": {\n \"uids\": [\n \"u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0\",\n \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"\n ],\n \"labels\": {\n \"direction\": [\n \"north\",\n \"east\"\n ]\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->suggestUserProfiles([\n \"body\" => [\n \"name\" => \"jack\",\n \"hint\" => [\n \"uids\" => array(\n \"u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0\",\n \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n ),\n \"labels\" => [\n \"direction\" => array(\n \"north\",\n \"east\",\n ),\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"name\":\"jack\",\"hint\":{\"uids\":[\"u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0\",\"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"],\"labels\":{\"direction\":[\"north\",\"east\"]}}}' \"$ELASTICSEARCH_URL/_security/profile/_suggest\"" } ] }, @@ -40727,6 +53843,26 @@ { "lang": "Console", "source": "POST /_security/profile/_suggest\n{\n \"name\": \"jack\", \n \"hint\": {\n \"uids\": [ \n \"u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0\",\n \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"\n ],\n \"labels\": {\n \"direction\": [\"north\", \"east\"] \n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.suggest_user_profiles(\n name=\"jack\",\n hint={\n \"uids\": [\n \"u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0\",\n \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"\n ],\n \"labels\": {\n \"direction\": [\n \"north\",\n \"east\"\n ]\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.suggestUserProfiles({\n name: \"jack\",\n hint: {\n uids: [\n \"u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0\",\n \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n ],\n labels: {\n direction: [\"north\", \"east\"],\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.suggest_user_profiles(\n body: {\n \"name\": \"jack\",\n \"hint\": {\n \"uids\": [\n \"u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0\",\n \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"\n ],\n \"labels\": {\n \"direction\": [\n \"north\",\n \"east\"\n ]\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->suggestUserProfiles([\n \"body\" => [\n \"name\" => \"jack\",\n \"hint\" => [\n \"uids\" => array(\n \"u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0\",\n \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n ),\n \"labels\" => [\n \"direction\" => array(\n \"north\",\n \"east\",\n ),\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"name\":\"jack\",\"hint\":{\"uids\":[\"u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0\",\"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"],\"labels\":{\"direction\":[\"north\",\"east\"]}}}' \"$ELASTICSEARCH_URL/_security/profile/_suggest\"" } ] } @@ -40821,6 +53957,26 @@ { "lang": "Console", "source": "PUT /_security/api_key/VuaCfGcBCdbkQm-e5aOx\n{\n \"role_descriptors\": {\n \"role-a\": {\n \"indices\": [\n {\n \"names\": [\"*\"],\n \"privileges\": [\"write\"]\n }\n ]\n }\n },\n \"metadata\": {\n \"environment\": {\n \"level\": 2,\n \"trusted\": true,\n \"tags\": [\"production\"]\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.update_api_key(\n id=\"VuaCfGcBCdbkQm-e5aOx\",\n role_descriptors={\n \"role-a\": {\n \"indices\": [\n {\n \"names\": [\n \"*\"\n ],\n \"privileges\": [\n \"write\"\n ]\n }\n ]\n }\n },\n metadata={\n \"environment\": {\n \"level\": 2,\n \"trusted\": True,\n \"tags\": [\n \"production\"\n ]\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.updateApiKey({\n id: \"VuaCfGcBCdbkQm-e5aOx\",\n role_descriptors: {\n \"role-a\": {\n indices: [\n {\n names: [\"*\"],\n privileges: [\"write\"],\n },\n ],\n },\n },\n metadata: {\n environment: {\n level: 2,\n trusted: true,\n tags: [\"production\"],\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.update_api_key(\n id: \"VuaCfGcBCdbkQm-e5aOx\",\n body: {\n \"role_descriptors\": {\n \"role-a\": {\n \"indices\": [\n {\n \"names\": [\n \"*\"\n ],\n \"privileges\": [\n \"write\"\n ]\n }\n ]\n }\n },\n \"metadata\": {\n \"environment\": {\n \"level\": 2,\n \"trusted\": true,\n \"tags\": [\n \"production\"\n ]\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->updateApiKey([\n \"id\" => \"VuaCfGcBCdbkQm-e5aOx\",\n \"body\" => [\n \"role_descriptors\" => [\n \"role-a\" => [\n \"indices\" => array(\n [\n \"names\" => array(\n \"*\",\n ),\n \"privileges\" => array(\n \"write\",\n ),\n ],\n ),\n ],\n ],\n \"metadata\" => [\n \"environment\" => [\n \"level\" => 2,\n \"trusted\" => true,\n \"tags\" => array(\n \"production\",\n ),\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"role_descriptors\":{\"role-a\":{\"indices\":[{\"names\":[\"*\"],\"privileges\":[\"write\"]}]}},\"metadata\":{\"environment\":{\"level\":2,\"trusted\":true,\"tags\":[\"production\"]}}}' \"$ELASTICSEARCH_URL/_security/api_key/VuaCfGcBCdbkQm-e5aOx\"" } ] } @@ -40910,6 +54066,26 @@ { "lang": "Console", "source": "PUT /_security/cross_cluster/api_key/VuaCfGcBCdbkQm-e5aOx\n{\n \"access\": {\n \"replication\": [\n {\n \"names\": [\"archive\"]\n }\n ]\n },\n \"metadata\": {\n \"application\": \"replication\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.update_cross_cluster_api_key(\n id=\"VuaCfGcBCdbkQm-e5aOx\",\n access={\n \"replication\": [\n {\n \"names\": [\n \"archive\"\n ]\n }\n ]\n },\n metadata={\n \"application\": \"replication\"\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.updateCrossClusterApiKey({\n id: \"VuaCfGcBCdbkQm-e5aOx\",\n access: {\n replication: [\n {\n names: [\"archive\"],\n },\n ],\n },\n metadata: {\n application: \"replication\",\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.update_cross_cluster_api_key(\n id: \"VuaCfGcBCdbkQm-e5aOx\",\n body: {\n \"access\": {\n \"replication\": [\n {\n \"names\": [\n \"archive\"\n ]\n }\n ]\n },\n \"metadata\": {\n \"application\": \"replication\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->updateCrossClusterApiKey([\n \"id\" => \"VuaCfGcBCdbkQm-e5aOx\",\n \"body\" => [\n \"access\" => [\n \"replication\" => array(\n [\n \"names\" => array(\n \"archive\",\n ),\n ],\n ),\n ],\n \"metadata\" => [\n \"application\" => \"replication\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"access\":{\"replication\":[{\"names\":[\"archive\"]}]},\"metadata\":{\"application\":\"replication\"}}' \"$ELASTICSEARCH_URL/_security/cross_cluster/api_key/VuaCfGcBCdbkQm-e5aOx\"" } ] } @@ -40949,6 +54125,26 @@ { "lang": "Console", "source": "POST /_security/profile/u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0/_data\n{\n \"labels\": {\n \"direction\": \"east\"\n },\n \"data\": {\n \"app1\": {\n \"theme\": \"default\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.update_user_profile_data(\n uid=\"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\",\n labels={\n \"direction\": \"east\"\n },\n data={\n \"app1\": {\n \"theme\": \"default\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.updateUserProfileData({\n uid: \"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\",\n labels: {\n direction: \"east\",\n },\n data: {\n app1: {\n theme: \"default\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.update_user_profile_data(\n uid: \"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\",\n body: {\n \"labels\": {\n \"direction\": \"east\"\n },\n \"data\": {\n \"app1\": {\n \"theme\": \"default\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->updateUserProfileData([\n \"uid\" => \"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\",\n \"body\" => [\n \"labels\" => [\n \"direction\" => \"east\",\n ],\n \"data\" => [\n \"app1\" => [\n \"theme\" => \"default\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"labels\":{\"direction\":\"east\"},\"data\":{\"app1\":{\"theme\":\"default\"}}}' \"$ELASTICSEARCH_URL/_security/profile/u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0/_data\"" } ] }, @@ -40986,6 +54182,26 @@ { "lang": "Console", "source": "POST /_security/profile/u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0/_data\n{\n \"labels\": {\n \"direction\": \"east\"\n },\n \"data\": {\n \"app1\": {\n \"theme\": \"default\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.update_user_profile_data(\n uid=\"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\",\n labels={\n \"direction\": \"east\"\n },\n data={\n \"app1\": {\n \"theme\": \"default\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.updateUserProfileData({\n uid: \"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\",\n labels: {\n direction: \"east\",\n },\n data: {\n app1: {\n theme: \"default\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.update_user_profile_data(\n uid: \"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\",\n body: {\n \"labels\": {\n \"direction\": \"east\"\n },\n \"data\": {\n \"app1\": {\n \"theme\": \"default\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->updateUserProfileData([\n \"uid\" => \"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\",\n \"body\" => [\n \"labels\" => [\n \"direction\" => \"east\",\n ],\n \"data\" => [\n \"app1\" => [\n \"theme\" => \"default\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"labels\":{\"direction\":\"east\"},\"data\":{\"app1\":{\"theme\":\"default\"}}}' \"$ELASTICSEARCH_URL/_security/profile/u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0/_data\"" } ] } @@ -41016,6 +54232,26 @@ { "lang": "Console", "source": "GET /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown\n" + }, + { + "lang": "Python", + "source": "resp = client.shutdown.get_node(\n node_id=\"USpTGYaBSIKbgSUJR2Z9lg\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.shutdown.getNode({\n node_id: \"USpTGYaBSIKbgSUJR2Z9lg\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.shutdown.get_node(\n node_id: \"USpTGYaBSIKbgSUJR2Z9lg\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->shutdown()->getNode([\n \"node_id\" => \"USpTGYaBSIKbgSUJR2Z9lg\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown\"" } ] }, @@ -41113,6 +54349,26 @@ { "lang": "Console", "source": "PUT /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown\n{\n \"type\": \"restart\",\n \"reason\": \"Demonstrating how the node shutdown API works\",\n \"allocation_delay\": \"20m\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.shutdown.put_node(\n node_id=\"USpTGYaBSIKbgSUJR2Z9lg\",\n type=\"restart\",\n reason=\"Demonstrating how the node shutdown API works\",\n allocation_delay=\"20m\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.shutdown.putNode({\n node_id: \"USpTGYaBSIKbgSUJR2Z9lg\",\n type: \"restart\",\n reason: \"Demonstrating how the node shutdown API works\",\n allocation_delay: \"20m\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.shutdown.put_node(\n node_id: \"USpTGYaBSIKbgSUJR2Z9lg\",\n body: {\n \"type\": \"restart\",\n \"reason\": \"Demonstrating how the node shutdown API works\",\n \"allocation_delay\": \"20m\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->shutdown()->putNode([\n \"node_id\" => \"USpTGYaBSIKbgSUJR2Z9lg\",\n \"body\" => [\n \"type\" => \"restart\",\n \"reason\" => \"Demonstrating how the node shutdown API works\",\n \"allocation_delay\" => \"20m\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"type\":\"restart\",\"reason\":\"Demonstrating how the node shutdown API works\",\"allocation_delay\":\"20m\"}' \"$ELASTICSEARCH_URL/_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown\"" } ] }, @@ -41179,6 +54435,26 @@ { "lang": "Console", "source": "DELETE /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown\n" + }, + { + "lang": "Python", + "source": "resp = client.shutdown.delete_node(\n node_id=\"USpTGYaBSIKbgSUJR2Z9lg\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.shutdown.deleteNode({\n node_id: \"USpTGYaBSIKbgSUJR2Z9lg\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.shutdown.delete_node(\n node_id: \"USpTGYaBSIKbgSUJR2Z9lg\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->shutdown()->deleteNode([\n \"node_id\" => \"USpTGYaBSIKbgSUJR2Z9lg\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown\"" } ] } @@ -41206,6 +54482,26 @@ { "lang": "Console", "source": "GET /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown\n" + }, + { + "lang": "Python", + "source": "resp = client.shutdown.get_node(\n node_id=\"USpTGYaBSIKbgSUJR2Z9lg\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.shutdown.getNode({\n node_id: \"USpTGYaBSIKbgSUJR2Z9lg\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.shutdown.get_node(\n node_id: \"USpTGYaBSIKbgSUJR2Z9lg\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->shutdown()->getNode([\n \"node_id\" => \"USpTGYaBSIKbgSUJR2Z9lg\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown\"" } ] } @@ -41236,6 +54532,26 @@ { "lang": "Console", "source": "POST /_ingest/_simulate\n{\n \"docs\": [\n {\n \"_id\": 123,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_id\": 456,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.simulate.ingest(\n docs=[\n {\n \"_id\": 123,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_id\": 456,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.simulate.ingest({\n docs: [\n {\n _id: 123,\n _index: \"my-index\",\n _source: {\n foo: \"bar\",\n },\n },\n {\n _id: 456,\n _index: \"my-index\",\n _source: {\n foo: \"rab\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.simulate.ingest(\n body: {\n \"docs\": [\n {\n \"_id\": 123,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_id\": 456,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->simulate()->ingest([\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => 123,\n \"_index\" => \"my-index\",\n \"_source\" => [\n \"foo\" => \"bar\",\n ],\n ],\n [\n \"_id\" => 456,\n \"_index\" => \"my-index\",\n \"_source\" => [\n \"foo\" => \"rab\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":123,\"_index\":\"my-index\",\"_source\":{\"foo\":\"bar\"}},{\"_id\":456,\"_index\":\"my-index\",\"_source\":{\"foo\":\"rab\"}}]}' \"$ELASTICSEARCH_URL/_ingest/_simulate\"" } ] }, @@ -41264,6 +54580,26 @@ { "lang": "Console", "source": "POST /_ingest/_simulate\n{\n \"docs\": [\n {\n \"_id\": 123,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_id\": 456,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.simulate.ingest(\n docs=[\n {\n \"_id\": 123,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_id\": 456,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.simulate.ingest({\n docs: [\n {\n _id: 123,\n _index: \"my-index\",\n _source: {\n foo: \"bar\",\n },\n },\n {\n _id: 456,\n _index: \"my-index\",\n _source: {\n foo: \"rab\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.simulate.ingest(\n body: {\n \"docs\": [\n {\n \"_id\": 123,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_id\": 456,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->simulate()->ingest([\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => 123,\n \"_index\" => \"my-index\",\n \"_source\" => [\n \"foo\" => \"bar\",\n ],\n ],\n [\n \"_id\" => 456,\n \"_index\" => \"my-index\",\n \"_source\" => [\n \"foo\" => \"rab\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":123,\"_index\":\"my-index\",\"_source\":{\"foo\":\"bar\"}},{\"_id\":456,\"_index\":\"my-index\",\"_source\":{\"foo\":\"rab\"}}]}' \"$ELASTICSEARCH_URL/_ingest/_simulate\"" } ] } @@ -41297,6 +54633,26 @@ { "lang": "Console", "source": "POST /_ingest/_simulate\n{\n \"docs\": [\n {\n \"_id\": 123,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_id\": 456,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.simulate.ingest(\n docs=[\n {\n \"_id\": 123,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_id\": 456,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.simulate.ingest({\n docs: [\n {\n _id: 123,\n _index: \"my-index\",\n _source: {\n foo: \"bar\",\n },\n },\n {\n _id: 456,\n _index: \"my-index\",\n _source: {\n foo: \"rab\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.simulate.ingest(\n body: {\n \"docs\": [\n {\n \"_id\": 123,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_id\": 456,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->simulate()->ingest([\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => 123,\n \"_index\" => \"my-index\",\n \"_source\" => [\n \"foo\" => \"bar\",\n ],\n ],\n [\n \"_id\" => 456,\n \"_index\" => \"my-index\",\n \"_source\" => [\n \"foo\" => \"rab\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":123,\"_index\":\"my-index\",\"_source\":{\"foo\":\"bar\"}},{\"_id\":456,\"_index\":\"my-index\",\"_source\":{\"foo\":\"rab\"}}]}' \"$ELASTICSEARCH_URL/_ingest/_simulate\"" } ] }, @@ -41328,6 +54684,26 @@ { "lang": "Console", "source": "POST /_ingest/_simulate\n{\n \"docs\": [\n {\n \"_id\": 123,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_id\": 456,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.simulate.ingest(\n docs=[\n {\n \"_id\": 123,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_id\": 456,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.simulate.ingest({\n docs: [\n {\n _id: 123,\n _index: \"my-index\",\n _source: {\n foo: \"bar\",\n },\n },\n {\n _id: 456,\n _index: \"my-index\",\n _source: {\n foo: \"rab\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.simulate.ingest(\n body: {\n \"docs\": [\n {\n \"_id\": 123,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_id\": 456,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->simulate()->ingest([\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => 123,\n \"_index\" => \"my-index\",\n \"_source\" => [\n \"foo\" => \"bar\",\n ],\n ],\n [\n \"_id\" => 456,\n \"_index\" => \"my-index\",\n \"_source\" => [\n \"foo\" => \"rab\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":123,\"_index\":\"my-index\",\"_source\":{\"foo\":\"bar\"}},{\"_id\":456,\"_index\":\"my-index\",\"_source\":{\"foo\":\"rab\"}}]}' \"$ELASTICSEARCH_URL/_ingest/_simulate\"" } ] } @@ -41361,6 +54737,26 @@ { "lang": "Console", "source": "GET _slm/policy/daily-snapshots?human\n" + }, + { + "lang": "Python", + "source": "resp = client.slm.get_lifecycle(\n policy_id=\"daily-snapshots\",\n human=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.slm.getLifecycle({\n policy_id: \"daily-snapshots\",\n human: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.slm.get_lifecycle(\n policy_id: \"daily-snapshots\",\n human: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->slm()->getLifecycle([\n \"policy_id\" => \"daily-snapshots\",\n \"human\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_slm/policy/daily-snapshots?human\"" } ] }, @@ -41460,6 +54856,26 @@ { "lang": "Console", "source": "PUT /_slm/policy/daily-snapshots\n{\n \"schedule\": \"0 30 1 * * ?\",\n \"name\": \"\",\n \"repository\": \"my_repository\",\n \"config\": {\n \"indices\": [\"data-*\", \"important\"],\n \"ignore_unavailable\": false,\n \"include_global_state\": false\n },\n \"retention\": {\n \"expire_after\": \"30d\",\n \"min_count\": 5,\n \"max_count\": 50\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.slm.put_lifecycle(\n policy_id=\"daily-snapshots\",\n schedule=\"0 30 1 * * ?\",\n name=\"\",\n repository=\"my_repository\",\n config={\n \"indices\": [\n \"data-*\",\n \"important\"\n ],\n \"ignore_unavailable\": False,\n \"include_global_state\": False\n },\n retention={\n \"expire_after\": \"30d\",\n \"min_count\": 5,\n \"max_count\": 50\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.slm.putLifecycle({\n policy_id: \"daily-snapshots\",\n schedule: \"0 30 1 * * ?\",\n name: \"\",\n repository: \"my_repository\",\n config: {\n indices: [\"data-*\", \"important\"],\n ignore_unavailable: false,\n include_global_state: false,\n },\n retention: {\n expire_after: \"30d\",\n min_count: 5,\n max_count: 50,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.slm.put_lifecycle(\n policy_id: \"daily-snapshots\",\n body: {\n \"schedule\": \"0 30 1 * * ?\",\n \"name\": \"\",\n \"repository\": \"my_repository\",\n \"config\": {\n \"indices\": [\n \"data-*\",\n \"important\"\n ],\n \"ignore_unavailable\": false,\n \"include_global_state\": false\n },\n \"retention\": {\n \"expire_after\": \"30d\",\n \"min_count\": 5,\n \"max_count\": 50\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->slm()->putLifecycle([\n \"policy_id\" => \"daily-snapshots\",\n \"body\" => [\n \"schedule\" => \"0 30 1 * * ?\",\n \"name\" => \"\",\n \"repository\" => \"my_repository\",\n \"config\" => [\n \"indices\" => array(\n \"data-*\",\n \"important\",\n ),\n \"ignore_unavailable\" => false,\n \"include_global_state\" => false,\n ],\n \"retention\" => [\n \"expire_after\" => \"30d\",\n \"min_count\" => 5,\n \"max_count\" => 50,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"schedule\":\"0 30 1 * * ?\",\"name\":\"\",\"repository\":\"my_repository\",\"config\":{\"indices\":[\"data-*\",\"important\"],\"ignore_unavailable\":false,\"include_global_state\":false},\"retention\":{\"expire_after\":\"30d\",\"min_count\":5,\"max_count\":50}}' \"$ELASTICSEARCH_URL/_slm/policy/daily-snapshots\"" } ] }, @@ -41520,6 +54936,26 @@ { "lang": "Console", "source": "DELETE /_slm/policy/daily-snapshots\n" + }, + { + "lang": "Python", + "source": "resp = client.slm.delete_lifecycle(\n policy_id=\"daily-snapshots\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.slm.deleteLifecycle({\n policy_id: \"daily-snapshots\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.slm.delete_lifecycle(\n policy_id: \"daily-snapshots\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->slm()->deleteLifecycle([\n \"policy_id\" => \"daily-snapshots\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_slm/policy/daily-snapshots\"" } ] } @@ -41595,7 +55031,27 @@ "x-codeSamples": [ { "lang": "Console", - "source": "POST /_slm/policy/daily-snapshots/_execute\n" + "source": "PUT /_slm/policy/daily-snapshots/_execute\n" + }, + { + "lang": "Python", + "source": "resp = client.slm.execute_lifecycle(\n policy_id=\"daily-snapshots\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.slm.executeLifecycle({\n policy_id: \"daily-snapshots\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.slm.execute_lifecycle(\n policy_id: \"daily-snapshots\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->slm()->executeLifecycle([\n \"policy_id\" => \"daily-snapshots\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_slm/policy/daily-snapshots/_execute\"" } ] } @@ -41647,6 +55103,26 @@ { "lang": "Console", "source": "POST _slm/_execute_retention\n" + }, + { + "lang": "Python", + "source": "resp = client.slm.execute_retention()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.slm.executeRetention();" + }, + { + "lang": "Ruby", + "source": "response = client.slm.execute_retention" + }, + { + "lang": "PHP", + "source": "$resp = $client->slm()->executeRetention();" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_slm/_execute_retention\"" } ] } @@ -41677,6 +55153,26 @@ { "lang": "Console", "source": "GET _slm/policy/daily-snapshots?human\n" + }, + { + "lang": "Python", + "source": "resp = client.slm.get_lifecycle(\n policy_id=\"daily-snapshots\",\n human=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.slm.getLifecycle({\n policy_id: \"daily-snapshots\",\n human: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.slm.get_lifecycle(\n policy_id: \"daily-snapshots\",\n human: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->slm()->getLifecycle([\n \"policy_id\" => \"daily-snapshots\",\n \"human\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_slm/policy/daily-snapshots?human\"" } ] } @@ -41781,6 +55277,26 @@ { "lang": "Console", "source": "GET /_slm/stats\n" + }, + { + "lang": "Python", + "source": "resp = client.slm.get_stats()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.slm.getStats();" + }, + { + "lang": "Ruby", + "source": "response = client.slm.get_stats" + }, + { + "lang": "PHP", + "source": "$resp = $client->slm()->getStats();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_slm/stats\"" } ] } @@ -41846,6 +55362,26 @@ { "lang": "Console", "source": "GET _slm/status\n" + }, + { + "lang": "Python", + "source": "resp = client.slm.get_status()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.slm.getStatus();" + }, + { + "lang": "Ruby", + "source": "response = client.slm.get_status" + }, + { + "lang": "PHP", + "source": "$resp = $client->slm()->getStatus();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_slm/status\"" } ] } @@ -41903,6 +55439,26 @@ { "lang": "Console", "source": "POST _slm/start\n" + }, + { + "lang": "Python", + "source": "resp = client.slm.start()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.slm.start();" + }, + { + "lang": "Ruby", + "source": "response = client.slm.start" + }, + { + "lang": "PHP", + "source": "$resp = $client->slm()->start();" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_slm/start\"" } ] } @@ -42027,6 +55583,26 @@ { "lang": "Console", "source": "POST /_snapshot/my_repository/_cleanup\n" + }, + { + "lang": "Python", + "source": "resp = client.snapshot.cleanup_repository(\n name=\"my_repository\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.snapshot.cleanupRepository({\n name: \"my_repository\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.snapshot.cleanup_repository(\n repository: \"my_repository\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->snapshot()->cleanupRepository([\n \"repository\" => \"my_repository\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_repository/_cleanup\"" } ] } @@ -42126,6 +55702,26 @@ { "lang": "Console", "source": "PUT /_snapshot/my_repository/source_snapshot/_clone/target_snapshot\n{\n \"indices\": \"index_a,index_b\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.snapshot.clone(\n repository=\"my_repository\",\n snapshot=\"source_snapshot\",\n target_snapshot=\"target_snapshot\",\n indices=\"index_a,index_b\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.snapshot.clone({\n repository: \"my_repository\",\n snapshot: \"source_snapshot\",\n target_snapshot: \"target_snapshot\",\n indices: \"index_a,index_b\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.snapshot.clone(\n repository: \"my_repository\",\n snapshot: \"source_snapshot\",\n target_snapshot: \"target_snapshot\",\n body: {\n \"indices\": \"index_a,index_b\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->snapshot()->clone([\n \"repository\" => \"my_repository\",\n \"snapshot\" => \"source_snapshot\",\n \"target_snapshot\" => \"target_snapshot\",\n \"body\" => [\n \"indices\" => \"index_a,index_b\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"indices\":\"index_a,index_b\"}' \"$ELASTICSEARCH_URL/_snapshot/my_repository/source_snapshot/_clone/target_snapshot\"" } ] } @@ -42345,6 +55941,26 @@ { "lang": "Console", "source": "GET /_snapshot/my_repository/snapshot_*?sort=start_time&from_sort_value=1577833200000\n" + }, + { + "lang": "Python", + "source": "resp = client.snapshot.get(\n repository=\"my_repository\",\n snapshot=\"snapshot_*\",\n sort=\"start_time\",\n from_sort_value=\"1577833200000\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.snapshot.get({\n repository: \"my_repository\",\n snapshot: \"snapshot_*\",\n sort: \"start_time\",\n from_sort_value: 1577833200000,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.snapshot.get(\n repository: \"my_repository\",\n snapshot: \"snapshot_*\",\n sort: \"start_time\",\n from_sort_value: \"1577833200000\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->snapshot()->get([\n \"repository\" => \"my_repository\",\n \"snapshot\" => \"snapshot_*\",\n \"sort\" => \"start_time\",\n \"from_sort_value\" => \"1577833200000\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_repository/snapshot_*?sort=start_time&from_sort_value=1577833200000\"" } ] }, @@ -42385,6 +56001,26 @@ { "lang": "Console", "source": "PUT /_snapshot/my_repository/snapshot_2?wait_for_completion=true\n{\n \"indices\": \"index_1,index_2\",\n \"ignore_unavailable\": true,\n \"include_global_state\": false,\n \"metadata\": {\n \"taken_by\": \"user123\",\n \"taken_because\": \"backup before upgrading\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.snapshot.create(\n repository=\"my_repository\",\n snapshot=\"snapshot_2\",\n wait_for_completion=True,\n indices=\"index_1,index_2\",\n ignore_unavailable=True,\n include_global_state=False,\n metadata={\n \"taken_by\": \"user123\",\n \"taken_because\": \"backup before upgrading\"\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.snapshot.create({\n repository: \"my_repository\",\n snapshot: \"snapshot_2\",\n wait_for_completion: \"true\",\n indices: \"index_1,index_2\",\n ignore_unavailable: true,\n include_global_state: false,\n metadata: {\n taken_by: \"user123\",\n taken_because: \"backup before upgrading\",\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.snapshot.create(\n repository: \"my_repository\",\n snapshot: \"snapshot_2\",\n wait_for_completion: \"true\",\n body: {\n \"indices\": \"index_1,index_2\",\n \"ignore_unavailable\": true,\n \"include_global_state\": false,\n \"metadata\": {\n \"taken_by\": \"user123\",\n \"taken_because\": \"backup before upgrading\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->snapshot()->create([\n \"repository\" => \"my_repository\",\n \"snapshot\" => \"snapshot_2\",\n \"wait_for_completion\" => \"true\",\n \"body\" => [\n \"indices\" => \"index_1,index_2\",\n \"ignore_unavailable\" => true,\n \"include_global_state\" => false,\n \"metadata\" => [\n \"taken_by\" => \"user123\",\n \"taken_because\" => \"backup before upgrading\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"indices\":\"index_1,index_2\",\"ignore_unavailable\":true,\"include_global_state\":false,\"metadata\":{\"taken_by\":\"user123\",\"taken_because\":\"backup before upgrading\"}}' \"$ELASTICSEARCH_URL/_snapshot/my_repository/snapshot_2?wait_for_completion=true\"" } ] }, @@ -42425,6 +56061,26 @@ { "lang": "Console", "source": "PUT /_snapshot/my_repository/snapshot_2?wait_for_completion=true\n{\n \"indices\": \"index_1,index_2\",\n \"ignore_unavailable\": true,\n \"include_global_state\": false,\n \"metadata\": {\n \"taken_by\": \"user123\",\n \"taken_because\": \"backup before upgrading\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.snapshot.create(\n repository=\"my_repository\",\n snapshot=\"snapshot_2\",\n wait_for_completion=True,\n indices=\"index_1,index_2\",\n ignore_unavailable=True,\n include_global_state=False,\n metadata={\n \"taken_by\": \"user123\",\n \"taken_because\": \"backup before upgrading\"\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.snapshot.create({\n repository: \"my_repository\",\n snapshot: \"snapshot_2\",\n wait_for_completion: \"true\",\n indices: \"index_1,index_2\",\n ignore_unavailable: true,\n include_global_state: false,\n metadata: {\n taken_by: \"user123\",\n taken_because: \"backup before upgrading\",\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.snapshot.create(\n repository: \"my_repository\",\n snapshot: \"snapshot_2\",\n wait_for_completion: \"true\",\n body: {\n \"indices\": \"index_1,index_2\",\n \"ignore_unavailable\": true,\n \"include_global_state\": false,\n \"metadata\": {\n \"taken_by\": \"user123\",\n \"taken_because\": \"backup before upgrading\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->snapshot()->create([\n \"repository\" => \"my_repository\",\n \"snapshot\" => \"snapshot_2\",\n \"wait_for_completion\" => \"true\",\n \"body\" => [\n \"indices\" => \"index_1,index_2\",\n \"ignore_unavailable\" => true,\n \"include_global_state\" => false,\n \"metadata\" => [\n \"taken_by\" => \"user123\",\n \"taken_because\" => \"backup before upgrading\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"indices\":\"index_1,index_2\",\"ignore_unavailable\":true,\"include_global_state\":false,\"metadata\":{\"taken_by\":\"user123\",\"taken_because\":\"backup before upgrading\"}}' \"$ELASTICSEARCH_URL/_snapshot/my_repository/snapshot_2?wait_for_completion=true\"" } ] }, @@ -42491,6 +56147,26 @@ { "lang": "Console", "source": "DELETE /_snapshot/my_repository/snapshot_2,snapshot_3\n" + }, + { + "lang": "Python", + "source": "resp = client.snapshot.delete(\n repository=\"my_repository\",\n snapshot=\"snapshot_2,snapshot_3\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.snapshot.delete({\n repository: \"my_repository\",\n snapshot: \"snapshot_2,snapshot_3\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.snapshot.delete(\n repository: \"my_repository\",\n snapshot: \"snapshot_2,snapshot_3\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->snapshot()->delete([\n \"repository\" => \"my_repository\",\n \"snapshot\" => \"snapshot_2,snapshot_3\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_repository/snapshot_2,snapshot_3\"" } ] } @@ -42524,6 +56200,26 @@ { "lang": "Console", "source": "GET /_snapshot/my_repository\n" + }, + { + "lang": "Python", + "source": "resp = client.snapshot.get_repository(\n name=\"my_repository\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.snapshot.getRepository({\n name: \"my_repository\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.snapshot.get_repository(\n repository: \"my_repository\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->snapshot()->getRepository([\n \"repository\" => \"my_repository\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_repository\"" } ] }, @@ -42564,6 +56260,26 @@ { "lang": "Console", "source": "PUT /_snapshot/my_repository\n{\n \"type\": \"fs\",\n \"settings\": {\n \"location\": \"my_backup_location\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.snapshot.create_repository(\n name=\"my_repository\",\n repository={\n \"type\": \"fs\",\n \"settings\": {\n \"location\": \"my_backup_location\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.snapshot.createRepository({\n name: \"my_repository\",\n repository: {\n type: \"fs\",\n settings: {\n location: \"my_backup_location\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.snapshot.create_repository(\n repository: \"my_repository\",\n body: {\n \"type\": \"fs\",\n \"settings\": {\n \"location\": \"my_backup_location\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->snapshot()->createRepository([\n \"repository\" => \"my_repository\",\n \"body\" => [\n \"type\" => \"fs\",\n \"settings\" => [\n \"location\" => \"my_backup_location\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"type\":\"fs\",\"settings\":{\"location\":\"my_backup_location\"}}' \"$ELASTICSEARCH_URL/_snapshot/my_repository\"" } ] }, @@ -42604,6 +56320,26 @@ { "lang": "Console", "source": "PUT /_snapshot/my_repository\n{\n \"type\": \"fs\",\n \"settings\": {\n \"location\": \"my_backup_location\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.snapshot.create_repository(\n name=\"my_repository\",\n repository={\n \"type\": \"fs\",\n \"settings\": {\n \"location\": \"my_backup_location\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.snapshot.createRepository({\n name: \"my_repository\",\n repository: {\n type: \"fs\",\n settings: {\n location: \"my_backup_location\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.snapshot.create_repository(\n repository: \"my_repository\",\n body: {\n \"type\": \"fs\",\n \"settings\": {\n \"location\": \"my_backup_location\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->snapshot()->createRepository([\n \"repository\" => \"my_repository\",\n \"body\" => [\n \"type\" => \"fs\",\n \"settings\" => [\n \"location\" => \"my_backup_location\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"type\":\"fs\",\"settings\":{\"location\":\"my_backup_location\"}}' \"$ELASTICSEARCH_URL/_snapshot/my_repository\"" } ] }, @@ -42664,6 +56400,26 @@ { "lang": "Console", "source": "DELETE /_snapshot/my_repository\n" + }, + { + "lang": "Python", + "source": "resp = client.snapshot.delete_repository(\n name=\"my_repository\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.snapshot.deleteRepository({\n name: \"my_repository\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.snapshot.delete_repository(\n repository: \"my_repository\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->snapshot()->deleteRepository([\n \"repository\" => \"my_repository\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_repository\"" } ] } @@ -42694,6 +56450,26 @@ { "lang": "Console", "source": "GET /_snapshot/my_repository\n" + }, + { + "lang": "Python", + "source": "resp = client.snapshot.get_repository(\n name=\"my_repository\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.snapshot.getRepository({\n name: \"my_repository\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.snapshot.get_repository(\n repository: \"my_repository\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->snapshot()->getRepository([\n \"repository\" => \"my_repository\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_repository\"" } ] } @@ -42954,6 +56730,26 @@ { "lang": "Console", "source": "POST /_snapshot/my_repository/_analyze?blob_count=10&max_blob_size=1mb&timeout=120s\n" + }, + { + "lang": "Python", + "source": "resp = client.snapshot.repository_analyze(\n name=\"my_repository\",\n blob_count=\"10\",\n max_blob_size=\"1mb\",\n timeout=\"120s\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.snapshot.repositoryAnalyze({\n name: \"my_repository\",\n blob_count: 10,\n max_blob_size: \"1mb\",\n timeout: \"120s\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.snapshot.repository_analyze(\n repository: \"my_repository\",\n blob_count: \"10\",\n max_blob_size: \"1mb\",\n timeout: \"120s\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->snapshot()->repositoryAnalyze([\n \"repository\" => \"my_repository\",\n \"blob_count\" => \"10\",\n \"max_blob_size\" => \"1mb\",\n \"timeout\" => \"120s\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_repository/_analyze?blob_count=10&max_blob_size=1mb&timeout=120s\"" } ] } @@ -43111,6 +56907,26 @@ { "lang": "Console", "source": "POST /_snapshot/my_repository/snapshot_2/_restore?wait_for_completion=true\n{\n \"indices\": \"index_1,index_2\",\n \"ignore_unavailable\": true,\n \"include_global_state\": false,\n \"rename_pattern\": \"index_(.+)\",\n \"rename_replacement\": \"restored_index_$1\",\n \"include_aliases\": false\n}" + }, + { + "lang": "Python", + "source": "resp = client.snapshot.restore(\n repository=\"my_repository\",\n snapshot=\"snapshot_2\",\n wait_for_completion=True,\n indices=\"index_1,index_2\",\n ignore_unavailable=True,\n include_global_state=False,\n rename_pattern=\"index_(.+)\",\n rename_replacement=\"restored_index_$1\",\n include_aliases=False,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.snapshot.restore({\n repository: \"my_repository\",\n snapshot: \"snapshot_2\",\n wait_for_completion: \"true\",\n indices: \"index_1,index_2\",\n ignore_unavailable: true,\n include_global_state: false,\n rename_pattern: \"index_(.+)\",\n rename_replacement: \"restored_index_$1\",\n include_aliases: false,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.snapshot.restore(\n repository: \"my_repository\",\n snapshot: \"snapshot_2\",\n wait_for_completion: \"true\",\n body: {\n \"indices\": \"index_1,index_2\",\n \"ignore_unavailable\": true,\n \"include_global_state\": false,\n \"rename_pattern\": \"index_(.+)\",\n \"rename_replacement\": \"restored_index_$1\",\n \"include_aliases\": false\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->snapshot()->restore([\n \"repository\" => \"my_repository\",\n \"snapshot\" => \"snapshot_2\",\n \"wait_for_completion\" => \"true\",\n \"body\" => [\n \"indices\" => \"index_1,index_2\",\n \"ignore_unavailable\" => true,\n \"include_global_state\" => false,\n \"rename_pattern\" => \"index_(.+)\",\n \"rename_replacement\" => \"restored_index_$1\",\n \"include_aliases\" => false,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"indices\":\"index_1,index_2\",\"ignore_unavailable\":true,\"include_global_state\":false,\"rename_pattern\":\"index_(.+)\",\"rename_replacement\":\"restored_index_$1\",\"include_aliases\":false}' \"$ELASTICSEARCH_URL/_snapshot/my_repository/snapshot_2/_restore?wait_for_completion=true\"" } ] } @@ -43141,6 +56957,26 @@ { "lang": "Console", "source": "GET _snapshot/my_repository/snapshot_2/_status\n" + }, + { + "lang": "Python", + "source": "resp = client.snapshot.status(\n repository=\"my_repository\",\n snapshot=\"snapshot_2\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.snapshot.status({\n repository: \"my_repository\",\n snapshot: \"snapshot_2\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.snapshot.status(\n repository: \"my_repository\",\n snapshot: \"snapshot_2\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->snapshot()->status([\n \"repository\" => \"my_repository\",\n \"snapshot\" => \"snapshot_2\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_repository/snapshot_2/_status\"" } ] } @@ -43174,6 +57010,26 @@ { "lang": "Console", "source": "GET _snapshot/my_repository/snapshot_2/_status\n" + }, + { + "lang": "Python", + "source": "resp = client.snapshot.status(\n repository=\"my_repository\",\n snapshot=\"snapshot_2\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.snapshot.status({\n repository: \"my_repository\",\n snapshot: \"snapshot_2\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.snapshot.status(\n repository: \"my_repository\",\n snapshot: \"snapshot_2\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->snapshot()->status([\n \"repository\" => \"my_repository\",\n \"snapshot\" => \"snapshot_2\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_repository/snapshot_2/_status\"" } ] } @@ -43210,6 +57066,26 @@ { "lang": "Console", "source": "GET _snapshot/my_repository/snapshot_2/_status\n" + }, + { + "lang": "Python", + "source": "resp = client.snapshot.status(\n repository=\"my_repository\",\n snapshot=\"snapshot_2\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.snapshot.status({\n repository: \"my_repository\",\n snapshot: \"snapshot_2\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.snapshot.status(\n repository: \"my_repository\",\n snapshot: \"snapshot_2\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->snapshot()->status([\n \"repository\" => \"my_repository\",\n \"snapshot\" => \"snapshot_2\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_repository/snapshot_2/_status\"" } ] } @@ -43287,6 +57163,26 @@ { "lang": "Console", "source": "POST _snapshot/my_unverified_backup/_verify\n" + }, + { + "lang": "Python", + "source": "resp = client.snapshot.verify_repository(\n name=\"my_unverified_backup\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.snapshot.verifyRepository({\n name: \"my_unverified_backup\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.snapshot.verify_repository(\n repository: \"my_unverified_backup\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->snapshot()->verifyRepository([\n \"repository\" => \"my_unverified_backup\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_unverified_backup/_verify\"" } ] } @@ -43348,6 +57244,26 @@ { "lang": "Console", "source": "POST _sql/close\n{\n \"cursor\": \"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.sql.clear_cursor(\n cursor=\"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.sql.clearCursor({\n cursor:\n \"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.sql.clear_cursor(\n body: {\n \"cursor\": \"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->sql()->clearCursor([\n \"body\" => [\n \"cursor\" => \"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"cursor\":\"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\"}' \"$ELASTICSEARCH_URL/_sql/close\"" } ] } @@ -43390,6 +57306,26 @@ { "lang": "Console", "source": "DELETE _sql/async/delete/FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\n" + }, + { + "lang": "Python", + "source": "resp = client.sql.delete_async(\n id=\"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.sql.deleteAsync({\n id: \"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.sql.delete_async(\n id: \"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->sql()->deleteAsync([\n \"id\" => \"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_sql/async/delete/FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\"" } ] } @@ -43509,6 +57445,26 @@ { "lang": "Console", "source": "GET _sql/async/FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=?wait_for_completion_timeout=2s&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.sql.get_async(\n id=\"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n wait_for_completion_timeout=\"2s\",\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.sql.getAsync({\n id: \"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n wait_for_completion_timeout: \"2s\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.sql.get_async(\n id: \"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n wait_for_completion_timeout: \"2s\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->sql()->getAsync([\n \"id\" => \"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n \"wait_for_completion_timeout\" => \"2s\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_sql/async/FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=?wait_for_completion_timeout=2s&format=json\"" } ] } @@ -43581,6 +57537,26 @@ { "lang": "Console", "source": "GET _sql/async/status/FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\n" + }, + { + "lang": "Python", + "source": "resp = client.sql.get_async_status(\n id=\"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.sql.getAsyncStatus({\n id: \"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.sql.get_async_status(\n id: \"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->sql()->getAsyncStatus([\n \"id\" => \"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_sql/async/status/FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\"" } ] } @@ -43611,6 +57587,26 @@ { "lang": "Console", "source": "POST _sql?format=txt\n{\n \"query\": \"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.sql.query(\n format=\"txt\",\n query=\"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.sql.query({\n format: \"txt\",\n query: \"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.sql.query(\n format: \"txt\",\n body: {\n \"query\": \"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->sql()->query([\n \"format\" => \"txt\",\n \"body\" => [\n \"query\" => \"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":\"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\"}' \"$ELASTICSEARCH_URL/_sql?format=txt\"" } ] }, @@ -43639,6 +57635,26 @@ { "lang": "Console", "source": "POST _sql?format=txt\n{\n \"query\": \"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.sql.query(\n format=\"txt\",\n query=\"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.sql.query({\n format: \"txt\",\n query: \"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.sql.query(\n format: \"txt\",\n body: {\n \"query\": \"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->sql()->query([\n \"format\" => \"txt\",\n \"body\" => [\n \"query\" => \"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":\"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\"}' \"$ELASTICSEARCH_URL/_sql?format=txt\"" } ] } @@ -43664,6 +57680,26 @@ { "lang": "Console", "source": "POST _sql/translate\n{\n \"query\": \"SELECT * FROM library ORDER BY page_count DESC\",\n \"fetch_size\": 10\n}" + }, + { + "lang": "Python", + "source": "resp = client.sql.translate(\n query=\"SELECT * FROM library ORDER BY page_count DESC\",\n fetch_size=10,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.sql.translate({\n query: \"SELECT * FROM library ORDER BY page_count DESC\",\n fetch_size: 10,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.sql.translate(\n body: {\n \"query\": \"SELECT * FROM library ORDER BY page_count DESC\",\n \"fetch_size\": 10\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->sql()->translate([\n \"body\" => [\n \"query\" => \"SELECT * FROM library ORDER BY page_count DESC\",\n \"fetch_size\" => 10,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":\"SELECT * FROM library ORDER BY page_count DESC\",\"fetch_size\":10}' \"$ELASTICSEARCH_URL/_sql/translate\"" } ] }, @@ -43687,6 +57723,26 @@ { "lang": "Console", "source": "POST _sql/translate\n{\n \"query\": \"SELECT * FROM library ORDER BY page_count DESC\",\n \"fetch_size\": 10\n}" + }, + { + "lang": "Python", + "source": "resp = client.sql.translate(\n query=\"SELECT * FROM library ORDER BY page_count DESC\",\n fetch_size=10,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.sql.translate({\n query: \"SELECT * FROM library ORDER BY page_count DESC\",\n fetch_size: 10,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.sql.translate(\n body: {\n \"query\": \"SELECT * FROM library ORDER BY page_count DESC\",\n \"fetch_size\": 10\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->sql()->translate([\n \"body\" => [\n \"query\" => \"SELECT * FROM library ORDER BY page_count DESC\",\n \"fetch_size\" => 10,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":\"SELECT * FROM library ORDER BY page_count DESC\",\"fetch_size\":10}' \"$ELASTICSEARCH_URL/_sql/translate\"" } ] } @@ -43728,6 +57784,26 @@ { "lang": "Console", "source": "GET /_ssl/certificates\n" + }, + { + "lang": "Python", + "source": "resp = client.ssl.certificates()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ssl.certificates();" + }, + { + "lang": "Ruby", + "source": "response = client.ssl.certificates" + }, + { + "lang": "PHP", + "source": "$resp = $client->ssl()->certificates();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ssl/certificates\"" } ] } @@ -43813,6 +57889,26 @@ { "lang": "Console", "source": "GET _synonyms/my-synonyms-set\n" + }, + { + "lang": "Python", + "source": "resp = client.synonyms.get_synonym(\n id=\"my-synonyms-set\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.synonyms.getSynonym({\n id: \"my-synonyms-set\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.synonyms.get_synonym(\n id: \"my-synonyms-set\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->synonyms()->getSynonym([\n \"id\" => \"my-synonyms-set\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set\"" } ] }, @@ -43894,6 +57990,26 @@ { "lang": "Console", "source": "PUT _synonyms/my-synonyms-set\n" + }, + { + "lang": "Python", + "source": "resp = client.synonyms.put_synonym(\n id=\"my-synonyms-set\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.synonyms.putSynonym({\n id: \"my-synonyms-set\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.synonyms.put_synonym(\n id: \"my-synonyms-set\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->synonyms()->putSynonym([\n \"id\" => \"my-synonyms-set\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set\"" } ] }, @@ -43934,6 +58050,26 @@ { "lang": "Console", "source": "DELETE _synonyms/my-synonyms-set\n" + }, + { + "lang": "Python", + "source": "resp = client.synonyms.delete_synonym(\n id=\"my-synonyms-set\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.synonyms.deleteSynonym({\n id: \"my-synonyms-set\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.synonyms.delete_synonym(\n id: \"my-synonyms-set\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->synonyms()->deleteSynonym([\n \"id\" => \"my-synonyms-set\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set\"" } ] } @@ -43993,6 +58129,26 @@ { "lang": "Console", "source": "GET _synonyms/my-synonyms-set/test-1\n" + }, + { + "lang": "Python", + "source": "resp = client.synonyms.get_synonym_rule(\n set_id=\"my-synonyms-set\",\n rule_id=\"test-1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.synonyms.getSynonymRule({\n set_id: \"my-synonyms-set\",\n rule_id: \"test-1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.synonyms.get_synonym_rule(\n set_id: \"my-synonyms-set\",\n rule_id: \"test-1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->synonyms()->getSynonymRule([\n \"set_id\" => \"my-synonyms-set\",\n \"rule_id\" => \"test-1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set/test-1\"" } ] }, @@ -44075,6 +58231,26 @@ { "lang": "Console", "source": "PUT _synonyms/my-synonyms-set/test-1\n{\n \"synonyms\": \"hello, hi, howdy\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.synonyms.put_synonym_rule(\n set_id=\"my-synonyms-set\",\n rule_id=\"test-1\",\n synonyms=\"hello, hi, howdy\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.synonyms.putSynonymRule({\n set_id: \"my-synonyms-set\",\n rule_id: \"test-1\",\n synonyms: \"hello, hi, howdy\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.synonyms.put_synonym_rule(\n set_id: \"my-synonyms-set\",\n rule_id: \"test-1\",\n body: {\n \"synonyms\": \"hello, hi, howdy\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->synonyms()->putSynonymRule([\n \"set_id\" => \"my-synonyms-set\",\n \"rule_id\" => \"test-1\",\n \"body\" => [\n \"synonyms\" => \"hello, hi, howdy\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"synonyms\":\"hello, hi, howdy\"}' \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set/test-1\"" } ] }, @@ -44132,6 +58308,26 @@ { "lang": "Console", "source": "DELETE _synonyms/my-synonyms-set/test-1\n" + }, + { + "lang": "Python", + "source": "resp = client.synonyms.delete_synonym_rule(\n set_id=\"my-synonyms-set\",\n rule_id=\"test-1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.synonyms.deleteSynonymRule({\n set_id: \"my-synonyms-set\",\n rule_id: \"test-1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.synonyms.delete_synonym_rule(\n set_id: \"my-synonyms-set\",\n rule_id: \"test-1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->synonyms()->deleteSynonymRule([\n \"set_id\" => \"my-synonyms-set\",\n \"rule_id\" => \"test-1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set/test-1\"" } ] } @@ -44206,6 +58402,26 @@ { "lang": "Console", "source": "GET _synonyms\n" + }, + { + "lang": "Python", + "source": "resp = client.synonyms.get_synonyms_sets()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.synonyms.getSynonymsSets();" + }, + { + "lang": "Ruby", + "source": "response = client.synonyms.get_synonyms_sets" + }, + { + "lang": "PHP", + "source": "$resp = $client->synonyms()->getSynonymsSets();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_synonyms\"" } ] } @@ -44242,6 +58458,26 @@ { "lang": "Console", "source": "POST _tasks//_cancel\n" + }, + { + "lang": "Python", + "source": "resp = client.tasks.cancel(\n task_id=\"\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.tasks.cancel({\n task_id: \"\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.tasks.cancel(\n task_id: \"\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->tasks()->cancel([\n \"task_id\" => \"\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_tasks//_cancel\"" } ] } @@ -44281,6 +58517,26 @@ { "lang": "Console", "source": "POST _tasks//_cancel\n" + }, + { + "lang": "Python", + "source": "resp = client.tasks.cancel(\n task_id=\"\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.tasks.cancel({\n task_id: \"\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.tasks.cancel(\n task_id: \"\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->tasks()->cancel([\n \"task_id\" => \"\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_tasks//_cancel\"" } ] } @@ -44373,6 +58629,26 @@ { "lang": "Console", "source": "GET _tasks?detailed=true&actions=*/delete/byquery\n" + }, + { + "lang": "Python", + "source": "resp = client.tasks.list(\n detailed=True,\n actions=\"*/delete/byquery\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.tasks.list({\n detailed: \"true\",\n actions: \"*/delete/byquery\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.tasks.list(\n detailed: \"true\",\n actions: \"*/delete/byquery\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->tasks()->list([\n \"detailed\" => \"true\",\n \"actions\" => \"*/delete/byquery\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_tasks?detailed=true&actions=*/delete/byquery\"" } ] } @@ -44490,6 +58766,26 @@ { "lang": "Console", "source": "GET _tasks?actions=*search&detailed\n" + }, + { + "lang": "Python", + "source": "resp = client.tasks.list(\n actions=\"*search\",\n detailed=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.tasks.list({\n actions: \"*search\",\n detailed: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.tasks.list(\n actions: \"*search\",\n detailed: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->tasks()->list([\n \"actions\" => \"*search\",\n \"detailed\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_tasks?actions=*search&detailed\"" } ] } @@ -44520,6 +58816,26 @@ { "lang": "Console", "source": "POST stackoverflow/_terms_enum\n{\n \"field\" : \"tags\",\n \"string\" : \"kiba\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.terms_enum(\n index=\"stackoverflow\",\n field=\"tags\",\n string=\"kiba\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.termsEnum({\n index: \"stackoverflow\",\n field: \"tags\",\n string: \"kiba\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.terms_enum(\n index: \"stackoverflow\",\n body: {\n \"field\": \"tags\",\n \"string\": \"kiba\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->termsEnum([\n \"index\" => \"stackoverflow\",\n \"body\" => [\n \"field\" => \"tags\",\n \"string\" => \"kiba\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"field\":\"tags\",\"string\":\"kiba\"}' \"$ELASTICSEARCH_URL/stackoverflow/_terms_enum\"" } ] }, @@ -44548,6 +58864,26 @@ { "lang": "Console", "source": "POST stackoverflow/_terms_enum\n{\n \"field\" : \"tags\",\n \"string\" : \"kiba\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.terms_enum(\n index=\"stackoverflow\",\n field=\"tags\",\n string=\"kiba\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.termsEnum({\n index: \"stackoverflow\",\n field: \"tags\",\n string: \"kiba\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.terms_enum(\n index: \"stackoverflow\",\n body: {\n \"field\": \"tags\",\n \"string\": \"kiba\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->termsEnum([\n \"index\" => \"stackoverflow\",\n \"body\" => [\n \"field\" => \"tags\",\n \"string\" => \"kiba\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"field\":\"tags\",\"string\":\"kiba\"}' \"$ELASTICSEARCH_URL/stackoverflow/_terms_enum\"" } ] } @@ -44616,6 +58952,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_termvectors/1\n{\n \"fields\" : [\"text\"],\n \"offsets\" : true,\n \"payloads\" : true,\n \"positions\" : true,\n \"term_statistics\" : true,\n \"field_statistics\" : true\n}" + }, + { + "lang": "Python", + "source": "resp = client.termvectors(\n index=\"my-index-000001\",\n id=\"1\",\n fields=[\n \"text\"\n ],\n offsets=True,\n payloads=True,\n positions=True,\n term_statistics=True,\n field_statistics=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.termvectors({\n index: \"my-index-000001\",\n id: 1,\n fields: [\"text\"],\n offsets: true,\n payloads: true,\n positions: true,\n term_statistics: true,\n field_statistics: true,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.termvectors(\n index: \"my-index-000001\",\n id: \"1\",\n body: {\n \"fields\": [\n \"text\"\n ],\n \"offsets\": true,\n \"payloads\": true,\n \"positions\": true,\n \"term_statistics\": true,\n \"field_statistics\": true\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->termvectors([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"body\" => [\n \"fields\" => array(\n \"text\",\n ),\n \"offsets\" => true,\n \"payloads\" => true,\n \"positions\" => true,\n \"term_statistics\" => true,\n \"field_statistics\" => true,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"fields\":[\"text\"],\"offsets\":true,\"payloads\":true,\"positions\":true,\"term_statistics\":true,\"field_statistics\":true}' \"$ELASTICSEARCH_URL/my-index-000001/_termvectors/1\"" } ] }, @@ -44682,6 +59038,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_termvectors/1\n{\n \"fields\" : [\"text\"],\n \"offsets\" : true,\n \"payloads\" : true,\n \"positions\" : true,\n \"term_statistics\" : true,\n \"field_statistics\" : true\n}" + }, + { + "lang": "Python", + "source": "resp = client.termvectors(\n index=\"my-index-000001\",\n id=\"1\",\n fields=[\n \"text\"\n ],\n offsets=True,\n payloads=True,\n positions=True,\n term_statistics=True,\n field_statistics=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.termvectors({\n index: \"my-index-000001\",\n id: 1,\n fields: [\"text\"],\n offsets: true,\n payloads: true,\n positions: true,\n term_statistics: true,\n field_statistics: true,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.termvectors(\n index: \"my-index-000001\",\n id: \"1\",\n body: {\n \"fields\": [\n \"text\"\n ],\n \"offsets\": true,\n \"payloads\": true,\n \"positions\": true,\n \"term_statistics\": true,\n \"field_statistics\": true\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->termvectors([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"body\" => [\n \"fields\" => array(\n \"text\",\n ),\n \"offsets\" => true,\n \"payloads\" => true,\n \"positions\" => true,\n \"term_statistics\" => true,\n \"field_statistics\" => true,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"fields\":[\"text\"],\"offsets\":true,\"payloads\":true,\"positions\":true,\"term_statistics\":true,\"field_statistics\":true}' \"$ELASTICSEARCH_URL/my-index-000001/_termvectors/1\"" } ] } @@ -44747,6 +59123,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_termvectors/1\n{\n \"fields\" : [\"text\"],\n \"offsets\" : true,\n \"payloads\" : true,\n \"positions\" : true,\n \"term_statistics\" : true,\n \"field_statistics\" : true\n}" + }, + { + "lang": "Python", + "source": "resp = client.termvectors(\n index=\"my-index-000001\",\n id=\"1\",\n fields=[\n \"text\"\n ],\n offsets=True,\n payloads=True,\n positions=True,\n term_statistics=True,\n field_statistics=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.termvectors({\n index: \"my-index-000001\",\n id: 1,\n fields: [\"text\"],\n offsets: true,\n payloads: true,\n positions: true,\n term_statistics: true,\n field_statistics: true,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.termvectors(\n index: \"my-index-000001\",\n id: \"1\",\n body: {\n \"fields\": [\n \"text\"\n ],\n \"offsets\": true,\n \"payloads\": true,\n \"positions\": true,\n \"term_statistics\": true,\n \"field_statistics\": true\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->termvectors([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"body\" => [\n \"fields\" => array(\n \"text\",\n ),\n \"offsets\" => true,\n \"payloads\" => true,\n \"positions\" => true,\n \"term_statistics\" => true,\n \"field_statistics\" => true,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"fields\":[\"text\"],\"offsets\":true,\"payloads\":true,\"positions\":true,\"term_statistics\":true,\"field_statistics\":true}' \"$ELASTICSEARCH_URL/my-index-000001/_termvectors/1\"" } ] }, @@ -44810,6 +59206,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_termvectors/1\n{\n \"fields\" : [\"text\"],\n \"offsets\" : true,\n \"payloads\" : true,\n \"positions\" : true,\n \"term_statistics\" : true,\n \"field_statistics\" : true\n}" + }, + { + "lang": "Python", + "source": "resp = client.termvectors(\n index=\"my-index-000001\",\n id=\"1\",\n fields=[\n \"text\"\n ],\n offsets=True,\n payloads=True,\n positions=True,\n term_statistics=True,\n field_statistics=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.termvectors({\n index: \"my-index-000001\",\n id: 1,\n fields: [\"text\"],\n offsets: true,\n payloads: true,\n positions: true,\n term_statistics: true,\n field_statistics: true,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.termvectors(\n index: \"my-index-000001\",\n id: \"1\",\n body: {\n \"fields\": [\n \"text\"\n ],\n \"offsets\": true,\n \"payloads\": true,\n \"positions\": true,\n \"term_statistics\": true,\n \"field_statistics\": true\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->termvectors([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"body\" => [\n \"fields\" => array(\n \"text\",\n ),\n \"offsets\" => true,\n \"payloads\" => true,\n \"positions\" => true,\n \"term_statistics\" => true,\n \"field_statistics\" => true,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"fields\":[\"text\"],\"offsets\":true,\"payloads\":true,\"positions\":true,\"term_statistics\":true,\"field_statistics\":true}' \"$ELASTICSEARCH_URL/my-index-000001/_termvectors/1\"" } ] } @@ -45055,6 +59471,26 @@ { "lang": "Console", "source": "GET _text_structure/find_field_structure?index=test-logs&field=message\n" + }, + { + "lang": "Python", + "source": "resp = client.text_structure.find_field_structure(\n index=\"test-logs\",\n field=\"message\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.textStructure.findFieldStructure({\n index: \"test-logs\",\n field: \"message\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.text_structure.find_field_structure(\n index: \"test-logs\",\n field: \"message\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->textStructure()->findFieldStructure([\n \"index\" => \"test-logs\",\n \"field\" => \"message\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_text_structure/find_field_structure?index=test-logs&field=message\"" } ] } @@ -45114,63 +59550,103 @@ { "lang": "Console", "source": "POST _text_structure/find_message_structure\n{\n \"messages\": [\n \"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128\",\n \"[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]\",\n \"[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]\",\n \"[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]\",\n \"[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled\",\n \"[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled\",\n \"[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled\",\n \"[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]\",\n \"[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]\",\n \"[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized\",\n \"[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ...\"\n ]\n}" - } - ] - }, - "post": { - "tags": [ - "text_structure" - ], - "summary": "Find the structure of text messages", - "description": "Find the structure of a list of text messages.\nThe messages must contain data that is suitable to be ingested into Elasticsearch.\n\nThis API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality.\nUse this API rather than the find text structure API if your input text has already been split up into separate messages by some other process.\n\nThe response from the API contains:\n\n* Sample messages.\n* Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields.\n* Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text.\nAppropriate mappings for an Elasticsearch index, which you could use to ingest the text.\n\nAll this information can be calculated by the structure finder with no guidance.\nHowever, you can optionally override some of the decisions about the text structure by specifying one or more query parameters.\n\nIf the structure finder produces unexpected results, specify the `explain` query parameter and an explanation will appear in the response.\nIt helps determine why the returned structure was chosen.\n ##Required authorization\n* Cluster privileges: `monitor_text_structure`", - "operationId": "text-structure-find-message-structure-1", - "parameters": [ - { - "$ref": "#/components/parameters/text_structure.find_message_structure-column_names" }, { - "$ref": "#/components/parameters/text_structure.find_message_structure-delimiter" + "lang": "Python", + "source": "resp = client.text_structure.find_message_structure(\n messages=[\n \"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128\",\n \"[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]\",\n \"[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]\",\n \"[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]\",\n \"[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled\",\n \"[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled\",\n \"[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled\",\n \"[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]\",\n \"[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]\",\n \"[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized\",\n \"[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ...\"\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.textStructure.findMessageStructure({\n messages: [\n \"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128\",\n \"[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]\",\n \"[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]\",\n \"[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]\",\n \"[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled\",\n \"[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled\",\n \"[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled\",\n \"[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]\",\n \"[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]\",\n \"[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized\",\n \"[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ...\",\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.text_structure.find_message_structure(\n body: {\n \"messages\": [\n \"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128\",\n \"[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]\",\n \"[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]\",\n \"[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]\",\n \"[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled\",\n \"[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled\",\n \"[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled\",\n \"[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]\",\n \"[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]\",\n \"[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized\",\n \"[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ...\"\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->textStructure()->findMessageStructure([\n \"body\" => [\n \"messages\" => array(\n \"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128\",\n \"[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]\",\n \"[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]\",\n \"[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]\",\n \"[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled\",\n \"[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled\",\n \"[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled\",\n \"[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]\",\n \"[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]\",\n \"[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized\",\n \"[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ...\",\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"messages\":[\"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128\",\"[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]\",\"[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]\",\"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]\",\"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]\",\"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]\",\"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]\",\"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]\",\"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]\",\"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]\",\"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]\",\"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]\",\"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]\",\"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]\",\"[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]\",\"[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled\",\"[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled\",\"[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled\",\"[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]\",\"[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]\",\"[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized\",\"[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ...\"]}' \"$ELASTICSEARCH_URL/_text_structure/find_message_structure\"" + } + ] + }, + "post": { + "tags": [ + "text_structure" + ], + "summary": "Find the structure of text messages", + "description": "Find the structure of a list of text messages.\nThe messages must contain data that is suitable to be ingested into Elasticsearch.\n\nThis API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality.\nUse this API rather than the find text structure API if your input text has already been split up into separate messages by some other process.\n\nThe response from the API contains:\n\n* Sample messages.\n* Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields.\n* Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text.\nAppropriate mappings for an Elasticsearch index, which you could use to ingest the text.\n\nAll this information can be calculated by the structure finder with no guidance.\nHowever, you can optionally override some of the decisions about the text structure by specifying one or more query parameters.\n\nIf the structure finder produces unexpected results, specify the `explain` query parameter and an explanation will appear in the response.\nIt helps determine why the returned structure was chosen.\n ##Required authorization\n* Cluster privileges: `monitor_text_structure`", + "operationId": "text-structure-find-message-structure-1", + "parameters": [ + { + "$ref": "#/components/parameters/text_structure.find_message_structure-column_names" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure-delimiter" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure-ecs_compatibility" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure-explain" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure-format" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure-grok_pattern" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure-quote" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure-should_trim_fields" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure-timeout" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure-timestamp_field" + }, + { + "$ref": "#/components/parameters/text_structure.find_message_structure-timestamp_format" + } + ], + "requestBody": { + "$ref": "#/components/requestBodies/text_structure.find_message_structure" + }, + "responses": { + "200": { + "$ref": "#/components/responses/text_structure.find_message_structure-200" + } + }, + "x-codeSamples": [ + { + "lang": "Console", + "source": "POST _text_structure/find_message_structure\n{\n \"messages\": [\n \"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128\",\n \"[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]\",\n \"[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]\",\n \"[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]\",\n \"[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled\",\n \"[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled\",\n \"[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled\",\n \"[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]\",\n \"[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]\",\n \"[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized\",\n \"[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ...\"\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.text_structure.find_message_structure(\n messages=[\n \"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128\",\n \"[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]\",\n \"[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]\",\n \"[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]\",\n \"[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled\",\n \"[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled\",\n \"[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled\",\n \"[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]\",\n \"[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]\",\n \"[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized\",\n \"[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ...\"\n ],\n)" }, { - "$ref": "#/components/parameters/text_structure.find_message_structure-ecs_compatibility" + "lang": "JavaScript", + "source": "const response = await client.textStructure.findMessageStructure({\n messages: [\n \"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128\",\n \"[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]\",\n \"[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]\",\n \"[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]\",\n \"[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled\",\n \"[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled\",\n \"[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled\",\n \"[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]\",\n \"[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]\",\n \"[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized\",\n \"[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ...\",\n ],\n});" }, { - "$ref": "#/components/parameters/text_structure.find_message_structure-explain" + "lang": "Ruby", + "source": "response = client.text_structure.find_message_structure(\n body: {\n \"messages\": [\n \"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128\",\n \"[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]\",\n \"[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]\",\n \"[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]\",\n \"[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled\",\n \"[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled\",\n \"[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled\",\n \"[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]\",\n \"[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]\",\n \"[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized\",\n \"[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ...\"\n ]\n }\n)" }, { - "$ref": "#/components/parameters/text_structure.find_message_structure-format" + "lang": "PHP", + "source": "$resp = $client->textStructure()->findMessageStructure([\n \"body\" => [\n \"messages\" => array(\n \"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128\",\n \"[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]\",\n \"[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]\",\n \"[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]\",\n \"[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled\",\n \"[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled\",\n \"[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled\",\n \"[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]\",\n \"[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]\",\n \"[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized\",\n \"[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ...\",\n ),\n ],\n]);" }, { - "$ref": "#/components/parameters/text_structure.find_message_structure-grok_pattern" - }, - { - "$ref": "#/components/parameters/text_structure.find_message_structure-quote" - }, - { - "$ref": "#/components/parameters/text_structure.find_message_structure-should_trim_fields" - }, - { - "$ref": "#/components/parameters/text_structure.find_message_structure-timeout" - }, - { - "$ref": "#/components/parameters/text_structure.find_message_structure-timestamp_field" - }, - { - "$ref": "#/components/parameters/text_structure.find_message_structure-timestamp_format" - } - ], - "requestBody": { - "$ref": "#/components/requestBodies/text_structure.find_message_structure" - }, - "responses": { - "200": { - "$ref": "#/components/responses/text_structure.find_message_structure-200" - } - }, - "x-codeSamples": [ - { - "lang": "Console", - "source": "POST _text_structure/find_message_structure\n{\n \"messages\": [\n \"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128\",\n \"[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]\",\n \"[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]\",\n \"[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]\",\n \"[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled\",\n \"[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled\",\n \"[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled\",\n \"[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]\",\n \"[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]\",\n \"[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized\",\n \"[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ...\"\n ]\n}" + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"messages\":[\"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128\",\"[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]\",\"[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]\",\"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]\",\"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]\",\"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]\",\"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]\",\"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]\",\"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]\",\"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]\",\"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]\",\"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]\",\"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]\",\"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]\",\"[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]\",\"[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled\",\"[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled\",\"[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled\",\"[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]\",\"[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]\",\"[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized\",\"[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ...\"]}' \"$ELASTICSEARCH_URL/_text_structure/find_message_structure\"" } ] } @@ -45483,6 +59959,26 @@ { "lang": "Console", "source": "POST _text_structure/find_structure\n{\"name\": \"Leviathan Wakes\", \"author\": \"James S.A. Corey\", \"release_date\": \"2011-06-02\", \"page_count\": 561}\n{\"name\": \"Hyperion\", \"author\": \"Dan Simmons\", \"release_date\": \"1989-05-26\", \"page_count\": 482}\n{\"name\": \"Dune\", \"author\": \"Frank Herbert\", \"release_date\": \"1965-06-01\", \"page_count\": 604}\n{\"name\": \"Dune Messiah\", \"author\": \"Frank Herbert\", \"release_date\": \"1969-10-15\", \"page_count\": 331}\n{\"name\": \"Children of Dune\", \"author\": \"Frank Herbert\", \"release_date\": \"1976-04-21\", \"page_count\": 408}\n{\"name\": \"God Emperor of Dune\", \"author\": \"Frank Herbert\", \"release_date\": \"1981-05-28\", \"page_count\": 454}\n{\"name\": \"Consider Phlebas\", \"author\": \"Iain M. Banks\", \"release_date\": \"1987-04-23\", \"page_count\": 471}\n{\"name\": \"Pandora's Star\", \"author\": \"Peter F. Hamilton\", \"release_date\": \"2004-03-02\", \"page_count\": 768}\n{\"name\": \"Revelation Space\", \"author\": \"Alastair Reynolds\", \"release_date\": \"2000-03-15\", \"page_count\": 585}\n{\"name\": \"A Fire Upon the Deep\", \"author\": \"Vernor Vinge\", \"release_date\": \"1992-06-01\", \"page_count\": 613}\n{\"name\": \"Ender's Game\", \"author\": \"Orson Scott Card\", \"release_date\": \"1985-06-01\", \"page_count\": 324}\n{\"name\": \"1984\", \"author\": \"George Orwell\", \"release_date\": \"1985-06-01\", \"page_count\": 328}\n{\"name\": \"Fahrenheit 451\", \"author\": \"Ray Bradbury\", \"release_date\": \"1953-10-15\", \"page_count\": 227}\n{\"name\": \"Brave New World\", \"author\": \"Aldous Huxley\", \"release_date\": \"1932-06-01\", \"page_count\": 268}\n{\"name\": \"Foundation\", \"author\": \"Isaac Asimov\", \"release_date\": \"1951-06-01\", \"page_count\": 224}\n{\"name\": \"The Giver\", \"author\": \"Lois Lowry\", \"release_date\": \"1993-04-26\", \"page_count\": 208}\n{\"name\": \"Slaughterhouse-Five\", \"author\": \"Kurt Vonnegut\", \"release_date\": \"1969-06-01\", \"page_count\": 275}\n{\"name\": \"The Hitchhiker's Guide to the Galaxy\", \"author\": \"Douglas Adams\", \"release_date\": \"1979-10-12\", \"page_count\": 180}\n{\"name\": \"Snow Crash\", \"author\": \"Neal Stephenson\", \"release_date\": \"1992-06-01\", \"page_count\": 470}\n{\"name\": \"Neuromancer\", \"author\": \"William Gibson\", \"release_date\": \"1984-07-01\", \"page_count\": 271}\n{\"name\": \"The Handmaid's Tale\", \"author\": \"Margaret Atwood\", \"release_date\": \"1985-06-01\", \"page_count\": 311}\n{\"name\": \"Starship Troopers\", \"author\": \"Robert A. Heinlein\", \"release_date\": \"1959-12-01\", \"page_count\": 335}\n{\"name\": \"The Left Hand of Darkness\", \"author\": \"Ursula K. Le Guin\", \"release_date\": \"1969-06-01\", \"page_count\": 304}\n{\"name\": \"The Moon is a Harsh Mistress\", \"author\": \"Robert A. Heinlein\", \"release_date\": \"1966-04-01\", \"page_count\": 288}" + }, + { + "lang": "Python", + "source": "resp = client.text_structure.find_structure(\n text_files=[\n {\n \"name\": \"Leviathan Wakes\",\n \"author\": \"James S.A. Corey\",\n \"release_date\": \"2011-06-02\",\n \"page_count\": 561\n },\n {\n \"name\": \"Hyperion\",\n \"author\": \"Dan Simmons\",\n \"release_date\": \"1989-05-26\",\n \"page_count\": 482\n },\n {\n \"name\": \"Dune\",\n \"author\": \"Frank Herbert\",\n \"release_date\": \"1965-06-01\",\n \"page_count\": 604\n },\n {\n \"name\": \"Dune Messiah\",\n \"author\": \"Frank Herbert\",\n \"release_date\": \"1969-10-15\",\n \"page_count\": 331\n },\n {\n \"name\": \"Children of Dune\",\n \"author\": \"Frank Herbert\",\n \"release_date\": \"1976-04-21\",\n \"page_count\": 408\n },\n {\n \"name\": \"God Emperor of Dune\",\n \"author\": \"Frank Herbert\",\n \"release_date\": \"1981-05-28\",\n \"page_count\": 454\n },\n {\n \"name\": \"Consider Phlebas\",\n \"author\": \"Iain M. Banks\",\n \"release_date\": \"1987-04-23\",\n \"page_count\": 471\n },\n {\n \"name\": \"Pandora's Star\",\n \"author\": \"Peter F. Hamilton\",\n \"release_date\": \"2004-03-02\",\n \"page_count\": 768\n },\n {\n \"name\": \"Revelation Space\",\n \"author\": \"Alastair Reynolds\",\n \"release_date\": \"2000-03-15\",\n \"page_count\": 585\n },\n {\n \"name\": \"A Fire Upon the Deep\",\n \"author\": \"Vernor Vinge\",\n \"release_date\": \"1992-06-01\",\n \"page_count\": 613\n },\n {\n \"name\": \"Ender's Game\",\n \"author\": \"Orson Scott Card\",\n \"release_date\": \"1985-06-01\",\n \"page_count\": 324\n },\n {\n \"name\": \"1984\",\n \"author\": \"George Orwell\",\n \"release_date\": \"1985-06-01\",\n \"page_count\": 328\n },\n {\n \"name\": \"Fahrenheit 451\",\n \"author\": \"Ray Bradbury\",\n \"release_date\": \"1953-10-15\",\n \"page_count\": 227\n },\n {\n \"name\": \"Brave New World\",\n \"author\": \"Aldous Huxley\",\n \"release_date\": \"1932-06-01\",\n \"page_count\": 268\n },\n {\n \"name\": \"Foundation\",\n \"author\": \"Isaac Asimov\",\n \"release_date\": \"1951-06-01\",\n \"page_count\": 224\n },\n {\n \"name\": \"The Giver\",\n \"author\": \"Lois Lowry\",\n \"release_date\": \"1993-04-26\",\n \"page_count\": 208\n },\n {\n \"name\": \"Slaughterhouse-Five\",\n \"author\": \"Kurt Vonnegut\",\n \"release_date\": \"1969-06-01\",\n \"page_count\": 275\n },\n {\n \"name\": \"The Hitchhiker's Guide to the Galaxy\",\n \"author\": \"Douglas Adams\",\n \"release_date\": \"1979-10-12\",\n \"page_count\": 180\n },\n {\n \"name\": \"Snow Crash\",\n \"author\": \"Neal Stephenson\",\n \"release_date\": \"1992-06-01\",\n \"page_count\": 470\n },\n {\n \"name\": \"Neuromancer\",\n \"author\": \"William Gibson\",\n \"release_date\": \"1984-07-01\",\n \"page_count\": 271\n },\n {\n \"name\": \"The Handmaid's Tale\",\n \"author\": \"Margaret Atwood\",\n \"release_date\": \"1985-06-01\",\n \"page_count\": 311\n },\n {\n \"name\": \"Starship Troopers\",\n \"author\": \"Robert A. Heinlein\",\n \"release_date\": \"1959-12-01\",\n \"page_count\": 335\n },\n {\n \"name\": \"The Left Hand of Darkness\",\n \"author\": \"Ursula K. Le Guin\",\n \"release_date\": \"1969-06-01\",\n \"page_count\": 304\n },\n {\n \"name\": \"The Moon is a Harsh Mistress\",\n \"author\": \"Robert A. Heinlein\",\n \"release_date\": \"1966-04-01\",\n \"page_count\": 288\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.textStructure.findStructure({\n text_files: [\n {\n name: \"Leviathan Wakes\",\n author: \"James S.A. Corey\",\n release_date: \"2011-06-02\",\n page_count: 561,\n },\n {\n name: \"Hyperion\",\n author: \"Dan Simmons\",\n release_date: \"1989-05-26\",\n page_count: 482,\n },\n {\n name: \"Dune\",\n author: \"Frank Herbert\",\n release_date: \"1965-06-01\",\n page_count: 604,\n },\n {\n name: \"Dune Messiah\",\n author: \"Frank Herbert\",\n release_date: \"1969-10-15\",\n page_count: 331,\n },\n {\n name: \"Children of Dune\",\n author: \"Frank Herbert\",\n release_date: \"1976-04-21\",\n page_count: 408,\n },\n {\n name: \"God Emperor of Dune\",\n author: \"Frank Herbert\",\n release_date: \"1981-05-28\",\n page_count: 454,\n },\n {\n name: \"Consider Phlebas\",\n author: \"Iain M. Banks\",\n release_date: \"1987-04-23\",\n page_count: 471,\n },\n {\n name: \"Pandora's Star\",\n author: \"Peter F. Hamilton\",\n release_date: \"2004-03-02\",\n page_count: 768,\n },\n {\n name: \"Revelation Space\",\n author: \"Alastair Reynolds\",\n release_date: \"2000-03-15\",\n page_count: 585,\n },\n {\n name: \"A Fire Upon the Deep\",\n author: \"Vernor Vinge\",\n release_date: \"1992-06-01\",\n page_count: 613,\n },\n {\n name: \"Ender's Game\",\n author: \"Orson Scott Card\",\n release_date: \"1985-06-01\",\n page_count: 324,\n },\n {\n name: \"1984\",\n author: \"George Orwell\",\n release_date: \"1985-06-01\",\n page_count: 328,\n },\n {\n name: \"Fahrenheit 451\",\n author: \"Ray Bradbury\",\n release_date: \"1953-10-15\",\n page_count: 227,\n },\n {\n name: \"Brave New World\",\n author: \"Aldous Huxley\",\n release_date: \"1932-06-01\",\n page_count: 268,\n },\n {\n name: \"Foundation\",\n author: \"Isaac Asimov\",\n release_date: \"1951-06-01\",\n page_count: 224,\n },\n {\n name: \"The Giver\",\n author: \"Lois Lowry\",\n release_date: \"1993-04-26\",\n page_count: 208,\n },\n {\n name: \"Slaughterhouse-Five\",\n author: \"Kurt Vonnegut\",\n release_date: \"1969-06-01\",\n page_count: 275,\n },\n {\n name: \"The Hitchhiker's Guide to the Galaxy\",\n author: \"Douglas Adams\",\n release_date: \"1979-10-12\",\n page_count: 180,\n },\n {\n name: \"Snow Crash\",\n author: \"Neal Stephenson\",\n release_date: \"1992-06-01\",\n page_count: 470,\n },\n {\n name: \"Neuromancer\",\n author: \"William Gibson\",\n release_date: \"1984-07-01\",\n page_count: 271,\n },\n {\n name: \"The Handmaid's Tale\",\n author: \"Margaret Atwood\",\n release_date: \"1985-06-01\",\n page_count: 311,\n },\n {\n name: \"Starship Troopers\",\n author: \"Robert A. Heinlein\",\n release_date: \"1959-12-01\",\n page_count: 335,\n },\n {\n name: \"The Left Hand of Darkness\",\n author: \"Ursula K. Le Guin\",\n release_date: \"1969-06-01\",\n page_count: 304,\n },\n {\n name: \"The Moon is a Harsh Mistress\",\n author: \"Robert A. Heinlein\",\n release_date: \"1966-04-01\",\n page_count: 288,\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.text_structure.find_structure(\n body: [\n {\n \"name\": \"Leviathan Wakes\",\n \"author\": \"James S.A. Corey\",\n \"release_date\": \"2011-06-02\",\n \"page_count\": 561\n },\n {\n \"name\": \"Hyperion\",\n \"author\": \"Dan Simmons\",\n \"release_date\": \"1989-05-26\",\n \"page_count\": 482\n },\n {\n \"name\": \"Dune\",\n \"author\": \"Frank Herbert\",\n \"release_date\": \"1965-06-01\",\n \"page_count\": 604\n },\n {\n \"name\": \"Dune Messiah\",\n \"author\": \"Frank Herbert\",\n \"release_date\": \"1969-10-15\",\n \"page_count\": 331\n },\n {\n \"name\": \"Children of Dune\",\n \"author\": \"Frank Herbert\",\n \"release_date\": \"1976-04-21\",\n \"page_count\": 408\n },\n {\n \"name\": \"God Emperor of Dune\",\n \"author\": \"Frank Herbert\",\n \"release_date\": \"1981-05-28\",\n \"page_count\": 454\n },\n {\n \"name\": \"Consider Phlebas\",\n \"author\": \"Iain M. Banks\",\n \"release_date\": \"1987-04-23\",\n \"page_count\": 471\n },\n {\n \"name\": \"Pandora's Star\",\n \"author\": \"Peter F. Hamilton\",\n \"release_date\": \"2004-03-02\",\n \"page_count\": 768\n },\n {\n \"name\": \"Revelation Space\",\n \"author\": \"Alastair Reynolds\",\n \"release_date\": \"2000-03-15\",\n \"page_count\": 585\n },\n {\n \"name\": \"A Fire Upon the Deep\",\n \"author\": \"Vernor Vinge\",\n \"release_date\": \"1992-06-01\",\n \"page_count\": 613\n },\n {\n \"name\": \"Ender's Game\",\n \"author\": \"Orson Scott Card\",\n \"release_date\": \"1985-06-01\",\n \"page_count\": 324\n },\n {\n \"name\": \"1984\",\n \"author\": \"George Orwell\",\n \"release_date\": \"1985-06-01\",\n \"page_count\": 328\n },\n {\n \"name\": \"Fahrenheit 451\",\n \"author\": \"Ray Bradbury\",\n \"release_date\": \"1953-10-15\",\n \"page_count\": 227\n },\n {\n \"name\": \"Brave New World\",\n \"author\": \"Aldous Huxley\",\n \"release_date\": \"1932-06-01\",\n \"page_count\": 268\n },\n {\n \"name\": \"Foundation\",\n \"author\": \"Isaac Asimov\",\n \"release_date\": \"1951-06-01\",\n \"page_count\": 224\n },\n {\n \"name\": \"The Giver\",\n \"author\": \"Lois Lowry\",\n \"release_date\": \"1993-04-26\",\n \"page_count\": 208\n },\n {\n \"name\": \"Slaughterhouse-Five\",\n \"author\": \"Kurt Vonnegut\",\n \"release_date\": \"1969-06-01\",\n \"page_count\": 275\n },\n {\n \"name\": \"The Hitchhiker's Guide to the Galaxy\",\n \"author\": \"Douglas Adams\",\n \"release_date\": \"1979-10-12\",\n \"page_count\": 180\n },\n {\n \"name\": \"Snow Crash\",\n \"author\": \"Neal Stephenson\",\n \"release_date\": \"1992-06-01\",\n \"page_count\": 470\n },\n {\n \"name\": \"Neuromancer\",\n \"author\": \"William Gibson\",\n \"release_date\": \"1984-07-01\",\n \"page_count\": 271\n },\n {\n \"name\": \"The Handmaid's Tale\",\n \"author\": \"Margaret Atwood\",\n \"release_date\": \"1985-06-01\",\n \"page_count\": 311\n },\n {\n \"name\": \"Starship Troopers\",\n \"author\": \"Robert A. Heinlein\",\n \"release_date\": \"1959-12-01\",\n \"page_count\": 335\n },\n {\n \"name\": \"The Left Hand of Darkness\",\n \"author\": \"Ursula K. Le Guin\",\n \"release_date\": \"1969-06-01\",\n \"page_count\": 304\n },\n {\n \"name\": \"The Moon is a Harsh Mistress\",\n \"author\": \"Robert A. Heinlein\",\n \"release_date\": \"1966-04-01\",\n \"page_count\": 288\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->textStructure()->findStructure([\n \"body\" => array(\n [\n \"name\" => \"Leviathan Wakes\",\n \"author\" => \"James S.A. Corey\",\n \"release_date\" => \"2011-06-02\",\n \"page_count\" => 561,\n ],\n [\n \"name\" => \"Hyperion\",\n \"author\" => \"Dan Simmons\",\n \"release_date\" => \"1989-05-26\",\n \"page_count\" => 482,\n ],\n [\n \"name\" => \"Dune\",\n \"author\" => \"Frank Herbert\",\n \"release_date\" => \"1965-06-01\",\n \"page_count\" => 604,\n ],\n [\n \"name\" => \"Dune Messiah\",\n \"author\" => \"Frank Herbert\",\n \"release_date\" => \"1969-10-15\",\n \"page_count\" => 331,\n ],\n [\n \"name\" => \"Children of Dune\",\n \"author\" => \"Frank Herbert\",\n \"release_date\" => \"1976-04-21\",\n \"page_count\" => 408,\n ],\n [\n \"name\" => \"God Emperor of Dune\",\n \"author\" => \"Frank Herbert\",\n \"release_date\" => \"1981-05-28\",\n \"page_count\" => 454,\n ],\n [\n \"name\" => \"Consider Phlebas\",\n \"author\" => \"Iain M. Banks\",\n \"release_date\" => \"1987-04-23\",\n \"page_count\" => 471,\n ],\n [\n \"name\" => \"Pandora's Star\",\n \"author\" => \"Peter F. Hamilton\",\n \"release_date\" => \"2004-03-02\",\n \"page_count\" => 768,\n ],\n [\n \"name\" => \"Revelation Space\",\n \"author\" => \"Alastair Reynolds\",\n \"release_date\" => \"2000-03-15\",\n \"page_count\" => 585,\n ],\n [\n \"name\" => \"A Fire Upon the Deep\",\n \"author\" => \"Vernor Vinge\",\n \"release_date\" => \"1992-06-01\",\n \"page_count\" => 613,\n ],\n [\n \"name\" => \"Ender's Game\",\n \"author\" => \"Orson Scott Card\",\n \"release_date\" => \"1985-06-01\",\n \"page_count\" => 324,\n ],\n [\n \"name\" => \"1984\",\n \"author\" => \"George Orwell\",\n \"release_date\" => \"1985-06-01\",\n \"page_count\" => 328,\n ],\n [\n \"name\" => \"Fahrenheit 451\",\n \"author\" => \"Ray Bradbury\",\n \"release_date\" => \"1953-10-15\",\n \"page_count\" => 227,\n ],\n [\n \"name\" => \"Brave New World\",\n \"author\" => \"Aldous Huxley\",\n \"release_date\" => \"1932-06-01\",\n \"page_count\" => 268,\n ],\n [\n \"name\" => \"Foundation\",\n \"author\" => \"Isaac Asimov\",\n \"release_date\" => \"1951-06-01\",\n \"page_count\" => 224,\n ],\n [\n \"name\" => \"The Giver\",\n \"author\" => \"Lois Lowry\",\n \"release_date\" => \"1993-04-26\",\n \"page_count\" => 208,\n ],\n [\n \"name\" => \"Slaughterhouse-Five\",\n \"author\" => \"Kurt Vonnegut\",\n \"release_date\" => \"1969-06-01\",\n \"page_count\" => 275,\n ],\n [\n \"name\" => \"The Hitchhiker's Guide to the Galaxy\",\n \"author\" => \"Douglas Adams\",\n \"release_date\" => \"1979-10-12\",\n \"page_count\" => 180,\n ],\n [\n \"name\" => \"Snow Crash\",\n \"author\" => \"Neal Stephenson\",\n \"release_date\" => \"1992-06-01\",\n \"page_count\" => 470,\n ],\n [\n \"name\" => \"Neuromancer\",\n \"author\" => \"William Gibson\",\n \"release_date\" => \"1984-07-01\",\n \"page_count\" => 271,\n ],\n [\n \"name\" => \"The Handmaid's Tale\",\n \"author\" => \"Margaret Atwood\",\n \"release_date\" => \"1985-06-01\",\n \"page_count\" => 311,\n ],\n [\n \"name\" => \"Starship Troopers\",\n \"author\" => \"Robert A. Heinlein\",\n \"release_date\" => \"1959-12-01\",\n \"page_count\" => 335,\n ],\n [\n \"name\" => \"The Left Hand of Darkness\",\n \"author\" => \"Ursula K. Le Guin\",\n \"release_date\" => \"1969-06-01\",\n \"page_count\" => 304,\n ],\n [\n \"name\" => \"The Moon is a Harsh Mistress\",\n \"author\" => \"Robert A. Heinlein\",\n \"release_date\" => \"1966-04-01\",\n \"page_count\" => 288,\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{\"name\":\"Leviathan Wakes\",\"author\":\"James S.A. Corey\",\"release_date\":\"2011-06-02\",\"page_count\":561},{\"name\":\"Hyperion\",\"author\":\"Dan Simmons\",\"release_date\":\"1989-05-26\",\"page_count\":482},{\"name\":\"Dune\",\"author\":\"Frank Herbert\",\"release_date\":\"1965-06-01\",\"page_count\":604},{\"name\":\"Dune Messiah\",\"author\":\"Frank Herbert\",\"release_date\":\"1969-10-15\",\"page_count\":331},{\"name\":\"Children of Dune\",\"author\":\"Frank Herbert\",\"release_date\":\"1976-04-21\",\"page_count\":408},{\"name\":\"God Emperor of Dune\",\"author\":\"Frank Herbert\",\"release_date\":\"1981-05-28\",\"page_count\":454},{\"name\":\"Consider Phlebas\",\"author\":\"Iain M. Banks\",\"release_date\":\"1987-04-23\",\"page_count\":471},{\"name\":\"Pandora'\"'\"'s Star\",\"author\":\"Peter F. Hamilton\",\"release_date\":\"2004-03-02\",\"page_count\":768},{\"name\":\"Revelation Space\",\"author\":\"Alastair Reynolds\",\"release_date\":\"2000-03-15\",\"page_count\":585},{\"name\":\"A Fire Upon the Deep\",\"author\":\"Vernor Vinge\",\"release_date\":\"1992-06-01\",\"page_count\":613},{\"name\":\"Ender'\"'\"'s Game\",\"author\":\"Orson Scott Card\",\"release_date\":\"1985-06-01\",\"page_count\":324},{\"name\":\"1984\",\"author\":\"George Orwell\",\"release_date\":\"1985-06-01\",\"page_count\":328},{\"name\":\"Fahrenheit 451\",\"author\":\"Ray Bradbury\",\"release_date\":\"1953-10-15\",\"page_count\":227},{\"name\":\"Brave New World\",\"author\":\"Aldous Huxley\",\"release_date\":\"1932-06-01\",\"page_count\":268},{\"name\":\"Foundation\",\"author\":\"Isaac Asimov\",\"release_date\":\"1951-06-01\",\"page_count\":224},{\"name\":\"The Giver\",\"author\":\"Lois Lowry\",\"release_date\":\"1993-04-26\",\"page_count\":208},{\"name\":\"Slaughterhouse-Five\",\"author\":\"Kurt Vonnegut\",\"release_date\":\"1969-06-01\",\"page_count\":275},{\"name\":\"The Hitchhiker'\"'\"'s Guide to the Galaxy\",\"author\":\"Douglas Adams\",\"release_date\":\"1979-10-12\",\"page_count\":180},{\"name\":\"Snow Crash\",\"author\":\"Neal Stephenson\",\"release_date\":\"1992-06-01\",\"page_count\":470},{\"name\":\"Neuromancer\",\"author\":\"William Gibson\",\"release_date\":\"1984-07-01\",\"page_count\":271},{\"name\":\"The Handmaid'\"'\"'s Tale\",\"author\":\"Margaret Atwood\",\"release_date\":\"1985-06-01\",\"page_count\":311},{\"name\":\"Starship Troopers\",\"author\":\"Robert A. Heinlein\",\"release_date\":\"1959-12-01\",\"page_count\":335},{\"name\":\"The Left Hand of Darkness\",\"author\":\"Ursula K. Le Guin\",\"release_date\":\"1969-06-01\",\"page_count\":304},{\"name\":\"The Moon is a Harsh Mistress\",\"author\":\"Robert A. Heinlein\",\"release_date\":\"1966-04-01\",\"page_count\":288}]' \"$ELASTICSEARCH_URL/_text_structure/find_structure\"" } ] } @@ -45516,6 +60012,26 @@ { "lang": "Console", "source": "GET _text_structure/test_grok_pattern\n{\n \"grok_pattern\": \"Hello %{WORD:first_name} %{WORD:last_name}\",\n \"text\": [\n \"Hello John Doe\",\n \"this does not match\"\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.text_structure.test_grok_pattern(\n grok_pattern=\"Hello %{WORD:first_name} %{WORD:last_name}\",\n text=[\n \"Hello John Doe\",\n \"this does not match\"\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.textStructure.testGrokPattern({\n grok_pattern: \"Hello %{WORD:first_name} %{WORD:last_name}\",\n text: [\"Hello John Doe\", \"this does not match\"],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.text_structure.test_grok_pattern(\n body: {\n \"grok_pattern\": \"Hello %{WORD:first_name} %{WORD:last_name}\",\n \"text\": [\n \"Hello John Doe\",\n \"this does not match\"\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->textStructure()->testGrokPattern([\n \"body\" => [\n \"grok_pattern\" => \"Hello %{WORD:first_name} %{WORD:last_name}\",\n \"text\" => array(\n \"Hello John Doe\",\n \"this does not match\",\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"grok_pattern\":\"Hello %{WORD:first_name} %{WORD:last_name}\",\"text\":[\"Hello John Doe\",\"this does not match\"]}' \"$ELASTICSEARCH_URL/_text_structure/test_grok_pattern\"" } ] }, @@ -45547,6 +60063,26 @@ { "lang": "Console", "source": "GET _text_structure/test_grok_pattern\n{\n \"grok_pattern\": \"Hello %{WORD:first_name} %{WORD:last_name}\",\n \"text\": [\n \"Hello John Doe\",\n \"this does not match\"\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.text_structure.test_grok_pattern(\n grok_pattern=\"Hello %{WORD:first_name} %{WORD:last_name}\",\n text=[\n \"Hello John Doe\",\n \"this does not match\"\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.textStructure.testGrokPattern({\n grok_pattern: \"Hello %{WORD:first_name} %{WORD:last_name}\",\n text: [\"Hello John Doe\", \"this does not match\"],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.text_structure.test_grok_pattern(\n body: {\n \"grok_pattern\": \"Hello %{WORD:first_name} %{WORD:last_name}\",\n \"text\": [\n \"Hello John Doe\",\n \"this does not match\"\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->textStructure()->testGrokPattern([\n \"body\" => [\n \"grok_pattern\" => \"Hello %{WORD:first_name} %{WORD:last_name}\",\n \"text\" => array(\n \"Hello John Doe\",\n \"this does not match\",\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"grok_pattern\":\"Hello %{WORD:first_name} %{WORD:last_name}\",\"text\":[\"Hello John Doe\",\"this does not match\"]}' \"$ELASTICSEARCH_URL/_text_structure/test_grok_pattern\"" } ] } @@ -45586,6 +60122,26 @@ { "lang": "Console", "source": "GET _transform?size=10\n" + }, + { + "lang": "Python", + "source": "resp = client.transform.get_transform(\n size=\"10\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.getTransform({\n size: 10,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.get_transform(\n size: \"10\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->getTransform([\n \"size\" => \"10\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform?size=10\"" } ] }, @@ -45711,6 +60267,26 @@ { "lang": "Console", "source": "PUT _transform/ecommerce_transform1\n{\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\",\n \"query\": {\n \"term\": {\n \"geoip.continent_name\": {\n \"value\": \"Asia\"\n }\n }\n }\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n \"description\": \"Maximum priced ecommerce data by customer_id in Asia\",\n \"dest\": {\n \"index\": \"kibana_sample_data_ecommerce_transform1\",\n \"pipeline\": \"add_timestamp_pipeline\"\n },\n \"frequency\": \"5m\",\n \"sync\": {\n \"time\": {\n \"field\": \"order_date\",\n \"delay\": \"60s\"\n }\n },\n \"retention_policy\": {\n \"time\": {\n \"field\": \"order_date\",\n \"max_age\": \"30d\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.transform.put_transform(\n transform_id=\"ecommerce_transform1\",\n source={\n \"index\": \"kibana_sample_data_ecommerce\",\n \"query\": {\n \"term\": {\n \"geoip.continent_name\": {\n \"value\": \"Asia\"\n }\n }\n }\n },\n pivot={\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": True\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n description=\"Maximum priced ecommerce data by customer_id in Asia\",\n dest={\n \"index\": \"kibana_sample_data_ecommerce_transform1\",\n \"pipeline\": \"add_timestamp_pipeline\"\n },\n frequency=\"5m\",\n sync={\n \"time\": {\n \"field\": \"order_date\",\n \"delay\": \"60s\"\n }\n },\n retention_policy={\n \"time\": {\n \"field\": \"order_date\",\n \"max_age\": \"30d\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.putTransform({\n transform_id: \"ecommerce_transform1\",\n source: {\n index: \"kibana_sample_data_ecommerce\",\n query: {\n term: {\n \"geoip.continent_name\": {\n value: \"Asia\",\n },\n },\n },\n },\n pivot: {\n group_by: {\n customer_id: {\n terms: {\n field: \"customer_id\",\n missing_bucket: true,\n },\n },\n },\n aggregations: {\n max_price: {\n max: {\n field: \"taxful_total_price\",\n },\n },\n },\n },\n description: \"Maximum priced ecommerce data by customer_id in Asia\",\n dest: {\n index: \"kibana_sample_data_ecommerce_transform1\",\n pipeline: \"add_timestamp_pipeline\",\n },\n frequency: \"5m\",\n sync: {\n time: {\n field: \"order_date\",\n delay: \"60s\",\n },\n },\n retention_policy: {\n time: {\n field: \"order_date\",\n max_age: \"30d\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.put_transform(\n transform_id: \"ecommerce_transform1\",\n body: {\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\",\n \"query\": {\n \"term\": {\n \"geoip.continent_name\": {\n \"value\": \"Asia\"\n }\n }\n }\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n \"description\": \"Maximum priced ecommerce data by customer_id in Asia\",\n \"dest\": {\n \"index\": \"kibana_sample_data_ecommerce_transform1\",\n \"pipeline\": \"add_timestamp_pipeline\"\n },\n \"frequency\": \"5m\",\n \"sync\": {\n \"time\": {\n \"field\": \"order_date\",\n \"delay\": \"60s\"\n }\n },\n \"retention_policy\": {\n \"time\": {\n \"field\": \"order_date\",\n \"max_age\": \"30d\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->putTransform([\n \"transform_id\" => \"ecommerce_transform1\",\n \"body\" => [\n \"source\" => [\n \"index\" => \"kibana_sample_data_ecommerce\",\n \"query\" => [\n \"term\" => [\n \"geoip.continent_name\" => [\n \"value\" => \"Asia\",\n ],\n ],\n ],\n ],\n \"pivot\" => [\n \"group_by\" => [\n \"customer_id\" => [\n \"terms\" => [\n \"field\" => \"customer_id\",\n \"missing_bucket\" => true,\n ],\n ],\n ],\n \"aggregations\" => [\n \"max_price\" => [\n \"max\" => [\n \"field\" => \"taxful_total_price\",\n ],\n ],\n ],\n ],\n \"description\" => \"Maximum priced ecommerce data by customer_id in Asia\",\n \"dest\" => [\n \"index\" => \"kibana_sample_data_ecommerce_transform1\",\n \"pipeline\" => \"add_timestamp_pipeline\",\n ],\n \"frequency\" => \"5m\",\n \"sync\" => [\n \"time\" => [\n \"field\" => \"order_date\",\n \"delay\" => \"60s\",\n ],\n ],\n \"retention_policy\" => [\n \"time\" => [\n \"field\" => \"order_date\",\n \"max_age\" => \"30d\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"kibana_sample_data_ecommerce\",\"query\":{\"term\":{\"geoip.continent_name\":{\"value\":\"Asia\"}}}},\"pivot\":{\"group_by\":{\"customer_id\":{\"terms\":{\"field\":\"customer_id\",\"missing_bucket\":true}}},\"aggregations\":{\"max_price\":{\"max\":{\"field\":\"taxful_total_price\"}}}},\"description\":\"Maximum priced ecommerce data by customer_id in Asia\",\"dest\":{\"index\":\"kibana_sample_data_ecommerce_transform1\",\"pipeline\":\"add_timestamp_pipeline\"},\"frequency\":\"5m\",\"sync\":{\"time\":{\"field\":\"order_date\",\"delay\":\"60s\"}},\"retention_policy\":{\"time\":{\"field\":\"order_date\",\"max_age\":\"30d\"}}}' \"$ELASTICSEARCH_URL/_transform/ecommerce_transform1\"" } ] }, @@ -45787,6 +60363,26 @@ { "lang": "Console", "source": "DELETE _transform/ecommerce_transform\n" + }, + { + "lang": "Python", + "source": "resp = client.transform.delete_transform(\n transform_id=\"ecommerce_transform\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.deleteTransform({\n transform_id: \"ecommerce_transform\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.delete_transform(\n transform_id: \"ecommerce_transform\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->deleteTransform([\n \"transform_id\" => \"ecommerce_transform\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/ecommerce_transform\"" } ] } @@ -45823,6 +60419,26 @@ { "lang": "Console", "source": "GET _transform?size=10\n" + }, + { + "lang": "Python", + "source": "resp = client.transform.get_transform(\n size=\"10\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.getTransform({\n size: 10,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.get_transform(\n size: \"10\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->getTransform([\n \"size\" => \"10\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform?size=10\"" } ] } @@ -45926,6 +60542,26 @@ { "lang": "Console", "source": "GET _transform/ecommerce-customer-transform/_stats\n" + }, + { + "lang": "Python", + "source": "resp = client.transform.get_transform_stats(\n transform_id=\"ecommerce-customer-transform\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.getTransformStats({\n transform_id: \"ecommerce-customer-transform\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.get_transform_stats(\n transform_id: \"ecommerce-customer-transform\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->getTransformStats([\n \"transform_id\" => \"ecommerce-customer-transform\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/ecommerce-customer-transform/_stats\"" } ] } @@ -45959,6 +60595,26 @@ { "lang": "Console", "source": "POST _transform/_preview\n{\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.transform.preview_transform(\n source={\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n pivot={\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": True\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.previewTransform({\n source: {\n index: \"kibana_sample_data_ecommerce\",\n },\n pivot: {\n group_by: {\n customer_id: {\n terms: {\n field: \"customer_id\",\n missing_bucket: true,\n },\n },\n },\n aggregations: {\n max_price: {\n max: {\n field: \"taxful_total_price\",\n },\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.preview_transform(\n body: {\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->previewTransform([\n \"body\" => [\n \"source\" => [\n \"index\" => \"kibana_sample_data_ecommerce\",\n ],\n \"pivot\" => [\n \"group_by\" => [\n \"customer_id\" => [\n \"terms\" => [\n \"field\" => \"customer_id\",\n \"missing_bucket\" => true,\n ],\n ],\n ],\n \"aggregations\" => [\n \"max_price\" => [\n \"max\" => [\n \"field\" => \"taxful_total_price\",\n ],\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"kibana_sample_data_ecommerce\"},\"pivot\":{\"group_by\":{\"customer_id\":{\"terms\":{\"field\":\"customer_id\",\"missing_bucket\":true}}},\"aggregations\":{\"max_price\":{\"max\":{\"field\":\"taxful_total_price\"}}}}}' \"$ELASTICSEARCH_URL/_transform/_preview\"" } ] }, @@ -45990,6 +60646,26 @@ { "lang": "Console", "source": "POST _transform/_preview\n{\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.transform.preview_transform(\n source={\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n pivot={\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": True\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.previewTransform({\n source: {\n index: \"kibana_sample_data_ecommerce\",\n },\n pivot: {\n group_by: {\n customer_id: {\n terms: {\n field: \"customer_id\",\n missing_bucket: true,\n },\n },\n },\n aggregations: {\n max_price: {\n max: {\n field: \"taxful_total_price\",\n },\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.preview_transform(\n body: {\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->previewTransform([\n \"body\" => [\n \"source\" => [\n \"index\" => \"kibana_sample_data_ecommerce\",\n ],\n \"pivot\" => [\n \"group_by\" => [\n \"customer_id\" => [\n \"terms\" => [\n \"field\" => \"customer_id\",\n \"missing_bucket\" => true,\n ],\n ],\n ],\n \"aggregations\" => [\n \"max_price\" => [\n \"max\" => [\n \"field\" => \"taxful_total_price\",\n ],\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"kibana_sample_data_ecommerce\"},\"pivot\":{\"group_by\":{\"customer_id\":{\"terms\":{\"field\":\"customer_id\",\"missing_bucket\":true}}},\"aggregations\":{\"max_price\":{\"max\":{\"field\":\"taxful_total_price\"}}}}}' \"$ELASTICSEARCH_URL/_transform/_preview\"" } ] } @@ -46020,6 +60696,26 @@ { "lang": "Console", "source": "POST _transform/_preview\n{\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.transform.preview_transform(\n source={\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n pivot={\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": True\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.previewTransform({\n source: {\n index: \"kibana_sample_data_ecommerce\",\n },\n pivot: {\n group_by: {\n customer_id: {\n terms: {\n field: \"customer_id\",\n missing_bucket: true,\n },\n },\n },\n aggregations: {\n max_price: {\n max: {\n field: \"taxful_total_price\",\n },\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.preview_transform(\n body: {\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->previewTransform([\n \"body\" => [\n \"source\" => [\n \"index\" => \"kibana_sample_data_ecommerce\",\n ],\n \"pivot\" => [\n \"group_by\" => [\n \"customer_id\" => [\n \"terms\" => [\n \"field\" => \"customer_id\",\n \"missing_bucket\" => true,\n ],\n ],\n ],\n \"aggregations\" => [\n \"max_price\" => [\n \"max\" => [\n \"field\" => \"taxful_total_price\",\n ],\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"kibana_sample_data_ecommerce\"},\"pivot\":{\"group_by\":{\"customer_id\":{\"terms\":{\"field\":\"customer_id\",\"missing_bucket\":true}}},\"aggregations\":{\"max_price\":{\"max\":{\"field\":\"taxful_total_price\"}}}}}' \"$ELASTICSEARCH_URL/_transform/_preview\"" } ] }, @@ -46048,6 +60744,26 @@ { "lang": "Console", "source": "POST _transform/_preview\n{\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.transform.preview_transform(\n source={\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n pivot={\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": True\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.previewTransform({\n source: {\n index: \"kibana_sample_data_ecommerce\",\n },\n pivot: {\n group_by: {\n customer_id: {\n terms: {\n field: \"customer_id\",\n missing_bucket: true,\n },\n },\n },\n aggregations: {\n max_price: {\n max: {\n field: \"taxful_total_price\",\n },\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.preview_transform(\n body: {\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->previewTransform([\n \"body\" => [\n \"source\" => [\n \"index\" => \"kibana_sample_data_ecommerce\",\n ],\n \"pivot\" => [\n \"group_by\" => [\n \"customer_id\" => [\n \"terms\" => [\n \"field\" => \"customer_id\",\n \"missing_bucket\" => true,\n ],\n ],\n ],\n \"aggregations\" => [\n \"max_price\" => [\n \"max\" => [\n \"field\" => \"taxful_total_price\",\n ],\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"kibana_sample_data_ecommerce\"},\"pivot\":{\"group_by\":{\"customer_id\":{\"terms\":{\"field\":\"customer_id\",\"missing_bucket\":true}}},\"aggregations\":{\"max_price\":{\"max\":{\"field\":\"taxful_total_price\"}}}}}' \"$ELASTICSEARCH_URL/_transform/_preview\"" } ] } @@ -46116,6 +60832,26 @@ { "lang": "Console", "source": "POST _transform/ecommerce_transform/_reset\n" + }, + { + "lang": "Python", + "source": "resp = client.transform.reset_transform(\n transform_id=\"ecommerce_transform\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.resetTransform({\n transform_id: \"ecommerce_transform\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.reset_transform(\n transform_id: \"ecommerce_transform\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->resetTransform([\n \"transform_id\" => \"ecommerce_transform\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/ecommerce_transform/_reset\"" } ] } @@ -46174,6 +60910,26 @@ { "lang": "Console", "source": "POST _transform/ecommerce_transform/_schedule_now\n" + }, + { + "lang": "Python", + "source": "resp = client.transform.schedule_now_transform(\n transform_id=\"ecommerce_transform\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.scheduleNowTransform({\n transform_id: \"ecommerce_transform\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.schedule_now_transform(\n transform_id: \"ecommerce_transform\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->scheduleNowTransform([\n \"transform_id\" => \"ecommerce_transform\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/ecommerce_transform/_schedule_now\"" } ] } @@ -46242,6 +60998,26 @@ { "lang": "Console", "source": "POST _transform/ecommerce-customer-transform/_start\n" + }, + { + "lang": "Python", + "source": "resp = client.transform.start_transform(\n transform_id=\"ecommerce-customer-transform\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.startTransform({\n transform_id: \"ecommerce-customer-transform\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.start_transform(\n transform_id: \"ecommerce-customer-transform\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->startTransform([\n \"transform_id\" => \"ecommerce-customer-transform\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/ecommerce-customer-transform/_start\"" } ] } @@ -46340,6 +61116,26 @@ { "lang": "Console", "source": "POST _transform/ecommerce_transform/_stop\n" + }, + { + "lang": "Python", + "source": "resp = client.transform.stop_transform(\n transform_id=\"ecommerce_transform\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.stopTransform({\n transform_id: \"ecommerce_transform\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.stop_transform(\n transform_id: \"ecommerce_transform\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->stopTransform([\n \"transform_id\" => \"ecommerce_transform\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/ecommerce_transform/_stop\"" } ] } @@ -46513,6 +61309,26 @@ { "lang": "Console", "source": "POST _transform/simple-kibana-ecomm-pivot/_update\n{\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\",\n \"query\": {\n \"term\": {\n \"geoip.continent_name\": {\n \"value\": \"Asia\"\n }\n }\n }\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n \"description\": \"Maximum priced ecommerce data by customer_id in Asia\",\n \"dest\": {\n \"index\": \"kibana_sample_data_ecommerce_transform1\",\n \"pipeline\": \"add_timestamp_pipeline\"\n },\n \"frequency\": \"5m\",\n \"sync\": {\n \"time\": {\n \"field\": \"order_date\",\n \"delay\": \"60s\"\n }\n },\n \"retention_policy\": {\n \"time\": {\n \"field\": \"order_date\",\n \"max_age\": \"30d\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.transform.update_transform(\n transform_id=\"simple-kibana-ecomm-pivot\",\n source={\n \"index\": \"kibana_sample_data_ecommerce\",\n \"query\": {\n \"term\": {\n \"geoip.continent_name\": {\n \"value\": \"Asia\"\n }\n }\n }\n },\n pivot={\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": True\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n description=\"Maximum priced ecommerce data by customer_id in Asia\",\n dest={\n \"index\": \"kibana_sample_data_ecommerce_transform1\",\n \"pipeline\": \"add_timestamp_pipeline\"\n },\n frequency=\"5m\",\n sync={\n \"time\": {\n \"field\": \"order_date\",\n \"delay\": \"60s\"\n }\n },\n retention_policy={\n \"time\": {\n \"field\": \"order_date\",\n \"max_age\": \"30d\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.updateTransform({\n transform_id: \"simple-kibana-ecomm-pivot\",\n source: {\n index: \"kibana_sample_data_ecommerce\",\n query: {\n term: {\n \"geoip.continent_name\": {\n value: \"Asia\",\n },\n },\n },\n },\n pivot: {\n group_by: {\n customer_id: {\n terms: {\n field: \"customer_id\",\n missing_bucket: true,\n },\n },\n },\n aggregations: {\n max_price: {\n max: {\n field: \"taxful_total_price\",\n },\n },\n },\n },\n description: \"Maximum priced ecommerce data by customer_id in Asia\",\n dest: {\n index: \"kibana_sample_data_ecommerce_transform1\",\n pipeline: \"add_timestamp_pipeline\",\n },\n frequency: \"5m\",\n sync: {\n time: {\n field: \"order_date\",\n delay: \"60s\",\n },\n },\n retention_policy: {\n time: {\n field: \"order_date\",\n max_age: \"30d\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.update_transform(\n transform_id: \"simple-kibana-ecomm-pivot\",\n body: {\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\",\n \"query\": {\n \"term\": {\n \"geoip.continent_name\": {\n \"value\": \"Asia\"\n }\n }\n }\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n \"description\": \"Maximum priced ecommerce data by customer_id in Asia\",\n \"dest\": {\n \"index\": \"kibana_sample_data_ecommerce_transform1\",\n \"pipeline\": \"add_timestamp_pipeline\"\n },\n \"frequency\": \"5m\",\n \"sync\": {\n \"time\": {\n \"field\": \"order_date\",\n \"delay\": \"60s\"\n }\n },\n \"retention_policy\": {\n \"time\": {\n \"field\": \"order_date\",\n \"max_age\": \"30d\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->updateTransform([\n \"transform_id\" => \"simple-kibana-ecomm-pivot\",\n \"body\" => [\n \"source\" => [\n \"index\" => \"kibana_sample_data_ecommerce\",\n \"query\" => [\n \"term\" => [\n \"geoip.continent_name\" => [\n \"value\" => \"Asia\",\n ],\n ],\n ],\n ],\n \"pivot\" => [\n \"group_by\" => [\n \"customer_id\" => [\n \"terms\" => [\n \"field\" => \"customer_id\",\n \"missing_bucket\" => true,\n ],\n ],\n ],\n \"aggregations\" => [\n \"max_price\" => [\n \"max\" => [\n \"field\" => \"taxful_total_price\",\n ],\n ],\n ],\n ],\n \"description\" => \"Maximum priced ecommerce data by customer_id in Asia\",\n \"dest\" => [\n \"index\" => \"kibana_sample_data_ecommerce_transform1\",\n \"pipeline\" => \"add_timestamp_pipeline\",\n ],\n \"frequency\" => \"5m\",\n \"sync\" => [\n \"time\" => [\n \"field\" => \"order_date\",\n \"delay\" => \"60s\",\n ],\n ],\n \"retention_policy\" => [\n \"time\" => [\n \"field\" => \"order_date\",\n \"max_age\" => \"30d\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"kibana_sample_data_ecommerce\",\"query\":{\"term\":{\"geoip.continent_name\":{\"value\":\"Asia\"}}}},\"pivot\":{\"group_by\":{\"customer_id\":{\"terms\":{\"field\":\"customer_id\",\"missing_bucket\":true}}},\"aggregations\":{\"max_price\":{\"max\":{\"field\":\"taxful_total_price\"}}}},\"description\":\"Maximum priced ecommerce data by customer_id in Asia\",\"dest\":{\"index\":\"kibana_sample_data_ecommerce_transform1\",\"pipeline\":\"add_timestamp_pipeline\"},\"frequency\":\"5m\",\"sync\":{\"time\":{\"field\":\"order_date\",\"delay\":\"60s\"}},\"retention_policy\":{\"time\":{\"field\":\"order_date\",\"max_age\":\"30d\"}}}' \"$ELASTICSEARCH_URL/_transform/simple-kibana-ecomm-pivot/_update\"" } ] } @@ -46589,6 +61405,26 @@ { "lang": "Console", "source": "POST _transform/_upgrade\n" + }, + { + "lang": "Python", + "source": "resp = client.transform.upgrade_transforms()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.upgradeTransforms();" + }, + { + "lang": "Ruby", + "source": "response = client.transform.upgrade_transforms" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->upgradeTransforms();" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/_upgrade\"" } ] } @@ -46873,6 +61709,26 @@ { "lang": "Console", "source": "POST test/_update/1\n{\n \"script\" : {\n \"source\": \"ctx._source.counter += params.count\",\n \"lang\": \"painless\",\n \"params\" : {\n \"count\" : 4\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.update(\n index=\"test\",\n id=\"1\",\n script={\n \"source\": \"ctx._source.counter += params.count\",\n \"lang\": \"painless\",\n \"params\": {\n \"count\": 4\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.update({\n index: \"test\",\n id: 1,\n script: {\n source: \"ctx._source.counter += params.count\",\n lang: \"painless\",\n params: {\n count: 4,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.update(\n index: \"test\",\n id: \"1\",\n body: {\n \"script\": {\n \"source\": \"ctx._source.counter += params.count\",\n \"lang\": \"painless\",\n \"params\": {\n \"count\": 4\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->update([\n \"index\" => \"test\",\n \"id\" => \"1\",\n \"body\" => [\n \"script\" => [\n \"source\" => \"ctx._source.counter += params.count\",\n \"lang\" => \"painless\",\n \"params\" => [\n \"count\" => 4,\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"source\":\"ctx._source.counter += params.count\",\"lang\":\"painless\",\"params\":{\"count\":4}}}' \"$ELASTICSEARCH_URL/test/_update/1\"" } ] } @@ -47342,6 +62198,26 @@ { "lang": "Console", "source": "POST my-index-000001/_update_by_query?conflicts=proceed\n{\n \"query\": { \n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.update_by_query(\n index=\"my-index-000001\",\n conflicts=\"proceed\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.updateByQuery({\n index: \"my-index-000001\",\n conflicts: \"proceed\",\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.update_by_query(\n index: \"my-index-000001\",\n conflicts: \"proceed\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->updateByQuery([\n \"index\" => \"my-index-000001\",\n \"conflicts\" => \"proceed\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_update_by_query?conflicts=proceed\"" } ] } @@ -47405,6 +62281,26 @@ { "lang": "Console", "source": "POST _update_by_query/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1\n" + }, + { + "lang": "Python", + "source": "resp = client.update_by_query_rethrottle(\n task_id=\"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second=\"-1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.updateByQueryRethrottle({\n task_id: \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second: \"-1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.update_by_query_rethrottle(\n task_id: \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second: \"-1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->updateByQueryRethrottle([\n \"task_id\" => \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n \"requests_per_second\" => \"-1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_update_by_query/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1\"" } ] } @@ -47431,6 +62327,26 @@ { "lang": "Console", "source": "POST _watcher/watch/my_watch/_ack\n" + }, + { + "lang": "Python", + "source": "resp = client.watcher.ack_watch(\n watch_id=\"my_watch\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.watcher.ackWatch({\n watch_id: \"my_watch\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.watcher.ack_watch(\n watch_id: \"my_watch\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->watcher()->ackWatch([\n \"watch_id\" => \"my_watch\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/watch/my_watch/_ack\"" } ] }, @@ -47455,6 +62371,26 @@ { "lang": "Console", "source": "POST _watcher/watch/my_watch/_ack\n" + }, + { + "lang": "Python", + "source": "resp = client.watcher.ack_watch(\n watch_id=\"my_watch\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.watcher.ackWatch({\n watch_id: \"my_watch\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.watcher.ack_watch(\n watch_id: \"my_watch\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->watcher()->ackWatch([\n \"watch_id\" => \"my_watch\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/watch/my_watch/_ack\"" } ] } @@ -47484,6 +62420,26 @@ { "lang": "Console", "source": "POST _watcher/watch/my_watch/_ack\n" + }, + { + "lang": "Python", + "source": "resp = client.watcher.ack_watch(\n watch_id=\"my_watch\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.watcher.ackWatch({\n watch_id: \"my_watch\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.watcher.ack_watch(\n watch_id: \"my_watch\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->watcher()->ackWatch([\n \"watch_id\" => \"my_watch\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/watch/my_watch/_ack\"" } ] }, @@ -47511,6 +62467,26 @@ { "lang": "Console", "source": "POST _watcher/watch/my_watch/_ack\n" + }, + { + "lang": "Python", + "source": "resp = client.watcher.ack_watch(\n watch_id=\"my_watch\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.watcher.ackWatch({\n watch_id: \"my_watch\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.watcher.ack_watch(\n watch_id: \"my_watch\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->watcher()->ackWatch([\n \"watch_id\" => \"my_watch\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/watch/my_watch/_ack\"" } ] } @@ -47540,6 +62516,26 @@ { "lang": "Console", "source": "PUT _watcher/watch/my_watch/_activate\n" + }, + { + "lang": "Python", + "source": "resp = client.watcher.activate_watch(\n watch_id=\"my_watch\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.watcher.activateWatch({\n watch_id: \"my_watch\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.watcher.activate_watch(\n watch_id: \"my_watch\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->watcher()->activateWatch([\n \"watch_id\" => \"my_watch\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/watch/my_watch/_activate\"" } ] }, @@ -47567,6 +62563,26 @@ { "lang": "Console", "source": "PUT _watcher/watch/my_watch/_activate\n" + }, + { + "lang": "Python", + "source": "resp = client.watcher.activate_watch(\n watch_id=\"my_watch\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.watcher.activateWatch({\n watch_id: \"my_watch\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.watcher.activate_watch(\n watch_id: \"my_watch\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->watcher()->activateWatch([\n \"watch_id\" => \"my_watch\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/watch/my_watch/_activate\"" } ] } @@ -47596,6 +62612,26 @@ { "lang": "Console", "source": "PUT _watcher/watch/my_watch/_deactivate\n" + }, + { + "lang": "Python", + "source": "resp = client.watcher.deactivate_watch(\n watch_id=\"my_watch\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.watcher.deactivateWatch({\n watch_id: \"my_watch\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.watcher.deactivate_watch(\n watch_id: \"my_watch\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->watcher()->deactivateWatch([\n \"watch_id\" => \"my_watch\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/watch/my_watch/_deactivate\"" } ] }, @@ -47623,6 +62659,26 @@ { "lang": "Console", "source": "PUT _watcher/watch/my_watch/_deactivate\n" + }, + { + "lang": "Python", + "source": "resp = client.watcher.deactivate_watch(\n watch_id=\"my_watch\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.watcher.deactivateWatch({\n watch_id: \"my_watch\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.watcher.deactivate_watch(\n watch_id: \"my_watch\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->watcher()->deactivateWatch([\n \"watch_id\" => \"my_watch\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/watch/my_watch/_deactivate\"" } ] } @@ -47698,6 +62754,26 @@ { "lang": "Console", "source": "GET _watcher/watch/my_watch\n" + }, + { + "lang": "Python", + "source": "resp = client.watcher.get_watch(\n id=\"my_watch\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.watcher.getWatch({\n id: \"my_watch\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.watcher.get_watch(\n id: \"my_watch\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->watcher()->getWatch([\n \"id\" => \"my_watch\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/watch/my_watch\"" } ] }, @@ -47737,6 +62813,26 @@ { "lang": "Console", "source": "PUT _watcher/watch/my-watch\n{\n \"trigger\" : {\n \"schedule\" : { \"cron\" : \"0 0/1 * * * ?\" }\n },\n \"input\" : {\n \"search\" : {\n \"request\" : {\n \"indices\" : [\n \"logstash*\"\n ],\n \"body\" : {\n \"query\" : {\n \"bool\" : {\n \"must\" : {\n \"match\": {\n \"response\": 404\n }\n },\n \"filter\" : {\n \"range\": {\n \"@timestamp\": {\n \"from\": \"{{ctx.trigger.scheduled_time}}||-5m\",\n \"to\": \"{{ctx.trigger.triggered_time}}\"\n }\n }\n }\n }\n }\n }\n }\n }\n },\n \"condition\" : {\n \"compare\" : { \"ctx.payload.hits.total\" : { \"gt\" : 0 }}\n },\n \"actions\" : {\n \"email_admin\" : {\n \"email\" : {\n \"to\" : \"admin@domain.host.com\",\n \"subject\" : \"404 recently encountered\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.watcher.put_watch(\n id=\"my-watch\",\n trigger={\n \"schedule\": {\n \"cron\": \"0 0/1 * * * ?\"\n }\n },\n input={\n \"search\": {\n \"request\": {\n \"indices\": [\n \"logstash*\"\n ],\n \"body\": {\n \"query\": {\n \"bool\": {\n \"must\": {\n \"match\": {\n \"response\": 404\n }\n },\n \"filter\": {\n \"range\": {\n \"@timestamp\": {\n \"from\": \"{{ctx.trigger.scheduled_time}}||-5m\",\n \"to\": \"{{ctx.trigger.triggered_time}}\"\n }\n }\n }\n }\n }\n }\n }\n }\n },\n condition={\n \"compare\": {\n \"ctx.payload.hits.total\": {\n \"gt\": 0\n }\n }\n },\n actions={\n \"email_admin\": {\n \"email\": {\n \"to\": \"admin@domain.host.com\",\n \"subject\": \"404 recently encountered\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.watcher.putWatch({\n id: \"my-watch\",\n trigger: {\n schedule: {\n cron: \"0 0/1 * * * ?\",\n },\n },\n input: {\n search: {\n request: {\n indices: [\"logstash*\"],\n body: {\n query: {\n bool: {\n must: {\n match: {\n response: 404,\n },\n },\n filter: {\n range: {\n \"@timestamp\": {\n from: \"{{ctx.trigger.scheduled_time}}||-5m\",\n to: \"{{ctx.trigger.triggered_time}}\",\n },\n },\n },\n },\n },\n },\n },\n },\n },\n condition: {\n compare: {\n \"ctx.payload.hits.total\": {\n gt: 0,\n },\n },\n },\n actions: {\n email_admin: {\n email: {\n to: \"admin@domain.host.com\",\n subject: \"404 recently encountered\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.watcher.put_watch(\n id: \"my-watch\",\n body: {\n \"trigger\": {\n \"schedule\": {\n \"cron\": \"0 0/1 * * * ?\"\n }\n },\n \"input\": {\n \"search\": {\n \"request\": {\n \"indices\": [\n \"logstash*\"\n ],\n \"body\": {\n \"query\": {\n \"bool\": {\n \"must\": {\n \"match\": {\n \"response\": 404\n }\n },\n \"filter\": {\n \"range\": {\n \"@timestamp\": {\n \"from\": \"{{ctx.trigger.scheduled_time}}||-5m\",\n \"to\": \"{{ctx.trigger.triggered_time}}\"\n }\n }\n }\n }\n }\n }\n }\n }\n },\n \"condition\": {\n \"compare\": {\n \"ctx.payload.hits.total\": {\n \"gt\": 0\n }\n }\n },\n \"actions\": {\n \"email_admin\": {\n \"email\": {\n \"to\": \"admin@domain.host.com\",\n \"subject\": \"404 recently encountered\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->watcher()->putWatch([\n \"id\" => \"my-watch\",\n \"body\" => [\n \"trigger\" => [\n \"schedule\" => [\n \"cron\" => \"0 0/1 * * * ?\",\n ],\n ],\n \"input\" => [\n \"search\" => [\n \"request\" => [\n \"indices\" => array(\n \"logstash*\",\n ),\n \"body\" => [\n \"query\" => [\n \"bool\" => [\n \"must\" => [\n \"match\" => [\n \"response\" => 404,\n ],\n ],\n \"filter\" => [\n \"range\" => [\n \"@timestamp\" => [\n \"from\" => \"{{ctx.trigger.scheduled_time}}||-5m\",\n \"to\" => \"{{ctx.trigger.triggered_time}}\",\n ],\n ],\n ],\n ],\n ],\n ],\n ],\n ],\n ],\n \"condition\" => [\n \"compare\" => [\n \"ctx.payload.hits.total\" => [\n \"gt\" => 0,\n ],\n ],\n ],\n \"actions\" => [\n \"email_admin\" => [\n \"email\" => [\n \"to\" => \"admin@domain.host.com\",\n \"subject\" => \"404 recently encountered\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"trigger\":{\"schedule\":{\"cron\":\"0 0/1 * * * ?\"}},\"input\":{\"search\":{\"request\":{\"indices\":[\"logstash*\"],\"body\":{\"query\":{\"bool\":{\"must\":{\"match\":{\"response\":404}},\"filter\":{\"range\":{\"@timestamp\":{\"from\":\"{{ctx.trigger.scheduled_time}}||-5m\",\"to\":\"{{ctx.trigger.triggered_time}}\"}}}}}}}}},\"condition\":{\"compare\":{\"ctx.payload.hits.total\":{\"gt\":0}}},\"actions\":{\"email_admin\":{\"email\":{\"to\":\"admin@domain.host.com\",\"subject\":\"404 recently encountered\"}}}}' \"$ELASTICSEARCH_URL/_watcher/watch/my-watch\"" } ] }, @@ -47776,6 +62872,26 @@ { "lang": "Console", "source": "PUT _watcher/watch/my-watch\n{\n \"trigger\" : {\n \"schedule\" : { \"cron\" : \"0 0/1 * * * ?\" }\n },\n \"input\" : {\n \"search\" : {\n \"request\" : {\n \"indices\" : [\n \"logstash*\"\n ],\n \"body\" : {\n \"query\" : {\n \"bool\" : {\n \"must\" : {\n \"match\": {\n \"response\": 404\n }\n },\n \"filter\" : {\n \"range\": {\n \"@timestamp\": {\n \"from\": \"{{ctx.trigger.scheduled_time}}||-5m\",\n \"to\": \"{{ctx.trigger.triggered_time}}\"\n }\n }\n }\n }\n }\n }\n }\n }\n },\n \"condition\" : {\n \"compare\" : { \"ctx.payload.hits.total\" : { \"gt\" : 0 }}\n },\n \"actions\" : {\n \"email_admin\" : {\n \"email\" : {\n \"to\" : \"admin@domain.host.com\",\n \"subject\" : \"404 recently encountered\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.watcher.put_watch(\n id=\"my-watch\",\n trigger={\n \"schedule\": {\n \"cron\": \"0 0/1 * * * ?\"\n }\n },\n input={\n \"search\": {\n \"request\": {\n \"indices\": [\n \"logstash*\"\n ],\n \"body\": {\n \"query\": {\n \"bool\": {\n \"must\": {\n \"match\": {\n \"response\": 404\n }\n },\n \"filter\": {\n \"range\": {\n \"@timestamp\": {\n \"from\": \"{{ctx.trigger.scheduled_time}}||-5m\",\n \"to\": \"{{ctx.trigger.triggered_time}}\"\n }\n }\n }\n }\n }\n }\n }\n }\n },\n condition={\n \"compare\": {\n \"ctx.payload.hits.total\": {\n \"gt\": 0\n }\n }\n },\n actions={\n \"email_admin\": {\n \"email\": {\n \"to\": \"admin@domain.host.com\",\n \"subject\": \"404 recently encountered\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.watcher.putWatch({\n id: \"my-watch\",\n trigger: {\n schedule: {\n cron: \"0 0/1 * * * ?\",\n },\n },\n input: {\n search: {\n request: {\n indices: [\"logstash*\"],\n body: {\n query: {\n bool: {\n must: {\n match: {\n response: 404,\n },\n },\n filter: {\n range: {\n \"@timestamp\": {\n from: \"{{ctx.trigger.scheduled_time}}||-5m\",\n to: \"{{ctx.trigger.triggered_time}}\",\n },\n },\n },\n },\n },\n },\n },\n },\n },\n condition: {\n compare: {\n \"ctx.payload.hits.total\": {\n gt: 0,\n },\n },\n },\n actions: {\n email_admin: {\n email: {\n to: \"admin@domain.host.com\",\n subject: \"404 recently encountered\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.watcher.put_watch(\n id: \"my-watch\",\n body: {\n \"trigger\": {\n \"schedule\": {\n \"cron\": \"0 0/1 * * * ?\"\n }\n },\n \"input\": {\n \"search\": {\n \"request\": {\n \"indices\": [\n \"logstash*\"\n ],\n \"body\": {\n \"query\": {\n \"bool\": {\n \"must\": {\n \"match\": {\n \"response\": 404\n }\n },\n \"filter\": {\n \"range\": {\n \"@timestamp\": {\n \"from\": \"{{ctx.trigger.scheduled_time}}||-5m\",\n \"to\": \"{{ctx.trigger.triggered_time}}\"\n }\n }\n }\n }\n }\n }\n }\n }\n },\n \"condition\": {\n \"compare\": {\n \"ctx.payload.hits.total\": {\n \"gt\": 0\n }\n }\n },\n \"actions\": {\n \"email_admin\": {\n \"email\": {\n \"to\": \"admin@domain.host.com\",\n \"subject\": \"404 recently encountered\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->watcher()->putWatch([\n \"id\" => \"my-watch\",\n \"body\" => [\n \"trigger\" => [\n \"schedule\" => [\n \"cron\" => \"0 0/1 * * * ?\",\n ],\n ],\n \"input\" => [\n \"search\" => [\n \"request\" => [\n \"indices\" => array(\n \"logstash*\",\n ),\n \"body\" => [\n \"query\" => [\n \"bool\" => [\n \"must\" => [\n \"match\" => [\n \"response\" => 404,\n ],\n ],\n \"filter\" => [\n \"range\" => [\n \"@timestamp\" => [\n \"from\" => \"{{ctx.trigger.scheduled_time}}||-5m\",\n \"to\" => \"{{ctx.trigger.triggered_time}}\",\n ],\n ],\n ],\n ],\n ],\n ],\n ],\n ],\n ],\n \"condition\" => [\n \"compare\" => [\n \"ctx.payload.hits.total\" => [\n \"gt\" => 0,\n ],\n ],\n ],\n \"actions\" => [\n \"email_admin\" => [\n \"email\" => [\n \"to\" => \"admin@domain.host.com\",\n \"subject\" => \"404 recently encountered\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"trigger\":{\"schedule\":{\"cron\":\"0 0/1 * * * ?\"}},\"input\":{\"search\":{\"request\":{\"indices\":[\"logstash*\"],\"body\":{\"query\":{\"bool\":{\"must\":{\"match\":{\"response\":404}},\"filter\":{\"range\":{\"@timestamp\":{\"from\":\"{{ctx.trigger.scheduled_time}}||-5m\",\"to\":\"{{ctx.trigger.triggered_time}}\"}}}}}}}}},\"condition\":{\"compare\":{\"ctx.payload.hits.total\":{\"gt\":0}}},\"actions\":{\"email_admin\":{\"email\":{\"to\":\"admin@domain.host.com\",\"subject\":\"404 recently encountered\"}}}}' \"$ELASTICSEARCH_URL/_watcher/watch/my-watch\"" } ] }, @@ -47837,6 +62953,26 @@ { "lang": "Console", "source": "DELETE _watcher/watch/my_watch\n" + }, + { + "lang": "Python", + "source": "resp = client.watcher.delete_watch(\n id=\"my_watch\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.watcher.deleteWatch({\n id: \"my_watch\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.watcher.delete_watch(\n id: \"my_watch\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->watcher()->deleteWatch([\n \"id\" => \"my_watch\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/watch/my_watch\"" } ] } @@ -47869,6 +63005,26 @@ { "lang": "Console", "source": "POST _watcher/watch/my_watch/_execute\n{\n \"trigger_data\" : { \n \"triggered_time\" : \"now\",\n \"scheduled_time\" : \"now\"\n },\n \"alternative_input\" : { \n \"foo\" : \"bar\"\n },\n \"ignore_condition\" : true, \n \"action_modes\" : {\n \"my-action\" : \"force_simulate\" \n },\n \"record_execution\" : true \n}" + }, + { + "lang": "Python", + "source": "resp = client.watcher.execute_watch(\n id=\"my_watch\",\n trigger_data={\n \"triggered_time\": \"now\",\n \"scheduled_time\": \"now\"\n },\n alternative_input={\n \"foo\": \"bar\"\n },\n ignore_condition=True,\n action_modes={\n \"my-action\": \"force_simulate\"\n },\n record_execution=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.watcher.executeWatch({\n id: \"my_watch\",\n trigger_data: {\n triggered_time: \"now\",\n scheduled_time: \"now\",\n },\n alternative_input: {\n foo: \"bar\",\n },\n ignore_condition: true,\n action_modes: {\n \"my-action\": \"force_simulate\",\n },\n record_execution: true,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.watcher.execute_watch(\n id: \"my_watch\",\n body: {\n \"trigger_data\": {\n \"triggered_time\": \"now\",\n \"scheduled_time\": \"now\"\n },\n \"alternative_input\": {\n \"foo\": \"bar\"\n },\n \"ignore_condition\": true,\n \"action_modes\": {\n \"my-action\": \"force_simulate\"\n },\n \"record_execution\": true\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->watcher()->executeWatch([\n \"id\" => \"my_watch\",\n \"body\" => [\n \"trigger_data\" => [\n \"triggered_time\" => \"now\",\n \"scheduled_time\" => \"now\",\n ],\n \"alternative_input\" => [\n \"foo\" => \"bar\",\n ],\n \"ignore_condition\" => true,\n \"action_modes\" => [\n \"my-action\" => \"force_simulate\",\n ],\n \"record_execution\" => true,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"trigger_data\":{\"triggered_time\":\"now\",\"scheduled_time\":\"now\"},\"alternative_input\":{\"foo\":\"bar\"},\"ignore_condition\":true,\"action_modes\":{\"my-action\":\"force_simulate\"},\"record_execution\":true}' \"$ELASTICSEARCH_URL/_watcher/watch/my_watch/_execute\"" } ] }, @@ -47899,6 +63055,26 @@ { "lang": "Console", "source": "POST _watcher/watch/my_watch/_execute\n{\n \"trigger_data\" : { \n \"triggered_time\" : \"now\",\n \"scheduled_time\" : \"now\"\n },\n \"alternative_input\" : { \n \"foo\" : \"bar\"\n },\n \"ignore_condition\" : true, \n \"action_modes\" : {\n \"my-action\" : \"force_simulate\" \n },\n \"record_execution\" : true \n}" + }, + { + "lang": "Python", + "source": "resp = client.watcher.execute_watch(\n id=\"my_watch\",\n trigger_data={\n \"triggered_time\": \"now\",\n \"scheduled_time\": \"now\"\n },\n alternative_input={\n \"foo\": \"bar\"\n },\n ignore_condition=True,\n action_modes={\n \"my-action\": \"force_simulate\"\n },\n record_execution=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.watcher.executeWatch({\n id: \"my_watch\",\n trigger_data: {\n triggered_time: \"now\",\n scheduled_time: \"now\",\n },\n alternative_input: {\n foo: \"bar\",\n },\n ignore_condition: true,\n action_modes: {\n \"my-action\": \"force_simulate\",\n },\n record_execution: true,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.watcher.execute_watch(\n id: \"my_watch\",\n body: {\n \"trigger_data\": {\n \"triggered_time\": \"now\",\n \"scheduled_time\": \"now\"\n },\n \"alternative_input\": {\n \"foo\": \"bar\"\n },\n \"ignore_condition\": true,\n \"action_modes\": {\n \"my-action\": \"force_simulate\"\n },\n \"record_execution\": true\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->watcher()->executeWatch([\n \"id\" => \"my_watch\",\n \"body\" => [\n \"trigger_data\" => [\n \"triggered_time\" => \"now\",\n \"scheduled_time\" => \"now\",\n ],\n \"alternative_input\" => [\n \"foo\" => \"bar\",\n ],\n \"ignore_condition\" => true,\n \"action_modes\" => [\n \"my-action\" => \"force_simulate\",\n ],\n \"record_execution\" => true,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"trigger_data\":{\"triggered_time\":\"now\",\"scheduled_time\":\"now\"},\"alternative_input\":{\"foo\":\"bar\"},\"ignore_condition\":true,\"action_modes\":{\"my-action\":\"force_simulate\"},\"record_execution\":true}' \"$ELASTICSEARCH_URL/_watcher/watch/my_watch/_execute\"" } ] } @@ -47928,6 +63104,26 @@ { "lang": "Console", "source": "POST _watcher/watch/my_watch/_execute\n{\n \"trigger_data\" : { \n \"triggered_time\" : \"now\",\n \"scheduled_time\" : \"now\"\n },\n \"alternative_input\" : { \n \"foo\" : \"bar\"\n },\n \"ignore_condition\" : true, \n \"action_modes\" : {\n \"my-action\" : \"force_simulate\" \n },\n \"record_execution\" : true \n}" + }, + { + "lang": "Python", + "source": "resp = client.watcher.execute_watch(\n id=\"my_watch\",\n trigger_data={\n \"triggered_time\": \"now\",\n \"scheduled_time\": \"now\"\n },\n alternative_input={\n \"foo\": \"bar\"\n },\n ignore_condition=True,\n action_modes={\n \"my-action\": \"force_simulate\"\n },\n record_execution=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.watcher.executeWatch({\n id: \"my_watch\",\n trigger_data: {\n triggered_time: \"now\",\n scheduled_time: \"now\",\n },\n alternative_input: {\n foo: \"bar\",\n },\n ignore_condition: true,\n action_modes: {\n \"my-action\": \"force_simulate\",\n },\n record_execution: true,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.watcher.execute_watch(\n id: \"my_watch\",\n body: {\n \"trigger_data\": {\n \"triggered_time\": \"now\",\n \"scheduled_time\": \"now\"\n },\n \"alternative_input\": {\n \"foo\": \"bar\"\n },\n \"ignore_condition\": true,\n \"action_modes\": {\n \"my-action\": \"force_simulate\"\n },\n \"record_execution\": true\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->watcher()->executeWatch([\n \"id\" => \"my_watch\",\n \"body\" => [\n \"trigger_data\" => [\n \"triggered_time\" => \"now\",\n \"scheduled_time\" => \"now\",\n ],\n \"alternative_input\" => [\n \"foo\" => \"bar\",\n ],\n \"ignore_condition\" => true,\n \"action_modes\" => [\n \"my-action\" => \"force_simulate\",\n ],\n \"record_execution\" => true,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"trigger_data\":{\"triggered_time\":\"now\",\"scheduled_time\":\"now\"},\"alternative_input\":{\"foo\":\"bar\"},\"ignore_condition\":true,\"action_modes\":{\"my-action\":\"force_simulate\"},\"record_execution\":true}' \"$ELASTICSEARCH_URL/_watcher/watch/my_watch/_execute\"" } ] }, @@ -47955,6 +63151,26 @@ { "lang": "Console", "source": "POST _watcher/watch/my_watch/_execute\n{\n \"trigger_data\" : { \n \"triggered_time\" : \"now\",\n \"scheduled_time\" : \"now\"\n },\n \"alternative_input\" : { \n \"foo\" : \"bar\"\n },\n \"ignore_condition\" : true, \n \"action_modes\" : {\n \"my-action\" : \"force_simulate\" \n },\n \"record_execution\" : true \n}" + }, + { + "lang": "Python", + "source": "resp = client.watcher.execute_watch(\n id=\"my_watch\",\n trigger_data={\n \"triggered_time\": \"now\",\n \"scheduled_time\": \"now\"\n },\n alternative_input={\n \"foo\": \"bar\"\n },\n ignore_condition=True,\n action_modes={\n \"my-action\": \"force_simulate\"\n },\n record_execution=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.watcher.executeWatch({\n id: \"my_watch\",\n trigger_data: {\n triggered_time: \"now\",\n scheduled_time: \"now\",\n },\n alternative_input: {\n foo: \"bar\",\n },\n ignore_condition: true,\n action_modes: {\n \"my-action\": \"force_simulate\",\n },\n record_execution: true,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.watcher.execute_watch(\n id: \"my_watch\",\n body: {\n \"trigger_data\": {\n \"triggered_time\": \"now\",\n \"scheduled_time\": \"now\"\n },\n \"alternative_input\": {\n \"foo\": \"bar\"\n },\n \"ignore_condition\": true,\n \"action_modes\": {\n \"my-action\": \"force_simulate\"\n },\n \"record_execution\": true\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->watcher()->executeWatch([\n \"id\" => \"my_watch\",\n \"body\" => [\n \"trigger_data\" => [\n \"triggered_time\" => \"now\",\n \"scheduled_time\" => \"now\",\n ],\n \"alternative_input\" => [\n \"foo\" => \"bar\",\n ],\n \"ignore_condition\" => true,\n \"action_modes\" => [\n \"my-action\" => \"force_simulate\",\n ],\n \"record_execution\" => true,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"trigger_data\":{\"triggered_time\":\"now\",\"scheduled_time\":\"now\"},\"alternative_input\":{\"foo\":\"bar\"},\"ignore_condition\":true,\"action_modes\":{\"my-action\":\"force_simulate\"},\"record_execution\":true}' \"$ELASTICSEARCH_URL/_watcher/watch/my_watch/_execute\"" } ] } @@ -48009,6 +63225,26 @@ { "lang": "Console", "source": "GET /_watcher/settings\n" + }, + { + "lang": "Python", + "source": "resp = client.watcher.get_settings()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.watcher.getSettings();" + }, + { + "lang": "Ruby", + "source": "response = client.watcher.get_settings" + }, + { + "lang": "PHP", + "source": "$resp = $client->watcher()->getSettings();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/settings\"" } ] }, @@ -48088,6 +63324,26 @@ { "lang": "Console", "source": "PUT /_watcher/settings\n{\n \"index.auto_expand_replicas\": \"0-4\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.watcher.update_settings(\n index.auto_expand_replicas=\"0-4\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.watcher.updateSettings({\n \"index.auto_expand_replicas\": \"0-4\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.watcher.update_settings(\n body: {\n \"index.auto_expand_replicas\": \"0-4\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->watcher()->updateSettings([\n \"body\" => [\n \"index.auto_expand_replicas\" => \"0-4\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index.auto_expand_replicas\":\"0-4\"}' \"$ELASTICSEARCH_URL/_watcher/settings\"" } ] } @@ -48113,6 +63369,26 @@ { "lang": "Console", "source": "GET /_watcher/_query/watches\n" + }, + { + "lang": "Python", + "source": "resp = client.watcher.query_watches()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.watcher.queryWatches();" + }, + { + "lang": "Ruby", + "source": "response = client.watcher.query_watches" + }, + { + "lang": "PHP", + "source": "$resp = $client->watcher()->queryWatches();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/_query/watches\"" } ] }, @@ -48136,6 +63412,26 @@ { "lang": "Console", "source": "GET /_watcher/_query/watches\n" + }, + { + "lang": "Python", + "source": "resp = client.watcher.query_watches()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.watcher.queryWatches();" + }, + { + "lang": "Ruby", + "source": "response = client.watcher.query_watches" + }, + { + "lang": "PHP", + "source": "$resp = $client->watcher()->queryWatches();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/_query/watches\"" } ] } @@ -48182,6 +63478,26 @@ { "lang": "Console", "source": "POST _watcher/_start\n" + }, + { + "lang": "Python", + "source": "resp = client.watcher.start()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.watcher.start();" + }, + { + "lang": "Ruby", + "source": "response = client.watcher.start" + }, + { + "lang": "PHP", + "source": "$resp = $client->watcher()->start();" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/_start\"" } ] } @@ -48212,6 +63528,26 @@ { "lang": "Console", "source": "GET _watcher/stats\n" + }, + { + "lang": "Python", + "source": "resp = client.watcher.stats()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.watcher.stats();" + }, + { + "lang": "Ruby", + "source": "response = client.watcher.stats" + }, + { + "lang": "PHP", + "source": "$resp = $client->watcher()->stats();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/stats\"" } ] } @@ -48245,6 +63581,26 @@ { "lang": "Console", "source": "GET _watcher/stats\n" + }, + { + "lang": "Python", + "source": "resp = client.watcher.stats()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.watcher.stats();" + }, + { + "lang": "Ruby", + "source": "response = client.watcher.stats" + }, + { + "lang": "PHP", + "source": "$resp = $client->watcher()->stats();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/stats\"" } ] } @@ -48291,6 +63647,26 @@ { "lang": "Console", "source": "POST _watcher/_stop\n" + }, + { + "lang": "Python", + "source": "resp = client.watcher.stop()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.watcher.stop();" + }, + { + "lang": "Ruby", + "source": "response = client.watcher.stop" + }, + { + "lang": "PHP", + "source": "$resp = $client->watcher()->stop();" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/_stop\"" } ] } @@ -48380,6 +63756,26 @@ { "lang": "Console", "source": "GET /_xpack\n" + }, + { + "lang": "Python", + "source": "resp = client.xpack.info()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.xpack.info();" + }, + { + "lang": "Ruby", + "source": "response = client.xpack.info" + }, + { + "lang": "PHP", + "source": "$resp = $client->xpack()->info();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_xpack\"" } ] } @@ -48534,6 +63930,26 @@ { "lang": "Console", "source": "GET /_xpack/usage\n" + }, + { + "lang": "Python", + "source": "resp = client.xpack.usage()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.xpack.usage();" + }, + { + "lang": "Ruby", + "source": "response = client.xpack.usage" + }, + { + "lang": "PHP", + "source": "$resp = $client->xpack()->usage();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_xpack/usage\"" } ] } @@ -72502,6 +87918,7 @@ ] }, "_types.NodeRoles": { + "description": "* @doc_id node-roles", "type": "array", "items": { "$ref": "#/components/schemas/_types.NodeRole" @@ -84508,6 +99925,7 @@ ] }, "inference._types.RateLimitSetting": { + "description": "This setting helps to minimize the number of rate limit errors returned from the service.", "type": "object", "properties": { "requests_per_minute": { diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 76d680cc24..514af04ba8 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -83,6 +83,26 @@ { "lang": "Console", "source": "GET /_async_search/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\n" + }, + { + "lang": "Python", + "source": "resp = client.async_search.get(\n id=\"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.asyncSearch.get({\n id: \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.async_search.get(\n id: \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->asyncSearch()->get([\n \"id\" => \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_async_search/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\"" } ] }, @@ -123,6 +143,26 @@ { "lang": "Console", "source": "DELETE /_async_search/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\n" + }, + { + "lang": "Python", + "source": "resp = client.async_search.delete(\n id=\"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.asyncSearch.delete({\n id: \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.async_search.delete(\n id: \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->asyncSearch()->delete([\n \"id\" => \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_async_search/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\"" } ] } @@ -192,6 +232,26 @@ { "lang": "Console", "source": "GET /_async_search/status/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\n" + }, + { + "lang": "Python", + "source": "resp = client.async_search.status(\n id=\"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.asyncSearch.status({\n id: \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.async_search.status(\n id: \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->asyncSearch()->status([\n \"id\" => \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_async_search/status/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\"" } ] } @@ -348,6 +408,26 @@ { "lang": "Console", "source": "POST /sales*/_async_search?size=0\n{\n \"sort\": [\n { \"date\": { \"order\": \"asc\" } }\n ],\n \"aggs\": {\n \"sale_date\": {\n \"date_histogram\": {\n \"field\": \"date\",\n \"calendar_interval\": \"1d\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.async_search.submit(\n index=\"sales*\",\n size=\"0\",\n sort=[\n {\n \"date\": {\n \"order\": \"asc\"\n }\n }\n ],\n aggs={\n \"sale_date\": {\n \"date_histogram\": {\n \"field\": \"date\",\n \"calendar_interval\": \"1d\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.asyncSearch.submit({\n index: \"sales*\",\n size: 0,\n sort: [\n {\n date: {\n order: \"asc\",\n },\n },\n ],\n aggs: {\n sale_date: {\n date_histogram: {\n field: \"date\",\n calendar_interval: \"1d\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.async_search.submit(\n index: \"sales*\",\n size: \"0\",\n body: {\n \"sort\": [\n {\n \"date\": {\n \"order\": \"asc\"\n }\n }\n ],\n \"aggs\": {\n \"sale_date\": {\n \"date_histogram\": {\n \"field\": \"date\",\n \"calendar_interval\": \"1d\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->asyncSearch()->submit([\n \"index\" => \"sales*\",\n \"size\" => \"0\",\n \"body\" => [\n \"sort\" => array(\n [\n \"date\" => [\n \"order\" => \"asc\",\n ],\n ],\n ),\n \"aggs\" => [\n \"sale_date\" => [\n \"date_histogram\" => [\n \"field\" => \"date\",\n \"calendar_interval\" => \"1d\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"sort\":[{\"date\":{\"order\":\"asc\"}}],\"aggs\":{\"sale_date\":{\"date_histogram\":{\"field\":\"date\",\"calendar_interval\":\"1d\"}}}}' \"$ELASTICSEARCH_URL/sales*/_async_search?size=0\"" } ] } @@ -507,6 +587,26 @@ { "lang": "Console", "source": "POST /sales*/_async_search?size=0\n{\n \"sort\": [\n { \"date\": { \"order\": \"asc\" } }\n ],\n \"aggs\": {\n \"sale_date\": {\n \"date_histogram\": {\n \"field\": \"date\",\n \"calendar_interval\": \"1d\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.async_search.submit(\n index=\"sales*\",\n size=\"0\",\n sort=[\n {\n \"date\": {\n \"order\": \"asc\"\n }\n }\n ],\n aggs={\n \"sale_date\": {\n \"date_histogram\": {\n \"field\": \"date\",\n \"calendar_interval\": \"1d\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.asyncSearch.submit({\n index: \"sales*\",\n size: 0,\n sort: [\n {\n date: {\n order: \"asc\",\n },\n },\n ],\n aggs: {\n sale_date: {\n date_histogram: {\n field: \"date\",\n calendar_interval: \"1d\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.async_search.submit(\n index: \"sales*\",\n size: \"0\",\n body: {\n \"sort\": [\n {\n \"date\": {\n \"order\": \"asc\"\n }\n }\n ],\n \"aggs\": {\n \"sale_date\": {\n \"date_histogram\": {\n \"field\": \"date\",\n \"calendar_interval\": \"1d\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->asyncSearch()->submit([\n \"index\" => \"sales*\",\n \"size\" => \"0\",\n \"body\" => [\n \"sort\" => array(\n [\n \"date\" => [\n \"order\" => \"asc\",\n ],\n ],\n ),\n \"aggs\" => [\n \"sale_date\" => [\n \"date_histogram\" => [\n \"field\" => \"date\",\n \"calendar_interval\" => \"1d\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"sort\":[{\"date\":{\"order\":\"asc\"}}],\"aggs\":{\"sale_date\":{\"date_histogram\":{\"field\":\"date\",\"calendar_interval\":\"1d\"}}}}' \"$ELASTICSEARCH_URL/sales*/_async_search?size=0\"" } ] } @@ -572,6 +672,26 @@ { "lang": "Console", "source": "POST _bulk\n{ \"index\" : { \"_index\" : \"test\", \"_id\" : \"1\" } }\n{ \"field1\" : \"value1\" }\n{ \"delete\" : { \"_index\" : \"test\", \"_id\" : \"2\" } }\n{ \"create\" : { \"_index\" : \"test\", \"_id\" : \"3\" } }\n{ \"field1\" : \"value3\" }\n{ \"update\" : {\"_id\" : \"1\", \"_index\" : \"test\"} }\n{ \"doc\" : {\"field2\" : \"value2\"} }" + }, + { + "lang": "Python", + "source": "resp = client.bulk(\n operations=[\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.bulk({\n operations: [\n {\n index: {\n _index: \"test\",\n _id: \"1\",\n },\n },\n {\n field1: \"value1\",\n },\n {\n delete: {\n _index: \"test\",\n _id: \"2\",\n },\n },\n {\n create: {\n _index: \"test\",\n _id: \"3\",\n },\n },\n {\n field1: \"value3\",\n },\n {\n update: {\n _id: \"1\",\n _index: \"test\",\n },\n },\n {\n doc: {\n field2: \"value2\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.bulk(\n body: [\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->bulk([\n \"body\" => array(\n [\n \"index\" => [\n \"_index\" => \"test\",\n \"_id\" => \"1\",\n ],\n ],\n [\n \"field1\" => \"value1\",\n ],\n [\n \"delete\" => [\n \"_index\" => \"test\",\n \"_id\" => \"2\",\n ],\n ],\n [\n \"create\" => [\n \"_index\" => \"test\",\n \"_id\" => \"3\",\n ],\n ],\n [\n \"field1\" => \"value3\",\n ],\n [\n \"update\" => [\n \"_id\" => \"1\",\n \"_index\" => \"test\",\n ],\n ],\n [\n \"doc\" => [\n \"field2\" => \"value2\",\n ],\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{\"index\":{\"_index\":\"test\",\"_id\":\"1\"}},{\"field1\":\"value1\"},{\"delete\":{\"_index\":\"test\",\"_id\":\"2\"}},{\"create\":{\"_index\":\"test\",\"_id\":\"3\"}},{\"field1\":\"value3\"},{\"update\":{\"_id\":\"1\",\"_index\":\"test\"}},{\"doc\":{\"field2\":\"value2\"}}]' \"$ELASTICSEARCH_URL/_bulk\"" } ] }, @@ -635,6 +755,26 @@ { "lang": "Console", "source": "POST _bulk\n{ \"index\" : { \"_index\" : \"test\", \"_id\" : \"1\" } }\n{ \"field1\" : \"value1\" }\n{ \"delete\" : { \"_index\" : \"test\", \"_id\" : \"2\" } }\n{ \"create\" : { \"_index\" : \"test\", \"_id\" : \"3\" } }\n{ \"field1\" : \"value3\" }\n{ \"update\" : {\"_id\" : \"1\", \"_index\" : \"test\"} }\n{ \"doc\" : {\"field2\" : \"value2\"} }" + }, + { + "lang": "Python", + "source": "resp = client.bulk(\n operations=[\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.bulk({\n operations: [\n {\n index: {\n _index: \"test\",\n _id: \"1\",\n },\n },\n {\n field1: \"value1\",\n },\n {\n delete: {\n _index: \"test\",\n _id: \"2\",\n },\n },\n {\n create: {\n _index: \"test\",\n _id: \"3\",\n },\n },\n {\n field1: \"value3\",\n },\n {\n update: {\n _id: \"1\",\n _index: \"test\",\n },\n },\n {\n doc: {\n field2: \"value2\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.bulk(\n body: [\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->bulk([\n \"body\" => array(\n [\n \"index\" => [\n \"_index\" => \"test\",\n \"_id\" => \"1\",\n ],\n ],\n [\n \"field1\" => \"value1\",\n ],\n [\n \"delete\" => [\n \"_index\" => \"test\",\n \"_id\" => \"2\",\n ],\n ],\n [\n \"create\" => [\n \"_index\" => \"test\",\n \"_id\" => \"3\",\n ],\n ],\n [\n \"field1\" => \"value3\",\n ],\n [\n \"update\" => [\n \"_id\" => \"1\",\n \"_index\" => \"test\",\n ],\n ],\n [\n \"doc\" => [\n \"field2\" => \"value2\",\n ],\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{\"index\":{\"_index\":\"test\",\"_id\":\"1\"}},{\"field1\":\"value1\"},{\"delete\":{\"_index\":\"test\",\"_id\":\"2\"}},{\"create\":{\"_index\":\"test\",\"_id\":\"3\"}},{\"field1\":\"value3\"},{\"update\":{\"_id\":\"1\",\"_index\":\"test\"}},{\"doc\":{\"field2\":\"value2\"}}]' \"$ELASTICSEARCH_URL/_bulk\"" } ] } @@ -703,6 +843,26 @@ { "lang": "Console", "source": "POST _bulk\n{ \"index\" : { \"_index\" : \"test\", \"_id\" : \"1\" } }\n{ \"field1\" : \"value1\" }\n{ \"delete\" : { \"_index\" : \"test\", \"_id\" : \"2\" } }\n{ \"create\" : { \"_index\" : \"test\", \"_id\" : \"3\" } }\n{ \"field1\" : \"value3\" }\n{ \"update\" : {\"_id\" : \"1\", \"_index\" : \"test\"} }\n{ \"doc\" : {\"field2\" : \"value2\"} }" + }, + { + "lang": "Python", + "source": "resp = client.bulk(\n operations=[\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.bulk({\n operations: [\n {\n index: {\n _index: \"test\",\n _id: \"1\",\n },\n },\n {\n field1: \"value1\",\n },\n {\n delete: {\n _index: \"test\",\n _id: \"2\",\n },\n },\n {\n create: {\n _index: \"test\",\n _id: \"3\",\n },\n },\n {\n field1: \"value3\",\n },\n {\n update: {\n _id: \"1\",\n _index: \"test\",\n },\n },\n {\n doc: {\n field2: \"value2\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.bulk(\n body: [\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->bulk([\n \"body\" => array(\n [\n \"index\" => [\n \"_index\" => \"test\",\n \"_id\" => \"1\",\n ],\n ],\n [\n \"field1\" => \"value1\",\n ],\n [\n \"delete\" => [\n \"_index\" => \"test\",\n \"_id\" => \"2\",\n ],\n ],\n [\n \"create\" => [\n \"_index\" => \"test\",\n \"_id\" => \"3\",\n ],\n ],\n [\n \"field1\" => \"value3\",\n ],\n [\n \"update\" => [\n \"_id\" => \"1\",\n \"_index\" => \"test\",\n ],\n ],\n [\n \"doc\" => [\n \"field2\" => \"value2\",\n ],\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{\"index\":{\"_index\":\"test\",\"_id\":\"1\"}},{\"field1\":\"value1\"},{\"delete\":{\"_index\":\"test\",\"_id\":\"2\"}},{\"create\":{\"_index\":\"test\",\"_id\":\"3\"}},{\"field1\":\"value3\"},{\"update\":{\"_id\":\"1\",\"_index\":\"test\"}},{\"doc\":{\"field2\":\"value2\"}}]' \"$ELASTICSEARCH_URL/_bulk\"" } ] }, @@ -769,6 +929,26 @@ { "lang": "Console", "source": "POST _bulk\n{ \"index\" : { \"_index\" : \"test\", \"_id\" : \"1\" } }\n{ \"field1\" : \"value1\" }\n{ \"delete\" : { \"_index\" : \"test\", \"_id\" : \"2\" } }\n{ \"create\" : { \"_index\" : \"test\", \"_id\" : \"3\" } }\n{ \"field1\" : \"value3\" }\n{ \"update\" : {\"_id\" : \"1\", \"_index\" : \"test\"} }\n{ \"doc\" : {\"field2\" : \"value2\"} }" + }, + { + "lang": "Python", + "source": "resp = client.bulk(\n operations=[\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.bulk({\n operations: [\n {\n index: {\n _index: \"test\",\n _id: \"1\",\n },\n },\n {\n field1: \"value1\",\n },\n {\n delete: {\n _index: \"test\",\n _id: \"2\",\n },\n },\n {\n create: {\n _index: \"test\",\n _id: \"3\",\n },\n },\n {\n field1: \"value3\",\n },\n {\n update: {\n _id: \"1\",\n _index: \"test\",\n },\n },\n {\n doc: {\n field2: \"value2\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.bulk(\n body: [\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->bulk([\n \"body\" => array(\n [\n \"index\" => [\n \"_index\" => \"test\",\n \"_id\" => \"1\",\n ],\n ],\n [\n \"field1\" => \"value1\",\n ],\n [\n \"delete\" => [\n \"_index\" => \"test\",\n \"_id\" => \"2\",\n ],\n ],\n [\n \"create\" => [\n \"_index\" => \"test\",\n \"_id\" => \"3\",\n ],\n ],\n [\n \"field1\" => \"value3\",\n ],\n [\n \"update\" => [\n \"_id\" => \"1\",\n \"_index\" => \"test\",\n ],\n ],\n [\n \"doc\" => [\n \"field2\" => \"value2\",\n ],\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{\"index\":{\"_index\":\"test\",\"_id\":\"1\"}},{\"field1\":\"value1\"},{\"delete\":{\"_index\":\"test\",\"_id\":\"2\"}},{\"create\":{\"_index\":\"test\",\"_id\":\"3\"}},{\"field1\":\"value3\"},{\"update\":{\"_id\":\"1\",\"_index\":\"test\"}},{\"doc\":{\"field2\":\"value2\"}}]' \"$ELASTICSEARCH_URL/_bulk\"" } ] } @@ -804,6 +984,26 @@ { "lang": "Console", "source": "GET _cat/aliases?format=json&v=true\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.aliases(\n format=\"json\",\n v=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.aliases({\n format: \"json\",\n v: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.aliases(\n format: \"json\",\n v: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->aliases([\n \"format\" => \"json\",\n \"v\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/aliases?format=json&v=true\"" } ] } @@ -842,6 +1042,26 @@ { "lang": "Console", "source": "GET _cat/aliases?format=json&v=true\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.aliases(\n format=\"json\",\n v=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.aliases({\n format: \"json\",\n v: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.aliases(\n format: \"json\",\n v: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->aliases([\n \"format\" => \"json\",\n \"v\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/aliases?format=json&v=true\"" } ] } @@ -878,6 +1098,26 @@ { "lang": "Console", "source": "GET _cat/component_templates/my-template-*?v=true&s=name&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.component_templates(\n name=\"my-template-*\",\n v=True,\n s=\"name\",\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.componentTemplates({\n name: \"my-template-*\",\n v: \"true\",\n s: \"name\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.component_templates(\n name: \"my-template-*\",\n v: \"true\",\n s: \"name\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->componentTemplates([\n \"name\" => \"my-template-*\",\n \"v\" => \"true\",\n \"s\" => \"name\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/component_templates/my-template-*?v=true&s=name&format=json\"" } ] } @@ -917,6 +1157,26 @@ { "lang": "Console", "source": "GET _cat/component_templates/my-template-*?v=true&s=name&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.component_templates(\n name=\"my-template-*\",\n v=True,\n s=\"name\",\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.componentTemplates({\n name: \"my-template-*\",\n v: \"true\",\n s: \"name\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.component_templates(\n name: \"my-template-*\",\n v: \"true\",\n s: \"name\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->componentTemplates([\n \"name\" => \"my-template-*\",\n \"v\" => \"true\",\n \"s\" => \"name\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/component_templates/my-template-*?v=true&s=name&format=json\"" } ] } @@ -946,6 +1206,26 @@ { "lang": "Console", "source": "GET /_cat/count/my-index-000001?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.count(\n index=\"my-index-000001\",\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.count({\n index: \"my-index-000001\",\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.count(\n index: \"my-index-000001\",\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->count([\n \"index\" => \"my-index-000001\",\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/count/my-index-000001?v=true&format=json\"" } ] } @@ -978,6 +1258,26 @@ { "lang": "Console", "source": "GET /_cat/count/my-index-000001?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.count(\n index=\"my-index-000001\",\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.count({\n index: \"my-index-000001\",\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.count(\n index: \"my-index-000001\",\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->count([\n \"index\" => \"my-index-000001\",\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/count/my-index-000001?v=true&format=json\"" } ] } @@ -1050,6 +1350,26 @@ { "lang": "Console", "source": "GET /_cat/indices/my-index-*?v=true&s=index&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.indices(\n index=\"my-index-*\",\n v=True,\n s=\"index\",\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.indices({\n index: \"my-index-*\",\n v: \"true\",\n s: \"index\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.indices(\n index: \"my-index-*\",\n v: \"true\",\n s: \"index\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->indices([\n \"index\" => \"my-index-*\",\n \"v\" => \"true\",\n \"s\" => \"index\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/indices/my-index-*?v=true&s=index&format=json\"" } ] } @@ -1103,6 +1423,26 @@ { "lang": "Console", "source": "GET /_cat/indices/my-index-*?v=true&s=index&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.indices(\n index=\"my-index-*\",\n v=True,\n s=\"index\",\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.indices({\n index: \"my-index-*\",\n v: \"true\",\n s: \"index\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.indices(\n index: \"my-index-*\",\n v: \"true\",\n s: \"index\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->indices([\n \"index\" => \"my-index-*\",\n \"v\" => \"true\",\n \"s\" => \"index\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/indices/my-index-*?v=true&s=index&format=json\"" } ] } @@ -1142,6 +1482,26 @@ { "lang": "Console", "source": "GET _cat/ml/data_frame/analytics?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.ml_data_frame_analytics(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.mlDataFrameAnalytics({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.ml_data_frame_analytics(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->mlDataFrameAnalytics([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/ml/data_frame/analytics?v=true&format=json\"" } ] } @@ -1184,6 +1544,26 @@ { "lang": "Console", "source": "GET _cat/ml/data_frame/analytics?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.ml_data_frame_analytics(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.mlDataFrameAnalytics({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.ml_data_frame_analytics(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->mlDataFrameAnalytics([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/ml/data_frame/analytics?v=true&format=json\"" } ] } @@ -1220,6 +1600,26 @@ { "lang": "Console", "source": "GET _cat/ml/datafeeds?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.ml_datafeeds(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.mlDatafeeds({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.ml_datafeeds(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->mlDatafeeds([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/ml/datafeeds?v=true&format=json\"" } ] } @@ -1259,6 +1659,26 @@ { "lang": "Console", "source": "GET _cat/ml/datafeeds?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.ml_datafeeds(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.mlDatafeeds({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.ml_datafeeds(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->mlDatafeeds([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/ml/datafeeds?v=true&format=json\"" } ] } @@ -1298,6 +1718,26 @@ { "lang": "Console", "source": "GET _cat/ml/anomaly_detectors?h=id,s,dpr,mb&v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.ml_jobs(\n h=\"id,s,dpr,mb\",\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.mlJobs({\n h: \"id,s,dpr,mb\",\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.ml_jobs(\n h: \"id,s,dpr,mb\",\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->mlJobs([\n \"h\" => \"id,s,dpr,mb\",\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/ml/anomaly_detectors?h=id,s,dpr,mb&v=true&format=json\"" } ] } @@ -1340,6 +1780,26 @@ { "lang": "Console", "source": "GET _cat/ml/anomaly_detectors?h=id,s,dpr,mb&v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.ml_jobs(\n h=\"id,s,dpr,mb\",\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.mlJobs({\n h: \"id,s,dpr,mb\",\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.ml_jobs(\n h: \"id,s,dpr,mb\",\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->mlJobs([\n \"h\" => \"id,s,dpr,mb\",\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/ml/anomaly_detectors?h=id,s,dpr,mb&v=true&format=json\"" } ] } @@ -1385,6 +1845,26 @@ { "lang": "Console", "source": "GET _cat/ml/trained_models?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.ml_trained_models(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.mlTrainedModels({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.ml_trained_models(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->mlTrainedModels([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/ml/trained_models?v=true&format=json\"" } ] } @@ -1433,6 +1913,26 @@ { "lang": "Console", "source": "GET _cat/ml/trained_models?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.ml_trained_models(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.mlTrainedModels({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.ml_trained_models(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->mlTrainedModels([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/ml/trained_models?v=true&format=json\"" } ] } @@ -1475,6 +1975,26 @@ { "lang": "Console", "source": "GET /_cat/transforms?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.transforms(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.transforms({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.transforms(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->transforms([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/transforms?v=true&format=json\"" } ] } @@ -1520,6 +2040,26 @@ { "lang": "Console", "source": "GET /_cat/transforms?v=true&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.cat.transforms(\n v=True,\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cat.transforms({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cat.transforms(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cat()->transforms([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/transforms?v=true&format=json\"" } ] } @@ -1558,6 +2098,26 @@ { "lang": "Console", "source": "GET /_search/scroll\n{\n \"scroll_id\" : \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.scroll(\n scroll_id=\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.scroll({\n scroll_id: \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.scroll(\n body: {\n \"scroll_id\": \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->scroll([\n \"body\" => [\n \"scroll_id\" => \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"scroll_id\":\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"}' \"$ELASTICSEARCH_URL/_search/scroll\"" } ] }, @@ -1594,6 +2154,26 @@ { "lang": "Console", "source": "GET /_search/scroll\n{\n \"scroll_id\" : \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.scroll(\n scroll_id=\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.scroll({\n scroll_id: \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.scroll(\n body: {\n \"scroll_id\": \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->scroll([\n \"body\" => [\n \"scroll_id\" => \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"scroll_id\":\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"}' \"$ELASTICSEARCH_URL/_search/scroll\"" } ] }, @@ -1619,6 +2199,26 @@ { "lang": "Console", "source": "DELETE /_search/scroll\n{\n \"scroll_id\": \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.clear_scroll(\n scroll_id=\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.clearScroll({\n scroll_id: \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.clear_scroll(\n body: {\n \"scroll_id\": \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->clearScroll([\n \"body\" => [\n \"scroll_id\" => \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"scroll_id\":\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"}' \"$ELASTICSEARCH_URL/_search/scroll\"" } ] } @@ -1660,6 +2260,26 @@ { "lang": "Console", "source": "GET /_search/scroll\n{\n \"scroll_id\" : \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.scroll(\n scroll_id=\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.scroll({\n scroll_id: \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.scroll(\n body: {\n \"scroll_id\": \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->scroll([\n \"body\" => [\n \"scroll_id\" => \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"scroll_id\":\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"}' \"$ELASTICSEARCH_URL/_search/scroll\"" } ] }, @@ -1699,6 +2319,26 @@ { "lang": "Console", "source": "GET /_search/scroll\n{\n \"scroll_id\" : \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.scroll(\n scroll_id=\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.scroll({\n scroll_id: \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.scroll(\n body: {\n \"scroll_id\": \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->scroll([\n \"body\" => [\n \"scroll_id\" => \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"scroll_id\":\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"}' \"$ELASTICSEARCH_URL/_search/scroll\"" } ] }, @@ -1729,6 +2369,26 @@ { "lang": "Console", "source": "DELETE /_search/scroll\n{\n \"scroll_id\": \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.clear_scroll(\n scroll_id=\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.clearScroll({\n scroll_id: \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.clear_scroll(\n body: {\n \"scroll_id\": \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->clearScroll([\n \"body\" => [\n \"scroll_id\" => \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"scroll_id\":\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"}' \"$ELASTICSEARCH_URL/_search/scroll\"" } ] } @@ -1801,6 +2461,26 @@ { "lang": "Console", "source": "DELETE /_pit\n{\n \"id\": \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.close_point_in_time(\n id=\"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.closePointInTime({\n id: \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.close_point_in_time(\n body: {\n \"id\": \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->closePointInTime([\n \"body\" => [\n \"id\" => \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\"}' \"$ELASTICSEARCH_URL/_pit\"" } ] } @@ -1840,6 +2520,26 @@ { "lang": "Console", "source": "GET /_component_template/template_1\n" + }, + { + "lang": "Python", + "source": "resp = client.cluster.get_component_template(\n name=\"template_1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.getComponentTemplate({\n name: \"template_1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.get_component_template(\n name: \"template_1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->getComponentTemplate([\n \"name\" => \"template_1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_component_template/template_1\"" } ] }, @@ -1874,6 +2574,26 @@ { "lang": "Console", "source": "PUT _component_template/template_1\n{\n \"template\": null,\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"mappings\": {\n \"_source\": {\n \"enabled\": false\n },\n \"properties\": {\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.cluster.put_component_template(\n name=\"template_1\",\n template=None,\n settings={\n \"number_of_shards\": 1\n },\n mappings={\n \"_source\": {\n \"enabled\": False\n },\n \"properties\": {\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.putComponentTemplate({\n name: \"template_1\",\n template: null,\n settings: {\n number_of_shards: 1,\n },\n mappings: {\n _source: {\n enabled: false,\n },\n properties: {\n host_name: {\n type: \"keyword\",\n },\n created_at: {\n type: \"date\",\n format: \"EEE MMM dd HH:mm:ss Z yyyy\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.put_component_template(\n name: \"template_1\",\n body: {\n \"template\": nil,\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"mappings\": {\n \"_source\": {\n \"enabled\": false\n },\n \"properties\": {\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->putComponentTemplate([\n \"name\" => \"template_1\",\n \"body\" => [\n \"template\" => null,\n \"settings\" => [\n \"number_of_shards\" => 1,\n ],\n \"mappings\" => [\n \"_source\" => [\n \"enabled\" => false,\n ],\n \"properties\" => [\n \"host_name\" => [\n \"type\" => \"keyword\",\n ],\n \"created_at\" => [\n \"type\" => \"date\",\n \"format\" => \"EEE MMM dd HH:mm:ss Z yyyy\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"template\":null,\"settings\":{\"number_of_shards\":1},\"mappings\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"keyword\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z yyyy\"}}}}' \"$ELASTICSEARCH_URL/_component_template/template_1\"" } ] }, @@ -1908,6 +2628,26 @@ { "lang": "Console", "source": "PUT _component_template/template_1\n{\n \"template\": null,\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"mappings\": {\n \"_source\": {\n \"enabled\": false\n },\n \"properties\": {\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.cluster.put_component_template(\n name=\"template_1\",\n template=None,\n settings={\n \"number_of_shards\": 1\n },\n mappings={\n \"_source\": {\n \"enabled\": False\n },\n \"properties\": {\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.putComponentTemplate({\n name: \"template_1\",\n template: null,\n settings: {\n number_of_shards: 1,\n },\n mappings: {\n _source: {\n enabled: false,\n },\n properties: {\n host_name: {\n type: \"keyword\",\n },\n created_at: {\n type: \"date\",\n format: \"EEE MMM dd HH:mm:ss Z yyyy\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.put_component_template(\n name: \"template_1\",\n body: {\n \"template\": nil,\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"mappings\": {\n \"_source\": {\n \"enabled\": false\n },\n \"properties\": {\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->putComponentTemplate([\n \"name\" => \"template_1\",\n \"body\" => [\n \"template\" => null,\n \"settings\" => [\n \"number_of_shards\" => 1,\n ],\n \"mappings\" => [\n \"_source\" => [\n \"enabled\" => false,\n ],\n \"properties\" => [\n \"host_name\" => [\n \"type\" => \"keyword\",\n ],\n \"created_at\" => [\n \"type\" => \"date\",\n \"format\" => \"EEE MMM dd HH:mm:ss Z yyyy\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"template\":null,\"settings\":{\"number_of_shards\":1},\"mappings\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"keyword\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z yyyy\"}}}}' \"$ELASTICSEARCH_URL/_component_template/template_1\"" } ] }, @@ -1968,6 +2708,26 @@ { "lang": "Console", "source": "DELETE _component_template/template_1\n" + }, + { + "lang": "Python", + "source": "resp = client.cluster.delete_component_template(\n name=\"template_1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.deleteComponentTemplate({\n name: \"template_1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.delete_component_template(\n name: \"template_1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->deleteComponentTemplate([\n \"name\" => \"template_1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_component_template/template_1\"" } ] }, @@ -2054,6 +2814,26 @@ { "lang": "Console", "source": "GET /_component_template/template_1\n" + }, + { + "lang": "Python", + "source": "resp = client.cluster.get_component_template(\n name=\"template_1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.getComponentTemplate({\n name: \"template_1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.get_component_template(\n name: \"template_1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->getComponentTemplate([\n \"name\" => \"template_1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_component_template/template_1\"" } ] } @@ -2119,6 +2899,26 @@ { "lang": "Console", "source": "GET /_info/_all\n" + }, + { + "lang": "Python", + "source": "resp = client.cluster.info(\n target=\"_all\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.cluster.info({\n target: \"_all\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.cluster.info(\n target: \"_all\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->cluster()->info([\n \"target\" => \"_all\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_info/_all\"" } ] } @@ -2174,6 +2974,26 @@ { "lang": "Console", "source": "PUT _connector/my-connector/_check_in\n" + }, + { + "lang": "Python", + "source": "resp = client.connector.check_in(\n connector_id=\"my-connector\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.checkIn({\n connector_id: \"my-connector\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.check_in(\n connector_id: \"my-connector\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->checkIn([\n \"connector_id\" => \"my-connector\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/my-connector/_check_in\"" } ] } @@ -2226,6 +3046,26 @@ { "lang": "Console", "source": "GET _connector/my-connector-id\n" + }, + { + "lang": "Python", + "source": "resp = client.connector.get(\n connector_id=\"my-connector-id\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.get({\n connector_id: \"my-connector-id\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.get(\n connector_id: \"my-connector-id\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->get([\n \"connector_id\" => \"my-connector-id\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/my-connector-id\"" } ] }, @@ -2253,6 +3093,26 @@ { "lang": "Console", "source": "PUT _connector/my-connector\n{\n \"index_name\": \"search-google-drive\",\n \"name\": \"My Connector\",\n \"service_type\": \"google_drive\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.put(\n connector_id=\"my-connector\",\n index_name=\"search-google-drive\",\n name=\"My Connector\",\n service_type=\"google_drive\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.put({\n connector_id: \"my-connector\",\n index_name: \"search-google-drive\",\n name: \"My Connector\",\n service_type: \"google_drive\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.put(\n connector_id: \"my-connector\",\n body: {\n \"index_name\": \"search-google-drive\",\n \"name\": \"My Connector\",\n \"service_type\": \"google_drive\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->put([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"index_name\" => \"search-google-drive\",\n \"name\" => \"My Connector\",\n \"service_type\" => \"google_drive\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_name\":\"search-google-drive\",\"name\":\"My Connector\",\"service_type\":\"google_drive\"}' \"$ELASTICSEARCH_URL/_connector/my-connector\"" } ] }, @@ -2318,6 +3178,26 @@ { "lang": "Console", "source": "DELETE _connector/my-connector-id&delete_sync_jobs=true\n" + }, + { + "lang": "Python", + "source": "resp = client.connector.delete(\n connector_id=\"my-connector-id&delete_sync_jobs=true\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.delete({\n connector_id: \"my-connector-id&delete_sync_jobs=true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.delete(\n connector_id: \"my-connector-id&delete_sync_jobs=true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->delete([\n \"connector_id\" => \"my-connector-id&delete_sync_jobs=true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/my-connector-id&delete_sync_jobs=true\"" } ] } @@ -2434,6 +3314,26 @@ { "lang": "Console", "source": "GET _connector\n" + }, + { + "lang": "Python", + "source": "resp = client.connector.list()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.list();" + }, + { + "lang": "Ruby", + "source": "response = client.connector.list" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->list();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector\"" } ] }, @@ -2456,6 +3356,26 @@ { "lang": "Console", "source": "PUT _connector/my-connector\n{\n \"index_name\": \"search-google-drive\",\n \"name\": \"My Connector\",\n \"service_type\": \"google_drive\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.put(\n connector_id=\"my-connector\",\n index_name=\"search-google-drive\",\n name=\"My Connector\",\n service_type=\"google_drive\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.put({\n connector_id: \"my-connector\",\n index_name: \"search-google-drive\",\n name: \"My Connector\",\n service_type: \"google_drive\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.put(\n connector_id: \"my-connector\",\n body: {\n \"index_name\": \"search-google-drive\",\n \"name\": \"My Connector\",\n \"service_type\": \"google_drive\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->put([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"index_name\" => \"search-google-drive\",\n \"name\" => \"My Connector\",\n \"service_type\" => \"google_drive\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_name\":\"search-google-drive\",\"name\":\"My Connector\",\"service_type\":\"google_drive\"}' \"$ELASTICSEARCH_URL/_connector/my-connector\"" } ] }, @@ -2568,6 +3488,26 @@ { "lang": "Console", "source": "PUT _connector/_sync_job/my-connector-sync-job-id/_cancel\n" + }, + { + "lang": "Python", + "source": "resp = client.connector.sync_job_cancel(\n connector_sync_job_id=\"my-connector-sync-job-id\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.syncJobCancel({\n connector_sync_job_id: \"my-connector-sync-job-id\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.sync_job_cancel(\n connector_sync_job_id: \"my-connector-sync-job-id\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->syncJobCancel([\n \"connector_sync_job_id\" => \"my-connector-sync-job-id\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job-id/_cancel\"" } ] } @@ -2609,6 +3549,26 @@ { "lang": "Console", "source": "GET _connector/_sync_job/my-connector-sync-job\n" + }, + { + "lang": "Python", + "source": "resp = client.connector.sync_job_get(\n connector_sync_job_id=\"my-connector-sync-job\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.syncJobGet({\n connector_sync_job_id: \"my-connector-sync-job\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.sync_job_get(\n connector_sync_job_id: \"my-connector-sync-job\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->syncJobGet([\n \"connector_sync_job_id\" => \"my-connector-sync-job\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job\"" } ] }, @@ -2654,6 +3614,26 @@ { "lang": "Console", "source": "DELETE _connector/_sync_job/my-connector-sync-job-id\n" + }, + { + "lang": "Python", + "source": "resp = client.connector.sync_job_delete(\n connector_sync_job_id=\"my-connector-sync-job-id\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.syncJobDelete({\n connector_sync_job_id: \"my-connector-sync-job-id\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.sync_job_delete(\n connector_sync_job_id: \"my-connector-sync-job-id\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->syncJobDelete([\n \"connector_sync_job_id\" => \"my-connector-sync-job-id\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job-id\"" } ] } @@ -2760,6 +3740,26 @@ { "lang": "Console", "source": "GET _connector/_sync_job?connector_id=my-connector-id&size=1\n" + }, + { + "lang": "Python", + "source": "resp = client.connector.sync_job_list(\n connector_id=\"my-connector-id\",\n size=\"1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.syncJobList({\n connector_id: \"my-connector-id\",\n size: 1,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.sync_job_list(\n connector_id: \"my-connector-id\",\n size: \"1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->syncJobList([\n \"connector_id\" => \"my-connector-id\",\n \"size\" => \"1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/_sync_job?connector_id=my-connector-id&size=1\"" } ] }, @@ -2824,6 +3824,26 @@ { "lang": "Console", "source": "POST _connector/_sync_job\n{\n \"id\": \"connector-id\",\n \"job_type\": \"full\",\n \"trigger_method\": \"on_demand\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.sync_job_post(\n id=\"connector-id\",\n job_type=\"full\",\n trigger_method=\"on_demand\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.syncJobPost({\n id: \"connector-id\",\n job_type: \"full\",\n trigger_method: \"on_demand\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.sync_job_post(\n body: {\n \"id\": \"connector-id\",\n \"job_type\": \"full\",\n \"trigger_method\": \"on_demand\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->syncJobPost([\n \"body\" => [\n \"id\" => \"connector-id\",\n \"job_type\" => \"full\",\n \"trigger_method\" => \"on_demand\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"connector-id\",\"job_type\":\"full\",\"trigger_method\":\"on_demand\"}' \"$ELASTICSEARCH_URL/_connector/_sync_job\"" } ] } @@ -2946,6 +3966,26 @@ { "lang": "Console", "source": "PUT _connector/my-connector/_api_key_id\n{\n \"api_key_id\": \"my-api-key-id\",\n \"api_key_secret_id\": \"my-connector-secret-id\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.update_api_key_id(\n connector_id=\"my-connector\",\n api_key_id=\"my-api-key-id\",\n api_key_secret_id=\"my-connector-secret-id\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.updateApiKeyId({\n connector_id: \"my-connector\",\n api_key_id: \"my-api-key-id\",\n api_key_secret_id: \"my-connector-secret-id\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.update_api_key_id(\n connector_id: \"my-connector\",\n body: {\n \"api_key_id\": \"my-api-key-id\",\n \"api_key_secret_id\": \"my-connector-secret-id\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->updateApiKeyId([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"api_key_id\" => \"my-api-key-id\",\n \"api_key_secret_id\" => \"my-connector-secret-id\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"api_key_id\":\"my-api-key-id\",\"api_key_secret_id\":\"my-connector-secret-id\"}' \"$ELASTICSEARCH_URL/_connector/my-connector/_api_key_id\"" } ] } @@ -3030,6 +4070,26 @@ { "lang": "Console", "source": "PUT _connector/my-spo-connector/_configuration\n{\n \"values\": {\n \"tenant_id\": \"my-tenant-id\",\n \"tenant_name\": \"my-sharepoint-site\",\n \"client_id\": \"foo\",\n \"secret_value\": \"bar\",\n \"site_collections\": \"*\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.update_configuration(\n connector_id=\"my-spo-connector\",\n values={\n \"tenant_id\": \"my-tenant-id\",\n \"tenant_name\": \"my-sharepoint-site\",\n \"client_id\": \"foo\",\n \"secret_value\": \"bar\",\n \"site_collections\": \"*\"\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.updateConfiguration({\n connector_id: \"my-spo-connector\",\n values: {\n tenant_id: \"my-tenant-id\",\n tenant_name: \"my-sharepoint-site\",\n client_id: \"foo\",\n secret_value: \"bar\",\n site_collections: \"*\",\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.update_configuration(\n connector_id: \"my-spo-connector\",\n body: {\n \"values\": {\n \"tenant_id\": \"my-tenant-id\",\n \"tenant_name\": \"my-sharepoint-site\",\n \"client_id\": \"foo\",\n \"secret_value\": \"bar\",\n \"site_collections\": \"*\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->updateConfiguration([\n \"connector_id\" => \"my-spo-connector\",\n \"body\" => [\n \"values\" => [\n \"tenant_id\" => \"my-tenant-id\",\n \"tenant_name\" => \"my-sharepoint-site\",\n \"client_id\" => \"foo\",\n \"secret_value\" => \"bar\",\n \"site_collections\" => \"*\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"values\":{\"tenant_id\":\"my-tenant-id\",\"tenant_name\":\"my-sharepoint-site\",\"client_id\":\"foo\",\"secret_value\":\"bar\",\"site_collections\":\"*\"}}' \"$ELASTICSEARCH_URL/_connector/my-spo-connector/_configuration\"" } ] } @@ -3115,6 +4175,26 @@ { "lang": "Console", "source": "PUT _connector/my-connector/_error\n{\n \"error\": \"Houston, we have a problem!\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.update_error(\n connector_id=\"my-connector\",\n error=\"Houston, we have a problem!\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.updateError({\n connector_id: \"my-connector\",\n error: \"Houston, we have a problem!\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.update_error(\n connector_id: \"my-connector\",\n body: {\n \"error\": \"Houston, we have a problem!\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->updateError([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"error\" => \"Houston, we have a problem!\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"error\":\"Houston, we have a problem!\"}' \"$ELASTICSEARCH_URL/_connector/my-connector/_error\"" } ] } @@ -3205,6 +4285,26 @@ { "lang": "Console", "source": "PUT _connector/my-g-drive-connector/_filtering\n{\n \"rules\": [\n {\n \"field\": \"file_extension\",\n \"id\": \"exclude-txt-files\",\n \"order\": 0,\n \"policy\": \"exclude\",\n \"rule\": \"equals\",\n \"value\": \"txt\"\n },\n {\n \"field\": \"_\",\n \"id\": \"DEFAULT\",\n \"order\": 1,\n \"policy\": \"include\",\n \"rule\": \"regex\",\n \"value\": \".*\"\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.update_filtering(\n connector_id=\"my-g-drive-connector\",\n rules=[\n {\n \"field\": \"file_extension\",\n \"id\": \"exclude-txt-files\",\n \"order\": 0,\n \"policy\": \"exclude\",\n \"rule\": \"equals\",\n \"value\": \"txt\"\n },\n {\n \"field\": \"_\",\n \"id\": \"DEFAULT\",\n \"order\": 1,\n \"policy\": \"include\",\n \"rule\": \"regex\",\n \"value\": \".*\"\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.updateFiltering({\n connector_id: \"my-g-drive-connector\",\n rules: [\n {\n field: \"file_extension\",\n id: \"exclude-txt-files\",\n order: 0,\n policy: \"exclude\",\n rule: \"equals\",\n value: \"txt\",\n },\n {\n field: \"_\",\n id: \"DEFAULT\",\n order: 1,\n policy: \"include\",\n rule: \"regex\",\n value: \".*\",\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.update_filtering(\n connector_id: \"my-g-drive-connector\",\n body: {\n \"rules\": [\n {\n \"field\": \"file_extension\",\n \"id\": \"exclude-txt-files\",\n \"order\": 0,\n \"policy\": \"exclude\",\n \"rule\": \"equals\",\n \"value\": \"txt\"\n },\n {\n \"field\": \"_\",\n \"id\": \"DEFAULT\",\n \"order\": 1,\n \"policy\": \"include\",\n \"rule\": \"regex\",\n \"value\": \".*\"\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->updateFiltering([\n \"connector_id\" => \"my-g-drive-connector\",\n \"body\" => [\n \"rules\" => array(\n [\n \"field\" => \"file_extension\",\n \"id\" => \"exclude-txt-files\",\n \"order\" => 0,\n \"policy\" => \"exclude\",\n \"rule\" => \"equals\",\n \"value\" => \"txt\",\n ],\n [\n \"field\" => \"_\",\n \"id\" => \"DEFAULT\",\n \"order\" => 1,\n \"policy\" => \"include\",\n \"rule\" => \"regex\",\n \"value\" => \".*\",\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"rules\":[{\"field\":\"file_extension\",\"id\":\"exclude-txt-files\",\"order\":0,\"policy\":\"exclude\",\"rule\":\"equals\",\"value\":\"txt\"},{\"field\":\"_\",\"id\":\"DEFAULT\",\"order\":1,\"policy\":\"include\",\"rule\":\"regex\",\"value\":\".*\"}]}' \"$ELASTICSEARCH_URL/_connector/my-g-drive-connector/_filtering\"" } ] } @@ -3352,6 +4452,26 @@ { "lang": "Console", "source": "PUT _connector/my-connector/_index_name\n{\n \"index_name\": \"data-from-my-google-drive\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.update_index_name(\n connector_id=\"my-connector\",\n index_name=\"data-from-my-google-drive\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.updateIndexName({\n connector_id: \"my-connector\",\n index_name: \"data-from-my-google-drive\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.update_index_name(\n connector_id: \"my-connector\",\n body: {\n \"index_name\": \"data-from-my-google-drive\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->updateIndexName([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"index_name\" => \"data-from-my-google-drive\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_name\":\"data-from-my-google-drive\"}' \"$ELASTICSEARCH_URL/_connector/my-connector/_index_name\"" } ] } @@ -3429,6 +4549,26 @@ { "lang": "Console", "source": "PUT _connector/my-connector/_name\n{\n \"name\": \"Custom connector\",\n \"description\": \"This is my customized connector\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.update_name(\n connector_id=\"my-connector\",\n name=\"Custom connector\",\n description=\"This is my customized connector\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.updateName({\n connector_id: \"my-connector\",\n name: \"Custom connector\",\n description: \"This is my customized connector\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.update_name(\n connector_id: \"my-connector\",\n body: {\n \"name\": \"Custom connector\",\n \"description\": \"This is my customized connector\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->updateName([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"name\" => \"Custom connector\",\n \"description\" => \"This is my customized connector\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"name\":\"Custom connector\",\"description\":\"This is my customized connector\"}' \"$ELASTICSEARCH_URL/_connector/my-connector/_name\"" } ] } @@ -3568,6 +4708,26 @@ { "lang": "Console", "source": "PUT _connector/my-connector/_pipeline\n{\n \"pipeline\": {\n \"extract_binary_content\": true,\n \"name\": \"my-connector-pipeline\",\n \"reduce_whitespace\": true,\n \"run_ml_inference\": true\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.update_pipeline(\n connector_id=\"my-connector\",\n pipeline={\n \"extract_binary_content\": True,\n \"name\": \"my-connector-pipeline\",\n \"reduce_whitespace\": True,\n \"run_ml_inference\": True\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.updatePipeline({\n connector_id: \"my-connector\",\n pipeline: {\n extract_binary_content: true,\n name: \"my-connector-pipeline\",\n reduce_whitespace: true,\n run_ml_inference: true,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.update_pipeline(\n connector_id: \"my-connector\",\n body: {\n \"pipeline\": {\n \"extract_binary_content\": true,\n \"name\": \"my-connector-pipeline\",\n \"reduce_whitespace\": true,\n \"run_ml_inference\": true\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->updatePipeline([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"pipeline\" => [\n \"extract_binary_content\" => true,\n \"name\" => \"my-connector-pipeline\",\n \"reduce_whitespace\" => true,\n \"run_ml_inference\" => true,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"pipeline\":{\"extract_binary_content\":true,\"name\":\"my-connector-pipeline\",\"reduce_whitespace\":true,\"run_ml_inference\":true}}' \"$ELASTICSEARCH_URL/_connector/my-connector/_pipeline\"" } ] } @@ -3648,6 +4808,26 @@ { "lang": "Console", "source": "PUT _connector/my-connector/_scheduling\n{\n \"scheduling\": {\n \"access_control\": {\n \"enabled\": true,\n \"interval\": \"0 10 0 * * ?\"\n },\n \"full\": {\n \"enabled\": true,\n \"interval\": \"0 20 0 * * ?\"\n },\n \"incremental\": {\n \"enabled\": false,\n \"interval\": \"0 30 0 * * ?\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.update_scheduling(\n connector_id=\"my-connector\",\n scheduling={\n \"access_control\": {\n \"enabled\": True,\n \"interval\": \"0 10 0 * * ?\"\n },\n \"full\": {\n \"enabled\": True,\n \"interval\": \"0 20 0 * * ?\"\n },\n \"incremental\": {\n \"enabled\": False,\n \"interval\": \"0 30 0 * * ?\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.updateScheduling({\n connector_id: \"my-connector\",\n scheduling: {\n access_control: {\n enabled: true,\n interval: \"0 10 0 * * ?\",\n },\n full: {\n enabled: true,\n interval: \"0 20 0 * * ?\",\n },\n incremental: {\n enabled: false,\n interval: \"0 30 0 * * ?\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.update_scheduling(\n connector_id: \"my-connector\",\n body: {\n \"scheduling\": {\n \"access_control\": {\n \"enabled\": true,\n \"interval\": \"0 10 0 * * ?\"\n },\n \"full\": {\n \"enabled\": true,\n \"interval\": \"0 20 0 * * ?\"\n },\n \"incremental\": {\n \"enabled\": false,\n \"interval\": \"0 30 0 * * ?\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->updateScheduling([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"scheduling\" => [\n \"access_control\" => [\n \"enabled\" => true,\n \"interval\" => \"0 10 0 * * ?\",\n ],\n \"full\" => [\n \"enabled\" => true,\n \"interval\" => \"0 20 0 * * ?\",\n ],\n \"incremental\" => [\n \"enabled\" => false,\n \"interval\" => \"0 30 0 * * ?\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"scheduling\":{\"access_control\":{\"enabled\":true,\"interval\":\"0 10 0 * * ?\"},\"full\":{\"enabled\":true,\"interval\":\"0 20 0 * * ?\"},\"incremental\":{\"enabled\":false,\"interval\":\"0 30 0 * * ?\"}}}' \"$ELASTICSEARCH_URL/_connector/my-connector/_scheduling\"" } ] } @@ -3725,6 +4905,26 @@ { "lang": "Console", "source": "PUT _connector/my-connector/_service_type\n{\n \"service_type\": \"sharepoint_online\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.update_service_type(\n connector_id=\"my-connector\",\n service_type=\"sharepoint_online\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.updateServiceType({\n connector_id: \"my-connector\",\n service_type: \"sharepoint_online\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.update_service_type(\n connector_id: \"my-connector\",\n body: {\n \"service_type\": \"sharepoint_online\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->updateServiceType([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"service_type\" => \"sharepoint_online\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service_type\":\"sharepoint_online\"}' \"$ELASTICSEARCH_URL/_connector/my-connector/_service_type\"" } ] } @@ -3802,6 +5002,26 @@ { "lang": "Console", "source": "PUT _connector/my-connector/_status\n{\n \"status\": \"needs_configuration\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.connector.update_status(\n connector_id=\"my-connector\",\n status=\"needs_configuration\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.connector.updateStatus({\n connector_id: \"my-connector\",\n status: \"needs_configuration\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.connector.update_status(\n connector_id: \"my-connector\",\n body: {\n \"status\": \"needs_configuration\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->connector()->updateStatus([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"status\" => \"needs_configuration\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"status\":\"needs_configuration\"}' \"$ELASTICSEARCH_URL/_connector/my-connector/_status\"" } ] } @@ -3870,6 +5090,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_count\n{\n \"query\" : {\n \"term\" : { \"user.id\" : \"kimchy\" }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.count(\n index=\"my-index-000001\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.count({\n index: \"my-index-000001\",\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.count(\n index: \"my-index-000001\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->count([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_count\"" } ] }, @@ -3936,6 +5176,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_count\n{\n \"query\" : {\n \"term\" : { \"user.id\" : \"kimchy\" }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.count(\n index=\"my-index-000001\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.count({\n index: \"my-index-000001\",\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.count(\n index: \"my-index-000001\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->count([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_count\"" } ] } @@ -4007,6 +5267,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_count\n{\n \"query\" : {\n \"term\" : { \"user.id\" : \"kimchy\" }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.count(\n index=\"my-index-000001\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.count({\n index: \"my-index-000001\",\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.count(\n index: \"my-index-000001\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->count([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_count\"" } ] }, @@ -4076,6 +5356,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_count\n{\n \"query\" : {\n \"term\" : { \"user.id\" : \"kimchy\" }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.count(\n index=\"my-index-000001\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.count({\n index: \"my-index-000001\",\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.count(\n index: \"my-index-000001\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->count([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_count\"" } ] } @@ -4151,6 +5451,26 @@ { "lang": "Console", "source": "PUT my-index-000001/_create/1\n{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.create(\n index=\"my-index-000001\",\n id=\"1\",\n document={\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.create({\n index: \"my-index-000001\",\n id: 1,\n document: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n message: \"GET /search HTTP/1.1 200 1070000\",\n user: {\n id: \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.create(\n index: \"my-index-000001\",\n id: \"1\",\n body: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->create([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"body\" => [\n \"@timestamp\" => \"2099-11-15T13:12:00\",\n \"message\" => \"GET /search HTTP/1.1 200 1070000\",\n \"user\" => [\n \"id\" => \"kimchy\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"@timestamp\":\"2099-11-15T13:12:00\",\"message\":\"GET /search HTTP/1.1 200 1070000\",\"user\":{\"id\":\"kimchy\"}}' \"$ELASTICSEARCH_URL/my-index-000001/_create/1\"" } ] }, @@ -4224,6 +5544,26 @@ { "lang": "Console", "source": "PUT my-index-000001/_create/1\n{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.create(\n index=\"my-index-000001\",\n id=\"1\",\n document={\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.create({\n index: \"my-index-000001\",\n id: 1,\n document: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n message: \"GET /search HTTP/1.1 200 1070000\",\n user: {\n id: \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.create(\n index: \"my-index-000001\",\n id: \"1\",\n body: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->create([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"body\" => [\n \"@timestamp\" => \"2099-11-15T13:12:00\",\n \"message\" => \"GET /search HTTP/1.1 200 1070000\",\n \"user\" => [\n \"id\" => \"kimchy\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"@timestamp\":\"2099-11-15T13:12:00\",\"message\":\"GET /search HTTP/1.1 200 1070000\",\"user\":{\"id\":\"kimchy\"}}' \"$ELASTICSEARCH_URL/my-index-000001/_create/1\"" } ] } @@ -4393,6 +5733,26 @@ { "lang": "Console", "source": "GET my-index-000001/_doc/1?stored_fields=tags,counter\n" + }, + { + "lang": "Python", + "source": "resp = client.get(\n index=\"my-index-000001\",\n id=\"1\",\n stored_fields=\"tags,counter\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.get({\n index: \"my-index-000001\",\n id: 1,\n stored_fields: \"tags,counter\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.get(\n index: \"my-index-000001\",\n id: \"1\",\n stored_fields: \"tags,counter\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->get([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"stored_fields\" => \"tags,counter\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_doc/1?stored_fields=tags,counter\"" } ] }, @@ -4462,6 +5822,26 @@ { "lang": "Console", "source": "POST my-index-000001/_doc/\n{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.index(\n index=\"my-index-000001\",\n document={\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.index({\n index: \"my-index-000001\",\n document: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n message: \"GET /search HTTP/1.1 200 1070000\",\n user: {\n id: \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.index(\n index: \"my-index-000001\",\n body: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->index([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"@timestamp\" => \"2099-11-15T13:12:00\",\n \"message\" => \"GET /search HTTP/1.1 200 1070000\",\n \"user\" => [\n \"id\" => \"kimchy\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"@timestamp\":\"2099-11-15T13:12:00\",\"message\":\"GET /search HTTP/1.1 200 1070000\",\"user\":{\"id\":\"kimchy\"}}' \"$ELASTICSEARCH_URL/my-index-000001/_doc/\"" } ] }, @@ -4531,6 +5911,26 @@ { "lang": "Console", "source": "POST my-index-000001/_doc/\n{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.index(\n index=\"my-index-000001\",\n document={\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.index({\n index: \"my-index-000001\",\n document: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n message: \"GET /search HTTP/1.1 200 1070000\",\n user: {\n id: \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.index(\n index: \"my-index-000001\",\n body: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->index([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"@timestamp\" => \"2099-11-15T13:12:00\",\n \"message\" => \"GET /search HTTP/1.1 200 1070000\",\n \"user\" => [\n \"id\" => \"kimchy\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"@timestamp\":\"2099-11-15T13:12:00\",\"message\":\"GET /search HTTP/1.1 200 1070000\",\"user\":{\"id\":\"kimchy\"}}' \"$ELASTICSEARCH_URL/my-index-000001/_doc/\"" } ] }, @@ -4667,6 +6067,26 @@ { "lang": "Console", "source": "DELETE /my-index-000001/_doc/1\n" + }, + { + "lang": "Python", + "source": "resp = client.delete(\n index=\"my-index-000001\",\n id=\"1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.delete({\n index: \"my-index-000001\",\n id: 1,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.delete(\n index: \"my-index-000001\",\n id: \"1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->delete([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_doc/1\"" } ] }, @@ -4813,6 +6233,26 @@ { "lang": "Console", "source": "HEAD my-index-000001/_doc/0\n" + }, + { + "lang": "Python", + "source": "resp = client.exists(\n index=\"my-index-000001\",\n id=\"0\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.exists({\n index: \"my-index-000001\",\n id: 0,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.exists(\n index: \"my-index-000001\",\n id: \"0\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->exists([\n \"index\" => \"my-index-000001\",\n \"id\" => \"0\",\n]);" + }, + { + "lang": "curl", + "source": "curl --head -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_doc/0\"" } ] } @@ -5262,6 +6702,26 @@ { "lang": "Console", "source": "POST /my-index-000001,my-index-000002/_delete_by_query\n{\n \"query\": {\n \"match_all\": {}\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.delete_by_query(\n index=\"my-index-000001,my-index-000002\",\n query={\n \"match_all\": {}\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.deleteByQuery({\n index: \"my-index-000001,my-index-000002\",\n query: {\n match_all: {},\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.delete_by_query(\n index: \"my-index-000001,my-index-000002\",\n body: {\n \"query\": {\n \"match_all\": {}\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->deleteByQuery([\n \"index\" => \"my-index-000001,my-index-000002\",\n \"body\" => [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"match_all\":{}}}' \"$ELASTICSEARCH_URL/my-index-000001,my-index-000002/_delete_by_query\"" } ] } @@ -5328,6 +6788,26 @@ { "lang": "Console", "source": "GET _scripts/my-search-template\n" + }, + { + "lang": "Python", + "source": "resp = client.get_script(\n id=\"my-search-template\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.getScript({\n id: \"my-search-template\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.get_script(\n id: \"my-search-template\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->getScript([\n \"id\" => \"my-search-template\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_scripts/my-search-template\"" } ] }, @@ -5367,6 +6847,26 @@ { "lang": "Console", "source": "PUT _scripts/my-search-template\n{\n \"script\": {\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.put_script(\n id=\"my-search-template\",\n script={\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.putScript({\n id: \"my-search-template\",\n script: {\n lang: \"mustache\",\n source: {\n query: {\n match: {\n message: \"{{query_string}}\",\n },\n },\n from: \"{{from}}\",\n size: \"{{size}}\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.put_script(\n id: \"my-search-template\",\n body: {\n \"script\": {\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->putScript([\n \"id\" => \"my-search-template\",\n \"body\" => [\n \"script\" => [\n \"lang\" => \"mustache\",\n \"source\" => [\n \"query\" => [\n \"match\" => [\n \"message\" => \"{{query_string}}\",\n ],\n ],\n \"from\" => \"{{from}}\",\n \"size\" => \"{{size}}\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"lang\":\"mustache\",\"source\":{\"query\":{\"match\":{\"message\":\"{{query_string}}\"}},\"from\":\"{{from}}\",\"size\":\"{{size}}\"}}}' \"$ELASTICSEARCH_URL/_scripts/my-search-template\"" } ] }, @@ -5406,6 +6906,26 @@ { "lang": "Console", "source": "PUT _scripts/my-search-template\n{\n \"script\": {\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.put_script(\n id=\"my-search-template\",\n script={\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.putScript({\n id: \"my-search-template\",\n script: {\n lang: \"mustache\",\n source: {\n query: {\n match: {\n message: \"{{query_string}}\",\n },\n },\n from: \"{{from}}\",\n size: \"{{size}}\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.put_script(\n id: \"my-search-template\",\n body: {\n \"script\": {\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->putScript([\n \"id\" => \"my-search-template\",\n \"body\" => [\n \"script\" => [\n \"lang\" => \"mustache\",\n \"source\" => [\n \"query\" => [\n \"match\" => [\n \"message\" => \"{{query_string}}\",\n ],\n ],\n \"from\" => \"{{from}}\",\n \"size\" => \"{{size}}\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"lang\":\"mustache\",\"source\":{\"query\":{\"match\":{\"message\":\"{{query_string}}\"}},\"from\":\"{{from}}\",\"size\":\"{{size}}\"}}}' \"$ELASTICSEARCH_URL/_scripts/my-search-template\"" } ] }, @@ -5465,6 +6985,26 @@ { "lang": "Console", "source": "DELETE _scripts/my-search-template\n" + }, + { + "lang": "Python", + "source": "resp = client.delete_script(\n id=\"my-search-template\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.deleteScript({\n id: \"my-search-template\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.delete_script(\n id: \"my-search-template\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->deleteScript([\n \"id\" => \"my-search-template\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_scripts/my-search-template\"" } ] } @@ -5495,6 +7035,26 @@ { "lang": "Console", "source": "GET /_enrich/policy/my-policy\n" + }, + { + "lang": "Python", + "source": "resp = client.enrich.get_policy(\n name=\"my-policy\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.enrich.getPolicy({\n name: \"my-policy\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.enrich.get_policy(\n name: \"my-policy\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->enrich()->getPolicy([\n \"name\" => \"my-policy\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_enrich/policy/my-policy\"" } ] }, @@ -5572,6 +7132,26 @@ { "lang": "Console", "source": "PUT /_enrich/policy/postal_policy\n{\n \"geo_match\": {\n \"indices\": \"postal_codes\",\n \"match_field\": \"location\",\n \"enrich_fields\": [ \"location\", \"postal_code\" ]\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.enrich.put_policy(\n name=\"postal_policy\",\n geo_match={\n \"indices\": \"postal_codes\",\n \"match_field\": \"location\",\n \"enrich_fields\": [\n \"location\",\n \"postal_code\"\n ]\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.enrich.putPolicy({\n name: \"postal_policy\",\n geo_match: {\n indices: \"postal_codes\",\n match_field: \"location\",\n enrich_fields: [\"location\", \"postal_code\"],\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.enrich.put_policy(\n name: \"postal_policy\",\n body: {\n \"geo_match\": {\n \"indices\": \"postal_codes\",\n \"match_field\": \"location\",\n \"enrich_fields\": [\n \"location\",\n \"postal_code\"\n ]\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->enrich()->putPolicy([\n \"name\" => \"postal_policy\",\n \"body\" => [\n \"geo_match\" => [\n \"indices\" => \"postal_codes\",\n \"match_field\" => \"location\",\n \"enrich_fields\" => array(\n \"location\",\n \"postal_code\",\n ),\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"geo_match\":{\"indices\":\"postal_codes\",\"match_field\":\"location\",\"enrich_fields\":[\"location\",\"postal_code\"]}}' \"$ELASTICSEARCH_URL/_enrich/policy/postal_policy\"" } ] }, @@ -5622,6 +7202,26 @@ { "lang": "Console", "source": "DELETE /_enrich/policy/my-policy\n" + }, + { + "lang": "Python", + "source": "resp = client.enrich.delete_policy(\n name=\"my-policy\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.enrich.deletePolicy({\n name: \"my-policy\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.enrich.delete_policy(\n name: \"my-policy\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->enrich()->deletePolicy([\n \"name\" => \"my-policy\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_enrich/policy/my-policy\"" } ] } @@ -5692,6 +7292,26 @@ { "lang": "Console", "source": "PUT /_enrich/policy/my-policy/_execute?wait_for_completion=false\n" + }, + { + "lang": "Python", + "source": "resp = client.enrich.execute_policy(\n name=\"my-policy\",\n wait_for_completion=False,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.enrich.executePolicy({\n name: \"my-policy\",\n wait_for_completion: \"false\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.enrich.execute_policy(\n name: \"my-policy\",\n wait_for_completion: \"false\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->enrich()->executePolicy([\n \"name\" => \"my-policy\",\n \"wait_for_completion\" => \"false\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_enrich/policy/my-policy/_execute?wait_for_completion=false\"" } ] } @@ -5719,6 +7339,26 @@ { "lang": "Console", "source": "GET /_enrich/policy/my-policy\n" + }, + { + "lang": "Python", + "source": "resp = client.enrich.get_policy(\n name=\"my-policy\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.enrich.getPolicy({\n name: \"my-policy\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.enrich.get_policy(\n name: \"my-policy\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->enrich()->getPolicy([\n \"name\" => \"my-policy\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_enrich/policy/my-policy\"" } ] } @@ -5781,6 +7421,26 @@ { "lang": "Console", "source": "GET /_eql/search/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=?wait_for_completion_timeout=2s\n" + }, + { + "lang": "Python", + "source": "resp = client.eql.get(\n id=\"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n wait_for_completion_timeout=\"2s\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.eql.get({\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n wait_for_completion_timeout: \"2s\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.eql.get(\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n wait_for_completion_timeout: \"2s\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->eql()->get([\n \"id\" => \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n \"wait_for_completion_timeout\" => \"2s\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_eql/search/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=?wait_for_completion_timeout=2s\"" } ] }, @@ -5821,6 +7481,26 @@ { "lang": "Console", "source": "DELETE /_eql/search/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\n" + }, + { + "lang": "Python", + "source": "resp = client.eql.delete(\n id=\"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.eql.delete({\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.eql.delete(\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->eql()->delete([\n \"id\" => \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_eql/search/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\"" } ] } @@ -5897,6 +7577,26 @@ { "lang": "Console", "source": "GET /_eql/search/status/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\n" + }, + { + "lang": "Python", + "source": "resp = client.eql.get_status(\n id=\"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.eql.getStatus({\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.eql.get_status(\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->eql()->getStatus([\n \"id\" => \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_eql/search/status/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\"" } ] } @@ -5954,6 +7654,26 @@ { "lang": "Console", "source": "GET /my-data-stream/_eql/search\n{\n \"query\": \"\"\"\n process where (process.name == \"cmd.exe\" and process.pid != 2013)\n \"\"\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.eql.search(\n index=\"my-data-stream\",\n query=\"\\n process where (process.name == \\\"cmd.exe\\\" and process.pid != 2013)\\n \",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.eql.search({\n index: \"my-data-stream\",\n query:\n '\\n process where (process.name == \"cmd.exe\" and process.pid != 2013)\\n ',\n});" + }, + { + "lang": "Ruby", + "source": "response = client.eql.search(\n index: \"my-data-stream\",\n body: {\n \"query\": \"\\n process where (process.name == \\\"cmd.exe\\\" and process.pid != 2013)\\n \"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->eql()->search([\n \"index\" => \"my-data-stream\",\n \"body\" => [\n \"query\" => \"\\n process where (process.name == \\\"cmd.exe\\\" and process.pid != 2013)\\n \",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":\"\\n process where (process.name == \\\"cmd.exe\\\" and process.pid != 2013)\\n \"}' \"$ELASTICSEARCH_URL/my-data-stream/_eql/search\"" } ] }, @@ -6009,6 +7729,26 @@ { "lang": "Console", "source": "GET /my-data-stream/_eql/search\n{\n \"query\": \"\"\"\n process where (process.name == \"cmd.exe\" and process.pid != 2013)\n \"\"\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.eql.search(\n index=\"my-data-stream\",\n query=\"\\n process where (process.name == \\\"cmd.exe\\\" and process.pid != 2013)\\n \",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.eql.search({\n index: \"my-data-stream\",\n query:\n '\\n process where (process.name == \"cmd.exe\" and process.pid != 2013)\\n ',\n});" + }, + { + "lang": "Ruby", + "source": "response = client.eql.search(\n index: \"my-data-stream\",\n body: {\n \"query\": \"\\n process where (process.name == \\\"cmd.exe\\\" and process.pid != 2013)\\n \"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->eql()->search([\n \"index\" => \"my-data-stream\",\n \"body\" => [\n \"query\" => \"\\n process where (process.name == \\\"cmd.exe\\\" and process.pid != 2013)\\n \",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":\"\\n process where (process.name == \\\"cmd.exe\\\" and process.pid != 2013)\\n \"}' \"$ELASTICSEARCH_URL/my-data-stream/_eql/search\"" } ] } @@ -6132,6 +7872,26 @@ { "lang": "Console", "source": "POST /_query\n{\n \"query\": \"\"\"\n FROM library,remote-*:library\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n | STATS MAX(page_count) BY year\n | SORT year\n | LIMIT 5\n \"\"\",\n \"include_ccs_metadata\": true\n}" + }, + { + "lang": "Python", + "source": "resp = client.esql.query(\n query=\"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\n include_ccs_metadata=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.esql.query({\n query:\n \"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\n include_ccs_metadata: true,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.esql.query(\n body: {\n \"query\": \"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\n \"include_ccs_metadata\": true\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->esql()->query([\n \"body\" => [\n \"query\" => \"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\n \"include_ccs_metadata\" => true,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":\"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\"include_ccs_metadata\":true}' \"$ELASTICSEARCH_URL/_query\"" } ] } @@ -6287,6 +8047,26 @@ { "lang": "Console", "source": "GET my-index-000001/_source/1\n" + }, + { + "lang": "Python", + "source": "resp = client.get_source(\n index=\"my-index-000001\",\n id=\"1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.getSource({\n index: \"my-index-000001\",\n id: 1,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.get_source(\n index: \"my-index-000001\",\n id: \"1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->getSource([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_source/1\"" } ] }, @@ -6427,6 +8207,26 @@ { "lang": "Console", "source": "HEAD my-index-000001/_source/1\n" + }, + { + "lang": "Python", + "source": "resp = client.exists_source(\n index=\"my-index-000001\",\n id=\"1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.existsSource({\n index: \"my-index-000001\",\n id: 1,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.exists_source(\n index: \"my-index-000001\",\n id: \"1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->existsSource([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n]);" + }, + { + "lang": "curl", + "source": "curl --head -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_source/1\"" } ] } @@ -6495,6 +8295,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_explain/0\n{\n \"query\" : {\n \"match\" : { \"message\" : \"elasticsearch\" }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.explain(\n index=\"my-index-000001\",\n id=\"0\",\n query={\n \"match\": {\n \"message\": \"elasticsearch\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.explain({\n index: \"my-index-000001\",\n id: 0,\n query: {\n match: {\n message: \"elasticsearch\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.explain(\n index: \"my-index-000001\",\n id: \"0\",\n body: {\n \"query\": {\n \"match\": {\n \"message\": \"elasticsearch\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->explain([\n \"index\" => \"my-index-000001\",\n \"id\" => \"0\",\n \"body\" => [\n \"query\" => [\n \"match\" => [\n \"message\" => \"elasticsearch\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"match\":{\"message\":\"elasticsearch\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_explain/0\"" } ] }, @@ -6561,6 +8381,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_explain/0\n{\n \"query\" : {\n \"match\" : { \"message\" : \"elasticsearch\" }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.explain(\n index=\"my-index-000001\",\n id=\"0\",\n query={\n \"match\": {\n \"message\": \"elasticsearch\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.explain({\n index: \"my-index-000001\",\n id: 0,\n query: {\n match: {\n message: \"elasticsearch\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.explain(\n index: \"my-index-000001\",\n id: \"0\",\n body: {\n \"query\": {\n \"match\": {\n \"message\": \"elasticsearch\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->explain([\n \"index\" => \"my-index-000001\",\n \"id\" => \"0\",\n \"body\" => [\n \"query\" => [\n \"match\" => [\n \"message\" => \"elasticsearch\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"match\":{\"message\":\"elasticsearch\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_explain/0\"" } ] } @@ -6612,6 +8452,26 @@ { "lang": "Console", "source": "POST my-index-*/_field_caps?fields=rating\n{\n \"index_filter\": {\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.field_caps(\n index=\"my-index-*\",\n fields=\"rating\",\n index_filter={\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.fieldCaps({\n index: \"my-index-*\",\n fields: \"rating\",\n index_filter: {\n range: {\n \"@timestamp\": {\n gte: \"2018\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.field_caps(\n index: \"my-index-*\",\n fields: \"rating\",\n body: {\n \"index_filter\": {\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->fieldCaps([\n \"index\" => \"my-index-*\",\n \"fields\" => \"rating\",\n \"body\" => [\n \"index_filter\" => [\n \"range\" => [\n \"@timestamp\" => [\n \"gte\" => \"2018\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_filter\":{\"range\":{\"@timestamp\":{\"gte\":\"2018\"}}}}' \"$ELASTICSEARCH_URL/my-index-*/_field_caps?fields=rating\"" } ] }, @@ -6661,6 +8521,26 @@ { "lang": "Console", "source": "POST my-index-*/_field_caps?fields=rating\n{\n \"index_filter\": {\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.field_caps(\n index=\"my-index-*\",\n fields=\"rating\",\n index_filter={\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.fieldCaps({\n index: \"my-index-*\",\n fields: \"rating\",\n index_filter: {\n range: {\n \"@timestamp\": {\n gte: \"2018\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.field_caps(\n index: \"my-index-*\",\n fields: \"rating\",\n body: {\n \"index_filter\": {\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->fieldCaps([\n \"index\" => \"my-index-*\",\n \"fields\" => \"rating\",\n \"body\" => [\n \"index_filter\" => [\n \"range\" => [\n \"@timestamp\" => [\n \"gte\" => \"2018\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_filter\":{\"range\":{\"@timestamp\":{\"gte\":\"2018\"}}}}' \"$ELASTICSEARCH_URL/my-index-*/_field_caps?fields=rating\"" } ] } @@ -6715,6 +8595,26 @@ { "lang": "Console", "source": "POST my-index-*/_field_caps?fields=rating\n{\n \"index_filter\": {\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.field_caps(\n index=\"my-index-*\",\n fields=\"rating\",\n index_filter={\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.fieldCaps({\n index: \"my-index-*\",\n fields: \"rating\",\n index_filter: {\n range: {\n \"@timestamp\": {\n gte: \"2018\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.field_caps(\n index: \"my-index-*\",\n fields: \"rating\",\n body: {\n \"index_filter\": {\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->fieldCaps([\n \"index\" => \"my-index-*\",\n \"fields\" => \"rating\",\n \"body\" => [\n \"index_filter\" => [\n \"range\" => [\n \"@timestamp\" => [\n \"gte\" => \"2018\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_filter\":{\"range\":{\"@timestamp\":{\"gte\":\"2018\"}}}}' \"$ELASTICSEARCH_URL/my-index-*/_field_caps?fields=rating\"" } ] }, @@ -6767,6 +8667,26 @@ { "lang": "Console", "source": "POST my-index-*/_field_caps?fields=rating\n{\n \"index_filter\": {\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.field_caps(\n index=\"my-index-*\",\n fields=\"rating\",\n index_filter={\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.fieldCaps({\n index: \"my-index-*\",\n fields: \"rating\",\n index_filter: {\n range: {\n \"@timestamp\": {\n gte: \"2018\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.field_caps(\n index: \"my-index-*\",\n fields: \"rating\",\n body: {\n \"index_filter\": {\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->fieldCaps([\n \"index\" => \"my-index-*\",\n \"fields\" => \"rating\",\n \"body\" => [\n \"index_filter\" => [\n \"range\" => [\n \"@timestamp\" => [\n \"gte\" => \"2018\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_filter\":{\"range\":{\"@timestamp\":{\"gte\":\"2018\"}}}}' \"$ELASTICSEARCH_URL/my-index-*/_field_caps?fields=rating\"" } ] } @@ -6805,6 +8725,26 @@ { "lang": "Console", "source": "POST clicklogs/_graph/explore\n{\n \"query\": {\n \"match\": {\n \"query.raw\": \"midi\"\n }\n },\n \"vertices\": [\n {\n \"field\": \"product\"\n }\n ],\n \"connections\": {\n \"vertices\": [\n {\n \"field\": \"query.raw\"\n }\n ]\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.graph.explore(\n index=\"clicklogs\",\n query={\n \"match\": {\n \"query.raw\": \"midi\"\n }\n },\n vertices=[\n {\n \"field\": \"product\"\n }\n ],\n connections={\n \"vertices\": [\n {\n \"field\": \"query.raw\"\n }\n ]\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.graph.explore({\n index: \"clicklogs\",\n query: {\n match: {\n \"query.raw\": \"midi\",\n },\n },\n vertices: [\n {\n field: \"product\",\n },\n ],\n connections: {\n vertices: [\n {\n field: \"query.raw\",\n },\n ],\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.graph.explore(\n index: \"clicklogs\",\n body: {\n \"query\": {\n \"match\": {\n \"query.raw\": \"midi\"\n }\n },\n \"vertices\": [\n {\n \"field\": \"product\"\n }\n ],\n \"connections\": {\n \"vertices\": [\n {\n \"field\": \"query.raw\"\n }\n ]\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->graph()->explore([\n \"index\" => \"clicklogs\",\n \"body\" => [\n \"query\" => [\n \"match\" => [\n \"query.raw\" => \"midi\",\n ],\n ],\n \"vertices\" => array(\n [\n \"field\" => \"product\",\n ],\n ),\n \"connections\" => [\n \"vertices\" => array(\n [\n \"field\" => \"query.raw\",\n ],\n ),\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"match\":{\"query.raw\":\"midi\"}},\"vertices\":[{\"field\":\"product\"}],\"connections\":{\"vertices\":[{\"field\":\"query.raw\"}]}}' \"$ELASTICSEARCH_URL/clicklogs/_graph/explore\"" } ] }, @@ -6841,6 +8781,26 @@ { "lang": "Console", "source": "POST clicklogs/_graph/explore\n{\n \"query\": {\n \"match\": {\n \"query.raw\": \"midi\"\n }\n },\n \"vertices\": [\n {\n \"field\": \"product\"\n }\n ],\n \"connections\": {\n \"vertices\": [\n {\n \"field\": \"query.raw\"\n }\n ]\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.graph.explore(\n index=\"clicklogs\",\n query={\n \"match\": {\n \"query.raw\": \"midi\"\n }\n },\n vertices=[\n {\n \"field\": \"product\"\n }\n ],\n connections={\n \"vertices\": [\n {\n \"field\": \"query.raw\"\n }\n ]\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.graph.explore({\n index: \"clicklogs\",\n query: {\n match: {\n \"query.raw\": \"midi\",\n },\n },\n vertices: [\n {\n field: \"product\",\n },\n ],\n connections: {\n vertices: [\n {\n field: \"query.raw\",\n },\n ],\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.graph.explore(\n index: \"clicklogs\",\n body: {\n \"query\": {\n \"match\": {\n \"query.raw\": \"midi\"\n }\n },\n \"vertices\": [\n {\n \"field\": \"product\"\n }\n ],\n \"connections\": {\n \"vertices\": [\n {\n \"field\": \"query.raw\"\n }\n ]\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->graph()->explore([\n \"index\" => \"clicklogs\",\n \"body\" => [\n \"query\" => [\n \"match\" => [\n \"query.raw\" => \"midi\",\n ],\n ],\n \"vertices\" => array(\n [\n \"field\" => \"product\",\n ],\n ),\n \"connections\" => [\n \"vertices\" => array(\n [\n \"field\" => \"query.raw\",\n ],\n ),\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"match\":{\"query.raw\":\"midi\"}},\"vertices\":[{\"field\":\"product\"}],\"connections\":{\"vertices\":[{\"field\":\"query.raw\"}]}}' \"$ELASTICSEARCH_URL/clicklogs/_graph/explore\"" } ] } @@ -6909,6 +8869,26 @@ { "lang": "Console", "source": "POST my-index-000001/_doc/\n{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.index(\n index=\"my-index-000001\",\n document={\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.index({\n index: \"my-index-000001\",\n document: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n message: \"GET /search HTTP/1.1 200 1070000\",\n user: {\n id: \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.index(\n index: \"my-index-000001\",\n body: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->index([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"@timestamp\" => \"2099-11-15T13:12:00\",\n \"message\" => \"GET /search HTTP/1.1 200 1070000\",\n \"user\" => [\n \"id\" => \"kimchy\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"@timestamp\":\"2099-11-15T13:12:00\",\"message\":\"GET /search HTTP/1.1 200 1070000\",\"user\":{\"id\":\"kimchy\"}}' \"$ELASTICSEARCH_URL/my-index-000001/_doc/\"" } ] } @@ -7037,6 +9017,26 @@ { "lang": "Console", "source": "PUT /my-index-000001/_block/write\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.add_block(\n index=\"my-index-000001\",\n block=\"write\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.addBlock({\n index: \"my-index-000001\",\n block: \"write\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.add_block(\n index: \"my-index-000001\",\n block: \"write\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->addBlock([\n \"index\" => \"my-index-000001\",\n \"block\" => \"write\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_block/write\"" } ] } @@ -7069,6 +9069,26 @@ { "lang": "Console", "source": "GET /_analyze\n{\n \"analyzer\": \"standard\",\n \"text\": \"this is a test\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.analyze(\n analyzer=\"standard\",\n text=\"this is a test\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.analyze({\n analyzer: \"standard\",\n text: \"this is a test\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.analyze(\n body: {\n \"analyzer\": \"standard\",\n \"text\": \"this is a test\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->analyze([\n \"body\" => [\n \"analyzer\" => \"standard\",\n \"text\" => \"this is a test\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"analyzer\":\"standard\",\"text\":\"this is a test\"}' \"$ELASTICSEARCH_URL/_analyze\"" } ] }, @@ -7099,6 +9119,26 @@ { "lang": "Console", "source": "GET /_analyze\n{\n \"analyzer\": \"standard\",\n \"text\": \"this is a test\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.analyze(\n analyzer=\"standard\",\n text=\"this is a test\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.analyze({\n analyzer: \"standard\",\n text: \"this is a test\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.analyze(\n body: {\n \"analyzer\": \"standard\",\n \"text\": \"this is a test\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->analyze([\n \"body\" => [\n \"analyzer\" => \"standard\",\n \"text\" => \"this is a test\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"analyzer\":\"standard\",\"text\":\"this is a test\"}' \"$ELASTICSEARCH_URL/_analyze\"" } ] } @@ -7134,6 +9174,26 @@ { "lang": "Console", "source": "GET /_analyze\n{\n \"analyzer\": \"standard\",\n \"text\": \"this is a test\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.analyze(\n analyzer=\"standard\",\n text=\"this is a test\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.analyze({\n analyzer: \"standard\",\n text: \"this is a test\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.analyze(\n body: {\n \"analyzer\": \"standard\",\n \"text\": \"this is a test\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->analyze([\n \"body\" => [\n \"analyzer\" => \"standard\",\n \"text\" => \"this is a test\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"analyzer\":\"standard\",\"text\":\"this is a test\"}' \"$ELASTICSEARCH_URL/_analyze\"" } ] }, @@ -7167,6 +9227,26 @@ { "lang": "Console", "source": "GET /_analyze\n{\n \"analyzer\": \"standard\",\n \"text\": \"this is a test\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.analyze(\n analyzer=\"standard\",\n text=\"this is a test\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.analyze({\n analyzer: \"standard\",\n text: \"this is a test\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.analyze(\n body: {\n \"analyzer\": \"standard\",\n \"text\": \"this is a test\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->analyze([\n \"body\" => [\n \"analyzer\" => \"standard\",\n \"text\" => \"this is a test\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"analyzer\":\"standard\",\"text\":\"this is a test\"}' \"$ELASTICSEARCH_URL/_analyze\"" } ] } @@ -7291,6 +9371,26 @@ { "lang": "Console", "source": "GET /my-index-000001\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get(\n index=\"my-index-000001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.get({\n index: \"my-index-000001\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get(\n index: \"my-index-000001\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->get([\n \"index\" => \"my-index-000001\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001\"" } ] }, @@ -7417,6 +9517,26 @@ { "lang": "Console", "source": "PUT /my-index-000001\n{\n \"settings\": {\n \"number_of_shards\": 3,\n \"number_of_replicas\": 2\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.create(\n index=\"my-index-000001\",\n settings={\n \"number_of_shards\": 3,\n \"number_of_replicas\": 2\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.create({\n index: \"my-index-000001\",\n settings: {\n number_of_shards: 3,\n number_of_replicas: 2,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.create(\n index: \"my-index-000001\",\n body: {\n \"settings\": {\n \"number_of_shards\": 3,\n \"number_of_replicas\": 2\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->create([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"settings\" => [\n \"number_of_shards\" => 3,\n \"number_of_replicas\" => 2,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"settings\":{\"number_of_shards\":3,\"number_of_replicas\":2}}' \"$ELASTICSEARCH_URL/my-index-000001\"" } ] }, @@ -7506,6 +9626,26 @@ { "lang": "Console", "source": "DELETE /books\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.delete(\n index=\"books\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.delete({\n index: \"books\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.delete(\n index: \"books\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->delete([\n \"index\" => \"books\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/books\"" } ] }, @@ -7601,6 +9741,26 @@ { "lang": "Console", "source": "HEAD my-data-stream\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.exists(\n index=\"my-data-stream\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.exists({\n index: \"my-data-stream\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.exists(\n index: \"my-data-stream\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->exists([\n \"index\" => \"my-data-stream\",\n]);" + }, + { + "lang": "curl", + "source": "curl --head -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-data-stream\"" } ] } @@ -7640,6 +9800,26 @@ { "lang": "Console", "source": "GET _data_stream/my-data-stream\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_data_stream(\n name=\"my-data-stream\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getDataStream({\n name: \"my-data-stream\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_data_stream(\n name: \"my-data-stream\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getDataStream([\n \"name\" => \"my-data-stream\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/my-data-stream\"" } ] }, @@ -7700,6 +9880,26 @@ { "lang": "Console", "source": "PUT _data_stream/logs-foo-bar\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.create_data_stream(\n name=\"logs-foo-bar\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.createDataStream({\n name: \"logs-foo-bar\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.create_data_stream(\n name: \"logs-foo-bar\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->createDataStream([\n \"name\" => \"logs-foo-bar\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/logs-foo-bar\"" } ] }, @@ -7760,6 +9960,26 @@ { "lang": "Console", "source": "DELETE _data_stream/my-data-stream\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.delete_data_stream(\n name=\"my-data-stream\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.deleteDataStream({\n name: \"my-data-stream\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.delete_data_stream(\n name: \"my-data-stream\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->deleteDataStream([\n \"name\" => \"my-data-stream\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/my-data-stream\"" } ] } @@ -7801,6 +10021,26 @@ { "lang": "Console", "source": "GET _alias\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_alias()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getAlias();" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_alias" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getAlias();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_alias\"" } ] }, @@ -7837,6 +10077,26 @@ { "lang": "Console", "source": "POST _aliases\n{\n \"actions\": [\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.update_aliases(\n actions=[\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.updateAliases({\n actions: [\n {\n add: {\n index: \"my-data-stream\",\n alias: \"my-alias\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.update_aliases(\n body: {\n \"actions\": [\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->updateAliases([\n \"body\" => [\n \"actions\" => array(\n [\n \"add\" => [\n \"index\" => \"my-data-stream\",\n \"alias\" => \"my-alias\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"actions\":[{\"add\":{\"index\":\"my-data-stream\",\"alias\":\"my-alias\"}}]}' \"$ELASTICSEARCH_URL/_aliases\"" } ] }, @@ -7873,6 +10133,26 @@ { "lang": "Console", "source": "POST _aliases\n{\n \"actions\": [\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.update_aliases(\n actions=[\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.updateAliases({\n actions: [\n {\n add: {\n index: \"my-data-stream\",\n alias: \"my-alias\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.update_aliases(\n body: {\n \"actions\": [\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->updateAliases([\n \"body\" => [\n \"actions\" => array(\n [\n \"add\" => [\n \"index\" => \"my-data-stream\",\n \"alias\" => \"my-alias\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"actions\":[{\"add\":{\"index\":\"my-data-stream\",\"alias\":\"my-alias\"}}]}' \"$ELASTICSEARCH_URL/_aliases\"" } ] }, @@ -7906,6 +10186,26 @@ { "lang": "Console", "source": "DELETE my-data-stream/_alias/my-alias\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.delete_alias(\n index=\"my-data-stream\",\n name=\"my-alias\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.deleteAlias({\n index: \"my-data-stream\",\n name: \"my-alias\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.delete_alias(\n index: \"my-data-stream\",\n name: \"my-alias\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->deleteAlias([\n \"index\" => \"my-data-stream\",\n \"name\" => \"my-alias\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-data-stream/_alias/my-alias\"" } ] }, @@ -7945,6 +10245,26 @@ { "lang": "Console", "source": "HEAD _alias/my-alias\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.exists_alias(\n name=\"my-alias\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.existsAlias({\n name: \"my-alias\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.exists_alias(\n name: \"my-alias\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->existsAlias([\n \"name\" => \"my-alias\",\n]);" + }, + { + "lang": "curl", + "source": "curl --head -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_alias/my-alias\"" } ] } @@ -7983,6 +10303,26 @@ { "lang": "Console", "source": "POST _aliases\n{\n \"actions\": [\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.update_aliases(\n actions=[\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.updateAliases({\n actions: [\n {\n add: {\n index: \"my-data-stream\",\n alias: \"my-alias\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.update_aliases(\n body: {\n \"actions\": [\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->updateAliases([\n \"body\" => [\n \"actions\" => array(\n [\n \"add\" => [\n \"index\" => \"my-data-stream\",\n \"alias\" => \"my-alias\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"actions\":[{\"add\":{\"index\":\"my-data-stream\",\"alias\":\"my-alias\"}}]}' \"$ELASTICSEARCH_URL/_aliases\"" } ] }, @@ -8019,6 +10359,26 @@ { "lang": "Console", "source": "POST _aliases\n{\n \"actions\": [\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.update_aliases(\n actions=[\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.updateAliases({\n actions: [\n {\n add: {\n index: \"my-data-stream\",\n alias: \"my-alias\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.update_aliases(\n body: {\n \"actions\": [\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->updateAliases([\n \"body\" => [\n \"actions\" => array(\n [\n \"add\" => [\n \"index\" => \"my-data-stream\",\n \"alias\" => \"my-alias\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"actions\":[{\"add\":{\"index\":\"my-data-stream\",\"alias\":\"my-alias\"}}]}' \"$ELASTICSEARCH_URL/_aliases\"" } ] }, @@ -8052,6 +10412,26 @@ { "lang": "Console", "source": "DELETE my-data-stream/_alias/my-alias\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.delete_alias(\n index=\"my-data-stream\",\n name=\"my-alias\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.deleteAlias({\n index: \"my-data-stream\",\n name: \"my-alias\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.delete_alias(\n index: \"my-data-stream\",\n name: \"my-alias\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->deleteAlias([\n \"index\" => \"my-data-stream\",\n \"name\" => \"my-alias\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-data-stream/_alias/my-alias\"" } ] } @@ -8091,6 +10471,26 @@ { "lang": "Console", "source": "GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_index_template(\n name=\"*\",\n filter_path=\"index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getIndexTemplate({\n name: \"*\",\n filter_path:\n \"index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_index_template(\n name: \"*\",\n filter_path: \"index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getIndexTemplate([\n \"name\" => \"*\",\n \"filter_path\" => \"index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\"" } ] }, @@ -8128,6 +10528,26 @@ { "lang": "Console", "source": "PUT /_index_template/template_1\n{\n \"index_patterns\" : [\"template*\"],\n \"priority\" : 1,\n \"template\": {\n \"settings\" : {\n \"number_of_shards\" : 2\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.put_index_template(\n name=\"template_1\",\n index_patterns=[\n \"template*\"\n ],\n priority=1,\n template={\n \"settings\": {\n \"number_of_shards\": 2\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.putIndexTemplate({\n name: \"template_1\",\n index_patterns: [\"template*\"],\n priority: 1,\n template: {\n settings: {\n number_of_shards: 2,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.put_index_template(\n name: \"template_1\",\n body: {\n \"index_patterns\": [\n \"template*\"\n ],\n \"priority\": 1,\n \"template\": {\n \"settings\": {\n \"number_of_shards\": 2\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->putIndexTemplate([\n \"name\" => \"template_1\",\n \"body\" => [\n \"index_patterns\" => array(\n \"template*\",\n ),\n \"priority\" => 1,\n \"template\" => [\n \"settings\" => [\n \"number_of_shards\" => 2,\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_patterns\":[\"template*\"],\"priority\":1,\"template\":{\"settings\":{\"number_of_shards\":2}}}' \"$ELASTICSEARCH_URL/_index_template/template_1\"" } ] }, @@ -8165,6 +10585,26 @@ { "lang": "Console", "source": "PUT /_index_template/template_1\n{\n \"index_patterns\" : [\"template*\"],\n \"priority\" : 1,\n \"template\": {\n \"settings\" : {\n \"number_of_shards\" : 2\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.put_index_template(\n name=\"template_1\",\n index_patterns=[\n \"template*\"\n ],\n priority=1,\n template={\n \"settings\": {\n \"number_of_shards\": 2\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.putIndexTemplate({\n name: \"template_1\",\n index_patterns: [\"template*\"],\n priority: 1,\n template: {\n settings: {\n number_of_shards: 2,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.put_index_template(\n name: \"template_1\",\n body: {\n \"index_patterns\": [\n \"template*\"\n ],\n \"priority\": 1,\n \"template\": {\n \"settings\": {\n \"number_of_shards\": 2\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->putIndexTemplate([\n \"name\" => \"template_1\",\n \"body\" => [\n \"index_patterns\" => array(\n \"template*\",\n ),\n \"priority\" => 1,\n \"template\" => [\n \"settings\" => [\n \"number_of_shards\" => 2,\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_patterns\":[\"template*\"],\"priority\":1,\"template\":{\"settings\":{\"number_of_shards\":2}}}' \"$ELASTICSEARCH_URL/_index_template/template_1\"" } ] }, @@ -8225,6 +10665,26 @@ { "lang": "Console", "source": "DELETE /_index_template/my-index-template\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.delete_index_template(\n name=\"my-index-template\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.deleteIndexTemplate({\n name: \"my-index-template\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.delete_index_template(\n name: \"my-index-template\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->deleteIndexTemplate([\n \"name\" => \"my-index-template\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_index_template/my-index-template\"" } ] }, @@ -8322,6 +10782,26 @@ { "lang": "Console", "source": "GET _alias\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_alias()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getAlias();" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_alias" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getAlias();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_alias\"" } ] }, @@ -8358,6 +10838,26 @@ { "lang": "Console", "source": "HEAD _alias/my-alias\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.exists_alias(\n name=\"my-alias\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.existsAlias({\n name: \"my-alias\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.exists_alias(\n name: \"my-alias\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->existsAlias([\n \"name\" => \"my-alias\",\n]);" + }, + { + "lang": "curl", + "source": "curl --head -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_alias/my-alias\"" } ] } @@ -8443,6 +10943,26 @@ { "lang": "Console", "source": "GET .ds-metrics-2023.03.22-000001/_lifecycle/explain\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.explain_data_lifecycle(\n index=\".ds-metrics-2023.03.22-000001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.explainDataLifecycle({\n index: \".ds-metrics-2023.03.22-000001\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.explain_data_lifecycle(\n index: \".ds-metrics-2023.03.22-000001\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->explainDataLifecycle([\n \"index\" => \".ds-metrics-2023.03.22-000001\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/.ds-metrics-2023.03.22-000001/_lifecycle/explain\"" } ] } @@ -8478,6 +10998,26 @@ { "lang": "Console", "source": "GET _alias\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_alias()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getAlias();" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_alias" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getAlias();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_alias\"" } ] } @@ -8516,6 +11056,26 @@ { "lang": "Console", "source": "GET _alias\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_alias()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getAlias();" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_alias" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getAlias();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_alias\"" } ] } @@ -8605,6 +11165,26 @@ { "lang": "Console", "source": "GET /_data_stream/{name}/_lifecycle?human&pretty\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_data_lifecycle(\n name=\"{name}\",\n human=True,\n pretty=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getDataLifecycle({\n name: \"{name}\",\n human: \"true\",\n pretty: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_data_lifecycle(\n name: \"{name}\",\n human: \"true\",\n pretty: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getDataLifecycle([\n \"name\" => \"{name}\",\n \"human\" => \"true\",\n \"pretty\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/%7Bname%7D/_lifecycle?human&pretty\"" } ] }, @@ -8713,6 +11293,26 @@ { "lang": "Console", "source": "PUT _data_stream/my-data-stream/_lifecycle\n{\n \"data_retention\": \"7d\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.put_data_lifecycle(\n name=\"my-data-stream\",\n data_retention=\"7d\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.putDataLifecycle({\n name: \"my-data-stream\",\n data_retention: \"7d\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.put_data_lifecycle(\n name: \"my-data-stream\",\n body: {\n \"data_retention\": \"7d\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->putDataLifecycle([\n \"name\" => \"my-data-stream\",\n \"body\" => [\n \"data_retention\" => \"7d\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"data_retention\":\"7d\"}' \"$ELASTICSEARCH_URL/_data_stream/my-data-stream/_lifecycle\"" } ] } @@ -8749,6 +11349,26 @@ { "lang": "Console", "source": "GET _data_stream/my-data-stream\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_data_stream(\n name=\"my-data-stream\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getDataStream({\n name: \"my-data-stream\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_data_stream(\n name: \"my-data-stream\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getDataStream([\n \"name\" => \"my-data-stream\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/my-data-stream\"" } ] } @@ -8785,6 +11405,26 @@ { "lang": "Console", "source": "GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_index_template(\n name=\"*\",\n filter_path=\"index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getIndexTemplate({\n name: \"*\",\n filter_path:\n \"index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_index_template(\n name: \"*\",\n filter_path: \"index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getIndexTemplate([\n \"name\" => \"*\",\n \"filter_path\" => \"index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\"" } ] } @@ -8823,6 +11463,26 @@ { "lang": "Console", "source": "GET /books/_mapping\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_mapping(\n index=\"books\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getMapping({\n index: \"books\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_mapping(\n index: \"books\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getMapping([\n \"index\" => \"books\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/books/_mapping\"" } ] } @@ -8864,6 +11524,26 @@ { "lang": "Console", "source": "GET /books/_mapping\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_mapping(\n index=\"books\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getMapping({\n index: \"books\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_mapping(\n index: \"books\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getMapping([\n \"index\" => \"books\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/books/_mapping\"" } ] }, @@ -8912,6 +11592,26 @@ { "lang": "Console", "source": "PUT /my-index-000001/_mapping\n{\n \"properties\": {\n \"user\": {\n \"properties\": {\n \"name\": {\n \"type\": \"keyword\"\n }\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.put_mapping(\n index=\"my-index-000001\",\n properties={\n \"user\": {\n \"properties\": {\n \"name\": {\n \"type\": \"keyword\"\n }\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.putMapping({\n index: \"my-index-000001\",\n properties: {\n user: {\n properties: {\n name: {\n type: \"keyword\",\n },\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.put_mapping(\n index: \"my-index-000001\",\n body: {\n \"properties\": {\n \"user\": {\n \"properties\": {\n \"name\": {\n \"type\": \"keyword\"\n }\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->putMapping([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"properties\" => [\n \"user\" => [\n \"properties\" => [\n \"name\" => [\n \"type\" => \"keyword\",\n ],\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"properties\":{\"user\":{\"properties\":{\"name\":{\"type\":\"keyword\"}}}}}' \"$ELASTICSEARCH_URL/my-index-000001/_mapping\"" } ] }, @@ -8960,6 +11660,26 @@ { "lang": "Console", "source": "PUT /my-index-000001/_mapping\n{\n \"properties\": {\n \"user\": {\n \"properties\": {\n \"name\": {\n \"type\": \"keyword\"\n }\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.put_mapping(\n index=\"my-index-000001\",\n properties={\n \"user\": {\n \"properties\": {\n \"name\": {\n \"type\": \"keyword\"\n }\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.putMapping({\n index: \"my-index-000001\",\n properties: {\n user: {\n properties: {\n name: {\n type: \"keyword\",\n },\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.put_mapping(\n index: \"my-index-000001\",\n body: {\n \"properties\": {\n \"user\": {\n \"properties\": {\n \"name\": {\n \"type\": \"keyword\"\n }\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->putMapping([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"properties\" => [\n \"user\" => [\n \"properties\" => [\n \"name\" => [\n \"type\" => \"keyword\",\n ],\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"properties\":{\"user\":{\"properties\":{\"name\":{\"type\":\"keyword\"}}}}}' \"$ELASTICSEARCH_URL/my-index-000001/_mapping\"" } ] } @@ -9004,6 +11724,26 @@ { "lang": "Console", "source": "GET _all/_settings?expand_wildcards=all&filter_path=*.settings.index.*.slowlog\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_settings(\n index=\"_all\",\n expand_wildcards=\"all\",\n filter_path=\"*.settings.index.*.slowlog\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getSettings({\n index: \"_all\",\n expand_wildcards: \"all\",\n filter_path: \"*.settings.index.*.slowlog\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_settings(\n index: \"_all\",\n expand_wildcards: \"all\",\n filter_path: \"*.settings.index.*.slowlog\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getSettings([\n \"index\" => \"_all\",\n \"expand_wildcards\" => \"all\",\n \"filter_path\" => \"*.settings.index.*.slowlog\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_all/_settings?expand_wildcards=all&filter_path=*.settings.index.*.slowlog\"" } ] }, @@ -9055,6 +11795,26 @@ { "lang": "Console", "source": "PUT /my-index-000001/_settings\n{\n \"index\" : {\n \"number_of_replicas\" : 2\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.put_settings(\n index=\"my-index-000001\",\n settings={\n \"index\": {\n \"number_of_replicas\": 2\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.putSettings({\n index: \"my-index-000001\",\n settings: {\n index: {\n number_of_replicas: 2,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.put_settings(\n index: \"my-index-000001\",\n body: {\n \"index\": {\n \"number_of_replicas\": 2\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->putSettings([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"index\" => [\n \"number_of_replicas\" => 2,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index\":{\"number_of_replicas\":2}}' \"$ELASTICSEARCH_URL/my-index-000001/_settings\"" } ] } @@ -9102,6 +11862,26 @@ { "lang": "Console", "source": "GET _all/_settings?expand_wildcards=all&filter_path=*.settings.index.*.slowlog\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_settings(\n index=\"_all\",\n expand_wildcards=\"all\",\n filter_path=\"*.settings.index.*.slowlog\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getSettings({\n index: \"_all\",\n expand_wildcards: \"all\",\n filter_path: \"*.settings.index.*.slowlog\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_settings(\n index: \"_all\",\n expand_wildcards: \"all\",\n filter_path: \"*.settings.index.*.slowlog\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getSettings([\n \"index\" => \"_all\",\n \"expand_wildcards\" => \"all\",\n \"filter_path\" => \"*.settings.index.*.slowlog\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_all/_settings?expand_wildcards=all&filter_path=*.settings.index.*.slowlog\"" } ] }, @@ -9156,6 +11936,26 @@ { "lang": "Console", "source": "PUT /my-index-000001/_settings\n{\n \"index\" : {\n \"number_of_replicas\" : 2\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.put_settings(\n index=\"my-index-000001\",\n settings={\n \"index\": {\n \"number_of_replicas\": 2\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.putSettings({\n index: \"my-index-000001\",\n settings: {\n index: {\n number_of_replicas: 2,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.put_settings(\n index: \"my-index-000001\",\n body: {\n \"index\": {\n \"number_of_replicas\": 2\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->putSettings([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"index\" => [\n \"number_of_replicas\" => 2,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index\":{\"number_of_replicas\":2}}' \"$ELASTICSEARCH_URL/my-index-000001/_settings\"" } ] } @@ -9206,6 +12006,26 @@ { "lang": "Console", "source": "GET _all/_settings?expand_wildcards=all&filter_path=*.settings.index.*.slowlog\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_settings(\n index=\"_all\",\n expand_wildcards=\"all\",\n filter_path=\"*.settings.index.*.slowlog\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getSettings({\n index: \"_all\",\n expand_wildcards: \"all\",\n filter_path: \"*.settings.index.*.slowlog\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_settings(\n index: \"_all\",\n expand_wildcards: \"all\",\n filter_path: \"*.settings.index.*.slowlog\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getSettings([\n \"index\" => \"_all\",\n \"expand_wildcards\" => \"all\",\n \"filter_path\" => \"*.settings.index.*.slowlog\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_all/_settings?expand_wildcards=all&filter_path=*.settings.index.*.slowlog\"" } ] } @@ -9253,6 +12073,26 @@ { "lang": "Console", "source": "GET _all/_settings?expand_wildcards=all&filter_path=*.settings.index.*.slowlog\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.get_settings(\n index=\"_all\",\n expand_wildcards=\"all\",\n filter_path=\"*.settings.index.*.slowlog\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.getSettings({\n index: \"_all\",\n expand_wildcards: \"all\",\n filter_path: \"*.settings.index.*.slowlog\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.get_settings(\n index: \"_all\",\n expand_wildcards: \"all\",\n filter_path: \"*.settings.index.*.slowlog\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->getSettings([\n \"index\" => \"_all\",\n \"expand_wildcards\" => \"all\",\n \"filter_path\" => \"*.settings.index.*.slowlog\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_all/_settings?expand_wildcards=all&filter_path=*.settings.index.*.slowlog\"" } ] } @@ -9315,6 +12155,26 @@ { "lang": "Console", "source": "POST _data_stream/_migrate/my-time-series-data\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.migrate_to_data_stream(\n name=\"my-time-series-data\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.migrateToDataStream({\n name: \"my-time-series-data\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.migrate_to_data_stream(\n name: \"my-time-series-data\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->migrateToDataStream([\n \"name\" => \"my-time-series-data\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/_migrate/my-time-series-data\"" } ] } @@ -9372,6 +12232,26 @@ { "lang": "Console", "source": "POST _data_stream/_modify\n{\n \"actions\": [\n {\n \"remove_backing_index\": {\n \"data_stream\": \"my-data-stream\",\n \"index\": \".ds-my-data-stream-2023.07.26-000001\"\n }\n },\n {\n \"add_backing_index\": {\n \"data_stream\": \"my-data-stream\",\n \"index\": \".ds-my-data-stream-2023.07.26-000001-downsample\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.modify_data_stream(\n actions=[\n {\n \"remove_backing_index\": {\n \"data_stream\": \"my-data-stream\",\n \"index\": \".ds-my-data-stream-2023.07.26-000001\"\n }\n },\n {\n \"add_backing_index\": {\n \"data_stream\": \"my-data-stream\",\n \"index\": \".ds-my-data-stream-2023.07.26-000001-downsample\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.modifyDataStream({\n actions: [\n {\n remove_backing_index: {\n data_stream: \"my-data-stream\",\n index: \".ds-my-data-stream-2023.07.26-000001\",\n },\n },\n {\n add_backing_index: {\n data_stream: \"my-data-stream\",\n index: \".ds-my-data-stream-2023.07.26-000001-downsample\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.modify_data_stream(\n body: {\n \"actions\": [\n {\n \"remove_backing_index\": {\n \"data_stream\": \"my-data-stream\",\n \"index\": \".ds-my-data-stream-2023.07.26-000001\"\n }\n },\n {\n \"add_backing_index\": {\n \"data_stream\": \"my-data-stream\",\n \"index\": \".ds-my-data-stream-2023.07.26-000001-downsample\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->modifyDataStream([\n \"body\" => [\n \"actions\" => array(\n [\n \"remove_backing_index\" => [\n \"data_stream\" => \"my-data-stream\",\n \"index\" => \".ds-my-data-stream-2023.07.26-000001\",\n ],\n ],\n [\n \"add_backing_index\" => [\n \"data_stream\" => \"my-data-stream\",\n \"index\" => \".ds-my-data-stream-2023.07.26-000001-downsample\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"actions\":[{\"remove_backing_index\":{\"data_stream\":\"my-data-stream\",\"index\":\".ds-my-data-stream-2023.07.26-000001\"}},{\"add_backing_index\":{\"data_stream\":\"my-data-stream\",\"index\":\".ds-my-data-stream-2023.07.26-000001-downsample\"}}]}' \"$ELASTICSEARCH_URL/_data_stream/_modify\"" } ] } @@ -9404,6 +12284,26 @@ { "lang": "Console", "source": "GET _refresh\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.refresh()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.refresh();" + }, + { + "lang": "Ruby", + "source": "response = client.indices.refresh" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->refresh();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_refresh\"" } ] }, @@ -9434,6 +12334,26 @@ { "lang": "Console", "source": "GET _refresh\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.refresh()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.refresh();" + }, + { + "lang": "Ruby", + "source": "response = client.indices.refresh" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->refresh();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_refresh\"" } ] } @@ -9469,6 +12389,26 @@ { "lang": "Console", "source": "GET _refresh\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.refresh()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.refresh();" + }, + { + "lang": "Ruby", + "source": "response = client.indices.refresh" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->refresh();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_refresh\"" } ] }, @@ -9502,6 +12442,26 @@ { "lang": "Console", "source": "GET _refresh\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.refresh()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.refresh();" + }, + { + "lang": "Ruby", + "source": "response = client.indices.refresh" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->refresh();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_refresh\"" } ] } @@ -9605,6 +12565,26 @@ { "lang": "Console", "source": "GET /_resolve/index/f*,remoteCluster1:bar*?expand_wildcards=all\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.resolve_index(\n name=\"f*,remoteCluster1:bar*\",\n expand_wildcards=\"all\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.resolveIndex({\n name: \"f*,remoteCluster1:bar*\",\n expand_wildcards: \"all\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.resolve_index(\n name: \"f*,remoteCluster1:bar*\",\n expand_wildcards: \"all\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->resolveIndex([\n \"name\" => \"f*,remoteCluster1:bar*\",\n \"expand_wildcards\" => \"all\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_resolve/index/f*,remoteCluster1:bar*?expand_wildcards=all\"" } ] } @@ -9650,6 +12630,26 @@ { "lang": "Console", "source": "POST my-data-stream/_rollover\n{\n \"conditions\": {\n \"max_age\": \"7d\",\n \"max_docs\": 1000,\n \"max_primary_shard_size\": \"50gb\",\n \"max_primary_shard_docs\": \"2000\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.rollover(\n alias=\"my-data-stream\",\n conditions={\n \"max_age\": \"7d\",\n \"max_docs\": 1000,\n \"max_primary_shard_size\": \"50gb\",\n \"max_primary_shard_docs\": \"2000\"\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.rollover({\n alias: \"my-data-stream\",\n conditions: {\n max_age: \"7d\",\n max_docs: 1000,\n max_primary_shard_size: \"50gb\",\n max_primary_shard_docs: \"2000\",\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.rollover(\n alias: \"my-data-stream\",\n body: {\n \"conditions\": {\n \"max_age\": \"7d\",\n \"max_docs\": 1000,\n \"max_primary_shard_size\": \"50gb\",\n \"max_primary_shard_docs\": \"2000\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->rollover([\n \"alias\" => \"my-data-stream\",\n \"body\" => [\n \"conditions\" => [\n \"max_age\" => \"7d\",\n \"max_docs\" => 1000,\n \"max_primary_shard_size\" => \"50gb\",\n \"max_primary_shard_docs\" => \"2000\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"conditions\":{\"max_age\":\"7d\",\"max_docs\":1000,\"max_primary_shard_size\":\"50gb\",\"max_primary_shard_docs\":\"2000\"}}' \"$ELASTICSEARCH_URL/my-data-stream/_rollover\"" } ] } @@ -9698,6 +12698,26 @@ { "lang": "Console", "source": "POST my-data-stream/_rollover\n{\n \"conditions\": {\n \"max_age\": \"7d\",\n \"max_docs\": 1000,\n \"max_primary_shard_size\": \"50gb\",\n \"max_primary_shard_docs\": \"2000\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.rollover(\n alias=\"my-data-stream\",\n conditions={\n \"max_age\": \"7d\",\n \"max_docs\": 1000,\n \"max_primary_shard_size\": \"50gb\",\n \"max_primary_shard_docs\": \"2000\"\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.rollover({\n alias: \"my-data-stream\",\n conditions: {\n max_age: \"7d\",\n max_docs: 1000,\n max_primary_shard_size: \"50gb\",\n max_primary_shard_docs: \"2000\",\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.rollover(\n alias: \"my-data-stream\",\n body: {\n \"conditions\": {\n \"max_age\": \"7d\",\n \"max_docs\": 1000,\n \"max_primary_shard_size\": \"50gb\",\n \"max_primary_shard_docs\": \"2000\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->rollover([\n \"alias\" => \"my-data-stream\",\n \"body\" => [\n \"conditions\" => [\n \"max_age\" => \"7d\",\n \"max_docs\" => 1000,\n \"max_primary_shard_size\" => \"50gb\",\n \"max_primary_shard_docs\" => \"2000\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"conditions\":{\"max_age\":\"7d\",\"max_docs\":1000,\"max_primary_shard_size\":\"50gb\",\"max_primary_shard_docs\":\"2000\"}}' \"$ELASTICSEARCH_URL/my-data-stream/_rollover\"" } ] } @@ -9800,6 +12820,26 @@ { "lang": "Console", "source": "POST /_index_template/_simulate_index/my-index-000001\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.simulate_index_template(\n name=\"my-index-000001\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.simulateIndexTemplate({\n name: \"my-index-000001\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.simulate_index_template(\n name: \"my-index-000001\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->simulateIndexTemplate([\n \"name\" => \"my-index-000001\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_index_template/_simulate_index/my-index-000001\"" } ] } @@ -9838,6 +12878,26 @@ { "lang": "Console", "source": "POST /_index_template/_simulate\n{\n \"index_patterns\": [\"my-index-*\"],\n \"composed_of\": [\"ct2\"],\n \"priority\": 10,\n \"template\": {\n \"settings\": {\n \"index.number_of_replicas\": 1\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.simulate_template(\n index_patterns=[\n \"my-index-*\"\n ],\n composed_of=[\n \"ct2\"\n ],\n priority=10,\n template={\n \"settings\": {\n \"index.number_of_replicas\": 1\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.simulateTemplate({\n index_patterns: [\"my-index-*\"],\n composed_of: [\"ct2\"],\n priority: 10,\n template: {\n settings: {\n \"index.number_of_replicas\": 1,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.simulate_template(\n body: {\n \"index_patterns\": [\n \"my-index-*\"\n ],\n \"composed_of\": [\n \"ct2\"\n ],\n \"priority\": 10,\n \"template\": {\n \"settings\": {\n \"index.number_of_replicas\": 1\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->simulateTemplate([\n \"body\" => [\n \"index_patterns\" => array(\n \"my-index-*\",\n ),\n \"composed_of\" => array(\n \"ct2\",\n ),\n \"priority\" => 10,\n \"template\" => [\n \"settings\" => [\n \"index.number_of_replicas\" => 1,\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_patterns\":[\"my-index-*\"],\"composed_of\":[\"ct2\"],\"priority\":10,\"template\":{\"settings\":{\"index.number_of_replicas\":1}}}' \"$ELASTICSEARCH_URL/_index_template/_simulate\"" } ] } @@ -9879,6 +12939,26 @@ { "lang": "Console", "source": "POST /_index_template/_simulate\n{\n \"index_patterns\": [\"my-index-*\"],\n \"composed_of\": [\"ct2\"],\n \"priority\": 10,\n \"template\": {\n \"settings\": {\n \"index.number_of_replicas\": 1\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.simulate_template(\n index_patterns=[\n \"my-index-*\"\n ],\n composed_of=[\n \"ct2\"\n ],\n priority=10,\n template={\n \"settings\": {\n \"index.number_of_replicas\": 1\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.simulateTemplate({\n index_patterns: [\"my-index-*\"],\n composed_of: [\"ct2\"],\n priority: 10,\n template: {\n settings: {\n \"index.number_of_replicas\": 1,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.simulate_template(\n body: {\n \"index_patterns\": [\n \"my-index-*\"\n ],\n \"composed_of\": [\n \"ct2\"\n ],\n \"priority\": 10,\n \"template\": {\n \"settings\": {\n \"index.number_of_replicas\": 1\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->simulateTemplate([\n \"body\" => [\n \"index_patterns\" => array(\n \"my-index-*\",\n ),\n \"composed_of\" => array(\n \"ct2\",\n ),\n \"priority\" => 10,\n \"template\" => [\n \"settings\" => [\n \"index.number_of_replicas\" => 1,\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_patterns\":[\"my-index-*\"],\"composed_of\":[\"ct2\"],\"priority\":10,\"template\":{\"settings\":{\"index.number_of_replicas\":1}}}' \"$ELASTICSEARCH_URL/_index_template/_simulate\"" } ] } @@ -9955,6 +13035,26 @@ { "lang": "Console", "source": "POST _aliases\n{\n \"actions\": [\n {\n \"add\": {\n \"index\": \"logs-nginx.access-prod\",\n \"alias\": \"logs\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.indices.update_aliases(\n actions=[\n {\n \"add\": {\n \"index\": \"logs-nginx.access-prod\",\n \"alias\": \"logs\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.updateAliases({\n actions: [\n {\n add: {\n index: \"logs-nginx.access-prod\",\n alias: \"logs\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.update_aliases(\n body: {\n \"actions\": [\n {\n \"add\": {\n \"index\": \"logs-nginx.access-prod\",\n \"alias\": \"logs\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->updateAliases([\n \"body\" => [\n \"actions\" => array(\n [\n \"add\" => [\n \"index\" => \"logs-nginx.access-prod\",\n \"alias\" => \"logs\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"actions\":[{\"add\":{\"index\":\"logs-nginx.access-prod\",\"alias\":\"logs\"}}]}' \"$ELASTICSEARCH_URL/_aliases\"" } ] } @@ -10018,6 +13118,26 @@ { "lang": "Console", "source": "GET my-index-000001/_validate/query?q=user.id:kimchy\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.validate_query(\n index=\"my-index-000001\",\n q=\"user.id:kimchy\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.validateQuery({\n index: \"my-index-000001\",\n q: \"user.id:kimchy\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.validate_query(\n index: \"my-index-000001\",\n q: \"user.id:kimchy\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->validateQuery([\n \"index\" => \"my-index-000001\",\n \"q\" => \"user.id:kimchy\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_validate/query?q=user.id:kimchy\"" } ] }, @@ -10079,6 +13199,26 @@ { "lang": "Console", "source": "GET my-index-000001/_validate/query?q=user.id:kimchy\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.validate_query(\n index=\"my-index-000001\",\n q=\"user.id:kimchy\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.validateQuery({\n index: \"my-index-000001\",\n q: \"user.id:kimchy\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.validate_query(\n index: \"my-index-000001\",\n q: \"user.id:kimchy\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->validateQuery([\n \"index\" => \"my-index-000001\",\n \"q\" => \"user.id:kimchy\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_validate/query?q=user.id:kimchy\"" } ] } @@ -10145,6 +13285,26 @@ { "lang": "Console", "source": "GET my-index-000001/_validate/query?q=user.id:kimchy\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.validate_query(\n index=\"my-index-000001\",\n q=\"user.id:kimchy\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.validateQuery({\n index: \"my-index-000001\",\n q: \"user.id:kimchy\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.validate_query(\n index: \"my-index-000001\",\n q: \"user.id:kimchy\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->validateQuery([\n \"index\" => \"my-index-000001\",\n \"q\" => \"user.id:kimchy\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_validate/query?q=user.id:kimchy\"" } ] }, @@ -10209,6 +13369,26 @@ { "lang": "Console", "source": "GET my-index-000001/_validate/query?q=user.id:kimchy\n" + }, + { + "lang": "Python", + "source": "resp = client.indices.validate_query(\n index=\"my-index-000001\",\n q=\"user.id:kimchy\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.indices.validateQuery({\n index: \"my-index-000001\",\n q: \"user.id:kimchy\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.indices.validate_query(\n index: \"my-index-000001\",\n q: \"user.id:kimchy\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->indices()->validateQuery([\n \"index\" => \"my-index-000001\",\n \"q\" => \"user.id:kimchy\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_validate/query?q=user.id:kimchy\"" } ] } @@ -10258,12 +13438,12 @@ }, "PostChatCompletionRequestExample2": { "summary": "A chat completion task with tool_calls", - "description": "Run `POST POST _inference/chat_completion/openai-completion/_stream` to perform a chat completion using an Assistant message with `tool_calls`.", + "description": "Run `POST _inference/chat_completion/openai-completion/_stream` to perform a chat completion using an Assistant message with `tool_calls`.", "value": "{\n \"messages\": [\n {\n \"role\": \"assistant\",\n \"content\": \"Let's find out what the weather is\",\n \"tool_calls\": [ \n {\n \"id\": \"call_KcAjWtAww20AihPHphUh46Gd\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"arguments\": \"{\\\"location\\\":\\\"Boston, MA\\\"}\"\n }\n }\n ]\n },\n { \n \"role\": \"tool\",\n \"content\": \"The weather is cold\",\n \"tool_call_id\": \"call_KcAjWtAww20AihPHphUh46Gd\"\n }\n ]\n}" }, "PostChatCompletionRequestExample3": { "summary": "A chat completion task with tools and tool_calls", - "description": "Run `POST POST _inference/chat_completion/openai-completion/_stream` to perform a chat completion using a User message with `tools` and `tool_choice`.", + "description": "Run `POST _inference/chat_completion/openai-completion/_stream` to perform a chat completion using a User message with `tools` and `tool_choice`.", "value": "{\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"What's the price of a scarf?\"\n }\n ]\n }\n ],\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_price\",\n \"description\": \"Get the current price of a item\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"item\": {\n \"id\": \"123\"\n }\n }\n }\n }\n }\n ],\n \"tool_choice\": {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_price\"\n }\n }\n}" } } @@ -10294,6 +13474,26 @@ { "lang": "Console", "source": "POST _inference/chat_completion/openai-completion/_stream\n{\n \"model\": \"gpt-4o\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is Elastic?\"\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.chat_completion_unified(\n inference_id=\"openai-completion\",\n chat_completion_request={\n \"model\": \"gpt-4o\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is Elastic?\"\n }\n ]\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.chatCompletionUnified({\n inference_id: \"openai-completion\",\n chat_completion_request: {\n model: \"gpt-4o\",\n messages: [\n {\n role: \"user\",\n content: \"What is Elastic?\",\n },\n ],\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.chat_completion_unified(\n inference_id: \"openai-completion\",\n body: {\n \"model\": \"gpt-4o\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is Elastic?\"\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->chatCompletionUnified([\n \"inference_id\" => \"openai-completion\",\n \"body\" => [\n \"model\" => \"gpt-4o\",\n \"messages\" => array(\n [\n \"role\" => \"user\",\n \"content\" => \"What is Elastic?\",\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"model\":\"gpt-4o\",\"messages\":[{\"role\":\"user\",\"content\":\"What is Elastic?\"}]}' \"$ELASTICSEARCH_URL/_inference/chat_completion/openai-completion/_stream\"" } ] } @@ -10390,6 +13590,26 @@ { "lang": "Console", "source": "POST _inference/completion/openai_chat_completions\n{\n \"input\": \"What is Elastic?\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.completion(\n inference_id=\"openai_chat_completions\",\n input=\"What is Elastic?\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.completion({\n inference_id: \"openai_chat_completions\",\n input: \"What is Elastic?\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.completion(\n inference_id: \"openai_chat_completions\",\n body: {\n \"input\": \"What is Elastic?\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->completion([\n \"inference_id\" => \"openai_chat_completions\",\n \"body\" => [\n \"input\" => \"What is Elastic?\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"input\":\"What is Elastic?\"}' \"$ELASTICSEARCH_URL/_inference/completion/openai_chat_completions\"" } ] } @@ -10416,6 +13636,26 @@ { "lang": "Console", "source": "GET _inference/sparse_embedding/my-elser-model\n" + }, + { + "lang": "Python", + "source": "resp = client.inference.get(\n task_type=\"sparse_embedding\",\n inference_id=\"my-elser-model\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.get({\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.get(\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->get([\n \"task_type\" => \"sparse_embedding\",\n \"inference_id\" => \"my-elser-model\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"" } ] }, @@ -10444,6 +13684,26 @@ { "lang": "Console", "source": "PUT _inference/rerank/my-rerank-model\n{\n \"service\": \"cohere\",\n \"service_settings\": {\n \"model_id\": \"rerank-english-v3.0\",\n \"api_key\": \"{{COHERE_API_KEY}}\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"rerank\",\n inference_id=\"my-rerank-model\",\n inference_config={\n \"service\": \"cohere\",\n \"service_settings\": {\n \"model_id\": \"rerank-english-v3.0\",\n \"api_key\": \"{{COHERE_API_KEY}}\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"rerank\",\n inference_id: \"my-rerank-model\",\n inference_config: {\n service: \"cohere\",\n service_settings: {\n model_id: \"rerank-english-v3.0\",\n api_key: \"{{COHERE_API_KEY}}\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"rerank\",\n inference_id: \"my-rerank-model\",\n body: {\n \"service\": \"cohere\",\n \"service_settings\": {\n \"model_id\": \"rerank-english-v3.0\",\n \"api_key\": \"{{COHERE_API_KEY}}\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"rerank\",\n \"inference_id\" => \"my-rerank-model\",\n \"body\" => [\n \"service\" => \"cohere\",\n \"service_settings\" => [\n \"model_id\" => \"rerank-english-v3.0\",\n \"api_key\" => \"{{COHERE_API_KEY}}\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"cohere\",\"service_settings\":{\"model_id\":\"rerank-english-v3.0\",\"api_key\":\"{{COHERE_API_KEY}}\"}}' \"$ELASTICSEARCH_URL/_inference/rerank/my-rerank-model\"" } ] }, @@ -10499,6 +13759,26 @@ { "lang": "Console", "source": "DELETE /_inference/sparse_embedding/my-elser-model\n" + }, + { + "lang": "Python", + "source": "resp = client.inference.delete(\n task_type=\"sparse_embedding\",\n inference_id=\"my-elser-model\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.delete({\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.delete(\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->delete([\n \"task_type\" => \"sparse_embedding\",\n \"inference_id\" => \"my-elser-model\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"" } ] } @@ -10528,6 +13808,26 @@ { "lang": "Console", "source": "GET _inference/sparse_embedding/my-elser-model\n" + }, + { + "lang": "Python", + "source": "resp = client.inference.get(\n task_type=\"sparse_embedding\",\n inference_id=\"my-elser-model\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.get({\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.get(\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->get([\n \"task_type\" => \"sparse_embedding\",\n \"inference_id\" => \"my-elser-model\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"" } ] }, @@ -10559,6 +13859,26 @@ { "lang": "Console", "source": "PUT _inference/rerank/my-rerank-model\n{\n \"service\": \"cohere\",\n \"service_settings\": {\n \"model_id\": \"rerank-english-v3.0\",\n \"api_key\": \"{{COHERE_API_KEY}}\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"rerank\",\n inference_id=\"my-rerank-model\",\n inference_config={\n \"service\": \"cohere\",\n \"service_settings\": {\n \"model_id\": \"rerank-english-v3.0\",\n \"api_key\": \"{{COHERE_API_KEY}}\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"rerank\",\n inference_id: \"my-rerank-model\",\n inference_config: {\n service: \"cohere\",\n service_settings: {\n model_id: \"rerank-english-v3.0\",\n api_key: \"{{COHERE_API_KEY}}\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"rerank\",\n inference_id: \"my-rerank-model\",\n body: {\n \"service\": \"cohere\",\n \"service_settings\": {\n \"model_id\": \"rerank-english-v3.0\",\n \"api_key\": \"{{COHERE_API_KEY}}\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"rerank\",\n \"inference_id\" => \"my-rerank-model\",\n \"body\" => [\n \"service\" => \"cohere\",\n \"service_settings\" => [\n \"model_id\" => \"rerank-english-v3.0\",\n \"api_key\" => \"{{COHERE_API_KEY}}\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"cohere\",\"service_settings\":{\"model_id\":\"rerank-english-v3.0\",\"api_key\":\"{{COHERE_API_KEY}}\"}}' \"$ELASTICSEARCH_URL/_inference/rerank/my-rerank-model\"" } ] }, @@ -10620,6 +13940,26 @@ { "lang": "Console", "source": "DELETE /_inference/sparse_embedding/my-elser-model\n" + }, + { + "lang": "Python", + "source": "resp = client.inference.delete(\n task_type=\"sparse_embedding\",\n inference_id=\"my-elser-model\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.delete({\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.delete(\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->delete([\n \"task_type\" => \"sparse_embedding\",\n \"inference_id\" => \"my-elser-model\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"" } ] } @@ -10641,6 +13981,26 @@ { "lang": "Console", "source": "GET _inference/sparse_embedding/my-elser-model\n" + }, + { + "lang": "Python", + "source": "resp = client.inference.get(\n task_type=\"sparse_embedding\",\n inference_id=\"my-elser-model\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.get({\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.get(\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->get([\n \"task_type\" => \"sparse_embedding\",\n \"inference_id\" => \"my-elser-model\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"" } ] } @@ -10743,6 +14103,26 @@ { "lang": "Console", "source": "PUT _inference/completion/alibabacloud_ai_search_completion\n{\n \"service\": \"alibabacloud-ai-search\",\n \"service_settings\": {\n \"host\" : \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n \"api_key\": \"AlibabaCloud-API-Key\",\n \"service_id\": \"ops-qwen-turbo\",\n \"workspace\" : \"default\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"completion\",\n inference_id=\"alibabacloud_ai_search_completion\",\n inference_config={\n \"service\": \"alibabacloud-ai-search\",\n \"service_settings\": {\n \"host\": \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n \"api_key\": \"AlibabaCloud-API-Key\",\n \"service_id\": \"ops-qwen-turbo\",\n \"workspace\": \"default\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"completion\",\n inference_id: \"alibabacloud_ai_search_completion\",\n inference_config: {\n service: \"alibabacloud-ai-search\",\n service_settings: {\n host: \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n api_key: \"AlibabaCloud-API-Key\",\n service_id: \"ops-qwen-turbo\",\n workspace: \"default\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"completion\",\n inference_id: \"alibabacloud_ai_search_completion\",\n body: {\n \"service\": \"alibabacloud-ai-search\",\n \"service_settings\": {\n \"host\": \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n \"api_key\": \"AlibabaCloud-API-Key\",\n \"service_id\": \"ops-qwen-turbo\",\n \"workspace\": \"default\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"completion\",\n \"inference_id\" => \"alibabacloud_ai_search_completion\",\n \"body\" => [\n \"service\" => \"alibabacloud-ai-search\",\n \"service_settings\" => [\n \"host\" => \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n \"api_key\" => \"AlibabaCloud-API-Key\",\n \"service_id\" => \"ops-qwen-turbo\",\n \"workspace\" => \"default\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"alibabacloud-ai-search\",\"service_settings\":{\"host\":\"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\"api_key\":\"AlibabaCloud-API-Key\",\"service_id\":\"ops-qwen-turbo\",\"workspace\":\"default\"}}' \"$ELASTICSEARCH_URL/_inference/completion/alibabacloud_ai_search_completion\"" } ] } @@ -10835,6 +14215,26 @@ { "lang": "Console", "source": "PUT _inference/text_embedding/amazon_bedrock_embeddings\n{\n \"service\": \"amazonbedrock\",\n \"service_settings\": {\n \"access_key\": \"AWS-access-key\",\n \"secret_key\": \"AWS-secret-key\",\n \"region\": \"us-east-1\",\n \"provider\": \"amazontitan\",\n \"model\": \"amazon.titan-embed-text-v2:0\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"amazon_bedrock_embeddings\",\n inference_config={\n \"service\": \"amazonbedrock\",\n \"service_settings\": {\n \"access_key\": \"AWS-access-key\",\n \"secret_key\": \"AWS-secret-key\",\n \"region\": \"us-east-1\",\n \"provider\": \"amazontitan\",\n \"model\": \"amazon.titan-embed-text-v2:0\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"amazon_bedrock_embeddings\",\n inference_config: {\n service: \"amazonbedrock\",\n service_settings: {\n access_key: \"AWS-access-key\",\n secret_key: \"AWS-secret-key\",\n region: \"us-east-1\",\n provider: \"amazontitan\",\n model: \"amazon.titan-embed-text-v2:0\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"amazon_bedrock_embeddings\",\n body: {\n \"service\": \"amazonbedrock\",\n \"service_settings\": {\n \"access_key\": \"AWS-access-key\",\n \"secret_key\": \"AWS-secret-key\",\n \"region\": \"us-east-1\",\n \"provider\": \"amazontitan\",\n \"model\": \"amazon.titan-embed-text-v2:0\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"amazon_bedrock_embeddings\",\n \"body\" => [\n \"service\" => \"amazonbedrock\",\n \"service_settings\" => [\n \"access_key\" => \"AWS-access-key\",\n \"secret_key\" => \"AWS-secret-key\",\n \"region\" => \"us-east-1\",\n \"provider\" => \"amazontitan\",\n \"model\" => \"amazon.titan-embed-text-v2:0\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"amazonbedrock\",\"service_settings\":{\"access_key\":\"AWS-access-key\",\"secret_key\":\"AWS-secret-key\",\"region\":\"us-east-1\",\"provider\":\"amazontitan\",\"model\":\"amazon.titan-embed-text-v2:0\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/amazon_bedrock_embeddings\"" } ] } @@ -10921,6 +14321,26 @@ { "lang": "Console", "source": "PUT _inference/completion/anthropic_completion\n{\n \"service\": \"anthropic\",\n \"service_settings\": {\n \"api_key\": \"Anthropic-Api-Key\",\n \"model_id\": \"Model-ID\"\n },\n \"task_settings\": {\n \"max_tokens\": 1024\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"completion\",\n inference_id=\"anthropic_completion\",\n inference_config={\n \"service\": \"anthropic\",\n \"service_settings\": {\n \"api_key\": \"Anthropic-Api-Key\",\n \"model_id\": \"Model-ID\"\n },\n \"task_settings\": {\n \"max_tokens\": 1024\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"completion\",\n inference_id: \"anthropic_completion\",\n inference_config: {\n service: \"anthropic\",\n service_settings: {\n api_key: \"Anthropic-Api-Key\",\n model_id: \"Model-ID\",\n },\n task_settings: {\n max_tokens: 1024,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"completion\",\n inference_id: \"anthropic_completion\",\n body: {\n \"service\": \"anthropic\",\n \"service_settings\": {\n \"api_key\": \"Anthropic-Api-Key\",\n \"model_id\": \"Model-ID\"\n },\n \"task_settings\": {\n \"max_tokens\": 1024\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"completion\",\n \"inference_id\" => \"anthropic_completion\",\n \"body\" => [\n \"service\" => \"anthropic\",\n \"service_settings\" => [\n \"api_key\" => \"Anthropic-Api-Key\",\n \"model_id\" => \"Model-ID\",\n ],\n \"task_settings\" => [\n \"max_tokens\" => 1024,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"anthropic\",\"service_settings\":{\"api_key\":\"Anthropic-Api-Key\",\"model_id\":\"Model-ID\"},\"task_settings\":{\"max_tokens\":1024}}' \"$ELASTICSEARCH_URL/_inference/completion/anthropic_completion\"" } ] } @@ -11013,6 +14433,26 @@ { "lang": "Console", "source": "PUT _inference/text_embedding/azure_ai_studio_embeddings\n{\n \"service\": \"azureaistudio\",\n \"service_settings\": {\n \"api_key\": \"Azure-AI-Studio-API-key\",\n \"target\": \"Target-Uri\",\n \"provider\": \"openai\",\n \"endpoint_type\": \"token\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"azure_ai_studio_embeddings\",\n inference_config={\n \"service\": \"azureaistudio\",\n \"service_settings\": {\n \"api_key\": \"Azure-AI-Studio-API-key\",\n \"target\": \"Target-Uri\",\n \"provider\": \"openai\",\n \"endpoint_type\": \"token\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"azure_ai_studio_embeddings\",\n inference_config: {\n service: \"azureaistudio\",\n service_settings: {\n api_key: \"Azure-AI-Studio-API-key\",\n target: \"Target-Uri\",\n provider: \"openai\",\n endpoint_type: \"token\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"azure_ai_studio_embeddings\",\n body: {\n \"service\": \"azureaistudio\",\n \"service_settings\": {\n \"api_key\": \"Azure-AI-Studio-API-key\",\n \"target\": \"Target-Uri\",\n \"provider\": \"openai\",\n \"endpoint_type\": \"token\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"azure_ai_studio_embeddings\",\n \"body\" => [\n \"service\" => \"azureaistudio\",\n \"service_settings\" => [\n \"api_key\" => \"Azure-AI-Studio-API-key\",\n \"target\" => \"Target-Uri\",\n \"provider\" => \"openai\",\n \"endpoint_type\" => \"token\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"azureaistudio\",\"service_settings\":{\"api_key\":\"Azure-AI-Studio-API-key\",\"target\":\"Target-Uri\",\"provider\":\"openai\",\"endpoint_type\":\"token\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/azure_ai_studio_embeddings\"" } ] } @@ -11105,6 +14545,26 @@ { "lang": "Console", "source": "PUT _inference/text_embedding/azure_openai_embeddings\n{\n \"service\": \"azureopenai\",\n \"service_settings\": {\n \"api_key\": \"Api-Key\",\n \"resource_name\": \"Resource-name\",\n \"deployment_id\": \"Deployment-id\",\n \"api_version\": \"2024-02-01\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"azure_openai_embeddings\",\n inference_config={\n \"service\": \"azureopenai\",\n \"service_settings\": {\n \"api_key\": \"Api-Key\",\n \"resource_name\": \"Resource-name\",\n \"deployment_id\": \"Deployment-id\",\n \"api_version\": \"2024-02-01\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"azure_openai_embeddings\",\n inference_config: {\n service: \"azureopenai\",\n service_settings: {\n api_key: \"Api-Key\",\n resource_name: \"Resource-name\",\n deployment_id: \"Deployment-id\",\n api_version: \"2024-02-01\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"azure_openai_embeddings\",\n body: {\n \"service\": \"azureopenai\",\n \"service_settings\": {\n \"api_key\": \"Api-Key\",\n \"resource_name\": \"Resource-name\",\n \"deployment_id\": \"Deployment-id\",\n \"api_version\": \"2024-02-01\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"azure_openai_embeddings\",\n \"body\" => [\n \"service\" => \"azureopenai\",\n \"service_settings\" => [\n \"api_key\" => \"Api-Key\",\n \"resource_name\" => \"Resource-name\",\n \"deployment_id\" => \"Deployment-id\",\n \"api_version\" => \"2024-02-01\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"azureopenai\",\"service_settings\":{\"api_key\":\"Api-Key\",\"resource_name\":\"Resource-name\",\"deployment_id\":\"Deployment-id\",\"api_version\":\"2024-02-01\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/azure_openai_embeddings\"" } ] } @@ -11197,6 +14657,26 @@ { "lang": "Console", "source": "PUT _inference/text_embedding/cohere-embeddings\n{\n \"service\": \"cohere\",\n \"service_settings\": {\n \"api_key\": \"Cohere-Api-key\",\n \"model_id\": \"embed-english-light-v3.0\",\n \"embedding_type\": \"byte\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"cohere-embeddings\",\n inference_config={\n \"service\": \"cohere\",\n \"service_settings\": {\n \"api_key\": \"Cohere-Api-key\",\n \"model_id\": \"embed-english-light-v3.0\",\n \"embedding_type\": \"byte\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"cohere-embeddings\",\n inference_config: {\n service: \"cohere\",\n service_settings: {\n api_key: \"Cohere-Api-key\",\n model_id: \"embed-english-light-v3.0\",\n embedding_type: \"byte\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"cohere-embeddings\",\n body: {\n \"service\": \"cohere\",\n \"service_settings\": {\n \"api_key\": \"Cohere-Api-key\",\n \"model_id\": \"embed-english-light-v3.0\",\n \"embedding_type\": \"byte\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"cohere-embeddings\",\n \"body\" => [\n \"service\" => \"cohere\",\n \"service_settings\" => [\n \"api_key\" => \"Cohere-Api-key\",\n \"model_id\" => \"embed-english-light-v3.0\",\n \"embedding_type\" => \"byte\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"cohere\",\"service_settings\":{\"api_key\":\"Cohere-Api-key\",\"model_id\":\"embed-english-light-v3.0\",\"embedding_type\":\"byte\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/cohere-embeddings\"" } ] } @@ -11315,6 +14795,26 @@ { "lang": "Console", "source": "PUT _inference/sparse_embedding/my-elser-model\n{\n \"service\": \"elasticsearch\",\n \"service_settings\": {\n \"adaptive_allocations\": { \n \"enabled\": true,\n \"min_number_of_allocations\": 1,\n \"max_number_of_allocations\": 4\n },\n \"num_threads\": 1,\n \"model_id\": \".elser_model_2\" \n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"sparse_embedding\",\n inference_id=\"my-elser-model\",\n inference_config={\n \"service\": \"elasticsearch\",\n \"service_settings\": {\n \"adaptive_allocations\": {\n \"enabled\": True,\n \"min_number_of_allocations\": 1,\n \"max_number_of_allocations\": 4\n },\n \"num_threads\": 1,\n \"model_id\": \".elser_model_2\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n inference_config: {\n service: \"elasticsearch\",\n service_settings: {\n adaptive_allocations: {\n enabled: true,\n min_number_of_allocations: 1,\n max_number_of_allocations: 4,\n },\n num_threads: 1,\n model_id: \".elser_model_2\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n body: {\n \"service\": \"elasticsearch\",\n \"service_settings\": {\n \"adaptive_allocations\": {\n \"enabled\": true,\n \"min_number_of_allocations\": 1,\n \"max_number_of_allocations\": 4\n },\n \"num_threads\": 1,\n \"model_id\": \".elser_model_2\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"sparse_embedding\",\n \"inference_id\" => \"my-elser-model\",\n \"body\" => [\n \"service\" => \"elasticsearch\",\n \"service_settings\" => [\n \"adaptive_allocations\" => [\n \"enabled\" => true,\n \"min_number_of_allocations\" => 1,\n \"max_number_of_allocations\" => 4,\n ],\n \"num_threads\" => 1,\n \"model_id\" => \".elser_model_2\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"elasticsearch\",\"service_settings\":{\"adaptive_allocations\":{\"enabled\":true,\"min_number_of_allocations\":1,\"max_number_of_allocations\":4},\"num_threads\":1,\"model_id\":\".elser_model_2\"}}' \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"" } ] } @@ -11411,6 +14911,26 @@ { "lang": "Console", "source": "PUT _inference/sparse_embedding/my-elser-model\n{\n \"service\": \"elser\",\n \"service_settings\": {\n \"num_allocations\": 1,\n \"num_threads\": 1\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"sparse_embedding\",\n inference_id=\"my-elser-model\",\n inference_config={\n \"service\": \"elser\",\n \"service_settings\": {\n \"num_allocations\": 1,\n \"num_threads\": 1\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n inference_config: {\n service: \"elser\",\n service_settings: {\n num_allocations: 1,\n num_threads: 1,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n body: {\n \"service\": \"elser\",\n \"service_settings\": {\n \"num_allocations\": 1,\n \"num_threads\": 1\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"sparse_embedding\",\n \"inference_id\" => \"my-elser-model\",\n \"body\" => [\n \"service\" => \"elser\",\n \"service_settings\" => [\n \"num_allocations\" => 1,\n \"num_threads\" => 1,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"elser\",\"service_settings\":{\"num_allocations\":1,\"num_threads\":1}}' \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"" } ] } @@ -11495,6 +15015,26 @@ { "lang": "Console", "source": "PUT _inference/completion/google_ai_studio_completion\n{\n \"service\": \"googleaistudio\",\n \"service_settings\": {\n \"api_key\": \"api-key\",\n \"model_id\": \"model-id\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"completion\",\n inference_id=\"google_ai_studio_completion\",\n inference_config={\n \"service\": \"googleaistudio\",\n \"service_settings\": {\n \"api_key\": \"api-key\",\n \"model_id\": \"model-id\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"completion\",\n inference_id: \"google_ai_studio_completion\",\n inference_config: {\n service: \"googleaistudio\",\n service_settings: {\n api_key: \"api-key\",\n model_id: \"model-id\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"completion\",\n inference_id: \"google_ai_studio_completion\",\n body: {\n \"service\": \"googleaistudio\",\n \"service_settings\": {\n \"api_key\": \"api-key\",\n \"model_id\": \"model-id\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"completion\",\n \"inference_id\" => \"google_ai_studio_completion\",\n \"body\" => [\n \"service\" => \"googleaistudio\",\n \"service_settings\" => [\n \"api_key\" => \"api-key\",\n \"model_id\" => \"model-id\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"googleaistudio\",\"service_settings\":{\"api_key\":\"api-key\",\"model_id\":\"model-id\"}}' \"$ELASTICSEARCH_URL/_inference/completion/google_ai_studio_completion\"" } ] } @@ -11587,6 +15127,26 @@ { "lang": "Console", "source": "PUT _inference/text_embedding/google_vertex_ai_embeddingss\n{\n \"service\": \"googlevertexai\",\n \"service_settings\": {\n \"service_account_json\": \"service-account-json\",\n \"model_id\": \"model-id\",\n \"location\": \"location\",\n \"project_id\": \"project-id\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"google_vertex_ai_embeddingss\",\n inference_config={\n \"service\": \"googlevertexai\",\n \"service_settings\": {\n \"service_account_json\": \"service-account-json\",\n \"model_id\": \"model-id\",\n \"location\": \"location\",\n \"project_id\": \"project-id\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"google_vertex_ai_embeddingss\",\n inference_config: {\n service: \"googlevertexai\",\n service_settings: {\n service_account_json: \"service-account-json\",\n model_id: \"model-id\",\n location: \"location\",\n project_id: \"project-id\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"google_vertex_ai_embeddingss\",\n body: {\n \"service\": \"googlevertexai\",\n \"service_settings\": {\n \"service_account_json\": \"service-account-json\",\n \"model_id\": \"model-id\",\n \"location\": \"location\",\n \"project_id\": \"project-id\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"google_vertex_ai_embeddingss\",\n \"body\" => [\n \"service\" => \"googlevertexai\",\n \"service_settings\" => [\n \"service_account_json\" => \"service-account-json\",\n \"model_id\" => \"model-id\",\n \"location\" => \"location\",\n \"project_id\" => \"project-id\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"googlevertexai\",\"service_settings\":{\"service_account_json\":\"service-account-json\",\"model_id\":\"model-id\",\"location\":\"location\",\"project_id\":\"project-id\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/google_vertex_ai_embeddingss\"" } ] } @@ -11671,6 +15231,26 @@ { "lang": "Console", "source": "PUT _inference/text_embedding/hugging-face-embeddings\n{\n \"service\": \"hugging_face\",\n \"service_settings\": {\n \"api_key\": \"hugging-face-access-token\", \n \"url\": \"url-endpoint\" \n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"hugging-face-embeddings\",\n inference_config={\n \"service\": \"hugging_face\",\n \"service_settings\": {\n \"api_key\": \"hugging-face-access-token\",\n \"url\": \"url-endpoint\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"hugging-face-embeddings\",\n inference_config: {\n service: \"hugging_face\",\n service_settings: {\n api_key: \"hugging-face-access-token\",\n url: \"url-endpoint\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"hugging-face-embeddings\",\n body: {\n \"service\": \"hugging_face\",\n \"service_settings\": {\n \"api_key\": \"hugging-face-access-token\",\n \"url\": \"url-endpoint\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"hugging-face-embeddings\",\n \"body\" => [\n \"service\" => \"hugging_face\",\n \"service_settings\" => [\n \"api_key\" => \"hugging-face-access-token\",\n \"url\" => \"url-endpoint\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"hugging_face\",\"service_settings\":{\"api_key\":\"hugging-face-access-token\",\"url\":\"url-endpoint\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/hugging-face-embeddings\"" } ] } @@ -11763,6 +15343,26 @@ { "lang": "Console", "source": "PUT _inference/text_embedding/jinaai-embeddings\n{\n \"service\": \"jinaai\",\n \"service_settings\": {\n \"model_id\": \"jina-embeddings-v3\",\n \"api_key\": \"JinaAi-Api-key\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"jinaai-embeddings\",\n inference_config={\n \"service\": \"jinaai\",\n \"service_settings\": {\n \"model_id\": \"jina-embeddings-v3\",\n \"api_key\": \"JinaAi-Api-key\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"jinaai-embeddings\",\n inference_config: {\n service: \"jinaai\",\n service_settings: {\n model_id: \"jina-embeddings-v3\",\n api_key: \"JinaAi-Api-key\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"jinaai-embeddings\",\n body: {\n \"service\": \"jinaai\",\n \"service_settings\": {\n \"model_id\": \"jina-embeddings-v3\",\n \"api_key\": \"JinaAi-Api-key\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"jinaai-embeddings\",\n \"body\" => [\n \"service\" => \"jinaai\",\n \"service_settings\" => [\n \"model_id\" => \"jina-embeddings-v3\",\n \"api_key\" => \"JinaAi-Api-key\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"jinaai\",\"service_settings\":{\"model_id\":\"jina-embeddings-v3\",\"api_key\":\"JinaAi-Api-key\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/jinaai-embeddings\"" } ] } @@ -11846,6 +15446,26 @@ { "lang": "Console", "source": "PUT _inference/text_embedding/mistral-embeddings-test\n{\n \"service\": \"mistral\",\n \"service_settings\": {\n \"api_key\": \"Mistral-API-Key\",\n \"model\": \"mistral-embed\" \n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"mistral-embeddings-test\",\n inference_config={\n \"service\": \"mistral\",\n \"service_settings\": {\n \"api_key\": \"Mistral-API-Key\",\n \"model\": \"mistral-embed\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"mistral-embeddings-test\",\n inference_config: {\n service: \"mistral\",\n service_settings: {\n api_key: \"Mistral-API-Key\",\n model: \"mistral-embed\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"mistral-embeddings-test\",\n body: {\n \"service\": \"mistral\",\n \"service_settings\": {\n \"api_key\": \"Mistral-API-Key\",\n \"model\": \"mistral-embed\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"mistral-embeddings-test\",\n \"body\" => [\n \"service\" => \"mistral\",\n \"service_settings\" => [\n \"api_key\" => \"Mistral-API-Key\",\n \"model\" => \"mistral-embed\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"mistral\",\"service_settings\":{\"api_key\":\"Mistral-API-Key\",\"model\":\"mistral-embed\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/mistral-embeddings-test\"" } ] } @@ -11938,6 +15558,26 @@ { "lang": "Console", "source": "PUT _inference/text_embedding/openai-embeddings\n{\n \"service\": \"openai\",\n \"service_settings\": {\n \"api_key\": \"OpenAI-API-Key\",\n \"model_id\": \"text-embedding-3-small\",\n \"dimensions\": 128\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"openai-embeddings\",\n inference_config={\n \"service\": \"openai\",\n \"service_settings\": {\n \"api_key\": \"OpenAI-API-Key\",\n \"model_id\": \"text-embedding-3-small\",\n \"dimensions\": 128\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"openai-embeddings\",\n inference_config: {\n service: \"openai\",\n service_settings: {\n api_key: \"OpenAI-API-Key\",\n model_id: \"text-embedding-3-small\",\n dimensions: 128,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"openai-embeddings\",\n body: {\n \"service\": \"openai\",\n \"service_settings\": {\n \"api_key\": \"OpenAI-API-Key\",\n \"model_id\": \"text-embedding-3-small\",\n \"dimensions\": 128\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"openai-embeddings\",\n \"body\" => [\n \"service\" => \"openai\",\n \"service_settings\" => [\n \"api_key\" => \"OpenAI-API-Key\",\n \"model_id\" => \"text-embedding-3-small\",\n \"dimensions\" => 128,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"openai\",\"service_settings\":{\"api_key\":\"OpenAI-API-Key\",\"model_id\":\"text-embedding-3-small\",\"dimensions\":128}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/openai-embeddings\"" } ] } @@ -12030,6 +15670,26 @@ { "lang": "Console", "source": "PUT _inference/text_embedding/openai-embeddings\n{\n \"service\": \"voyageai\",\n \"service_settings\": {\n \"model_id\": \"voyage-3-large\",\n \"dimensions\": 512\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"openai-embeddings\",\n inference_config={\n \"service\": \"voyageai\",\n \"service_settings\": {\n \"model_id\": \"voyage-3-large\",\n \"dimensions\": 512\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"openai-embeddings\",\n inference_config: {\n service: \"voyageai\",\n service_settings: {\n model_id: \"voyage-3-large\",\n dimensions: 512,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"openai-embeddings\",\n body: {\n \"service\": \"voyageai\",\n \"service_settings\": {\n \"model_id\": \"voyage-3-large\",\n \"dimensions\": 512\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"openai-embeddings\",\n \"body\" => [\n \"service\" => \"voyageai\",\n \"service_settings\" => [\n \"model_id\" => \"voyage-3-large\",\n \"dimensions\" => 512,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"voyageai\",\"service_settings\":{\"model_id\":\"voyage-3-large\",\"dimensions\":512}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/openai-embeddings\"" } ] } @@ -12110,6 +15770,26 @@ { "lang": "Console", "source": "PUT _inference/text_embedding/watsonx-embeddings\n{\n \"service\": \"watsonxai\",\n \"service_settings\": {\n \"api_key\": \"Watsonx-API-Key\", \n \"url\": \"Wastonx-URL\", \n \"model_id\": \"ibm/slate-30m-english-rtrvr\",\n \"project_id\": \"IBM-Cloud-ID\", \n \"api_version\": \"2024-03-14\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"watsonx-embeddings\",\n inference_config={\n \"service\": \"watsonxai\",\n \"service_settings\": {\n \"api_key\": \"Watsonx-API-Key\",\n \"url\": \"Wastonx-URL\",\n \"model_id\": \"ibm/slate-30m-english-rtrvr\",\n \"project_id\": \"IBM-Cloud-ID\",\n \"api_version\": \"2024-03-14\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"watsonx-embeddings\",\n inference_config: {\n service: \"watsonxai\",\n service_settings: {\n api_key: \"Watsonx-API-Key\",\n url: \"Wastonx-URL\",\n model_id: \"ibm/slate-30m-english-rtrvr\",\n project_id: \"IBM-Cloud-ID\",\n api_version: \"2024-03-14\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"watsonx-embeddings\",\n body: {\n \"service\": \"watsonxai\",\n \"service_settings\": {\n \"api_key\": \"Watsonx-API-Key\",\n \"url\": \"Wastonx-URL\",\n \"model_id\": \"ibm/slate-30m-english-rtrvr\",\n \"project_id\": \"IBM-Cloud-ID\",\n \"api_version\": \"2024-03-14\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"watsonx-embeddings\",\n \"body\" => [\n \"service\" => \"watsonxai\",\n \"service_settings\" => [\n \"api_key\" => \"Watsonx-API-Key\",\n \"url\" => \"Wastonx-URL\",\n \"model_id\" => \"ibm/slate-30m-english-rtrvr\",\n \"project_id\" => \"IBM-Cloud-ID\",\n \"api_version\" => \"2024-03-14\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"watsonxai\",\"service_settings\":{\"api_key\":\"Watsonx-API-Key\",\"url\":\"Wastonx-URL\",\"model_id\":\"ibm/slate-30m-english-rtrvr\",\"project_id\":\"IBM-Cloud-ID\",\"api_version\":\"2024-03-14\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/watsonx-embeddings\"" } ] } @@ -12212,6 +15892,26 @@ { "lang": "Console", "source": "POST _inference/rerank/cohere_rerank\n{\n \"input\": [\"luke\", \"like\", \"leia\", \"chewy\",\"r2d2\", \"star\", \"wars\"],\n \"query\": \"star wars main character\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.rerank(\n inference_id=\"cohere_rerank\",\n input=[\n \"luke\",\n \"like\",\n \"leia\",\n \"chewy\",\n \"r2d2\",\n \"star\",\n \"wars\"\n ],\n query=\"star wars main character\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.rerank({\n inference_id: \"cohere_rerank\",\n input: [\"luke\", \"like\", \"leia\", \"chewy\", \"r2d2\", \"star\", \"wars\"],\n query: \"star wars main character\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.rerank(\n inference_id: \"cohere_rerank\",\n body: {\n \"input\": [\n \"luke\",\n \"like\",\n \"leia\",\n \"chewy\",\n \"r2d2\",\n \"star\",\n \"wars\"\n ],\n \"query\": \"star wars main character\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->rerank([\n \"inference_id\" => \"cohere_rerank\",\n \"body\" => [\n \"input\" => array(\n \"luke\",\n \"like\",\n \"leia\",\n \"chewy\",\n \"r2d2\",\n \"star\",\n \"wars\",\n ),\n \"query\" => \"star wars main character\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"input\":[\"luke\",\"like\",\"leia\",\"chewy\",\"r2d2\",\"star\",\"wars\"],\"query\":\"star wars main character\"}' \"$ELASTICSEARCH_URL/_inference/rerank/cohere_rerank\"" } ] } @@ -12308,6 +16008,26 @@ { "lang": "Console", "source": "POST _inference/sparse_embedding/my-elser-model\n{\n \"input\": \"The sky above the port was the color of television tuned to a dead channel.\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.sparse_embedding(\n inference_id=\"my-elser-model\",\n input=\"The sky above the port was the color of television tuned to a dead channel.\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.sparseEmbedding({\n inference_id: \"my-elser-model\",\n input:\n \"The sky above the port was the color of television tuned to a dead channel.\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.sparse_embedding(\n inference_id: \"my-elser-model\",\n body: {\n \"input\": \"The sky above the port was the color of television tuned to a dead channel.\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->sparseEmbedding([\n \"inference_id\" => \"my-elser-model\",\n \"body\" => [\n \"input\" => \"The sky above the port was the color of television tuned to a dead channel.\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"input\":\"The sky above the port was the color of television tuned to a dead channel.\"}' \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"" } ] } @@ -12404,6 +16124,26 @@ { "lang": "Console", "source": "POST _inference/text_embedding/my-cohere-endpoint\n{\n \"input\": \"The sky above the port was the color of television tuned to a dead channel.\",\n \"task_settings\": {\n \"input_type\": \"ingest\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.inference.text_embedding(\n inference_id=\"my-cohere-endpoint\",\n input=\"The sky above the port was the color of television tuned to a dead channel.\",\n task_settings={\n \"input_type\": \"ingest\"\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.inference.textEmbedding({\n inference_id: \"my-cohere-endpoint\",\n input:\n \"The sky above the port was the color of television tuned to a dead channel.\",\n task_settings: {\n input_type: \"ingest\",\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.inference.text_embedding(\n inference_id: \"my-cohere-endpoint\",\n body: {\n \"input\": \"The sky above the port was the color of television tuned to a dead channel.\",\n \"task_settings\": {\n \"input_type\": \"ingest\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->inference()->textEmbedding([\n \"inference_id\" => \"my-cohere-endpoint\",\n \"body\" => [\n \"input\" => \"The sky above the port was the color of television tuned to a dead channel.\",\n \"task_settings\" => [\n \"input_type\" => \"ingest\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"input\":\"The sky above the port was the color of television tuned to a dead channel.\",\"task_settings\":{\"input_type\":\"ingest\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/my-cohere-endpoint\"" } ] } @@ -12462,6 +16202,26 @@ { "lang": "Console", "source": "GET /\n" + }, + { + "lang": "Python", + "source": "resp = client.info()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.info();" + }, + { + "lang": "Ruby", + "source": "response = client.info" + }, + { + "lang": "PHP", + "source": "$resp = $client->info();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/\"" } ] }, @@ -12514,6 +16274,26 @@ { "lang": "Console", "source": "GET /_ingest/pipeline/my-pipeline-id\n" + }, + { + "lang": "Python", + "source": "resp = client.ingest.get_pipeline(\n id=\"my-pipeline-id\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ingest.getPipeline({\n id: \"my-pipeline-id\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ingest.get_pipeline(\n id: \"my-pipeline-id\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ingest()->getPipeline([\n \"id\" => \"my-pipeline-id\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ingest/pipeline/my-pipeline-id\"" } ] }, @@ -12638,6 +16418,26 @@ { "lang": "Console", "source": "PUT _ingest/pipeline/my-pipeline-id\n{\n \"description\" : \"My optional pipeline description\",\n \"processors\" : [\n {\n \"set\" : {\n \"description\" : \"My optional processor description\",\n \"field\": \"my-keyword-field\",\n \"value\": \"foo\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.ingest.put_pipeline(\n id=\"my-pipeline-id\",\n description=\"My optional pipeline description\",\n processors=[\n {\n \"set\": {\n \"description\": \"My optional processor description\",\n \"field\": \"my-keyword-field\",\n \"value\": \"foo\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ingest.putPipeline({\n id: \"my-pipeline-id\",\n description: \"My optional pipeline description\",\n processors: [\n {\n set: {\n description: \"My optional processor description\",\n field: \"my-keyword-field\",\n value: \"foo\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ingest.put_pipeline(\n id: \"my-pipeline-id\",\n body: {\n \"description\": \"My optional pipeline description\",\n \"processors\": [\n {\n \"set\": {\n \"description\": \"My optional processor description\",\n \"field\": \"my-keyword-field\",\n \"value\": \"foo\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ingest()->putPipeline([\n \"id\" => \"my-pipeline-id\",\n \"body\" => [\n \"description\" => \"My optional pipeline description\",\n \"processors\" => array(\n [\n \"set\" => [\n \"description\" => \"My optional processor description\",\n \"field\" => \"my-keyword-field\",\n \"value\" => \"foo\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"My optional pipeline description\",\"processors\":[{\"set\":{\"description\":\"My optional processor description\",\"field\":\"my-keyword-field\",\"value\":\"foo\"}}]}' \"$ELASTICSEARCH_URL/_ingest/pipeline/my-pipeline-id\"" } ] }, @@ -12701,6 +16501,26 @@ { "lang": "Console", "source": "DELETE /_ingest/pipeline/my-pipeline-id\n" + }, + { + "lang": "Python", + "source": "resp = client.ingest.delete_pipeline(\n id=\"my-pipeline-id\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ingest.deletePipeline({\n id: \"my-pipeline-id\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ingest.delete_pipeline(\n id: \"my-pipeline-id\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ingest()->deletePipeline([\n \"id\" => \"my-pipeline-id\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ingest/pipeline/my-pipeline-id\"" } ] } @@ -12734,6 +16554,26 @@ { "lang": "Console", "source": "GET /_ingest/pipeline/my-pipeline-id\n" + }, + { + "lang": "Python", + "source": "resp = client.ingest.get_pipeline(\n id=\"my-pipeline-id\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ingest.getPipeline({\n id: \"my-pipeline-id\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ingest.get_pipeline(\n id: \"my-pipeline-id\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ingest()->getPipeline([\n \"id\" => \"my-pipeline-id\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ingest/pipeline/my-pipeline-id\"" } ] } @@ -12777,6 +16617,26 @@ { "lang": "Console", "source": "GET _ingest/processor/grok\n" + }, + { + "lang": "Python", + "source": "resp = client.ingest.processor_grok()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ingest.processorGrok();" + }, + { + "lang": "Ruby", + "source": "response = client.ingest.processor_grok" + }, + { + "lang": "PHP", + "source": "$resp = $client->ingest()->processorGrok();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ingest/processor/grok\"" } ] } @@ -12807,6 +16667,26 @@ { "lang": "Console", "source": "POST /_ingest/pipeline/_simulate\n{\n \"pipeline\" :\n {\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\" : {\n \"field\" : \"field2\",\n \"value\" : \"_value\"\n }\n }\n ]\n },\n \"docs\": [\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.ingest.simulate(\n pipeline={\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\": {\n \"field\": \"field2\",\n \"value\": \"_value\"\n }\n }\n ]\n },\n docs=[\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ingest.simulate({\n pipeline: {\n description: \"_description\",\n processors: [\n {\n set: {\n field: \"field2\",\n value: \"_value\",\n },\n },\n ],\n },\n docs: [\n {\n _index: \"index\",\n _id: \"id\",\n _source: {\n foo: \"bar\",\n },\n },\n {\n _index: \"index\",\n _id: \"id\",\n _source: {\n foo: \"rab\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ingest.simulate(\n body: {\n \"pipeline\": {\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\": {\n \"field\": \"field2\",\n \"value\": \"_value\"\n }\n }\n ]\n },\n \"docs\": [\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ingest()->simulate([\n \"body\" => [\n \"pipeline\" => [\n \"description\" => \"_description\",\n \"processors\" => array(\n [\n \"set\" => [\n \"field\" => \"field2\",\n \"value\" => \"_value\",\n ],\n ],\n ),\n ],\n \"docs\" => array(\n [\n \"_index\" => \"index\",\n \"_id\" => \"id\",\n \"_source\" => [\n \"foo\" => \"bar\",\n ],\n ],\n [\n \"_index\" => \"index\",\n \"_id\" => \"id\",\n \"_source\" => [\n \"foo\" => \"rab\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"pipeline\":{\"description\":\"_description\",\"processors\":[{\"set\":{\"field\":\"field2\",\"value\":\"_value\"}}]},\"docs\":[{\"_index\":\"index\",\"_id\":\"id\",\"_source\":{\"foo\":\"bar\"}},{\"_index\":\"index\",\"_id\":\"id\",\"_source\":{\"foo\":\"rab\"}}]}' \"$ELASTICSEARCH_URL/_ingest/pipeline/_simulate\"" } ] }, @@ -12835,6 +16715,26 @@ { "lang": "Console", "source": "POST /_ingest/pipeline/_simulate\n{\n \"pipeline\" :\n {\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\" : {\n \"field\" : \"field2\",\n \"value\" : \"_value\"\n }\n }\n ]\n },\n \"docs\": [\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.ingest.simulate(\n pipeline={\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\": {\n \"field\": \"field2\",\n \"value\": \"_value\"\n }\n }\n ]\n },\n docs=[\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ingest.simulate({\n pipeline: {\n description: \"_description\",\n processors: [\n {\n set: {\n field: \"field2\",\n value: \"_value\",\n },\n },\n ],\n },\n docs: [\n {\n _index: \"index\",\n _id: \"id\",\n _source: {\n foo: \"bar\",\n },\n },\n {\n _index: \"index\",\n _id: \"id\",\n _source: {\n foo: \"rab\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ingest.simulate(\n body: {\n \"pipeline\": {\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\": {\n \"field\": \"field2\",\n \"value\": \"_value\"\n }\n }\n ]\n },\n \"docs\": [\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ingest()->simulate([\n \"body\" => [\n \"pipeline\" => [\n \"description\" => \"_description\",\n \"processors\" => array(\n [\n \"set\" => [\n \"field\" => \"field2\",\n \"value\" => \"_value\",\n ],\n ],\n ),\n ],\n \"docs\" => array(\n [\n \"_index\" => \"index\",\n \"_id\" => \"id\",\n \"_source\" => [\n \"foo\" => \"bar\",\n ],\n ],\n [\n \"_index\" => \"index\",\n \"_id\" => \"id\",\n \"_source\" => [\n \"foo\" => \"rab\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"pipeline\":{\"description\":\"_description\",\"processors\":[{\"set\":{\"field\":\"field2\",\"value\":\"_value\"}}]},\"docs\":[{\"_index\":\"index\",\"_id\":\"id\",\"_source\":{\"foo\":\"bar\"}},{\"_index\":\"index\",\"_id\":\"id\",\"_source\":{\"foo\":\"rab\"}}]}' \"$ELASTICSEARCH_URL/_ingest/pipeline/_simulate\"" } ] } @@ -12868,6 +16768,26 @@ { "lang": "Console", "source": "POST /_ingest/pipeline/_simulate\n{\n \"pipeline\" :\n {\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\" : {\n \"field\" : \"field2\",\n \"value\" : \"_value\"\n }\n }\n ]\n },\n \"docs\": [\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.ingest.simulate(\n pipeline={\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\": {\n \"field\": \"field2\",\n \"value\": \"_value\"\n }\n }\n ]\n },\n docs=[\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ingest.simulate({\n pipeline: {\n description: \"_description\",\n processors: [\n {\n set: {\n field: \"field2\",\n value: \"_value\",\n },\n },\n ],\n },\n docs: [\n {\n _index: \"index\",\n _id: \"id\",\n _source: {\n foo: \"bar\",\n },\n },\n {\n _index: \"index\",\n _id: \"id\",\n _source: {\n foo: \"rab\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ingest.simulate(\n body: {\n \"pipeline\": {\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\": {\n \"field\": \"field2\",\n \"value\": \"_value\"\n }\n }\n ]\n },\n \"docs\": [\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ingest()->simulate([\n \"body\" => [\n \"pipeline\" => [\n \"description\" => \"_description\",\n \"processors\" => array(\n [\n \"set\" => [\n \"field\" => \"field2\",\n \"value\" => \"_value\",\n ],\n ],\n ),\n ],\n \"docs\" => array(\n [\n \"_index\" => \"index\",\n \"_id\" => \"id\",\n \"_source\" => [\n \"foo\" => \"bar\",\n ],\n ],\n [\n \"_index\" => \"index\",\n \"_id\" => \"id\",\n \"_source\" => [\n \"foo\" => \"rab\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"pipeline\":{\"description\":\"_description\",\"processors\":[{\"set\":{\"field\":\"field2\",\"value\":\"_value\"}}]},\"docs\":[{\"_index\":\"index\",\"_id\":\"id\",\"_source\":{\"foo\":\"bar\"}},{\"_index\":\"index\",\"_id\":\"id\",\"_source\":{\"foo\":\"rab\"}}]}' \"$ELASTICSEARCH_URL/_ingest/pipeline/_simulate\"" } ] }, @@ -12899,6 +16819,26 @@ { "lang": "Console", "source": "POST /_ingest/pipeline/_simulate\n{\n \"pipeline\" :\n {\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\" : {\n \"field\" : \"field2\",\n \"value\" : \"_value\"\n }\n }\n ]\n },\n \"docs\": [\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.ingest.simulate(\n pipeline={\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\": {\n \"field\": \"field2\",\n \"value\": \"_value\"\n }\n }\n ]\n },\n docs=[\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ingest.simulate({\n pipeline: {\n description: \"_description\",\n processors: [\n {\n set: {\n field: \"field2\",\n value: \"_value\",\n },\n },\n ],\n },\n docs: [\n {\n _index: \"index\",\n _id: \"id\",\n _source: {\n foo: \"bar\",\n },\n },\n {\n _index: \"index\",\n _id: \"id\",\n _source: {\n foo: \"rab\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ingest.simulate(\n body: {\n \"pipeline\": {\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\": {\n \"field\": \"field2\",\n \"value\": \"_value\"\n }\n }\n ]\n },\n \"docs\": [\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ingest()->simulate([\n \"body\" => [\n \"pipeline\" => [\n \"description\" => \"_description\",\n \"processors\" => array(\n [\n \"set\" => [\n \"field\" => \"field2\",\n \"value\" => \"_value\",\n ],\n ],\n ),\n ],\n \"docs\" => array(\n [\n \"_index\" => \"index\",\n \"_id\" => \"id\",\n \"_source\" => [\n \"foo\" => \"bar\",\n ],\n ],\n [\n \"_index\" => \"index\",\n \"_id\" => \"id\",\n \"_source\" => [\n \"foo\" => \"rab\",\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"pipeline\":{\"description\":\"_description\",\"processors\":[{\"set\":{\"field\":\"field2\",\"value\":\"_value\"}}]},\"docs\":[{\"_index\":\"index\",\"_id\":\"id\",\"_source\":{\"foo\":\"bar\"}},{\"_index\":\"index\",\"_id\":\"id\",\"_source\":{\"foo\":\"rab\"}}]}' \"$ELASTICSEARCH_URL/_ingest/pipeline/_simulate\"" } ] } @@ -12963,6 +16903,26 @@ { "lang": "Console", "source": "GET /_license\n" + }, + { + "lang": "Python", + "source": "resp = client.license.get()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.license.get();" + }, + { + "lang": "Ruby", + "source": "response = client.license.get" + }, + { + "lang": "PHP", + "source": "$resp = $client->license()->get();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_license\"" } ] } @@ -12993,6 +16953,26 @@ { "lang": "Console", "source": "GET _logstash/pipeline/my_pipeline\n" + }, + { + "lang": "Python", + "source": "resp = client.logstash.get_pipeline(\n id=\"my_pipeline\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.logstash.getPipeline({\n id: \"my_pipeline\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.logstash.get_pipeline(\n id: \"my_pipeline\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->logstash()->getPipeline([\n \"id\" => \"my_pipeline\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_logstash/pipeline/my_pipeline\"" } ] }, @@ -13049,6 +17029,26 @@ { "lang": "Console", "source": "PUT _logstash/pipeline/my_pipeline\n{\n \"description\": \"Sample pipeline for illustration purposes\",\n \"last_modified\": \"2021-01-02T02:50:51.250Z\",\n \"pipeline_metadata\": {\n \"type\": \"logstash_pipeline\",\n \"version\": 1\n },\n \"username\": \"elastic\",\n \"pipeline\": \"input {}\\\\n filter { grok {} }\\\\n output {}\",\n \"pipeline_settings\": {\n \"pipeline.workers\": 1,\n \"pipeline.batch.size\": 125,\n \"pipeline.batch.delay\": 50,\n \"queue.type\": \"memory\",\n \"queue.max_bytes\": \"1gb\",\n \"queue.checkpoint.writes\": 1024\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.logstash.put_pipeline(\n id=\"my_pipeline\",\n pipeline={\n \"description\": \"Sample pipeline for illustration purposes\",\n \"last_modified\": \"2021-01-02T02:50:51.250Z\",\n \"pipeline_metadata\": {\n \"type\": \"logstash_pipeline\",\n \"version\": 1\n },\n \"username\": \"elastic\",\n \"pipeline\": \"input {}\\\\n filter { grok {} }\\\\n output {}\",\n \"pipeline_settings\": {\n \"pipeline.workers\": 1,\n \"pipeline.batch.size\": 125,\n \"pipeline.batch.delay\": 50,\n \"queue.type\": \"memory\",\n \"queue.max_bytes\": \"1gb\",\n \"queue.checkpoint.writes\": 1024\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.logstash.putPipeline({\n id: \"my_pipeline\",\n pipeline: {\n description: \"Sample pipeline for illustration purposes\",\n last_modified: \"2021-01-02T02:50:51.250Z\",\n pipeline_metadata: {\n type: \"logstash_pipeline\",\n version: 1,\n },\n username: \"elastic\",\n pipeline: \"input {}\\\\n filter { grok {} }\\\\n output {}\",\n pipeline_settings: {\n \"pipeline.workers\": 1,\n \"pipeline.batch.size\": 125,\n \"pipeline.batch.delay\": 50,\n \"queue.type\": \"memory\",\n \"queue.max_bytes\": \"1gb\",\n \"queue.checkpoint.writes\": 1024,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.logstash.put_pipeline(\n id: \"my_pipeline\",\n body: {\n \"description\": \"Sample pipeline for illustration purposes\",\n \"last_modified\": \"2021-01-02T02:50:51.250Z\",\n \"pipeline_metadata\": {\n \"type\": \"logstash_pipeline\",\n \"version\": 1\n },\n \"username\": \"elastic\",\n \"pipeline\": \"input {}\\\\n filter { grok {} }\\\\n output {}\",\n \"pipeline_settings\": {\n \"pipeline.workers\": 1,\n \"pipeline.batch.size\": 125,\n \"pipeline.batch.delay\": 50,\n \"queue.type\": \"memory\",\n \"queue.max_bytes\": \"1gb\",\n \"queue.checkpoint.writes\": 1024\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->logstash()->putPipeline([\n \"id\" => \"my_pipeline\",\n \"body\" => [\n \"description\" => \"Sample pipeline for illustration purposes\",\n \"last_modified\" => \"2021-01-02T02:50:51.250Z\",\n \"pipeline_metadata\" => [\n \"type\" => \"logstash_pipeline\",\n \"version\" => 1,\n ],\n \"username\" => \"elastic\",\n \"pipeline\" => \"input {}\\\\n filter { grok {} }\\\\n output {}\",\n \"pipeline_settings\" => [\n \"pipeline.workers\" => 1,\n \"pipeline.batch.size\" => 125,\n \"pipeline.batch.delay\" => 50,\n \"queue.type\" => \"memory\",\n \"queue.max_bytes\" => \"1gb\",\n \"queue.checkpoint.writes\" => 1024,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"Sample pipeline for illustration purposes\",\"last_modified\":\"2021-01-02T02:50:51.250Z\",\"pipeline_metadata\":{\"type\":\"logstash_pipeline\",\"version\":1},\"username\":\"elastic\",\"pipeline\":\"input {}\\\\n filter { grok {} }\\\\n output {}\",\"pipeline_settings\":{\"pipeline.workers\":1,\"pipeline.batch.size\":125,\"pipeline.batch.delay\":50,\"queue.type\":\"memory\",\"queue.max_bytes\":\"1gb\",\"queue.checkpoint.writes\":1024}}' \"$ELASTICSEARCH_URL/_logstash/pipeline/my_pipeline\"" } ] }, @@ -13088,6 +17088,26 @@ { "lang": "Console", "source": "DELETE _logstash/pipeline/my_pipeline\n" + }, + { + "lang": "Python", + "source": "resp = client.logstash.delete_pipeline(\n id=\"my_pipeline\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.logstash.deletePipeline({\n id: \"my_pipeline\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.logstash.delete_pipeline(\n id: \"my_pipeline\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->logstash()->deletePipeline([\n \"id\" => \"my_pipeline\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_logstash/pipeline/my_pipeline\"" } ] } @@ -13113,6 +17133,26 @@ { "lang": "Console", "source": "GET _logstash/pipeline/my_pipeline\n" + }, + { + "lang": "Python", + "source": "resp = client.logstash.get_pipeline(\n id=\"my_pipeline\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.logstash.getPipeline({\n id: \"my_pipeline\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.logstash.get_pipeline(\n id: \"my_pipeline\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->logstash()->getPipeline([\n \"id\" => \"my_pipeline\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_logstash/pipeline/my_pipeline\"" } ] } @@ -13164,6 +17204,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_mget\n{\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.mget(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.mget({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"1\",\n },\n {\n _id: \"2\",\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.mget(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->mget([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"1\",\n ],\n [\n \"_id\" => \"2\",\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":\"1\"},{\"_id\":\"2\"}]}' \"$ELASTICSEARCH_URL/my-index-000001/_mget\"" } ] }, @@ -13213,6 +17273,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_mget\n{\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.mget(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.mget({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"1\",\n },\n {\n _id: \"2\",\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.mget(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->mget([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"1\",\n ],\n [\n \"_id\" => \"2\",\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":\"1\"},{\"_id\":\"2\"}]}' \"$ELASTICSEARCH_URL/my-index-000001/_mget\"" } ] } @@ -13267,6 +17347,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_mget\n{\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.mget(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.mget({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"1\",\n },\n {\n _id: \"2\",\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.mget(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->mget([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"1\",\n ],\n [\n \"_id\" => \"2\",\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":\"1\"},{\"_id\":\"2\"}]}' \"$ELASTICSEARCH_URL/my-index-000001/_mget\"" } ] }, @@ -13319,6 +17419,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_mget\n{\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.mget(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.mget({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"1\",\n },\n {\n _id: \"2\",\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.mget(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->mget([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"1\",\n ],\n [\n \"_id\" => \"2\",\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":\"1\"},{\"_id\":\"2\"}]}' \"$ELASTICSEARCH_URL/my-index-000001/_mget\"" } ] } @@ -13427,6 +17547,26 @@ { "lang": "Console", "source": "POST _ml/anomaly_detectors/low_request_rate/_close\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.close_job(\n job_id=\"low_request_rate\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.closeJob({\n job_id: \"low_request_rate\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.close_job(\n job_id: \"low_request_rate\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->closeJob([\n \"job_id\" => \"low_request_rate\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_close\"" } ] } @@ -13463,6 +17603,26 @@ { "lang": "Console", "source": "GET _ml/calendars/planned-outages\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_calendars(\n calendar_id=\"planned-outages\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getCalendars({\n calendar_id: \"planned-outages\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_calendars(\n calendar_id: \"planned-outages\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getCalendars([\n \"calendar_id\" => \"planned-outages\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages\"" } ] }, @@ -13541,6 +17701,26 @@ { "lang": "Console", "source": "PUT _ml/calendars/planned-outages\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.put_calendar(\n calendar_id=\"planned-outages\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.putCalendar({\n calendar_id: \"planned-outages\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.put_calendar(\n calendar_id: \"planned-outages\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->putCalendar([\n \"calendar_id\" => \"planned-outages\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages\"" } ] }, @@ -13575,6 +17755,26 @@ { "lang": "Console", "source": "GET _ml/calendars/planned-outages\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_calendars(\n calendar_id=\"planned-outages\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getCalendars({\n calendar_id: \"planned-outages\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_calendars(\n calendar_id: \"planned-outages\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getCalendars([\n \"calendar_id\" => \"planned-outages\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages\"" } ] }, @@ -13621,6 +17821,26 @@ { "lang": "Console", "source": "DELETE _ml/calendars/planned-outages\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.delete_calendar(\n calendar_id=\"planned-outages\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.deleteCalendar({\n calendar_id: \"planned-outages\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.delete_calendar(\n calendar_id: \"planned-outages\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->deleteCalendar([\n \"calendar_id\" => \"planned-outages\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages\"" } ] } @@ -13679,6 +17899,26 @@ { "lang": "Console", "source": "DELETE _ml/calendars/planned-outages/events/LS8LJGEBMTCMA-qz49st\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.delete_calendar_event(\n calendar_id=\"planned-outages\",\n event_id=\"LS8LJGEBMTCMA-qz49st\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.deleteCalendarEvent({\n calendar_id: \"planned-outages\",\n event_id: \"LS8LJGEBMTCMA-qz49st\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.delete_calendar_event(\n calendar_id: \"planned-outages\",\n event_id: \"LS8LJGEBMTCMA-qz49st\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->deleteCalendarEvent([\n \"calendar_id\" => \"planned-outages\",\n \"event_id\" => \"LS8LJGEBMTCMA-qz49st\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages/events/LS8LJGEBMTCMA-qz49st\"" } ] } @@ -13748,6 +17988,26 @@ { "lang": "Console", "source": "PUT _ml/calendars/planned-outages/jobs/total-requests\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.put_calendar_job(\n calendar_id=\"planned-outages\",\n job_id=\"total-requests\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.putCalendarJob({\n calendar_id: \"planned-outages\",\n job_id: \"total-requests\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.put_calendar_job(\n calendar_id: \"planned-outages\",\n job_id: \"total-requests\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->putCalendarJob([\n \"calendar_id\" => \"planned-outages\",\n \"job_id\" => \"total-requests\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages/jobs/total-requests\"" } ] }, @@ -13821,6 +18081,26 @@ { "lang": "Console", "source": "DELETE _ml/calendars/planned-outages/jobs/total-requests\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.delete_calendar_job(\n calendar_id=\"planned-outages\",\n job_id=\"total-requests\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.deleteCalendarJob({\n calendar_id: \"planned-outages\",\n job_id: \"total-requests\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.delete_calendar_job(\n calendar_id: \"planned-outages\",\n job_id: \"total-requests\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->deleteCalendarJob([\n \"calendar_id\" => \"planned-outages\",\n \"job_id\" => \"total-requests\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages/jobs/total-requests\"" } ] } @@ -13860,6 +18140,26 @@ { "lang": "Console", "source": "GET _ml/data_frame/analytics/loganalytics\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_data_frame_analytics(\n id=\"loganalytics\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getDataFrameAnalytics({\n id: \"loganalytics\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_data_frame_analytics(\n id: \"loganalytics\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics\"" } ] }, @@ -14012,6 +18312,26 @@ { "lang": "Console", "source": "PUT _ml/data_frame/analytics/model-flight-delays-pre\n{\n \"source\": {\n \"index\": [\n \"kibana_sample_data_flights\"\n ],\n \"query\": {\n \"range\": {\n \"DistanceKilometers\": {\n \"gt\": 0\n }\n }\n },\n \"_source\": {\n \"includes\": [],\n \"excludes\": [\n \"FlightDelay\",\n \"FlightDelayType\"\n ]\n }\n },\n \"dest\": {\n \"index\": \"df-flight-delays\",\n \"results_field\": \"ml-results\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"FlightDelayMin\",\n \"training_percent\": 90\n }\n },\n \"analyzed_fields\": {\n \"includes\": [],\n \"excludes\": [\n \"FlightNum\"\n ]\n },\n \"model_memory_limit\": \"100mb\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.put_data_frame_analytics(\n id=\"model-flight-delays-pre\",\n source={\n \"index\": [\n \"kibana_sample_data_flights\"\n ],\n \"query\": {\n \"range\": {\n \"DistanceKilometers\": {\n \"gt\": 0\n }\n }\n },\n \"_source\": {\n \"includes\": [],\n \"excludes\": [\n \"FlightDelay\",\n \"FlightDelayType\"\n ]\n }\n },\n dest={\n \"index\": \"df-flight-delays\",\n \"results_field\": \"ml-results\"\n },\n analysis={\n \"regression\": {\n \"dependent_variable\": \"FlightDelayMin\",\n \"training_percent\": 90\n }\n },\n analyzed_fields={\n \"includes\": [],\n \"excludes\": [\n \"FlightNum\"\n ]\n },\n model_memory_limit=\"100mb\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.putDataFrameAnalytics({\n id: \"model-flight-delays-pre\",\n source: {\n index: [\"kibana_sample_data_flights\"],\n query: {\n range: {\n DistanceKilometers: {\n gt: 0,\n },\n },\n },\n _source: {\n includes: [],\n excludes: [\"FlightDelay\", \"FlightDelayType\"],\n },\n },\n dest: {\n index: \"df-flight-delays\",\n results_field: \"ml-results\",\n },\n analysis: {\n regression: {\n dependent_variable: \"FlightDelayMin\",\n training_percent: 90,\n },\n },\n analyzed_fields: {\n includes: [],\n excludes: [\"FlightNum\"],\n },\n model_memory_limit: \"100mb\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.put_data_frame_analytics(\n id: \"model-flight-delays-pre\",\n body: {\n \"source\": {\n \"index\": [\n \"kibana_sample_data_flights\"\n ],\n \"query\": {\n \"range\": {\n \"DistanceKilometers\": {\n \"gt\": 0\n }\n }\n },\n \"_source\": {\n \"includes\": [],\n \"excludes\": [\n \"FlightDelay\",\n \"FlightDelayType\"\n ]\n }\n },\n \"dest\": {\n \"index\": \"df-flight-delays\",\n \"results_field\": \"ml-results\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"FlightDelayMin\",\n \"training_percent\": 90\n }\n },\n \"analyzed_fields\": {\n \"includes\": [],\n \"excludes\": [\n \"FlightNum\"\n ]\n },\n \"model_memory_limit\": \"100mb\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->putDataFrameAnalytics([\n \"id\" => \"model-flight-delays-pre\",\n \"body\" => [\n \"source\" => [\n \"index\" => array(\n \"kibana_sample_data_flights\",\n ),\n \"query\" => [\n \"range\" => [\n \"DistanceKilometers\" => [\n \"gt\" => 0,\n ],\n ],\n ],\n \"_source\" => [\n \"includes\" => array(\n ),\n \"excludes\" => array(\n \"FlightDelay\",\n \"FlightDelayType\",\n ),\n ],\n ],\n \"dest\" => [\n \"index\" => \"df-flight-delays\",\n \"results_field\" => \"ml-results\",\n ],\n \"analysis\" => [\n \"regression\" => [\n \"dependent_variable\" => \"FlightDelayMin\",\n \"training_percent\" => 90,\n ],\n ],\n \"analyzed_fields\" => [\n \"includes\" => array(\n ),\n \"excludes\" => array(\n \"FlightNum\",\n ),\n ],\n \"model_memory_limit\" => \"100mb\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":[\"kibana_sample_data_flights\"],\"query\":{\"range\":{\"DistanceKilometers\":{\"gt\":0}}},\"_source\":{\"includes\":[],\"excludes\":[\"FlightDelay\",\"FlightDelayType\"]}},\"dest\":{\"index\":\"df-flight-delays\",\"results_field\":\"ml-results\"},\"analysis\":{\"regression\":{\"dependent_variable\":\"FlightDelayMin\",\"training_percent\":90}},\"analyzed_fields\":{\"includes\":[],\"excludes\":[\"FlightNum\"]},\"model_memory_limit\":\"100mb\"}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/model-flight-delays-pre\"" } ] }, @@ -14078,6 +18398,26 @@ { "lang": "Console", "source": "DELETE _ml/data_frame/analytics/loganalytics\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.delete_data_frame_analytics(\n id=\"loganalytics\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.deleteDataFrameAnalytics({\n id: \"loganalytics\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.delete_data_frame_analytics(\n id: \"loganalytics\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->deleteDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics\"" } ] } @@ -14111,6 +18451,26 @@ { "lang": "Console", "source": "GET _ml/datafeeds/datafeed-high_sum_total_sales\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_datafeeds(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getDatafeeds({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_datafeeds(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getDatafeeds([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales\"" } ] }, @@ -14119,7 +18479,7 @@ "ml anomaly" ], "summary": "Create a datafeed", - "description": "Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job.\nYou can associate only one datafeed with each anomaly detection job.\nThe datafeed contains a query that runs at a defined interval (`frequency`).\nIf you are concerned about delayed data, you can add a delay (`query_delay') at each interval.\nBy default, the datafeed uses the following query: `{\"match_all\": {\"boost\": 1}}`.\n\nWhen Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had\nat the time of creation and runs the query using those same roles. If you provide secondary authorization headers,\nthose credentials are used instead.\nYou must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed\ndirectly to the `.ml-config` index. Do not give users `write` privileges on the `.ml-config` index.\n ##Required authorization\n* Index privileges: `read`* Cluster privileges: `manage_ml`", + "description": "Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job.\nYou can associate only one datafeed with each anomaly detection job.\nThe datafeed contains a query that runs at a defined interval (`frequency`).\nIf you are concerned about delayed data, you can add a delay (`query_delay`) at each interval.\nBy default, the datafeed uses the following query: `{\"match_all\": {\"boost\": 1}}`.\n\nWhen Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had\nat the time of creation and runs the query using those same roles. If you provide secondary authorization headers,\nthose credentials are used instead.\nYou must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed\ndirectly to the `.ml-config` index. Do not give users `write` privileges on the `.ml-config` index.\n ##Required authorization\n* Index privileges: `read`* Cluster privileges: `manage_ml`", "operationId": "ml-put-datafeed", "parameters": [ { @@ -14326,6 +18686,26 @@ { "lang": "Console", "source": "PUT _ml/datafeeds/datafeed-test-job?pretty\n{\n \"indices\": [\n \"kibana_sample_data_logs\"\n ],\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ]\n }\n },\n \"job_id\": \"test-job\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.put_datafeed(\n datafeed_id=\"datafeed-test-job\",\n pretty=True,\n indices=[\n \"kibana_sample_data_logs\"\n ],\n query={\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ]\n }\n },\n job_id=\"test-job\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.putDatafeed({\n datafeed_id: \"datafeed-test-job\",\n pretty: \"true\",\n indices: [\"kibana_sample_data_logs\"],\n query: {\n bool: {\n must: [\n {\n match_all: {},\n },\n ],\n },\n },\n job_id: \"test-job\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.put_datafeed(\n datafeed_id: \"datafeed-test-job\",\n pretty: \"true\",\n body: {\n \"indices\": [\n \"kibana_sample_data_logs\"\n ],\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ]\n }\n },\n \"job_id\": \"test-job\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->putDatafeed([\n \"datafeed_id\" => \"datafeed-test-job\",\n \"pretty\" => \"true\",\n \"body\" => [\n \"indices\" => array(\n \"kibana_sample_data_logs\",\n ),\n \"query\" => [\n \"bool\" => [\n \"must\" => array(\n [\n \"match_all\" => new ArrayObject([]),\n ],\n ),\n ],\n ],\n \"job_id\" => \"test-job\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"indices\":[\"kibana_sample_data_logs\"],\"query\":{\"bool\":{\"must\":[{\"match_all\":{}}]}},\"job_id\":\"test-job\"}' \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-test-job?pretty\"" } ] }, @@ -14382,6 +18762,26 @@ { "lang": "Console", "source": "DELETE _ml/datafeeds/datafeed-total-requests\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.delete_datafeed(\n datafeed_id=\"datafeed-total-requests\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.deleteDatafeed({\n datafeed_id: \"datafeed-total-requests\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.delete_datafeed(\n datafeed_id: \"datafeed-total-requests\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->deleteDatafeed([\n \"datafeed_id\" => \"datafeed-total-requests\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-total-requests\"" } ] } @@ -14415,6 +18815,26 @@ { "lang": "Console", "source": "GET _ml/filters/safe_domains\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_filters(\n filter_id=\"safe_domains\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getFilters({\n filter_id: \"safe_domains\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_filters(\n filter_id: \"safe_domains\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getFilters([\n \"filter_id\" => \"safe_domains\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/filters/safe_domains\"" } ] }, @@ -14503,6 +18923,26 @@ { "lang": "Console", "source": "PUT _ml/filters/safe_domains\n{\n \"description\": \"A list of safe domains\",\n \"items\": [\"*.google.com\", \"wikipedia.org\"]\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.put_filter(\n filter_id=\"safe_domains\",\n description=\"A list of safe domains\",\n items=[\n \"*.google.com\",\n \"wikipedia.org\"\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.putFilter({\n filter_id: \"safe_domains\",\n description: \"A list of safe domains\",\n items: [\"*.google.com\", \"wikipedia.org\"],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.put_filter(\n filter_id: \"safe_domains\",\n body: {\n \"description\": \"A list of safe domains\",\n \"items\": [\n \"*.google.com\",\n \"wikipedia.org\"\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->putFilter([\n \"filter_id\" => \"safe_domains\",\n \"body\" => [\n \"description\" => \"A list of safe domains\",\n \"items\" => array(\n \"*.google.com\",\n \"wikipedia.org\",\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"A list of safe domains\",\"items\":[\"*.google.com\",\"wikipedia.org\"]}' \"$ELASTICSEARCH_URL/_ml/filters/safe_domains\"" } ] }, @@ -14549,6 +18989,26 @@ { "lang": "Console", "source": "DELETE _ml/filters/safe_domains\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.delete_filter(\n filter_id=\"safe_domains\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.deleteFilter({\n filter_id: \"safe_domains\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.delete_filter(\n filter_id: \"safe_domains\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->deleteFilter([\n \"filter_id\" => \"safe_domains\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/filters/safe_domains\"" } ] } @@ -14582,6 +19042,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/high_sum_total_sales\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_jobs(\n job_id=\"high_sum_total_sales\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getJobs({\n job_id: \"high_sum_total_sales\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_jobs(\n job_id: \"high_sum_total_sales\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getJobs([\n \"job_id\" => \"high_sum_total_sales\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/high_sum_total_sales\"" } ] }, @@ -14821,7 +19301,33 @@ } } }, - "x-state": "Added in 5.4.0" + "x-state": "Added in 5.4.0", + "x-codeSamples": [ + { + "lang": "Console", + "source": "PUT /_ml/anomaly_detectors/job-01\n{\n \"analysis_config\": {\n \"bucket_span\": \"15m\",\n \"detectors\": [\n {\n \"detector_description\": \"Sum of bytes\",\n \"function\": \"sum\",\n \"field_name\": \"bytes\"\n }\n ]\n },\n \"data_description\": {\n \"time_field\": \"timestamp\",\n \"time_format\": \"epoch_ms\"\n },\n \"analysis_limits\": {\n \"model_memory_limit\": \"11MB\"\n },\n \"model_plot_config\": {\n \"enabled\": true,\n \"annotations_enabled\": true\n },\n \"results_index_name\": \"test-job1\",\n \"datafeed_config\": {\n \"indices\": [\n \"kibana_sample_data_logs\"\n ],\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ]\n }\n },\n \"runtime_mappings\": {\n \"hour_of_day\": {\n \"type\": \"long\",\n \"script\": {\n \"source\": \"emit(doc['timestamp'].value.getHour());\"\n }\n }\n },\n \"datafeed_id\": \"datafeed-test-job1\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.put_job(\n job_id=\"job-01\",\n analysis_config={\n \"bucket_span\": \"15m\",\n \"detectors\": [\n {\n \"detector_description\": \"Sum of bytes\",\n \"function\": \"sum\",\n \"field_name\": \"bytes\"\n }\n ]\n },\n data_description={\n \"time_field\": \"timestamp\",\n \"time_format\": \"epoch_ms\"\n },\n analysis_limits={\n \"model_memory_limit\": \"11MB\"\n },\n model_plot_config={\n \"enabled\": True,\n \"annotations_enabled\": True\n },\n results_index_name=\"test-job1\",\n datafeed_config={\n \"indices\": [\n \"kibana_sample_data_logs\"\n ],\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ]\n }\n },\n \"runtime_mappings\": {\n \"hour_of_day\": {\n \"type\": \"long\",\n \"script\": {\n \"source\": \"emit(doc['timestamp'].value.getHour());\"\n }\n }\n },\n \"datafeed_id\": \"datafeed-test-job1\"\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.putJob({\n job_id: \"job-01\",\n analysis_config: {\n bucket_span: \"15m\",\n detectors: [\n {\n detector_description: \"Sum of bytes\",\n function: \"sum\",\n field_name: \"bytes\",\n },\n ],\n },\n data_description: {\n time_field: \"timestamp\",\n time_format: \"epoch_ms\",\n },\n analysis_limits: {\n model_memory_limit: \"11MB\",\n },\n model_plot_config: {\n enabled: true,\n annotations_enabled: true,\n },\n results_index_name: \"test-job1\",\n datafeed_config: {\n indices: [\"kibana_sample_data_logs\"],\n query: {\n bool: {\n must: [\n {\n match_all: {},\n },\n ],\n },\n },\n runtime_mappings: {\n hour_of_day: {\n type: \"long\",\n script: {\n source: \"emit(doc['timestamp'].value.getHour());\",\n },\n },\n },\n datafeed_id: \"datafeed-test-job1\",\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.put_job(\n job_id: \"job-01\",\n body: {\n \"analysis_config\": {\n \"bucket_span\": \"15m\",\n \"detectors\": [\n {\n \"detector_description\": \"Sum of bytes\",\n \"function\": \"sum\",\n \"field_name\": \"bytes\"\n }\n ]\n },\n \"data_description\": {\n \"time_field\": \"timestamp\",\n \"time_format\": \"epoch_ms\"\n },\n \"analysis_limits\": {\n \"model_memory_limit\": \"11MB\"\n },\n \"model_plot_config\": {\n \"enabled\": true,\n \"annotations_enabled\": true\n },\n \"results_index_name\": \"test-job1\",\n \"datafeed_config\": {\n \"indices\": [\n \"kibana_sample_data_logs\"\n ],\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ]\n }\n },\n \"runtime_mappings\": {\n \"hour_of_day\": {\n \"type\": \"long\",\n \"script\": {\n \"source\": \"emit(doc['timestamp'].value.getHour());\"\n }\n }\n },\n \"datafeed_id\": \"datafeed-test-job1\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->putJob([\n \"job_id\" => \"job-01\",\n \"body\" => [\n \"analysis_config\" => [\n \"bucket_span\" => \"15m\",\n \"detectors\" => array(\n [\n \"detector_description\" => \"Sum of bytes\",\n \"function\" => \"sum\",\n \"field_name\" => \"bytes\",\n ],\n ),\n ],\n \"data_description\" => [\n \"time_field\" => \"timestamp\",\n \"time_format\" => \"epoch_ms\",\n ],\n \"analysis_limits\" => [\n \"model_memory_limit\" => \"11MB\",\n ],\n \"model_plot_config\" => [\n \"enabled\" => true,\n \"annotations_enabled\" => true,\n ],\n \"results_index_name\" => \"test-job1\",\n \"datafeed_config\" => [\n \"indices\" => array(\n \"kibana_sample_data_logs\",\n ),\n \"query\" => [\n \"bool\" => [\n \"must\" => array(\n [\n \"match_all\" => new ArrayObject([]),\n ],\n ),\n ],\n ],\n \"runtime_mappings\" => [\n \"hour_of_day\" => [\n \"type\" => \"long\",\n \"script\" => [\n \"source\" => \"emit(doc['timestamp'].value.getHour());\",\n ],\n ],\n ],\n \"datafeed_id\" => \"datafeed-test-job1\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"analysis_config\":{\"bucket_span\":\"15m\",\"detectors\":[{\"detector_description\":\"Sum of bytes\",\"function\":\"sum\",\"field_name\":\"bytes\"}]},\"data_description\":{\"time_field\":\"timestamp\",\"time_format\":\"epoch_ms\"},\"analysis_limits\":{\"model_memory_limit\":\"11MB\"},\"model_plot_config\":{\"enabled\":true,\"annotations_enabled\":true},\"results_index_name\":\"test-job1\",\"datafeed_config\":{\"indices\":[\"kibana_sample_data_logs\"],\"query\":{\"bool\":{\"must\":[{\"match_all\":{}}]}},\"runtime_mappings\":{\"hour_of_day\":{\"type\":\"long\",\"script\":{\"source\":\"emit(doc['\"'\"'timestamp'\"'\"'].value.getHour());\"}}},\"datafeed_id\":\"datafeed-test-job1\"}}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/job-01\"" + } + ] }, "delete": { "tags": [ @@ -14902,6 +19408,26 @@ { "lang": "Console", "source": "DELETE _ml/anomaly_detectors/total-requests\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.delete_job(\n job_id=\"total-requests\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.deleteJob({\n job_id: \"total-requests\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.delete_job(\n job_id: \"total-requests\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->deleteJob([\n \"job_id\" => \"total-requests\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/total-requests\"" } ] } @@ -14950,6 +19476,26 @@ { "lang": "Console", "source": "GET _ml/trained_models/\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_trained_models()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getTrainedModels();" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_trained_models" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getTrainedModels();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/\"" } ] }, @@ -15124,6 +19670,26 @@ { "lang": "Console", "source": "DELETE _ml/trained_models/regression-job-one-1574775307356\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.delete_trained_model(\n model_id=\"regression-job-one-1574775307356\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.deleteTrainedModel({\n model_id: \"regression-job-one-1574775307356\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.delete_trained_model(\n model_id: \"regression-job-one-1574775307356\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->deleteTrainedModel([\n \"model_id\" => \"regression-job-one-1574775307356\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/regression-job-one-1574775307356\"" } ] } @@ -15187,6 +19753,26 @@ { "lang": "Console", "source": "PUT _ml/trained_models/flight-delay-prediction-1574775339910/model_aliases/flight_delay_model\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.put_trained_model_alias(\n model_id=\"flight-delay-prediction-1574775339910\",\n model_alias=\"flight_delay_model\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.putTrainedModelAlias({\n model_id: \"flight-delay-prediction-1574775339910\",\n model_alias: \"flight_delay_model\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.put_trained_model_alias(\n model_id: \"flight-delay-prediction-1574775339910\",\n model_alias: \"flight_delay_model\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->putTrainedModelAlias([\n \"model_id\" => \"flight-delay-prediction-1574775339910\",\n \"model_alias\" => \"flight_delay_model\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/flight-delay-prediction-1574775339910/model_aliases/flight_delay_model\"" } ] }, @@ -15244,6 +19830,26 @@ { "lang": "Console", "source": "DELETE _ml/trained_models/flight-delay-prediction-1574775339910/model_aliases/flight_delay_model\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.delete_trained_model_alias(\n model_id=\"flight-delay-prediction-1574775339910\",\n model_alias=\"flight_delay_model\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.deleteTrainedModelAlias({\n model_id: \"flight-delay-prediction-1574775339910\",\n model_alias: \"flight_delay_model\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.delete_trained_model_alias(\n model_id: \"flight-delay-prediction-1574775339910\",\n model_alias: \"flight_delay_model\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->deleteTrainedModelAlias([\n \"model_id\" => \"flight-delay-prediction-1574775339910\",\n \"model_alias\" => \"flight_delay_model\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/flight-delay-prediction-1574775339910/model_aliases/flight_delay_model\"" } ] } @@ -15322,6 +19928,26 @@ { "lang": "Console", "source": "POST _ml/anomaly_detectors/_estimate_model_memory\n{\n \"analysis_config\": {\n \"bucket_span\": \"5m\",\n \"detectors\": [\n {\n \"function\": \"sum\",\n \"field_name\": \"bytes\",\n \"by_field_name\": \"status\",\n \"partition_field_name\": \"app\"\n }\n ],\n \"influencers\": [\n \"source_ip\",\n \"dest_ip\"\n ]\n },\n \"overall_cardinality\": {\n \"status\": 10,\n \"app\": 50\n },\n \"max_bucket_cardinality\": {\n \"source_ip\": 300,\n \"dest_ip\": 30\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.estimate_model_memory(\n analysis_config={\n \"bucket_span\": \"5m\",\n \"detectors\": [\n {\n \"function\": \"sum\",\n \"field_name\": \"bytes\",\n \"by_field_name\": \"status\",\n \"partition_field_name\": \"app\"\n }\n ],\n \"influencers\": [\n \"source_ip\",\n \"dest_ip\"\n ]\n },\n overall_cardinality={\n \"status\": 10,\n \"app\": 50\n },\n max_bucket_cardinality={\n \"source_ip\": 300,\n \"dest_ip\": 30\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.estimateModelMemory({\n analysis_config: {\n bucket_span: \"5m\",\n detectors: [\n {\n function: \"sum\",\n field_name: \"bytes\",\n by_field_name: \"status\",\n partition_field_name: \"app\",\n },\n ],\n influencers: [\"source_ip\", \"dest_ip\"],\n },\n overall_cardinality: {\n status: 10,\n app: 50,\n },\n max_bucket_cardinality: {\n source_ip: 300,\n dest_ip: 30,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.estimate_model_memory(\n body: {\n \"analysis_config\": {\n \"bucket_span\": \"5m\",\n \"detectors\": [\n {\n \"function\": \"sum\",\n \"field_name\": \"bytes\",\n \"by_field_name\": \"status\",\n \"partition_field_name\": \"app\"\n }\n ],\n \"influencers\": [\n \"source_ip\",\n \"dest_ip\"\n ]\n },\n \"overall_cardinality\": {\n \"status\": 10,\n \"app\": 50\n },\n \"max_bucket_cardinality\": {\n \"source_ip\": 300,\n \"dest_ip\": 30\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->estimateModelMemory([\n \"body\" => [\n \"analysis_config\" => [\n \"bucket_span\" => \"5m\",\n \"detectors\" => array(\n [\n \"function\" => \"sum\",\n \"field_name\" => \"bytes\",\n \"by_field_name\" => \"status\",\n \"partition_field_name\" => \"app\",\n ],\n ),\n \"influencers\" => array(\n \"source_ip\",\n \"dest_ip\",\n ),\n ],\n \"overall_cardinality\" => [\n \"status\" => 10,\n \"app\" => 50,\n ],\n \"max_bucket_cardinality\" => [\n \"source_ip\" => 300,\n \"dest_ip\" => 30,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"analysis_config\":{\"bucket_span\":\"5m\",\"detectors\":[{\"function\":\"sum\",\"field_name\":\"bytes\",\"by_field_name\":\"status\",\"partition_field_name\":\"app\"}],\"influencers\":[\"source_ip\",\"dest_ip\"]},\"overall_cardinality\":{\"status\":10,\"app\":50},\"max_bucket_cardinality\":{\"source_ip\":300,\"dest_ip\":30}}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/_estimate_model_memory\"" } ] } @@ -15431,6 +20057,26 @@ { "lang": "Console", "source": "POST _ml/data_frame/_evaluate\n{\n \"index\": \"animal_classification\",\n \"evaluation\": {\n \"classification\": {\n \"actual_field\": \"animal_class\",\n \"predicted_field\": \"ml.animal_class_prediction\",\n \"metrics\": {\n \"multiclass_confusion_matrix\": {}\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.evaluate_data_frame(\n index=\"animal_classification\",\n evaluation={\n \"classification\": {\n \"actual_field\": \"animal_class\",\n \"predicted_field\": \"ml.animal_class_prediction\",\n \"metrics\": {\n \"multiclass_confusion_matrix\": {}\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.evaluateDataFrame({\n index: \"animal_classification\",\n evaluation: {\n classification: {\n actual_field: \"animal_class\",\n predicted_field: \"ml.animal_class_prediction\",\n metrics: {\n multiclass_confusion_matrix: {},\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.evaluate_data_frame(\n body: {\n \"index\": \"animal_classification\",\n \"evaluation\": {\n \"classification\": {\n \"actual_field\": \"animal_class\",\n \"predicted_field\": \"ml.animal_class_prediction\",\n \"metrics\": {\n \"multiclass_confusion_matrix\": {}\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->evaluateDataFrame([\n \"body\" => [\n \"index\" => \"animal_classification\",\n \"evaluation\" => [\n \"classification\" => [\n \"actual_field\" => \"animal_class\",\n \"predicted_field\" => \"ml.animal_class_prediction\",\n \"metrics\" => [\n \"multiclass_confusion_matrix\" => new ArrayObject([]),\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index\":\"animal_classification\",\"evaluation\":{\"classification\":{\"actual_field\":\"animal_class\",\"predicted_field\":\"ml.animal_class_prediction\",\"metrics\":{\"multiclass_confusion_matrix\":{}}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/_evaluate\"" } ] } @@ -15568,6 +20214,26 @@ { "lang": "Console", "source": "POST _ml/anomaly_detectors/low_request_rate/_flush\n{\n \"calc_interim\": true\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.flush_job(\n job_id=\"low_request_rate\",\n calc_interim=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.flushJob({\n job_id: \"low_request_rate\",\n calc_interim: true,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.flush_job(\n job_id: \"low_request_rate\",\n body: {\n \"calc_interim\": true\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->flushJob([\n \"job_id\" => \"low_request_rate\",\n \"body\" => [\n \"calc_interim\" => true,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"calc_interim\":true}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_flush\"" } ] } @@ -15675,6 +20341,26 @@ { "lang": "Console", "source": "GET _ml/calendars/planned-outages/events\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_calendar_events(\n calendar_id=\"planned-outages\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getCalendarEvents({\n calendar_id: \"planned-outages\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_calendar_events(\n calendar_id: \"planned-outages\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getCalendarEvents([\n \"calendar_id\" => \"planned-outages\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages/events\"" } ] }, @@ -15754,6 +20440,26 @@ { "lang": "Console", "source": "POST _ml/calendars/planned-outages/events\n{\n \"events\" : [\n {\"description\": \"event 1\", \"start_time\": 1513641600000, \"end_time\": 1513728000000},\n {\"description\": \"event 2\", \"start_time\": 1513814400000, \"end_time\": 1513900800000},\n {\"description\": \"event 3\", \"start_time\": 1514160000000, \"end_time\": 1514246400000}\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.post_calendar_events(\n calendar_id=\"planned-outages\",\n events=[\n {\n \"description\": \"event 1\",\n \"start_time\": 1513641600000,\n \"end_time\": 1513728000000\n },\n {\n \"description\": \"event 2\",\n \"start_time\": 1513814400000,\n \"end_time\": 1513900800000\n },\n {\n \"description\": \"event 3\",\n \"start_time\": 1514160000000,\n \"end_time\": 1514246400000\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.postCalendarEvents({\n calendar_id: \"planned-outages\",\n events: [\n {\n description: \"event 1\",\n start_time: 1513641600000,\n end_time: 1513728000000,\n },\n {\n description: \"event 2\",\n start_time: 1513814400000,\n end_time: 1513900800000,\n },\n {\n description: \"event 3\",\n start_time: 1514160000000,\n end_time: 1514246400000,\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.post_calendar_events(\n calendar_id: \"planned-outages\",\n body: {\n \"events\": [\n {\n \"description\": \"event 1\",\n \"start_time\": 1513641600000,\n \"end_time\": 1513728000000\n },\n {\n \"description\": \"event 2\",\n \"start_time\": 1513814400000,\n \"end_time\": 1513900800000\n },\n {\n \"description\": \"event 3\",\n \"start_time\": 1514160000000,\n \"end_time\": 1514246400000\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->postCalendarEvents([\n \"calendar_id\" => \"planned-outages\",\n \"body\" => [\n \"events\" => array(\n [\n \"description\" => \"event 1\",\n \"start_time\" => 1513641600000,\n \"end_time\" => 1513728000000,\n ],\n [\n \"description\" => \"event 2\",\n \"start_time\" => 1513814400000,\n \"end_time\" => 1513900800000,\n ],\n [\n \"description\" => \"event 3\",\n \"start_time\" => 1514160000000,\n \"end_time\" => 1514246400000,\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"events\":[{\"description\":\"event 1\",\"start_time\":1513641600000,\"end_time\":1513728000000},{\"description\":\"event 2\",\"start_time\":1513814400000,\"end_time\":1513900800000},{\"description\":\"event 3\",\"start_time\":1514160000000,\"end_time\":1514246400000}]}' \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages/events\"" } ] } @@ -15787,6 +20493,26 @@ { "lang": "Console", "source": "GET _ml/calendars/planned-outages\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_calendars(\n calendar_id=\"planned-outages\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getCalendars({\n calendar_id: \"planned-outages\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_calendars(\n calendar_id: \"planned-outages\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getCalendars([\n \"calendar_id\" => \"planned-outages\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages\"" } ] }, @@ -15818,6 +20544,26 @@ { "lang": "Console", "source": "GET _ml/calendars/planned-outages\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_calendars(\n calendar_id=\"planned-outages\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getCalendars({\n calendar_id: \"planned-outages\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_calendars(\n calendar_id: \"planned-outages\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getCalendars([\n \"calendar_id\" => \"planned-outages\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages\"" } ] } @@ -15854,6 +20600,26 @@ { "lang": "Console", "source": "GET _ml/data_frame/analytics/loganalytics\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_data_frame_analytics(\n id=\"loganalytics\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getDataFrameAnalytics({\n id: \"loganalytics\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_data_frame_analytics(\n id: \"loganalytics\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics\"" } ] } @@ -15890,6 +20656,26 @@ { "lang": "Console", "source": "GET _ml/data_frame/analytics/weblog-outliers/_stats\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_data_frame_analytics_stats(\n id=\"weblog-outliers\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getDataFrameAnalyticsStats({\n id: \"weblog-outliers\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_data_frame_analytics_stats(\n id: \"weblog-outliers\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getDataFrameAnalyticsStats([\n \"id\" => \"weblog-outliers\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/weblog-outliers/_stats\"" } ] } @@ -15929,6 +20715,26 @@ { "lang": "Console", "source": "GET _ml/data_frame/analytics/weblog-outliers/_stats\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_data_frame_analytics_stats(\n id=\"weblog-outliers\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getDataFrameAnalyticsStats({\n id: \"weblog-outliers\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_data_frame_analytics_stats(\n id: \"weblog-outliers\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getDataFrameAnalyticsStats([\n \"id\" => \"weblog-outliers\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/weblog-outliers/_stats\"" } ] } @@ -15959,6 +20765,26 @@ { "lang": "Console", "source": "GET _ml/datafeeds/datafeed-high_sum_total_sales/_stats\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_datafeed_stats(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getDatafeedStats({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_datafeed_stats(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getDatafeedStats([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales/_stats\"" } ] } @@ -15986,6 +20812,26 @@ { "lang": "Console", "source": "GET _ml/datafeeds/datafeed-high_sum_total_sales/_stats\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_datafeed_stats(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getDatafeedStats({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_datafeed_stats(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getDatafeedStats([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales/_stats\"" } ] } @@ -16016,6 +20862,26 @@ { "lang": "Console", "source": "GET _ml/datafeeds/datafeed-high_sum_total_sales\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_datafeeds(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getDatafeeds({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_datafeeds(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getDatafeeds([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales\"" } ] } @@ -16046,6 +20912,26 @@ { "lang": "Console", "source": "GET _ml/filters/safe_domains\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_filters(\n filter_id=\"safe_domains\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getFilters({\n filter_id: \"safe_domains\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_filters(\n filter_id: \"safe_domains\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getFilters([\n \"filter_id\" => \"safe_domains\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/filters/safe_domains\"" } ] } @@ -16073,6 +20959,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/low_request_rate/_stats\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_job_stats(\n job_id=\"low_request_rate\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getJobStats({\n job_id: \"low_request_rate\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_job_stats(\n job_id: \"low_request_rate\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getJobStats([\n \"job_id\" => \"low_request_rate\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_stats\"" } ] } @@ -16103,6 +21009,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/low_request_rate/_stats\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_job_stats(\n job_id=\"low_request_rate\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getJobStats({\n job_id: \"low_request_rate\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_job_stats(\n job_id: \"low_request_rate\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getJobStats([\n \"job_id\" => \"low_request_rate\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_stats\"" } ] } @@ -16133,6 +21059,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/high_sum_total_sales\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_jobs(\n job_id=\"high_sum_total_sales\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getJobs({\n job_id: \"high_sum_total_sales\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_jobs(\n job_id: \"high_sum_total_sales\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getJobs([\n \"job_id\" => \"high_sum_total_sales\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/high_sum_total_sales\"" } ] } @@ -16184,6 +21130,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/job-*/results/overall_buckets\n{\n \"overall_score\": 80,\n \"start\": \"1403532000000\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_overall_buckets(\n job_id=\"job-*\",\n overall_score=80,\n start=\"1403532000000\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getOverallBuckets({\n job_id: \"job-*\",\n overall_score: 80,\n start: 1403532000000,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_overall_buckets(\n job_id: \"job-*\",\n body: {\n \"overall_score\": 80,\n \"start\": \"1403532000000\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getOverallBuckets([\n \"job_id\" => \"job-*\",\n \"body\" => [\n \"overall_score\" => 80,\n \"start\" => \"1403532000000\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"overall_score\":80,\"start\":\"1403532000000\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/job-*/results/overall_buckets\"" } ] }, @@ -16233,6 +21199,26 @@ { "lang": "Console", "source": "GET _ml/anomaly_detectors/job-*/results/overall_buckets\n{\n \"overall_score\": 80,\n \"start\": \"1403532000000\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_overall_buckets(\n job_id=\"job-*\",\n overall_score=80,\n start=\"1403532000000\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getOverallBuckets({\n job_id: \"job-*\",\n overall_score: 80,\n start: 1403532000000,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_overall_buckets(\n job_id: \"job-*\",\n body: {\n \"overall_score\": 80,\n \"start\": \"1403532000000\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getOverallBuckets([\n \"job_id\" => \"job-*\",\n \"body\" => [\n \"overall_score\" => 80,\n \"start\" => \"1403532000000\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"overall_score\":80,\"start\":\"1403532000000\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/job-*/results/overall_buckets\"" } ] } @@ -16278,6 +21264,26 @@ { "lang": "Console", "source": "GET _ml/trained_models/\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_trained_models()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getTrainedModels();" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_trained_models" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getTrainedModels();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/\"" } ] } @@ -16314,6 +21320,26 @@ { "lang": "Console", "source": "GET _ml/trained_models/_stats\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_trained_models_stats()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getTrainedModelsStats();" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_trained_models_stats" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getTrainedModelsStats();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/_stats\"" } ] } @@ -16347,6 +21373,26 @@ { "lang": "Console", "source": "GET _ml/trained_models/_stats\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.get_trained_models_stats()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.getTrainedModelsStats();" + }, + { + "lang": "Ruby", + "source": "response = client.ml.get_trained_models_stats" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->getTrainedModelsStats();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/_stats\"" } ] } @@ -16443,6 +21489,26 @@ { "lang": "Console", "source": "POST _ml/trained_models/lang_ident_model_1/_infer\n{\n \"docs\":[{\"text\": \"The fool doth think he is wise, but the wise man knows himself to be a fool.\"}]\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.infer_trained_model(\n model_id=\"lang_ident_model_1\",\n docs=[\n {\n \"text\": \"The fool doth think he is wise, but the wise man knows himself to be a fool.\"\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.inferTrainedModel({\n model_id: \"lang_ident_model_1\",\n docs: [\n {\n text: \"The fool doth think he is wise, but the wise man knows himself to be a fool.\",\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.infer_trained_model(\n model_id: \"lang_ident_model_1\",\n body: {\n \"docs\": [\n {\n \"text\": \"The fool doth think he is wise, but the wise man knows himself to be a fool.\"\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->inferTrainedModel([\n \"model_id\" => \"lang_ident_model_1\",\n \"body\" => [\n \"docs\" => array(\n [\n \"text\" => \"The fool doth think he is wise, but the wise man knows himself to be a fool.\",\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"text\":\"The fool doth think he is wise, but the wise man knows himself to be a fool.\"}]}' \"$ELASTICSEARCH_URL/_ml/trained_models/lang_ident_model_1/_infer\"" } ] } @@ -16528,7 +21594,33 @@ } } }, - "x-state": "Added in 5.4.0" + "x-state": "Added in 5.4.0", + "x-codeSamples": [ + { + "lang": "Console", + "source": "POST /_ml/anomaly_detectors/job-01/_open\n{\n \"timeout\": \"35m\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.open_job(\n job_id=\"job-01\",\n timeout=\"35m\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.openJob({\n job_id: \"job-01\",\n timeout: \"35m\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.open_job(\n job_id: \"job-01\",\n body: {\n \"timeout\": \"35m\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->openJob([\n \"job_id\" => \"job-01\",\n \"body\" => [\n \"timeout\" => \"35m\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"timeout\":\"35m\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/job-01/_open\"" + } + ] } }, "/_ml/data_frame/analytics/_preview": { @@ -16552,6 +21644,26 @@ { "lang": "Console", "source": "POST _ml/data_frame/analytics/_preview\n{\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.preview_data_frame_analytics(\n config={\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.previewDataFrameAnalytics({\n config: {\n source: {\n index: \"houses_sold_last_10_yrs\",\n },\n analysis: {\n regression: {\n dependent_variable: \"price\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.preview_data_frame_analytics(\n body: {\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->previewDataFrameAnalytics([\n \"body\" => [\n \"config\" => [\n \"source\" => [\n \"index\" => \"houses_sold_last_10_yrs\",\n ],\n \"analysis\" => [\n \"regression\" => [\n \"dependent_variable\" => \"price\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"config\":{\"source\":{\"index\":\"houses_sold_last_10_yrs\"},\"analysis\":{\"regression\":{\"dependent_variable\":\"price\"}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/_preview\"" } ] }, @@ -16575,6 +21687,26 @@ { "lang": "Console", "source": "POST _ml/data_frame/analytics/_preview\n{\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.preview_data_frame_analytics(\n config={\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.previewDataFrameAnalytics({\n config: {\n source: {\n index: \"houses_sold_last_10_yrs\",\n },\n analysis: {\n regression: {\n dependent_variable: \"price\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.preview_data_frame_analytics(\n body: {\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->previewDataFrameAnalytics([\n \"body\" => [\n \"config\" => [\n \"source\" => [\n \"index\" => \"houses_sold_last_10_yrs\",\n ],\n \"analysis\" => [\n \"regression\" => [\n \"dependent_variable\" => \"price\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"config\":{\"source\":{\"index\":\"houses_sold_last_10_yrs\"},\"analysis\":{\"regression\":{\"dependent_variable\":\"price\"}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/_preview\"" } ] } @@ -16605,6 +21737,26 @@ { "lang": "Console", "source": "POST _ml/data_frame/analytics/_preview\n{\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.preview_data_frame_analytics(\n config={\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.previewDataFrameAnalytics({\n config: {\n source: {\n index: \"houses_sold_last_10_yrs\",\n },\n analysis: {\n regression: {\n dependent_variable: \"price\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.preview_data_frame_analytics(\n body: {\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->previewDataFrameAnalytics([\n \"body\" => [\n \"config\" => [\n \"source\" => [\n \"index\" => \"houses_sold_last_10_yrs\",\n ],\n \"analysis\" => [\n \"regression\" => [\n \"dependent_variable\" => \"price\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"config\":{\"source\":{\"index\":\"houses_sold_last_10_yrs\"},\"analysis\":{\"regression\":{\"dependent_variable\":\"price\"}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/_preview\"" } ] }, @@ -16633,6 +21785,26 @@ { "lang": "Console", "source": "POST _ml/data_frame/analytics/_preview\n{\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.preview_data_frame_analytics(\n config={\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.previewDataFrameAnalytics({\n config: {\n source: {\n index: \"houses_sold_last_10_yrs\",\n },\n analysis: {\n regression: {\n dependent_variable: \"price\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.preview_data_frame_analytics(\n body: {\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->previewDataFrameAnalytics([\n \"body\" => [\n \"config\" => [\n \"source\" => [\n \"index\" => \"houses_sold_last_10_yrs\",\n ],\n \"analysis\" => [\n \"regression\" => [\n \"dependent_variable\" => \"price\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"config\":{\"source\":{\"index\":\"houses_sold_last_10_yrs\"},\"analysis\":{\"regression\":{\"dependent_variable\":\"price\"}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/_preview\"" } ] } @@ -16669,6 +21841,26 @@ { "lang": "Console", "source": "GET _ml/datafeeds/datafeed-high_sum_total_sales/_preview\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.preview_datafeed(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.previewDatafeed({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.preview_datafeed(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->previewDatafeed([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales/_preview\"" } ] }, @@ -16703,6 +21895,26 @@ { "lang": "Console", "source": "GET _ml/datafeeds/datafeed-high_sum_total_sales/_preview\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.preview_datafeed(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.previewDatafeed({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.preview_datafeed(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->previewDatafeed([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales/_preview\"" } ] } @@ -16736,6 +21948,26 @@ { "lang": "Console", "source": "GET _ml/datafeeds/datafeed-high_sum_total_sales/_preview\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.preview_datafeed(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.previewDatafeed({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.preview_datafeed(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->previewDatafeed([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales/_preview\"" } ] }, @@ -16767,6 +21999,26 @@ { "lang": "Console", "source": "GET _ml/datafeeds/datafeed-high_sum_total_sales/_preview\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.preview_datafeed(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.previewDatafeed({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.preview_datafeed(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->previewDatafeed([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales/_preview\"" } ] } @@ -16855,6 +22107,26 @@ { "lang": "Console", "source": "PUT _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/definition/0\n{\n \"definition\": \"...\",\n \"total_definition_length\": 265632637,\n \"total_parts\": 64\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.put_trained_model_definition_part(\n model_id=\"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n part=\"0\",\n definition=\"...\",\n total_definition_length=265632637,\n total_parts=64,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.putTrainedModelDefinitionPart({\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n part: 0,\n definition: \"...\",\n total_definition_length: 265632637,\n total_parts: 64,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.put_trained_model_definition_part(\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n part: \"0\",\n body: {\n \"definition\": \"...\",\n \"total_definition_length\": 265632637,\n \"total_parts\": 64\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->putTrainedModelDefinitionPart([\n \"model_id\" => \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n \"part\" => \"0\",\n \"body\" => [\n \"definition\" => \"...\",\n \"total_definition_length\" => 265632637,\n \"total_parts\" => 64,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"definition\":\"...\",\"total_definition_length\":265632637,\"total_parts\":64}' \"$ELASTICSEARCH_URL/_ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/definition/0\"" } ] } @@ -16915,7 +22187,7 @@ "examples": { "MlPutTrainedModelVocabularyExample1": { "description": "An example body for a `PUT _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/vocabulary` request.", - "value": "{\n \"vocabulary\": [\n \"[PAD]\",\n \"[unused0]\",\n ...\n ]\n}" + "value": "{\n \"vocabulary\": [\n \"[PAD]\",\n \"[unused0]\",\n ]\n}" } } } @@ -16938,7 +22210,27 @@ "x-codeSamples": [ { "lang": "Console", - "source": "PUT _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/vocabulary\n{\n \"vocabulary\": [\n \"[PAD]\",\n \"[unused0]\",\n ...\n ]\n}" + "source": "PUT _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/vocabulary\n{\n \"vocabulary\": [\n \"[PAD]\",\n \"[unused0]\",\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.put_trained_model_vocabulary(\n model_id=\"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n vocabulary=[\n \"[PAD]\",\n \"[unused0]\"\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.putTrainedModelVocabulary({\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n vocabulary: [\"[PAD]\", \"[unused0]\"],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.put_trained_model_vocabulary(\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n body: {\n \"vocabulary\": [\n \"[PAD]\",\n \"[unused0]\"\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->putTrainedModelVocabulary([\n \"model_id\" => \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n \"body\" => [\n \"vocabulary\" => array(\n \"[PAD]\",\n \"[unused0]\",\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"vocabulary\":[\"[PAD]\",\"[unused0]\"]}' \"$ELASTICSEARCH_URL/_ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/vocabulary\"" } ] } @@ -17001,6 +22293,26 @@ { "lang": "Console", "source": "POST _ml/anomaly_detectors/total-requests/_reset\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.reset_job(\n job_id=\"total-requests\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.resetJob({\n job_id: \"total-requests\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.reset_job(\n job_id: \"total-requests\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->resetJob([\n \"job_id\" => \"total-requests\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/total-requests/_reset\"" } ] } @@ -17065,6 +22377,26 @@ { "lang": "Console", "source": "POST _ml/data_frame/analytics/loganalytics/_start\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.start_data_frame_analytics(\n id=\"loganalytics\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.startDataFrameAnalytics({\n id: \"loganalytics\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.start_data_frame_analytics(\n id: \"loganalytics\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->startDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics/_start\"" } ] } @@ -17176,6 +22508,26 @@ { "lang": "Console", "source": "POST _ml/datafeeds/datafeed-low_request_rate/_start\n{\n \"start\": \"2019-04-07T18:22:16Z\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.start_datafeed(\n datafeed_id=\"datafeed-low_request_rate\",\n start=\"2019-04-07T18:22:16Z\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.startDatafeed({\n datafeed_id: \"datafeed-low_request_rate\",\n start: \"2019-04-07T18:22:16Z\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.start_datafeed(\n datafeed_id: \"datafeed-low_request_rate\",\n body: {\n \"start\": \"2019-04-07T18:22:16Z\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->startDatafeed([\n \"datafeed_id\" => \"datafeed-low_request_rate\",\n \"body\" => [\n \"start\" => \"2019-04-07T18:22:16Z\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"start\":\"2019-04-07T18:22:16Z\"}' \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-low_request_rate/_start\"" } ] } @@ -17310,6 +22662,26 @@ { "lang": "Console", "source": "POST _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_start?wait_for=started&timeout=1m\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.start_trained_model_deployment(\n model_id=\"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n wait_for=\"started\",\n timeout=\"1m\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.startTrainedModelDeployment({\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n wait_for: \"started\",\n timeout: \"1m\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.start_trained_model_deployment(\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n wait_for: \"started\",\n timeout: \"1m\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->startTrainedModelDeployment([\n \"model_id\" => \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n \"wait_for\" => \"started\",\n \"timeout\" => \"1m\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_start?wait_for=started&timeout=1m\"" } ] } @@ -17390,6 +22762,26 @@ { "lang": "Console", "source": "POST _ml/data_frame/analytics/loganalytics/_stop\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.stop_data_frame_analytics(\n id=\"loganalytics\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.stopDataFrameAnalytics({\n id: \"loganalytics\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.stop_data_frame_analytics(\n id: \"loganalytics\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->stopDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics/_stop\"" } ] } @@ -17498,6 +22890,26 @@ { "lang": "Console", "source": "POST _ml/datafeeds/datafeed-low_request_rate/_stop\n{\n \"timeout\": \"30s\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.stop_datafeed(\n datafeed_id=\"datafeed-low_request_rate\",\n timeout=\"30s\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.stopDatafeed({\n datafeed_id: \"datafeed-low_request_rate\",\n timeout: \"30s\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.stop_datafeed(\n datafeed_id: \"datafeed-low_request_rate\",\n body: {\n \"timeout\": \"30s\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->stopDatafeed([\n \"datafeed_id\" => \"datafeed-low_request_rate\",\n \"body\" => [\n \"timeout\" => \"30s\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"timeout\":\"30s\"}' \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-low_request_rate/_stop\"" } ] } @@ -17568,6 +22980,26 @@ { "lang": "Console", "source": "POST _ml/trained_models/my_model_for_search/deployment/_stop\n" + }, + { + "lang": "Python", + "source": "resp = client.ml.stop_trained_model_deployment(\n model_id=\"my_model_for_search\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.stopTrainedModelDeployment({\n model_id: \"my_model_for_search\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.stop_trained_model_deployment(\n model_id: \"my_model_for_search\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->stopTrainedModelDeployment([\n \"model_id\" => \"my_model_for_search\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/my_model_for_search/deployment/_stop\"" } ] } @@ -17693,6 +23125,26 @@ { "lang": "Console", "source": "POST _ml/data_frame/analytics/loganalytics/_update\n{\n \"model_memory_limit\": \"200mb\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.update_data_frame_analytics(\n id=\"loganalytics\",\n model_memory_limit=\"200mb\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.updateDataFrameAnalytics({\n id: \"loganalytics\",\n model_memory_limit: \"200mb\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.update_data_frame_analytics(\n id: \"loganalytics\",\n body: {\n \"model_memory_limit\": \"200mb\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->updateDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n \"body\" => [\n \"model_memory_limit\" => \"200mb\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"model_memory_limit\":\"200mb\"}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics/_update\"" } ] } @@ -17911,6 +23363,26 @@ { "lang": "Console", "source": "POST _ml/datafeeds/datafeed-test-job/_update\n{\n \"query\": {\n \"term\": {\n \"geo.src\": \"US\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.update_datafeed(\n datafeed_id=\"datafeed-test-job\",\n query={\n \"term\": {\n \"geo.src\": \"US\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.updateDatafeed({\n datafeed_id: \"datafeed-test-job\",\n query: {\n term: {\n \"geo.src\": \"US\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.update_datafeed(\n datafeed_id: \"datafeed-test-job\",\n body: {\n \"query\": {\n \"term\": {\n \"geo.src\": \"US\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->updateDatafeed([\n \"datafeed_id\" => \"datafeed-test-job\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"geo.src\" => \"US\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"geo.src\":\"US\"}}}' \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-test-job/_update\"" } ] } @@ -18008,6 +23480,26 @@ { "lang": "Console", "source": "POST _ml/filters/safe_domains/_update\n{\n \"description\": \"Updated list of domains\",\n \"add_items\": [\"*.myorg.com\"],\n \"remove_items\": [\"wikipedia.org\"]\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.update_filter(\n filter_id=\"safe_domains\",\n description=\"Updated list of domains\",\n add_items=[\n \"*.myorg.com\"\n ],\n remove_items=[\n \"wikipedia.org\"\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.updateFilter({\n filter_id: \"safe_domains\",\n description: \"Updated list of domains\",\n add_items: [\"*.myorg.com\"],\n remove_items: [\"wikipedia.org\"],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.update_filter(\n filter_id: \"safe_domains\",\n body: {\n \"description\": \"Updated list of domains\",\n \"add_items\": [\n \"*.myorg.com\"\n ],\n \"remove_items\": [\n \"wikipedia.org\"\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->updateFilter([\n \"filter_id\" => \"safe_domains\",\n \"body\" => [\n \"description\" => \"Updated list of domains\",\n \"add_items\" => array(\n \"*.myorg.com\",\n ),\n \"remove_items\" => array(\n \"wikipedia.org\",\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"Updated list of domains\",\"add_items\":[\"*.myorg.com\"],\"remove_items\":[\"wikipedia.org\"]}' \"$ELASTICSEARCH_URL/_ml/filters/safe_domains/_update\"" } ] } @@ -18218,6 +23710,26 @@ { "lang": "Console", "source": "POST _ml/anomaly_detectors/low_request_rate/_update\n{\n \"description\":\"An updated job\",\n \"detectors\": {\n \"detector_index\": 0,\n \"description\": \"An updated detector description\"\n },\n \"groups\": [\"kibana_sample_data\",\"kibana_sample_web_logs\"],\n \"model_plot_config\": {\n \"enabled\": true\n },\n \"renormalization_window_days\": 30,\n \"background_persist_interval\": \"2h\",\n \"model_snapshot_retention_days\": 7,\n \"results_retention_days\": 60\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.update_job(\n job_id=\"low_request_rate\",\n description=\"An updated job\",\n detectors={\n \"detector_index\": 0,\n \"description\": \"An updated detector description\"\n },\n groups=[\n \"kibana_sample_data\",\n \"kibana_sample_web_logs\"\n ],\n model_plot_config={\n \"enabled\": True\n },\n renormalization_window_days=30,\n background_persist_interval=\"2h\",\n model_snapshot_retention_days=7,\n results_retention_days=60,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.updateJob({\n job_id: \"low_request_rate\",\n description: \"An updated job\",\n detectors: {\n detector_index: 0,\n description: \"An updated detector description\",\n },\n groups: [\"kibana_sample_data\", \"kibana_sample_web_logs\"],\n model_plot_config: {\n enabled: true,\n },\n renormalization_window_days: 30,\n background_persist_interval: \"2h\",\n model_snapshot_retention_days: 7,\n results_retention_days: 60,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.update_job(\n job_id: \"low_request_rate\",\n body: {\n \"description\": \"An updated job\",\n \"detectors\": {\n \"detector_index\": 0,\n \"description\": \"An updated detector description\"\n },\n \"groups\": [\n \"kibana_sample_data\",\n \"kibana_sample_web_logs\"\n ],\n \"model_plot_config\": {\n \"enabled\": true\n },\n \"renormalization_window_days\": 30,\n \"background_persist_interval\": \"2h\",\n \"model_snapshot_retention_days\": 7,\n \"results_retention_days\": 60\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->updateJob([\n \"job_id\" => \"low_request_rate\",\n \"body\" => [\n \"description\" => \"An updated job\",\n \"detectors\" => [\n \"detector_index\" => 0,\n \"description\" => \"An updated detector description\",\n ],\n \"groups\" => array(\n \"kibana_sample_data\",\n \"kibana_sample_web_logs\",\n ),\n \"model_plot_config\" => [\n \"enabled\" => true,\n ],\n \"renormalization_window_days\" => 30,\n \"background_persist_interval\" => \"2h\",\n \"model_snapshot_retention_days\" => 7,\n \"results_retention_days\" => 60,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"An updated job\",\"detectors\":{\"detector_index\":0,\"description\":\"An updated detector description\"},\"groups\":[\"kibana_sample_data\",\"kibana_sample_web_logs\"],\"model_plot_config\":{\"enabled\":true},\"renormalization_window_days\":30,\"background_persist_interval\":\"2h\",\"model_snapshot_retention_days\":7,\"results_retention_days\":60}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_update\"" } ] } @@ -18303,6 +23815,26 @@ { "lang": "Console", "source": "POST _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_update\n{\n \"number_of_allocations\": 4\n}" + }, + { + "lang": "Python", + "source": "resp = client.ml.update_trained_model_deployment(\n model_id=\"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n number_of_allocations=4,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.ml.updateTrainedModelDeployment({\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n number_of_allocations: 4,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.ml.update_trained_model_deployment(\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n body: {\n \"number_of_allocations\": 4\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->ml()->updateTrainedModelDeployment([\n \"model_id\" => \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n \"body\" => [\n \"number_of_allocations\" => 4,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"number_of_allocations\":4}' \"$ELASTICSEARCH_URL/_ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_update\"" } ] } @@ -18369,6 +23901,26 @@ { "lang": "Console", "source": "GET my-index-000001/_msearch\n{ }\n{\"query\" : {\"match\" : { \"message\": \"this is a test\"}}}\n{\"index\": \"my-index-000002\"}\n{\"query\" : {\"match_all\" : {}}}" + }, + { + "lang": "Python", + "source": "resp = client.msearch(\n index=\"my-index-000001\",\n searches=[\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.msearch({\n index: \"my-index-000001\",\n searches: [\n {},\n {\n query: {\n match: {\n message: \"this is a test\",\n },\n },\n },\n {\n index: \"my-index-000002\",\n },\n {\n query: {\n match_all: {},\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.msearch(\n index: \"my-index-000001\",\n body: [\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->msearch([\n \"index\" => \"my-index-000001\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"query\" => [\n \"match\" => [\n \"message\" => \"this is a test\",\n ],\n ],\n ],\n [\n \"index\" => \"my-index-000002\",\n ],\n [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{},{\"query\":{\"match\":{\"message\":\"this is a test\"}}},{\"index\":\"my-index-000002\"},{\"query\":{\"match_all\":{}}}]' \"$ELASTICSEARCH_URL/my-index-000001/_msearch\"" } ] }, @@ -18433,6 +23985,26 @@ { "lang": "Console", "source": "GET my-index-000001/_msearch\n{ }\n{\"query\" : {\"match\" : { \"message\": \"this is a test\"}}}\n{\"index\": \"my-index-000002\"}\n{\"query\" : {\"match_all\" : {}}}" + }, + { + "lang": "Python", + "source": "resp = client.msearch(\n index=\"my-index-000001\",\n searches=[\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.msearch({\n index: \"my-index-000001\",\n searches: [\n {},\n {\n query: {\n match: {\n message: \"this is a test\",\n },\n },\n },\n {\n index: \"my-index-000002\",\n },\n {\n query: {\n match_all: {},\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.msearch(\n index: \"my-index-000001\",\n body: [\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->msearch([\n \"index\" => \"my-index-000001\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"query\" => [\n \"match\" => [\n \"message\" => \"this is a test\",\n ],\n ],\n ],\n [\n \"index\" => \"my-index-000002\",\n ],\n [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{},{\"query\":{\"match\":{\"message\":\"this is a test\"}}},{\"index\":\"my-index-000002\"},{\"query\":{\"match_all\":{}}}]' \"$ELASTICSEARCH_URL/my-index-000001/_msearch\"" } ] } @@ -18502,6 +24074,26 @@ { "lang": "Console", "source": "GET my-index-000001/_msearch\n{ }\n{\"query\" : {\"match\" : { \"message\": \"this is a test\"}}}\n{\"index\": \"my-index-000002\"}\n{\"query\" : {\"match_all\" : {}}}" + }, + { + "lang": "Python", + "source": "resp = client.msearch(\n index=\"my-index-000001\",\n searches=[\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.msearch({\n index: \"my-index-000001\",\n searches: [\n {},\n {\n query: {\n match: {\n message: \"this is a test\",\n },\n },\n },\n {\n index: \"my-index-000002\",\n },\n {\n query: {\n match_all: {},\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.msearch(\n index: \"my-index-000001\",\n body: [\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->msearch([\n \"index\" => \"my-index-000001\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"query\" => [\n \"match\" => [\n \"message\" => \"this is a test\",\n ],\n ],\n ],\n [\n \"index\" => \"my-index-000002\",\n ],\n [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{},{\"query\":{\"match\":{\"message\":\"this is a test\"}}},{\"index\":\"my-index-000002\"},{\"query\":{\"match_all\":{}}}]' \"$ELASTICSEARCH_URL/my-index-000001/_msearch\"" } ] }, @@ -18569,6 +24161,26 @@ { "lang": "Console", "source": "GET my-index-000001/_msearch\n{ }\n{\"query\" : {\"match\" : { \"message\": \"this is a test\"}}}\n{\"index\": \"my-index-000002\"}\n{\"query\" : {\"match_all\" : {}}}" + }, + { + "lang": "Python", + "source": "resp = client.msearch(\n index=\"my-index-000001\",\n searches=[\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.msearch({\n index: \"my-index-000001\",\n searches: [\n {},\n {\n query: {\n match: {\n message: \"this is a test\",\n },\n },\n },\n {\n index: \"my-index-000002\",\n },\n {\n query: {\n match_all: {},\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.msearch(\n index: \"my-index-000001\",\n body: [\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->msearch([\n \"index\" => \"my-index-000001\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"query\" => [\n \"match\" => [\n \"message\" => \"this is a test\",\n ],\n ],\n ],\n [\n \"index\" => \"my-index-000002\",\n ],\n [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{},{\"query\":{\"match\":{\"message\":\"this is a test\"}}},{\"index\":\"my-index-000002\"},{\"query\":{\"match_all\":{}}}]' \"$ELASTICSEARCH_URL/my-index-000001/_msearch\"" } ] } @@ -18614,6 +24226,26 @@ { "lang": "Console", "source": "GET my-index/_msearch/template\n{ }\n{ \"id\": \"my-search-template\", \"params\": { \"query_string\": \"hello world\", \"from\": 0, \"size\": 10 }}\n{ }\n{ \"id\": \"my-other-search-template\", \"params\": { \"query_type\": \"match_all\" }}" + }, + { + "lang": "Python", + "source": "resp = client.msearch_template(\n index=\"my-index\",\n search_templates=[\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.msearchTemplate({\n index: \"my-index\",\n search_templates: [\n {},\n {\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 0,\n size: 10,\n },\n },\n {},\n {\n id: \"my-other-search-template\",\n params: {\n query_type: \"match_all\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.msearch_template(\n index: \"my-index\",\n body: [\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->msearchTemplate([\n \"index\" => \"my-index\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 0,\n \"size\" => 10,\n ],\n ],\n new ArrayObject([]),\n [\n \"id\" => \"my-other-search-template\",\n \"params\" => [\n \"query_type\" => \"match_all\",\n ],\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{},{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":0,\"size\":10}},{},{\"id\":\"my-other-search-template\",\"params\":{\"query_type\":\"match_all\"}}]' \"$ELASTICSEARCH_URL/my-index/_msearch/template\"" } ] }, @@ -18657,6 +24289,26 @@ { "lang": "Console", "source": "GET my-index/_msearch/template\n{ }\n{ \"id\": \"my-search-template\", \"params\": { \"query_string\": \"hello world\", \"from\": 0, \"size\": 10 }}\n{ }\n{ \"id\": \"my-other-search-template\", \"params\": { \"query_type\": \"match_all\" }}" + }, + { + "lang": "Python", + "source": "resp = client.msearch_template(\n index=\"my-index\",\n search_templates=[\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.msearchTemplate({\n index: \"my-index\",\n search_templates: [\n {},\n {\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 0,\n size: 10,\n },\n },\n {},\n {\n id: \"my-other-search-template\",\n params: {\n query_type: \"match_all\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.msearch_template(\n index: \"my-index\",\n body: [\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->msearchTemplate([\n \"index\" => \"my-index\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 0,\n \"size\" => 10,\n ],\n ],\n new ArrayObject([]),\n [\n \"id\" => \"my-other-search-template\",\n \"params\" => [\n \"query_type\" => \"match_all\",\n ],\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{},{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":0,\"size\":10}},{},{\"id\":\"my-other-search-template\",\"params\":{\"query_type\":\"match_all\"}}]' \"$ELASTICSEARCH_URL/my-index/_msearch/template\"" } ] } @@ -18705,6 +24357,26 @@ { "lang": "Console", "source": "GET my-index/_msearch/template\n{ }\n{ \"id\": \"my-search-template\", \"params\": { \"query_string\": \"hello world\", \"from\": 0, \"size\": 10 }}\n{ }\n{ \"id\": \"my-other-search-template\", \"params\": { \"query_type\": \"match_all\" }}" + }, + { + "lang": "Python", + "source": "resp = client.msearch_template(\n index=\"my-index\",\n search_templates=[\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.msearchTemplate({\n index: \"my-index\",\n search_templates: [\n {},\n {\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 0,\n size: 10,\n },\n },\n {},\n {\n id: \"my-other-search-template\",\n params: {\n query_type: \"match_all\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.msearch_template(\n index: \"my-index\",\n body: [\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->msearchTemplate([\n \"index\" => \"my-index\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 0,\n \"size\" => 10,\n ],\n ],\n new ArrayObject([]),\n [\n \"id\" => \"my-other-search-template\",\n \"params\" => [\n \"query_type\" => \"match_all\",\n ],\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{},{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":0,\"size\":10}},{},{\"id\":\"my-other-search-template\",\"params\":{\"query_type\":\"match_all\"}}]' \"$ELASTICSEARCH_URL/my-index/_msearch/template\"" } ] }, @@ -18751,6 +24423,26 @@ { "lang": "Console", "source": "GET my-index/_msearch/template\n{ }\n{ \"id\": \"my-search-template\", \"params\": { \"query_string\": \"hello world\", \"from\": 0, \"size\": 10 }}\n{ }\n{ \"id\": \"my-other-search-template\", \"params\": { \"query_type\": \"match_all\" }}" + }, + { + "lang": "Python", + "source": "resp = client.msearch_template(\n index=\"my-index\",\n search_templates=[\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.msearchTemplate({\n index: \"my-index\",\n search_templates: [\n {},\n {\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 0,\n size: 10,\n },\n },\n {},\n {\n id: \"my-other-search-template\",\n params: {\n query_type: \"match_all\",\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.msearch_template(\n index: \"my-index\",\n body: [\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ]\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->msearchTemplate([\n \"index\" => \"my-index\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 0,\n \"size\" => 10,\n ],\n ],\n new ArrayObject([]),\n [\n \"id\" => \"my-other-search-template\",\n \"params\" => [\n \"query_type\" => \"match_all\",\n ],\n ],\n ),\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{},{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":0,\"size\":10}},{},{\"id\":\"my-other-search-template\",\"params\":{\"query_type\":\"match_all\"}}]' \"$ELASTICSEARCH_URL/my-index/_msearch/template\"" } ] } @@ -18813,6 +24505,26 @@ { "lang": "Console", "source": "POST /my-index-000001/_mtermvectors\n{\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.mtermvectors(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": True\n },\n {\n \"_id\": \"1\"\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.mtermvectors({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"2\",\n fields: [\"message\"],\n term_statistics: true,\n },\n {\n _id: \"1\",\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.mtermvectors(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->mtermvectors([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"2\",\n \"fields\" => array(\n \"message\",\n ),\n \"term_statistics\" => true,\n ],\n [\n \"_id\" => \"1\",\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":\"2\",\"fields\":[\"message\"],\"term_statistics\":true},{\"_id\":\"1\"}]}' \"$ELASTICSEARCH_URL/my-index-000001/_mtermvectors\"" } ] }, @@ -18873,6 +24585,26 @@ { "lang": "Console", "source": "POST /my-index-000001/_mtermvectors\n{\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.mtermvectors(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": True\n },\n {\n \"_id\": \"1\"\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.mtermvectors({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"2\",\n fields: [\"message\"],\n term_statistics: true,\n },\n {\n _id: \"1\",\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.mtermvectors(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->mtermvectors([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"2\",\n \"fields\" => array(\n \"message\",\n ),\n \"term_statistics\" => true,\n ],\n [\n \"_id\" => \"1\",\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":\"2\",\"fields\":[\"message\"],\"term_statistics\":true},{\"_id\":\"1\"}]}' \"$ELASTICSEARCH_URL/my-index-000001/_mtermvectors\"" } ] } @@ -18938,6 +24670,26 @@ { "lang": "Console", "source": "POST /my-index-000001/_mtermvectors\n{\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.mtermvectors(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": True\n },\n {\n \"_id\": \"1\"\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.mtermvectors({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"2\",\n fields: [\"message\"],\n term_statistics: true,\n },\n {\n _id: \"1\",\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.mtermvectors(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->mtermvectors([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"2\",\n \"fields\" => array(\n \"message\",\n ),\n \"term_statistics\" => true,\n ],\n [\n \"_id\" => \"1\",\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":\"2\",\"fields\":[\"message\"],\"term_statistics\":true},{\"_id\":\"1\"}]}' \"$ELASTICSEARCH_URL/my-index-000001/_mtermvectors\"" } ] }, @@ -19001,6 +24753,26 @@ { "lang": "Console", "source": "POST /my-index-000001/_mtermvectors\n{\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.mtermvectors(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": True\n },\n {\n \"_id\": \"1\"\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.mtermvectors({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"2\",\n fields: [\"message\"],\n term_statistics: true,\n },\n {\n _id: \"1\",\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.mtermvectors(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->mtermvectors([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"2\",\n \"fields\" => array(\n \"message\",\n ),\n \"term_statistics\" => true,\n ],\n [\n \"_id\" => \"1\",\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":\"2\",\"fields\":[\"message\"],\"term_statistics\":true},{\"_id\":\"1\"}]}' \"$ELASTICSEARCH_URL/my-index-000001/_mtermvectors\"" } ] } @@ -19146,6 +24918,26 @@ { "lang": "Console", "source": "POST /my-index-000001/_pit?keep_alive=1m&allow_partial_search_results=true\n" + }, + { + "lang": "Python", + "source": "resp = client.open_point_in_time(\n index=\"my-index-000001\",\n keep_alive=\"1m\",\n allow_partial_search_results=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.openPointInTime({\n index: \"my-index-000001\",\n keep_alive: \"1m\",\n allow_partial_search_results: \"true\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.open_point_in_time(\n index: \"my-index-000001\",\n keep_alive: \"1m\",\n allow_partial_search_results: \"true\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->openPointInTime([\n \"index\" => \"my-index-000001\",\n \"keep_alive\" => \"1m\",\n \"allow_partial_search_results\" => \"true\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_pit?keep_alive=1m&allow_partial_search_results=true\"" } ] } @@ -19190,6 +24982,26 @@ { "lang": "Console", "source": "PUT _scripts/my-search-template\n{\n \"script\": {\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.put_script(\n id=\"my-search-template\",\n script={\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.putScript({\n id: \"my-search-template\",\n script: {\n lang: \"mustache\",\n source: {\n query: {\n match: {\n message: \"{{query_string}}\",\n },\n },\n from: \"{{from}}\",\n size: \"{{size}}\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.put_script(\n id: \"my-search-template\",\n body: {\n \"script\": {\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->putScript([\n \"id\" => \"my-search-template\",\n \"body\" => [\n \"script\" => [\n \"lang\" => \"mustache\",\n \"source\" => [\n \"query\" => [\n \"match\" => [\n \"message\" => \"{{query_string}}\",\n ],\n ],\n \"from\" => \"{{from}}\",\n \"size\" => \"{{size}}\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"lang\":\"mustache\",\"source\":{\"query\":{\"match\":{\"message\":\"{{query_string}}\"}},\"from\":\"{{from}}\",\"size\":\"{{size}}\"}}}' \"$ELASTICSEARCH_URL/_scripts/my-search-template\"" } ] }, @@ -19232,6 +25044,26 @@ { "lang": "Console", "source": "PUT _scripts/my-search-template\n{\n \"script\": {\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.put_script(\n id=\"my-search-template\",\n script={\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.putScript({\n id: \"my-search-template\",\n script: {\n lang: \"mustache\",\n source: {\n query: {\n match: {\n message: \"{{query_string}}\",\n },\n },\n from: \"{{from}}\",\n size: \"{{size}}\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.put_script(\n id: \"my-search-template\",\n body: {\n \"script\": {\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->putScript([\n \"id\" => \"my-search-template\",\n \"body\" => [\n \"script\" => [\n \"lang\" => \"mustache\",\n \"source\" => [\n \"query\" => [\n \"match\" => [\n \"message\" => \"{{query_string}}\",\n ],\n ],\n \"from\" => \"{{from}}\",\n \"size\" => \"{{size}}\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"lang\":\"mustache\",\"source\":{\"query\":{\"match\":{\"message\":\"{{query_string}}\"}},\"from\":\"{{from}}\",\"size\":\"{{size}}\"}}}' \"$ELASTICSEARCH_URL/_scripts/my-search-template\"" } ] } @@ -19294,6 +25126,26 @@ { "lang": "Console", "source": "GET _query_rules/my-ruleset/_rule/my-rule1\n" + }, + { + "lang": "Python", + "source": "resp = client.query_rules.get_rule(\n ruleset_id=\"my-ruleset\",\n rule_id=\"my-rule1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.queryRules.getRule({\n ruleset_id: \"my-ruleset\",\n rule_id: \"my-rule1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.query_rules.get_rule(\n ruleset_id: \"my-ruleset\",\n rule_id: \"my-rule1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->queryRules()->getRule([\n \"ruleset_id\" => \"my-ruleset\",\n \"rule_id\" => \"my-rule1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/my-ruleset/_rule/my-rule1\"" } ] }, @@ -19399,6 +25251,26 @@ { "lang": "Console", "source": "POST _query_rules/my-ruleset/_test\n{\n \"match_criteria\": {\n \"query_string\": \"puggles\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.query_rules.test(\n ruleset_id=\"my-ruleset\",\n match_criteria={\n \"query_string\": \"puggles\"\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.queryRules.test({\n ruleset_id: \"my-ruleset\",\n match_criteria: {\n query_string: \"puggles\",\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.query_rules.test(\n ruleset_id: \"my-ruleset\",\n body: {\n \"match_criteria\": {\n \"query_string\": \"puggles\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->queryRules()->test([\n \"ruleset_id\" => \"my-ruleset\",\n \"body\" => [\n \"match_criteria\" => [\n \"query_string\" => \"puggles\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"match_criteria\":{\"query_string\":\"puggles\"}}' \"$ELASTICSEARCH_URL/_query_rules/my-ruleset/_test\"" } ] }, @@ -19450,6 +25322,26 @@ { "lang": "Console", "source": "DELETE _query_rules/my-ruleset/_rule/my-rule1\n" + }, + { + "lang": "Python", + "source": "resp = client.query_rules.delete_rule(\n ruleset_id=\"my-ruleset\",\n rule_id=\"my-rule1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.queryRules.deleteRule({\n ruleset_id: \"my-ruleset\",\n rule_id: \"my-rule1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.query_rules.delete_rule(\n ruleset_id: \"my-ruleset\",\n rule_id: \"my-rule1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->queryRules()->deleteRule([\n \"ruleset_id\" => \"my-ruleset\",\n \"rule_id\" => \"my-rule1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/my-ruleset/_rule/my-rule1\"" } ] } @@ -19498,6 +25390,26 @@ { "lang": "Console", "source": "GET _query_rules/my-ruleset/\n" + }, + { + "lang": "Python", + "source": "resp = client.query_rules.get_ruleset(\n ruleset_id=\"my-ruleset\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.queryRules.getRuleset({\n ruleset_id: \"my-ruleset\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.query_rules.get_ruleset(\n ruleset_id: \"my-ruleset\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->queryRules()->getRuleset([\n \"ruleset_id\" => \"my-ruleset\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/my-ruleset/\"" } ] }, @@ -19583,6 +25495,26 @@ { "lang": "Console", "source": "PUT _query_rules/my-ruleset\n{\n \"rules\": [\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [ \"pugs\", \"puggles\" ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [ \"us\" ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [ \"rescue dogs\" ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.query_rules.put_ruleset(\n ruleset_id=\"my-ruleset\",\n rules=[\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"pugs\",\n \"puggles\"\n ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [\n \"us\"\n ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"rescue dogs\"\n ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.queryRules.putRuleset({\n ruleset_id: \"my-ruleset\",\n rules: [\n {\n rule_id: \"my-rule1\",\n type: \"pinned\",\n criteria: [\n {\n type: \"contains\",\n metadata: \"user_query\",\n values: [\"pugs\", \"puggles\"],\n },\n {\n type: \"exact\",\n metadata: \"user_country\",\n values: [\"us\"],\n },\n ],\n actions: {\n ids: [\"id1\", \"id2\"],\n },\n },\n {\n rule_id: \"my-rule2\",\n type: \"pinned\",\n criteria: [\n {\n type: \"fuzzy\",\n metadata: \"user_query\",\n values: [\"rescue dogs\"],\n },\n ],\n actions: {\n docs: [\n {\n _index: \"index1\",\n _id: \"id3\",\n },\n {\n _index: \"index2\",\n _id: \"id4\",\n },\n ],\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.query_rules.put_ruleset(\n ruleset_id: \"my-ruleset\",\n body: {\n \"rules\": [\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"pugs\",\n \"puggles\"\n ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [\n \"us\"\n ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"rescue dogs\"\n ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->queryRules()->putRuleset([\n \"ruleset_id\" => \"my-ruleset\",\n \"body\" => [\n \"rules\" => array(\n [\n \"rule_id\" => \"my-rule1\",\n \"type\" => \"pinned\",\n \"criteria\" => array(\n [\n \"type\" => \"contains\",\n \"metadata\" => \"user_query\",\n \"values\" => array(\n \"pugs\",\n \"puggles\",\n ),\n ],\n [\n \"type\" => \"exact\",\n \"metadata\" => \"user_country\",\n \"values\" => array(\n \"us\",\n ),\n ],\n ),\n \"actions\" => [\n \"ids\" => array(\n \"id1\",\n \"id2\",\n ),\n ],\n ],\n [\n \"rule_id\" => \"my-rule2\",\n \"type\" => \"pinned\",\n \"criteria\" => array(\n [\n \"type\" => \"fuzzy\",\n \"metadata\" => \"user_query\",\n \"values\" => array(\n \"rescue dogs\",\n ),\n ],\n ),\n \"actions\" => [\n \"docs\" => array(\n [\n \"_index\" => \"index1\",\n \"_id\" => \"id3\",\n ],\n [\n \"_index\" => \"index2\",\n \"_id\" => \"id4\",\n ],\n ),\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"rules\":[{\"rule_id\":\"my-rule1\",\"type\":\"pinned\",\"criteria\":[{\"type\":\"contains\",\"metadata\":\"user_query\",\"values\":[\"pugs\",\"puggles\"]},{\"type\":\"exact\",\"metadata\":\"user_country\",\"values\":[\"us\"]}],\"actions\":{\"ids\":[\"id1\",\"id2\"]}},{\"rule_id\":\"my-rule2\",\"type\":\"pinned\",\"criteria\":[{\"type\":\"fuzzy\",\"metadata\":\"user_query\",\"values\":[\"rescue dogs\"]}],\"actions\":{\"docs\":[{\"_index\":\"index1\",\"_id\":\"id3\"},{\"_index\":\"index2\",\"_id\":\"id4\"}]}}]}' \"$ELASTICSEARCH_URL/_query_rules/my-ruleset\"" } ] }, @@ -19623,6 +25555,26 @@ { "lang": "Console", "source": "DELETE _query_rules/my-ruleset/\n" + }, + { + "lang": "Python", + "source": "resp = client.query_rules.delete_ruleset(\n ruleset_id=\"my-ruleset\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.queryRules.deleteRuleset({\n ruleset_id: \"my-ruleset\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.query_rules.delete_ruleset(\n ruleset_id: \"my-ruleset\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->queryRules()->deleteRuleset([\n \"ruleset_id\" => \"my-ruleset\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/my-ruleset/\"" } ] } @@ -19695,6 +25647,26 @@ { "lang": "Console", "source": "GET _query_rules/?from=0&size=3\n" + }, + { + "lang": "Python", + "source": "resp = client.query_rules.list_rulesets(\n from=\"0\",\n size=\"3\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.queryRules.listRulesets({\n from: 0,\n size: 3,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.query_rules.list_rulesets(\n from: \"0\",\n size: \"3\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->queryRules()->listRulesets([\n \"from\" => \"0\",\n \"size\" => \"3\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/?from=0&size=3\"" } ] } @@ -19786,6 +25758,26 @@ { "lang": "Console", "source": "PUT _query_rules/my-ruleset\n{\n \"rules\": [\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [ \"pugs\", \"puggles\" ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [ \"us\" ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [ \"rescue dogs\" ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.query_rules.put_ruleset(\n ruleset_id=\"my-ruleset\",\n rules=[\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"pugs\",\n \"puggles\"\n ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [\n \"us\"\n ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"rescue dogs\"\n ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.queryRules.putRuleset({\n ruleset_id: \"my-ruleset\",\n rules: [\n {\n rule_id: \"my-rule1\",\n type: \"pinned\",\n criteria: [\n {\n type: \"contains\",\n metadata: \"user_query\",\n values: [\"pugs\", \"puggles\"],\n },\n {\n type: \"exact\",\n metadata: \"user_country\",\n values: [\"us\"],\n },\n ],\n actions: {\n ids: [\"id1\", \"id2\"],\n },\n },\n {\n rule_id: \"my-rule2\",\n type: \"pinned\",\n criteria: [\n {\n type: \"fuzzy\",\n metadata: \"user_query\",\n values: [\"rescue dogs\"],\n },\n ],\n actions: {\n docs: [\n {\n _index: \"index1\",\n _id: \"id3\",\n },\n {\n _index: \"index2\",\n _id: \"id4\",\n },\n ],\n },\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.query_rules.put_ruleset(\n ruleset_id: \"my-ruleset\",\n body: {\n \"rules\": [\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"pugs\",\n \"puggles\"\n ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [\n \"us\"\n ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"rescue dogs\"\n ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->queryRules()->putRuleset([\n \"ruleset_id\" => \"my-ruleset\",\n \"body\" => [\n \"rules\" => array(\n [\n \"rule_id\" => \"my-rule1\",\n \"type\" => \"pinned\",\n \"criteria\" => array(\n [\n \"type\" => \"contains\",\n \"metadata\" => \"user_query\",\n \"values\" => array(\n \"pugs\",\n \"puggles\",\n ),\n ],\n [\n \"type\" => \"exact\",\n \"metadata\" => \"user_country\",\n \"values\" => array(\n \"us\",\n ),\n ],\n ),\n \"actions\" => [\n \"ids\" => array(\n \"id1\",\n \"id2\",\n ),\n ],\n ],\n [\n \"rule_id\" => \"my-rule2\",\n \"type\" => \"pinned\",\n \"criteria\" => array(\n [\n \"type\" => \"fuzzy\",\n \"metadata\" => \"user_query\",\n \"values\" => array(\n \"rescue dogs\",\n ),\n ],\n ),\n \"actions\" => [\n \"docs\" => array(\n [\n \"_index\" => \"index1\",\n \"_id\" => \"id3\",\n ],\n [\n \"_index\" => \"index2\",\n \"_id\" => \"id4\",\n ],\n ),\n ],\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"rules\":[{\"rule_id\":\"my-rule1\",\"type\":\"pinned\",\"criteria\":[{\"type\":\"contains\",\"metadata\":\"user_query\",\"values\":[\"pugs\",\"puggles\"]},{\"type\":\"exact\",\"metadata\":\"user_country\",\"values\":[\"us\"]}],\"actions\":{\"ids\":[\"id1\",\"id2\"]}},{\"rule_id\":\"my-rule2\",\"type\":\"pinned\",\"criteria\":[{\"type\":\"fuzzy\",\"metadata\":\"user_query\",\"values\":[\"rescue dogs\"]}],\"actions\":{\"docs\":[{\"_index\":\"index1\",\"_id\":\"id3\"},{\"_index\":\"index2\",\"_id\":\"id4\"}]}}]}' \"$ELASTICSEARCH_URL/_query_rules/my-ruleset\"" } ] } @@ -19825,6 +25817,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_rank_eval\n{\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": { \"query\": { \"match_all\": {} } },\n \"ratings\": []\n } ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.rank_eval(\n index=\"my-index-000001\",\n requests=[\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n metric={\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": False\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.rankEval({\n index: \"my-index-000001\",\n requests: [\n {\n id: \"JFK query\",\n request: {\n query: {\n match_all: {},\n },\n },\n ratings: [],\n },\n ],\n metric: {\n precision: {\n k: 20,\n relevant_rating_threshold: 1,\n ignore_unlabeled: false,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.rank_eval(\n index: \"my-index-000001\",\n body: {\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->rankEval([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"requests\" => array(\n [\n \"id\" => \"JFK query\",\n \"request\" => [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n \"ratings\" => array(\n ),\n ],\n ),\n \"metric\" => [\n \"precision\" => [\n \"k\" => 20,\n \"relevant_rating_threshold\" => 1,\n \"ignore_unlabeled\" => false,\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"requests\":[{\"id\":\"JFK query\",\"request\":{\"query\":{\"match_all\":{}}},\"ratings\":[]}],\"metric\":{\"precision\":{\"k\":20,\"relevant_rating_threshold\":1,\"ignore_unlabeled\":false}}}' \"$ELASTICSEARCH_URL/my-index-000001/_rank_eval\"" } ] }, @@ -19862,6 +25874,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_rank_eval\n{\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": { \"query\": { \"match_all\": {} } },\n \"ratings\": []\n } ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.rank_eval(\n index=\"my-index-000001\",\n requests=[\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n metric={\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": False\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.rankEval({\n index: \"my-index-000001\",\n requests: [\n {\n id: \"JFK query\",\n request: {\n query: {\n match_all: {},\n },\n },\n ratings: [],\n },\n ],\n metric: {\n precision: {\n k: 20,\n relevant_rating_threshold: 1,\n ignore_unlabeled: false,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.rank_eval(\n index: \"my-index-000001\",\n body: {\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->rankEval([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"requests\" => array(\n [\n \"id\" => \"JFK query\",\n \"request\" => [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n \"ratings\" => array(\n ),\n ],\n ),\n \"metric\" => [\n \"precision\" => [\n \"k\" => 20,\n \"relevant_rating_threshold\" => 1,\n \"ignore_unlabeled\" => false,\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"requests\":[{\"id\":\"JFK query\",\"request\":{\"query\":{\"match_all\":{}}},\"ratings\":[]}],\"metric\":{\"precision\":{\"k\":20,\"relevant_rating_threshold\":1,\"ignore_unlabeled\":false}}}' \"$ELASTICSEARCH_URL/my-index-000001/_rank_eval\"" } ] } @@ -19904,6 +25936,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_rank_eval\n{\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": { \"query\": { \"match_all\": {} } },\n \"ratings\": []\n } ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.rank_eval(\n index=\"my-index-000001\",\n requests=[\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n metric={\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": False\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.rankEval({\n index: \"my-index-000001\",\n requests: [\n {\n id: \"JFK query\",\n request: {\n query: {\n match_all: {},\n },\n },\n ratings: [],\n },\n ],\n metric: {\n precision: {\n k: 20,\n relevant_rating_threshold: 1,\n ignore_unlabeled: false,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.rank_eval(\n index: \"my-index-000001\",\n body: {\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->rankEval([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"requests\" => array(\n [\n \"id\" => \"JFK query\",\n \"request\" => [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n \"ratings\" => array(\n ),\n ],\n ),\n \"metric\" => [\n \"precision\" => [\n \"k\" => 20,\n \"relevant_rating_threshold\" => 1,\n \"ignore_unlabeled\" => false,\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"requests\":[{\"id\":\"JFK query\",\"request\":{\"query\":{\"match_all\":{}}},\"ratings\":[]}],\"metric\":{\"precision\":{\"k\":20,\"relevant_rating_threshold\":1,\"ignore_unlabeled\":false}}}' \"$ELASTICSEARCH_URL/my-index-000001/_rank_eval\"" } ] }, @@ -19944,6 +25996,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_rank_eval\n{\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": { \"query\": { \"match_all\": {} } },\n \"ratings\": []\n } ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.rank_eval(\n index=\"my-index-000001\",\n requests=[\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n metric={\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": False\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.rankEval({\n index: \"my-index-000001\",\n requests: [\n {\n id: \"JFK query\",\n request: {\n query: {\n match_all: {},\n },\n },\n ratings: [],\n },\n ],\n metric: {\n precision: {\n k: 20,\n relevant_rating_threshold: 1,\n ignore_unlabeled: false,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.rank_eval(\n index: \"my-index-000001\",\n body: {\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->rankEval([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"requests\" => array(\n [\n \"id\" => \"JFK query\",\n \"request\" => [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n \"ratings\" => array(\n ),\n ],\n ),\n \"metric\" => [\n \"precision\" => [\n \"k\" => 20,\n \"relevant_rating_threshold\" => 1,\n \"ignore_unlabeled\" => false,\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"requests\":[{\"id\":\"JFK query\",\"request\":{\"query\":{\"match_all\":{}}},\"ratings\":[]}],\"metric\":{\"precision\":{\"k\":20,\"relevant_rating_threshold\":1,\"ignore_unlabeled\":false}}}' \"$ELASTICSEARCH_URL/my-index-000001/_rank_eval\"" } ] } @@ -20220,6 +26292,26 @@ { "lang": "Console", "source": "POST _reindex\n{\n \"source\": {\n \"index\": [\"my-index-000001\", \"my-index-000002\"]\n },\n \"dest\": {\n \"index\": \"my-new-index-000002\"\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.reindex(\n source={\n \"index\": [\n \"my-index-000001\",\n \"my-index-000002\"\n ]\n },\n dest={\n \"index\": \"my-new-index-000002\"\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.reindex({\n source: {\n index: [\"my-index-000001\", \"my-index-000002\"],\n },\n dest: {\n index: \"my-new-index-000002\",\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.reindex(\n body: {\n \"source\": {\n \"index\": [\n \"my-index-000001\",\n \"my-index-000002\"\n ]\n },\n \"dest\": {\n \"index\": \"my-new-index-000002\"\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->reindex([\n \"body\" => [\n \"source\" => [\n \"index\" => array(\n \"my-index-000001\",\n \"my-index-000002\",\n ),\n ],\n \"dest\" => [\n \"index\" => \"my-new-index-000002\",\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":[\"my-index-000001\",\"my-index-000002\"]},\"dest\":{\"index\":\"my-new-index-000002\"}}' \"$ELASTICSEARCH_URL/_reindex\"" } ] } @@ -20244,6 +26336,26 @@ { "lang": "Console", "source": "POST _render/template\n{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.render_search_template(\n id=\"my-search-template\",\n params={\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.renderSearchTemplate({\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 20,\n size: 10,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.render_search_template(\n body: {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->renderSearchTemplate([\n \"body\" => [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 20,\n \"size\" => 10,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":20,\"size\":10}}' \"$ELASTICSEARCH_URL/_render/template\"" } ] }, @@ -20266,6 +26378,26 @@ { "lang": "Console", "source": "POST _render/template\n{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.render_search_template(\n id=\"my-search-template\",\n params={\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.renderSearchTemplate({\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 20,\n size: 10,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.render_search_template(\n body: {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->renderSearchTemplate([\n \"body\" => [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 20,\n \"size\" => 10,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":20,\"size\":10}}' \"$ELASTICSEARCH_URL/_render/template\"" } ] } @@ -20295,6 +26427,26 @@ { "lang": "Console", "source": "POST _render/template\n{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.render_search_template(\n id=\"my-search-template\",\n params={\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.renderSearchTemplate({\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 20,\n size: 10,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.render_search_template(\n body: {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->renderSearchTemplate([\n \"body\" => [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 20,\n \"size\" => 10,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":20,\"size\":10}}' \"$ELASTICSEARCH_URL/_render/template\"" } ] }, @@ -20322,6 +26474,26 @@ { "lang": "Console", "source": "POST _render/template\n{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.render_search_template(\n id=\"my-search-template\",\n params={\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.renderSearchTemplate({\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 20,\n size: 10,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.render_search_template(\n body: {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->renderSearchTemplate([\n \"body\" => [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 20,\n \"size\" => 10,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":20,\"size\":10}}' \"$ELASTICSEARCH_URL/_render/template\"" } ] } @@ -20347,6 +26519,26 @@ { "lang": "Console", "source": "POST /_scripts/painless/_execute\n{\n \"script\": {\n \"source\": \"params.count / params.total\",\n \"params\": {\n \"count\": 100.0,\n \"total\": 1000.0\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.scripts_painless_execute(\n script={\n \"source\": \"params.count / params.total\",\n \"params\": {\n \"count\": 100,\n \"total\": 1000\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.scriptsPainlessExecute({\n script: {\n source: \"params.count / params.total\",\n params: {\n count: 100,\n total: 1000,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.scripts_painless_execute(\n body: {\n \"script\": {\n \"source\": \"params.count / params.total\",\n \"params\": {\n \"count\": 100,\n \"total\": 1000\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->scriptsPainlessExecute([\n \"body\" => [\n \"script\" => [\n \"source\" => \"params.count / params.total\",\n \"params\" => [\n \"count\" => 100,\n \"total\" => 1000,\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"source\":\"params.count / params.total\",\"params\":{\"count\":100,\"total\":1000}}}' \"$ELASTICSEARCH_URL/_scripts/painless/_execute\"" } ] }, @@ -20370,6 +26562,26 @@ { "lang": "Console", "source": "POST /_scripts/painless/_execute\n{\n \"script\": {\n \"source\": \"params.count / params.total\",\n \"params\": {\n \"count\": 100.0,\n \"total\": 1000.0\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.scripts_painless_execute(\n script={\n \"source\": \"params.count / params.total\",\n \"params\": {\n \"count\": 100,\n \"total\": 1000\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.scriptsPainlessExecute({\n script: {\n source: \"params.count / params.total\",\n params: {\n count: 100,\n total: 1000,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.scripts_painless_execute(\n body: {\n \"script\": {\n \"source\": \"params.count / params.total\",\n \"params\": {\n \"count\": 100,\n \"total\": 1000\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->scriptsPainlessExecute([\n \"body\" => [\n \"script\" => [\n \"source\" => \"params.count / params.total\",\n \"params\" => [\n \"count\" => 100,\n \"total\" => 1000,\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"source\":\"params.count / params.total\",\"params\":{\"count\":100,\"total\":1000}}}' \"$ELASTICSEARCH_URL/_scripts/painless/_execute\"" } ] } @@ -20528,6 +26740,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_search?from=40&size=20\n{\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search(\n index=\"my-index-000001\",\n from=\"40\",\n size=\"20\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.search({\n index: \"my-index-000001\",\n from: 40,\n size: 20,\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search(\n index: \"my-index-000001\",\n from: \"40\",\n size: \"20\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->search([\n \"index\" => \"my-index-000001\",\n \"from\" => \"40\",\n \"size\" => \"20\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_search?from=40&size=20\"" } ] }, @@ -20684,6 +26916,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_search?from=40&size=20\n{\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search(\n index=\"my-index-000001\",\n from=\"40\",\n size=\"20\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.search({\n index: \"my-index-000001\",\n from: 40,\n size: 20,\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search(\n index: \"my-index-000001\",\n from: \"40\",\n size: \"20\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->search([\n \"index\" => \"my-index-000001\",\n \"from\" => \"40\",\n \"size\" => \"20\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_search?from=40&size=20\"" } ] } @@ -20845,6 +27097,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_search?from=40&size=20\n{\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search(\n index=\"my-index-000001\",\n from=\"40\",\n size=\"20\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.search({\n index: \"my-index-000001\",\n from: 40,\n size: 20,\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search(\n index: \"my-index-000001\",\n from: \"40\",\n size: \"20\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->search([\n \"index\" => \"my-index-000001\",\n \"from\" => \"40\",\n \"size\" => \"20\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_search?from=40&size=20\"" } ] }, @@ -21004,6 +27276,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_search?from=40&size=20\n{\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search(\n index=\"my-index-000001\",\n from=\"40\",\n size=\"20\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.search({\n index: \"my-index-000001\",\n from: 40,\n size: 20,\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search(\n index: \"my-index-000001\",\n from: \"40\",\n size: \"20\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->search([\n \"index\" => \"my-index-000001\",\n \"from\" => \"40\",\n \"size\" => \"20\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_search?from=40&size=20\"" } ] } @@ -21052,6 +27344,26 @@ { "lang": "Console", "source": "GET _application/search_application/my-app/\n" + }, + { + "lang": "Python", + "source": "resp = client.search_application.get(\n name=\"my-app\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchApplication.get({\n name: \"my-app\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_application.get(\n name: \"my-app\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchApplication()->get([\n \"name\" => \"my-app\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/search_application/my-app/\"" } ] }, @@ -21126,6 +27438,26 @@ { "lang": "Console", "source": "PUT _application/search_application/my-app\n{\n \"indices\": [ \"index1\", \"index2\" ],\n \"template\": {\n \"script\": {\n \"source\": {\n \"query\": {\n \"query_string\": {\n \"query\": \"{{query_string}}\",\n \"default_field\": \"{{default_field}}\"\n }\n }\n },\n \"params\": {\n \"query_string\": \"*\",\n \"default_field\": \"*\"\n }\n },\n \"dictionary\": {\n \"properties\": {\n \"query_string\": {\n \"type\": \"string\"\n },\n \"default_field\": {\n \"type\": \"string\",\n \"enum\": [\n \"title\",\n \"description\"\n ]\n },\n \"additionalProperties\": false\n },\n \"required\": [\n \"query_string\"\n ]\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search_application.put(\n name=\"my-app\",\n search_application={\n \"indices\": [\n \"index1\",\n \"index2\"\n ],\n \"template\": {\n \"script\": {\n \"source\": {\n \"query\": {\n \"query_string\": {\n \"query\": \"{{query_string}}\",\n \"default_field\": \"{{default_field}}\"\n }\n }\n },\n \"params\": {\n \"query_string\": \"*\",\n \"default_field\": \"*\"\n }\n },\n \"dictionary\": {\n \"properties\": {\n \"query_string\": {\n \"type\": \"string\"\n },\n \"default_field\": {\n \"type\": \"string\",\n \"enum\": [\n \"title\",\n \"description\"\n ]\n },\n \"additionalProperties\": False\n },\n \"required\": [\n \"query_string\"\n ]\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchApplication.put({\n name: \"my-app\",\n search_application: {\n indices: [\"index1\", \"index2\"],\n template: {\n script: {\n source: {\n query: {\n query_string: {\n query: \"{{query_string}}\",\n default_field: \"{{default_field}}\",\n },\n },\n },\n params: {\n query_string: \"*\",\n default_field: \"*\",\n },\n },\n dictionary: {\n properties: {\n query_string: {\n type: \"string\",\n },\n default_field: {\n type: \"string\",\n enum: [\"title\", \"description\"],\n },\n additionalProperties: false,\n },\n required: [\"query_string\"],\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_application.put(\n name: \"my-app\",\n body: {\n \"indices\": [\n \"index1\",\n \"index2\"\n ],\n \"template\": {\n \"script\": {\n \"source\": {\n \"query\": {\n \"query_string\": {\n \"query\": \"{{query_string}}\",\n \"default_field\": \"{{default_field}}\"\n }\n }\n },\n \"params\": {\n \"query_string\": \"*\",\n \"default_field\": \"*\"\n }\n },\n \"dictionary\": {\n \"properties\": {\n \"query_string\": {\n \"type\": \"string\"\n },\n \"default_field\": {\n \"type\": \"string\",\n \"enum\": [\n \"title\",\n \"description\"\n ]\n },\n \"additionalProperties\": false\n },\n \"required\": [\n \"query_string\"\n ]\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchApplication()->put([\n \"name\" => \"my-app\",\n \"body\" => [\n \"indices\" => array(\n \"index1\",\n \"index2\",\n ),\n \"template\" => [\n \"script\" => [\n \"source\" => [\n \"query\" => [\n \"query_string\" => [\n \"query\" => \"{{query_string}}\",\n \"default_field\" => \"{{default_field}}\",\n ],\n ],\n ],\n \"params\" => [\n \"query_string\" => \"*\",\n \"default_field\" => \"*\",\n ],\n ],\n \"dictionary\" => [\n \"properties\" => [\n \"query_string\" => [\n \"type\" => \"string\",\n ],\n \"default_field\" => [\n \"type\" => \"string\",\n \"enum\" => array(\n \"title\",\n \"description\",\n ),\n ],\n \"additionalProperties\" => false,\n ],\n \"required\" => array(\n \"query_string\",\n ),\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"indices\":[\"index1\",\"index2\"],\"template\":{\"script\":{\"source\":{\"query\":{\"query_string\":{\"query\":\"{{query_string}}\",\"default_field\":\"{{default_field}}\"}}},\"params\":{\"query_string\":\"*\",\"default_field\":\"*\"}},\"dictionary\":{\"properties\":{\"query_string\":{\"type\":\"string\"},\"default_field\":{\"type\":\"string\",\"enum\":[\"title\",\"description\"]},\"additionalProperties\":false},\"required\":[\"query_string\"]}}}' \"$ELASTICSEARCH_URL/_application/search_application/my-app\"" } ] }, @@ -21166,6 +27498,26 @@ { "lang": "Console", "source": "DELETE _application/search_application/my-app/\n" + }, + { + "lang": "Python", + "source": "resp = client.search_application.delete(\n name=\"my-app\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchApplication.delete({\n name: \"my-app\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_application.delete(\n name: \"my-app\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchApplication()->delete([\n \"name\" => \"my-app\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/search_application/my-app/\"" } ] } @@ -21193,6 +27545,26 @@ { "lang": "Console", "source": "GET _application/analytics/my*\n" + }, + { + "lang": "Python", + "source": "resp = client.search_application.get_behavioral_analytics(\n name=\"my*\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchApplication.getBehavioralAnalytics({\n name: \"my*\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_application.get_behavioral_analytics(\n name: \"my*\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchApplication()->getBehavioralAnalytics([\n \"name\" => \"my*\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/analytics/my*\"" } ] }, @@ -21233,6 +27605,26 @@ { "lang": "Console", "source": "PUT _application/analytics/my_analytics_collection\n" + }, + { + "lang": "Python", + "source": "resp = client.search_application.put_behavioral_analytics(\n name=\"my_analytics_collection\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchApplication.putBehavioralAnalytics({\n name: \"my_analytics_collection\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_application.put_behavioral_analytics(\n name: \"my_analytics_collection\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchApplication()->putBehavioralAnalytics([\n \"name\" => \"my_analytics_collection\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/analytics/my_analytics_collection\"" } ] }, @@ -21274,6 +27666,26 @@ { "lang": "Console", "source": "DELETE _application/analytics/my_analytics_collection/\n" + }, + { + "lang": "Python", + "source": "resp = client.search_application.delete_behavioral_analytics(\n name=\"my_analytics_collection\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchApplication.deleteBehavioralAnalytics({\n name: \"my_analytics_collection\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_application.delete_behavioral_analytics(\n name: \"my_analytics_collection\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchApplication()->deleteBehavioralAnalytics([\n \"name\" => \"my_analytics_collection\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/analytics/my_analytics_collection/\"" } ] } @@ -21296,6 +27708,26 @@ { "lang": "Console", "source": "GET _application/analytics/my*\n" + }, + { + "lang": "Python", + "source": "resp = client.search_application.get_behavioral_analytics(\n name=\"my*\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchApplication.getBehavioralAnalytics({\n name: \"my*\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_application.get_behavioral_analytics(\n name: \"my*\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchApplication()->getBehavioralAnalytics([\n \"name\" => \"my*\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/analytics/my*\"" } ] } @@ -21378,6 +27810,26 @@ { "lang": "Console", "source": "GET _application/search_application?from=0&size=3&q=app*\n" + }, + { + "lang": "Python", + "source": "resp = client.search_application.list(\n from=\"0\",\n size=\"3\",\n q=\"app*\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchApplication.list({\n from: 0,\n size: 3,\n q: \"app*\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_application.list(\n from: \"0\",\n size: \"3\",\n q: \"app*\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchApplication()->list([\n \"from\" => \"0\",\n \"size\" => \"3\",\n \"q\" => \"app*\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/search_application?from=0&size=3&q=app*\"" } ] } @@ -21411,6 +27863,26 @@ { "lang": "Console", "source": "POST _application/search_application/my-app/_search\n{\n \"params\": {\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\"name\": \"title\", \"boost\": 5},\n {\"name\": \"description\", \"boost\": 1}\n ]\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search_application.search(\n name=\"my-app\",\n params={\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\n \"name\": \"title\",\n \"boost\": 5\n },\n {\n \"name\": \"description\",\n \"boost\": 1\n }\n ]\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchApplication.search({\n name: \"my-app\",\n params: {\n query_string: \"my first query\",\n text_fields: [\n {\n name: \"title\",\n boost: 5,\n },\n {\n name: \"description\",\n boost: 1,\n },\n ],\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_application.search(\n name: \"my-app\",\n body: {\n \"params\": {\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\n \"name\": \"title\",\n \"boost\": 5\n },\n {\n \"name\": \"description\",\n \"boost\": 1\n }\n ]\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchApplication()->search([\n \"name\" => \"my-app\",\n \"body\" => [\n \"params\" => [\n \"query_string\" => \"my first query\",\n \"text_fields\" => array(\n [\n \"name\" => \"title\",\n \"boost\" => 5,\n ],\n [\n \"name\" => \"description\",\n \"boost\" => 1,\n ],\n ),\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"params\":{\"query_string\":\"my first query\",\"text_fields\":[{\"name\":\"title\",\"boost\":5},{\"name\":\"description\",\"boost\":1}]}}' \"$ELASTICSEARCH_URL/_application/search_application/my-app/_search\"" } ] }, @@ -21442,6 +27914,26 @@ { "lang": "Console", "source": "POST _application/search_application/my-app/_search\n{\n \"params\": {\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\"name\": \"title\", \"boost\": 5},\n {\"name\": \"description\", \"boost\": 1}\n ]\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search_application.search(\n name=\"my-app\",\n params={\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\n \"name\": \"title\",\n \"boost\": 5\n },\n {\n \"name\": \"description\",\n \"boost\": 1\n }\n ]\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchApplication.search({\n name: \"my-app\",\n params: {\n query_string: \"my first query\",\n text_fields: [\n {\n name: \"title\",\n boost: 5,\n },\n {\n name: \"description\",\n boost: 1,\n },\n ],\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_application.search(\n name: \"my-app\",\n body: {\n \"params\": {\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\n \"name\": \"title\",\n \"boost\": 5\n },\n {\n \"name\": \"description\",\n \"boost\": 1\n }\n ]\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchApplication()->search([\n \"name\" => \"my-app\",\n \"body\" => [\n \"params\" => [\n \"query_string\" => \"my first query\",\n \"text_fields\" => array(\n [\n \"name\" => \"title\",\n \"boost\" => 5,\n ],\n [\n \"name\" => \"description\",\n \"boost\" => 1,\n ],\n ),\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"params\":{\"query_string\":\"my first query\",\"text_fields\":[{\"name\":\"title\",\"boost\":5},{\"name\":\"description\",\"boost\":1}]}}' \"$ELASTICSEARCH_URL/_application/search_application/my-app/_search\"" } ] } @@ -21508,6 +28000,26 @@ { "lang": "Console", "source": "GET museums/_mvt/location/13/4207/2692\n{\n \"grid_agg\": \"geotile\",\n \"grid_precision\": 2,\n \"fields\": [\n \"name\",\n \"price\"\n ],\n \"query\": {\n \"term\": {\n \"included\": true\n }\n },\n \"aggs\": {\n \"min_price\": {\n \"min\": {\n \"field\": \"price\"\n }\n },\n \"max_price\": {\n \"max\": {\n \"field\": \"price\"\n }\n },\n \"avg_price\": {\n \"avg\": {\n \"field\": \"price\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search_mvt(\n index=\"museums\",\n field=\"location\",\n zoom=\"13\",\n x=\"4207\",\n y=\"2692\",\n grid_agg=\"geotile\",\n grid_precision=2,\n fields=[\n \"name\",\n \"price\"\n ],\n query={\n \"term\": {\n \"included\": True\n }\n },\n aggs={\n \"min_price\": {\n \"min\": {\n \"field\": \"price\"\n }\n },\n \"max_price\": {\n \"max\": {\n \"field\": \"price\"\n }\n },\n \"avg_price\": {\n \"avg\": {\n \"field\": \"price\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchMvt({\n index: \"museums\",\n field: \"location\",\n zoom: 13,\n x: 4207,\n y: 2692,\n grid_agg: \"geotile\",\n grid_precision: 2,\n fields: [\"name\", \"price\"],\n query: {\n term: {\n included: true,\n },\n },\n aggs: {\n min_price: {\n min: {\n field: \"price\",\n },\n },\n max_price: {\n max: {\n field: \"price\",\n },\n },\n avg_price: {\n avg: {\n field: \"price\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_mvt(\n index: \"museums\",\n field: \"location\",\n zoom: \"13\",\n x: \"4207\",\n y: \"2692\",\n body: {\n \"grid_agg\": \"geotile\",\n \"grid_precision\": 2,\n \"fields\": [\n \"name\",\n \"price\"\n ],\n \"query\": {\n \"term\": {\n \"included\": true\n }\n },\n \"aggs\": {\n \"min_price\": {\n \"min\": {\n \"field\": \"price\"\n }\n },\n \"max_price\": {\n \"max\": {\n \"field\": \"price\"\n }\n },\n \"avg_price\": {\n \"avg\": {\n \"field\": \"price\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchMvt([\n \"index\" => \"museums\",\n \"field\" => \"location\",\n \"zoom\" => \"13\",\n \"x\" => \"4207\",\n \"y\" => \"2692\",\n \"body\" => [\n \"grid_agg\" => \"geotile\",\n \"grid_precision\" => 2,\n \"fields\" => array(\n \"name\",\n \"price\",\n ),\n \"query\" => [\n \"term\" => [\n \"included\" => true,\n ],\n ],\n \"aggs\" => [\n \"min_price\" => [\n \"min\" => [\n \"field\" => \"price\",\n ],\n ],\n \"max_price\" => [\n \"max\" => [\n \"field\" => \"price\",\n ],\n ],\n \"avg_price\" => [\n \"avg\" => [\n \"field\" => \"price\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"grid_agg\":\"geotile\",\"grid_precision\":2,\"fields\":[\"name\",\"price\"],\"query\":{\"term\":{\"included\":true}},\"aggs\":{\"min_price\":{\"min\":{\"field\":\"price\"}},\"max_price\":{\"max\":{\"field\":\"price\"}},\"avg_price\":{\"avg\":{\"field\":\"price\"}}}}' \"$ELASTICSEARCH_URL/museums/_mvt/location/13/4207/2692\"" } ] }, @@ -21572,6 +28084,26 @@ { "lang": "Console", "source": "GET museums/_mvt/location/13/4207/2692\n{\n \"grid_agg\": \"geotile\",\n \"grid_precision\": 2,\n \"fields\": [\n \"name\",\n \"price\"\n ],\n \"query\": {\n \"term\": {\n \"included\": true\n }\n },\n \"aggs\": {\n \"min_price\": {\n \"min\": {\n \"field\": \"price\"\n }\n },\n \"max_price\": {\n \"max\": {\n \"field\": \"price\"\n }\n },\n \"avg_price\": {\n \"avg\": {\n \"field\": \"price\"\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search_mvt(\n index=\"museums\",\n field=\"location\",\n zoom=\"13\",\n x=\"4207\",\n y=\"2692\",\n grid_agg=\"geotile\",\n grid_precision=2,\n fields=[\n \"name\",\n \"price\"\n ],\n query={\n \"term\": {\n \"included\": True\n }\n },\n aggs={\n \"min_price\": {\n \"min\": {\n \"field\": \"price\"\n }\n },\n \"max_price\": {\n \"max\": {\n \"field\": \"price\"\n }\n },\n \"avg_price\": {\n \"avg\": {\n \"field\": \"price\"\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchMvt({\n index: \"museums\",\n field: \"location\",\n zoom: 13,\n x: 4207,\n y: 2692,\n grid_agg: \"geotile\",\n grid_precision: 2,\n fields: [\"name\", \"price\"],\n query: {\n term: {\n included: true,\n },\n },\n aggs: {\n min_price: {\n min: {\n field: \"price\",\n },\n },\n max_price: {\n max: {\n field: \"price\",\n },\n },\n avg_price: {\n avg: {\n field: \"price\",\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_mvt(\n index: \"museums\",\n field: \"location\",\n zoom: \"13\",\n x: \"4207\",\n y: \"2692\",\n body: {\n \"grid_agg\": \"geotile\",\n \"grid_precision\": 2,\n \"fields\": [\n \"name\",\n \"price\"\n ],\n \"query\": {\n \"term\": {\n \"included\": true\n }\n },\n \"aggs\": {\n \"min_price\": {\n \"min\": {\n \"field\": \"price\"\n }\n },\n \"max_price\": {\n \"max\": {\n \"field\": \"price\"\n }\n },\n \"avg_price\": {\n \"avg\": {\n \"field\": \"price\"\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchMvt([\n \"index\" => \"museums\",\n \"field\" => \"location\",\n \"zoom\" => \"13\",\n \"x\" => \"4207\",\n \"y\" => \"2692\",\n \"body\" => [\n \"grid_agg\" => \"geotile\",\n \"grid_precision\" => 2,\n \"fields\" => array(\n \"name\",\n \"price\",\n ),\n \"query\" => [\n \"term\" => [\n \"included\" => true,\n ],\n ],\n \"aggs\" => [\n \"min_price\" => [\n \"min\" => [\n \"field\" => \"price\",\n ],\n ],\n \"max_price\" => [\n \"max\" => [\n \"field\" => \"price\",\n ],\n ],\n \"avg_price\" => [\n \"avg\" => [\n \"field\" => \"price\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"grid_agg\":\"geotile\",\"grid_precision\":2,\"fields\":[\"name\",\"price\"],\"query\":{\"term\":{\"included\":true}},\"aggs\":{\"min_price\":{\"min\":{\"field\":\"price\"}},\"max_price\":{\"max\":{\"field\":\"price\"}},\"avg_price\":{\"avg\":{\"field\":\"price\"}}}}' \"$ELASTICSEARCH_URL/museums/_mvt/location/13/4207/2692\"" } ] } @@ -21641,6 +28173,26 @@ { "lang": "Console", "source": "GET my-index/_search/template\n{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search_template(\n index=\"my-index\",\n id=\"my-search-template\",\n params={\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchTemplate({\n index: \"my-index\",\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 0,\n size: 10,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_template(\n index: \"my-index\",\n body: {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchTemplate([\n \"index\" => \"my-index\",\n \"body\" => [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 0,\n \"size\" => 10,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":0,\"size\":10}}' \"$ELASTICSEARCH_URL/my-index/_search/template\"" } ] }, @@ -21708,6 +28260,26 @@ { "lang": "Console", "source": "GET my-index/_search/template\n{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search_template(\n index=\"my-index\",\n id=\"my-search-template\",\n params={\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchTemplate({\n index: \"my-index\",\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 0,\n size: 10,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_template(\n index: \"my-index\",\n body: {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchTemplate([\n \"index\" => \"my-index\",\n \"body\" => [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 0,\n \"size\" => 10,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":0,\"size\":10}}' \"$ELASTICSEARCH_URL/my-index/_search/template\"" } ] } @@ -21780,6 +28352,26 @@ { "lang": "Console", "source": "GET my-index/_search/template\n{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search_template(\n index=\"my-index\",\n id=\"my-search-template\",\n params={\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchTemplate({\n index: \"my-index\",\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 0,\n size: 10,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_template(\n index: \"my-index\",\n body: {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchTemplate([\n \"index\" => \"my-index\",\n \"body\" => [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 0,\n \"size\" => 10,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":0,\"size\":10}}' \"$ELASTICSEARCH_URL/my-index/_search/template\"" } ] }, @@ -21850,6 +28442,26 @@ { "lang": "Console", "source": "GET my-index/_search/template\n{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.search_template(\n index=\"my-index\",\n id=\"my-search-template\",\n params={\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.searchTemplate({\n index: \"my-index\",\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 0,\n size: 10,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.search_template(\n index: \"my-index\",\n body: {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->searchTemplate([\n \"index\" => \"my-index\",\n \"body\" => [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 0,\n \"size\" => 10,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":0,\"size\":10}}' \"$ELASTICSEARCH_URL/my-index/_search/template\"" } ] } @@ -21948,6 +28560,26 @@ { "lang": "Console", "source": "GET /_security/_authenticate\n" + }, + { + "lang": "Python", + "source": "resp = client.security.authenticate()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.authenticate();" + }, + { + "lang": "Ruby", + "source": "response = client.security.authenticate" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->authenticate();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/_authenticate\"" } ] } @@ -22082,6 +28714,26 @@ { "lang": "Console", "source": "GET /_security/api_key?username=myuser&realm_name=native1\n" + }, + { + "lang": "Python", + "source": "resp = client.security.get_api_key(\n username=\"myuser\",\n realm_name=\"native1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.getApiKey({\n username: \"myuser\",\n realm_name: \"native1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.get_api_key(\n username: \"myuser\",\n realm_name: \"native1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->getApiKey([\n \"username\" => \"myuser\",\n \"realm_name\" => \"native1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/api_key?username=myuser&realm_name=native1\"" } ] }, @@ -22113,6 +28765,26 @@ { "lang": "Console", "source": "POST /_security/api_key\n{\n \"name\": \"my-api-key\",\n \"expiration\": \"1d\", \n \"role_descriptors\": { \n \"role-a\": {\n \"cluster\": [\"all\"],\n \"indices\": [\n {\n \"names\": [\"index-a*\"],\n \"privileges\": [\"read\"]\n }\n ]\n },\n \"role-b\": {\n \"cluster\": [\"all\"],\n \"indices\": [\n {\n \"names\": [\"index-b*\"],\n \"privileges\": [\"all\"]\n }\n ]\n }\n },\n \"metadata\": {\n \"application\": \"my-application\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": true,\n \"tags\": [\"dev\", \"staging\"]\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.create_api_key(\n name=\"my-api-key\",\n expiration=\"1d\",\n role_descriptors={\n \"role-a\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-a*\"\n ],\n \"privileges\": [\n \"read\"\n ]\n }\n ]\n },\n \"role-b\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-b*\"\n ],\n \"privileges\": [\n \"all\"\n ]\n }\n ]\n }\n },\n metadata={\n \"application\": \"my-application\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": True,\n \"tags\": [\n \"dev\",\n \"staging\"\n ]\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.createApiKey({\n name: \"my-api-key\",\n expiration: \"1d\",\n role_descriptors: {\n \"role-a\": {\n cluster: [\"all\"],\n indices: [\n {\n names: [\"index-a*\"],\n privileges: [\"read\"],\n },\n ],\n },\n \"role-b\": {\n cluster: [\"all\"],\n indices: [\n {\n names: [\"index-b*\"],\n privileges: [\"all\"],\n },\n ],\n },\n },\n metadata: {\n application: \"my-application\",\n environment: {\n level: 1,\n trusted: true,\n tags: [\"dev\", \"staging\"],\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.create_api_key(\n body: {\n \"name\": \"my-api-key\",\n \"expiration\": \"1d\",\n \"role_descriptors\": {\n \"role-a\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-a*\"\n ],\n \"privileges\": [\n \"read\"\n ]\n }\n ]\n },\n \"role-b\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-b*\"\n ],\n \"privileges\": [\n \"all\"\n ]\n }\n ]\n }\n },\n \"metadata\": {\n \"application\": \"my-application\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": true,\n \"tags\": [\n \"dev\",\n \"staging\"\n ]\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->createApiKey([\n \"body\" => [\n \"name\" => \"my-api-key\",\n \"expiration\" => \"1d\",\n \"role_descriptors\" => [\n \"role-a\" => [\n \"cluster\" => array(\n \"all\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index-a*\",\n ),\n \"privileges\" => array(\n \"read\",\n ),\n ],\n ),\n ],\n \"role-b\" => [\n \"cluster\" => array(\n \"all\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index-b*\",\n ),\n \"privileges\" => array(\n \"all\",\n ),\n ],\n ),\n ],\n ],\n \"metadata\" => [\n \"application\" => \"my-application\",\n \"environment\" => [\n \"level\" => 1,\n \"trusted\" => true,\n \"tags\" => array(\n \"dev\",\n \"staging\",\n ),\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"name\":\"my-api-key\",\"expiration\":\"1d\",\"role_descriptors\":{\"role-a\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index-a*\"],\"privileges\":[\"read\"]}]},\"role-b\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index-b*\"],\"privileges\":[\"all\"]}]}},\"metadata\":{\"application\":\"my-application\",\"environment\":{\"level\":1,\"trusted\":true,\"tags\":[\"dev\",\"staging\"]}}}' \"$ELASTICSEARCH_URL/_security/api_key\"" } ] }, @@ -22144,6 +28816,26 @@ { "lang": "Console", "source": "POST /_security/api_key\n{\n \"name\": \"my-api-key\",\n \"expiration\": \"1d\", \n \"role_descriptors\": { \n \"role-a\": {\n \"cluster\": [\"all\"],\n \"indices\": [\n {\n \"names\": [\"index-a*\"],\n \"privileges\": [\"read\"]\n }\n ]\n },\n \"role-b\": {\n \"cluster\": [\"all\"],\n \"indices\": [\n {\n \"names\": [\"index-b*\"],\n \"privileges\": [\"all\"]\n }\n ]\n }\n },\n \"metadata\": {\n \"application\": \"my-application\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": true,\n \"tags\": [\"dev\", \"staging\"]\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.create_api_key(\n name=\"my-api-key\",\n expiration=\"1d\",\n role_descriptors={\n \"role-a\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-a*\"\n ],\n \"privileges\": [\n \"read\"\n ]\n }\n ]\n },\n \"role-b\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-b*\"\n ],\n \"privileges\": [\n \"all\"\n ]\n }\n ]\n }\n },\n metadata={\n \"application\": \"my-application\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": True,\n \"tags\": [\n \"dev\",\n \"staging\"\n ]\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.createApiKey({\n name: \"my-api-key\",\n expiration: \"1d\",\n role_descriptors: {\n \"role-a\": {\n cluster: [\"all\"],\n indices: [\n {\n names: [\"index-a*\"],\n privileges: [\"read\"],\n },\n ],\n },\n \"role-b\": {\n cluster: [\"all\"],\n indices: [\n {\n names: [\"index-b*\"],\n privileges: [\"all\"],\n },\n ],\n },\n },\n metadata: {\n application: \"my-application\",\n environment: {\n level: 1,\n trusted: true,\n tags: [\"dev\", \"staging\"],\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.create_api_key(\n body: {\n \"name\": \"my-api-key\",\n \"expiration\": \"1d\",\n \"role_descriptors\": {\n \"role-a\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-a*\"\n ],\n \"privileges\": [\n \"read\"\n ]\n }\n ]\n },\n \"role-b\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-b*\"\n ],\n \"privileges\": [\n \"all\"\n ]\n }\n ]\n }\n },\n \"metadata\": {\n \"application\": \"my-application\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": true,\n \"tags\": [\n \"dev\",\n \"staging\"\n ]\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->createApiKey([\n \"body\" => [\n \"name\" => \"my-api-key\",\n \"expiration\" => \"1d\",\n \"role_descriptors\" => [\n \"role-a\" => [\n \"cluster\" => array(\n \"all\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index-a*\",\n ),\n \"privileges\" => array(\n \"read\",\n ),\n ],\n ),\n ],\n \"role-b\" => [\n \"cluster\" => array(\n \"all\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index-b*\",\n ),\n \"privileges\" => array(\n \"all\",\n ),\n ],\n ),\n ],\n ],\n \"metadata\" => [\n \"application\" => \"my-application\",\n \"environment\" => [\n \"level\" => 1,\n \"trusted\" => true,\n \"tags\" => array(\n \"dev\",\n \"staging\",\n ),\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"name\":\"my-api-key\",\"expiration\":\"1d\",\"role_descriptors\":{\"role-a\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index-a*\"],\"privileges\":[\"read\"]}]},\"role-b\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index-b*\"],\"privileges\":[\"all\"]}]}},\"metadata\":{\"application\":\"my-application\",\"environment\":{\"level\":1,\"trusted\":true,\"tags\":[\"dev\",\"staging\"]}}}' \"$ELASTICSEARCH_URL/_security/api_key\"" } ] }, @@ -22277,6 +28969,26 @@ { "lang": "Console", "source": "DELETE /_security/api_key\n{\n \"ids\" : [ \"VuaCfGcBCdbkQm-e5aOx\" ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.invalidate_api_key(\n ids=[\n \"VuaCfGcBCdbkQm-e5aOx\"\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.invalidateApiKey({\n ids: [\"VuaCfGcBCdbkQm-e5aOx\"],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.invalidate_api_key(\n body: {\n \"ids\": [\n \"VuaCfGcBCdbkQm-e5aOx\"\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->invalidateApiKey([\n \"body\" => [\n \"ids\" => array(\n \"VuaCfGcBCdbkQm-e5aOx\",\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"ids\":[\"VuaCfGcBCdbkQm-e5aOx\"]}' \"$ELASTICSEARCH_URL/_security/api_key\"" } ] } @@ -22303,6 +29015,26 @@ { "lang": "Console", "source": "GET /_security/role/my_admin_role\n" + }, + { + "lang": "Python", + "source": "resp = client.security.get_role(\n name=\"my_admin_role\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.getRole({\n name: \"my_admin_role\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.get_role(\n name: \"my_admin_role\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->getRole([\n \"name\" => \"my_admin_role\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/role/my_admin_role\"" } ] }, @@ -22336,6 +29068,26 @@ { "lang": "Console", "source": "POST /_security/role/my_admin_role\n{\n \"description\": \"Grants full access to all management features within the cluster.\",\n \"cluster\": [\"all\"],\n \"indices\": [\n {\n \"names\": [ \"index1\", \"index2\" ],\n \"privileges\": [\"all\"],\n \"field_security\" : { // optional\n \"grant\" : [ \"title\", \"body\" ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\" // optional\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [ \"admin\", \"read\" ],\n \"resources\": [ \"*\" ]\n }\n ],\n \"run_as\": [ \"other_user\" ], // optional\n \"metadata\" : { // optional\n \"version\" : 1\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.put_role(\n name=\"my_admin_role\",\n description=\"Grants full access to all management features within the cluster.\",\n cluster=[\n \"all\"\n ],\n indices=[\n {\n \"names\": [\n \"index1\",\n \"index2\"\n ],\n \"privileges\": [\n \"all\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n applications=[\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n run_as=[\n \"other_user\"\n ],\n metadata={\n \"version\": 1\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.putRole({\n name: \"my_admin_role\",\n description:\n \"Grants full access to all management features within the cluster.\",\n cluster: [\"all\"],\n indices: [\n {\n names: [\"index1\", \"index2\"],\n privileges: [\"all\"],\n field_security: {\n grant: [\"title\", \"body\"],\n },\n query: '{\"match\": {\"title\": \"foo\"}}',\n },\n ],\n applications: [\n {\n application: \"myapp\",\n privileges: [\"admin\", \"read\"],\n resources: [\"*\"],\n },\n ],\n run_as: [\"other_user\"],\n metadata: {\n version: 1,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.put_role(\n name: \"my_admin_role\",\n body: {\n \"description\": \"Grants full access to all management features within the cluster.\",\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index1\",\n \"index2\"\n ],\n \"privileges\": [\n \"all\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n \"run_as\": [\n \"other_user\"\n ],\n \"metadata\": {\n \"version\": 1\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->putRole([\n \"name\" => \"my_admin_role\",\n \"body\" => [\n \"description\" => \"Grants full access to all management features within the cluster.\",\n \"cluster\" => array(\n \"all\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index1\",\n \"index2\",\n ),\n \"privileges\" => array(\n \"all\",\n ),\n \"field_security\" => [\n \"grant\" => array(\n \"title\",\n \"body\",\n ),\n ],\n \"query\" => \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\",\n ],\n ),\n \"applications\" => array(\n [\n \"application\" => \"myapp\",\n \"privileges\" => array(\n \"admin\",\n \"read\",\n ),\n \"resources\" => array(\n \"*\",\n ),\n ],\n ),\n \"run_as\" => array(\n \"other_user\",\n ),\n \"metadata\" => [\n \"version\" => 1,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"Grants full access to all management features within the cluster.\",\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index1\",\"index2\"],\"privileges\":[\"all\"],\"field_security\":{\"grant\":[\"title\",\"body\"]},\"query\":\"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"}],\"applications\":[{\"application\":\"myapp\",\"privileges\":[\"admin\",\"read\"],\"resources\":[\"*\"]}],\"run_as\":[\"other_user\"],\"metadata\":{\"version\":1}}' \"$ELASTICSEARCH_URL/_security/role/my_admin_role\"" } ] }, @@ -22369,6 +29121,26 @@ { "lang": "Console", "source": "POST /_security/role/my_admin_role\n{\n \"description\": \"Grants full access to all management features within the cluster.\",\n \"cluster\": [\"all\"],\n \"indices\": [\n {\n \"names\": [ \"index1\", \"index2\" ],\n \"privileges\": [\"all\"],\n \"field_security\" : { // optional\n \"grant\" : [ \"title\", \"body\" ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\" // optional\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [ \"admin\", \"read\" ],\n \"resources\": [ \"*\" ]\n }\n ],\n \"run_as\": [ \"other_user\" ], // optional\n \"metadata\" : { // optional\n \"version\" : 1\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.put_role(\n name=\"my_admin_role\",\n description=\"Grants full access to all management features within the cluster.\",\n cluster=[\n \"all\"\n ],\n indices=[\n {\n \"names\": [\n \"index1\",\n \"index2\"\n ],\n \"privileges\": [\n \"all\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n applications=[\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n run_as=[\n \"other_user\"\n ],\n metadata={\n \"version\": 1\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.putRole({\n name: \"my_admin_role\",\n description:\n \"Grants full access to all management features within the cluster.\",\n cluster: [\"all\"],\n indices: [\n {\n names: [\"index1\", \"index2\"],\n privileges: [\"all\"],\n field_security: {\n grant: [\"title\", \"body\"],\n },\n query: '{\"match\": {\"title\": \"foo\"}}',\n },\n ],\n applications: [\n {\n application: \"myapp\",\n privileges: [\"admin\", \"read\"],\n resources: [\"*\"],\n },\n ],\n run_as: [\"other_user\"],\n metadata: {\n version: 1,\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.put_role(\n name: \"my_admin_role\",\n body: {\n \"description\": \"Grants full access to all management features within the cluster.\",\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index1\",\n \"index2\"\n ],\n \"privileges\": [\n \"all\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n \"run_as\": [\n \"other_user\"\n ],\n \"metadata\": {\n \"version\": 1\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->putRole([\n \"name\" => \"my_admin_role\",\n \"body\" => [\n \"description\" => \"Grants full access to all management features within the cluster.\",\n \"cluster\" => array(\n \"all\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index1\",\n \"index2\",\n ),\n \"privileges\" => array(\n \"all\",\n ),\n \"field_security\" => [\n \"grant\" => array(\n \"title\",\n \"body\",\n ),\n ],\n \"query\" => \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\",\n ],\n ),\n \"applications\" => array(\n [\n \"application\" => \"myapp\",\n \"privileges\" => array(\n \"admin\",\n \"read\",\n ),\n \"resources\" => array(\n \"*\",\n ),\n ],\n ),\n \"run_as\" => array(\n \"other_user\",\n ),\n \"metadata\" => [\n \"version\" => 1,\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"Grants full access to all management features within the cluster.\",\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index1\",\"index2\"],\"privileges\":[\"all\"],\"field_security\":{\"grant\":[\"title\",\"body\"]},\"query\":\"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"}],\"applications\":[{\"application\":\"myapp\",\"privileges\":[\"admin\",\"read\"],\"resources\":[\"*\"]}],\"run_as\":[\"other_user\"],\"metadata\":{\"version\":1}}' \"$ELASTICSEARCH_URL/_security/role/my_admin_role\"" } ] }, @@ -22433,6 +29205,26 @@ { "lang": "Console", "source": "DELETE /_security/role/my_admin_role\n" + }, + { + "lang": "Python", + "source": "resp = client.security.delete_role(\n name=\"my_admin_role\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.deleteRole({\n name: \"my_admin_role\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.delete_role(\n name: \"my_admin_role\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->deleteRole([\n \"name\" => \"my_admin_role\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/role/my_admin_role\"" } ] } @@ -22491,6 +29283,26 @@ { "lang": "Console", "source": "GET /_security/privilege/_builtin\n" + }, + { + "lang": "Python", + "source": "resp = client.security.get_builtin_privileges()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.getBuiltinPrivileges();" + }, + { + "lang": "Ruby", + "source": "response = client.security.get_builtin_privileges" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->getBuiltinPrivileges();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/privilege/_builtin\"" } ] } @@ -22512,6 +29324,26 @@ { "lang": "Console", "source": "GET /_security/role/my_admin_role\n" + }, + { + "lang": "Python", + "source": "resp = client.security.get_role(\n name=\"my_admin_role\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.getRole({\n name: \"my_admin_role\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.get_role(\n name: \"my_admin_role\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->getRole([\n \"name\" => \"my_admin_role\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/role/my_admin_role\"" } ] } @@ -22540,6 +29372,26 @@ { "lang": "Console", "source": "GET /_security/user/_has_privileges\n{\n \"cluster\": [ \"monitor\", \"manage\" ],\n \"index\" : [\n {\n \"names\": [ \"suppliers\", \"products\" ],\n \"privileges\": [ \"read\" ]\n },\n {\n \"names\": [ \"inventory\" ],\n \"privileges\" : [ \"read\", \"write\" ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\" : [ \"read\", \"data:write/inventory\" ],\n \"resources\" : [ \"product/1852563\" ]\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.has_privileges(\n cluster=[\n \"monitor\",\n \"manage\"\n ],\n index=[\n {\n \"names\": [\n \"suppliers\",\n \"products\"\n ],\n \"privileges\": [\n \"read\"\n ]\n },\n {\n \"names\": [\n \"inventory\"\n ],\n \"privileges\": [\n \"read\",\n \"write\"\n ]\n }\n ],\n application=[\n {\n \"application\": \"inventory_manager\",\n \"privileges\": [\n \"read\",\n \"data:write/inventory\"\n ],\n \"resources\": [\n \"product/1852563\"\n ]\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.hasPrivileges({\n cluster: [\"monitor\", \"manage\"],\n index: [\n {\n names: [\"suppliers\", \"products\"],\n privileges: [\"read\"],\n },\n {\n names: [\"inventory\"],\n privileges: [\"read\", \"write\"],\n },\n ],\n application: [\n {\n application: \"inventory_manager\",\n privileges: [\"read\", \"data:write/inventory\"],\n resources: [\"product/1852563\"],\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.has_privileges(\n body: {\n \"cluster\": [\n \"monitor\",\n \"manage\"\n ],\n \"index\": [\n {\n \"names\": [\n \"suppliers\",\n \"products\"\n ],\n \"privileges\": [\n \"read\"\n ]\n },\n {\n \"names\": [\n \"inventory\"\n ],\n \"privileges\": [\n \"read\",\n \"write\"\n ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\": [\n \"read\",\n \"data:write/inventory\"\n ],\n \"resources\": [\n \"product/1852563\"\n ]\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->hasPrivileges([\n \"body\" => [\n \"cluster\" => array(\n \"monitor\",\n \"manage\",\n ),\n \"index\" => array(\n [\n \"names\" => array(\n \"suppliers\",\n \"products\",\n ),\n \"privileges\" => array(\n \"read\",\n ),\n ],\n [\n \"names\" => array(\n \"inventory\",\n ),\n \"privileges\" => array(\n \"read\",\n \"write\",\n ),\n ],\n ),\n \"application\" => array(\n [\n \"application\" => \"inventory_manager\",\n \"privileges\" => array(\n \"read\",\n \"data:write/inventory\",\n ),\n \"resources\" => array(\n \"product/1852563\",\n ),\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"cluster\":[\"monitor\",\"manage\"],\"index\":[{\"names\":[\"suppliers\",\"products\"],\"privileges\":[\"read\"]},{\"names\":[\"inventory\"],\"privileges\":[\"read\",\"write\"]}],\"application\":[{\"application\":\"inventory_manager\",\"privileges\":[\"read\",\"data:write/inventory\"],\"resources\":[\"product/1852563\"]}]}' \"$ELASTICSEARCH_URL/_security/user/_has_privileges\"" } ] }, @@ -22566,6 +29418,26 @@ { "lang": "Console", "source": "GET /_security/user/_has_privileges\n{\n \"cluster\": [ \"monitor\", \"manage\" ],\n \"index\" : [\n {\n \"names\": [ \"suppliers\", \"products\" ],\n \"privileges\": [ \"read\" ]\n },\n {\n \"names\": [ \"inventory\" ],\n \"privileges\" : [ \"read\", \"write\" ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\" : [ \"read\", \"data:write/inventory\" ],\n \"resources\" : [ \"product/1852563\" ]\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.has_privileges(\n cluster=[\n \"monitor\",\n \"manage\"\n ],\n index=[\n {\n \"names\": [\n \"suppliers\",\n \"products\"\n ],\n \"privileges\": [\n \"read\"\n ]\n },\n {\n \"names\": [\n \"inventory\"\n ],\n \"privileges\": [\n \"read\",\n \"write\"\n ]\n }\n ],\n application=[\n {\n \"application\": \"inventory_manager\",\n \"privileges\": [\n \"read\",\n \"data:write/inventory\"\n ],\n \"resources\": [\n \"product/1852563\"\n ]\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.hasPrivileges({\n cluster: [\"monitor\", \"manage\"],\n index: [\n {\n names: [\"suppliers\", \"products\"],\n privileges: [\"read\"],\n },\n {\n names: [\"inventory\"],\n privileges: [\"read\", \"write\"],\n },\n ],\n application: [\n {\n application: \"inventory_manager\",\n privileges: [\"read\", \"data:write/inventory\"],\n resources: [\"product/1852563\"],\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.has_privileges(\n body: {\n \"cluster\": [\n \"monitor\",\n \"manage\"\n ],\n \"index\": [\n {\n \"names\": [\n \"suppliers\",\n \"products\"\n ],\n \"privileges\": [\n \"read\"\n ]\n },\n {\n \"names\": [\n \"inventory\"\n ],\n \"privileges\": [\n \"read\",\n \"write\"\n ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\": [\n \"read\",\n \"data:write/inventory\"\n ],\n \"resources\": [\n \"product/1852563\"\n ]\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->hasPrivileges([\n \"body\" => [\n \"cluster\" => array(\n \"monitor\",\n \"manage\",\n ),\n \"index\" => array(\n [\n \"names\" => array(\n \"suppliers\",\n \"products\",\n ),\n \"privileges\" => array(\n \"read\",\n ),\n ],\n [\n \"names\" => array(\n \"inventory\",\n ),\n \"privileges\" => array(\n \"read\",\n \"write\",\n ),\n ],\n ),\n \"application\" => array(\n [\n \"application\" => \"inventory_manager\",\n \"privileges\" => array(\n \"read\",\n \"data:write/inventory\",\n ),\n \"resources\" => array(\n \"product/1852563\",\n ),\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"cluster\":[\"monitor\",\"manage\"],\"index\":[{\"names\":[\"suppliers\",\"products\"],\"privileges\":[\"read\"]},{\"names\":[\"inventory\"],\"privileges\":[\"read\",\"write\"]}],\"application\":[{\"application\":\"inventory_manager\",\"privileges\":[\"read\",\"data:write/inventory\"],\"resources\":[\"product/1852563\"]}]}' \"$ELASTICSEARCH_URL/_security/user/_has_privileges\"" } ] } @@ -22599,6 +29471,26 @@ { "lang": "Console", "source": "GET /_security/user/_has_privileges\n{\n \"cluster\": [ \"monitor\", \"manage\" ],\n \"index\" : [\n {\n \"names\": [ \"suppliers\", \"products\" ],\n \"privileges\": [ \"read\" ]\n },\n {\n \"names\": [ \"inventory\" ],\n \"privileges\" : [ \"read\", \"write\" ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\" : [ \"read\", \"data:write/inventory\" ],\n \"resources\" : [ \"product/1852563\" ]\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.has_privileges(\n cluster=[\n \"monitor\",\n \"manage\"\n ],\n index=[\n {\n \"names\": [\n \"suppliers\",\n \"products\"\n ],\n \"privileges\": [\n \"read\"\n ]\n },\n {\n \"names\": [\n \"inventory\"\n ],\n \"privileges\": [\n \"read\",\n \"write\"\n ]\n }\n ],\n application=[\n {\n \"application\": \"inventory_manager\",\n \"privileges\": [\n \"read\",\n \"data:write/inventory\"\n ],\n \"resources\": [\n \"product/1852563\"\n ]\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.hasPrivileges({\n cluster: [\"monitor\", \"manage\"],\n index: [\n {\n names: [\"suppliers\", \"products\"],\n privileges: [\"read\"],\n },\n {\n names: [\"inventory\"],\n privileges: [\"read\", \"write\"],\n },\n ],\n application: [\n {\n application: \"inventory_manager\",\n privileges: [\"read\", \"data:write/inventory\"],\n resources: [\"product/1852563\"],\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.has_privileges(\n body: {\n \"cluster\": [\n \"monitor\",\n \"manage\"\n ],\n \"index\": [\n {\n \"names\": [\n \"suppliers\",\n \"products\"\n ],\n \"privileges\": [\n \"read\"\n ]\n },\n {\n \"names\": [\n \"inventory\"\n ],\n \"privileges\": [\n \"read\",\n \"write\"\n ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\": [\n \"read\",\n \"data:write/inventory\"\n ],\n \"resources\": [\n \"product/1852563\"\n ]\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->hasPrivileges([\n \"body\" => [\n \"cluster\" => array(\n \"monitor\",\n \"manage\",\n ),\n \"index\" => array(\n [\n \"names\" => array(\n \"suppliers\",\n \"products\",\n ),\n \"privileges\" => array(\n \"read\",\n ),\n ],\n [\n \"names\" => array(\n \"inventory\",\n ),\n \"privileges\" => array(\n \"read\",\n \"write\",\n ),\n ],\n ),\n \"application\" => array(\n [\n \"application\" => \"inventory_manager\",\n \"privileges\" => array(\n \"read\",\n \"data:write/inventory\",\n ),\n \"resources\" => array(\n \"product/1852563\",\n ),\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"cluster\":[\"monitor\",\"manage\"],\"index\":[{\"names\":[\"suppliers\",\"products\"],\"privileges\":[\"read\"]},{\"names\":[\"inventory\"],\"privileges\":[\"read\",\"write\"]}],\"application\":[{\"application\":\"inventory_manager\",\"privileges\":[\"read\",\"data:write/inventory\"],\"resources\":[\"product/1852563\"]}]}' \"$ELASTICSEARCH_URL/_security/user/_has_privileges\"" } ] }, @@ -22630,6 +29522,26 @@ { "lang": "Console", "source": "GET /_security/user/_has_privileges\n{\n \"cluster\": [ \"monitor\", \"manage\" ],\n \"index\" : [\n {\n \"names\": [ \"suppliers\", \"products\" ],\n \"privileges\": [ \"read\" ]\n },\n {\n \"names\": [ \"inventory\" ],\n \"privileges\" : [ \"read\", \"write\" ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\" : [ \"read\", \"data:write/inventory\" ],\n \"resources\" : [ \"product/1852563\" ]\n }\n ]\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.has_privileges(\n cluster=[\n \"monitor\",\n \"manage\"\n ],\n index=[\n {\n \"names\": [\n \"suppliers\",\n \"products\"\n ],\n \"privileges\": [\n \"read\"\n ]\n },\n {\n \"names\": [\n \"inventory\"\n ],\n \"privileges\": [\n \"read\",\n \"write\"\n ]\n }\n ],\n application=[\n {\n \"application\": \"inventory_manager\",\n \"privileges\": [\n \"read\",\n \"data:write/inventory\"\n ],\n \"resources\": [\n \"product/1852563\"\n ]\n }\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.hasPrivileges({\n cluster: [\"monitor\", \"manage\"],\n index: [\n {\n names: [\"suppliers\", \"products\"],\n privileges: [\"read\"],\n },\n {\n names: [\"inventory\"],\n privileges: [\"read\", \"write\"],\n },\n ],\n application: [\n {\n application: \"inventory_manager\",\n privileges: [\"read\", \"data:write/inventory\"],\n resources: [\"product/1852563\"],\n },\n ],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.has_privileges(\n body: {\n \"cluster\": [\n \"monitor\",\n \"manage\"\n ],\n \"index\": [\n {\n \"names\": [\n \"suppliers\",\n \"products\"\n ],\n \"privileges\": [\n \"read\"\n ]\n },\n {\n \"names\": [\n \"inventory\"\n ],\n \"privileges\": [\n \"read\",\n \"write\"\n ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\": [\n \"read\",\n \"data:write/inventory\"\n ],\n \"resources\": [\n \"product/1852563\"\n ]\n }\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->hasPrivileges([\n \"body\" => [\n \"cluster\" => array(\n \"monitor\",\n \"manage\",\n ),\n \"index\" => array(\n [\n \"names\" => array(\n \"suppliers\",\n \"products\",\n ),\n \"privileges\" => array(\n \"read\",\n ),\n ],\n [\n \"names\" => array(\n \"inventory\",\n ),\n \"privileges\" => array(\n \"read\",\n \"write\",\n ),\n ],\n ),\n \"application\" => array(\n [\n \"application\" => \"inventory_manager\",\n \"privileges\" => array(\n \"read\",\n \"data:write/inventory\",\n ),\n \"resources\" => array(\n \"product/1852563\",\n ),\n ],\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"cluster\":[\"monitor\",\"manage\"],\"index\":[{\"names\":[\"suppliers\",\"products\"],\"privileges\":[\"read\"]},{\"names\":[\"inventory\"],\"privileges\":[\"read\",\"write\"]}],\"application\":[{\"application\":\"inventory_manager\",\"privileges\":[\"read\",\"data:write/inventory\"],\"resources\":[\"product/1852563\"]}]}' \"$ELASTICSEARCH_URL/_security/user/_has_privileges\"" } ] } @@ -22666,6 +29578,26 @@ { "lang": "Console", "source": "GET /_security/_query/api_key?with_limited_by=true\n{\n \"query\": {\n \"ids\": {\n \"values\": [\n \"VuaCfGcBCdbkQm-e5aOx\"\n ]\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.query_api_keys(\n with_limited_by=True,\n query={\n \"ids\": {\n \"values\": [\n \"VuaCfGcBCdbkQm-e5aOx\"\n ]\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.queryApiKeys({\n with_limited_by: \"true\",\n query: {\n ids: {\n values: [\"VuaCfGcBCdbkQm-e5aOx\"],\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.query_api_keys(\n with_limited_by: \"true\",\n body: {\n \"query\": {\n \"ids\": {\n \"values\": [\n \"VuaCfGcBCdbkQm-e5aOx\"\n ]\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->queryApiKeys([\n \"with_limited_by\" => \"true\",\n \"body\" => [\n \"query\" => [\n \"ids\" => [\n \"values\" => array(\n \"VuaCfGcBCdbkQm-e5aOx\",\n ),\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"ids\":{\"values\":[\"VuaCfGcBCdbkQm-e5aOx\"]}}}' \"$ELASTICSEARCH_URL/_security/_query/api_key?with_limited_by=true\"" } ] }, @@ -22700,6 +29632,26 @@ { "lang": "Console", "source": "GET /_security/_query/api_key?with_limited_by=true\n{\n \"query\": {\n \"ids\": {\n \"values\": [\n \"VuaCfGcBCdbkQm-e5aOx\"\n ]\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.query_api_keys(\n with_limited_by=True,\n query={\n \"ids\": {\n \"values\": [\n \"VuaCfGcBCdbkQm-e5aOx\"\n ]\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.queryApiKeys({\n with_limited_by: \"true\",\n query: {\n ids: {\n values: [\"VuaCfGcBCdbkQm-e5aOx\"],\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.query_api_keys(\n with_limited_by: \"true\",\n body: {\n \"query\": {\n \"ids\": {\n \"values\": [\n \"VuaCfGcBCdbkQm-e5aOx\"\n ]\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->queryApiKeys([\n \"with_limited_by\" => \"true\",\n \"body\" => [\n \"query\" => [\n \"ids\" => [\n \"values\" => array(\n \"VuaCfGcBCdbkQm-e5aOx\",\n ),\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"ids\":{\"values\":[\"VuaCfGcBCdbkQm-e5aOx\"]}}}' \"$ELASTICSEARCH_URL/_security/_query/api_key?with_limited_by=true\"" } ] } @@ -22725,6 +29677,26 @@ { "lang": "Console", "source": "POST /_security/_query/role\n{\n \"sort\": [\"name\"]\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.query_role(\n sort=[\n \"name\"\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.queryRole({\n sort: [\"name\"],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.query_role(\n body: {\n \"sort\": [\n \"name\"\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->queryRole([\n \"body\" => [\n \"sort\" => array(\n \"name\",\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"sort\":[\"name\"]}' \"$ELASTICSEARCH_URL/_security/_query/role\"" } ] }, @@ -22748,6 +29720,26 @@ { "lang": "Console", "source": "POST /_security/_query/role\n{\n \"sort\": [\"name\"]\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.query_role(\n sort=[\n \"name\"\n ],\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.queryRole({\n sort: [\"name\"],\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.query_role(\n body: {\n \"sort\": [\n \"name\"\n ]\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->queryRole([\n \"body\" => [\n \"sort\" => array(\n \"name\",\n ),\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"sort\":[\"name\"]}' \"$ELASTICSEARCH_URL/_security/_query/role\"" } ] } @@ -22842,6 +29834,26 @@ { "lang": "Console", "source": "PUT /_security/api_key/VuaCfGcBCdbkQm-e5aOx\n{\n \"role_descriptors\": {\n \"role-a\": {\n \"indices\": [\n {\n \"names\": [\"*\"],\n \"privileges\": [\"write\"]\n }\n ]\n }\n },\n \"metadata\": {\n \"environment\": {\n \"level\": 2,\n \"trusted\": true,\n \"tags\": [\"production\"]\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.security.update_api_key(\n id=\"VuaCfGcBCdbkQm-e5aOx\",\n role_descriptors={\n \"role-a\": {\n \"indices\": [\n {\n \"names\": [\n \"*\"\n ],\n \"privileges\": [\n \"write\"\n ]\n }\n ]\n }\n },\n metadata={\n \"environment\": {\n \"level\": 2,\n \"trusted\": True,\n \"tags\": [\n \"production\"\n ]\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.security.updateApiKey({\n id: \"VuaCfGcBCdbkQm-e5aOx\",\n role_descriptors: {\n \"role-a\": {\n indices: [\n {\n names: [\"*\"],\n privileges: [\"write\"],\n },\n ],\n },\n },\n metadata: {\n environment: {\n level: 2,\n trusted: true,\n tags: [\"production\"],\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.security.update_api_key(\n id: \"VuaCfGcBCdbkQm-e5aOx\",\n body: {\n \"role_descriptors\": {\n \"role-a\": {\n \"indices\": [\n {\n \"names\": [\n \"*\"\n ],\n \"privileges\": [\n \"write\"\n ]\n }\n ]\n }\n },\n \"metadata\": {\n \"environment\": {\n \"level\": 2,\n \"trusted\": true,\n \"tags\": [\n \"production\"\n ]\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->security()->updateApiKey([\n \"id\" => \"VuaCfGcBCdbkQm-e5aOx\",\n \"body\" => [\n \"role_descriptors\" => [\n \"role-a\" => [\n \"indices\" => array(\n [\n \"names\" => array(\n \"*\",\n ),\n \"privileges\" => array(\n \"write\",\n ),\n ],\n ),\n ],\n ],\n \"metadata\" => [\n \"environment\" => [\n \"level\" => 2,\n \"trusted\" => true,\n \"tags\" => array(\n \"production\",\n ),\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"role_descriptors\":{\"role-a\":{\"indices\":[{\"names\":[\"*\"],\"privileges\":[\"write\"]}]}},\"metadata\":{\"environment\":{\"level\":2,\"trusted\":true,\"tags\":[\"production\"]}}}' \"$ELASTICSEARCH_URL/_security/api_key/VuaCfGcBCdbkQm-e5aOx\"" } ] } @@ -22903,6 +29915,26 @@ { "lang": "Console", "source": "POST _sql/close\n{\n \"cursor\": \"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.sql.clear_cursor(\n cursor=\"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.sql.clearCursor({\n cursor:\n \"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.sql.clear_cursor(\n body: {\n \"cursor\": \"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->sql()->clearCursor([\n \"body\" => [\n \"cursor\" => \"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"cursor\":\"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\"}' \"$ELASTICSEARCH_URL/_sql/close\"" } ] } @@ -22945,6 +29977,26 @@ { "lang": "Console", "source": "DELETE _sql/async/delete/FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\n" + }, + { + "lang": "Python", + "source": "resp = client.sql.delete_async(\n id=\"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.sql.deleteAsync({\n id: \"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.sql.delete_async(\n id: \"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->sql()->deleteAsync([\n \"id\" => \"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_sql/async/delete/FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\"" } ] } @@ -23064,6 +30116,26 @@ { "lang": "Console", "source": "GET _sql/async/FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=?wait_for_completion_timeout=2s&format=json\n" + }, + { + "lang": "Python", + "source": "resp = client.sql.get_async(\n id=\"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n wait_for_completion_timeout=\"2s\",\n format=\"json\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.sql.getAsync({\n id: \"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n wait_for_completion_timeout: \"2s\",\n format: \"json\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.sql.get_async(\n id: \"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n wait_for_completion_timeout: \"2s\",\n format: \"json\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->sql()->getAsync([\n \"id\" => \"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n \"wait_for_completion_timeout\" => \"2s\",\n \"format\" => \"json\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_sql/async/FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=?wait_for_completion_timeout=2s&format=json\"" } ] } @@ -23136,6 +30208,26 @@ { "lang": "Console", "source": "GET _sql/async/status/FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\n" + }, + { + "lang": "Python", + "source": "resp = client.sql.get_async_status(\n id=\"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.sql.getAsyncStatus({\n id: \"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.sql.get_async_status(\n id: \"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->sql()->getAsyncStatus([\n \"id\" => \"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_sql/async/status/FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\"" } ] } @@ -23166,6 +30258,26 @@ { "lang": "Console", "source": "POST _sql?format=txt\n{\n \"query\": \"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.sql.query(\n format=\"txt\",\n query=\"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.sql.query({\n format: \"txt\",\n query: \"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.sql.query(\n format: \"txt\",\n body: {\n \"query\": \"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->sql()->query([\n \"format\" => \"txt\",\n \"body\" => [\n \"query\" => \"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":\"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\"}' \"$ELASTICSEARCH_URL/_sql?format=txt\"" } ] }, @@ -23194,6 +30306,26 @@ { "lang": "Console", "source": "POST _sql?format=txt\n{\n \"query\": \"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.sql.query(\n format=\"txt\",\n query=\"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.sql.query({\n format: \"txt\",\n query: \"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.sql.query(\n format: \"txt\",\n body: {\n \"query\": \"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->sql()->query([\n \"format\" => \"txt\",\n \"body\" => [\n \"query\" => \"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":\"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\"}' \"$ELASTICSEARCH_URL/_sql?format=txt\"" } ] } @@ -23219,6 +30351,26 @@ { "lang": "Console", "source": "POST _sql/translate\n{\n \"query\": \"SELECT * FROM library ORDER BY page_count DESC\",\n \"fetch_size\": 10\n}" + }, + { + "lang": "Python", + "source": "resp = client.sql.translate(\n query=\"SELECT * FROM library ORDER BY page_count DESC\",\n fetch_size=10,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.sql.translate({\n query: \"SELECT * FROM library ORDER BY page_count DESC\",\n fetch_size: 10,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.sql.translate(\n body: {\n \"query\": \"SELECT * FROM library ORDER BY page_count DESC\",\n \"fetch_size\": 10\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->sql()->translate([\n \"body\" => [\n \"query\" => \"SELECT * FROM library ORDER BY page_count DESC\",\n \"fetch_size\" => 10,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":\"SELECT * FROM library ORDER BY page_count DESC\",\"fetch_size\":10}' \"$ELASTICSEARCH_URL/_sql/translate\"" } ] }, @@ -23242,6 +30394,26 @@ { "lang": "Console", "source": "POST _sql/translate\n{\n \"query\": \"SELECT * FROM library ORDER BY page_count DESC\",\n \"fetch_size\": 10\n}" + }, + { + "lang": "Python", + "source": "resp = client.sql.translate(\n query=\"SELECT * FROM library ORDER BY page_count DESC\",\n fetch_size=10,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.sql.translate({\n query: \"SELECT * FROM library ORDER BY page_count DESC\",\n fetch_size: 10,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.sql.translate(\n body: {\n \"query\": \"SELECT * FROM library ORDER BY page_count DESC\",\n \"fetch_size\": 10\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->sql()->translate([\n \"body\" => [\n \"query\" => \"SELECT * FROM library ORDER BY page_count DESC\",\n \"fetch_size\" => 10,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":\"SELECT * FROM library ORDER BY page_count DESC\",\"fetch_size\":10}' \"$ELASTICSEARCH_URL/_sql/translate\"" } ] } @@ -23327,6 +30499,26 @@ { "lang": "Console", "source": "GET _synonyms/my-synonyms-set\n" + }, + { + "lang": "Python", + "source": "resp = client.synonyms.get_synonym(\n id=\"my-synonyms-set\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.synonyms.getSynonym({\n id: \"my-synonyms-set\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.synonyms.get_synonym(\n id: \"my-synonyms-set\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->synonyms()->getSynonym([\n \"id\" => \"my-synonyms-set\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set\"" } ] }, @@ -23408,6 +30600,26 @@ { "lang": "Console", "source": "PUT _synonyms/my-synonyms-set\n" + }, + { + "lang": "Python", + "source": "resp = client.synonyms.put_synonym(\n id=\"my-synonyms-set\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.synonyms.putSynonym({\n id: \"my-synonyms-set\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.synonyms.put_synonym(\n id: \"my-synonyms-set\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->synonyms()->putSynonym([\n \"id\" => \"my-synonyms-set\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set\"" } ] }, @@ -23448,6 +30660,26 @@ { "lang": "Console", "source": "DELETE _synonyms/my-synonyms-set\n" + }, + { + "lang": "Python", + "source": "resp = client.synonyms.delete_synonym(\n id=\"my-synonyms-set\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.synonyms.deleteSynonym({\n id: \"my-synonyms-set\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.synonyms.delete_synonym(\n id: \"my-synonyms-set\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->synonyms()->deleteSynonym([\n \"id\" => \"my-synonyms-set\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set\"" } ] } @@ -23507,6 +30739,26 @@ { "lang": "Console", "source": "GET _synonyms/my-synonyms-set/test-1\n" + }, + { + "lang": "Python", + "source": "resp = client.synonyms.get_synonym_rule(\n set_id=\"my-synonyms-set\",\n rule_id=\"test-1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.synonyms.getSynonymRule({\n set_id: \"my-synonyms-set\",\n rule_id: \"test-1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.synonyms.get_synonym_rule(\n set_id: \"my-synonyms-set\",\n rule_id: \"test-1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->synonyms()->getSynonymRule([\n \"set_id\" => \"my-synonyms-set\",\n \"rule_id\" => \"test-1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set/test-1\"" } ] }, @@ -23589,6 +30841,26 @@ { "lang": "Console", "source": "PUT _synonyms/my-synonyms-set/test-1\n{\n \"synonyms\": \"hello, hi, howdy\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.synonyms.put_synonym_rule(\n set_id=\"my-synonyms-set\",\n rule_id=\"test-1\",\n synonyms=\"hello, hi, howdy\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.synonyms.putSynonymRule({\n set_id: \"my-synonyms-set\",\n rule_id: \"test-1\",\n synonyms: \"hello, hi, howdy\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.synonyms.put_synonym_rule(\n set_id: \"my-synonyms-set\",\n rule_id: \"test-1\",\n body: {\n \"synonyms\": \"hello, hi, howdy\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->synonyms()->putSynonymRule([\n \"set_id\" => \"my-synonyms-set\",\n \"rule_id\" => \"test-1\",\n \"body\" => [\n \"synonyms\" => \"hello, hi, howdy\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"synonyms\":\"hello, hi, howdy\"}' \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set/test-1\"" } ] }, @@ -23646,6 +30918,26 @@ { "lang": "Console", "source": "DELETE _synonyms/my-synonyms-set/test-1\n" + }, + { + "lang": "Python", + "source": "resp = client.synonyms.delete_synonym_rule(\n set_id=\"my-synonyms-set\",\n rule_id=\"test-1\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.synonyms.deleteSynonymRule({\n set_id: \"my-synonyms-set\",\n rule_id: \"test-1\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.synonyms.delete_synonym_rule(\n set_id: \"my-synonyms-set\",\n rule_id: \"test-1\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->synonyms()->deleteSynonymRule([\n \"set_id\" => \"my-synonyms-set\",\n \"rule_id\" => \"test-1\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set/test-1\"" } ] } @@ -23720,6 +31012,26 @@ { "lang": "Console", "source": "GET _synonyms\n" + }, + { + "lang": "Python", + "source": "resp = client.synonyms.get_synonyms_sets()" + }, + { + "lang": "JavaScript", + "source": "const response = await client.synonyms.getSynonymsSets();" + }, + { + "lang": "Ruby", + "source": "response = client.synonyms.get_synonyms_sets" + }, + { + "lang": "PHP", + "source": "$resp = $client->synonyms()->getSynonymsSets();" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_synonyms\"" } ] } @@ -23812,6 +31124,26 @@ { "lang": "Console", "source": "GET _tasks?detailed=true&actions=*/delete/byquery\n" + }, + { + "lang": "Python", + "source": "resp = client.tasks.list(\n detailed=True,\n actions=\"*/delete/byquery\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.tasks.list({\n detailed: \"true\",\n actions: \"*/delete/byquery\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.tasks.list(\n detailed: \"true\",\n actions: \"*/delete/byquery\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->tasks()->list([\n \"detailed\" => \"true\",\n \"actions\" => \"*/delete/byquery\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_tasks?detailed=true&actions=*/delete/byquery\"" } ] } @@ -23842,6 +31174,26 @@ { "lang": "Console", "source": "POST stackoverflow/_terms_enum\n{\n \"field\" : \"tags\",\n \"string\" : \"kiba\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.terms_enum(\n index=\"stackoverflow\",\n field=\"tags\",\n string=\"kiba\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.termsEnum({\n index: \"stackoverflow\",\n field: \"tags\",\n string: \"kiba\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.terms_enum(\n index: \"stackoverflow\",\n body: {\n \"field\": \"tags\",\n \"string\": \"kiba\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->termsEnum([\n \"index\" => \"stackoverflow\",\n \"body\" => [\n \"field\" => \"tags\",\n \"string\" => \"kiba\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"field\":\"tags\",\"string\":\"kiba\"}' \"$ELASTICSEARCH_URL/stackoverflow/_terms_enum\"" } ] }, @@ -23870,6 +31222,26 @@ { "lang": "Console", "source": "POST stackoverflow/_terms_enum\n{\n \"field\" : \"tags\",\n \"string\" : \"kiba\"\n}" + }, + { + "lang": "Python", + "source": "resp = client.terms_enum(\n index=\"stackoverflow\",\n field=\"tags\",\n string=\"kiba\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.termsEnum({\n index: \"stackoverflow\",\n field: \"tags\",\n string: \"kiba\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.terms_enum(\n index: \"stackoverflow\",\n body: {\n \"field\": \"tags\",\n \"string\": \"kiba\"\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->termsEnum([\n \"index\" => \"stackoverflow\",\n \"body\" => [\n \"field\" => \"tags\",\n \"string\" => \"kiba\",\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"field\":\"tags\",\"string\":\"kiba\"}' \"$ELASTICSEARCH_URL/stackoverflow/_terms_enum\"" } ] } @@ -23938,6 +31310,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_termvectors/1\n{\n \"fields\" : [\"text\"],\n \"offsets\" : true,\n \"payloads\" : true,\n \"positions\" : true,\n \"term_statistics\" : true,\n \"field_statistics\" : true\n}" + }, + { + "lang": "Python", + "source": "resp = client.termvectors(\n index=\"my-index-000001\",\n id=\"1\",\n fields=[\n \"text\"\n ],\n offsets=True,\n payloads=True,\n positions=True,\n term_statistics=True,\n field_statistics=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.termvectors({\n index: \"my-index-000001\",\n id: 1,\n fields: [\"text\"],\n offsets: true,\n payloads: true,\n positions: true,\n term_statistics: true,\n field_statistics: true,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.termvectors(\n index: \"my-index-000001\",\n id: \"1\",\n body: {\n \"fields\": [\n \"text\"\n ],\n \"offsets\": true,\n \"payloads\": true,\n \"positions\": true,\n \"term_statistics\": true,\n \"field_statistics\": true\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->termvectors([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"body\" => [\n \"fields\" => array(\n \"text\",\n ),\n \"offsets\" => true,\n \"payloads\" => true,\n \"positions\" => true,\n \"term_statistics\" => true,\n \"field_statistics\" => true,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"fields\":[\"text\"],\"offsets\":true,\"payloads\":true,\"positions\":true,\"term_statistics\":true,\"field_statistics\":true}' \"$ELASTICSEARCH_URL/my-index-000001/_termvectors/1\"" } ] }, @@ -24004,6 +31396,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_termvectors/1\n{\n \"fields\" : [\"text\"],\n \"offsets\" : true,\n \"payloads\" : true,\n \"positions\" : true,\n \"term_statistics\" : true,\n \"field_statistics\" : true\n}" + }, + { + "lang": "Python", + "source": "resp = client.termvectors(\n index=\"my-index-000001\",\n id=\"1\",\n fields=[\n \"text\"\n ],\n offsets=True,\n payloads=True,\n positions=True,\n term_statistics=True,\n field_statistics=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.termvectors({\n index: \"my-index-000001\",\n id: 1,\n fields: [\"text\"],\n offsets: true,\n payloads: true,\n positions: true,\n term_statistics: true,\n field_statistics: true,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.termvectors(\n index: \"my-index-000001\",\n id: \"1\",\n body: {\n \"fields\": [\n \"text\"\n ],\n \"offsets\": true,\n \"payloads\": true,\n \"positions\": true,\n \"term_statistics\": true,\n \"field_statistics\": true\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->termvectors([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"body\" => [\n \"fields\" => array(\n \"text\",\n ),\n \"offsets\" => true,\n \"payloads\" => true,\n \"positions\" => true,\n \"term_statistics\" => true,\n \"field_statistics\" => true,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"fields\":[\"text\"],\"offsets\":true,\"payloads\":true,\"positions\":true,\"term_statistics\":true,\"field_statistics\":true}' \"$ELASTICSEARCH_URL/my-index-000001/_termvectors/1\"" } ] } @@ -24069,6 +31481,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_termvectors/1\n{\n \"fields\" : [\"text\"],\n \"offsets\" : true,\n \"payloads\" : true,\n \"positions\" : true,\n \"term_statistics\" : true,\n \"field_statistics\" : true\n}" + }, + { + "lang": "Python", + "source": "resp = client.termvectors(\n index=\"my-index-000001\",\n id=\"1\",\n fields=[\n \"text\"\n ],\n offsets=True,\n payloads=True,\n positions=True,\n term_statistics=True,\n field_statistics=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.termvectors({\n index: \"my-index-000001\",\n id: 1,\n fields: [\"text\"],\n offsets: true,\n payloads: true,\n positions: true,\n term_statistics: true,\n field_statistics: true,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.termvectors(\n index: \"my-index-000001\",\n id: \"1\",\n body: {\n \"fields\": [\n \"text\"\n ],\n \"offsets\": true,\n \"payloads\": true,\n \"positions\": true,\n \"term_statistics\": true,\n \"field_statistics\": true\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->termvectors([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"body\" => [\n \"fields\" => array(\n \"text\",\n ),\n \"offsets\" => true,\n \"payloads\" => true,\n \"positions\" => true,\n \"term_statistics\" => true,\n \"field_statistics\" => true,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"fields\":[\"text\"],\"offsets\":true,\"payloads\":true,\"positions\":true,\"term_statistics\":true,\"field_statistics\":true}' \"$ELASTICSEARCH_URL/my-index-000001/_termvectors/1\"" } ] }, @@ -24132,6 +31564,26 @@ { "lang": "Console", "source": "GET /my-index-000001/_termvectors/1\n{\n \"fields\" : [\"text\"],\n \"offsets\" : true,\n \"payloads\" : true,\n \"positions\" : true,\n \"term_statistics\" : true,\n \"field_statistics\" : true\n}" + }, + { + "lang": "Python", + "source": "resp = client.termvectors(\n index=\"my-index-000001\",\n id=\"1\",\n fields=[\n \"text\"\n ],\n offsets=True,\n payloads=True,\n positions=True,\n term_statistics=True,\n field_statistics=True,\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.termvectors({\n index: \"my-index-000001\",\n id: 1,\n fields: [\"text\"],\n offsets: true,\n payloads: true,\n positions: true,\n term_statistics: true,\n field_statistics: true,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.termvectors(\n index: \"my-index-000001\",\n id: \"1\",\n body: {\n \"fields\": [\n \"text\"\n ],\n \"offsets\": true,\n \"payloads\": true,\n \"positions\": true,\n \"term_statistics\": true,\n \"field_statistics\": true\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->termvectors([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"body\" => [\n \"fields\" => array(\n \"text\",\n ),\n \"offsets\" => true,\n \"payloads\" => true,\n \"positions\" => true,\n \"term_statistics\" => true,\n \"field_statistics\" => true,\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"fields\":[\"text\"],\"offsets\":true,\"payloads\":true,\"positions\":true,\"term_statistics\":true,\"field_statistics\":true}' \"$ELASTICSEARCH_URL/my-index-000001/_termvectors/1\"" } ] } @@ -24171,6 +31623,26 @@ { "lang": "Console", "source": "GET _transform?size=10\n" + }, + { + "lang": "Python", + "source": "resp = client.transform.get_transform(\n size=\"10\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.getTransform({\n size: 10,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.get_transform(\n size: \"10\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->getTransform([\n \"size\" => \"10\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform?size=10\"" } ] }, @@ -24296,6 +31768,26 @@ { "lang": "Console", "source": "PUT _transform/ecommerce_transform1\n{\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\",\n \"query\": {\n \"term\": {\n \"geoip.continent_name\": {\n \"value\": \"Asia\"\n }\n }\n }\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n \"description\": \"Maximum priced ecommerce data by customer_id in Asia\",\n \"dest\": {\n \"index\": \"kibana_sample_data_ecommerce_transform1\",\n \"pipeline\": \"add_timestamp_pipeline\"\n },\n \"frequency\": \"5m\",\n \"sync\": {\n \"time\": {\n \"field\": \"order_date\",\n \"delay\": \"60s\"\n }\n },\n \"retention_policy\": {\n \"time\": {\n \"field\": \"order_date\",\n \"max_age\": \"30d\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.transform.put_transform(\n transform_id=\"ecommerce_transform1\",\n source={\n \"index\": \"kibana_sample_data_ecommerce\",\n \"query\": {\n \"term\": {\n \"geoip.continent_name\": {\n \"value\": \"Asia\"\n }\n }\n }\n },\n pivot={\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": True\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n description=\"Maximum priced ecommerce data by customer_id in Asia\",\n dest={\n \"index\": \"kibana_sample_data_ecommerce_transform1\",\n \"pipeline\": \"add_timestamp_pipeline\"\n },\n frequency=\"5m\",\n sync={\n \"time\": {\n \"field\": \"order_date\",\n \"delay\": \"60s\"\n }\n },\n retention_policy={\n \"time\": {\n \"field\": \"order_date\",\n \"max_age\": \"30d\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.putTransform({\n transform_id: \"ecommerce_transform1\",\n source: {\n index: \"kibana_sample_data_ecommerce\",\n query: {\n term: {\n \"geoip.continent_name\": {\n value: \"Asia\",\n },\n },\n },\n },\n pivot: {\n group_by: {\n customer_id: {\n terms: {\n field: \"customer_id\",\n missing_bucket: true,\n },\n },\n },\n aggregations: {\n max_price: {\n max: {\n field: \"taxful_total_price\",\n },\n },\n },\n },\n description: \"Maximum priced ecommerce data by customer_id in Asia\",\n dest: {\n index: \"kibana_sample_data_ecommerce_transform1\",\n pipeline: \"add_timestamp_pipeline\",\n },\n frequency: \"5m\",\n sync: {\n time: {\n field: \"order_date\",\n delay: \"60s\",\n },\n },\n retention_policy: {\n time: {\n field: \"order_date\",\n max_age: \"30d\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.put_transform(\n transform_id: \"ecommerce_transform1\",\n body: {\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\",\n \"query\": {\n \"term\": {\n \"geoip.continent_name\": {\n \"value\": \"Asia\"\n }\n }\n }\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n \"description\": \"Maximum priced ecommerce data by customer_id in Asia\",\n \"dest\": {\n \"index\": \"kibana_sample_data_ecommerce_transform1\",\n \"pipeline\": \"add_timestamp_pipeline\"\n },\n \"frequency\": \"5m\",\n \"sync\": {\n \"time\": {\n \"field\": \"order_date\",\n \"delay\": \"60s\"\n }\n },\n \"retention_policy\": {\n \"time\": {\n \"field\": \"order_date\",\n \"max_age\": \"30d\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->putTransform([\n \"transform_id\" => \"ecommerce_transform1\",\n \"body\" => [\n \"source\" => [\n \"index\" => \"kibana_sample_data_ecommerce\",\n \"query\" => [\n \"term\" => [\n \"geoip.continent_name\" => [\n \"value\" => \"Asia\",\n ],\n ],\n ],\n ],\n \"pivot\" => [\n \"group_by\" => [\n \"customer_id\" => [\n \"terms\" => [\n \"field\" => \"customer_id\",\n \"missing_bucket\" => true,\n ],\n ],\n ],\n \"aggregations\" => [\n \"max_price\" => [\n \"max\" => [\n \"field\" => \"taxful_total_price\",\n ],\n ],\n ],\n ],\n \"description\" => \"Maximum priced ecommerce data by customer_id in Asia\",\n \"dest\" => [\n \"index\" => \"kibana_sample_data_ecommerce_transform1\",\n \"pipeline\" => \"add_timestamp_pipeline\",\n ],\n \"frequency\" => \"5m\",\n \"sync\" => [\n \"time\" => [\n \"field\" => \"order_date\",\n \"delay\" => \"60s\",\n ],\n ],\n \"retention_policy\" => [\n \"time\" => [\n \"field\" => \"order_date\",\n \"max_age\" => \"30d\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"kibana_sample_data_ecommerce\",\"query\":{\"term\":{\"geoip.continent_name\":{\"value\":\"Asia\"}}}},\"pivot\":{\"group_by\":{\"customer_id\":{\"terms\":{\"field\":\"customer_id\",\"missing_bucket\":true}}},\"aggregations\":{\"max_price\":{\"max\":{\"field\":\"taxful_total_price\"}}}},\"description\":\"Maximum priced ecommerce data by customer_id in Asia\",\"dest\":{\"index\":\"kibana_sample_data_ecommerce_transform1\",\"pipeline\":\"add_timestamp_pipeline\"},\"frequency\":\"5m\",\"sync\":{\"time\":{\"field\":\"order_date\",\"delay\":\"60s\"}},\"retention_policy\":{\"time\":{\"field\":\"order_date\",\"max_age\":\"30d\"}}}' \"$ELASTICSEARCH_URL/_transform/ecommerce_transform1\"" } ] }, @@ -24372,6 +31864,26 @@ { "lang": "Console", "source": "DELETE _transform/ecommerce_transform\n" + }, + { + "lang": "Python", + "source": "resp = client.transform.delete_transform(\n transform_id=\"ecommerce_transform\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.deleteTransform({\n transform_id: \"ecommerce_transform\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.delete_transform(\n transform_id: \"ecommerce_transform\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->deleteTransform([\n \"transform_id\" => \"ecommerce_transform\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/ecommerce_transform\"" } ] } @@ -24408,6 +31920,26 @@ { "lang": "Console", "source": "GET _transform?size=10\n" + }, + { + "lang": "Python", + "source": "resp = client.transform.get_transform(\n size=\"10\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.getTransform({\n size: 10,\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.get_transform(\n size: \"10\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->getTransform([\n \"size\" => \"10\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform?size=10\"" } ] } @@ -24511,6 +32043,26 @@ { "lang": "Console", "source": "GET _transform/ecommerce-customer-transform/_stats\n" + }, + { + "lang": "Python", + "source": "resp = client.transform.get_transform_stats(\n transform_id=\"ecommerce-customer-transform\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.getTransformStats({\n transform_id: \"ecommerce-customer-transform\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.get_transform_stats(\n transform_id: \"ecommerce-customer-transform\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->getTransformStats([\n \"transform_id\" => \"ecommerce-customer-transform\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/ecommerce-customer-transform/_stats\"" } ] } @@ -24544,6 +32096,26 @@ { "lang": "Console", "source": "POST _transform/_preview\n{\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.transform.preview_transform(\n source={\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n pivot={\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": True\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.previewTransform({\n source: {\n index: \"kibana_sample_data_ecommerce\",\n },\n pivot: {\n group_by: {\n customer_id: {\n terms: {\n field: \"customer_id\",\n missing_bucket: true,\n },\n },\n },\n aggregations: {\n max_price: {\n max: {\n field: \"taxful_total_price\",\n },\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.preview_transform(\n body: {\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->previewTransform([\n \"body\" => [\n \"source\" => [\n \"index\" => \"kibana_sample_data_ecommerce\",\n ],\n \"pivot\" => [\n \"group_by\" => [\n \"customer_id\" => [\n \"terms\" => [\n \"field\" => \"customer_id\",\n \"missing_bucket\" => true,\n ],\n ],\n ],\n \"aggregations\" => [\n \"max_price\" => [\n \"max\" => [\n \"field\" => \"taxful_total_price\",\n ],\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"kibana_sample_data_ecommerce\"},\"pivot\":{\"group_by\":{\"customer_id\":{\"terms\":{\"field\":\"customer_id\",\"missing_bucket\":true}}},\"aggregations\":{\"max_price\":{\"max\":{\"field\":\"taxful_total_price\"}}}}}' \"$ELASTICSEARCH_URL/_transform/_preview\"" } ] }, @@ -24575,6 +32147,26 @@ { "lang": "Console", "source": "POST _transform/_preview\n{\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.transform.preview_transform(\n source={\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n pivot={\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": True\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.previewTransform({\n source: {\n index: \"kibana_sample_data_ecommerce\",\n },\n pivot: {\n group_by: {\n customer_id: {\n terms: {\n field: \"customer_id\",\n missing_bucket: true,\n },\n },\n },\n aggregations: {\n max_price: {\n max: {\n field: \"taxful_total_price\",\n },\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.preview_transform(\n body: {\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->previewTransform([\n \"body\" => [\n \"source\" => [\n \"index\" => \"kibana_sample_data_ecommerce\",\n ],\n \"pivot\" => [\n \"group_by\" => [\n \"customer_id\" => [\n \"terms\" => [\n \"field\" => \"customer_id\",\n \"missing_bucket\" => true,\n ],\n ],\n ],\n \"aggregations\" => [\n \"max_price\" => [\n \"max\" => [\n \"field\" => \"taxful_total_price\",\n ],\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"kibana_sample_data_ecommerce\"},\"pivot\":{\"group_by\":{\"customer_id\":{\"terms\":{\"field\":\"customer_id\",\"missing_bucket\":true}}},\"aggregations\":{\"max_price\":{\"max\":{\"field\":\"taxful_total_price\"}}}}}' \"$ELASTICSEARCH_URL/_transform/_preview\"" } ] } @@ -24605,6 +32197,26 @@ { "lang": "Console", "source": "POST _transform/_preview\n{\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.transform.preview_transform(\n source={\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n pivot={\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": True\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.previewTransform({\n source: {\n index: \"kibana_sample_data_ecommerce\",\n },\n pivot: {\n group_by: {\n customer_id: {\n terms: {\n field: \"customer_id\",\n missing_bucket: true,\n },\n },\n },\n aggregations: {\n max_price: {\n max: {\n field: \"taxful_total_price\",\n },\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.preview_transform(\n body: {\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->previewTransform([\n \"body\" => [\n \"source\" => [\n \"index\" => \"kibana_sample_data_ecommerce\",\n ],\n \"pivot\" => [\n \"group_by\" => [\n \"customer_id\" => [\n \"terms\" => [\n \"field\" => \"customer_id\",\n \"missing_bucket\" => true,\n ],\n ],\n ],\n \"aggregations\" => [\n \"max_price\" => [\n \"max\" => [\n \"field\" => \"taxful_total_price\",\n ],\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"kibana_sample_data_ecommerce\"},\"pivot\":{\"group_by\":{\"customer_id\":{\"terms\":{\"field\":\"customer_id\",\"missing_bucket\":true}}},\"aggregations\":{\"max_price\":{\"max\":{\"field\":\"taxful_total_price\"}}}}}' \"$ELASTICSEARCH_URL/_transform/_preview\"" } ] }, @@ -24633,6 +32245,26 @@ { "lang": "Console", "source": "POST _transform/_preview\n{\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.transform.preview_transform(\n source={\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n pivot={\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": True\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.previewTransform({\n source: {\n index: \"kibana_sample_data_ecommerce\",\n },\n pivot: {\n group_by: {\n customer_id: {\n terms: {\n field: \"customer_id\",\n missing_bucket: true,\n },\n },\n },\n aggregations: {\n max_price: {\n max: {\n field: \"taxful_total_price\",\n },\n },\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.preview_transform(\n body: {\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->previewTransform([\n \"body\" => [\n \"source\" => [\n \"index\" => \"kibana_sample_data_ecommerce\",\n ],\n \"pivot\" => [\n \"group_by\" => [\n \"customer_id\" => [\n \"terms\" => [\n \"field\" => \"customer_id\",\n \"missing_bucket\" => true,\n ],\n ],\n ],\n \"aggregations\" => [\n \"max_price\" => [\n \"max\" => [\n \"field\" => \"taxful_total_price\",\n ],\n ],\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"kibana_sample_data_ecommerce\"},\"pivot\":{\"group_by\":{\"customer_id\":{\"terms\":{\"field\":\"customer_id\",\"missing_bucket\":true}}},\"aggregations\":{\"max_price\":{\"max\":{\"field\":\"taxful_total_price\"}}}}}' \"$ELASTICSEARCH_URL/_transform/_preview\"" } ] } @@ -24701,6 +32333,26 @@ { "lang": "Console", "source": "POST _transform/ecommerce_transform/_reset\n" + }, + { + "lang": "Python", + "source": "resp = client.transform.reset_transform(\n transform_id=\"ecommerce_transform\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.resetTransform({\n transform_id: \"ecommerce_transform\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.reset_transform(\n transform_id: \"ecommerce_transform\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->resetTransform([\n \"transform_id\" => \"ecommerce_transform\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/ecommerce_transform/_reset\"" } ] } @@ -24759,6 +32411,26 @@ { "lang": "Console", "source": "POST _transform/ecommerce_transform/_schedule_now\n" + }, + { + "lang": "Python", + "source": "resp = client.transform.schedule_now_transform(\n transform_id=\"ecommerce_transform\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.scheduleNowTransform({\n transform_id: \"ecommerce_transform\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.schedule_now_transform(\n transform_id: \"ecommerce_transform\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->scheduleNowTransform([\n \"transform_id\" => \"ecommerce_transform\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/ecommerce_transform/_schedule_now\"" } ] } @@ -24827,6 +32499,26 @@ { "lang": "Console", "source": "POST _transform/ecommerce-customer-transform/_start\n" + }, + { + "lang": "Python", + "source": "resp = client.transform.start_transform(\n transform_id=\"ecommerce-customer-transform\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.startTransform({\n transform_id: \"ecommerce-customer-transform\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.start_transform(\n transform_id: \"ecommerce-customer-transform\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->startTransform([\n \"transform_id\" => \"ecommerce-customer-transform\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/ecommerce-customer-transform/_start\"" } ] } @@ -24925,6 +32617,26 @@ { "lang": "Console", "source": "POST _transform/ecommerce_transform/_stop\n" + }, + { + "lang": "Python", + "source": "resp = client.transform.stop_transform(\n transform_id=\"ecommerce_transform\",\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.stopTransform({\n transform_id: \"ecommerce_transform\",\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.stop_transform(\n transform_id: \"ecommerce_transform\"\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->stopTransform([\n \"transform_id\" => \"ecommerce_transform\",\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/ecommerce_transform/_stop\"" } ] } @@ -25098,6 +32810,26 @@ { "lang": "Console", "source": "POST _transform/simple-kibana-ecomm-pivot/_update\n{\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\",\n \"query\": {\n \"term\": {\n \"geoip.continent_name\": {\n \"value\": \"Asia\"\n }\n }\n }\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n \"description\": \"Maximum priced ecommerce data by customer_id in Asia\",\n \"dest\": {\n \"index\": \"kibana_sample_data_ecommerce_transform1\",\n \"pipeline\": \"add_timestamp_pipeline\"\n },\n \"frequency\": \"5m\",\n \"sync\": {\n \"time\": {\n \"field\": \"order_date\",\n \"delay\": \"60s\"\n }\n },\n \"retention_policy\": {\n \"time\": {\n \"field\": \"order_date\",\n \"max_age\": \"30d\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.transform.update_transform(\n transform_id=\"simple-kibana-ecomm-pivot\",\n source={\n \"index\": \"kibana_sample_data_ecommerce\",\n \"query\": {\n \"term\": {\n \"geoip.continent_name\": {\n \"value\": \"Asia\"\n }\n }\n }\n },\n pivot={\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": True\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n description=\"Maximum priced ecommerce data by customer_id in Asia\",\n dest={\n \"index\": \"kibana_sample_data_ecommerce_transform1\",\n \"pipeline\": \"add_timestamp_pipeline\"\n },\n frequency=\"5m\",\n sync={\n \"time\": {\n \"field\": \"order_date\",\n \"delay\": \"60s\"\n }\n },\n retention_policy={\n \"time\": {\n \"field\": \"order_date\",\n \"max_age\": \"30d\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.transform.updateTransform({\n transform_id: \"simple-kibana-ecomm-pivot\",\n source: {\n index: \"kibana_sample_data_ecommerce\",\n query: {\n term: {\n \"geoip.continent_name\": {\n value: \"Asia\",\n },\n },\n },\n },\n pivot: {\n group_by: {\n customer_id: {\n terms: {\n field: \"customer_id\",\n missing_bucket: true,\n },\n },\n },\n aggregations: {\n max_price: {\n max: {\n field: \"taxful_total_price\",\n },\n },\n },\n },\n description: \"Maximum priced ecommerce data by customer_id in Asia\",\n dest: {\n index: \"kibana_sample_data_ecommerce_transform1\",\n pipeline: \"add_timestamp_pipeline\",\n },\n frequency: \"5m\",\n sync: {\n time: {\n field: \"order_date\",\n delay: \"60s\",\n },\n },\n retention_policy: {\n time: {\n field: \"order_date\",\n max_age: \"30d\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.transform.update_transform(\n transform_id: \"simple-kibana-ecomm-pivot\",\n body: {\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\",\n \"query\": {\n \"term\": {\n \"geoip.continent_name\": {\n \"value\": \"Asia\"\n }\n }\n }\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n \"description\": \"Maximum priced ecommerce data by customer_id in Asia\",\n \"dest\": {\n \"index\": \"kibana_sample_data_ecommerce_transform1\",\n \"pipeline\": \"add_timestamp_pipeline\"\n },\n \"frequency\": \"5m\",\n \"sync\": {\n \"time\": {\n \"field\": \"order_date\",\n \"delay\": \"60s\"\n }\n },\n \"retention_policy\": {\n \"time\": {\n \"field\": \"order_date\",\n \"max_age\": \"30d\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->transform()->updateTransform([\n \"transform_id\" => \"simple-kibana-ecomm-pivot\",\n \"body\" => [\n \"source\" => [\n \"index\" => \"kibana_sample_data_ecommerce\",\n \"query\" => [\n \"term\" => [\n \"geoip.continent_name\" => [\n \"value\" => \"Asia\",\n ],\n ],\n ],\n ],\n \"pivot\" => [\n \"group_by\" => [\n \"customer_id\" => [\n \"terms\" => [\n \"field\" => \"customer_id\",\n \"missing_bucket\" => true,\n ],\n ],\n ],\n \"aggregations\" => [\n \"max_price\" => [\n \"max\" => [\n \"field\" => \"taxful_total_price\",\n ],\n ],\n ],\n ],\n \"description\" => \"Maximum priced ecommerce data by customer_id in Asia\",\n \"dest\" => [\n \"index\" => \"kibana_sample_data_ecommerce_transform1\",\n \"pipeline\" => \"add_timestamp_pipeline\",\n ],\n \"frequency\" => \"5m\",\n \"sync\" => [\n \"time\" => [\n \"field\" => \"order_date\",\n \"delay\" => \"60s\",\n ],\n ],\n \"retention_policy\" => [\n \"time\" => [\n \"field\" => \"order_date\",\n \"max_age\" => \"30d\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"kibana_sample_data_ecommerce\",\"query\":{\"term\":{\"geoip.continent_name\":{\"value\":\"Asia\"}}}},\"pivot\":{\"group_by\":{\"customer_id\":{\"terms\":{\"field\":\"customer_id\",\"missing_bucket\":true}}},\"aggregations\":{\"max_price\":{\"max\":{\"field\":\"taxful_total_price\"}}}},\"description\":\"Maximum priced ecommerce data by customer_id in Asia\",\"dest\":{\"index\":\"kibana_sample_data_ecommerce_transform1\",\"pipeline\":\"add_timestamp_pipeline\"},\"frequency\":\"5m\",\"sync\":{\"time\":{\"field\":\"order_date\",\"delay\":\"60s\"}},\"retention_policy\":{\"time\":{\"field\":\"order_date\",\"max_age\":\"30d\"}}}' \"$ELASTICSEARCH_URL/_transform/simple-kibana-ecomm-pivot/_update\"" } ] } @@ -25382,6 +33114,26 @@ { "lang": "Console", "source": "POST test/_update/1\n{\n \"script\" : {\n \"source\": \"ctx._source.counter += params.count\",\n \"lang\": \"painless\",\n \"params\" : {\n \"count\" : 4\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.update(\n index=\"test\",\n id=\"1\",\n script={\n \"source\": \"ctx._source.counter += params.count\",\n \"lang\": \"painless\",\n \"params\": {\n \"count\": 4\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.update({\n index: \"test\",\n id: 1,\n script: {\n source: \"ctx._source.counter += params.count\",\n lang: \"painless\",\n params: {\n count: 4,\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.update(\n index: \"test\",\n id: \"1\",\n body: {\n \"script\": {\n \"source\": \"ctx._source.counter += params.count\",\n \"lang\": \"painless\",\n \"params\": {\n \"count\": 4\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->update([\n \"index\" => \"test\",\n \"id\" => \"1\",\n \"body\" => [\n \"script\" => [\n \"source\" => \"ctx._source.counter += params.count\",\n \"lang\" => \"painless\",\n \"params\" => [\n \"count\" => 4,\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"source\":\"ctx._source.counter += params.count\",\"lang\":\"painless\",\"params\":{\"count\":4}}}' \"$ELASTICSEARCH_URL/test/_update/1\"" } ] } @@ -25851,6 +33603,26 @@ { "lang": "Console", "source": "POST my-index-000001/_update_by_query?conflicts=proceed\n{\n \"query\": { \n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n}" + }, + { + "lang": "Python", + "source": "resp = client.update_by_query(\n index=\"my-index-000001\",\n conflicts=\"proceed\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)" + }, + { + "lang": "JavaScript", + "source": "const response = await client.updateByQuery({\n index: \"my-index-000001\",\n conflicts: \"proceed\",\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});" + }, + { + "lang": "Ruby", + "source": "response = client.update_by_query(\n index: \"my-index-000001\",\n conflicts: \"proceed\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)" + }, + { + "lang": "PHP", + "source": "$resp = $client->updateByQuery([\n \"index\" => \"my-index-000001\",\n \"conflicts\" => \"proceed\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);" + }, + { + "lang": "curl", + "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_update_by_query?conflicts=proceed\"" } ] } @@ -53453,6 +61225,7 @@ ] }, "inference._types.RateLimitSetting": { + "description": "This setting helps to minimize the number of rate limit errors returned from the service.", "type": "object", "properties": { "requests_per_minute": { diff --git a/output/schema/schema.json b/output/schema/schema.json index dd873ebdf8..137b04689d 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -13634,7 +13634,7 @@ "stability": "stable" } }, - "description": "Create a datafeed.\nDatafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job.\nYou can associate only one datafeed with each anomaly detection job.\nThe datafeed contains a query that runs at a defined interval (`frequency`).\nIf you are concerned about delayed data, you can add a delay (`query_delay') at each interval.\nBy default, the datafeed uses the following query: `{\"match_all\": {\"boost\": 1}}`.\n\nWhen Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had\nat the time of creation and runs the query using those same roles. If you provide secondary authorization headers,\nthose credentials are used instead.\nYou must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed\ndirectly to the `.ml-config` index. Do not give users `write` privileges on the `.ml-config` index.", + "description": "Create a datafeed.\nDatafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job.\nYou can associate only one datafeed with each anomaly detection job.\nThe datafeed contains a query that runs at a defined interval (`frequency`).\nIf you are concerned about delayed data, you can add a delay (`query_delay`) at each interval.\nBy default, the datafeed uses the following query: `{\"match_all\": {\"boost\": 1}}`.\n\nWhen Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had\nat the time of creation and runs the query using those same roles. If you provide secondary authorization headers,\nthose credentials are used instead.\nYou must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed\ndirectly to the `.ml-config` index. Do not give users `write` privileges on the `.ml-config` index.", "docId": "ml-put-datafeed", "docTag": "ml anomaly", "docUrl": "https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-ml-put-datafeed", @@ -23687,24 +23687,112 @@ "description": "Bulk index or delete documents.\nPerform multiple `index`, `create`, `delete`, and `update` actions in a single request.\nThis reduces overhead and can greatly increase indexing speed.\n\nIf the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias:\n\n* To use the `create` action, you must have the `create_doc`, `create`, `index`, or `write` index privilege. Data streams support only the `create` action.\n* To use the `index` action, you must have the `create`, `index`, or `write` index privilege.\n* To use the `delete` action, you must have the `delete` or `write` index privilege.\n* To use the `update` action, you must have the `index` or `write` index privilege.\n* To automatically create a data stream or index with a bulk API request, you must have the `auto_configure`, `create_index`, or `manage` index privilege.\n* To make the result of a bulk operation visible to search using the `refresh` parameter, you must have the `maintenance` or `manage` index privilege.\n\nAutomatic data stream creation requires a matching index template with data stream enabled.\n\nThe actions are specified in the request body using a newline delimited JSON (NDJSON) structure:\n\n```\naction_and_meta_data\\n\noptional_source\\n\naction_and_meta_data\\n\noptional_source\\n\n....\naction_and_meta_data\\n\noptional_source\\n\n```\n\nThe `index` and `create` actions expect a source on the next line and have the same semantics as the `op_type` parameter in the standard index API.\nA `create` action fails if a document with the same ID already exists in the target\nAn `index` action adds or replaces a document as necessary.\n\nNOTE: Data streams support only the `create` action.\nTo update or delete a document in a data stream, you must target the backing index containing the document.\n\nAn `update` action expects that the partial doc, upsert, and script and its options are specified on the next line.\n\nA `delete` action does not expect a source on the next line and has the same semantics as the standard delete API.\n\nNOTE: The final line of data must end with a newline character (`\\n`).\nEach newline character may be preceded by a carriage return (`\\r`).\nWhen sending NDJSON data to the `_bulk` endpoint, use a `Content-Type` header of `application/json` or `application/x-ndjson`.\nBecause this format uses literal newline characters (`\\n`) as delimiters, make sure that the JSON actions and sources are not pretty printed.\n\nIf you provide a target in the request path, it is used for any actions that don't explicitly specify an `_index` argument.\n\nA note on the format: the idea here is to make processing as fast as possible.\nAs some of the actions are redirected to other shards on other nodes, only `action_meta_data` is parsed on the receiving node side.\n\nClient libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible.\n\nThere is no \"correct\" number of actions to perform in a single bulk request.\nExperiment with different settings to find the optimal size for your particular workload.\nNote that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size.\nIt is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch.\nFor instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch.\n\n**Client suppport for bulk requests**\n\nSome of the officially supported clients provide helpers to assist with bulk requests and reindexing:\n\n* Go: Check out `esutil.BulkIndexer`\n* Perl: Check out `Search::Elasticsearch::Client::5_0::Bulk` and `Search::Elasticsearch::Client::5_0::Scroll`\n* Python: Check out `elasticsearch.helpers.*`\n* JavaScript: Check out `client.helpers.*`\n* .NET: Check out `BulkAllObservable`\n* PHP: Check out bulk indexing.\n\n**Submitting bulk requests with cURL**\n\nIf you're providing text file input to `curl`, you must use the `--data-binary` flag instead of plain `-d`.\nThe latter doesn't preserve newlines. For example:\n\n```\n$ cat requests\n{ \"index\" : { \"_index\" : \"test\", \"_id\" : \"1\" } }\n{ \"field1\" : \"value1\" }\n$ curl -s -H \"Content-Type: application/x-ndjson\" -XPOST localhost:9200/_bulk --data-binary \"@requests\"; echo\n{\"took\":7, \"errors\": false, \"items\":[{\"index\":{\"_index\":\"test\",\"_id\":\"1\",\"_version\":1,\"result\":\"created\",\"forced_refresh\":false}}]}\n```\n\n**Optimistic concurrency control**\n\nEach `index` and `delete` action within a bulk API call may include the `if_seq_no` and `if_primary_term` parameters in their respective action and meta data lines.\nThe `if_seq_no` and `if_primary_term` parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details.\n\n**Versioning**\n\nEach bulk item can include the version value using the `version` field.\nIt automatically follows the behavior of the index or delete operation based on the `_version` mapping.\nIt also support the `version_type`.\n\n**Routing**\n\nEach bulk item can include the routing value using the `routing` field.\nIt automatically follows the behavior of the index or delete operation based on the `_routing` mapping.\n\nNOTE: Data streams do not support custom routing unless they were created with the `allow_custom_routing` setting enabled in the template.\n\n**Wait for active shards**\n\nWhen making bulk calls, you can set the `wait_for_active_shards` parameter to require a minimum number of shard copies to be active before starting to process the bulk request.\n\n**Refresh**\n\nControl when the changes made by this request are visible to search.\n\nNOTE: Only the shards that receive the bulk request will be affected by refresh.\nImagine a `_bulk?refresh=wait_for` request with three documents in it that happen to be routed to different shards in an index with five shards.\nThe request will only wait for those three shards to refresh.\nThe other two shards that make up the index do not participate in the `_bulk` request at all.\n\nYou might want to disable the refresh interval temporarily to improve indexing throughput for large bulk requests.\nRefer to the linked documentation for step-by-step instructions using the index settings API.", "examples": { "BulkRequestExample1": { + "alternatives": [ + { + "code": "resp = client.bulk(\n operations=[\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.bulk({\n operations: [\n {\n index: {\n _index: \"test\",\n _id: \"1\",\n },\n },\n {\n field1: \"value1\",\n },\n {\n delete: {\n _index: \"test\",\n _id: \"2\",\n },\n },\n {\n create: {\n _index: \"test\",\n _id: \"3\",\n },\n },\n {\n field1: \"value3\",\n },\n {\n update: {\n _id: \"1\",\n _index: \"test\",\n },\n },\n {\n doc: {\n field2: \"value2\",\n },\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.bulk(\n body: [\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ]\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->bulk([\n \"body\" => array(\n [\n \"index\" => [\n \"_index\" => \"test\",\n \"_id\" => \"1\",\n ],\n ],\n [\n \"field1\" => \"value1\",\n ],\n [\n \"delete\" => [\n \"_index\" => \"test\",\n \"_id\" => \"2\",\n ],\n ],\n [\n \"create\" => [\n \"_index\" => \"test\",\n \"_id\" => \"3\",\n ],\n ],\n [\n \"field1\" => \"value3\",\n ],\n [\n \"update\" => [\n \"_id\" => \"1\",\n \"_index\" => \"test\",\n ],\n ],\n [\n \"doc\" => [\n \"field2\" => \"value2\",\n ],\n ],\n ),\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{\"index\":{\"_index\":\"test\",\"_id\":\"1\"}},{\"field1\":\"value1\"},{\"delete\":{\"_index\":\"test\",\"_id\":\"2\"}},{\"create\":{\"_index\":\"test\",\"_id\":\"3\"}},{\"field1\":\"value3\"},{\"update\":{\"_id\":\"1\",\"_index\":\"test\"}},{\"doc\":{\"field2\":\"value2\"}}]' \"$ELASTICSEARCH_URL/_bulk\"", + "language": "curl" + } + ], "description": "Run `POST _bulk` to perform multiple operations.", "method_request": "POST _bulk", "summary": "Multiple operations", "value": "{ \"index\" : { \"_index\" : \"test\", \"_id\" : \"1\" } }\n{ \"field1\" : \"value1\" }\n{ \"delete\" : { \"_index\" : \"test\", \"_id\" : \"2\" } }\n{ \"create\" : { \"_index\" : \"test\", \"_id\" : \"3\" } }\n{ \"field1\" : \"value3\" }\n{ \"update\" : {\"_id\" : \"1\", \"_index\" : \"test\"} }\n{ \"doc\" : {\"field2\" : \"value2\"} }" }, "BulkRequestExample2": { + "alternatives": [ + { + "code": "resp = client.bulk(\n operations=[\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"index1\",\n \"retry_on_conflict\": 3\n }\n },\n {\n \"doc\": {\n \"field\": \"value\"\n }\n },\n {\n \"update\": {\n \"_id\": \"0\",\n \"_index\": \"index1\",\n \"retry_on_conflict\": 3\n }\n },\n {\n \"script\": {\n \"source\": \"ctx._source.counter += params.param1\",\n \"lang\": \"painless\",\n \"params\": {\n \"param1\": 1\n }\n },\n \"upsert\": {\n \"counter\": 1\n }\n },\n {\n \"update\": {\n \"_id\": \"2\",\n \"_index\": \"index1\",\n \"retry_on_conflict\": 3\n }\n },\n {\n \"doc\": {\n \"field\": \"value\"\n },\n \"doc_as_upsert\": True\n },\n {\n \"update\": {\n \"_id\": \"3\",\n \"_index\": \"index1\",\n \"_source\": True\n }\n },\n {\n \"doc\": {\n \"field\": \"value\"\n }\n },\n {\n \"update\": {\n \"_id\": \"4\",\n \"_index\": \"index1\"\n }\n },\n {\n \"doc\": {\n \"field\": \"value\"\n },\n \"_source\": True\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.bulk({\n operations: [\n {\n update: {\n _id: \"1\",\n _index: \"index1\",\n retry_on_conflict: 3,\n },\n },\n {\n doc: {\n field: \"value\",\n },\n },\n {\n update: {\n _id: \"0\",\n _index: \"index1\",\n retry_on_conflict: 3,\n },\n },\n {\n script: {\n source: \"ctx._source.counter += params.param1\",\n lang: \"painless\",\n params: {\n param1: 1,\n },\n },\n upsert: {\n counter: 1,\n },\n },\n {\n update: {\n _id: \"2\",\n _index: \"index1\",\n retry_on_conflict: 3,\n },\n },\n {\n doc: {\n field: \"value\",\n },\n doc_as_upsert: true,\n },\n {\n update: {\n _id: \"3\",\n _index: \"index1\",\n _source: true,\n },\n },\n {\n doc: {\n field: \"value\",\n },\n },\n {\n update: {\n _id: \"4\",\n _index: \"index1\",\n },\n },\n {\n doc: {\n field: \"value\",\n },\n _source: true,\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.bulk(\n body: [\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"index1\",\n \"retry_on_conflict\": 3\n }\n },\n {\n \"doc\": {\n \"field\": \"value\"\n }\n },\n {\n \"update\": {\n \"_id\": \"0\",\n \"_index\": \"index1\",\n \"retry_on_conflict\": 3\n }\n },\n {\n \"script\": {\n \"source\": \"ctx._source.counter += params.param1\",\n \"lang\": \"painless\",\n \"params\": {\n \"param1\": 1\n }\n },\n \"upsert\": {\n \"counter\": 1\n }\n },\n {\n \"update\": {\n \"_id\": \"2\",\n \"_index\": \"index1\",\n \"retry_on_conflict\": 3\n }\n },\n {\n \"doc\": {\n \"field\": \"value\"\n },\n \"doc_as_upsert\": true\n },\n {\n \"update\": {\n \"_id\": \"3\",\n \"_index\": \"index1\",\n \"_source\": true\n }\n },\n {\n \"doc\": {\n \"field\": \"value\"\n }\n },\n {\n \"update\": {\n \"_id\": \"4\",\n \"_index\": \"index1\"\n }\n },\n {\n \"doc\": {\n \"field\": \"value\"\n },\n \"_source\": true\n }\n ]\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->bulk([\n \"body\" => array(\n [\n \"update\" => [\n \"_id\" => \"1\",\n \"_index\" => \"index1\",\n \"retry_on_conflict\" => 3,\n ],\n ],\n [\n \"doc\" => [\n \"field\" => \"value\",\n ],\n ],\n [\n \"update\" => [\n \"_id\" => \"0\",\n \"_index\" => \"index1\",\n \"retry_on_conflict\" => 3,\n ],\n ],\n [\n \"script\" => [\n \"source\" => \"ctx._source.counter += params.param1\",\n \"lang\" => \"painless\",\n \"params\" => [\n \"param1\" => 1,\n ],\n ],\n \"upsert\" => [\n \"counter\" => 1,\n ],\n ],\n [\n \"update\" => [\n \"_id\" => \"2\",\n \"_index\" => \"index1\",\n \"retry_on_conflict\" => 3,\n ],\n ],\n [\n \"doc\" => [\n \"field\" => \"value\",\n ],\n \"doc_as_upsert\" => true,\n ],\n [\n \"update\" => [\n \"_id\" => \"3\",\n \"_index\" => \"index1\",\n \"_source\" => true,\n ],\n ],\n [\n \"doc\" => [\n \"field\" => \"value\",\n ],\n ],\n [\n \"update\" => [\n \"_id\" => \"4\",\n \"_index\" => \"index1\",\n ],\n ],\n [\n \"doc\" => [\n \"field\" => \"value\",\n ],\n \"_source\" => true,\n ],\n ),\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{\"update\":{\"_id\":\"1\",\"_index\":\"index1\",\"retry_on_conflict\":3}},{\"doc\":{\"field\":\"value\"}},{\"update\":{\"_id\":\"0\",\"_index\":\"index1\",\"retry_on_conflict\":3}},{\"script\":{\"source\":\"ctx._source.counter += params.param1\",\"lang\":\"painless\",\"params\":{\"param1\":1}},\"upsert\":{\"counter\":1}},{\"update\":{\"_id\":\"2\",\"_index\":\"index1\",\"retry_on_conflict\":3}},{\"doc\":{\"field\":\"value\"},\"doc_as_upsert\":true},{\"update\":{\"_id\":\"3\",\"_index\":\"index1\",\"_source\":true}},{\"doc\":{\"field\":\"value\"}},{\"update\":{\"_id\":\"4\",\"_index\":\"index1\"}},{\"doc\":{\"field\":\"value\"},\"_source\":true}]' \"$ELASTICSEARCH_URL/_bulk\"", + "language": "curl" + } + ], "description": "When you run `POST _bulk` and use the `update` action, you can use `retry_on_conflict` as a field in the action itself (not in the extra payload line) to specify how many times an update should be retried in the case of a version conflict.\n", "method_request": "POST _bulk", "summary": "Bulk updates", "value": "{ \"update\" : {\"_id\" : \"1\", \"_index\" : \"index1\", \"retry_on_conflict\" : 3} }\n{ \"doc\" : {\"field\" : \"value\"} }\n{ \"update\" : { \"_id\" : \"0\", \"_index\" : \"index1\", \"retry_on_conflict\" : 3} }\n{ \"script\" : { \"source\": \"ctx._source.counter += params.param1\", \"lang\" : \"painless\", \"params\" : {\"param1\" : 1}}, \"upsert\" : {\"counter\" : 1}}\n{ \"update\" : {\"_id\" : \"2\", \"_index\" : \"index1\", \"retry_on_conflict\" : 3} }\n{ \"doc\" : {\"field\" : \"value\"}, \"doc_as_upsert\" : true }\n{ \"update\" : {\"_id\" : \"3\", \"_index\" : \"index1\", \"_source\" : true} }\n{ \"doc\" : {\"field\" : \"value\"} }\n{ \"update\" : {\"_id\" : \"4\", \"_index\" : \"index1\"} }\n{ \"doc\" : {\"field\" : \"value\"}, \"_source\": true}" }, "BulkRequestExample3": { + "alternatives": [ + { + "code": "resp = client.bulk(\n operations=[\n {\n \"update\": {\n \"_id\": \"5\",\n \"_index\": \"index1\"\n }\n },\n {\n \"doc\": {\n \"my_field\": \"foo\"\n }\n },\n {\n \"update\": {\n \"_id\": \"6\",\n \"_index\": \"index1\"\n }\n },\n {\n \"doc\": {\n \"my_field\": \"foo\"\n }\n },\n {\n \"create\": {\n \"_id\": \"7\",\n \"_index\": \"index1\"\n }\n },\n {\n \"my_field\": \"foo\"\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.bulk({\n operations: [\n {\n update: {\n _id: \"5\",\n _index: \"index1\",\n },\n },\n {\n doc: {\n my_field: \"foo\",\n },\n },\n {\n update: {\n _id: \"6\",\n _index: \"index1\",\n },\n },\n {\n doc: {\n my_field: \"foo\",\n },\n },\n {\n create: {\n _id: \"7\",\n _index: \"index1\",\n },\n },\n {\n my_field: \"foo\",\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.bulk(\n body: [\n {\n \"update\": {\n \"_id\": \"5\",\n \"_index\": \"index1\"\n }\n },\n {\n \"doc\": {\n \"my_field\": \"foo\"\n }\n },\n {\n \"update\": {\n \"_id\": \"6\",\n \"_index\": \"index1\"\n }\n },\n {\n \"doc\": {\n \"my_field\": \"foo\"\n }\n },\n {\n \"create\": {\n \"_id\": \"7\",\n \"_index\": \"index1\"\n }\n },\n {\n \"my_field\": \"foo\"\n }\n ]\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->bulk([\n \"body\" => array(\n [\n \"update\" => [\n \"_id\" => \"5\",\n \"_index\" => \"index1\",\n ],\n ],\n [\n \"doc\" => [\n \"my_field\" => \"foo\",\n ],\n ],\n [\n \"update\" => [\n \"_id\" => \"6\",\n \"_index\" => \"index1\",\n ],\n ],\n [\n \"doc\" => [\n \"my_field\" => \"foo\",\n ],\n ],\n [\n \"create\" => [\n \"_id\" => \"7\",\n \"_index\" => \"index1\",\n ],\n ],\n [\n \"my_field\" => \"foo\",\n ],\n ),\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{\"update\":{\"_id\":\"5\",\"_index\":\"index1\"}},{\"doc\":{\"my_field\":\"foo\"}},{\"update\":{\"_id\":\"6\",\"_index\":\"index1\"}},{\"doc\":{\"my_field\":\"foo\"}},{\"create\":{\"_id\":\"7\",\"_index\":\"index1\"}},{\"my_field\":\"foo\"}]' \"$ELASTICSEARCH_URL/_bulk\"", + "language": "curl" + } + ], "description": "To return only information about failed operations, run `POST /_bulk?filter_path=items.*.error`.\n", "method_request": "POST /_bulk", "summary": "Filter for failed operations", "value": "{ \"update\": {\"_id\": \"5\", \"_index\": \"index1\"} }\n{ \"doc\": {\"my_field\": \"foo\"} }\n{ \"update\": {\"_id\": \"6\", \"_index\": \"index1\"} }\n{ \"doc\": {\"my_field\": \"foo\"} }\n{ \"create\": {\"_id\": \"7\", \"_index\": \"index1\"} }\n{ \"my_field\": \"foo\" }" }, "BulkRequestExample4": { + "alternatives": [ + { + "code": "resp = client.bulk(\n operations=[\n {\n \"index\": {\n \"_index\": \"my_index\",\n \"_id\": \"1\",\n \"dynamic_templates\": {\n \"work_location\": \"geo_point\"\n }\n }\n },\n {\n \"field\": \"value1\",\n \"work_location\": \"41.12,-71.34\",\n \"raw_location\": \"41.12,-71.34\"\n },\n {\n \"create\": {\n \"_index\": \"my_index\",\n \"_id\": \"2\",\n \"dynamic_templates\": {\n \"home_location\": \"geo_point\"\n }\n }\n },\n {\n \"field\": \"value2\",\n \"home_location\": \"41.12,-71.34\"\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.bulk({\n operations: [\n {\n index: {\n _index: \"my_index\",\n _id: \"1\",\n dynamic_templates: {\n work_location: \"geo_point\",\n },\n },\n },\n {\n field: \"value1\",\n work_location: \"41.12,-71.34\",\n raw_location: \"41.12,-71.34\",\n },\n {\n create: {\n _index: \"my_index\",\n _id: \"2\",\n dynamic_templates: {\n home_location: \"geo_point\",\n },\n },\n },\n {\n field: \"value2\",\n home_location: \"41.12,-71.34\",\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.bulk(\n body: [\n {\n \"index\": {\n \"_index\": \"my_index\",\n \"_id\": \"1\",\n \"dynamic_templates\": {\n \"work_location\": \"geo_point\"\n }\n }\n },\n {\n \"field\": \"value1\",\n \"work_location\": \"41.12,-71.34\",\n \"raw_location\": \"41.12,-71.34\"\n },\n {\n \"create\": {\n \"_index\": \"my_index\",\n \"_id\": \"2\",\n \"dynamic_templates\": {\n \"home_location\": \"geo_point\"\n }\n }\n },\n {\n \"field\": \"value2\",\n \"home_location\": \"41.12,-71.34\"\n }\n ]\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->bulk([\n \"body\" => array(\n [\n \"index\" => [\n \"_index\" => \"my_index\",\n \"_id\" => \"1\",\n \"dynamic_templates\" => [\n \"work_location\" => \"geo_point\",\n ],\n ],\n ],\n [\n \"field\" => \"value1\",\n \"work_location\" => \"41.12,-71.34\",\n \"raw_location\" => \"41.12,-71.34\",\n ],\n [\n \"create\" => [\n \"_index\" => \"my_index\",\n \"_id\" => \"2\",\n \"dynamic_templates\" => [\n \"home_location\" => \"geo_point\",\n ],\n ],\n ],\n [\n \"field\" => \"value2\",\n \"home_location\" => \"41.12,-71.34\",\n ],\n ),\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{\"index\":{\"_index\":\"my_index\",\"_id\":\"1\",\"dynamic_templates\":{\"work_location\":\"geo_point\"}}},{\"field\":\"value1\",\"work_location\":\"41.12,-71.34\",\"raw_location\":\"41.12,-71.34\"},{\"create\":{\"_index\":\"my_index\",\"_id\":\"2\",\"dynamic_templates\":{\"home_location\":\"geo_point\"}}},{\"field\":\"value2\",\"home_location\":\"41.12,-71.34\"}]' \"$ELASTICSEARCH_URL/_bulk\"", + "language": "curl" + } + ], "description": "Run `POST /_bulk` to perform a bulk request that consists of index and create actions with the `dynamic_templates` parameter. The bulk request creates two new fields `work_location` and `home_location` with type `geo_point` according to the `dynamic_templates` parameter. However, the `raw_location` field is created using default dynamic mapping rules, as a text field in that case since it is supplied as a string in the JSON document.\n", "method_request": "POST /_bulk", "summary": "Dynamic templates", @@ -24407,6 +24495,28 @@ "description": "Clear a scrolling search.\nClear the search context and results for a scrolling search.", "examples": { "ClearScrollRequestExample1": { + "alternatives": [ + { + "code": "resp = client.clear_scroll(\n scroll_id=\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.clearScroll({\n scroll_id: \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.clear_scroll(\n body: {\n \"scroll_id\": \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->clearScroll([\n \"body\" => [\n \"scroll_id\" => \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"scroll_id\":\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"}' \"$ELASTICSEARCH_URL/_search/scroll\"", + "language": "curl" + } + ], "description": "Run `DELETE /_search/scroll` to clear the search context and results for a scrolling search.", "method_request": "DELETE /_search/scroll", "value": "{\n \"scroll_id\": \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n}" @@ -24539,6 +24649,28 @@ "description": "Close a point in time.\nA point in time must be opened explicitly before being used in search requests.\nThe `keep_alive` parameter tells Elasticsearch how long it should persist.\nA point in time is automatically closed when the `keep_alive` period has elapsed.\nHowever, keeping points in time has a cost; close them as soon as they are no longer required for search requests.", "examples": { "ClosePointInTimeRequestExample1": { + "alternatives": [ + { + "code": "resp = client.close_point_in_time(\n id=\"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.closePointInTime({\n id: \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.close_point_in_time(\n body: {\n \"id\": \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->closePointInTime([\n \"body\" => [\n \"id\" => \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\"}' \"$ELASTICSEARCH_URL/_pit\"", + "language": "curl" + } + ], "description": "Run `DELETE /_pit` to close a point-in-time.", "method_request": "DELETE /_pit", "value": "{\n \"id\": \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\"\n}" @@ -24660,6 +24792,28 @@ "description": "Count search results.\nGet the number of documents matching a query.\n\nThe query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body.\nThe query is optional. When no query is provided, the API uses `match_all` to count all the documents.\n\nThe count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices.\n\nThe operation is broadcast across all shards.\nFor each shard ID group, a replica is chosen and the search is run against it.\nThis means that replicas increase the scalability of the count.", "examples": { "CountRequestExample1": { + "alternatives": [ + { + "code": "resp = client.count(\n index=\"my-index-000001\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.count({\n index: \"my-index-000001\",\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.count(\n index: \"my-index-000001\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->count([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_count\"", + "language": "curl" + } + ], "description": "Run `GET /my-index-000001/_count?q=user:kimchy`. Alternatively, run `GET /my-index-000001/_count` with the same query in the request body. Both requests count the number of documents in `my-index-000001` with a `user.id` of `kimchy`.\n", "method_request": "GET /my-index-000001/_count", "value": "{\n \"query\" : {\n \"term\" : { \"user.id\" : \"kimchy\" }\n }\n}" @@ -24932,6 +25086,28 @@ "description": "Create a new document in the index.\n\nYou can index a new JSON document with the `//_doc/` or `//_create/<_id>` APIs\nUsing `_create` guarantees that the document is indexed only if it does not already exist.\nIt returns a 409 response when a document with a same ID already exists in the index.\nTo update an existing document, you must use the `//_doc/` API.\n\nIf the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias:\n\n* To add a document using the `PUT //_create/<_id>` or `POST //_create/<_id>` request formats, you must have the `create_doc`, `create`, `index`, or `write` index privilege.\n* To automatically create a data stream or index with this API request, you must have the `auto_configure`, `create_index`, or `manage` index privilege.\n\nAutomatic data stream creation requires a matching index template with data stream enabled.\n\n**Automatically create data streams and indices**\n\nIf the request's target doesn't exist and matches an index template with a `data_stream` definition, the index operation automatically creates the data stream.\n\nIf the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates.\n\nNOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation.\n\nIf no mapping exists, the index operation creates a dynamic mapping.\nBy default, new fields and objects are automatically added to the mapping if needed.\n\nAutomatic index creation is controlled by the `action.auto_create_index` setting.\nIf it is `true`, any index can be created automatically.\nYou can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to `false` to turn off automatic index creation entirely.\nSpecify a comma-separated list of patterns you want to allow or prefix each pattern with `+` or `-` to indicate whether it should be allowed or blocked.\nWhen a list is specified, the default behaviour is to disallow.\n\nNOTE: The `action.auto_create_index` setting affects the automatic creation of indices only.\nIt does not affect the creation of data streams.\n\n**Routing**\n\nBy default, shard placement — or routing — is controlled by using a hash of the document's ID value.\nFor more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the `routing` parameter.\n\nWhen setting up explicit mapping, you can also use the `_routing` field to direct the index operation to extract the routing value from the document itself.\nThis does come at the (very minimal) cost of an additional document parsing pass.\nIf the `_routing` mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted.\n\nNOTE: Data streams do not support custom routing unless they were created with the `allow_custom_routing` setting enabled in the template.\n\n**Distributed**\n\nThe index operation is directed to the primary shard based on its route and performed on the actual node containing this shard.\nAfter the primary shard completes the operation, if needed, the update is distributed to applicable replicas.\n\n**Active shards**\n\nTo improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation.\nIf the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs.\nBy default, write operations only wait for the primary shards to be active before proceeding (that is to say `wait_for_active_shards` is `1`).\nThis default can be overridden in the index settings dynamically by setting `index.write.wait_for_active_shards`.\nTo alter this behavior per operation, use the `wait_for_active_shards request` parameter.\n\nValid values are all or any positive integer up to the total number of configured copies per shard in the index (which is `number_of_replicas`+1).\nSpecifying a negative value or a number greater than the number of shard copies will throw an error.\n\nFor example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes).\nIf you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding.\nThis means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data.\nIf `wait_for_active_shards` is set on the request to `3` (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding.\nThis requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard.\nHowever, if you set `wait_for_active_shards` to `all` (or to `4`, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index.\nThe operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard.\n\nIt is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts.\nAfter the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary.\nThe `_shards` section of the API response reveals the number of shard copies on which replication succeeded and failed.", "examples": { "CreateRequestExample1": { + "alternatives": [ + { + "code": "resp = client.create(\n index=\"my-index-000001\",\n id=\"1\",\n document={\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.create({\n index: \"my-index-000001\",\n id: 1,\n document: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n message: \"GET /search HTTP/1.1 200 1070000\",\n user: {\n id: \"kimchy\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.create(\n index: \"my-index-000001\",\n id: \"1\",\n body: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->create([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"body\" => [\n \"@timestamp\" => \"2099-11-15T13:12:00\",\n \"message\" => \"GET /search HTTP/1.1 200 1070000\",\n \"user\" => [\n \"id\" => \"kimchy\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"@timestamp\":\"2099-11-15T13:12:00\",\"message\":\"GET /search HTTP/1.1 200 1070000\",\"user\":{\"id\":\"kimchy\"}}' \"$ELASTICSEARCH_URL/my-index-000001/_create/1\"", + "language": "curl" + } + ], "description": "Run `PUT my-index-000001/_create/1` to index a document into the `my-index-000001` index if no document with that ID exists.\n", "method_request": "PUT my-index-000001/_create/1", "value": "{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}" @@ -25179,6 +25355,28 @@ "description": "Delete a document.\n\nRemove a JSON document from the specified index.\n\nNOTE: You cannot send deletion requests directly to a data stream.\nTo delete a document in a data stream, you must target the backing index containing the document.\n\n**Optimistic concurrency control**\n\nDelete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the `if_seq_no` and `if_primary_term` parameters.\nIf a mismatch is detected, the operation will result in a `VersionConflictException` and a status code of `409`.\n\n**Versioning**\n\nEach document indexed is versioned.\nWhen deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime.\nEvery write operation run on a document, deletes included, causes its version to be incremented.\nThe version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations.\nThe length of time for which a deleted document's version remains available is determined by the `index.gc_deletes` index setting.\n\n**Routing**\n\nIf routing is used during indexing, the routing value also needs to be specified to delete a document.\n\nIf the `_routing` mapping is set to `required` and no routing value is specified, the delete API throws a `RoutingMissingException` and rejects the request.\n\nFor example:\n\n```\nDELETE /my-index-000001/_doc/1?routing=shard-1\n```\n\nThis request deletes the document with ID 1, but it is routed based on the user.\nThe document is not deleted if the correct routing is not specified.\n\n**Distributed**\n\nThe delete operation gets hashed into a specific shard ID.\nIt then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group.", "examples": { "DeleteRequestExample1": { + "alternatives": [ + { + "code": "resp = client.delete(\n index=\"my-index-000001\",\n id=\"1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.delete({\n index: \"my-index-000001\",\n id: 1,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.delete(\n index: \"my-index-000001\",\n id: \"1\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->delete([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_doc/1\"", + "language": "curl" + } + ], "method_request": "DELETE /my-index-000001/_doc/1" } }, @@ -25429,24 +25627,112 @@ "description": "Delete documents.\n\nDeletes documents that match the specified query.\n\nIf the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias:\n\n* `read`\n* `delete` or `write`\n\nYou can specify the query criteria in the request URI or the request body using the same syntax as the search API.\nWhen you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning.\nIf a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails.\n\nNOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number.\n\nWhile processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete.\nA bulk delete request is performed for each batch of matching documents.\nIf a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off.\nIf the maximum retry limit is reached, processing halts and all failed requests are returned in the response.\nAny delete requests that completed successfully still stick, they are not rolled back.\n\nYou can opt to count version conflicts instead of halting and returning by setting `conflicts` to `proceed`.\nNote that if you opt to count version conflicts the operation could attempt to delete more documents from the source than `max_docs` until it has successfully deleted `max_docs documents`, or it has gone through every document in the source query.\n\n**Throttling delete requests**\n\nTo control the rate at which delete by query issues batches of delete operations, you can set `requests_per_second` to any positive decimal number.\nThis pads each batch with a wait time to throttle the rate.\nSet `requests_per_second` to `-1` to disable throttling.\n\nThrottling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account.\nThe padding time is the difference between the batch size divided by the `requests_per_second` and the time spent writing.\nBy default the batch size is `1000`, so if `requests_per_second` is set to `500`:\n\n```\ntarget_time = 1000 / 500 per second = 2 seconds\nwait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds\n```\n\nSince the batch is issued as a single `_bulk` request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set.\nThis is \"bursty\" instead of \"smooth\".\n\n**Slicing**\n\nDelete by query supports sliced scroll to parallelize the delete process.\nThis can improve efficiency and provide a convenient way to break the request down into smaller parts.\n\nSetting `slices` to `auto` lets Elasticsearch choose the number of slices to use.\nThis setting will use one slice per shard, up to a certain limit.\nIf there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards.\nAdding slices to the delete by query operation creates sub-requests which means it has some quirks:\n\n* You can see these requests in the tasks APIs. These sub-requests are \"child\" tasks of the task for the request with slices.\n* Fetching the status of the task for the request with slices only contains the status of completed slices.\n* These sub-requests are individually addressable for things like cancellation and rethrottling.\n* Rethrottling the request with `slices` will rethrottle the unfinished sub-request proportionally.\n* Canceling the request with `slices` will cancel each sub-request.\n* Due to the nature of `slices` each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution.\n* Parameters like `requests_per_second` and `max_docs` on a request with `slices` are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using `max_docs` with `slices` might not result in exactly `max_docs` documents being deleted.\n* Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time.\n\nIf you're slicing manually or otherwise tuning automatic slicing, keep in mind that:\n\n* Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many `slices` hurts performance. Setting `slices` higher than the number of shards generally does not improve efficiency and adds overhead.\n* Delete performance scales linearly across available resources with the number of slices.\n\nWhether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources.\n\n**Cancel a delete by query operation**\n\nAny delete by query can be canceled using the task cancel API. For example:\n\n```\nPOST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel\n```\n\nThe task ID can be found by using the get tasks API.\n\nCancellation should happen quickly but might take a few seconds.\nThe get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself.", "examples": { "DeleteByQueryRequestExample1": { + "alternatives": [ + { + "code": "resp = client.delete_by_query(\n index=\"my-index-000001,my-index-000002\",\n query={\n \"match_all\": {}\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.deleteByQuery({\n index: \"my-index-000001,my-index-000002\",\n query: {\n match_all: {},\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.delete_by_query(\n index: \"my-index-000001,my-index-000002\",\n body: {\n \"query\": {\n \"match_all\": {}\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->deleteByQuery([\n \"index\" => \"my-index-000001,my-index-000002\",\n \"body\" => [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"match_all\":{}}}' \"$ELASTICSEARCH_URL/my-index-000001,my-index-000002/_delete_by_query\"", + "language": "curl" + } + ], "description": "Run `POST /my-index-000001,my-index-000002/_delete_by_query` to delete all documents from multiple data streams or indices.", "method_request": "POST /my-index-000001,my-index-000002/_delete_by_query", "summary": "Delete all documents", "value": "{\n \"query\": {\n \"match_all\": {}\n }\n}" }, "DeleteByQueryRequestExample2": { + "alternatives": [ + { + "code": "resp = client.delete_by_query(\n index=\"my-index-000001\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n max_docs=1,\n)", + "language": "Python" + }, + { + "code": "const response = await client.deleteByQuery({\n index: \"my-index-000001\",\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n max_docs: 1,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.delete_by_query(\n index: \"my-index-000001\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n \"max_docs\": 1\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->deleteByQuery([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n \"max_docs\" => 1,\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}},\"max_docs\":1}' \"$ELASTICSEARCH_URL/my-index-000001/_delete_by_query\"", + "language": "curl" + } + ], "description": "Run `POST my-index-000001/_delete_by_query` to delete a document by using a unique attribute.", "method_request": "POST my-index-000001/_delete_by_query", "summary": "Delete a single document", "value": "{\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n \"max_docs\": 1\n}" }, "DeleteByQueryRequestExample3": { + "alternatives": [ + { + "code": "resp = client.delete_by_query(\n index=\"my-index-000001\",\n slice={\n \"id\": 0,\n \"max\": 2\n },\n query={\n \"range\": {\n \"http.response.bytes\": {\n \"lt\": 2000000\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.deleteByQuery({\n index: \"my-index-000001\",\n slice: {\n id: 0,\n max: 2,\n },\n query: {\n range: {\n \"http.response.bytes\": {\n lt: 2000000,\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.delete_by_query(\n index: \"my-index-000001\",\n body: {\n \"slice\": {\n \"id\": 0,\n \"max\": 2\n },\n \"query\": {\n \"range\": {\n \"http.response.bytes\": {\n \"lt\": 2000000\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->deleteByQuery([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"slice\" => [\n \"id\" => 0,\n \"max\" => 2,\n ],\n \"query\" => [\n \"range\" => [\n \"http.response.bytes\" => [\n \"lt\" => 2000000,\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"slice\":{\"id\":0,\"max\":2},\"query\":{\"range\":{\"http.response.bytes\":{\"lt\":2000000}}}}' \"$ELASTICSEARCH_URL/my-index-000001/_delete_by_query\"", + "language": "curl" + } + ], "description": "Run `POST my-index-000001/_delete_by_query` to slice a delete by query manually. Provide a slice ID and total number of slices.\n", "method_request": "POST my-index-000001/_delete_by_query", "summary": "Slice manually", "value": "{\n \"slice\": {\n \"id\": 0,\n \"max\": 2\n },\n \"query\": {\n \"range\": {\n \"http.response.bytes\": {\n \"lt\": 2000000\n }\n }\n }\n}" }, "DeleteByQueryRequestExample4": { + "alternatives": [ + { + "code": "resp = client.delete_by_query(\n index=\"my-index-000001\",\n refresh=True,\n slices=\"5\",\n query={\n \"range\": {\n \"http.response.bytes\": {\n \"lt\": 2000000\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.deleteByQuery({\n index: \"my-index-000001\",\n refresh: \"true\",\n slices: 5,\n query: {\n range: {\n \"http.response.bytes\": {\n lt: 2000000,\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.delete_by_query(\n index: \"my-index-000001\",\n refresh: \"true\",\n slices: \"5\",\n body: {\n \"query\": {\n \"range\": {\n \"http.response.bytes\": {\n \"lt\": 2000000\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->deleteByQuery([\n \"index\" => \"my-index-000001\",\n \"refresh\" => \"true\",\n \"slices\" => \"5\",\n \"body\" => [\n \"query\" => [\n \"range\" => [\n \"http.response.bytes\" => [\n \"lt\" => 2000000,\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"range\":{\"http.response.bytes\":{\"lt\":2000000}}}}' \"$ELASTICSEARCH_URL/my-index-000001/_delete_by_query?refresh&slices=5\"", + "language": "curl" + } + ], "description": "Run `POST my-index-000001/_delete_by_query?refresh&slices=5` to let delete by query automatically parallelize using sliced scroll to slice on `_id`. The `slices` query parameter value specifies the number of slices to use.\n", "method_request": "POST my-index-000001/_delete_by_query?refresh&slices=5", "summary": "Automatic slicing", @@ -26100,6 +26386,28 @@ "description": "Throttle a delete by query operation.\n\nChange the number of requests per second for a particular delete by query operation.\nRethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts.", "examples": { "DeleteByQueryRethrottleRequestExample1": { + "alternatives": [ + { + "code": "resp = client.delete_by_query_rethrottle(\n task_id=\"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second=\"-1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.deleteByQueryRethrottle({\n task_id: \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second: \"-1\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.delete_by_query_rethrottle(\n task_id: \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second: \"-1\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->deleteByQueryRethrottle([\n \"task_id\" => \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n \"requests_per_second\" => \"-1\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_delete_by_query/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1\"", + "language": "curl" + } + ], "method_request": "POST _delete_by_query/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1" } }, @@ -26173,6 +26481,28 @@ "description": "Delete a script or search template.\nDeletes a stored script or search template.", "examples": { "DeleteScriptRequestExample1": { + "alternatives": [ + { + "code": "resp = client.delete_script(\n id=\"my-search-template\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.deleteScript({\n id: \"my-search-template\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.delete_script(\n id: \"my-search-template\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->deleteScript([\n \"id\" => \"my-search-template\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_scripts/my-search-template\"", + "language": "curl" + } + ], "method_request": "DELETE _scripts/my-search-template" } }, @@ -26260,6 +26590,28 @@ "description": "Check a document.\n\nVerify that a document exists.\nFor example, check to see if a document with the `_id` 0 exists:\n\n```\nHEAD my-index-000001/_doc/0\n```\n\nIf the document exists, the API returns a status code of `200 - OK`.\nIf the document doesn’t exist, the API returns `404 - Not Found`.\n\n**Versioning support**\n\nYou can use the `version` parameter to check the document only if its current version is equal to the specified one.\n\nInternally, Elasticsearch has marked the old document as deleted and added an entirely new document.\nThe old version of the document doesn't disappear immediately, although you won't be able to access it.\nElasticsearch cleans up deleted documents in the background as you continue to index more data.", "examples": { "DocumentExistsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.exists(\n index=\"my-index-000001\",\n id=\"0\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.exists({\n index: \"my-index-000001\",\n id: 0,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.exists(\n index: \"my-index-000001\",\n id: \"0\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->exists([\n \"index\" => \"my-index-000001\",\n \"id\" => \"0\",\n]);", + "language": "PHP" + }, + { + "code": "curl --head -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_doc/0\"", + "language": "curl" + } + ], "method_request": "HEAD my-index-000001/_doc/0" } }, @@ -26451,6 +26803,28 @@ "description": "Check for a document source.\n\nCheck whether a document source exists in an index.\nFor example:\n\n```\nHEAD my-index-000001/_source/1\n```\n\nA document's source is not available if it is disabled in the mapping.", "examples": { "ExistsSourceRequestExample1": { + "alternatives": [ + { + "code": "resp = client.exists_source(\n index=\"my-index-000001\",\n id=\"1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.existsSource({\n index: \"my-index-000001\",\n id: 1,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.exists_source(\n index: \"my-index-000001\",\n id: \"1\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->existsSource([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n]);", + "language": "PHP" + }, + { + "code": "curl --head -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_source/1\"", + "language": "curl" + } + ], "method_request": "HEAD my-index-000001/_source/1" } }, @@ -26736,6 +27110,28 @@ "description": "Explain a document match result.\nGet information about why a specific document matches, or doesn't match, a query.\nIt computes a score explanation for a query and a specific document.", "examples": { "ExplainRequestExample1": { + "alternatives": [ + { + "code": "resp = client.explain(\n index=\"my-index-000001\",\n id=\"0\",\n query={\n \"match\": {\n \"message\": \"elasticsearch\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.explain({\n index: \"my-index-000001\",\n id: 0,\n query: {\n match: {\n message: \"elasticsearch\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.explain(\n index: \"my-index-000001\",\n id: \"0\",\n body: {\n \"query\": {\n \"match\": {\n \"message\": \"elasticsearch\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->explain([\n \"index\" => \"my-index-000001\",\n \"id\" => \"0\",\n \"body\" => [\n \"query\" => [\n \"match\" => [\n \"message\" => \"elasticsearch\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"match\":{\"message\":\"elasticsearch\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_explain/0\"", + "language": "curl" + } + ], "description": "Run `GET /my-index-000001/_explain/0` with the request body. Alternatively, run `GET /my-index-000001/_explain/0?q=message:elasticsearch`\n", "method_request": "GET /my-index-000001/_explain/0", "value": "{\n \"query\" : {\n \"match\" : { \"message\" : \"elasticsearch\" }\n }\n}" @@ -27277,6 +27673,28 @@ "description": "Get the field capabilities.\n\nGet information about the capabilities of fields among multiple indices.\n\nFor data streams, the API returns field capabilities among the stream’s backing indices.\nIt returns runtime fields like any other field.\nFor example, a runtime field with a type of keyword is returned the same as any other field that belongs to the `keyword` family.", "examples": { "FieldCapabilitiesRequestExample1": { + "alternatives": [ + { + "code": "resp = client.field_caps(\n index=\"my-index-*\",\n fields=\"rating\",\n index_filter={\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.fieldCaps({\n index: \"my-index-*\",\n fields: \"rating\",\n index_filter: {\n range: {\n \"@timestamp\": {\n gte: \"2018\",\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.field_caps(\n index: \"my-index-*\",\n fields: \"rating\",\n body: {\n \"index_filter\": {\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->fieldCaps([\n \"index\" => \"my-index-*\",\n \"fields\" => \"rating\",\n \"body\" => [\n \"index_filter\" => [\n \"range\" => [\n \"@timestamp\" => [\n \"gte\" => \"2018\",\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_filter\":{\"range\":{\"@timestamp\":{\"gte\":\"2018\"}}}}' \"$ELASTICSEARCH_URL/my-index-*/_field_caps?fields=rating\"", + "language": "curl" + } + ], "description": "Run `POST my-index-*/_field_caps?fields=rating` to get field capabilities and filter indices with a query. Indices that rewrite the provided filter to `match_none` on every shard will be filtered from the response.\n", "method_request": "POST my-index-*/_field_caps?fields=rating", "value": "{\n \"index_filter\": {\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"2018\"\n }\n }\n }\n}" @@ -27660,6 +28078,28 @@ "description": "Get a document by its ID.\n\nGet a document and its source or stored fields from an index.\n\nBy default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search).\nIn the case where stored fields are requested with the `stored_fields` parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields.\nTo turn off realtime behavior, set the `realtime` parameter to false.\n\n**Source filtering**\n\nBy default, the API returns the contents of the `_source` field unless you have used the `stored_fields` parameter or the `_source` field is turned off.\nYou can turn off `_source` retrieval by using the `_source` parameter:\n\n```\nGET my-index-000001/_doc/0?_source=false\n```\n\nIf you only need one or two fields from the `_source`, use the `_source_includes` or `_source_excludes` parameters to include or filter out particular fields.\nThis can be helpful with large documents where partial retrieval can save on network overhead\nBoth parameters take a comma separated list of fields or wildcard expressions.\nFor example:\n\n```\nGET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities\n```\n\nIf you only want to specify includes, you can use a shorter notation:\n\n```\nGET my-index-000001/_doc/0?_source=*.id\n```\n\n**Routing**\n\nIf routing is used during indexing, the routing value also needs to be specified to retrieve a document.\nFor example:\n\n```\nGET my-index-000001/_doc/2?routing=user1\n```\n\nThis request gets the document with ID 2, but it is routed based on the user.\nThe document is not fetched if the correct routing is not specified.\n\n**Distributed**\n\nThe GET operation is hashed into a specific shard ID.\nIt is then redirected to one of the replicas within that shard ID and returns the result.\nThe replicas are the primary shard and its replicas within that shard ID group.\nThis means that the more replicas you have, the better your GET scaling will be.\n\n**Versioning support**\n\nYou can use the `version` parameter to retrieve the document only if its current version is equal to the specified one.\n\nInternally, Elasticsearch has marked the old document as deleted and added an entirely new document.\nThe old version of the document doesn't disappear immediately, although you won't be able to access it.\nElasticsearch cleans up deleted documents in the background as you continue to index more data.", "examples": { "GetRequestExample2": { + "alternatives": [ + { + "code": "resp = client.get(\n index=\"my-index-000001\",\n id=\"1\",\n stored_fields=\"tags,counter\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.get({\n index: \"my-index-000001\",\n id: 1,\n stored_fields: \"tags,counter\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.get(\n index: \"my-index-000001\",\n id: \"1\",\n stored_fields: \"tags,counter\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->get([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"stored_fields\" => \"tags,counter\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_doc/1?stored_fields=tags,counter\"", + "language": "curl" + } + ], "method_request": "GET my-index-000001/_doc/1?stored_fields=tags,counter" } }, @@ -27948,6 +28388,28 @@ "description": "Get a script or search template.\nRetrieves a stored script or search template.", "examples": { "GetScriptRequestExample1": { + "alternatives": [ + { + "code": "resp = client.get_script(\n id=\"my-search-template\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.getScript({\n id: \"my-search-template\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.get_script(\n id: \"my-search-template\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->getScript([\n \"id\" => \"my-search-template\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_scripts/my-search-template\"", + "language": "curl" + } + ], "method_request": "GET _scripts/my-search-template" } }, @@ -28162,6 +28624,28 @@ "description": "Get script contexts.\n\nGet a list of supported script contexts and their methods.", "examples": { "GetScriptContextRequestExample1": { + "alternatives": [ + { + "code": "resp = client.get_script_context()", + "language": "Python" + }, + { + "code": "const response = await client.getScriptContext();", + "language": "JavaScript" + }, + { + "code": "response = client.get_script_context", + "language": "Ruby" + }, + { + "code": "$resp = $client->getScriptContext();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_script_context\"", + "language": "curl" + } + ], "method_request": "GET _script_context" } }, @@ -28252,6 +28736,28 @@ "description": "Get script languages.\n\nGet a list of available script types, languages, and contexts.", "examples": { "GetScriptLanguagesRequestExample1": { + "alternatives": [ + { + "code": "resp = client.get_script_languages()", + "language": "Python" + }, + { + "code": "const response = await client.getScriptLanguages();", + "language": "JavaScript" + }, + { + "code": "response = client.get_script_languages", + "language": "Ruby" + }, + { + "code": "$resp = $client->getScriptLanguages();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_script_language\"", + "language": "curl" + } + ], "method_request": "GET _script_language" } }, @@ -28321,6 +28827,28 @@ "description": "Get a document's source.\n\nGet the source of a document.\nFor example:\n\n```\nGET my-index-000001/_source/1\n```\n\nYou can use the source filtering parameters to control which parts of the `_source` are returned:\n\n```\nGET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities\n```", "examples": { "GetSourceRequestExample1": { + "alternatives": [ + { + "code": "resp = client.get_source(\n index=\"my-index-000001\",\n id=\"1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.getSource({\n index: \"my-index-000001\",\n id: 1,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.get_source(\n index: \"my-index-000001\",\n id: \"1\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->getSource([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_source/1\"", + "language": "curl" + } + ], "method_request": "GET my-index-000001/_source/1" } }, @@ -29528,6 +30056,28 @@ "description": "Get the cluster health.\nGet a report with the health status of an Elasticsearch cluster.\nThe report contains a list of indicators that compose Elasticsearch functionality.\n\nEach indicator has a health status of: green, unknown, yellow or red.\nThe indicator will provide an explanation and metadata describing the reason for its current health status.\n\nThe cluster’s status is controlled by the worst indicator status.\n\nIn the event that an indicator’s status is non-green, a list of impacts may be present in the indicator result which detail the functionalities that are negatively affected by the health issue.\nEach impact carries with it a severity level, an area of the system that is affected, and a simple description of the impact on the system.\n\nSome health indicators can determine the root cause of a health problem and prescribe a set of steps that can be performed in order to improve the health of the system.\nThe root cause and remediation steps are encapsulated in a diagnosis.\nA diagnosis contains a cause detailing a root cause analysis, an action containing a brief description of the steps to take to fix the problem, the list of affected resources (if applicable), and a detailed step-by-step troubleshooting guide to fix the diagnosed problem.\n\nNOTE: The health indicators perform root cause analysis of non-green health statuses. This can be computationally expensive when called frequently.\nWhen setting up automated polling of the API for health status, set verbose to false to disable the more expensive analysis logic.", "examples": { "HealthReportRequestExample1": { + "alternatives": [ + { + "code": "resp = client.health_report()", + "language": "Python" + }, + { + "code": "const response = await client.healthReport();", + "language": "JavaScript" + }, + { + "code": "response = client.health_report", + "language": "Ruby" + }, + { + "code": "$resp = $client->healthReport();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_health_report\"", + "language": "curl" + } + ], "method_request": "GET _health_report" } }, @@ -30074,12 +30624,56 @@ "description": "Create or update a document in an index.\n\nAdd a JSON document to the specified data stream or index and make it searchable.\nIf the target is an index and the document already exists, the request updates the document and increments its version.\n\nNOTE: You cannot use this API to send update requests for existing documents in a data stream.\n\nIf the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias:\n\n* To add or overwrite a document using the `PUT //_doc/<_id>` request format, you must have the `create`, `index`, or `write` index privilege.\n* To add a document using the `POST //_doc/` request format, you must have the `create_doc`, `create`, `index`, or `write` index privilege.\n* To automatically create a data stream or index with this API request, you must have the `auto_configure`, `create_index`, or `manage` index privilege.\n\nAutomatic data stream creation requires a matching index template with data stream enabled.\n\nNOTE: Replica shards might not all be started when an indexing operation returns successfully.\nBy default, only the primary is required. Set `wait_for_active_shards` to change this default behavior.\n\n**Automatically create data streams and indices**\n\nIf the request's target doesn't exist and matches an index template with a `data_stream` definition, the index operation automatically creates the data stream.\n\nIf the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates.\n\nNOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation.\n\nIf no mapping exists, the index operation creates a dynamic mapping.\nBy default, new fields and objects are automatically added to the mapping if needed.\n\nAutomatic index creation is controlled by the `action.auto_create_index` setting.\nIf it is `true`, any index can be created automatically.\nYou can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to `false` to turn off automatic index creation entirely.\nSpecify a comma-separated list of patterns you want to allow or prefix each pattern with `+` or `-` to indicate whether it should be allowed or blocked.\nWhen a list is specified, the default behaviour is to disallow.\n\nNOTE: The `action.auto_create_index` setting affects the automatic creation of indices only.\nIt does not affect the creation of data streams.\n\n**Optimistic concurrency control**\n\nIndex operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the `if_seq_no` and `if_primary_term` parameters.\nIf a mismatch is detected, the operation will result in a `VersionConflictException` and a status code of `409`.\n\n**Routing**\n\nBy default, shard placement — or routing — is controlled by using a hash of the document's ID value.\nFor more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the `routing` parameter.\n\nWhen setting up explicit mapping, you can also use the `_routing` field to direct the index operation to extract the routing value from the document itself.\nThis does come at the (very minimal) cost of an additional document parsing pass.\nIf the `_routing` mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted.\n\nNOTE: Data streams do not support custom routing unless they were created with the `allow_custom_routing` setting enabled in the template.\n\n**Distributed**\n\nThe index operation is directed to the primary shard based on its route and performed on the actual node containing this shard.\nAfter the primary shard completes the operation, if needed, the update is distributed to applicable replicas.\n\n**Active shards**\n\nTo improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation.\nIf the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs.\nBy default, write operations only wait for the primary shards to be active before proceeding (that is to say `wait_for_active_shards` is `1`).\nThis default can be overridden in the index settings dynamically by setting `index.write.wait_for_active_shards`.\nTo alter this behavior per operation, use the `wait_for_active_shards request` parameter.\n\nValid values are all or any positive integer up to the total number of configured copies per shard in the index (which is `number_of_replicas`+1).\nSpecifying a negative value or a number greater than the number of shard copies will throw an error.\n\nFor example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes).\nIf you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding.\nThis means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data.\nIf `wait_for_active_shards` is set on the request to `3` (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding.\nThis requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard.\nHowever, if you set `wait_for_active_shards` to `all` (or to `4`, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index.\nThe operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard.\n\nIt is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts.\nAfter the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary.\nThe `_shards` section of the API response reveals the number of shard copies on which replication succeeded and failed.\n\n**No operation (noop) updates**\n\nWhen updating a document by using this API, a new version of the document is always created even if the document hasn't changed.\nIf this isn't acceptable use the `_update` API with `detect_noop` set to `true`.\nThe `detect_noop` option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source.\n\nThere isn't a definitive rule for when noop updates aren't acceptable.\nIt's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates.\n\n**Versioning**\n\nEach indexed document is given a version number.\nBy default, internal versioning is used that starts at 1 and increments with each update, deletes included.\nOptionally, the version number can be set to an external value (for example, if maintained in a database).\nTo enable this functionality, `version_type` should be set to `external`.\nThe value provided must be a numeric, long value greater than or equal to 0, and less than around `9.2e+18`.\n\nNOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations.\nIf no version is provided, the operation runs without any version checks.\n\nWhen using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document.\nIf true, the document will be indexed and the new version number used.\nIf the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example:\n\n```\nPUT my-index-000001/_doc/1?version=2&version_type=external\n{\n \"user\": {\n \"id\": \"elkbee\"\n }\n}\n\nIn this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1.\nIf the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code).\n\nA nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used.\nEven the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order.", "examples": { "IndexRequestExample1": { + "alternatives": [ + { + "code": "resp = client.index(\n index=\"my-index-000001\",\n document={\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.index({\n index: \"my-index-000001\",\n document: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n message: \"GET /search HTTP/1.1 200 1070000\",\n user: {\n id: \"kimchy\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.index(\n index: \"my-index-000001\",\n body: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->index([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"@timestamp\" => \"2099-11-15T13:12:00\",\n \"message\" => \"GET /search HTTP/1.1 200 1070000\",\n \"user\" => [\n \"id\" => \"kimchy\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"@timestamp\":\"2099-11-15T13:12:00\",\"message\":\"GET /search HTTP/1.1 200 1070000\",\"user\":{\"id\":\"kimchy\"}}' \"$ELASTICSEARCH_URL/my-index-000001/_doc/\"", + "language": "curl" + } + ], "description": "Run `POST my-index-000001/_doc/` to index a document. When you use the `POST //_doc/` request format, the `op_type` is automatically set to `create` and the index operation generates a unique ID for the document.\n", "method_request": "POST my-index-000001/_doc/", "summary": "Automate document IDs", "value": "{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}" }, "IndexRequestExample2": { + "alternatives": [ + { + "code": "resp = client.index(\n index=\"my-index-000001\",\n id=\"1\",\n document={\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.index({\n index: \"my-index-000001\",\n id: 1,\n document: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n message: \"GET /search HTTP/1.1 200 1070000\",\n user: {\n id: \"kimchy\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.index(\n index: \"my-index-000001\",\n id: \"1\",\n body: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->index([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"body\" => [\n \"@timestamp\" => \"2099-11-15T13:12:00\",\n \"message\" => \"GET /search HTTP/1.1 200 1070000\",\n \"user\" => [\n \"id\" => \"kimchy\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"@timestamp\":\"2099-11-15T13:12:00\",\"message\":\"GET /search HTTP/1.1 200 1070000\",\"user\":{\"id\":\"kimchy\"}}' \"$ELASTICSEARCH_URL/my-index-000001/_doc/1\"", + "language": "curl" + } + ], "description": "Run `PUT my-index-000001/_doc/1` to insert a JSON document into the `my-index-000001` index with an `_id` of 1.\n", "method_request": "PUT my-index-000001/_doc/1", "summary": "Define document IDs", @@ -30327,6 +30921,28 @@ "description": "Get cluster info.\nGet basic build, version, and cluster information.", "examples": { "RootNodeInfoRequestExample1": { + "alternatives": [ + { + "code": "resp = client.info()", + "language": "Python" + }, + { + "code": "const response = await client.info();", + "language": "JavaScript" + }, + { + "code": "response = client.info", + "language": "Ruby" + }, + { + "code": "$resp = $client->info();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/\"", + "language": "curl" + } + ], "method_request": "GET /" } }, @@ -30596,24 +31212,112 @@ "description": "Get multiple documents.\n\nGet multiple JSON documents by ID from one or more indices.\nIf you specify an index in the request URI, you only need to specify the document IDs in the request body.\nTo ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail.\n\n**Filter source fields**\n\nBy default, the `_source` field is returned for every document (if stored).\nUse the `_source` and `_source_include` or `source_exclude` attributes to filter what fields are returned for a particular document.\nYou can include the `_source`, `_source_includes`, and `_source_excludes` query parameters in the request URI to specify the defaults to use when there are no per-document instructions.\n\n**Get stored fields**\n\nUse the `stored_fields` attribute to specify the set of stored fields you want to retrieve.\nAny requested fields that are not stored are ignored.\nYou can include the `stored_fields` query parameter in the request URI to specify the defaults to use when there are no per-document instructions.", "examples": { "MultiGetRequestExample1": { + "alternatives": [ + { + "code": "resp = client.mget(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.mget({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"1\",\n },\n {\n _id: \"2\",\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.mget(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->mget([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"1\",\n ],\n [\n \"_id\" => \"2\",\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":\"1\"},{\"_id\":\"2\"}]}' \"$ELASTICSEARCH_URL/my-index-000001/_mget\"", + "language": "curl" + } + ], "description": "Run `GET /my-index-000001/_mget`. When you specify an index in the request URI, only the document IDs are required in the request body.\n", "method_request": "GET /my-index-000001/_mget", "summary": "Get documents by ID", "value": "{\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n}" }, "MultiGetRequestExample2": { + "alternatives": [ + { + "code": "resp = client.mget(\n docs=[\n {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"_source\": False\n },\n {\n \"_index\": \"test\",\n \"_id\": \"2\",\n \"_source\": [\n \"field3\",\n \"field4\"\n ]\n },\n {\n \"_index\": \"test\",\n \"_id\": \"3\",\n \"_source\": {\n \"include\": [\n \"user\"\n ],\n \"exclude\": [\n \"user.location\"\n ]\n }\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.mget({\n docs: [\n {\n _index: \"test\",\n _id: \"1\",\n _source: false,\n },\n {\n _index: \"test\",\n _id: \"2\",\n _source: [\"field3\", \"field4\"],\n },\n {\n _index: \"test\",\n _id: \"3\",\n _source: {\n include: [\"user\"],\n exclude: [\"user.location\"],\n },\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.mget(\n body: {\n \"docs\": [\n {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"_source\": false\n },\n {\n \"_index\": \"test\",\n \"_id\": \"2\",\n \"_source\": [\n \"field3\",\n \"field4\"\n ]\n },\n {\n \"_index\": \"test\",\n \"_id\": \"3\",\n \"_source\": {\n \"include\": [\n \"user\"\n ],\n \"exclude\": [\n \"user.location\"\n ]\n }\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->mget([\n \"body\" => [\n \"docs\" => array(\n [\n \"_index\" => \"test\",\n \"_id\" => \"1\",\n \"_source\" => false,\n ],\n [\n \"_index\" => \"test\",\n \"_id\" => \"2\",\n \"_source\" => array(\n \"field3\",\n \"field4\",\n ),\n ],\n [\n \"_index\" => \"test\",\n \"_id\" => \"3\",\n \"_source\" => [\n \"include\" => array(\n \"user\",\n ),\n \"exclude\" => array(\n \"user.location\",\n ),\n ],\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_index\":\"test\",\"_id\":\"1\",\"_source\":false},{\"_index\":\"test\",\"_id\":\"2\",\"_source\":[\"field3\",\"field4\"]},{\"_index\":\"test\",\"_id\":\"3\",\"_source\":{\"include\":[\"user\"],\"exclude\":[\"user.location\"]}}]}' \"$ELASTICSEARCH_URL/_mget\"", + "language": "curl" + } + ], "description": "Run `GET /_mget`. This request sets `_source` to `false` for document 1 to exclude the source entirely. It retrieves `field3` and `field4` from document 2. It retrieves the `user` field from document 3 but filters out the `user.location` field.\n", "method_request": "GET /_mget", "summary": "Filter source fields", "value": "{\n \"docs\": [\n {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"_source\": false\n },\n {\n \"_index\": \"test\",\n \"_id\": \"2\",\n \"_source\": [ \"field3\", \"field4\" ]\n },\n {\n \"_index\": \"test\",\n \"_id\": \"3\",\n \"_source\": {\n \"include\": [ \"user\" ],\n \"exclude\": [ \"user.location\" ]\n }\n }\n ]\n}" }, "MultiGetRequestExample3": { + "alternatives": [ + { + "code": "resp = client.mget(\n docs=[\n {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"stored_fields\": [\n \"field1\",\n \"field2\"\n ]\n },\n {\n \"_index\": \"test\",\n \"_id\": \"2\",\n \"stored_fields\": [\n \"field3\",\n \"field4\"\n ]\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.mget({\n docs: [\n {\n _index: \"test\",\n _id: \"1\",\n stored_fields: [\"field1\", \"field2\"],\n },\n {\n _index: \"test\",\n _id: \"2\",\n stored_fields: [\"field3\", \"field4\"],\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.mget(\n body: {\n \"docs\": [\n {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"stored_fields\": [\n \"field1\",\n \"field2\"\n ]\n },\n {\n \"_index\": \"test\",\n \"_id\": \"2\",\n \"stored_fields\": [\n \"field3\",\n \"field4\"\n ]\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->mget([\n \"body\" => [\n \"docs\" => array(\n [\n \"_index\" => \"test\",\n \"_id\" => \"1\",\n \"stored_fields\" => array(\n \"field1\",\n \"field2\",\n ),\n ],\n [\n \"_index\" => \"test\",\n \"_id\" => \"2\",\n \"stored_fields\" => array(\n \"field3\",\n \"field4\",\n ),\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_index\":\"test\",\"_id\":\"1\",\"stored_fields\":[\"field1\",\"field2\"]},{\"_index\":\"test\",\"_id\":\"2\",\"stored_fields\":[\"field3\",\"field4\"]}]}' \"$ELASTICSEARCH_URL/_mget\"", + "language": "curl" + } + ], "description": "Run `GET /_mget`. This request retrieves `field1` and `field2` from document 1 and `field3` and `field4` from document 2.\n", "method_request": "GET /_mget", "summary": "Get stored fields", "value": "{\n \"docs\": [\n {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"stored_fields\": [ \"field1\", \"field2\" ]\n },\n {\n \"_index\": \"test\",\n \"_id\": \"2\",\n \"stored_fields\": [ \"field3\", \"field4\" ]\n }\n ]\n}" }, "MultiGetRequestExample4": { + "alternatives": [ + { + "code": "resp = client.mget(\n routing=\"key1\",\n docs=[\n {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"routing\": \"key2\"\n },\n {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.mget({\n routing: \"key1\",\n docs: [\n {\n _index: \"test\",\n _id: \"1\",\n routing: \"key2\",\n },\n {\n _index: \"test\",\n _id: \"2\",\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.mget(\n routing: \"key1\",\n body: {\n \"docs\": [\n {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"routing\": \"key2\"\n },\n {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->mget([\n \"routing\" => \"key1\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_index\" => \"test\",\n \"_id\" => \"1\",\n \"routing\" => \"key2\",\n ],\n [\n \"_index\" => \"test\",\n \"_id\" => \"2\",\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_index\":\"test\",\"_id\":\"1\",\"routing\":\"key2\"},{\"_index\":\"test\",\"_id\":\"2\"}]}' \"$ELASTICSEARCH_URL/_mget?routing=key1\"", + "language": "curl" + } + ], "description": "Run `GET /_mget?routing=key1`. If routing is used during indexing, you need to specify the routing value to retrieve documents. This request fetches `test/_doc/2` from the shard corresponding to routing key `key1`. It fetches `test/_doc/1` from the shard corresponding to routing key `key2`.\n", "method_request": "GET /_mget?routing=key1", "summary": "Document routing", @@ -31107,6 +31811,28 @@ "description": "Run multiple searches.\n\nThe format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format.\nThe structure is as follows:\n\n```\nheader\\n\nbody\\n\nheader\\n\nbody\\n\n```\n\nThis structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node.\n\nIMPORTANT: The final line of data must end with a newline character `\\n`.\nEach newline character may be preceded by a carriage return `\\r`.\nWhen sending requests to this endpoint the `Content-Type` header should be set to `application/x-ndjson`.", "examples": { "MsearchRequestExample1": { + "alternatives": [ + { + "code": "resp = client.msearch(\n index=\"my-index-000001\",\n searches=[\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.msearch({\n index: \"my-index-000001\",\n searches: [\n {},\n {\n query: {\n match: {\n message: \"this is a test\",\n },\n },\n },\n {\n index: \"my-index-000002\",\n },\n {\n query: {\n match_all: {},\n },\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.msearch(\n index: \"my-index-000001\",\n body: [\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ]\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->msearch([\n \"index\" => \"my-index-000001\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"query\" => [\n \"match\" => [\n \"message\" => \"this is a test\",\n ],\n ],\n ],\n [\n \"index\" => \"my-index-000002\",\n ],\n [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n ),\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{},{\"query\":{\"match\":{\"message\":\"this is a test\"}}},{\"index\":\"my-index-000002\"},{\"query\":{\"match_all\":{}}}]' \"$ELASTICSEARCH_URL/my-index-000001/_msearch\"", + "language": "curl" + } + ], "description": "An example body for a `GET my-index-000001/_msearch` request.", "method_request": "GET my-index-000001/_msearch", "value": "{ }\n{\"query\" : {\"match\" : { \"message\": \"this is a test\"}}}\n{\"index\": \"my-index-000002\"}\n{\"query\" : {\"match_all\" : {}}}" @@ -31437,6 +32163,28 @@ "description": "Run multiple templated searches.\n\nRun multiple templated searches with a single request.\nIf you are providing a text file or text input to `curl`, use the `--data-binary` flag instead of `-d` to preserve newlines.\nFor example:\n\n```\n$ cat requests\n{ \"index\": \"my-index\" }\n{ \"id\": \"my-search-template\", \"params\": { \"query_string\": \"hello world\", \"from\": 0, \"size\": 10 }}\n{ \"index\": \"my-other-index\" }\n{ \"id\": \"my-other-search-template\", \"params\": { \"query_type\": \"match_all\" }}\n\n$ curl -H \"Content-Type: application/x-ndjson\" -XGET localhost:9200/_msearch/template --data-binary \"@requests\"; echo\n```", "examples": { "MultiSearchTemplateRequestExample1": { + "alternatives": [ + { + "code": "resp = client.msearch_template(\n index=\"my-index\",\n search_templates=[\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.msearchTemplate({\n index: \"my-index\",\n search_templates: [\n {},\n {\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 0,\n size: 10,\n },\n },\n {},\n {\n id: \"my-other-search-template\",\n params: {\n query_type: \"match_all\",\n },\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.msearch_template(\n index: \"my-index\",\n body: [\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ]\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->msearchTemplate([\n \"index\" => \"my-index\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 0,\n \"size\" => 10,\n ],\n ],\n new ArrayObject([]),\n [\n \"id\" => \"my-other-search-template\",\n \"params\" => [\n \"query_type\" => \"match_all\",\n ],\n ],\n ),\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{},{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":0,\"size\":10}},{},{\"id\":\"my-other-search-template\",\"params\":{\"query_type\":\"match_all\"}}]' \"$ELASTICSEARCH_URL/my-index/_msearch/template\"", + "language": "curl" + } + ], "description": "Run `GET my-index/_msearch/template` to run multiple templated searches.", "method_request": "GET my-index/_msearch/template", "value": "{ }\n{ \"id\": \"my-search-template\", \"params\": { \"query_string\": \"hello world\", \"from\": 0, \"size\": 10 }}\n{ }\n{ \"id\": \"my-other-search-template\", \"params\": { \"query_type\": \"match_all\" }}" @@ -31887,18 +32635,84 @@ "description": "Get multiple term vectors.\n\nGet multiple term vectors with a single request.\nYou can specify existing documents by index and ID or provide artificial documents in the body of the request.\nYou can specify the index in the request body or request URI.\nThe response contains a `docs` array with all the fetched termvectors.\nEach element has the structure provided by the termvectors API.\n\n**Artificial documents**\n\nYou can also use `mtermvectors` to generate term vectors for artificial documents provided in the body of the request.\nThe mapping used is determined by the specified `_index`.", "examples": { "MultiTermVectorsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.mtermvectors(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": True\n },\n {\n \"_id\": \"1\"\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.mtermvectors({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"2\",\n fields: [\"message\"],\n term_statistics: true,\n },\n {\n _id: \"1\",\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.mtermvectors(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->mtermvectors([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"2\",\n \"fields\" => array(\n \"message\",\n ),\n \"term_statistics\" => true,\n ],\n [\n \"_id\" => \"1\",\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":\"2\",\"fields\":[\"message\"],\"term_statistics\":true},{\"_id\":\"1\"}]}' \"$ELASTICSEARCH_URL/my-index-000001/_mtermvectors\"", + "language": "curl" + } + ], "description": "Run `POST /my-index-000001/_mtermvectors`. When you specify an index in the request URI, the index does not need to be specified for each documents in the request body.\n", "method_request": "POST /my-index-000001/_mtermvectors", "summary": "Get multiple term vectors", "value": "{\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n}" }, "MultiTermVectorsRequestExample2": { + "alternatives": [ + { + "code": "resp = client.mtermvectors(\n index=\"my-index-000001\",\n ids=[\n \"1\",\n \"2\"\n ],\n fields=[\n \"message\"\n ],\n term_statistics=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.mtermvectors({\n index: \"my-index-000001\",\n ids: [\"1\", \"2\"],\n fields: [\"message\"],\n term_statistics: true,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.mtermvectors(\n index: \"my-index-000001\",\n body: {\n \"ids\": [\n \"1\",\n \"2\"\n ],\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->mtermvectors([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"ids\" => array(\n \"1\",\n \"2\",\n ),\n \"fields\" => array(\n \"message\",\n ),\n \"term_statistics\" => true,\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"ids\":[\"1\",\"2\"],\"fields\":[\"message\"],\"term_statistics\":true}' \"$ELASTICSEARCH_URL/my-index-000001/_mtermvectors\"", + "language": "curl" + } + ], "description": "Run `POST /my-index-000001/_mtermvectors`. If all requested documents are in same index and the parameters are the same, you can use a simplified syntax.\n", "method_request": "POST /my-index-000001/_mtermvectors", "summary": "Simplified syntax", "value": "{\n \"ids\": [ \"1\", \"2\" ],\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n}" }, "MultiTermVectorsRequestExample3": { + "alternatives": [ + { + "code": "resp = client.mtermvectors(\n docs=[\n {\n \"_index\": \"my-index-000001\",\n \"doc\": {\n \"message\": \"test test test\"\n }\n },\n {\n \"_index\": \"my-index-000001\",\n \"doc\": {\n \"message\": \"Another test ...\"\n }\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.mtermvectors({\n docs: [\n {\n _index: \"my-index-000001\",\n doc: {\n message: \"test test test\",\n },\n },\n {\n _index: \"my-index-000001\",\n doc: {\n message: \"Another test ...\",\n },\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.mtermvectors(\n body: {\n \"docs\": [\n {\n \"_index\": \"my-index-000001\",\n \"doc\": {\n \"message\": \"test test test\"\n }\n },\n {\n \"_index\": \"my-index-000001\",\n \"doc\": {\n \"message\": \"Another test ...\"\n }\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->mtermvectors([\n \"body\" => [\n \"docs\" => array(\n [\n \"_index\" => \"my-index-000001\",\n \"doc\" => [\n \"message\" => \"test test test\",\n ],\n ],\n [\n \"_index\" => \"my-index-000001\",\n \"doc\" => [\n \"message\" => \"Another test ...\",\n ],\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_index\":\"my-index-000001\",\"doc\":{\"message\":\"test test test\"}},{\"_index\":\"my-index-000001\",\"doc\":{\"message\":\"Another test ...\"}}]}' \"$ELASTICSEARCH_URL/_mtermvectors\"", + "language": "curl" + } + ], "description": "Run `POST /_mtermvectors` to generate term vectors for artificial documents provided in the body of the request. The mapping used is determined by the specified `_index`.\n", "method_request": "POST /_mtermvectors", "summary": "Artificial documents", @@ -32238,6 +33052,28 @@ "description": "Open a point in time.\n\nA search request by default runs against the most recent visible data of the target indices,\nwhich is called point in time. Elasticsearch pit (point in time) is a lightweight view into the\nstate of the data as it existed when initiated. In some cases, it’s preferred to perform multiple\nsearch requests using the same point in time. For example, if refreshes happen between\n`search_after` requests, then the results of those requests might not be consistent as changes happening\nbetween searches are only visible to the more recent point in time.\n\nA point in time must be opened explicitly before being used in search requests.\n\nA subsequent search request with the `pit` parameter must not specify `index`, `routing`, or `preference` values as these parameters are copied from the point in time.\n\nJust like regular searches, you can use `from` and `size` to page through point in time search results, up to the first 10,000 hits.\nIf you want to retrieve more hits, use PIT with `search_after`.\n\nIMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request.\n\nWhen a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a `NoShardAvailableActionException` exception.\nTo get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime.\n\n**Keeping point in time alive**\n\nThe `keep_alive` parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time.\nThe value does not need to be long enough to process all data — it just needs to be long enough for the next request.\n\nNormally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments.\nOnce the smaller segments are no longer needed they are deleted.\nHowever, open point-in-times prevent the old segments from being deleted since they are still in use.\n\nTIP: Keeping older segments alive means that more disk space and file handles are needed.\nEnsure that you have configured your nodes to have ample free file handles.\n\nAdditionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request.\nEnsure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates.\nNote that a point-in-time doesn't prevent its associated indices from being deleted.\nYou can check how many point-in-times (that is, search contexts) are open with the nodes stats API.", "examples": { "OpenPointInTimeRequestExample1": { + "alternatives": [ + { + "code": "resp = client.open_point_in_time(\n index=\"my-index-000001\",\n keep_alive=\"1m\",\n allow_partial_search_results=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.openPointInTime({\n index: \"my-index-000001\",\n keep_alive: \"1m\",\n allow_partial_search_results: \"true\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.open_point_in_time(\n index: \"my-index-000001\",\n keep_alive: \"1m\",\n allow_partial_search_results: \"true\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->openPointInTime([\n \"index\" => \"my-index-000001\",\n \"keep_alive\" => \"1m\",\n \"allow_partial_search_results\" => \"true\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_pit?keep_alive=1m&allow_partial_search_results=true\"", + "language": "curl" + } + ], "method_request": "POST /my-index-000001/_pit?keep_alive=1m&allow_partial_search_results=true" } }, @@ -32458,12 +33294,56 @@ "description": "Create or update a script or search template.\nCreates or updates a stored script or search template.", "examples": { "PutScriptRequestExample1": { + "alternatives": [ + { + "code": "resp = client.put_script(\n id=\"my-search-template\",\n script={\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.putScript({\n id: \"my-search-template\",\n script: {\n lang: \"mustache\",\n source: {\n query: {\n match: {\n message: \"{{query_string}}\",\n },\n },\n from: \"{{from}}\",\n size: \"{{size}}\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.put_script(\n id: \"my-search-template\",\n body: {\n \"script\": {\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->putScript([\n \"id\" => \"my-search-template\",\n \"body\" => [\n \"script\" => [\n \"lang\" => \"mustache\",\n \"source\" => [\n \"query\" => [\n \"match\" => [\n \"message\" => \"{{query_string}}\",\n ],\n ],\n \"from\" => \"{{from}}\",\n \"size\" => \"{{size}}\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"lang\":\"mustache\",\"source\":{\"query\":{\"match\":{\"message\":\"{{query_string}}\"}},\"from\":\"{{from}}\",\"size\":\"{{size}}\"}}}' \"$ELASTICSEARCH_URL/_scripts/my-search-template\"", + "language": "curl" + } + ], "description": "Run `PUT _scripts/my-search-template` to create a search template.\n", "method_request": "PUT _scripts/my-search-template", "summary": "Create a search template", "value": "{\n \"script\": {\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n }\n}" }, "PutScriptRequestExample2": { + "alternatives": [ + { + "code": "resp = client.put_script(\n id=\"my-stored-script\",\n script={\n \"lang\": \"painless\",\n \"source\": \"Math.log(_score * 2) + params['my_modifier']\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.putScript({\n id: \"my-stored-script\",\n script: {\n lang: \"painless\",\n source: \"Math.log(_score * 2) + params['my_modifier']\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.put_script(\n id: \"my-stored-script\",\n body: {\n \"script\": {\n \"lang\": \"painless\",\n \"source\": \"Math.log(_score * 2) + params['my_modifier']\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->putScript([\n \"id\" => \"my-stored-script\",\n \"body\" => [\n \"script\" => [\n \"lang\" => \"painless\",\n \"source\" => \"Math.log(_score * 2) + params['my_modifier']\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"lang\":\"painless\",\"source\":\"Math.log(_score * 2) + params['\"'\"'my_modifier'\"'\"']\"}}' \"$ELASTICSEARCH_URL/_scripts/my-stored-script\"", + "language": "curl" + } + ], "description": "Run `PUT _scripts/my-stored-script` to create a stored script.\n", "method_request": "PUT _scripts/my-stored-script", "summary": "Create a stored script", @@ -33184,6 +34064,28 @@ "description": "Evaluate ranked search results.\n\nEvaluate the quality of ranked search results over a set of typical search queries.", "examples": { "RankEvalRequestExample1": { + "alternatives": [ + { + "code": "resp = client.rank_eval(\n index=\"my-index-000001\",\n requests=[\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n metric={\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": False\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.rankEval({\n index: \"my-index-000001\",\n requests: [\n {\n id: \"JFK query\",\n request: {\n query: {\n match_all: {},\n },\n },\n ratings: [],\n },\n ],\n metric: {\n precision: {\n k: 20,\n relevant_rating_threshold: 1,\n ignore_unlabeled: false,\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.rank_eval(\n index: \"my-index-000001\",\n body: {\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->rankEval([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"requests\" => array(\n [\n \"id\" => \"JFK query\",\n \"request\" => [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n \"ratings\" => array(\n ),\n ],\n ),\n \"metric\" => [\n \"precision\" => [\n \"k\" => 20,\n \"relevant_rating_threshold\" => 1,\n \"ignore_unlabeled\" => false,\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"requests\":[{\"id\":\"JFK query\",\"request\":{\"query\":{\"match_all\":{}}},\"ratings\":[]}],\"metric\":{\"precision\":{\"k\":20,\"relevant_rating_threshold\":1,\"ignore_unlabeled\":false}}}' \"$ELASTICSEARCH_URL/my-index-000001/_rank_eval\"", + "language": "curl" + } + ], "description": "An example body for a `GET /my-index-000001/_rank_eval` request.", "method_request": "GET /my-index-000001/_rank_eval", "value": "{\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": { \"query\": { \"match_all\": {} } },\n \"ratings\": []\n } ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n}" @@ -33617,78 +34519,364 @@ "description": "Reindex documents.\n\nCopy documents from a source to a destination.\nYou can copy all documents to the destination index or reindex a subset of the documents.\nThe source can be any existing index, alias, or data stream.\nThe destination must differ from the source.\nFor example, you cannot reindex a data stream into itself.\n\nIMPORTANT: Reindex requires `_source` to be enabled for all documents in the source.\nThe destination should be configured as wanted before calling the reindex API.\nReindex does not copy the settings from the source or its associated template.\nMappings, shard counts, and replicas, for example, must be configured ahead of time.\n\nIf the Elasticsearch security features are enabled, you must have the following security privileges:\n\n* The `read` index privilege for the source data stream, index, or alias.\n* The `write` index privilege for the destination data stream, index, or index alias.\n* To automatically create a data stream or index with a reindex API request, you must have the `auto_configure`, `create_index`, or `manage` index privilege for the destination data stream, index, or alias.\n* If reindexing from a remote cluster, the `source.remote.user` must have the `monitor` cluster privilege and the `read` index privilege for the source data stream, index, or alias.\n\nIf reindexing from a remote cluster, you must explicitly allow the remote host in the `reindex.remote.whitelist` setting.\nAutomatic data stream creation requires a matching index template with data stream enabled.\n\nThe `dest` element can be configured like the index API to control optimistic concurrency control.\nOmitting `version_type` or setting it to `internal` causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID.\n\nSetting `version_type` to `external` causes Elasticsearch to preserve the `version` from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source.\n\nSetting `op_type` to `create` causes the reindex API to create only missing documents in the destination.\nAll existing documents will cause a version conflict.\n\nIMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an `op_type` of `create`.\nA reindex can only add new documents to a destination data stream.\nIt cannot update existing documents in a destination data stream.\n\nBy default, version conflicts abort the reindex process.\nTo continue reindexing if there are conflicts, set the `conflicts` request body property to `proceed`.\nIn this case, the response includes a count of the version conflicts that were encountered.\nNote that the handling of other error types is unaffected by the `conflicts` property.\nAdditionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than `max_docs` until it has successfully indexed `max_docs` documents into the target or it has gone through every document in the source query.\n\nNOTE: The reindex API makes no effort to handle ID collisions.\nThe last document written will \"win\" but the order isn't usually predictable so it is not a good idea to rely on this behavior.\nInstead, make sure that IDs are unique by using a script.\n\n**Running reindex asynchronously**\n\nIf the request contains `wait_for_completion=false`, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task.\nElasticsearch creates a record of this task as a document at `_tasks/`.\n\n**Reindex from multiple sources**\n\nIf you have many sources to reindex it is generally better to reindex them one at a time rather than using a glob pattern to pick up multiple sources.\nThat way you can resume the process if there are any errors by removing the partially completed source and starting over.\nIt also makes parallelizing the process fairly simple: split the list of sources to reindex and run each list in parallel.\n\nFor example, you can use a bash script like this:\n\n```\nfor index in i1 i2 i3 i4 i5; do\n curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{\n \"source\": {\n \"index\": \"'$index'\"\n },\n \"dest\": {\n \"index\": \"'$index'-reindexed\"\n }\n }'\ndone\n```\n\n**Throttling**\n\nSet `requests_per_second` to any positive decimal number (`1.4`, `6`, `1000`, for example) to throttle the rate at which reindex issues batches of index operations.\nRequests are throttled by padding each batch with a wait time.\nTo turn off throttling, set `requests_per_second` to `-1`.\n\nThe throttling is done by waiting between batches so that the scroll that reindex uses internally can be given a timeout that takes into account the padding.\nThe padding time is the difference between the batch size divided by the `requests_per_second` and the time spent writing.\nBy default the batch size is `1000`, so if `requests_per_second` is set to `500`:\n\n```\ntarget_time = 1000 / 500 per second = 2 seconds\nwait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds\n```\n\nSince the batch is issued as a single bulk request, large batch sizes cause Elasticsearch to create many requests and then wait for a while before starting the next set.\nThis is \"bursty\" instead of \"smooth\".\n\n**Slicing**\n\nReindex supports sliced scroll to parallelize the reindexing process.\nThis parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts.\n\nNOTE: Reindexing from remote clusters does not support manual or automatic slicing.\n\nYou can slice a reindex request manually by providing a slice ID and total number of slices to each request.\nYou can also let reindex automatically parallelize by using sliced scroll to slice on `_id`.\nThe `slices` parameter specifies the number of slices to use.\n\nAdding `slices` to the reindex request just automates the manual process, creating sub-requests which means it has some quirks:\n\n* You can see these requests in the tasks API. These sub-requests are \"child\" tasks of the task for the request with slices.\n* Fetching the status of the task for the request with `slices` only contains the status of completed slices.\n* These sub-requests are individually addressable for things like cancellation and rethrottling.\n* Rethrottling the request with `slices` will rethrottle the unfinished sub-request proportionally.\n* Canceling the request with `slices` will cancel each sub-request.\n* Due to the nature of `slices`, each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution.\n* Parameters like `requests_per_second` and `max_docs` on a request with `slices` are distributed proportionally to each sub-request. Combine that with the previous point about distribution being uneven and you should conclude that using `max_docs` with `slices` might not result in exactly `max_docs` documents being reindexed.\n* Each sub-request gets a slightly different snapshot of the source, though these are all taken at approximately the same time.\n\nIf slicing automatically, setting `slices` to `auto` will choose a reasonable number for most indices.\nIf slicing manually or otherwise tuning automatic slicing, use the following guidelines.\n\nQuery performance is most efficient when the number of slices is equal to the number of shards in the index.\nIf that number is large (for example, `500`), choose a lower number as too many slices will hurt performance.\nSetting slices higher than the number of shards generally does not improve efficiency and adds overhead.\n\nIndexing performance scales linearly across available resources with the number of slices.\n\nWhether query or indexing performance dominates the runtime depends on the documents being reindexed and cluster resources.\n\n**Modify documents during reindexing**\n\nLike `_update_by_query`, reindex operations support a script that modifies the document.\nUnlike `_update_by_query`, the script is allowed to modify the document's metadata.\n\nJust as in `_update_by_query`, you can set `ctx.op` to change the operation that is run on the destination.\nFor example, set `ctx.op` to `noop` if your script decides that the document doesn’t have to be indexed in the destination. This \"no operation\" will be reported in the `noop` counter in the response body.\nSet `ctx.op` to `delete` if your script decides that the document must be deleted from the destination.\nThe deletion will be reported in the `deleted` counter in the response body.\nSetting `ctx.op` to anything else will return an error, as will setting any other field in `ctx`.\n\nThink of the possibilities! Just be careful; you are able to change:\n\n* `_id`\n* `_index`\n* `_version`\n* `_routing`\n\nSetting `_version` to `null` or clearing it from the `ctx` map is just like not sending the version in an indexing request.\nIt will cause the document to be overwritten in the destination regardless of the version on the target or the version type you use in the reindex API.\n\n**Reindex from remote**\n\nReindex supports reindexing from a remote Elasticsearch cluster.\nThe `host` parameter must contain a scheme, host, port, and optional path.\nThe `username` and `password` parameters are optional and when they are present the reindex operation will connect to the remote Elasticsearch node using basic authentication.\nBe sure to use HTTPS when using basic authentication or the password will be sent in plain text.\nThere are a range of settings available to configure the behavior of the HTTPS connection.\n\nWhen using Elastic Cloud, it is also possible to authenticate against the remote cluster through the use of a valid API key.\nRemote hosts must be explicitly allowed with the `reindex.remote.whitelist` setting.\nIt can be set to a comma delimited list of allowed remote host and port combinations.\nScheme is ignored; only the host and port are used.\nFor example:\n\n```\nreindex.remote.whitelist: [otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*\"]\n```\n\nThe list of allowed hosts must be configured on any nodes that will coordinate the reindex.\nThis feature should work with remote clusters of any version of Elasticsearch.\nThis should enable you to upgrade from any version of Elasticsearch to the current version by reindexing from a cluster of the old version.\n\nWARNING: Elasticsearch does not support forward compatibility across major versions.\nFor example, you cannot reindex from a 7.x cluster into a 6.x cluster.\n\nTo enable queries sent to older versions of Elasticsearch, the `query` parameter is sent directly to the remote host without validation or modification.\n\nNOTE: Reindexing from remote clusters does not support manual or automatic slicing.\n\nReindexing from a remote server uses an on-heap buffer that defaults to a maximum size of 100mb.\nIf the remote index includes very large documents you'll need to use a smaller batch size.\nIt is also possible to set the socket read timeout on the remote connection with the `socket_timeout` field and the connection timeout with the `connect_timeout` field.\nBoth default to 30 seconds.\n\n**Configuring SSL parameters**\n\nReindex from remote supports configurable SSL settings.\nThese must be specified in the `elasticsearch.yml` file, with the exception of the secure settings, which you add in the Elasticsearch keystore.\nIt is not possible to configure SSL in the body of the reindex request.", "examples": { "ReindexRequestExample1": { + "alternatives": [ + { + "code": "resp = client.reindex(\n source={\n \"index\": [\n \"my-index-000001\",\n \"my-index-000002\"\n ]\n },\n dest={\n \"index\": \"my-new-index-000002\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.reindex({\n source: {\n index: [\"my-index-000001\", \"my-index-000002\"],\n },\n dest: {\n index: \"my-new-index-000002\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.reindex(\n body: {\n \"source\": {\n \"index\": [\n \"my-index-000001\",\n \"my-index-000002\"\n ]\n },\n \"dest\": {\n \"index\": \"my-new-index-000002\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->reindex([\n \"body\" => [\n \"source\" => [\n \"index\" => array(\n \"my-index-000001\",\n \"my-index-000002\",\n ),\n ],\n \"dest\" => [\n \"index\" => \"my-new-index-000002\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":[\"my-index-000001\",\"my-index-000002\"]},\"dest\":{\"index\":\"my-new-index-000002\"}}' \"$ELASTICSEARCH_URL/_reindex\"", + "language": "curl" + } + ], "description": "Run `POST _reindex` to reindex from multiple sources. The `index` attribute in source can be a list, which enables you to copy from lots of sources in one request. This example copies documents from the `my-index-000001` and `my-index-000002` indices.\n", "method_request": "POST _reindex", "summary": "Reindex multiple sources", "value": "{\n \"source\": {\n \"index\": [\"my-index-000001\", \"my-index-000002\"]\n },\n \"dest\": {\n \"index\": \"my-new-index-000002\"\n }\n}" }, "ReindexRequestExample10": { + "alternatives": [ + { + "code": "resp = client.reindex(\n source={\n \"index\": \"metricbeat-*\"\n },\n dest={\n \"index\": \"metricbeat\"\n },\n script={\n \"lang\": \"painless\",\n \"source\": \"ctx._index = 'metricbeat-' + (ctx._index.substring('metricbeat-'.length(), ctx._index.length())) + '-1'\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.reindex({\n source: {\n index: \"metricbeat-*\",\n },\n dest: {\n index: \"metricbeat\",\n },\n script: {\n lang: \"painless\",\n source:\n \"ctx._index = 'metricbeat-' + (ctx._index.substring('metricbeat-'.length(), ctx._index.length())) + '-1'\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.reindex(\n body: {\n \"source\": {\n \"index\": \"metricbeat-*\"\n },\n \"dest\": {\n \"index\": \"metricbeat\"\n },\n \"script\": {\n \"lang\": \"painless\",\n \"source\": \"ctx._index = 'metricbeat-' + (ctx._index.substring('metricbeat-'.length(), ctx._index.length())) + '-1'\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->reindex([\n \"body\" => [\n \"source\" => [\n \"index\" => \"metricbeat-*\",\n ],\n \"dest\" => [\n \"index\" => \"metricbeat\",\n ],\n \"script\" => [\n \"lang\" => \"painless\",\n \"source\" => \"ctx._index = 'metricbeat-' + (ctx._index.substring('metricbeat-'.length(), ctx._index.length())) + '-1'\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"metricbeat-*\"},\"dest\":{\"index\":\"metricbeat\"},\"script\":{\"lang\":\"painless\",\"source\":\"ctx._index = '\"'\"'metricbeat-'\"'\"' + (ctx._index.substring('\"'\"'metricbeat-'\"'\"'.length(), ctx._index.length())) + '\"'\"'-1'\"'\"'\"}}' \"$ELASTICSEARCH_URL/_reindex\"", + "language": "curl" + } + ], "description": "You can use Painless to reindex daily indices to apply a new template to the existing documents. The script extracts the date from the index name and creates a new index with `-1` appended. For example, all data from `metricbeat-2016.05.31` will be reindexed into `metricbeat-2016.05.31-1`.\n", "method_request": "POST _reindex", "summary": "Reindex with Painless", "value": "{\n \"source\": {\n \"index\": \"metricbeat-*\"\n },\n \"dest\": {\n \"index\": \"metricbeat\"\n },\n \"script\": {\n \"lang\": \"painless\",\n \"source\": \"ctx._index = 'metricbeat-' + (ctx._index.substring('metricbeat-'.length(), ctx._index.length())) + '-1'\"\n }\n}" }, "ReindexRequestExample11": { + "alternatives": [ + { + "code": "resp = client.reindex(\n max_docs=10,\n source={\n \"index\": \"my-index-000001\",\n \"query\": {\n \"function_score\": {\n \"random_score\": {},\n \"min_score\": 0.9\n }\n }\n },\n dest={\n \"index\": \"my-new-index-000001\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.reindex({\n max_docs: 10,\n source: {\n index: \"my-index-000001\",\n query: {\n function_score: {\n random_score: {},\n min_score: 0.9,\n },\n },\n },\n dest: {\n index: \"my-new-index-000001\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.reindex(\n body: {\n \"max_docs\": 10,\n \"source\": {\n \"index\": \"my-index-000001\",\n \"query\": {\n \"function_score\": {\n \"random_score\": {},\n \"min_score\": 0.9\n }\n }\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->reindex([\n \"body\" => [\n \"max_docs\" => 10,\n \"source\" => [\n \"index\" => \"my-index-000001\",\n \"query\" => [\n \"function_score\" => [\n \"random_score\" => new ArrayObject([]),\n \"min_score\" => 0.9,\n ],\n ],\n ],\n \"dest\" => [\n \"index\" => \"my-new-index-000001\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"max_docs\":10,\"source\":{\"index\":\"my-index-000001\",\"query\":{\"function_score\":{\"random_score\":{},\"min_score\":0.9}}},\"dest\":{\"index\":\"my-new-index-000001\"}}' \"$ELASTICSEARCH_URL/_reindex\"", + "language": "curl" + } + ], "description": "Run `POST _reindex` to extract a random subset of the source for testing. You might need to adjust the `min_score` value depending on the relative amount of data extracted from source.\n", "method_request": "POST _reindex", "summary": "Reindex a random subset", "value": "{\n \"max_docs\": 10,\n \"source\": {\n \"index\": \"my-index-000001\",\n \"query\": {\n \"function_score\" : {\n \"random_score\" : {},\n \"min_score\" : 0.9\n }\n }\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n }\n}" }, "ReindexRequestExample12": { + "alternatives": [ + { + "code": "resp = client.reindex(\n source={\n \"index\": \"my-index-000001\"\n },\n dest={\n \"index\": \"my-new-index-000001\",\n \"version_type\": \"external\"\n },\n script={\n \"source\": \"if (ctx._source.foo == 'bar') {ctx._version++; ctx._source.remove('foo')}\",\n \"lang\": \"painless\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.reindex({\n source: {\n index: \"my-index-000001\",\n },\n dest: {\n index: \"my-new-index-000001\",\n version_type: \"external\",\n },\n script: {\n source:\n \"if (ctx._source.foo == 'bar') {ctx._version++; ctx._source.remove('foo')}\",\n lang: \"painless\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.reindex(\n body: {\n \"source\": {\n \"index\": \"my-index-000001\"\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\",\n \"version_type\": \"external\"\n },\n \"script\": {\n \"source\": \"if (ctx._source.foo == 'bar') {ctx._version++; ctx._source.remove('foo')}\",\n \"lang\": \"painless\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->reindex([\n \"body\" => [\n \"source\" => [\n \"index\" => \"my-index-000001\",\n ],\n \"dest\" => [\n \"index\" => \"my-new-index-000001\",\n \"version_type\" => \"external\",\n ],\n \"script\" => [\n \"source\" => \"if (ctx._source.foo == 'bar') {ctx._version++; ctx._source.remove('foo')}\",\n \"lang\" => \"painless\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"my-index-000001\"},\"dest\":{\"index\":\"my-new-index-000001\",\"version_type\":\"external\"},\"script\":{\"source\":\"if (ctx._source.foo == '\"'\"'bar'\"'\"') {ctx._version++; ctx._source.remove('\"'\"'foo'\"'\"')}\",\"lang\":\"painless\"}}' \"$ELASTICSEARCH_URL/_reindex\"", + "language": "curl" + } + ], "description": "Run `POST _reindex` to modify documents during reindexing. This example bumps the version of the source document.\n", "method_request": "POST _reindex", "summary": "Reindex modified documents", "value": "{\n \"source\": {\n \"index\": \"my-index-000001\"\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\",\n \"version_type\": \"external\"\n },\n \"script\": {\n \"source\": \"if (ctx._source.foo == 'bar') {ctx._version++; ctx._source.remove('foo')}\",\n \"lang\": \"painless\"\n }\n}" }, "ReindexRequestExample13": { + "alternatives": [ + { + "code": "resp = client.reindex(\n source={\n \"remote\": {\n \"host\": \"http://otherhost:9200\",\n \"username\": \"user\",\n \"password\": \"pass\"\n },\n \"index\": \"my-index-000001\",\n \"query\": {\n \"match\": {\n \"test\": \"data\"\n }\n }\n },\n dest={\n \"index\": \"my-new-index-000001\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.reindex({\n source: {\n remote: {\n host: \"http://otherhost:9200\",\n username: \"user\",\n password: \"pass\",\n },\n index: \"my-index-000001\",\n query: {\n match: {\n test: \"data\",\n },\n },\n },\n dest: {\n index: \"my-new-index-000001\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.reindex(\n body: {\n \"source\": {\n \"remote\": {\n \"host\": \"http://otherhost:9200\",\n \"username\": \"user\",\n \"password\": \"pass\"\n },\n \"index\": \"my-index-000001\",\n \"query\": {\n \"match\": {\n \"test\": \"data\"\n }\n }\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->reindex([\n \"body\" => [\n \"source\" => [\n \"remote\" => [\n \"host\" => \"http://otherhost:9200\",\n \"username\" => \"user\",\n \"password\" => \"pass\",\n ],\n \"index\" => \"my-index-000001\",\n \"query\" => [\n \"match\" => [\n \"test\" => \"data\",\n ],\n ],\n ],\n \"dest\" => [\n \"index\" => \"my-new-index-000001\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"remote\":{\"host\":\"http://otherhost:9200\",\"username\":\"user\",\"password\":\"pass\"},\"index\":\"my-index-000001\",\"query\":{\"match\":{\"test\":\"data\"}}},\"dest\":{\"index\":\"my-new-index-000001\"}}' \"$ELASTICSEARCH_URL/_reindex\"", + "language": "curl" + } + ], "description": "When using Elastic Cloud, you can run `POST _reindex` and authenticate against a remote cluster with an API key.\n", "method_request": "POST _reindex", "summary": "Reindex from remote on Elastic Cloud", "value": "{\n \"source\": {\n \"remote\": {\n \"host\": \"http://otherhost:9200\",\n \"username\": \"user\",\n \"password\": \"pass\"\n },\n \"index\": \"my-index-000001\",\n \"query\": {\n \"match\": {\n \"test\": \"data\"\n }\n }\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n }\n}" }, "ReindexRequestExample2": { + "alternatives": [ + { + "code": "resp = client.reindex(\n source={\n \"index\": \"my-index-000001\",\n \"slice\": {\n \"id\": 0,\n \"max\": 2\n }\n },\n dest={\n \"index\": \"my-new-index-000001\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.reindex({\n source: {\n index: \"my-index-000001\",\n slice: {\n id: 0,\n max: 2,\n },\n },\n dest: {\n index: \"my-new-index-000001\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.reindex(\n body: {\n \"source\": {\n \"index\": \"my-index-000001\",\n \"slice\": {\n \"id\": 0,\n \"max\": 2\n }\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->reindex([\n \"body\" => [\n \"source\" => [\n \"index\" => \"my-index-000001\",\n \"slice\" => [\n \"id\" => 0,\n \"max\" => 2,\n ],\n ],\n \"dest\" => [\n \"index\" => \"my-new-index-000001\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"my-index-000001\",\"slice\":{\"id\":0,\"max\":2}},\"dest\":{\"index\":\"my-new-index-000001\"}}' \"$ELASTICSEARCH_URL/_reindex\"", + "language": "curl" + } + ], "description": "Run `POST _reindex` to slice a reindex request manually. Provide a slice ID and total number of slices to each request.\n", "method_request": "POST _reindex", "summary": "Manual slicing", "value": "{\n \"source\": {\n \"index\": \"my-index-000001\",\n \"slice\": {\n \"id\": 0,\n \"max\": 2\n }\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n }\n}" }, "ReindexRequestExample3": { + "alternatives": [ + { + "code": "resp = client.reindex(\n slices=\"5\",\n refresh=True,\n source={\n \"index\": \"my-index-000001\"\n },\n dest={\n \"index\": \"my-new-index-000001\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.reindex({\n slices: 5,\n refresh: \"true\",\n source: {\n index: \"my-index-000001\",\n },\n dest: {\n index: \"my-new-index-000001\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.reindex(\n slices: \"5\",\n refresh: \"true\",\n body: {\n \"source\": {\n \"index\": \"my-index-000001\"\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->reindex([\n \"slices\" => \"5\",\n \"refresh\" => \"true\",\n \"body\" => [\n \"source\" => [\n \"index\" => \"my-index-000001\",\n ],\n \"dest\" => [\n \"index\" => \"my-new-index-000001\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"my-index-000001\"},\"dest\":{\"index\":\"my-new-index-000001\"}}' \"$ELASTICSEARCH_URL/_reindex?slices=5&refresh\"", + "language": "curl" + } + ], "description": "Run `POST _reindex?slices=5&refresh` to automatically parallelize using sliced scroll to slice on `_id`. The `slices` parameter specifies the number of slices to use.\n", "method_request": "POST _reindex?slices=5&refresh", "summary": "Automatic slicing", "value": "{\n \"source\": {\n \"index\": \"my-index-000001\"\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n }\n}" }, "ReindexRequestExample4": { + "alternatives": [ + { + "code": "resp = client.reindex(\n source={\n \"index\": \"source\",\n \"query\": {\n \"match\": {\n \"company\": \"cat\"\n }\n }\n },\n dest={\n \"index\": \"dest\",\n \"routing\": \"=cat\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.reindex({\n source: {\n index: \"source\",\n query: {\n match: {\n company: \"cat\",\n },\n },\n },\n dest: {\n index: \"dest\",\n routing: \"=cat\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.reindex(\n body: {\n \"source\": {\n \"index\": \"source\",\n \"query\": {\n \"match\": {\n \"company\": \"cat\"\n }\n }\n },\n \"dest\": {\n \"index\": \"dest\",\n \"routing\": \"=cat\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->reindex([\n \"body\" => [\n \"source\" => [\n \"index\" => \"source\",\n \"query\" => [\n \"match\" => [\n \"company\" => \"cat\",\n ],\n ],\n ],\n \"dest\" => [\n \"index\" => \"dest\",\n \"routing\" => \"=cat\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"source\",\"query\":{\"match\":{\"company\":\"cat\"}}},\"dest\":{\"index\":\"dest\",\"routing\":\"=cat\"}}' \"$ELASTICSEARCH_URL/_reindex\"", + "language": "curl" + } + ], "description": "By default if reindex sees a document with routing then the routing is preserved unless it's changed by the script. You can set `routing` on the `dest` request to change this behavior. In this example, run `POST _reindex` to copy all documents from the `source` with the company name `cat` into the `dest` with routing set to `cat`.\n", "method_request": "POST _reindex", "summary": "Routing", "value": "{\n \"source\": {\n \"index\": \"source\",\n \"query\": {\n \"match\": {\n \"company\": \"cat\"\n }\n }\n },\n \"dest\": {\n \"index\": \"dest\",\n \"routing\": \"=cat\"\n }\n}" }, "ReindexRequestExample5": { + "alternatives": [ + { + "code": "resp = client.reindex(\n source={\n \"index\": \"source\"\n },\n dest={\n \"index\": \"dest\",\n \"pipeline\": \"some_ingest_pipeline\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.reindex({\n source: {\n index: \"source\",\n },\n dest: {\n index: \"dest\",\n pipeline: \"some_ingest_pipeline\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.reindex(\n body: {\n \"source\": {\n \"index\": \"source\"\n },\n \"dest\": {\n \"index\": \"dest\",\n \"pipeline\": \"some_ingest_pipeline\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->reindex([\n \"body\" => [\n \"source\" => [\n \"index\" => \"source\",\n ],\n \"dest\" => [\n \"index\" => \"dest\",\n \"pipeline\" => \"some_ingest_pipeline\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"source\"},\"dest\":{\"index\":\"dest\",\"pipeline\":\"some_ingest_pipeline\"}}' \"$ELASTICSEARCH_URL/_reindex\"", + "language": "curl" + } + ], "description": "Run `POST _reindex` and use the ingest pipelines feature.", "method_request": "POST _reindex", "summary": "Ingest pipelines", "value": "{\n \"source\": {\n \"index\": \"source\"\n },\n \"dest\": {\n \"index\": \"dest\",\n \"pipeline\": \"some_ingest_pipeline\"\n }\n}" }, "ReindexRequestExample6": { + "alternatives": [ + { + "code": "resp = client.reindex(\n source={\n \"index\": \"my-index-000001\",\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n },\n dest={\n \"index\": \"my-new-index-000001\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.reindex({\n source: {\n index: \"my-index-000001\",\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n },\n dest: {\n index: \"my-new-index-000001\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.reindex(\n body: {\n \"source\": {\n \"index\": \"my-index-000001\",\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->reindex([\n \"body\" => [\n \"source\" => [\n \"index\" => \"my-index-000001\",\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n \"dest\" => [\n \"index\" => \"my-new-index-000001\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"my-index-000001\",\"query\":{\"term\":{\"user.id\":\"kimchy\"}}},\"dest\":{\"index\":\"my-new-index-000001\"}}' \"$ELASTICSEARCH_URL/_reindex\"", + "language": "curl" + } + ], "description": "Run `POST _reindex` and add a query to the `source` to limit the documents to reindex. For example, this request copies documents into `my-new-index-000001` only if they have a `user.id` of `kimchy`.\n", "method_request": "POST _reindex", "summary": "Reindex with a query", "value": "{\n \"source\": {\n \"index\": \"my-index-000001\",\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n }\n}" }, "ReindexRequestExample7": { + "alternatives": [ + { + "code": "resp = client.reindex(\n max_docs=1,\n source={\n \"index\": \"my-index-000001\"\n },\n dest={\n \"index\": \"my-new-index-000001\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.reindex({\n max_docs: 1,\n source: {\n index: \"my-index-000001\",\n },\n dest: {\n index: \"my-new-index-000001\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.reindex(\n body: {\n \"max_docs\": 1,\n \"source\": {\n \"index\": \"my-index-000001\"\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->reindex([\n \"body\" => [\n \"max_docs\" => 1,\n \"source\" => [\n \"index\" => \"my-index-000001\",\n ],\n \"dest\" => [\n \"index\" => \"my-new-index-000001\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"max_docs\":1,\"source\":{\"index\":\"my-index-000001\"},\"dest\":{\"index\":\"my-new-index-000001\"}}' \"$ELASTICSEARCH_URL/_reindex\"", + "language": "curl" + } + ], "description": "You can limit the number of processed documents by setting `max_docs`. For example, run `POST _reindex` to copy a single document from `my-index-000001` to `my-new-index-000001`.\n", "method_request": "POST _reindex", "summary": "Reindex with max_docs", "value": "{\n \"max_docs\": 1,\n \"source\": {\n \"index\": \"my-index-000001\"\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n }\n}" }, "ReindexRequestExample8": { + "alternatives": [ + { + "code": "resp = client.reindex(\n source={\n \"index\": \"my-index-000001\",\n \"_source\": [\n \"user.id\",\n \"_doc\"\n ]\n },\n dest={\n \"index\": \"my-new-index-000001\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.reindex({\n source: {\n index: \"my-index-000001\",\n _source: [\"user.id\", \"_doc\"],\n },\n dest: {\n index: \"my-new-index-000001\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.reindex(\n body: {\n \"source\": {\n \"index\": \"my-index-000001\",\n \"_source\": [\n \"user.id\",\n \"_doc\"\n ]\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->reindex([\n \"body\" => [\n \"source\" => [\n \"index\" => \"my-index-000001\",\n \"_source\" => array(\n \"user.id\",\n \"_doc\",\n ),\n ],\n \"dest\" => [\n \"index\" => \"my-new-index-000001\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"my-index-000001\",\"_source\":[\"user.id\",\"_doc\"]},\"dest\":{\"index\":\"my-new-index-000001\"}}' \"$ELASTICSEARCH_URL/_reindex\"", + "language": "curl" + } + ], "description": "You can use source filtering to reindex a subset of the fields in the original documents. For example, run `POST _reindex` the reindex only the `user.id` and `_doc` fields of each document.\n", "method_request": "POST _reindex", "summary": "Reindex selected fields", "value": "{\n \"source\": {\n \"index\": \"my-index-000001\",\n \"_source\": [\"user.id\", \"_doc\"]\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n }\n}" }, "ReindexRequestExample9": { + "alternatives": [ + { + "code": "resp = client.reindex(\n source={\n \"index\": \"my-index-000001\"\n },\n dest={\n \"index\": \"my-new-index-000001\"\n },\n script={\n \"source\": \"ctx._source.tag = ctx._source.remove(\\\"flag\\\")\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.reindex({\n source: {\n index: \"my-index-000001\",\n },\n dest: {\n index: \"my-new-index-000001\",\n },\n script: {\n source: 'ctx._source.tag = ctx._source.remove(\"flag\")',\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.reindex(\n body: {\n \"source\": {\n \"index\": \"my-index-000001\"\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n },\n \"script\": {\n \"source\": \"ctx._source.tag = ctx._source.remove(\\\"flag\\\")\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->reindex([\n \"body\" => [\n \"source\" => [\n \"index\" => \"my-index-000001\",\n ],\n \"dest\" => [\n \"index\" => \"my-new-index-000001\",\n ],\n \"script\" => [\n \"source\" => \"ctx._source.tag = ctx._source.remove(\\\"flag\\\")\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"my-index-000001\"},\"dest\":{\"index\":\"my-new-index-000001\"},\"script\":{\"source\":\"ctx._source.tag = ctx._source.remove(\\\"flag\\\")\"}}' \"$ELASTICSEARCH_URL/_reindex\"", + "language": "curl" + } + ], "description": "A reindex operation can build a copy of an index with renamed fields. If your index has documents with `text` and `flag` fields, you can change the latter field name to `tag` during the reindex.\n", "method_request": "POST _reindex", "summary": "Reindex new field names", @@ -34529,6 +35717,28 @@ "description": "Throttle a reindex operation.\n\nChange the number of requests per second for a particular reindex operation.\nFor example:\n\n```\nPOST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1\n```\n\nRethrottling that speeds up the query takes effect immediately.\nRethrottling that slows down the query will take effect after completing the current batch.\nThis behavior prevents scroll timeouts.", "examples": { "ReindexRethrottleRequestExample1": { + "alternatives": [ + { + "code": "resp = client.reindex_rethrottle(\n task_id=\"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second=\"-1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.reindexRethrottle({\n task_id: \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second: \"-1\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.reindex_rethrottle(\n task_id: \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second: \"-1\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->reindexRethrottle([\n \"task_id\" => \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n \"requests_per_second\" => \"-1\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1\"", + "language": "curl" + } + ], "method_request": "POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1" } }, @@ -34674,6 +35884,28 @@ "description": "Render a search template.\n\nRender a search template as a search request body.", "examples": { "RenderSearchTemplateRequestExample1": { + "alternatives": [ + { + "code": "resp = client.render_search_template(\n id=\"my-search-template\",\n params={\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.renderSearchTemplate({\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 20,\n size: 10,\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.render_search_template(\n body: {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->renderSearchTemplate([\n \"body\" => [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 20,\n \"size\" => 10,\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":20,\"size\":10}}' \"$ELASTICSEARCH_URL/_render/template\"", + "language": "curl" + } + ], "description": "Run `POST _render/template`", "method_request": "POST _render/template", "value": "{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n}" @@ -34883,18 +36115,84 @@ "description": "Run a script.\n\nRuns a script and returns a result.\nUse this API to build and test scripts, such as when defining a script for a runtime field.\nThis API requires very few dependencies and is especially useful if you don't have permissions to write documents on a cluster.\n\nThe API uses several _contexts_, which control how scripts are run, what variables are available at runtime, and what the return type is.\n\nEach context requires a script, but additional parameters depend on the context you're using for that script.", "examples": { "ExecutePainlessScriptRequestExample1": { + "alternatives": [ + { + "code": "resp = client.scripts_painless_execute(\n script={\n \"source\": \"params.count / params.total\",\n \"params\": {\n \"count\": 100,\n \"total\": 1000\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.scriptsPainlessExecute({\n script: {\n source: \"params.count / params.total\",\n params: {\n count: 100,\n total: 1000,\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.scripts_painless_execute(\n body: {\n \"script\": {\n \"source\": \"params.count / params.total\",\n \"params\": {\n \"count\": 100,\n \"total\": 1000\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->scriptsPainlessExecute([\n \"body\" => [\n \"script\" => [\n \"source\" => \"params.count / params.total\",\n \"params\" => [\n \"count\" => 100,\n \"total\" => 1000,\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"source\":\"params.count / params.total\",\"params\":{\"count\":100,\"total\":1000}}}' \"$ELASTICSEARCH_URL/_scripts/painless/_execute\"", + "language": "curl" + } + ], "description": "Run `POST /_scripts/painless/_execute`. The `painless_test` context is the default context. It runs scripts without additional parameters. The only variable that is available is `params`, which can be used to access user defined values. The result of the script is always converted to a string.\n", "method_request": "POST /_scripts/painless/_execute", "summary": "Test context", "value": "{\n \"script\": {\n \"source\": \"params.count / params.total\",\n \"params\": {\n \"count\": 100.0,\n \"total\": 1000.0\n }\n }\n}" }, "ExecutePainlessScriptRequestExample2": { + "alternatives": [ + { + "code": "resp = client.scripts_painless_execute(\n script={\n \"source\": \"doc['field'].value.length() <= params.max_length\",\n \"params\": {\n \"max_length\": 4\n }\n },\n context=\"filter\",\n context_setup={\n \"index\": \"my-index-000001\",\n \"document\": {\n \"field\": \"four\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.scriptsPainlessExecute({\n script: {\n source: \"doc['field'].value.length() <= params.max_length\",\n params: {\n max_length: 4,\n },\n },\n context: \"filter\",\n context_setup: {\n index: \"my-index-000001\",\n document: {\n field: \"four\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.scripts_painless_execute(\n body: {\n \"script\": {\n \"source\": \"doc['field'].value.length() <= params.max_length\",\n \"params\": {\n \"max_length\": 4\n }\n },\n \"context\": \"filter\",\n \"context_setup\": {\n \"index\": \"my-index-000001\",\n \"document\": {\n \"field\": \"four\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->scriptsPainlessExecute([\n \"body\" => [\n \"script\" => [\n \"source\" => \"doc['field'].value.length() <= params.max_length\",\n \"params\" => [\n \"max_length\" => 4,\n ],\n ],\n \"context\" => \"filter\",\n \"context_setup\" => [\n \"index\" => \"my-index-000001\",\n \"document\" => [\n \"field\" => \"four\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"source\":\"doc['\"'\"'field'\"'\"'].value.length() <= params.max_length\",\"params\":{\"max_length\":4}},\"context\":\"filter\",\"context_setup\":{\"index\":\"my-index-000001\",\"document\":{\"field\":\"four\"}}}' \"$ELASTICSEARCH_URL/_scripts/painless/_execute\"", + "language": "curl" + } + ], "description": "Run `POST /_scripts/painless/_execute` with a `filter` context. It treats scripts as if they were run inside a script query. For testing purposes, a document must be provided so that it will be temporarily indexed in-memory and is accessible from the script. More precisely, the `_source`, stored fields, and doc values of such a document are available to the script being tested.\n", "method_request": "POST /_scripts/painless/_execute", "summary": "Filter context", "value": "{\n \"script\": {\n \"source\": \"doc['field'].value.length() <= params.max_length\",\n \"params\": {\n \"max_length\": 4\n }\n },\n \"context\": \"filter\",\n \"context_setup\": {\n \"index\": \"my-index-000001\",\n \"document\": {\n \"field\": \"four\"\n }\n }\n}" }, "ExecutePainlessScriptRequestExample3": { + "alternatives": [ + { + "code": "resp = client.scripts_painless_execute(\n script={\n \"source\": \"doc['rank'].value / params.max_rank\",\n \"params\": {\n \"max_rank\": 5\n }\n },\n context=\"score\",\n context_setup={\n \"index\": \"my-index-000001\",\n \"document\": {\n \"rank\": 4\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.scriptsPainlessExecute({\n script: {\n source: \"doc['rank'].value / params.max_rank\",\n params: {\n max_rank: 5,\n },\n },\n context: \"score\",\n context_setup: {\n index: \"my-index-000001\",\n document: {\n rank: 4,\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.scripts_painless_execute(\n body: {\n \"script\": {\n \"source\": \"doc['rank'].value / params.max_rank\",\n \"params\": {\n \"max_rank\": 5\n }\n },\n \"context\": \"score\",\n \"context_setup\": {\n \"index\": \"my-index-000001\",\n \"document\": {\n \"rank\": 4\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->scriptsPainlessExecute([\n \"body\" => [\n \"script\" => [\n \"source\" => \"doc['rank'].value / params.max_rank\",\n \"params\" => [\n \"max_rank\" => 5,\n ],\n ],\n \"context\" => \"score\",\n \"context_setup\" => [\n \"index\" => \"my-index-000001\",\n \"document\" => [\n \"rank\" => 4,\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"source\":\"doc['\"'\"'rank'\"'\"'].value / params.max_rank\",\"params\":{\"max_rank\":5}},\"context\":\"score\",\"context_setup\":{\"index\":\"my-index-000001\",\"document\":{\"rank\":4}}}' \"$ELASTICSEARCH_URL/_scripts/painless/_execute\"", + "language": "curl" + } + ], "description": "Run `POST /_scripts/painless/_execute` with a `score` context. It treats scripts as if they were run inside a `script_score` function in a `function_score` query.\n", "method_request": "POST /_scripts/painless/_execute", "summary": "Score context", @@ -35002,6 +36300,28 @@ "description": "Run a scrolling search.\n\nIMPORTANT: The scroll API is no longer recommend for deep pagination. If you need to preserve the index state while paging through more than 10,000 hits, use the `search_after` parameter with a point in time (PIT).\n\nThe scroll API gets large sets of results from a single scrolling search request.\nTo get the necessary scroll ID, submit a search API request that includes an argument for the `scroll` query parameter.\nThe `scroll` parameter indicates how long Elasticsearch should retain the search context for the request.\nThe search response returns a scroll ID in the `_scroll_id` response body parameter.\nYou can then use the scroll ID with the scroll API to retrieve the next batch of results for the request.\nIf the Elasticsearch security features are enabled, the access to the results of a specific scroll ID is restricted to the user or API key that submitted the search.\n\nYou can also use the scroll API to specify a new scroll parameter that extends or shortens the retention period for the search context.\n\nIMPORTANT: Results from a scrolling search reflect the state of the index at the time of the initial search request. Subsequent indexing or document changes only affect later search and scroll requests.", "examples": { "ScrollRequestExample1": { + "alternatives": [ + { + "code": "resp = client.scroll(\n scroll_id=\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.scroll({\n scroll_id: \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.scroll(\n body: {\n \"scroll_id\": \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->scroll([\n \"body\" => [\n \"scroll_id\" => \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"scroll_id\":\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"}' \"$ELASTICSEARCH_URL/_search/scroll\"", + "language": "curl" + } + ], "description": "Run `GET /_search/scroll` to get the next batch of results for a scrolling search.", "method_request": "GET /_search/scroll", "value": "{\n \"scroll_id\" : \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n}" @@ -35675,18 +36995,84 @@ "description": "Run a search.\n\nGet search hits that match the query defined in the request.\nYou can provide search queries using the `q` query string parameter or the request body.\nIf both are specified, only the query parameter is used.\n\nIf the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges.\nTo search a point in time (PIT) for an alias, you must have the `read` index privilege for the alias's data streams or indices.\n\n**Search slicing**\n\nWhen paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the `slice` and `pit` properties.\nBy default the splitting is done first on the shards, then locally on each shard.\nThe local splitting partitions the shard into contiguous ranges based on Lucene document IDs.\n\nFor instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard.\n\nIMPORTANT: The same point-in-time ID should be used for all slices.\nIf different PIT IDs are used, slices can overlap and miss documents.\nThis situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index.", "examples": { "SearchRequestExample1": { + "alternatives": [ + { + "code": "resp = client.search(\n index=\"my-index-000001\",\n from=\"40\",\n size=\"20\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.search({\n index: \"my-index-000001\",\n from: 40,\n size: 20,\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.search(\n index: \"my-index-000001\",\n from: \"40\",\n size: \"20\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->search([\n \"index\" => \"my-index-000001\",\n \"from\" => \"40\",\n \"size\" => \"20\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_search?from=40&size=20\"", + "language": "curl" + } + ], "description": "Run `GET /my-index-000001/_search?from=40&size=20` to run a search.\n", "method_request": "GET /my-index-000001/_search?from=40&size=20", "summary": "A simple term search", "value": "{\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n}" }, "SearchRequestExample2": { + "alternatives": [ + { + "code": "resp = client.search(\n size=100,\n query={\n \"match\": {\n \"title\": \"elasticsearch\"\n }\n },\n pit={\n \"id\": \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\",\n \"keep_alive\": \"1m\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.search({\n size: 100,\n query: {\n match: {\n title: \"elasticsearch\",\n },\n },\n pit: {\n id: \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\",\n keep_alive: \"1m\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.search(\n body: {\n \"size\": 100,\n \"query\": {\n \"match\": {\n \"title\": \"elasticsearch\"\n }\n },\n \"pit\": {\n \"id\": \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\",\n \"keep_alive\": \"1m\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->search([\n \"body\" => [\n \"size\" => 100,\n \"query\" => [\n \"match\" => [\n \"title\" => \"elasticsearch\",\n ],\n ],\n \"pit\" => [\n \"id\" => \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\",\n \"keep_alive\" => \"1m\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"size\":100,\"query\":{\"match\":{\"title\":\"elasticsearch\"}},\"pit\":{\"id\":\"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\",\"keep_alive\":\"1m\"}}' \"$ELASTICSEARCH_URL/_search\"", + "language": "curl" + } + ], "description": "Run `POST /_search` to run a point in time search. The `id` parameter tells Elasticsearch to run the request using contexts from this open point in time. The `keep_alive` parameter tells Elasticsearch how long it should extend the time to live of the point in time.\n", "method_request": "POST /_search", "summary": "A point in time search", "value": "{\n \"size\": 100, \n \"query\": {\n \"match\" : {\n \"title\" : \"elasticsearch\"\n }\n },\n \"pit\": {\n \"id\": \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\", \n \"keep_alive\": \"1m\" \n }\n}" }, "SearchRequestExample3": { + "alternatives": [ + { + "code": "resp = client.search(\n slice={\n \"id\": 0,\n \"max\": 2\n },\n query={\n \"match\": {\n \"message\": \"foo\"\n }\n },\n pit={\n \"id\": \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.search({\n slice: {\n id: 0,\n max: 2,\n },\n query: {\n match: {\n message: \"foo\",\n },\n },\n pit: {\n id: \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.search(\n body: {\n \"slice\": {\n \"id\": 0,\n \"max\": 2\n },\n \"query\": {\n \"match\": {\n \"message\": \"foo\"\n }\n },\n \"pit\": {\n \"id\": \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->search([\n \"body\" => [\n \"slice\" => [\n \"id\" => 0,\n \"max\" => 2,\n ],\n \"query\" => [\n \"match\" => [\n \"message\" => \"foo\",\n ],\n ],\n \"pit\" => [\n \"id\" => \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"slice\":{\"id\":0,\"max\":2},\"query\":{\"match\":{\"message\":\"foo\"}},\"pit\":{\"id\":\"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\"}}' \"$ELASTICSEARCH_URL/_search\"", + "language": "curl" + } + ], "description": "When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently. The result from running the first `GET /_search` request returns documents belonging to the first slice (`id: 0`). If you run a second request with `id` set to `1', it returns documents in the second slice. Since the maximum number of slices is set to `2`, the union of the results is equivalent to the results of a point-in-time search without slicing.\n", "method_request": "GET /_search", "summary": "Search slicing", @@ -42942,6 +44328,28 @@ "description": "Search a vector tile.\n\nSearch a vector tile for geospatial values.\nBefore using this API, you should be familiar with the Mapbox vector tile specification.\nThe API returns results as a binary mapbox vector tile.\n\nInternally, Elasticsearch translates a vector tile search API request into a search containing:\n\n* A `geo_bounding_box` query on the ``. The query uses the `//` tile as a bounding box.\n* A `geotile_grid` or `geohex_grid` aggregation on the ``. The `grid_agg` parameter determines the aggregation type. The aggregation uses the `//` tile as a bounding box.\n* Optionally, a `geo_bounds` aggregation on the ``. The search only includes this aggregation if the `exact_bounds` parameter is `true`.\n* If the optional parameter `with_labels` is `true`, the internal search will include a dynamic runtime field that calls the `getLabelPosition` function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label.\n\nFor example, Elasticsearch may translate a vector tile search API request with a `grid_agg` argument of `geotile` and an `exact_bounds` argument of `true` into the following search\n\n```\nGET my-index/_search\n{\n \"size\": 10000,\n \"query\": {\n \"geo_bounding_box\": {\n \"my-geo-field\": {\n \"top_left\": {\n \"lat\": -40.979898069620134,\n \"lon\": -45\n },\n \"bottom_right\": {\n \"lat\": -66.51326044311186,\n \"lon\": 0\n }\n }\n }\n },\n \"aggregations\": {\n \"grid\": {\n \"geotile_grid\": {\n \"field\": \"my-geo-field\",\n \"precision\": 11,\n \"size\": 65536,\n \"bounds\": {\n \"top_left\": {\n \"lat\": -40.979898069620134,\n \"lon\": -45\n },\n \"bottom_right\": {\n \"lat\": -66.51326044311186,\n \"lon\": 0\n }\n }\n }\n },\n \"bounds\": {\n \"geo_bounds\": {\n \"field\": \"my-geo-field\",\n \"wrap_longitude\": false\n }\n }\n }\n}\n```\n\nThe API returns results as a binary Mapbox vector tile.\nMapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers:\n\n* A `hits` layer containing a feature for each `` value matching the `geo_bounding_box` query.\n* An `aggs` layer containing a feature for each cell of the `geotile_grid` or `geohex_grid`. The layer only contains features for cells with matching data.\n* A meta layer containing:\n * A feature containing a bounding box. By default, this is the bounding box of the tile.\n * Value ranges for any sub-aggregations on the `geotile_grid` or `geohex_grid`.\n * Metadata for the search.\n\nThe API only returns features that can display at its zoom level.\nFor example, if a polygon feature has no area at its zoom level, the API omits it.\nThe API returns errors as UTF-8 encoded JSON.\n\nIMPORTANT: You can specify several options for this API as either a query parameter or request body parameter.\nIf you specify both parameters, the query parameter takes precedence.\n\n**Grid precision for geotile**\n\nFor a `grid_agg` of `geotile`, you can use cells in the `aggs` layer as tiles for lower zoom levels.\n`grid_precision` represents the additional zoom levels available through these cells. The final precision is computed by as follows: ` + grid_precision`.\nFor example, if `` is 7 and `grid_precision` is 8, then the `geotile_grid` aggregation will use a precision of 15.\nThe maximum final precision is 29.\nThe `grid_precision` also determines the number of cells for the grid as follows: `(2^grid_precision) x (2^grid_precision)`.\nFor example, a value of 8 divides the tile into a grid of 256 x 256 cells.\nThe `aggs` layer only contains features for cells with matching data.\n\n**Grid precision for geohex**\n\nFor a `grid_agg` of `geohex`, Elasticsearch uses `` and `grid_precision` to calculate a final precision as follows: ` + grid_precision`.\n\nThis precision determines the H3 resolution of the hexagonal cells produced by the `geohex` aggregation.\nThe following table maps the H3 resolution for each precision.\nFor example, if `` is 3 and `grid_precision` is 3, the precision is 6.\nAt a precision of 6, hexagonal cells have an H3 resolution of 2.\nIf `` is 3 and `grid_precision` is 4, the precision is 7.\nAt a precision of 7, hexagonal cells have an H3 resolution of 3.\n\n| Precision | Unique tile bins | H3 resolution | Unique hex bins |\tRatio |\n| --------- | ---------------- | ------------- | ----------------| ----- |\n| 1 | 4 | 0 | 122 | 30.5 |\n| 2 | 16 | 0 | 122 | 7.625 |\n| 3 | 64 | 1 | 842 | 13.15625 |\n| 4 | 256 | 1 | 842 | 3.2890625 |\n| 5 | 1024 | 2 | 5882 | 5.744140625 |\n| 6 | 4096 | 2 | 5882 | 1.436035156 |\n| 7 | 16384 | 3 | 41162 | 2.512329102 |\n| 8 | 65536 | 3 | 41162 | 0.6280822754 |\n| 9 | 262144 | 4 | 288122 | 1.099098206 |\n| 10 | 1048576 | 4 | 288122 | 0.2747745514 |\n| 11 | 4194304 | 5 | 2016842 | 0.4808526039 |\n| 12 | 16777216 | 6 | 14117882 | 0.8414913416 |\n| 13 | 67108864 | 6 | 14117882 | 0.2103728354 |\n| 14 | 268435456 | 7 | 98825162 | 0.3681524172 |\n| 15 | 1073741824 | 8 | 691776122 | 0.644266719 |\n| 16 | 4294967296 | 8 | 691776122 | 0.1610666797 |\n| 17 | 17179869184 | 9 | 4842432842 | 0.2818666889 |\n| 18 | 68719476736 | 10 | 33897029882 | 0.4932667053 |\n| 19 | 274877906944 | 11 | 237279209162 | 0.8632167343 |\n| 20 | 1099511627776 | 11 | 237279209162 | 0.2158041836 |\n| 21 | 4398046511104 | 12 | 1660954464122 | 0.3776573213 |\n| 22 | 17592186044416 | 13 | 11626681248842 | 0.6609003122 |\n| 23 | 70368744177664 | 13 | 11626681248842 | 0.165225078 |\n| 24 | 281474976710656 | 14 | 81386768741882 | 0.2891438866 |\n| 25 | 1125899906842620 | 15 | 569707381193162 | 0.5060018015 |\n| 26 | 4503599627370500 | 15 | 569707381193162 | 0.1265004504 |\n| 27 | 18014398509482000 | 15 | 569707381193162 | 0.03162511259 |\n| 28 | 72057594037927900 | 15 | 569707381193162 | 0.007906278149 |\n| 29 | 288230376151712000 | 15 | 569707381193162 | 0.001976569537 |\n\nHexagonal cells don't align perfectly on a vector tile.\nSome cells may intersect more than one vector tile.\nTo compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level.\nElasticsearch uses the H3 resolution that is closest to the corresponding geotile density.", "examples": { "SearchMvtRequestExample1": { + "alternatives": [ + { + "code": "resp = client.search_mvt(\n index=\"museums\",\n field=\"location\",\n zoom=\"13\",\n x=\"4207\",\n y=\"2692\",\n grid_agg=\"geotile\",\n grid_precision=2,\n fields=[\n \"name\",\n \"price\"\n ],\n query={\n \"term\": {\n \"included\": True\n }\n },\n aggs={\n \"min_price\": {\n \"min\": {\n \"field\": \"price\"\n }\n },\n \"max_price\": {\n \"max\": {\n \"field\": \"price\"\n }\n },\n \"avg_price\": {\n \"avg\": {\n \"field\": \"price\"\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.searchMvt({\n index: \"museums\",\n field: \"location\",\n zoom: 13,\n x: 4207,\n y: 2692,\n grid_agg: \"geotile\",\n grid_precision: 2,\n fields: [\"name\", \"price\"],\n query: {\n term: {\n included: true,\n },\n },\n aggs: {\n min_price: {\n min: {\n field: \"price\",\n },\n },\n max_price: {\n max: {\n field: \"price\",\n },\n },\n avg_price: {\n avg: {\n field: \"price\",\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.search_mvt(\n index: \"museums\",\n field: \"location\",\n zoom: \"13\",\n x: \"4207\",\n y: \"2692\",\n body: {\n \"grid_agg\": \"geotile\",\n \"grid_precision\": 2,\n \"fields\": [\n \"name\",\n \"price\"\n ],\n \"query\": {\n \"term\": {\n \"included\": true\n }\n },\n \"aggs\": {\n \"min_price\": {\n \"min\": {\n \"field\": \"price\"\n }\n },\n \"max_price\": {\n \"max\": {\n \"field\": \"price\"\n }\n },\n \"avg_price\": {\n \"avg\": {\n \"field\": \"price\"\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->searchMvt([\n \"index\" => \"museums\",\n \"field\" => \"location\",\n \"zoom\" => \"13\",\n \"x\" => \"4207\",\n \"y\" => \"2692\",\n \"body\" => [\n \"grid_agg\" => \"geotile\",\n \"grid_precision\" => 2,\n \"fields\" => array(\n \"name\",\n \"price\",\n ),\n \"query\" => [\n \"term\" => [\n \"included\" => true,\n ],\n ],\n \"aggs\" => [\n \"min_price\" => [\n \"min\" => [\n \"field\" => \"price\",\n ],\n ],\n \"max_price\" => [\n \"max\" => [\n \"field\" => \"price\",\n ],\n ],\n \"avg_price\" => [\n \"avg\" => [\n \"field\" => \"price\",\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"grid_agg\":\"geotile\",\"grid_precision\":2,\"fields\":[\"name\",\"price\"],\"query\":{\"term\":{\"included\":true}},\"aggs\":{\"min_price\":{\"min\":{\"field\":\"price\"}},\"max_price\":{\"max\":{\"field\":\"price\"}},\"avg_price\":{\"avg\":{\"field\":\"price\"}}}}' \"$ELASTICSEARCH_URL/museums/_mvt/location/13/4207/2692\"", + "language": "curl" + } + ], "description": "Run `GET museums/_mvt/location/13/4207/2692` to search an index for `location` values that intersect the `13/4207/2692` vector tile.\n", "method_request": "GET museums/_mvt/location/13/4207/2692", "value": "{\n \"grid_agg\": \"geotile\",\n \"grid_precision\": 2,\n \"fields\": [\n \"name\",\n \"price\"\n ],\n \"query\": {\n \"term\": {\n \"included\": true\n }\n },\n \"aggs\": {\n \"min_price\": {\n \"min\": {\n \"field\": \"price\"\n }\n },\n \"max_price\": {\n \"max\": {\n \"field\": \"price\"\n }\n },\n \"avg_price\": {\n \"avg\": {\n \"field\": \"price\"\n }\n }\n }\n}" @@ -43219,6 +44627,28 @@ "description": "Get the search shards.\n\nGet the indices and shards that a search request would be run against.\nThis information can be useful for working out issues or planning optimizations with routing and shard preferences.\nWhen filtered aliases are used, the filter is returned as part of the `indices` section.\n\nIf the Elasticsearch security features are enabled, you must have the `view_index_metadata` or `manage` index privilege for the target data stream, index, or alias.", "examples": { "SearchShardsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.search_shards(\n index=\"my-index-000001\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.searchShards({\n index: \"my-index-000001\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.search_shards(\n index: \"my-index-000001\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->searchShards([\n \"index\" => \"my-index-000001\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_search_shards\"", + "language": "curl" + } + ], "method_request": "GET /my-index-000001/_search_shards" } }, @@ -43666,6 +45096,28 @@ "description": "Run a search with a search template.", "examples": { "SearchTemplateRequestExample1": { + "alternatives": [ + { + "code": "resp = client.search_template(\n index=\"my-index\",\n id=\"my-search-template\",\n params={\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.searchTemplate({\n index: \"my-index\",\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 0,\n size: 10,\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.search_template(\n index: \"my-index\",\n body: {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->searchTemplate([\n \"index\" => \"my-index\",\n \"body\" => [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 0,\n \"size\" => 10,\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":0,\"size\":10}}' \"$ELASTICSEARCH_URL/my-index/_search/template\"", + "language": "curl" + } + ], "description": "Run `GET my-index/_search/template` to run a search with a search template.\n", "method_request": "GET my-index/_search/template", "value": "{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n}" @@ -44198,6 +45650,28 @@ "description": "Get terms in an index.\n\nDiscover terms that match a partial string in an index.\nThis API is designed for low-latency look-ups used in auto-complete scenarios.\n\n> info\n> The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents.", "examples": { "TermsEnumRequestExample1": { + "alternatives": [ + { + "code": "resp = client.terms_enum(\n index=\"stackoverflow\",\n field=\"tags\",\n string=\"kiba\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.termsEnum({\n index: \"stackoverflow\",\n field: \"tags\",\n string: \"kiba\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.terms_enum(\n index: \"stackoverflow\",\n body: {\n \"field\": \"tags\",\n \"string\": \"kiba\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->termsEnum([\n \"index\" => \"stackoverflow\",\n \"body\" => [\n \"field\" => \"tags\",\n \"string\" => \"kiba\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"field\":\"tags\",\"string\":\"kiba\"}' \"$ELASTICSEARCH_URL/stackoverflow/_terms_enum\"", + "language": "curl" + } + ], "description": "Run `POST stackoverflow/_terms_enum`.", "method_request": "POST stackoverflow/_terms_enum", "value": "{\n \"field\" : \"tags\",\n \"string\" : \"kiba\"\n}" @@ -44603,30 +46077,140 @@ "description": "Get term vector information.\n\nGet information and statistics about terms in the fields of a particular document.\n\nYou can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request.\nYou can specify the fields you are interested in through the `fields` parameter or by adding the fields to the request body.\nFor example:\n\n```\nGET /my-index-000001/_termvectors/1?fields=message\n```\n\nFields can be specified using wildcards, similar to the multi match query.\n\nTerm vectors are real-time by default, not near real-time.\nThis can be changed by setting `realtime` parameter to `false`.\n\nYou can request three types of values: _term information_, _term statistics_, and _field statistics_.\nBy default, all term information and field statistics are returned for all fields but term statistics are excluded.\n\n**Term information**\n\n* term frequency in the field (always returned)\n* term positions (`positions: true`)\n* start and end offsets (`offsets: true`)\n* term payloads (`payloads: true`), as base64 encoded bytes\n\nIf the requested information wasn't stored in the index, it will be computed on the fly if possible.\nAdditionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user.\n\n> warn\n> Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16.\n\n**Behaviour**\n\nThe term and field statistics are not accurate.\nDeleted documents are not taken into account.\nThe information is only retrieved for the shard the requested document resides in.\nThe term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context.\nBy default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected.\nUse `routing` only to hit a particular shard.\nRefer to the linked documentation for detailed examples of how to use this API.", "examples": { "TermVectorsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.termvectors(\n index=\"my-index-000001\",\n id=\"1\",\n fields=[\n \"text\"\n ],\n offsets=True,\n payloads=True,\n positions=True,\n term_statistics=True,\n field_statistics=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.termvectors({\n index: \"my-index-000001\",\n id: 1,\n fields: [\"text\"],\n offsets: true,\n payloads: true,\n positions: true,\n term_statistics: true,\n field_statistics: true,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.termvectors(\n index: \"my-index-000001\",\n id: \"1\",\n body: {\n \"fields\": [\n \"text\"\n ],\n \"offsets\": true,\n \"payloads\": true,\n \"positions\": true,\n \"term_statistics\": true,\n \"field_statistics\": true\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->termvectors([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"body\" => [\n \"fields\" => array(\n \"text\",\n ),\n \"offsets\" => true,\n \"payloads\" => true,\n \"positions\" => true,\n \"term_statistics\" => true,\n \"field_statistics\" => true,\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"fields\":[\"text\"],\"offsets\":true,\"payloads\":true,\"positions\":true,\"term_statistics\":true,\"field_statistics\":true}' \"$ELASTICSEARCH_URL/my-index-000001/_termvectors/1\"", + "language": "curl" + } + ], "description": "Run `GET /my-index-000001/_termvectors/1` to return all information and statistics for field `text` in document 1.\n", "method_request": "GET /my-index-000001/_termvectors/1", "summary": "Return stored term vectors", "value": "{\n \"fields\" : [\"text\"],\n \"offsets\" : true,\n \"payloads\" : true,\n \"positions\" : true,\n \"term_statistics\" : true,\n \"field_statistics\" : true\n}" }, "TermVectorsRequestExample2": { + "alternatives": [ + { + "code": "resp = client.termvectors(\n index=\"my-index-000001\",\n doc={\n \"fullname\": \"John Doe\",\n \"text\": \"test test test\"\n },\n fields=[\n \"fullname\"\n ],\n per_field_analyzer={\n \"fullname\": \"keyword\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.termvectors({\n index: \"my-index-000001\",\n doc: {\n fullname: \"John Doe\",\n text: \"test test test\",\n },\n fields: [\"fullname\"],\n per_field_analyzer: {\n fullname: \"keyword\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.termvectors(\n index: \"my-index-000001\",\n body: {\n \"doc\": {\n \"fullname\": \"John Doe\",\n \"text\": \"test test test\"\n },\n \"fields\": [\n \"fullname\"\n ],\n \"per_field_analyzer\": {\n \"fullname\": \"keyword\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->termvectors([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"doc\" => [\n \"fullname\" => \"John Doe\",\n \"text\" => \"test test test\",\n ],\n \"fields\" => array(\n \"fullname\",\n ),\n \"per_field_analyzer\" => [\n \"fullname\" => \"keyword\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"doc\":{\"fullname\":\"John Doe\",\"text\":\"test test test\"},\"fields\":[\"fullname\"],\"per_field_analyzer\":{\"fullname\":\"keyword\"}}' \"$ELASTICSEARCH_URL/my-index-000001/_termvectors\"", + "language": "curl" + } + ], "description": "Run `GET /my-index-000001/_termvectors/1` to set per-field analyzers. A different analyzer than the one at the field may be provided by using the `per_field_analyzer` parameter.\n", "method_request": "GET /my-index-000001/_termvectors", "summary": "Per-field analyzer", "value": "{\n \"doc\" : {\n \"fullname\" : \"John Doe\",\n \"text\" : \"test test test\"\n },\n \"fields\": [\"fullname\"],\n \"per_field_analyzer\" : {\n \"fullname\": \"keyword\"\n }\n}" }, "TermVectorsRequestExample3": { + "alternatives": [ + { + "code": "resp = client.termvectors(\n index=\"imdb\",\n doc={\n \"plot\": \"When wealthy industrialist Tony Stark is forced to build an armored suit after a life-threatening incident, he ultimately decides to use its technology to fight against evil.\"\n },\n term_statistics=True,\n field_statistics=True,\n positions=False,\n offsets=False,\n filter={\n \"max_num_terms\": 3,\n \"min_term_freq\": 1,\n \"min_doc_freq\": 1\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.termvectors({\n index: \"imdb\",\n doc: {\n plot: \"When wealthy industrialist Tony Stark is forced to build an armored suit after a life-threatening incident, he ultimately decides to use its technology to fight against evil.\",\n },\n term_statistics: true,\n field_statistics: true,\n positions: false,\n offsets: false,\n filter: {\n max_num_terms: 3,\n min_term_freq: 1,\n min_doc_freq: 1,\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.termvectors(\n index: \"imdb\",\n body: {\n \"doc\": {\n \"plot\": \"When wealthy industrialist Tony Stark is forced to build an armored suit after a life-threatening incident, he ultimately decides to use its technology to fight against evil.\"\n },\n \"term_statistics\": true,\n \"field_statistics\": true,\n \"positions\": false,\n \"offsets\": false,\n \"filter\": {\n \"max_num_terms\": 3,\n \"min_term_freq\": 1,\n \"min_doc_freq\": 1\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->termvectors([\n \"index\" => \"imdb\",\n \"body\" => [\n \"doc\" => [\n \"plot\" => \"When wealthy industrialist Tony Stark is forced to build an armored suit after a life-threatening incident, he ultimately decides to use its technology to fight against evil.\",\n ],\n \"term_statistics\" => true,\n \"field_statistics\" => true,\n \"positions\" => false,\n \"offsets\" => false,\n \"filter\" => [\n \"max_num_terms\" => 3,\n \"min_term_freq\" => 1,\n \"min_doc_freq\" => 1,\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"doc\":{\"plot\":\"When wealthy industrialist Tony Stark is forced to build an armored suit after a life-threatening incident, he ultimately decides to use its technology to fight against evil.\"},\"term_statistics\":true,\"field_statistics\":true,\"positions\":false,\"offsets\":false,\"filter\":{\"max_num_terms\":3,\"min_term_freq\":1,\"min_doc_freq\":1}}' \"$ELASTICSEARCH_URL/imdb/_termvectors\"", + "language": "curl" + } + ], "description": "Run `GET /imdb/_termvectors` to filter the terms returned based on their tf-idf scores. It returns the three most \"interesting\" keywords from the artificial document having the given \"plot\" field value. Notice that the keyword \"Tony\" or any stop words are not part of the response, as their tf-idf must be too low.\n", - "method_request": "GET /imdb/_termvectorss", + "method_request": "GET /imdb/_termvectors", "summary": "Terms filtering", "value": "{\n \"doc\": {\n \"plot\": \"When wealthy industrialist Tony Stark is forced to build an armored suit after a life-threatening incident, he ultimately decides to use its technology to fight against evil.\"\n },\n \"term_statistics\": true,\n \"field_statistics\": true,\n \"positions\": false,\n \"offsets\": false,\n \"filter\": {\n \"max_num_terms\": 3,\n \"min_term_freq\": 1,\n \"min_doc_freq\": 1\n }\n}" }, "TermVectorsRequestExample4": { + "alternatives": [ + { + "code": "resp = client.termvectors(\n index=\"my-index-000001\",\n id=\"1\",\n fields=[\n \"text\",\n \"some_field_without_term_vectors\"\n ],\n offsets=True,\n positions=True,\n term_statistics=True,\n field_statistics=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.termvectors({\n index: \"my-index-000001\",\n id: 1,\n fields: [\"text\", \"some_field_without_term_vectors\"],\n offsets: true,\n positions: true,\n term_statistics: true,\n field_statistics: true,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.termvectors(\n index: \"my-index-000001\",\n id: \"1\",\n body: {\n \"fields\": [\n \"text\",\n \"some_field_without_term_vectors\"\n ],\n \"offsets\": true,\n \"positions\": true,\n \"term_statistics\": true,\n \"field_statistics\": true\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->termvectors([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"body\" => [\n \"fields\" => array(\n \"text\",\n \"some_field_without_term_vectors\",\n ),\n \"offsets\" => true,\n \"positions\" => true,\n \"term_statistics\" => true,\n \"field_statistics\" => true,\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"fields\":[\"text\",\"some_field_without_term_vectors\"],\"offsets\":true,\"positions\":true,\"term_statistics\":true,\"field_statistics\":true}' \"$ELASTICSEARCH_URL/my-index-000001/_termvectors/1\"", + "language": "curl" + } + ], "description": "Run `GET /my-index-000001/_termvectors/1`. Term vectors which are not explicitly stored in the index are automatically computed on the fly. This request returns all information and statistics for the fields in document 1, even though the terms haven't been explicitly stored in the index. Note that for the field text, the terms are not regenerated.\n", "method_request": "GET /my-index-000001/_termvectors/1", "summary": "Generate term vectors on the fly", "value": "{\n \"fields\" : [\"text\", \"some_field_without_term_vectors\"],\n \"offsets\" : true,\n \"positions\" : true,\n \"term_statistics\" : true,\n \"field_statistics\" : true\n}" }, "TermVectorsRequestExample5": { + "alternatives": [ + { + "code": "resp = client.termvectors(\n index=\"my-index-000001\",\n doc={\n \"fullname\": \"John Doe\",\n \"text\": \"test test test\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.termvectors({\n index: \"my-index-000001\",\n doc: {\n fullname: \"John Doe\",\n text: \"test test test\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.termvectors(\n index: \"my-index-000001\",\n body: {\n \"doc\": {\n \"fullname\": \"John Doe\",\n \"text\": \"test test test\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->termvectors([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"doc\" => [\n \"fullname\" => \"John Doe\",\n \"text\" => \"test test test\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"doc\":{\"fullname\":\"John Doe\",\"text\":\"test test test\"}}' \"$ELASTICSEARCH_URL/my-index-000001/_termvectors\"", + "language": "curl" + } + ], "description": "Run `GET /my-index-000001/_termvectors`. Term vectors can be generated for artificial documents, that is for documents not present in the index. If dynamic mapping is turned on (default), the document fields not in the original mapping will be dynamically created.\n", "method_request": "GET /my-index-000001/_termvectors", "summary": "Artificial documents", @@ -45192,66 +46776,308 @@ "description": "Update a document.\n\nUpdate a document by running a script or passing a partial document.\n\nIf the Elasticsearch security features are enabled, you must have the `index` or `write` index privilege for the target index or index alias.\n\nThe script can update, delete, or skip modifying the document.\nThe API also supports passing a partial document, which is merged into the existing document.\nTo fully replace an existing document, use the index API.\nThis operation:\n\n* Gets the document (collocated with the shard) from the index.\n* Runs the specified script.\n* Indexes the result.\n\nThe document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation.\n\nThe `_source` field must be enabled to use this API.\nIn addition to `_source`, you can access the following variables through the `ctx` map: `_index`, `_type`, `_id`, `_version`, `_routing`, and `_now` (the current timestamp).", "examples": { "UpdateRequestExample1": { + "alternatives": [ + { + "code": "resp = client.update(\n index=\"test\",\n id=\"1\",\n script={\n \"source\": \"ctx._source.counter += params.count\",\n \"lang\": \"painless\",\n \"params\": {\n \"count\": 4\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.update({\n index: \"test\",\n id: 1,\n script: {\n source: \"ctx._source.counter += params.count\",\n lang: \"painless\",\n params: {\n count: 4,\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.update(\n index: \"test\",\n id: \"1\",\n body: {\n \"script\": {\n \"source\": \"ctx._source.counter += params.count\",\n \"lang\": \"painless\",\n \"params\": {\n \"count\": 4\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->update([\n \"index\" => \"test\",\n \"id\" => \"1\",\n \"body\" => [\n \"script\" => [\n \"source\" => \"ctx._source.counter += params.count\",\n \"lang\" => \"painless\",\n \"params\" => [\n \"count\" => 4,\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"source\":\"ctx._source.counter += params.count\",\"lang\":\"painless\",\"params\":{\"count\":4}}}' \"$ELASTICSEARCH_URL/test/_update/1\"", + "language": "curl" + } + ], "description": "Run `POST test/_update/1` to increment a counter by using a script.", "method_request": "POST test/_update/1", "summary": "Update a counter with a script", "value": "{\n \"script\" : {\n \"source\": \"ctx._source.counter += params.count\",\n \"lang\": \"painless\",\n \"params\" : {\n \"count\" : 4\n }\n }\n}" }, "UpdateRequestExample10": { + "alternatives": [ + { + "code": "resp = client.update(\n index=\"test\",\n id=\"1\",\n scripted_upsert=True,\n script={\n \"source\": \"\\n if ( ctx.op == 'create' ) {\\n ctx._source.counter = params.count\\n } else {\\n ctx._source.counter += params.count\\n }\\n \",\n \"params\": {\n \"count\": 4\n }\n },\n upsert={},\n)", + "language": "Python" + }, + { + "code": "const response = await client.update({\n index: \"test\",\n id: 1,\n scripted_upsert: true,\n script: {\n source:\n \"\\n if ( ctx.op == 'create' ) {\\n ctx._source.counter = params.count\\n } else {\\n ctx._source.counter += params.count\\n }\\n \",\n params: {\n count: 4,\n },\n },\n upsert: {},\n});", + "language": "JavaScript" + }, + { + "code": "response = client.update(\n index: \"test\",\n id: \"1\",\n body: {\n \"scripted_upsert\": true,\n \"script\": {\n \"source\": \"\\n if ( ctx.op == 'create' ) {\\n ctx._source.counter = params.count\\n } else {\\n ctx._source.counter += params.count\\n }\\n \",\n \"params\": {\n \"count\": 4\n }\n },\n \"upsert\": {}\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->update([\n \"index\" => \"test\",\n \"id\" => \"1\",\n \"body\" => [\n \"scripted_upsert\" => true,\n \"script\" => [\n \"source\" => \"\\n if ( ctx.op == 'create' ) {\\n ctx._source.counter = params.count\\n } else {\\n ctx._source.counter += params.count\\n }\\n \",\n \"params\" => [\n \"count\" => 4,\n ],\n ],\n \"upsert\" => new ArrayObject([]),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"scripted_upsert\":true,\"script\":{\"source\":\"\\n if ( ctx.op == '\"'\"'create'\"'\"' ) {\\n ctx._source.counter = params.count\\n } else {\\n ctx._source.counter += params.count\\n }\\n \",\"params\":{\"count\":4}},\"upsert\":{}}' \"$ELASTICSEARCH_URL/test/_update/1\"", + "language": "curl" + } + ], "description": "Run `POST test/_update/1` to perform a scripted upsert. When `scripted_upsert` is `true`, the script runs whether or not the document exists.\n", "method_request": "POST test/_update/1", "summary": "Scripted upsert", "value": "{\n \"scripted_upsert\": true,\n \"script\": {\n \"source\": \"\"\"\n if ( ctx.op == 'create' ) {\n ctx._source.counter = params.count\n } else {\n ctx._source.counter += params.count\n }\n \"\"\",\n \"params\": {\n \"count\": 4\n }\n },\n \"upsert\": {}\n}" }, "UpdateRequestExample11": { + "alternatives": [ + { + "code": "resp = client.update(\n index=\"test\",\n id=\"1\",\n doc={\n \"name\": \"new_name\"\n },\n doc_as_upsert=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.update({\n index: \"test\",\n id: 1,\n doc: {\n name: \"new_name\",\n },\n doc_as_upsert: true,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.update(\n index: \"test\",\n id: \"1\",\n body: {\n \"doc\": {\n \"name\": \"new_name\"\n },\n \"doc_as_upsert\": true\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->update([\n \"index\" => \"test\",\n \"id\" => \"1\",\n \"body\" => [\n \"doc\" => [\n \"name\" => \"new_name\",\n ],\n \"doc_as_upsert\" => true,\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"doc\":{\"name\":\"new_name\"},\"doc_as_upsert\":true}' \"$ELASTICSEARCH_URL/test/_update/1\"", + "language": "curl" + } + ], "description": "Run `POST test/_update/1` to perform a doc as upsert. Instead of sending a partial `doc` plus an `upsert` doc, you can set `doc_as_upsert` to `true` to use the contents of `doc` as the `upsert` value.\n", "method_request": "POST test/_update/1", "summary": "Doc as upsert", "value": "{\n \"doc\": {\n \"name\": \"new_name\"\n },\n \"doc_as_upsert\": true\n}" }, "UpdateRequestExample2": { + "alternatives": [ + { + "code": "resp = client.update(\n index=\"test\",\n id=\"1\",\n script={\n \"source\": \"ctx._source.tags.add(params.tag)\",\n \"lang\": \"painless\",\n \"params\": {\n \"tag\": \"blue\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.update({\n index: \"test\",\n id: 1,\n script: {\n source: \"ctx._source.tags.add(params.tag)\",\n lang: \"painless\",\n params: {\n tag: \"blue\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.update(\n index: \"test\",\n id: \"1\",\n body: {\n \"script\": {\n \"source\": \"ctx._source.tags.add(params.tag)\",\n \"lang\": \"painless\",\n \"params\": {\n \"tag\": \"blue\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->update([\n \"index\" => \"test\",\n \"id\" => \"1\",\n \"body\" => [\n \"script\" => [\n \"source\" => \"ctx._source.tags.add(params.tag)\",\n \"lang\" => \"painless\",\n \"params\" => [\n \"tag\" => \"blue\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"source\":\"ctx._source.tags.add(params.tag)\",\"lang\":\"painless\",\"params\":{\"tag\":\"blue\"}}}' \"$ELASTICSEARCH_URL/test/_update/1\"", + "language": "curl" + } + ], "description": "Run `POST test/_update/1` to use a script to add a tag to a list of tags. In this example, it is just a list, so the tag is added even it exists.\n", "method_request": "POST test/_update/1", "summary": "Add a tag with a script", "value": "{\n \"script\": {\n \"source\": \"ctx._source.tags.add(params.tag)\",\n \"lang\": \"painless\",\n \"params\": {\n \"tag\": \"blue\"\n }\n }\n}" }, "UpdateRequestExample3": { + "alternatives": [ + { + "code": "resp = client.update(\n index=\"test\",\n id=\"1\",\n script={\n \"source\": \"if (ctx._source.tags.contains(params.tag)) { ctx._source.tags.remove(ctx._source.tags.indexOf(params.tag)) }\",\n \"lang\": \"painless\",\n \"params\": {\n \"tag\": \"blue\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.update({\n index: \"test\",\n id: 1,\n script: {\n source:\n \"if (ctx._source.tags.contains(params.tag)) { ctx._source.tags.remove(ctx._source.tags.indexOf(params.tag)) }\",\n lang: \"painless\",\n params: {\n tag: \"blue\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.update(\n index: \"test\",\n id: \"1\",\n body: {\n \"script\": {\n \"source\": \"if (ctx._source.tags.contains(params.tag)) { ctx._source.tags.remove(ctx._source.tags.indexOf(params.tag)) }\",\n \"lang\": \"painless\",\n \"params\": {\n \"tag\": \"blue\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->update([\n \"index\" => \"test\",\n \"id\" => \"1\",\n \"body\" => [\n \"script\" => [\n \"source\" => \"if (ctx._source.tags.contains(params.tag)) { ctx._source.tags.remove(ctx._source.tags.indexOf(params.tag)) }\",\n \"lang\" => \"painless\",\n \"params\" => [\n \"tag\" => \"blue\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"source\":\"if (ctx._source.tags.contains(params.tag)) { ctx._source.tags.remove(ctx._source.tags.indexOf(params.tag)) }\",\"lang\":\"painless\",\"params\":{\"tag\":\"blue\"}}}' \"$ELASTICSEARCH_URL/test/_update/1\"", + "language": "curl" + } + ], "description": "Run `POST test/_update/1` to use a script to remove a tag from a list of tags. The Painless function to remove a tag takes the array index of the element you want to remove. To avoid a possible runtime error, you first need to make sure the tag exists. If the list contains duplicates of the tag, this script just removes one occurrence.\n", "method_request": "POST test/_update/1", "summary": "Remove a tag with a script", "value": "{\n \"script\": {\n \"source\": \"if (ctx._source.tags.contains(params.tag)) { ctx._source.tags.remove(ctx._source.tags.indexOf(params.tag)) }\",\n \"lang\": \"painless\",\n \"params\": {\n \"tag\": \"blue\"\n }\n }\n}" }, "UpdateRequestExample4": { + "alternatives": [ + { + "code": "resp = client.update(\n index=\"test\",\n id=\"1\",\n script=\"ctx._source.new_field = 'value_of_new_field'\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.update({\n index: \"test\",\n id: 1,\n script: \"ctx._source.new_field = 'value_of_new_field'\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.update(\n index: \"test\",\n id: \"1\",\n body: {\n \"script\": \"ctx._source.new_field = 'value_of_new_field'\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->update([\n \"index\" => \"test\",\n \"id\" => \"1\",\n \"body\" => [\n \"script\" => \"ctx._source.new_field = 'value_of_new_field'\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":\"ctx._source.new_field = '\"'\"'value_of_new_field'\"'\"'\"}' \"$ELASTICSEARCH_URL/test/_update/1\"", + "language": "curl" + } + ], "description": "Run `POST test/_update/1` to use a script to add a field `new_field` to the document.\n", "method_request": "POST test/_update/1", "summary": "Add fields with a script", "value": "{\n \"script\" : \"ctx._source.new_field = 'value_of_new_field'\"\n}" }, "UpdateRequestExample5": { + "alternatives": [ + { + "code": "resp = client.update(\n index=\"test\",\n id=\"1\",\n script=\"ctx._source.remove('new_field')\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.update({\n index: \"test\",\n id: 1,\n script: \"ctx._source.remove('new_field')\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.update(\n index: \"test\",\n id: \"1\",\n body: {\n \"script\": \"ctx._source.remove('new_field')\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->update([\n \"index\" => \"test\",\n \"id\" => \"1\",\n \"body\" => [\n \"script\" => \"ctx._source.remove('new_field')\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":\"ctx._source.remove('\"'\"'new_field'\"'\"')\"}' \"$ELASTICSEARCH_URL/test/_update/1\"", + "language": "curl" + } + ], "description": "Run `POST test/_update/1` to use a script to remove a field `new_field` from the document.\n", "method_request": "POST test/_update/1", "summary": "Remove fields with a script", "value": "{\n \"script\" : \"ctx._source.remove('new_field')\"\n}" }, "UpdateRequestExample6": { + "alternatives": [ + { + "code": "resp = client.update(\n index=\"test\",\n id=\"1\",\n script=\"ctx._source['my-object'].remove('my-subfield')\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.update({\n index: \"test\",\n id: 1,\n script: \"ctx._source['my-object'].remove('my-subfield')\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.update(\n index: \"test\",\n id: \"1\",\n body: {\n \"script\": \"ctx._source['my-object'].remove('my-subfield')\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->update([\n \"index\" => \"test\",\n \"id\" => \"1\",\n \"body\" => [\n \"script\" => \"ctx._source['my-object'].remove('my-subfield')\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":\"ctx._source['\"'\"'my-object'\"'\"'].remove('\"'\"'my-subfield'\"'\"')\"}' \"$ELASTICSEARCH_URL/test/_update/1\"", + "language": "curl" + } + ], "description": "Run `POST test/_update/1` to use a script to remove a subfield from an object field.\n", "method_request": "POST test/_update/1", "summary": "Remove subfields with a script", "value": "{\n \"script\": \"ctx._source['my-object'].remove('my-subfield')\"\n}" }, "UpdateRequestExample7": { + "alternatives": [ + { + "code": "resp = client.update(\n index=\"test\",\n id=\"1\",\n script={\n \"source\": \"if (ctx._source.tags.contains(params.tag)) { ctx.op = 'delete' } else { ctx.op = 'noop' }\",\n \"lang\": \"painless\",\n \"params\": {\n \"tag\": \"green\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.update({\n index: \"test\",\n id: 1,\n script: {\n source:\n \"if (ctx._source.tags.contains(params.tag)) { ctx.op = 'delete' } else { ctx.op = 'noop' }\",\n lang: \"painless\",\n params: {\n tag: \"green\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.update(\n index: \"test\",\n id: \"1\",\n body: {\n \"script\": {\n \"source\": \"if (ctx._source.tags.contains(params.tag)) { ctx.op = 'delete' } else { ctx.op = 'noop' }\",\n \"lang\": \"painless\",\n \"params\": {\n \"tag\": \"green\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->update([\n \"index\" => \"test\",\n \"id\" => \"1\",\n \"body\" => [\n \"script\" => [\n \"source\" => \"if (ctx._source.tags.contains(params.tag)) { ctx.op = 'delete' } else { ctx.op = 'noop' }\",\n \"lang\" => \"painless\",\n \"params\" => [\n \"tag\" => \"green\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"source\":\"if (ctx._source.tags.contains(params.tag)) { ctx.op = '\"'\"'delete'\"'\"' } else { ctx.op = '\"'\"'noop'\"'\"' }\",\"lang\":\"painless\",\"params\":{\"tag\":\"green\"}}}' \"$ELASTICSEARCH_URL/test/_update/1\"", + "language": "curl" + } + ], "description": "Run `POST test/_update/1` to change the operation that runs from within the script. For example, this request deletes the document if the `tags` field contains `green`, otherwise it does nothing (`noop`).\n", "method_request": "POST test/_update/1", "summary": "Change the operation with a script", "value": "{\n \"script\": {\n \"source\": \"if (ctx._source.tags.contains(params.tag)) { ctx.op = 'delete' } else { ctx.op = 'noop' }\",\n \"lang\": \"painless\",\n \"params\": {\n \"tag\": \"green\"\n }\n }\n}" }, "UpdateRequestExample8": { + "alternatives": [ + { + "code": "resp = client.update(\n index=\"test\",\n id=\"1\",\n doc={\n \"name\": \"new_name\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.update({\n index: \"test\",\n id: 1,\n doc: {\n name: \"new_name\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.update(\n index: \"test\",\n id: \"1\",\n body: {\n \"doc\": {\n \"name\": \"new_name\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->update([\n \"index\" => \"test\",\n \"id\" => \"1\",\n \"body\" => [\n \"doc\" => [\n \"name\" => \"new_name\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"doc\":{\"name\":\"new_name\"}}' \"$ELASTICSEARCH_URL/test/_update/1\"", + "language": "curl" + } + ], "description": "Run `POST test/_update/1` to do a partial update that adds a new field to the existing document.\n", "method_request": "POST test/_update/1", "summary": "Update part of a document", "value": "{\n \"doc\": {\n \"name\": \"new_name\"\n }\n}" }, "UpdateRequestExample9": { + "alternatives": [ + { + "code": "resp = client.update(\n index=\"test\",\n id=\"1\",\n script={\n \"source\": \"ctx._source.counter += params.count\",\n \"lang\": \"painless\",\n \"params\": {\n \"count\": 4\n }\n },\n upsert={\n \"counter\": 1\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.update({\n index: \"test\",\n id: 1,\n script: {\n source: \"ctx._source.counter += params.count\",\n lang: \"painless\",\n params: {\n count: 4,\n },\n },\n upsert: {\n counter: 1,\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.update(\n index: \"test\",\n id: \"1\",\n body: {\n \"script\": {\n \"source\": \"ctx._source.counter += params.count\",\n \"lang\": \"painless\",\n \"params\": {\n \"count\": 4\n }\n },\n \"upsert\": {\n \"counter\": 1\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->update([\n \"index\" => \"test\",\n \"id\" => \"1\",\n \"body\" => [\n \"script\" => [\n \"source\" => \"ctx._source.counter += params.count\",\n \"lang\" => \"painless\",\n \"params\" => [\n \"count\" => 4,\n ],\n ],\n \"upsert\" => [\n \"counter\" => 1,\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"source\":\"ctx._source.counter += params.count\",\"lang\":\"painless\",\"params\":{\"count\":4}},\"upsert\":{\"counter\":1}}' \"$ELASTICSEARCH_URL/test/_update/1\"", + "language": "curl" + } + ], "description": "Run `POST test/_update/1` to perfom an upsert. If the document does not already exist, the contents of the upsert element are inserted as a new document. If the document exists, the script is run.\n", "method_request": "POST test/_update/1", "summary": "Upsert", @@ -45633,24 +47459,112 @@ "description": "Update documents.\nUpdates documents that match the specified query.\nIf 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.\n\nIf the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias:\n\n* `read`\n* `index` or `write`\n\nYou can specify the query criteria in the request URI or the request body using the same syntax as the search API.\n\nWhen you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning.\nWhen the versions match, the document is updated and the version number is incremented.\nIf a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails.\nYou can opt to count version conflicts instead of halting and returning by setting `conflicts` to `proceed`.\nNote that if you opt to count version conflicts, the operation could attempt to update more documents from the source than `max_docs` until it has successfully updated `max_docs` documents or it has gone through every document in the source query.\n\nNOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number.\n\nWhile processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents.\nA bulk update request is performed for each batch of matching documents.\nAny query or update failures cause the update by query request to fail and the failures are shown in the response.\nAny update requests that completed successfully still stick, they are not rolled back.\n\n**Throttling update requests**\n\nTo control the rate at which update by query issues batches of update operations, you can set `requests_per_second` to any positive decimal number.\nThis pads each batch with a wait time to throttle the rate.\nSet `requests_per_second` to `-1` to turn off throttling.\n\nThrottling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account.\nThe padding time is the difference between the batch size divided by the `requests_per_second` and the time spent writing.\nBy default the batch size is 1000, so if `requests_per_second` is set to `500`:\n\n```\ntarget_time = 1000 / 500 per second = 2 seconds\nwait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds\n```\n\nSince the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set.\nThis is \"bursty\" instead of \"smooth\".\n\n**Slicing**\n\nUpdate by query supports sliced scroll to parallelize the update process.\nThis can improve efficiency and provide a convenient way to break the request down into smaller parts.\n\nSetting `slices` to `auto` chooses a reasonable number for most data streams and indices.\nThis setting will use one slice per shard, up to a certain limit.\nIf there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards.\n\nAdding `slices` to `_update_by_query` just automates the manual process of creating sub-requests, which means it has some quirks:\n\n* You can see these requests in the tasks APIs. These sub-requests are \"child\" tasks of the task for the request with slices.\n* Fetching the status of the task for the request with `slices` only contains the status of completed slices.\n* These sub-requests are individually addressable for things like cancellation and rethrottling.\n* Rethrottling the request with `slices` will rethrottle the unfinished sub-request proportionally.\n* Canceling the request with slices will cancel each sub-request.\n* Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution.\n* Parameters like `requests_per_second` and `max_docs` on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using `max_docs` with `slices` might not result in exactly `max_docs` documents being updated.\n* Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time.\n\nIf you're slicing manually or otherwise tuning automatic slicing, keep in mind that:\n\n* Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead.\n* Update performance scales linearly across available resources with the number of slices.\n\nWhether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources.\n\n**Update the document source**\n\nUpdate by query supports scripts to update the document source.\nAs with the update API, you can set `ctx.op` to change the operation that is performed.\n\nSet `ctx.op = \"noop\"` if your script decides that it doesn't have to make any changes.\nThe update by query operation skips updating the document and increments the `noop` counter.\n\nSet `ctx.op = \"delete\"` if your script decides that the document should be deleted.\nThe update by query operation deletes the document and increments the `deleted` counter.\n\nUpdate by query supports only `index`, `noop`, and `delete`.\nSetting `ctx.op` to anything else is an error.\nSetting any other field in `ctx` is an error.\nThis API enables you to only modify the source of matching documents; you cannot move them.", "examples": { "UpdateByQueryRequestExample1": { + "alternatives": [ + { + "code": "resp = client.update_by_query(\n index=\"my-index-000001\",\n conflicts=\"proceed\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.updateByQuery({\n index: \"my-index-000001\",\n conflicts: \"proceed\",\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.update_by_query(\n index: \"my-index-000001\",\n conflicts: \"proceed\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->updateByQuery([\n \"index\" => \"my-index-000001\",\n \"conflicts\" => \"proceed\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_update_by_query?conflicts=proceed\"", + "language": "curl" + } + ], "description": "Run `POST my-index-000001/_update_by_query?conflicts=proceed` to update documents that match a query.\n", "method_request": "POST my-index-000001/_update_by_query?conflicts=proceed", "summary": "Update selected documents", "value": "{\n \"query\": { \n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n}" }, "UpdateByQueryRequestExample2": { + "alternatives": [ + { + "code": "resp = client.update_by_query(\n index=\"my-index-000001\",\n script={\n \"source\": \"ctx._source.count++\",\n \"lang\": \"painless\"\n },\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.updateByQuery({\n index: \"my-index-000001\",\n script: {\n source: \"ctx._source.count++\",\n lang: \"painless\",\n },\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.update_by_query(\n index: \"my-index-000001\",\n body: {\n \"script\": {\n \"source\": \"ctx._source.count++\",\n \"lang\": \"painless\"\n },\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->updateByQuery([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"script\" => [\n \"source\" => \"ctx._source.count++\",\n \"lang\" => \"painless\",\n ],\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"source\":\"ctx._source.count++\",\"lang\":\"painless\"},\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_update_by_query\"", + "language": "curl" + } + ], "description": "Run `POST my-index-000001/_update_by_query` with a script to update the document source. It increments the `count` field for all documents with a `user.id` of `kimchy` in `my-index-000001`.\n", "method_request": "POST my-index-000001/_update_by_query", "summary": "Update the document source", "value": "{\n \"script\": {\n \"source\": \"ctx._source.count++\",\n \"lang\": \"painless\"\n },\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n}" }, "UpdateByQueryRequestExample3": { + "alternatives": [ + { + "code": "resp = client.update_by_query(\n index=\"my-index-000001\",\n slice={\n \"id\": 0,\n \"max\": 2\n },\n script={\n \"source\": \"ctx._source['extra'] = 'test'\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.updateByQuery({\n index: \"my-index-000001\",\n slice: {\n id: 0,\n max: 2,\n },\n script: {\n source: \"ctx._source['extra'] = 'test'\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.update_by_query(\n index: \"my-index-000001\",\n body: {\n \"slice\": {\n \"id\": 0,\n \"max\": 2\n },\n \"script\": {\n \"source\": \"ctx._source['extra'] = 'test'\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->updateByQuery([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"slice\" => [\n \"id\" => 0,\n \"max\" => 2,\n ],\n \"script\" => [\n \"source\" => \"ctx._source['extra'] = 'test'\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"slice\":{\"id\":0,\"max\":2},\"script\":{\"source\":\"ctx._source['\"'\"'extra'\"'\"'] = '\"'\"'test'\"'\"'\"}}' \"$ELASTICSEARCH_URL/my-index-000001/_update_by_query\"", + "language": "curl" + } + ], "description": "Run `POST my-index-000001/_update_by_query` to slice an update by query manually. Provide a slice ID and total number of slices to each request.\n", "method_request": "POST my-index-000001/_update_by_query", "summary": "Slice manually", "value": "{\n \"slice\": {\n \"id\": 0,\n \"max\": 2\n },\n \"script\": {\n \"source\": \"ctx._source['extra'] = 'test'\"\n }\n}" }, "UpdateByQueryRequestExample4": { + "alternatives": [ + { + "code": "resp = client.update_by_query(\n index=\"my-index-000001\",\n refresh=True,\n slices=\"5\",\n script={\n \"source\": \"ctx._source['extra'] = 'test'\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.updateByQuery({\n index: \"my-index-000001\",\n refresh: \"true\",\n slices: 5,\n script: {\n source: \"ctx._source['extra'] = 'test'\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.update_by_query(\n index: \"my-index-000001\",\n refresh: \"true\",\n slices: \"5\",\n body: {\n \"script\": {\n \"source\": \"ctx._source['extra'] = 'test'\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->updateByQuery([\n \"index\" => \"my-index-000001\",\n \"refresh\" => \"true\",\n \"slices\" => \"5\",\n \"body\" => [\n \"script\" => [\n \"source\" => \"ctx._source['extra'] = 'test'\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"source\":\"ctx._source['\"'\"'extra'\"'\"'] = '\"'\"'test'\"'\"'\"}}' \"$ELASTICSEARCH_URL/my-index-000001/_update_by_query?refresh&slices=5\"", + "language": "curl" + } + ], "description": "Run `POST my-index-000001/_update_by_query?refresh&slices=5` to use automatic slicing. It automatically parallelizes using sliced scroll to slice on `_id`.\n", "method_request": "POST my-index-000001/_update_by_query?refresh&slices=5", "summary": "Slice automatically", @@ -46322,6 +48236,28 @@ "description": "Throttle an update by query operation.\n\nChange the number of requests per second for a particular update by query operation.\nRethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts.", "examples": { "UpdateByQueryRethrottleRequestExample1": { + "alternatives": [ + { + "code": "resp = client.update_by_query_rethrottle(\n task_id=\"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second=\"-1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.updateByQueryRethrottle({\n task_id: \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second: \"-1\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.update_by_query_rethrottle(\n task_id: \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second: \"-1\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->updateByQueryRethrottle([\n \"task_id\" => \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n \"requests_per_second\" => \"-1\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_update_by_query/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1\"", + "language": "curl" + } + ], "method_request": "POST _update_by_query/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1" } }, @@ -51049,8 +52985,7 @@ }, { "kind": "type_alias", - "docId": "node-roles", - "docUrl": "https://www.elastic.co/docs/reference/elasticsearch/configuration-reference/node-settings#node-roles", + "description": "* @doc_id node-roles", "name": { "name": "NodeRoles", "namespace": "_types" @@ -92974,6 +94909,28 @@ "description": "Delete an async search.\n\nIf the asynchronous search is still running, it is cancelled.\nOtherwise, the saved search results are deleted.\nIf the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the `cancel_task` cluster privilege.", "examples": { "AsyncSearchDeleteExample1": { + "alternatives": [ + { + "code": "resp = client.async_search.delete(\n id=\"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.asyncSearch.delete({\n id: \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.async_search.delete(\n id: \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->asyncSearch()->delete([\n \"id\" => \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_async_search/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\"", + "language": "curl" + } + ], "method_request": "DELETE /_async_search/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=" } }, @@ -93034,6 +94991,28 @@ "description": "Get async search results.\n\nRetrieve the results of a previously submitted asynchronous search request.\nIf the Elasticsearch security features are enabled, access to the results of a specific async search is restricted to the user or API key that submitted it.", "examples": { "AsyncSearchGetRequestExample1": { + "alternatives": [ + { + "code": "resp = client.async_search.get(\n id=\"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.asyncSearch.get({\n id: \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.async_search.get(\n id: \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->asyncSearch()->get([\n \"id\" => \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_async_search/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\"", + "language": "curl" + } + ], "method_request": "GET /_async_search/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=" } }, @@ -93152,6 +95131,28 @@ "description": "Get the async search status.\n\nGet the status of a previously submitted async search request given its identifier, without retrieving search results.\nIf the Elasticsearch security features are enabled, the access to the status of a specific async search is restricted to:\n\n* The user or API key that submitted the original async search request.\n* Users that have the `monitor` cluster privilege or greater privileges.", "examples": { "AsyncSearchStatusRequestExample1": { + "alternatives": [ + { + "code": "resp = client.async_search.status(\n id=\"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.asyncSearch.status({\n id: \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.async_search.status(\n id: \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->asyncSearch()->status([\n \"id\" => \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_async_search/status/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\"", + "language": "curl" + } + ], "method_request": "GET /_async_search/status/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=" } }, @@ -93770,6 +95771,28 @@ "description": "Run an async search.\n\nWhen the primary sort of the results is an indexed field, shards get sorted based on minimum and maximum value that they hold for that field. Partial results become available following the sort criteria that was requested.\n\nWarning: Asynchronous search does not support scroll or search requests that include only the suggest section.\n\nBy default, Elasticsearch does not allow you to store an async search response larger than 10Mb and an attempt to do this results in an error.\nThe maximum allowed size for a stored async search response can be set by changing the `search.max_async_search_response_size` cluster level setting.", "examples": { "AsyncSearchSubmitRequestExample1": { + "alternatives": [ + { + "code": "resp = client.async_search.submit(\n index=\"sales*\",\n size=\"0\",\n sort=[\n {\n \"date\": {\n \"order\": \"asc\"\n }\n }\n ],\n aggs={\n \"sale_date\": {\n \"date_histogram\": {\n \"field\": \"date\",\n \"calendar_interval\": \"1d\"\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.asyncSearch.submit({\n index: \"sales*\",\n size: 0,\n sort: [\n {\n date: {\n order: \"asc\",\n },\n },\n ],\n aggs: {\n sale_date: {\n date_histogram: {\n field: \"date\",\n calendar_interval: \"1d\",\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.async_search.submit(\n index: \"sales*\",\n size: \"0\",\n body: {\n \"sort\": [\n {\n \"date\": {\n \"order\": \"asc\"\n }\n }\n ],\n \"aggs\": {\n \"sale_date\": {\n \"date_histogram\": {\n \"field\": \"date\",\n \"calendar_interval\": \"1d\"\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->asyncSearch()->submit([\n \"index\" => \"sales*\",\n \"size\" => \"0\",\n \"body\" => [\n \"sort\" => array(\n [\n \"date\" => [\n \"order\" => \"asc\",\n ],\n ],\n ),\n \"aggs\" => [\n \"sale_date\" => [\n \"date_histogram\" => [\n \"field\" => \"date\",\n \"calendar_interval\" => \"1d\",\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"sort\":[{\"date\":{\"order\":\"asc\"}}],\"aggs\":{\"sale_date\":{\"date_histogram\":{\"field\":\"date\",\"calendar_interval\":\"1d\"}}}}' \"$ELASTICSEARCH_URL/sales*/_async_search?size=0\"", + "language": "curl" + } + ], "description": "Perform a search request asynchronously with `POST /sales*/_async_search?size=0`. It accepts the same parameters and request body as the search API.\n", "method_request": "POST /sales*/_async_search?size=0", "value": "{\n \"sort\": [\n { \"date\": { \"order\": \"asc\" } }\n ],\n \"aggs\": {\n \"sale_date\": {\n \"date_histogram\": {\n \"field\": \"date\",\n \"calendar_interval\": \"1d\"\n }\n }\n }\n}" @@ -94439,6 +96462,28 @@ "description": "Delete an autoscaling policy.\n\nNOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.", "examples": { "DeleteAutoscalingPolicyRequestExample1": { + "alternatives": [ + { + "code": "resp = client.autoscaling.delete_autoscaling_policy(\n name=\"*\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.autoscaling.deleteAutoscalingPolicy({\n name: \"*\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.autoscaling.delete_autoscaling_policy(\n name: \"*\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->autoscaling()->deleteAutoscalingPolicy([\n \"name\" => \"*\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_autoscaling/policy/*\"", + "language": "curl" + } + ], "method_request": "DELETE /_autoscaling/policy/*" } }, @@ -94725,6 +96770,28 @@ "description": "Get the autoscaling capacity.\n\nNOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.\n\nThis API gets the current autoscaling capacity based on the configured autoscaling policy.\nIt will return information to size the cluster appropriately to the current workload.\n\nThe `required_capacity` is calculated as the maximum of the `required_capacity` result of all individual deciders that are enabled for the policy.\n\nThe operator should verify that the `current_nodes` match the operator’s knowledge of the cluster to avoid making autoscaling decisions based on stale or incomplete information.\n\nThe response contains decider-specific information you can use to diagnose how and why autoscaling determined a certain capacity was required.\nThis information is provided for diagnosis only.\nDo not use this information to make autoscaling decisions.", "examples": { "GetAutoscalingCapacityRequestExample1": { + "alternatives": [ + { + "code": "resp = client.autoscaling.get_autoscaling_capacity()", + "language": "Python" + }, + { + "code": "const response = await client.autoscaling.getAutoscalingCapacity();", + "language": "JavaScript" + }, + { + "code": "response = client.autoscaling.get_autoscaling_capacity", + "language": "Ruby" + }, + { + "code": "$resp = $client->autoscaling()->getAutoscalingCapacity();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_autoscaling/capacity\"", + "language": "curl" + } + ], "method_request": "GET /_autoscaling/capacity" } }, @@ -94809,6 +96876,28 @@ "description": "Get an autoscaling policy.\n\nNOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.", "examples": { "GetAutoscalingPolicyRequestExample1": { + "alternatives": [ + { + "code": "resp = client.autoscaling.get_autoscaling_policy(\n name=\"my_autoscaling_policy\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.autoscaling.getAutoscalingPolicy({\n name: \"my_autoscaling_policy\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.autoscaling.get_autoscaling_policy(\n name: \"my_autoscaling_policy\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->autoscaling()->getAutoscalingPolicy([\n \"name\" => \"my_autoscaling_policy\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_autoscaling/policy/my_autoscaling_policy\"", + "language": "curl" + } + ], "method_request": "GET /_autoscaling/policy/my_autoscaling_policy" } }, @@ -94898,11 +96987,55 @@ "description": "Create or update an autoscaling policy.\n\nNOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.", "examples": { "PutAutoscalingPolicyRequestExample1": { + "alternatives": [ + { + "code": "resp = client.autoscaling.put_autoscaling_policy(\n name=\"\",\n policy={\n \"roles\": [],\n \"deciders\": {\n \"fixed\": {}\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.autoscaling.putAutoscalingPolicy({\n name: \"\",\n policy: {\n roles: [],\n deciders: {\n fixed: {},\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.autoscaling.put_autoscaling_policy(\n name: \"\",\n body: {\n \"roles\": [],\n \"deciders\": {\n \"fixed\": {}\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->autoscaling()->putAutoscalingPolicy([\n \"name\" => \"\",\n \"body\" => [\n \"roles\" => array(\n ),\n \"deciders\" => [\n \"fixed\" => new ArrayObject([]),\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"roles\":[],\"deciders\":{\"fixed\":{}}}' \"$ELASTICSEARCH_URL/_autoscaling/policy/\"", + "language": "curl" + } + ], "method_request": "PUT /_autoscaling/policy/", "summary": "Creates or updates an autoscaling policy.", "value": "{\n \"roles\": [],\n \"deciders\": {\n \"fixed\": {\n }\n }\n}" }, "PutAutoscalingPolicyRequestExample2": { + "alternatives": [ + { + "code": "resp = client.autoscaling.put_autoscaling_policy(\n name=\"my_autoscaling_policy\",\n policy={\n \"roles\": [\n \"data_hot\"\n ],\n \"deciders\": {\n \"fixed\": {}\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.autoscaling.putAutoscalingPolicy({\n name: \"my_autoscaling_policy\",\n policy: {\n roles: [\"data_hot\"],\n deciders: {\n fixed: {},\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.autoscaling.put_autoscaling_policy(\n name: \"my_autoscaling_policy\",\n body: {\n \"roles\": [\n \"data_hot\"\n ],\n \"deciders\": {\n \"fixed\": {}\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->autoscaling()->putAutoscalingPolicy([\n \"name\" => \"my_autoscaling_policy\",\n \"body\" => [\n \"roles\" => array(\n \"data_hot\",\n ),\n \"deciders\" => [\n \"fixed\" => new ArrayObject([]),\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"roles\":[\"data_hot\"],\"deciders\":{\"fixed\":{}}}' \"$ELASTICSEARCH_URL/_autoscaling/policy/my_autoscaling_policy\"", + "language": "curl" + } + ], "description": "The API method and path for this request: `PUT /_autoscaling/policy/my_autoscaling_policy`. It creates `my_autoscaling_policy` using the fixed autoscaling decider, applying to the set of nodes having (only) the `data_hot` role.", "method_request": "PUT /_autoscaling/policy/my_autoscaling_policy", "summary": "Creates an autoscaling policy.", @@ -97090,6 +99223,28 @@ "description": "Get aliases.\n\nGet the cluster's index aliases, including filter and routing information.\nThis API does not return data stream aliases.\n\nIMPORTANT: CAT APIs are only intended for human consumption using the command line or the Kibana console. They are not intended for use by applications. For application consumption, use the aliases API.", "examples": { "CatAliasesRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cat.aliases(\n format=\"json\",\n v=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.aliases({\n format: \"json\",\n v: \"true\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.aliases(\n format: \"json\",\n v: \"true\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->aliases([\n \"format\" => \"json\",\n \"v\" => \"true\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/aliases?format=json&v=true\"", + "language": "curl" + } + ], "method_request": "GET _cat/aliases?format=json&v=true" } }, @@ -97559,6 +99714,28 @@ "description": "Get shard allocation information.\n\nGet a snapshot of the number of shards allocated to each data node and their disk space.\n\nIMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications.", "examples": { "CatAllocationRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cat.allocation(\n v=True,\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.allocation({\n v: \"true\",\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.allocation(\n v: \"true\",\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->allocation([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/allocation?v=true&format=json\"", + "language": "curl" + } + ], "method_request": "GET /_cat/allocation?v=true&format=json" } }, @@ -97791,6 +99968,28 @@ "description": "Get component templates.\n\nGet information about component templates in a cluster.\nComponent templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.\n\nIMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console.\nThey are not intended for use by applications. For application consumption, use the get component template API.", "examples": { "CatComponentTemplatesRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cat.component_templates(\n name=\"my-template-*\",\n v=True,\n s=\"name\",\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.componentTemplates({\n name: \"my-template-*\",\n v: \"true\",\n s: \"name\",\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.component_templates(\n name: \"my-template-*\",\n v: \"true\",\n s: \"name\",\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->componentTemplates([\n \"name\" => \"my-template-*\",\n \"v\" => \"true\",\n \"s\" => \"name\",\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/component_templates/my-template-*?v=true&s=name&format=json\"", + "language": "curl" + } + ], "method_request": "GET _cat/component_templates/my-template-*?v=true&s=name&format=json" } }, @@ -97990,6 +100189,28 @@ "description": "Get a document count.\n\nGet quick access to a document count for a data stream, an index, or an entire cluster.\nThe document count only includes live documents, not deleted documents which have not yet been removed by the merge process.\n\nIMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console.\nThey are not intended for use by applications. For application consumption, use the count API.", "examples": { "CatCountRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cat.count(\n index=\"my-index-000001\",\n v=True,\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.count({\n index: \"my-index-000001\",\n v: \"true\",\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.count(\n index: \"my-index-000001\",\n v: \"true\",\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->count([\n \"index\" => \"my-index-000001\",\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/count/my-index-000001?v=true&format=json\"", + "language": "curl" + } + ], "method_request": "GET /_cat/count/my-index-000001?v=true&format=json" } }, @@ -98182,6 +100403,28 @@ "description": "Get field data cache information.\n\nGet the amount of heap memory currently used by the field data cache on every data node in the cluster.\n\nIMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console.\nThey are not intended for use by applications. For application consumption, use the nodes stats API.", "examples": { "CatFielddataRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cat.fielddata(\n v=True,\n fields=\"body\",\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.fielddata({\n v: \"true\",\n fields: \"body\",\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.fielddata(\n v: \"true\",\n fields: \"body\",\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->fielddata([\n \"v\" => \"true\",\n \"fields\" => \"body\",\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/fielddata?v=true&fields=body&format=json\"", + "language": "curl" + } + ], "method_request": "GET /_cat/fielddata?v=true&fields=body&format=json" } }, @@ -98580,6 +100823,28 @@ "description": "Get the cluster health status.\n\nIMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console.\nThey are not intended for use by applications. For application consumption, use the cluster health API.\nThis API is often used to check malfunctioning clusters.\nTo help you track cluster health alongside log files and alerting systems, the API returns timestamps in two formats:\n`HH:MM:SS`, which is human-readable but includes no date information;\n`Unix epoch time`, which is machine-sortable and includes date information.\nThe latter format is useful for cluster recoveries that take multiple days.\nYou can use the cat health API to verify cluster health across multiple nodes.\nYou also can use the API to track the recovery of a large cluster over a longer period of time.", "examples": { "CatHealthRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cat.health(\n v=True,\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.health({\n v: \"true\",\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.health(\n v: \"true\",\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->health([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/health?v=true&format=json\"", + "language": "curl" + } + ], "method_request": "GET /_cat/health?v=true&format=json" } }, @@ -100795,6 +103060,28 @@ "description": "Get index information.\n\nGet high-level information about indices in a cluster, including backing indices for data streams.\n\nUse this request to get the following information for each index in a cluster:\n- shard count\n- document count\n- deleted document count\n- primary store size\n- total store size of all shards, including shard replicas\n\nThese metrics are retrieved directly from Lucene, which Elasticsearch uses internally to power indexing and search. As a result, all document counts include hidden nested documents.\nTo get an accurate count of Elasticsearch documents, use the cat count or count APIs.\n\nCAT APIs are only intended for human consumption using the command line or Kibana console.\nThey are not intended for use by applications. For application consumption, use an index endpoint.", "examples": { "CatIndicesRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cat.indices(\n index=\"my-index-*\",\n v=True,\n s=\"index\",\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.indices({\n index: \"my-index-*\",\n v: \"true\",\n s: \"index\",\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.indices(\n index: \"my-index-*\",\n v: \"true\",\n s: \"index\",\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->indices([\n \"index\" => \"my-index-*\",\n \"v\" => \"true\",\n \"s\" => \"index\",\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/indices/my-index-*?v=true&s=index&format=json\"", + "language": "curl" + } + ], "method_request": "GET /_cat/indices/my-index-*?v=true&s=index&format=json" } }, @@ -101041,6 +103328,28 @@ "description": "Get master node information.\n\nGet information about the master node, including the ID, bound IP address, and name.\n\nIMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API.", "examples": { "CatMasterRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cat.master(\n v=True,\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.master({\n v: \"true\",\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.master(\n v: \"true\",\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->master([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/master?v=true&format=json\"", + "language": "curl" + } + ], "method_request": "GET /_cat/master?v=true&format=json" } }, @@ -101406,6 +103715,28 @@ "description": "Get data frame analytics jobs.\n\nGet configuration and usage information about data frame analytics jobs.\n\nIMPORTANT: CAT APIs are only intended for human consumption using the Kibana\nconsole or command line. They are not intended for use by applications. For\napplication consumption, use the get data frame analytics jobs statistics API.", "examples": { "CatDataframeanalyticsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cat.ml_data_frame_analytics(\n v=True,\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.mlDataFrameAnalytics({\n v: \"true\",\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.ml_data_frame_analytics(\n v: \"true\",\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->mlDataFrameAnalytics([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/ml/data_frame/analytics?v=true&format=json\"", + "language": "curl" + } + ], "method_request": "GET _cat/ml/data_frame/analytics?v=true&format=json" } }, @@ -101734,6 +104065,28 @@ "description": "Get datafeeds.\n\nGet configuration and usage information about datafeeds.\nThis API returns a maximum of 10,000 datafeeds.\nIf the Elasticsearch security features are enabled, you must have `monitor_ml`, `monitor`, `manage_ml`, or `manage`\ncluster privileges to use this API.\n\nIMPORTANT: CAT APIs are only intended for human consumption using the Kibana\nconsole or command line. They are not intended for use by applications. For\napplication consumption, use the get datafeed statistics API.", "examples": { "CatDatafeedsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cat.ml_datafeeds(\n v=True,\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.mlDatafeeds({\n v: \"true\",\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.ml_datafeeds(\n v: \"true\",\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->mlDatafeeds([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/ml/datafeeds?v=true&format=json\"", + "language": "curl" + } + ], "method_request": "GET _cat/ml/datafeeds?v=true&format=json" } }, @@ -102817,6 +105170,28 @@ "description": "Get anomaly detection jobs.\n\nGet configuration and usage information for anomaly detection jobs.\nThis API returns a maximum of 10,000 jobs.\nIf the Elasticsearch security features are enabled, you must have `monitor_ml`,\n`monitor`, `manage_ml`, or `manage` cluster privileges to use this API.\n\nIMPORTANT: CAT APIs are only intended for human consumption using the Kibana\nconsole or command line. They are not intended for use by applications. For\napplication consumption, use the get anomaly detection job statistics API.", "examples": { "CatJobsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cat.ml_jobs(\n h=\"id,s,dpr,mb\",\n v=True,\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.mlJobs({\n h: \"id,s,dpr,mb\",\n v: \"true\",\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.ml_jobs(\n h: \"id,s,dpr,mb\",\n v: \"true\",\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->mlJobs([\n \"h\" => \"id,s,dpr,mb\",\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/ml/anomaly_detectors?h=id,s,dpr,mb&v=true&format=json\"", + "language": "curl" + } + ], "method_request": "GET _cat/ml/anomaly_detectors?h=id,s,dpr,mb&v=true&format=json" } }, @@ -102950,6 +105325,28 @@ "description": "Get trained models.\n\nGet configuration and usage information about inference trained models.\n\nIMPORTANT: CAT APIs are only intended for human consumption using the Kibana\nconsole or command line. They are not intended for use by applications. For\napplication consumption, use the get trained models statistics API.", "examples": { "CatTrainedModelsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cat.ml_trained_models(\n v=True,\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.mlTrainedModels({\n v: \"true\",\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.ml_trained_models(\n v: \"true\",\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->mlTrainedModels([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/ml/trained_models?v=true&format=json\"", + "language": "curl" + } + ], "method_request": "GET _cat/ml/trained_models?v=true&format=json" } }, @@ -103509,6 +105906,28 @@ "description": "Get node attribute information.\n\nGet information about custom node attributes.\nIMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API.", "examples": { "CatNodeAttributesRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cat.nodeattrs(\n v=True,\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.nodeattrs({\n v: \"true\",\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.nodeattrs(\n v: \"true\",\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->nodeattrs([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/nodeattrs?v=true&format=json\"", + "language": "curl" + } + ], "method_request": "GET /_cat/nodeattrs?v=true&format=json" } }, @@ -105138,6 +107557,28 @@ "description": "Get node information.\n\nGet information about the nodes in a cluster.\nIMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API.", "examples": { "CatNodesRequestExample2": { + "alternatives": [ + { + "code": "resp = client.cat.nodes(\n v=True,\n h=\"id,ip,port,v,m\",\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.nodes({\n v: \"true\",\n h: \"id,ip,port,v,m\",\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.nodes(\n v: \"true\",\n h: \"id,ip,port,v,m\",\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->nodes([\n \"v\" => \"true\",\n \"h\" => \"id,ip,port,v,m\",\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/nodes?v=true&h=id,ip,port,v,m&format=json\"", + "language": "curl" + } + ], "method_request": "GET /_cat/nodes?v=true&h=id,ip,port,v,m&format=json" } }, @@ -105372,6 +107813,28 @@ "description": "Get pending task information.\n\nGet information about cluster-level changes that have not yet taken effect.\nIMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the pending cluster tasks API.", "examples": { "CatPendingTasksRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cat.pending_tasks(\n v=\"trueh=insertOrder,timeInQueue,priority,source\",\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.pendingTasks({\n v: \"trueh=insertOrder,timeInQueue,priority,source\",\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.pending_tasks(\n v: \"trueh=insertOrder,timeInQueue,priority,source\",\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->pendingTasks([\n \"v\" => \"trueh=insertOrder,timeInQueue,priority,source\",\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/pending_tasks?v=trueh=insertOrder,timeInQueue,priority,source&format=json\"", + "language": "curl" + } + ], "method_request": "GET /_cat/pending_tasks?v=trueh=insertOrder,timeInQueue,priority,source&format=json" } }, @@ -105589,6 +108052,28 @@ "description": "Get plugin information.\n\nGet a list of plugins running on each node of a cluster.\nIMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API.", "examples": { "CatPluginsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cat.plugins(\n v=True,\n s=\"component\",\n h=\"name,component,version,description\",\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.plugins({\n v: \"true\",\n s: \"component\",\n h: \"name,component,version,description\",\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.plugins(\n v: \"true\",\n s: \"component\",\n h: \"name,component,version,description\",\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->plugins([\n \"v\" => \"true\",\n \"s\" => \"component\",\n \"h\" => \"name,component,version,description\",\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/plugins?v=true&s=component&h=name,component,version,description&format=json\"", + "language": "curl" + } + ], "method_request": "GET /_cat/plugins?v=true&s=component&h=name,component,version,description&format=json" } }, @@ -106131,6 +108616,28 @@ "description": "Get shard recovery information.\n\nGet information about ongoing and completed shard recoveries.\nShard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or syncing a replica shard from a primary shard. When a shard recovery completes, the recovered shard is available for search and indexing.\nFor data streams, the API returns information about the stream’s backing indices.\nIMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the index recovery API.", "examples": { "CatRecoveryRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cat.recovery(\n v=True,\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.recovery({\n v: \"true\",\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.recovery(\n v: \"true\",\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->recovery([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/recovery?v=true&format=json\"", + "language": "curl" + } + ], "method_request": "GET _cat/recovery?v=true&format=json" } }, @@ -106339,6 +108846,28 @@ "description": "Get snapshot repository information.\n\nGet a list of snapshot repositories for a cluster.\nIMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get snapshot repository API.", "examples": { "CatRepositoriesRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cat.repositories(\n v=True,\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.repositories({\n v: \"true\",\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.repositories(\n v: \"true\",\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->repositories([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/repositories?v=true&format=json\"", + "language": "curl" + } + ], "method_request": "GET /_cat/repositories?v=true&format=json" } }, @@ -106447,6 +108976,28 @@ "description": "Get segment information.\n\nGet low-level information about the Lucene segments in index shards.\nFor data streams, the API returns information about the backing indices.\nIMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the index segments API.", "examples": { "CatSegmentsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cat.segments(\n v=True,\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.segments({\n v: \"true\",\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.segments(\n v: \"true\",\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->segments([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/segments?v=true&format=json\"", + "language": "curl" + } + ], "method_request": "GET /_cat/segments?v=true&format=json" } }, @@ -106820,6 +109371,28 @@ "description": "Get shard information.\n\nGet information about the shards in a cluster.\nFor data streams, the API returns information about the backing indices.\nIMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications.", "examples": { "CatShardsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cat.shards(\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.shards({\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.shards(\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->shards([\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/shards?format=json\"", + "language": "curl" + } + ], "method_request": "GET _cat/shards?format=json" } }, @@ -108254,6 +110827,28 @@ "description": "Get snapshot information.\n\nGet information about the snapshots stored in one or more repositories.\nA snapshot is a backup of an index or running Elasticsearch cluster.\nIMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get snapshot API.", "examples": { "CatSnapshotsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cat.snapshots(\n repository=\"repo1\",\n v=True,\n s=\"id\",\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.snapshots({\n repository: \"repo1\",\n v: \"true\",\n s: \"id\",\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.snapshots(\n repository: \"repo1\",\n v: \"true\",\n s: \"id\",\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->snapshots([\n \"repository\" => \"repo1\",\n \"v\" => \"true\",\n \"s\" => \"id\",\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/snapshots/repo1?v=true&s=id&format=json\"", + "language": "curl" + } + ], "method_request": "GET /_cat/snapshots/repo1?v=true&s=id&format=json" } }, @@ -108633,6 +111228,28 @@ "description": "Get task information.\n\nGet information about tasks currently running in the cluster.\nIMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the task management API.", "examples": { "CatTasksRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cat.tasks(\n v=True,\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.tasks({\n v: \"true\",\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.tasks(\n v: \"true\",\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->tasks([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/tasks?v=true&format=json\"", + "language": "curl" + } + ], "method_request": "GET _cat/tasks?v=true&format=json" } }, @@ -109054,6 +111671,28 @@ "description": "Get index template information.\n\nGet information about the index templates in a cluster.\nYou can use index templates to apply index settings and field mappings to new indices at creation.\nIMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get index template API.", "examples": { "CatTemplatesRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cat.templates(\n name=\"my-template-*\",\n v=True,\n s=\"name\",\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.templates({\n name: \"my-template-*\",\n v: \"true\",\n s: \"name\",\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.templates(\n name: \"my-template-*\",\n v: \"true\",\n s: \"name\",\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->templates([\n \"name\" => \"my-template-*\",\n \"v\" => \"true\",\n \"s\" => \"name\",\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/templates/my-template-*?v=true&s=name&format=json\"", + "language": "curl" + } + ], "method_request": "GET _cat/templates/my-template-*?v=true&s=name&format=json" } }, @@ -109273,6 +111912,28 @@ "description": "Get thread pool statistics.\n\nGet thread pool statistics for each node in a cluster.\nReturned information includes all built-in thread pools and custom thread pools.\nIMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API.", "examples": { "CatThreadPoolRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cat.thread_pool(\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.threadPool({\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.thread_pool(\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->threadPool([\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/thread_pool?format=json\"", + "language": "curl" + } + ], "method_request": "GET /_cat/thread_pool?format=json" } }, @@ -109770,6 +112431,28 @@ "description": "Get transform information.\n\nGet configuration and usage information about transforms.\n\nCAT APIs are only intended for human consumption using the Kibana\nconsole or command line. They are not intended for use by applications. For\napplication consumption, use the get transform statistics API.", "examples": { "CatTransformsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cat.transforms(\n v=True,\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cat.transforms({\n v: \"true\",\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cat.transforms(\n v: \"true\",\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cat()->transforms([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/transforms?v=true&format=json\"", + "language": "curl" + } + ], "method_request": "GET /_cat/transforms?v=true&format=json" } }, @@ -110984,6 +113667,28 @@ "description": "Delete auto-follow patterns.\n\nDelete a collection of cross-cluster replication auto-follow patterns.", "examples": { "DeleteAutoFollowPatternRequestExample1": { + "alternatives": [ + { + "code": "resp = client.ccr.delete_auto_follow_pattern(\n name=\"my_auto_follow_pattern\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ccr.deleteAutoFollowPattern({\n name: \"my_auto_follow_pattern\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ccr.delete_auto_follow_pattern(\n name: \"my_auto_follow_pattern\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ccr()->deleteAutoFollowPattern([\n \"name\" => \"my_auto_follow_pattern\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ccr/auto_follow/my_auto_follow_pattern\"", + "language": "curl" + } + ], "method_request": "DELETE /_ccr/auto_follow/my_auto_follow_pattern" } }, @@ -111234,6 +113939,28 @@ "description": "Create a follower.\nCreate a cross-cluster replication follower index that follows a specific leader index.\nWhen the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index.", "examples": { "CreateFollowIndexRequestExample1": { + "alternatives": [ + { + "code": "resp = client.ccr.follow(\n index=\"follower_index\",\n wait_for_active_shards=\"1\",\n remote_cluster=\"remote_cluster\",\n leader_index=\"leader_index\",\n settings={\n \"index.number_of_replicas\": 0\n },\n max_read_request_operation_count=1024,\n max_outstanding_read_requests=16,\n max_read_request_size=\"1024k\",\n max_write_request_operation_count=32768,\n max_write_request_size=\"16k\",\n max_outstanding_write_requests=8,\n max_write_buffer_count=512,\n max_write_buffer_size=\"512k\",\n max_retry_delay=\"10s\",\n read_poll_timeout=\"30s\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ccr.follow({\n index: \"follower_index\",\n wait_for_active_shards: 1,\n remote_cluster: \"remote_cluster\",\n leader_index: \"leader_index\",\n settings: {\n \"index.number_of_replicas\": 0,\n },\n max_read_request_operation_count: 1024,\n max_outstanding_read_requests: 16,\n max_read_request_size: \"1024k\",\n max_write_request_operation_count: 32768,\n max_write_request_size: \"16k\",\n max_outstanding_write_requests: 8,\n max_write_buffer_count: 512,\n max_write_buffer_size: \"512k\",\n max_retry_delay: \"10s\",\n read_poll_timeout: \"30s\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ccr.follow(\n index: \"follower_index\",\n wait_for_active_shards: \"1\",\n body: {\n \"remote_cluster\": \"remote_cluster\",\n \"leader_index\": \"leader_index\",\n \"settings\": {\n \"index.number_of_replicas\": 0\n },\n \"max_read_request_operation_count\": 1024,\n \"max_outstanding_read_requests\": 16,\n \"max_read_request_size\": \"1024k\",\n \"max_write_request_operation_count\": 32768,\n \"max_write_request_size\": \"16k\",\n \"max_outstanding_write_requests\": 8,\n \"max_write_buffer_count\": 512,\n \"max_write_buffer_size\": \"512k\",\n \"max_retry_delay\": \"10s\",\n \"read_poll_timeout\": \"30s\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ccr()->follow([\n \"index\" => \"follower_index\",\n \"wait_for_active_shards\" => \"1\",\n \"body\" => [\n \"remote_cluster\" => \"remote_cluster\",\n \"leader_index\" => \"leader_index\",\n \"settings\" => [\n \"index.number_of_replicas\" => 0,\n ],\n \"max_read_request_operation_count\" => 1024,\n \"max_outstanding_read_requests\" => 16,\n \"max_read_request_size\" => \"1024k\",\n \"max_write_request_operation_count\" => 32768,\n \"max_write_request_size\" => \"16k\",\n \"max_outstanding_write_requests\" => 8,\n \"max_write_buffer_count\" => 512,\n \"max_write_buffer_size\" => \"512k\",\n \"max_retry_delay\" => \"10s\",\n \"read_poll_timeout\" => \"30s\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"remote_cluster\":\"remote_cluster\",\"leader_index\":\"leader_index\",\"settings\":{\"index.number_of_replicas\":0},\"max_read_request_operation_count\":1024,\"max_outstanding_read_requests\":16,\"max_read_request_size\":\"1024k\",\"max_write_request_operation_count\":32768,\"max_write_request_size\":\"16k\",\"max_outstanding_write_requests\":8,\"max_write_buffer_count\":512,\"max_write_buffer_size\":\"512k\",\"max_retry_delay\":\"10s\",\"read_poll_timeout\":\"30s\"}' \"$ELASTICSEARCH_URL/follower_index/_ccr/follow?wait_for_active_shards=1\"", + "language": "curl" + } + ], "description": "Run `PUT /follower_index/_ccr/follow?wait_for_active_shards=1` to create a follower index named `follower_index`.", "method_request": "PUT /follower_index/_ccr/follow?wait_for_active_shards=1", "value": "{\n \"remote_cluster\" : \"remote_cluster\",\n \"leader_index\" : \"leader_index\",\n \"settings\": {\n \"index.number_of_replicas\": 0\n },\n \"max_read_request_operation_count\" : 1024,\n \"max_outstanding_read_requests\" : 16,\n \"max_read_request_size\" : \"1024k\",\n \"max_write_request_operation_count\" : 32768,\n \"max_write_request_size\" : \"16k\",\n \"max_outstanding_write_requests\" : 8,\n \"max_write_buffer_count\" : 512,\n \"max_write_buffer_size\" : \"512k\",\n \"max_retry_delay\" : \"10s\",\n \"read_poll_timeout\" : \"30s\"\n}" @@ -111571,6 +114298,28 @@ "description": "Get follower information.\n\nGet information about all cross-cluster replication follower indices.\nFor example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused.", "examples": { "FollowInfoRequestExample1": { + "alternatives": [ + { + "code": "resp = client.ccr.follow_info(\n index=\"follower_index\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ccr.followInfo({\n index: \"follower_index\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ccr.follow_info(\n index: \"follower_index\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ccr()->followInfo([\n \"index\" => \"follower_index\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/follower_index/_ccr/info\"", + "language": "curl" + } + ], "method_request": "GET /follower_index/_ccr/info" } }, @@ -111665,6 +114414,28 @@ "description": "Get follower stats.\n\nGet cross-cluster replication follower stats.\nThe API returns shard-level stats about the \"following tasks\" associated with each shard for the specified indices.", "examples": { "FollowIndexStatsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.ccr.follow_stats(\n index=\"follower_index\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ccr.followStats({\n index: \"follower_index\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ccr.follow_stats(\n index: \"follower_index\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ccr()->followStats([\n \"index\" => \"follower_index\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/follower_index/_ccr/stats\"", + "language": "curl" + } + ], "method_request": "GET /follower_index/_ccr/stats" } }, @@ -111800,6 +114571,28 @@ "description": "Forget a follower.\nRemove the cross-cluster replication follower retention leases from the leader.\n\nA following index takes out retention leases on its leader index.\nThese leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication.\nWhen a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed.\nHowever, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable.\nWhile the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index.\nThis API exists to enable manually removing the leases when the unfollow API is unable to do so.\n\nNOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader.\nThe only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked.", "examples": { "ForgetFollowerIndexRequestExample1": { + "alternatives": [ + { + "code": "resp = client.ccr.forget_follower(\n index=\"\",\n follower_cluster=\"\",\n follower_index=\"\",\n follower_index_uuid=\"\",\n leader_remote_cluster=\"\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ccr.forgetFollower({\n index: \"\",\n follower_cluster: \"\",\n follower_index: \"\",\n follower_index_uuid: \"\",\n leader_remote_cluster: \"\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ccr.forget_follower(\n index: \"\",\n body: {\n \"follower_cluster\": \"\",\n \"follower_index\": \"\",\n \"follower_index_uuid\": \"\",\n \"leader_remote_cluster\": \"\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ccr()->forgetFollower([\n \"index\" => \"\",\n \"body\" => [\n \"follower_cluster\" => \"\",\n \"follower_index\" => \"\",\n \"follower_index_uuid\" => \"\",\n \"leader_remote_cluster\" => \"\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"follower_cluster\":\"\",\"follower_index\":\"\",\"follower_index_uuid\":\"\",\"leader_remote_cluster\":\"\"}' \"$ELASTICSEARCH_URL//_ccr/forget_follower\"", + "language": "curl" + } + ], "description": "Run `POST //_ccr/forget_follower`.", "method_request": "POST //_ccr/forget_follower", "value": "{\n \"follower_cluster\" : \"\",\n \"follower_index\" : \"\",\n \"follower_index_uuid\" : \"\",\n \"leader_remote_cluster\" : \"\"\n}" @@ -112006,6 +114799,28 @@ "description": "Get auto-follow patterns.\n\nGet cross-cluster replication auto-follow patterns.", "examples": { "GetAutoFollowPatternRequestExample1": { + "alternatives": [ + { + "code": "resp = client.ccr.get_auto_follow_pattern(\n name=\"my_auto_follow_pattern\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ccr.getAutoFollowPattern({\n name: \"my_auto_follow_pattern\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ccr.get_auto_follow_pattern(\n name: \"my_auto_follow_pattern\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ccr()->getAutoFollowPattern([\n \"name\" => \"my_auto_follow_pattern\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ccr/auto_follow/my_auto_follow_pattern\"", + "language": "curl" + } + ], "method_request": "GET /_ccr/auto_follow/my_auto_follow_pattern" } }, @@ -112094,6 +114909,28 @@ "description": "Pause an auto-follow pattern.\n\nPause a cross-cluster replication auto-follow pattern.\nWhen the API returns, the auto-follow pattern is inactive.\nNew indices that are created on the remote cluster and match the auto-follow patterns are ignored.\n\nYou can resume auto-following with the resume auto-follow pattern API.\nWhen it resumes, the auto-follow pattern is active again and automatically configures follower indices for newly created indices on the remote cluster that match its patterns.\nRemote indices that were created while the pattern was paused will also be followed, unless they have been deleted or closed in the interim.", "examples": { "PauseAutoFollowPatternRequestExample1": { + "alternatives": [ + { + "code": "resp = client.ccr.pause_auto_follow_pattern(\n name=\"my_auto_follow_pattern\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ccr.pauseAutoFollowPattern({\n name: \"my_auto_follow_pattern\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ccr.pause_auto_follow_pattern(\n name: \"my_auto_follow_pattern\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ccr()->pauseAutoFollowPattern([\n \"name\" => \"my_auto_follow_pattern\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ccr/auto_follow/my_auto_follow_pattern/pause\"", + "language": "curl" + } + ], "method_request": "POST /_ccr/auto_follow/my_auto_follow_pattern/pause" } }, @@ -112174,6 +115011,28 @@ "description": "Pause a follower.\n\nPause a cross-cluster replication follower index.\nThe follower index will not fetch any additional operations from the leader index.\nYou can resume following with the resume follower API.\nYou can pause and resume a follower index to change the configuration of the following task.", "examples": { "PauseFollowIndexRequestExample1": { + "alternatives": [ + { + "code": "resp = client.ccr.pause_follow(\n index=\"follower_index\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ccr.pauseFollow({\n index: \"follower_index\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ccr.pause_follow(\n index: \"follower_index\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ccr()->pauseFollow([\n \"index\" => \"follower_index\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/follower_index/_ccr/pause_follow\"", + "language": "curl" + } + ], "method_request": "POST /follower_index/_ccr/pause_follow" } }, @@ -112455,6 +115314,28 @@ "description": "Create or update auto-follow patterns.\nCreate a collection of cross-cluster replication auto-follow patterns for a remote cluster.\nNewly created indices on the remote cluster that match any of the patterns are automatically configured as follower indices.\nIndices on the remote cluster that were created before the auto-follow pattern was created will not be auto-followed even if they match the pattern.\n\nThis API can also be used to update auto-follow patterns.\nNOTE: Follower indices that were configured automatically before updating an auto-follow pattern will remain unchanged even if they do not match against the new patterns.", "examples": { "PutAutoFollowPatternRequestExample1": { + "alternatives": [ + { + "code": "resp = client.ccr.put_auto_follow_pattern(\n name=\"my_auto_follow_pattern\",\n remote_cluster=\"remote_cluster\",\n leader_index_patterns=[\n \"leader_index*\"\n ],\n follow_index_pattern=\"{{leader_index}}-follower\",\n settings={\n \"index.number_of_replicas\": 0\n },\n max_read_request_operation_count=1024,\n max_outstanding_read_requests=16,\n max_read_request_size=\"1024k\",\n max_write_request_operation_count=32768,\n max_write_request_size=\"16k\",\n max_outstanding_write_requests=8,\n max_write_buffer_count=512,\n max_write_buffer_size=\"512k\",\n max_retry_delay=\"10s\",\n read_poll_timeout=\"30s\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ccr.putAutoFollowPattern({\n name: \"my_auto_follow_pattern\",\n remote_cluster: \"remote_cluster\",\n leader_index_patterns: [\"leader_index*\"],\n follow_index_pattern: \"{{leader_index}}-follower\",\n settings: {\n \"index.number_of_replicas\": 0,\n },\n max_read_request_operation_count: 1024,\n max_outstanding_read_requests: 16,\n max_read_request_size: \"1024k\",\n max_write_request_operation_count: 32768,\n max_write_request_size: \"16k\",\n max_outstanding_write_requests: 8,\n max_write_buffer_count: 512,\n max_write_buffer_size: \"512k\",\n max_retry_delay: \"10s\",\n read_poll_timeout: \"30s\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ccr.put_auto_follow_pattern(\n name: \"my_auto_follow_pattern\",\n body: {\n \"remote_cluster\": \"remote_cluster\",\n \"leader_index_patterns\": [\n \"leader_index*\"\n ],\n \"follow_index_pattern\": \"{{leader_index}}-follower\",\n \"settings\": {\n \"index.number_of_replicas\": 0\n },\n \"max_read_request_operation_count\": 1024,\n \"max_outstanding_read_requests\": 16,\n \"max_read_request_size\": \"1024k\",\n \"max_write_request_operation_count\": 32768,\n \"max_write_request_size\": \"16k\",\n \"max_outstanding_write_requests\": 8,\n \"max_write_buffer_count\": 512,\n \"max_write_buffer_size\": \"512k\",\n \"max_retry_delay\": \"10s\",\n \"read_poll_timeout\": \"30s\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ccr()->putAutoFollowPattern([\n \"name\" => \"my_auto_follow_pattern\",\n \"body\" => [\n \"remote_cluster\" => \"remote_cluster\",\n \"leader_index_patterns\" => array(\n \"leader_index*\",\n ),\n \"follow_index_pattern\" => \"{{leader_index}}-follower\",\n \"settings\" => [\n \"index.number_of_replicas\" => 0,\n ],\n \"max_read_request_operation_count\" => 1024,\n \"max_outstanding_read_requests\" => 16,\n \"max_read_request_size\" => \"1024k\",\n \"max_write_request_operation_count\" => 32768,\n \"max_write_request_size\" => \"16k\",\n \"max_outstanding_write_requests\" => 8,\n \"max_write_buffer_count\" => 512,\n \"max_write_buffer_size\" => \"512k\",\n \"max_retry_delay\" => \"10s\",\n \"read_poll_timeout\" => \"30s\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"remote_cluster\":\"remote_cluster\",\"leader_index_patterns\":[\"leader_index*\"],\"follow_index_pattern\":\"{{leader_index}}-follower\",\"settings\":{\"index.number_of_replicas\":0},\"max_read_request_operation_count\":1024,\"max_outstanding_read_requests\":16,\"max_read_request_size\":\"1024k\",\"max_write_request_operation_count\":32768,\"max_write_request_size\":\"16k\",\"max_outstanding_write_requests\":8,\"max_write_buffer_count\":512,\"max_write_buffer_size\":\"512k\",\"max_retry_delay\":\"10s\",\"read_poll_timeout\":\"30s\"}' \"$ELASTICSEARCH_URL/_ccr/auto_follow/my_auto_follow_pattern\"", + "language": "curl" + } + ], "description": "Run `PUT /_ccr/auto_follow/my_auto_follow_pattern` to creates an auto-follow pattern.\n", "method_request": "PUT /_ccr/auto_follow/my_auto_follow_pattern", "value": "{\n \"remote_cluster\" : \"remote_cluster\",\n \"leader_index_patterns\" :\n [\n \"leader_index*\"\n ],\n \"follow_index_pattern\" : \"{{leader_index}}-follower\",\n \"settings\": {\n \"index.number_of_replicas\": 0\n },\n \"max_read_request_operation_count\" : 1024,\n \"max_outstanding_read_requests\" : 16,\n \"max_read_request_size\" : \"1024k\",\n \"max_write_request_operation_count\" : 32768,\n \"max_write_request_size\" : \"16k\",\n \"max_outstanding_write_requests\" : 8,\n \"max_write_buffer_count\" : 512,\n \"max_write_buffer_size\" : \"512k\",\n \"max_retry_delay\" : \"10s\",\n \"read_poll_timeout\" : \"30s\"\n}" @@ -112537,6 +115418,28 @@ "description": "Resume an auto-follow pattern.\n\nResume a cross-cluster replication auto-follow pattern that was paused.\nThe auto-follow pattern will resume configuring following indices for newly created indices that match its patterns on the remote cluster.\nRemote indices created while the pattern was paused will also be followed unless they have been deleted or closed in the interim.", "examples": { "ResumeAutoFollowPatternRequestExample1": { + "alternatives": [ + { + "code": "resp = client.ccr.resume_auto_follow_pattern(\n name=\"my_auto_follow_pattern\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ccr.resumeAutoFollowPattern({\n name: \"my_auto_follow_pattern\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ccr.resume_auto_follow_pattern(\n name: \"my_auto_follow_pattern\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ccr()->resumeAutoFollowPattern([\n \"name\" => \"my_auto_follow_pattern\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ccr/auto_follow/my_auto_follow_pattern/resume\"", + "language": "curl" + } + ], "method_request": "POST /_ccr/auto_follow/my_auto_follow_pattern/resume" } }, @@ -112729,6 +115632,28 @@ "description": "Resume a follower.\nResume a cross-cluster replication follower index that was paused.\nThe follower index could have been paused with the pause follower API.\nAlternatively it could be paused due to replication that cannot be retried due to failures during following tasks.\nWhen this API returns, the follower index will resume fetching operations from the leader index.", "examples": { "ResumeFollowIndexRequestExample1": { + "alternatives": [ + { + "code": "resp = client.ccr.resume_follow(\n index=\"follower_index\",\n max_read_request_operation_count=1024,\n max_outstanding_read_requests=16,\n max_read_request_size=\"1024k\",\n max_write_request_operation_count=32768,\n max_write_request_size=\"16k\",\n max_outstanding_write_requests=8,\n max_write_buffer_count=512,\n max_write_buffer_size=\"512k\",\n max_retry_delay=\"10s\",\n read_poll_timeout=\"30s\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ccr.resumeFollow({\n index: \"follower_index\",\n max_read_request_operation_count: 1024,\n max_outstanding_read_requests: 16,\n max_read_request_size: \"1024k\",\n max_write_request_operation_count: 32768,\n max_write_request_size: \"16k\",\n max_outstanding_write_requests: 8,\n max_write_buffer_count: 512,\n max_write_buffer_size: \"512k\",\n max_retry_delay: \"10s\",\n read_poll_timeout: \"30s\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ccr.resume_follow(\n index: \"follower_index\",\n body: {\n \"max_read_request_operation_count\": 1024,\n \"max_outstanding_read_requests\": 16,\n \"max_read_request_size\": \"1024k\",\n \"max_write_request_operation_count\": 32768,\n \"max_write_request_size\": \"16k\",\n \"max_outstanding_write_requests\": 8,\n \"max_write_buffer_count\": 512,\n \"max_write_buffer_size\": \"512k\",\n \"max_retry_delay\": \"10s\",\n \"read_poll_timeout\": \"30s\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ccr()->resumeFollow([\n \"index\" => \"follower_index\",\n \"body\" => [\n \"max_read_request_operation_count\" => 1024,\n \"max_outstanding_read_requests\" => 16,\n \"max_read_request_size\" => \"1024k\",\n \"max_write_request_operation_count\" => 32768,\n \"max_write_request_size\" => \"16k\",\n \"max_outstanding_write_requests\" => 8,\n \"max_write_buffer_count\" => 512,\n \"max_write_buffer_size\" => \"512k\",\n \"max_retry_delay\" => \"10s\",\n \"read_poll_timeout\" => \"30s\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"max_read_request_operation_count\":1024,\"max_outstanding_read_requests\":16,\"max_read_request_size\":\"1024k\",\"max_write_request_operation_count\":32768,\"max_write_request_size\":\"16k\",\"max_outstanding_write_requests\":8,\"max_write_buffer_count\":512,\"max_write_buffer_size\":\"512k\",\"max_retry_delay\":\"10s\",\"read_poll_timeout\":\"30s\"}' \"$ELASTICSEARCH_URL/follower_index/_ccr/resume_follow\"", + "language": "curl" + } + ], "description": "Run `POST /follower_index/_ccr/resume_follow` to resume the follower index.", "method_request": "POST /follower_index/_ccr/resume_follow", "value": "{\n \"max_read_request_operation_count\" : 1024,\n \"max_outstanding_read_requests\" : 16,\n \"max_read_request_size\" : \"1024k\",\n \"max_write_request_operation_count\" : 32768,\n \"max_write_request_size\" : \"16k\",\n \"max_outstanding_write_requests\" : 8,\n \"max_write_buffer_count\" : 512,\n \"max_write_buffer_size\" : \"512k\",\n \"max_retry_delay\" : \"10s\",\n \"read_poll_timeout\" : \"30s\"\n}" @@ -112962,6 +115887,28 @@ "description": "Get cross-cluster replication stats.\n\nThis API returns stats about auto-following and the same shard-level stats as the get follower stats API.", "examples": { "CcrStatsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.ccr.stats()", + "language": "Python" + }, + { + "code": "const response = await client.ccr.stats();", + "language": "JavaScript" + }, + { + "code": "response = client.ccr.stats", + "language": "Ruby" + }, + { + "code": "$resp = $client->ccr()->stats();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ccr/stats\"", + "language": "curl" + } + ], "method_request": "GET /_ccr/stats" } }, @@ -113060,6 +116007,28 @@ "description": "Unfollow an index.\n\nConvert a cross-cluster replication follower index to a regular index.\nThe API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication.\nThe follower index must be paused and closed before you call the unfollow API.\n\n> info\n> Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation.", "examples": { "UnfollowIndexRequestExample1": { + "alternatives": [ + { + "code": "resp = client.ccr.unfollow(\n index=\"follower_index\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ccr.unfollow({\n index: \"follower_index\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ccr.unfollow(\n index: \"follower_index\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ccr()->unfollow([\n \"index\" => \"follower_index\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/follower_index/_ccr/unfollow\"", + "language": "curl" + } + ], "method_request": "POST /follower_index/_ccr/unfollow" } }, @@ -114017,6 +116986,28 @@ "description": "Explain the shard allocations.\nGet explanations for shard allocations in the cluster.\nFor unassigned shards, it provides an explanation for why the shard is unassigned.\nFor assigned shards, it provides an explanation for why the shard is remaining on its current node and has not moved or rebalanced to another node.\nThis API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise.\nRefer to the linked documentation for examples of how to troubleshoot allocation issues using this API.", "examples": { "ClusterAllocationExplainRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cluster.allocation_explain(\n index=\"my-index-000001\",\n shard=0,\n primary=False,\n current_node=\"my-node\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cluster.allocationExplain({\n index: \"my-index-000001\",\n shard: 0,\n primary: false,\n current_node: \"my-node\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cluster.allocation_explain(\n body: {\n \"index\": \"my-index-000001\",\n \"shard\": 0,\n \"primary\": false,\n \"current_node\": \"my-node\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cluster()->allocationExplain([\n \"body\" => [\n \"index\" => \"my-index-000001\",\n \"shard\" => 0,\n \"primary\" => false,\n \"current_node\" => \"my-node\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index\":\"my-index-000001\",\"shard\":0,\"primary\":false,\"current_node\":\"my-node\"}' \"$ELASTICSEARCH_URL/_cluster/allocation/explain\"", + "language": "curl" + } + ], "description": "Run `GET _cluster/allocation/explain` to get an explanation for a shard's current allocation.", "method_request": "GET _cluster/allocation/explain", "value": "{\n \"index\": \"my-index-000001\",\n \"shard\": 0,\n \"primary\": false,\n \"current_node\": \"my-node\"\n}" @@ -114628,6 +117619,28 @@ "description": "Delete component templates.\nComponent templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.", "examples": { "ClusterDeleteComponentTemplateExample1": { + "alternatives": [ + { + "code": "resp = client.cluster.delete_component_template(\n name=\"template_1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cluster.deleteComponentTemplate({\n name: \"template_1\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cluster.delete_component_template(\n name: \"template_1\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cluster()->deleteComponentTemplate([\n \"name\" => \"template_1\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_component_template/template_1\"", + "language": "curl" + } + ], "method_request": "DELETE _component_template/template_1" } }, @@ -114850,6 +117863,28 @@ "description": "Get component templates.\nGet information about component templates.", "examples": { "ClusterGetComponentTemplateExample1": { + "alternatives": [ + { + "code": "resp = client.cluster.get_component_template(\n name=\"template_1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cluster.getComponentTemplate({\n name: \"template_1\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cluster.get_component_template(\n name: \"template_1\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cluster()->getComponentTemplate([\n \"name\" => \"template_1\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_component_template/template_1\"", + "language": "curl" + } + ], "method_request": "GET /_component_template/template_1" } }, @@ -114980,6 +118015,28 @@ "description": "Get cluster-wide settings.\nBy default, it returns only settings that have been explicitly defined.", "examples": { "ClusterGetSettingsExample1": { + "alternatives": [ + { + "code": "resp = client.cluster.get_settings(\n filter_path=\"persistent.cluster.remote\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cluster.getSettings({\n filter_path: \"persistent.cluster.remote\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cluster.get_settings(\n filter_path: \"persistent.cluster.remote\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cluster()->getSettings([\n \"filter_path\" => \"persistent.cluster.remote\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cluster/settings?filter_path=persistent.cluster.remote\"", + "language": "curl" + } + ], "method_request": "GET /_cluster/settings?filter_path=persistent.cluster.remote" } }, @@ -115518,6 +118575,28 @@ "description": "Get the cluster health status.\n\nYou can also use the API to get the health status of only specified data streams and indices.\nFor data streams, the API retrieves the health status of the stream’s backing indices.\n\nThe cluster health status is: green, yellow or red.\nOn the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated.\nThe index level status is controlled by the worst shard status.\n\nOne of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level.\nThe cluster status is controlled by the worst index status.", "examples": { "ClusterHealthRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cluster.health()", + "language": "Python" + }, + { + "code": "const response = await client.cluster.health();", + "language": "JavaScript" + }, + { + "code": "response = client.cluster.health", + "language": "Ruby" + }, + { + "code": "$resp = $client->cluster()->health();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cluster/health\"", + "language": "curl" + } + ], "method_request": "GET _cluster/health" } }, @@ -115855,6 +118934,28 @@ "description": "Get cluster info.\nReturns basic information about the cluster.", "examples": { "ClusterInfoExample1": { + "alternatives": [ + { + "code": "resp = client.cluster.info(\n target=\"_all\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cluster.info({\n target: \"_all\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cluster.info(\n target: \"_all\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cluster()->info([\n \"target\" => \"_all\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_info/_all\"", + "language": "curl" + } + ], "method_request": "GET /_info/_all" } }, @@ -116066,6 +119167,28 @@ "description": "Get the pending cluster tasks.\nGet information about cluster-level changes (such as create index, update mapping, allocate or fail shard) that have not yet taken effect.\n\nNOTE: This API returns a list of any pending updates to the cluster state.\nThese are distinct from the tasks reported by the task management API which include periodic tasks and tasks initiated by the user, such as node stats, search queries, or create index requests.\nHowever, if a user-initiated task such as a create index command causes a cluster state update, the activity of this task might be reported by both task api and pending cluster tasks API.", "examples": { "ClusterPendingTasksExample1": { + "alternatives": [ + { + "code": "resp = client.cluster.pending_tasks()", + "language": "Python" + }, + { + "code": "const response = await client.cluster.pendingTasks();", + "language": "JavaScript" + }, + { + "code": "response = client.cluster.pending_tasks", + "language": "Ruby" + }, + { + "code": "$resp = $client->cluster()->pendingTasks();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cluster/pending_tasks\"", + "language": "curl" + } + ], "method_request": "GET /_cluster/pending_tasks" } }, @@ -116283,11 +119406,55 @@ "description": "Create or update a component template.\nComponent templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.\n\nAn index template can be composed of multiple component templates.\nTo use a component template, specify it in an index template’s `composed_of` list.\nComponent templates are only applied to new data streams and indices as part of a matching index template.\n\nSettings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template.\n\nComponent templates are only used during index creation.\nFor data streams, this includes data stream creation and the creation of a stream’s backing indices.\nChanges to component templates do not affect existing indices, including a stream’s backing indices.\n\nYou can use C-style `/* *\\/` block comments in component templates.\nYou can include comments anywhere in the request body except before the opening curly bracket.\n\n**Applying component templates**\n\nYou cannot directly apply a component template to a data stream or index.\nTo be applied, a component template must be included in an index template's `composed_of` list.", "examples": { "ClusterPutComponentTemplateRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cluster.put_component_template(\n name=\"template_1\",\n template=None,\n settings={\n \"number_of_shards\": 1\n },\n mappings={\n \"_source\": {\n \"enabled\": False\n },\n \"properties\": {\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.cluster.putComponentTemplate({\n name: \"template_1\",\n template: null,\n settings: {\n number_of_shards: 1,\n },\n mappings: {\n _source: {\n enabled: false,\n },\n properties: {\n host_name: {\n type: \"keyword\",\n },\n created_at: {\n type: \"date\",\n format: \"EEE MMM dd HH:mm:ss Z yyyy\",\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cluster.put_component_template(\n name: \"template_1\",\n body: {\n \"template\": nil,\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"mappings\": {\n \"_source\": {\n \"enabled\": false\n },\n \"properties\": {\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cluster()->putComponentTemplate([\n \"name\" => \"template_1\",\n \"body\" => [\n \"template\" => null,\n \"settings\" => [\n \"number_of_shards\" => 1,\n ],\n \"mappings\" => [\n \"_source\" => [\n \"enabled\" => false,\n ],\n \"properties\" => [\n \"host_name\" => [\n \"type\" => \"keyword\",\n ],\n \"created_at\" => [\n \"type\" => \"date\",\n \"format\" => \"EEE MMM dd HH:mm:ss Z yyyy\",\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"template\":null,\"settings\":{\"number_of_shards\":1},\"mappings\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"keyword\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z yyyy\"}}}}' \"$ELASTICSEARCH_URL/_component_template/template_1\"", + "language": "curl" + } + ], "method_request": "PUT _component_template/template_1", "summary": "Create a template", "value": "{\n \"template\": null,\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"mappings\": {\n \"_source\": {\n \"enabled\": false\n },\n \"properties\": {\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n }\n }\n}" }, "ClusterPutComponentTemplateRequestExample2": { + "alternatives": [ + { + "code": "resp = client.cluster.put_component_template(\n name=\"template_1\",\n template=None,\n settings={\n \"number_of_shards\": 1\n },\n aliases={\n \"alias1\": {},\n \"alias2\": {\n \"filter\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n \"routing\": \"shard-1\"\n },\n \"{index}-alias\": {}\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.cluster.putComponentTemplate({\n name: \"template_1\",\n template: null,\n settings: {\n number_of_shards: 1,\n },\n aliases: {\n alias1: {},\n alias2: {\n filter: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n routing: \"shard-1\",\n },\n \"{index}-alias\": {},\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cluster.put_component_template(\n name: \"template_1\",\n body: {\n \"template\": nil,\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"aliases\": {\n \"alias1\": {},\n \"alias2\": {\n \"filter\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n \"routing\": \"shard-1\"\n },\n \"{index}-alias\": {}\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cluster()->putComponentTemplate([\n \"name\" => \"template_1\",\n \"body\" => [\n \"template\" => null,\n \"settings\" => [\n \"number_of_shards\" => 1,\n ],\n \"aliases\" => [\n \"alias1\" => new ArrayObject([]),\n \"alias2\" => [\n \"filter\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n \"routing\" => \"shard-1\",\n ],\n \"{index}-alias\" => new ArrayObject([]),\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"template\":null,\"settings\":{\"number_of_shards\":1},\"aliases\":{\"alias1\":{},\"alias2\":{\"filter\":{\"term\":{\"user.id\":\"kimchy\"}},\"routing\":\"shard-1\"},\"{index}-alias\":{}}}' \"$ELASTICSEARCH_URL/_component_template/template_1\"", + "language": "curl" + } + ], "description": "You can include index aliases in a component template. During index creation, the `{index}` placeholder in the alias name will be replaced with the actual index name that the template gets applied to.\n", "method_request": "PUT _component_template/template_1", "summary": "Create a template with aliases", @@ -116418,12 +119585,56 @@ "description": "Update the cluster settings.\n\nConfigure and update dynamic settings on a running cluster.\nYou can also configure dynamic settings locally on an unstarted or shut down node in `elasticsearch.yml`.\n\nUpdates made with this API can be persistent, which apply across cluster restarts, or transient, which reset after a cluster restart.\nYou can also reset transient or persistent settings by assigning them a null value.\n\nIf you configure the same setting using multiple methods, Elasticsearch applies the settings in following order of precedence: 1) Transient setting; 2) Persistent setting; 3) `elasticsearch.yml` setting; 4) Default setting value.\nFor example, you can apply a transient setting to override a persistent setting or `elasticsearch.yml` setting.\nHowever, a change to an `elasticsearch.yml` setting will not override a defined transient or persistent setting.\n\nTIP: In Elastic Cloud, use the user settings feature to configure all cluster settings. This method automatically rejects unsafe settings that could break your cluster.\nIf you run Elasticsearch on your own hardware, use this API to configure dynamic cluster settings.\nOnly use `elasticsearch.yml` for static cluster settings and node settings.\nThe API doesn’t require a restart and ensures a setting’s value is the same on all nodes.\n\nWARNING: Transient cluster settings are no longer recommended. Use persistent cluster settings instead.\nIf a cluster becomes unstable, transient settings can clear unexpectedly, resulting in a potentially undesired cluster configuration.", "examples": { "ClusterPutSettingsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cluster.put_settings(\n persistent={\n \"indices.recovery.max_bytes_per_sec\": \"50mb\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.cluster.putSettings({\n persistent: {\n \"indices.recovery.max_bytes_per_sec\": \"50mb\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cluster.put_settings(\n body: {\n \"persistent\": {\n \"indices.recovery.max_bytes_per_sec\": \"50mb\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cluster()->putSettings([\n \"body\" => [\n \"persistent\" => [\n \"indices.recovery.max_bytes_per_sec\" => \"50mb\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"persistent\":{\"indices.recovery.max_bytes_per_sec\":\"50mb\"}}' \"$ELASTICSEARCH_URL/_cluster/settings\"", + "language": "curl" + } + ], "description": "An example of a persistent update.", "method_request": "PUT /_cluster/settings", "summary": "A simple setting", "value": "{\n \"persistent\" : {\n \"indices.recovery.max_bytes_per_sec\" : \"50mb\"\n }\n}" }, "ClusterPutSettingsRequestExample2": { + "alternatives": [ + { + "code": "resp = client.cluster.put_settings(\n persistent={\n \"action.auto_create_index\": \"my-index-000001,index10,-index1*,+ind*\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.cluster.putSettings({\n persistent: {\n \"action.auto_create_index\": \"my-index-000001,index10,-index1*,+ind*\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cluster.put_settings(\n body: {\n \"persistent\": {\n \"action.auto_create_index\": \"my-index-000001,index10,-index1*,+ind*\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cluster()->putSettings([\n \"body\" => [\n \"persistent\" => [\n \"action.auto_create_index\" => \"my-index-000001,index10,-index1*,+ind*\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"persistent\":{\"action.auto_create_index\":\"my-index-000001,index10,-index1*,+ind*\"}}' \"$ELASTICSEARCH_URL/_cluster/settings\"", + "language": "curl" + } + ], "description": "PUT `/_cluster/settings` to update the `action.auto_create_index` setting. The setting accepts a comma-separated list of patterns that you want to allow or you can prefix each pattern with `+` or `-` to indicate whether it should be allowed or blocked. In this example, the auto-creation of indices called `my-index-000001` or `index10` is allowed, the creation of indices that match the pattern `index1*` is blocked, and the creation of any other indices that match the `ind*` pattern is allowed. Patterns are matched in the order specified.\n", "method_request": "PUT /_cluster/settings", "summary": "A setting with multiple patterns", @@ -116795,6 +120006,28 @@ "description": "Get remote cluster information.\n\nGet information about configured remote clusters.\nThe API returns connection and endpoint information keyed by the configured remote cluster alias.\n\n> info\n> This API returns information that reflects current state on the local cluster.\n> The `connected` field does not necessarily reflect whether a remote cluster is down or unavailable, only whether there is currently an open connection to it.\n> Elasticsearch does not spontaneously try to reconnect to a disconnected remote cluster.\n> To trigger a reconnection, attempt a cross-cluster search, ES|QL cross-cluster search, or try the [resolve cluster endpoint](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-resolve-cluster).", "examples": { "ClusterRemoteInfoExample1": { + "alternatives": [ + { + "code": "resp = client.cluster.remote_info()", + "language": "Python" + }, + { + "code": "const response = await client.cluster.remoteInfo();", + "language": "JavaScript" + }, + { + "code": "response = client.cluster.remote_info", + "language": "Ruby" + }, + { + "code": "$resp = $client->cluster()->remoteInfo();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_remote/info\"", + "language": "curl" + } + ], "method_request": "GET /_remote/info" } }, @@ -117150,6 +120383,28 @@ "description": "Reroute the cluster.\nManually change the allocation of individual shards in the cluster.\nFor example, a shard can be moved from one node to another explicitly, an allocation can be canceled, and an unassigned shard can be explicitly allocated to a specific node.\n\nIt is important to note that after processing any reroute commands Elasticsearch will perform rebalancing as normal (respecting the values of settings such as `cluster.routing.rebalance.enable`) in order to remain in a balanced state.\nFor example, if the requested allocation includes moving a shard from node1 to node2 then this may cause a shard to be moved from node2 back to node1 to even things out.\n\nThe cluster can be set to disable allocations using the `cluster.routing.allocation.enable` setting.\nIf allocations are disabled then the only allocations that will be performed are explicit ones given using the reroute command, and consequent allocations due to rebalancing.\n\nThe cluster will attempt to allocate a shard a maximum of `index.allocation.max_retries` times in a row (defaults to `5`), before giving up and leaving the shard unallocated.\nThis scenario can be caused by structural problems such as having an analyzer which refers to a stopwords file which doesn’t exist on all nodes.\n\nOnce the problem has been corrected, allocation can be manually retried by calling the reroute API with the `?retry_failed` URI query parameter, which will attempt a single retry round for these shards.", "examples": { "ClusterRerouteRequestExample1": { + "alternatives": [ + { + "code": "resp = client.cluster.reroute(\n metric=\"none\",\n commands=[\n {\n \"move\": {\n \"index\": \"test\",\n \"shard\": 0,\n \"from_node\": \"node1\",\n \"to_node\": \"node2\"\n }\n },\n {\n \"allocate_replica\": {\n \"index\": \"test\",\n \"shard\": 1,\n \"node\": \"node3\"\n }\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.cluster.reroute({\n metric: \"none\",\n commands: [\n {\n move: {\n index: \"test\",\n shard: 0,\n from_node: \"node1\",\n to_node: \"node2\",\n },\n },\n {\n allocate_replica: {\n index: \"test\",\n shard: 1,\n node: \"node3\",\n },\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cluster.reroute(\n metric: \"none\",\n body: {\n \"commands\": [\n {\n \"move\": {\n \"index\": \"test\",\n \"shard\": 0,\n \"from_node\": \"node1\",\n \"to_node\": \"node2\"\n }\n },\n {\n \"allocate_replica\": {\n \"index\": \"test\",\n \"shard\": 1,\n \"node\": \"node3\"\n }\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cluster()->reroute([\n \"metric\" => \"none\",\n \"body\" => [\n \"commands\" => array(\n [\n \"move\" => [\n \"index\" => \"test\",\n \"shard\" => 0,\n \"from_node\" => \"node1\",\n \"to_node\" => \"node2\",\n ],\n ],\n [\n \"allocate_replica\" => [\n \"index\" => \"test\",\n \"shard\" => 1,\n \"node\" => \"node3\",\n ],\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"commands\":[{\"move\":{\"index\":\"test\",\"shard\":0,\"from_node\":\"node1\",\"to_node\":\"node2\"}},{\"allocate_replica\":{\"index\":\"test\",\"shard\":1,\"node\":\"node3\"}}]}' \"$ELASTICSEARCH_URL/_cluster/reroute?metric=none\"", + "language": "curl" + } + ], "description": "Run `POST /_cluster/reroute?metric=none` to changes the allocation of shards in a cluster.", "method_request": "POST /_cluster/reroute?metric=none", "value": "{\n \"commands\": [\n {\n \"move\": {\n \"index\": \"test\", \"shard\": 0,\n \"from_node\": \"node1\", \"to_node\": \"node2\"\n }\n },\n {\n \"allocate_replica\": {\n \"index\": \"test\", \"shard\": 1,\n \"node\": \"node3\"\n }\n }\n ]\n}" @@ -117470,6 +120725,28 @@ "description": "Get the cluster state.\nGet comprehensive information about the state of the cluster.\n\nThe cluster state is an internal data structure which keeps track of a variety of information needed by every node, including the identity and attributes of the other nodes in the cluster; cluster-wide settings; index metadata, including the mapping and settings for each index; the location and status of every shard copy in the cluster.\n\nThe elected master node ensures that every node in the cluster has a copy of the same cluster state.\nThis API lets you retrieve a representation of this internal state for debugging or diagnostic purposes.\nYou may need to consult the Elasticsearch source code to determine the precise meaning of the response.\n\nBy default the API will route requests to the elected master node since this node is the authoritative source of cluster states.\nYou can also retrieve the cluster state held on the node handling the API request by adding the `?local=true` query parameter.\n\nElasticsearch may need to expend significant effort to compute a response to this API in larger clusters, and the response may comprise a very large quantity of data.\nIf you use this API repeatedly, your cluster may become unstable.\n\nWARNING: The response is a representation of an internal data structure.\nIts format is not subject to the same compatibility guarantees as other more stable APIs and may change from version to version.\nDo not query this API using external monitoring tools.\nInstead, obtain the information you require using other more stable cluster APIs.", "examples": { "ClusterStateExample1": { + "alternatives": [ + { + "code": "resp = client.cluster.state(\n filter_path=\"metadata.cluster_coordination.last_committed_config\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cluster.state({\n filter_path: \"metadata.cluster_coordination.last_committed_config\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cluster.state(\n filter_path: \"metadata.cluster_coordination.last_committed_config\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cluster()->state([\n \"filter_path\" => \"metadata.cluster_coordination.last_committed_config\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cluster/state?filter_path=metadata.cluster_coordination.last_committed_config\"", + "language": "curl" + } + ], "method_request": "GET /_cluster/state?filter_path=metadata.cluster_coordination.last_committed_config" } }, @@ -120237,6 +123514,28 @@ "description": "Get cluster statistics.\nGet basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins).", "examples": { "ClusterStatsExample1": { + "alternatives": [ + { + "code": "resp = client.cluster.stats(\n human=True,\n filter_path=\"indices.mappings.total_deduplicated_mapping_size*\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cluster.stats({\n human: \"true\",\n filter_path: \"indices.mappings.total_deduplicated_mapping_size*\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cluster.stats(\n human: \"true\",\n filter_path: \"indices.mappings.total_deduplicated_mapping_size*\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cluster()->stats([\n \"human\" => \"true\",\n \"filter_path\" => \"indices.mappings.total_deduplicated_mapping_size*\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cluster/stats?human&filter_path=indices.mappings.total_deduplicated_mapping_size*\"", + "language": "curl" + } + ], "method_request": "GET _cluster/stats?human&filter_path=indices.mappings.total_deduplicated_mapping_size*" } }, @@ -122686,6 +125985,28 @@ "description": "Check in a connector.\n\nUpdate the `last_seen` field in the connector and set it to the current timestamp.", "examples": { "ConnectorCheckInExample1": { + "alternatives": [ + { + "code": "resp = client.connector.check_in(\n connector_id=\"my-connector\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.checkIn({\n connector_id: \"my-connector\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.check_in(\n connector_id: \"my-connector\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->checkIn([\n \"connector_id\" => \"my-connector\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/my-connector/_check_in\"", + "language": "curl" + } + ], "method_request": "PUT _connector/my-connector/_check_in" } }, @@ -122756,6 +126077,28 @@ "description": "Delete a connector.\n\nRemoves a connector and associated sync jobs.\nThis is a destructive action that is not recoverable.\nNOTE: This action doesn’t delete any API keys, ingest pipelines, or data indices associated with the connector.\nThese need to be removed manually.", "examples": { "ConnectorDeleteExample1": { + "alternatives": [ + { + "code": "resp = client.connector.delete(\n connector_id=\"my-connector-id&delete_sync_jobs=true\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.delete({\n connector_id: \"my-connector-id&delete_sync_jobs=true\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.delete(\n connector_id: \"my-connector-id&delete_sync_jobs=true\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->delete([\n \"connector_id\" => \"my-connector-id&delete_sync_jobs=true\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/my-connector-id&delete_sync_jobs=true\"", + "language": "curl" + } + ], "method_request": "DELETE _connector/my-connector-id&delete_sync_jobs=true" } }, @@ -122847,6 +126190,28 @@ "description": "Get a connector.\n\nGet the details about a connector.", "examples": { "ConnectorGetExample1": { + "alternatives": [ + { + "code": "resp = client.connector.get(\n connector_id=\"my-connector-id\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.get({\n connector_id: \"my-connector-id\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.get(\n connector_id: \"my-connector-id\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->get([\n \"connector_id\" => \"my-connector-id\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/my-connector-id\"", + "language": "curl" + } + ], "method_request": "GET _connector/my-connector-id" } }, @@ -123051,6 +126416,28 @@ "description": "Update the connector last sync stats.\n\nUpdate the fields related to the last sync of a connector.\nThis action is used for analytics and monitoring.", "examples": { "ConnectorUpdateLastSyncRequestExample1": { + "alternatives": [ + { + "code": "resp = client.perform_request(\n \"PUT\",\n \"/_connector/my-connector/_last_sync\",\n headers={\"Content-Type\": \"application/json\"},\n body={\n \"last_access_control_sync_error\": \"Houston, we have a problem!\",\n \"last_access_control_sync_scheduled_at\": \"2023-11-09T15:13:08.231Z\",\n \"last_access_control_sync_status\": \"pending\",\n \"last_deleted_document_count\": 42,\n \"last_incremental_sync_scheduled_at\": \"2023-11-09T15:13:08.231Z\",\n \"last_indexed_document_count\": 42,\n \"last_sync_error\": \"Houston, we have a problem!\",\n \"last_sync_scheduled_at\": \"2024-11-09T15:13:08.231Z\",\n \"last_sync_status\": \"completed\",\n \"last_synced\": \"2024-11-09T15:13:08.231Z\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.transport.request({\n method: \"PUT\",\n path: \"/_connector/my-connector/_last_sync\",\n body: {\n last_access_control_sync_error: \"Houston, we have a problem!\",\n last_access_control_sync_scheduled_at: \"2023-11-09T15:13:08.231Z\",\n last_access_control_sync_status: \"pending\",\n last_deleted_document_count: 42,\n last_incremental_sync_scheduled_at: \"2023-11-09T15:13:08.231Z\",\n last_indexed_document_count: 42,\n last_sync_error: \"Houston, we have a problem!\",\n last_sync_scheduled_at: \"2024-11-09T15:13:08.231Z\",\n last_sync_status: \"completed\",\n last_synced: \"2024-11-09T15:13:08.231Z\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.perform_request(\n \"PUT\",\n \"/_connector/my-connector/_last_sync\",\n {},\n {\n \"last_access_control_sync_error\": \"Houston, we have a problem!\",\n \"last_access_control_sync_scheduled_at\": \"2023-11-09T15:13:08.231Z\",\n \"last_access_control_sync_status\": \"pending\",\n \"last_deleted_document_count\": 42,\n \"last_incremental_sync_scheduled_at\": \"2023-11-09T15:13:08.231Z\",\n \"last_indexed_document_count\": 42,\n \"last_sync_error\": \"Houston, we have a problem!\",\n \"last_sync_scheduled_at\": \"2024-11-09T15:13:08.231Z\",\n \"last_sync_status\": \"completed\",\n \"last_synced\": \"2024-11-09T15:13:08.231Z\"\n },\n { \"Content-Type\": \"application/json\" },\n)", + "language": "Ruby" + }, + { + "code": "$requestFactory = Psr17FactoryDiscovery::findRequestFactory();\n$streamFactory = Psr17FactoryDiscovery::findStreamFactory();\n$request = $requestFactory->createRequest(\n \"PUT\",\n \"/_connector/my-connector/_last_sync\",\n);\n$request = $request->withHeader(\"Content-Type\", \"application/json\");\n$request = $request->withBody($streamFactory->createStream(\n json_encode([\n \"last_access_control_sync_error\" => \"Houston, we have a problem!\",\n \"last_access_control_sync_scheduled_at\" => \"2023-11-09T15:13:08.231Z\",\n \"last_access_control_sync_status\" => \"pending\",\n \"last_deleted_document_count\" => 42,\n \"last_incremental_sync_scheduled_at\" => \"2023-11-09T15:13:08.231Z\",\n \"last_indexed_document_count\" => 42,\n \"last_sync_error\" => \"Houston, we have a problem!\",\n \"last_sync_scheduled_at\" => \"2024-11-09T15:13:08.231Z\",\n \"last_sync_status\" => \"completed\",\n \"last_synced\" => \"2024-11-09T15:13:08.231Z\",\n ]),\n));\n$resp = $client->sendRequest($request);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"last_access_control_sync_error\":\"Houston, we have a problem!\",\"last_access_control_sync_scheduled_at\":\"2023-11-09T15:13:08.231Z\",\"last_access_control_sync_status\":\"pending\",\"last_deleted_document_count\":42,\"last_incremental_sync_scheduled_at\":\"2023-11-09T15:13:08.231Z\",\"last_indexed_document_count\":42,\"last_sync_error\":\"Houston, we have a problem!\",\"last_sync_scheduled_at\":\"2024-11-09T15:13:08.231Z\",\"last_sync_status\":\"completed\",\"last_synced\":\"2024-11-09T15:13:08.231Z\"}' \"$ELASTICSEARCH_URL/_connector/my-connector/_last_sync\"", + "language": "curl" + } + ], "method_request": "PUT _connector/my-connector/_last_sync", "value": "{\n \"last_access_control_sync_error\": \"Houston, we have a problem!\",\n \"last_access_control_sync_scheduled_at\": \"2023-11-09T15:13:08.231Z\",\n \"last_access_control_sync_status\": \"pending\",\n \"last_deleted_document_count\": 42,\n \"last_incremental_sync_scheduled_at\": \"2023-11-09T15:13:08.231Z\",\n \"last_indexed_document_count\": 42,\n \"last_sync_error\": \"Houston, we have a problem!\",\n \"last_sync_scheduled_at\": \"2024-11-09T15:13:08.231Z\",\n \"last_sync_status\": \"completed\",\n \"last_synced\": \"2024-11-09T15:13:08.231Z\"\n}" } @@ -123117,6 +126504,28 @@ "description": "Get all connectors.\n\nGet information about all connectors.", "examples": { "ConnectorListExample1": { + "alternatives": [ + { + "code": "resp = client.connector.list()", + "language": "Python" + }, + { + "code": "const response = await client.connector.list();", + "language": "JavaScript" + }, + { + "code": "response = client.connector.list", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->list();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector\"", + "language": "curl" + } + ], "method_request": "GET _connector" } }, @@ -123463,10 +126872,54 @@ "description": "Create or update a connector.", "examples": { "ConnectorPutRequestExample1": { + "alternatives": [ + { + "code": "resp = client.connector.put(\n connector_id=\"my-connector\",\n index_name=\"search-google-drive\",\n name=\"My Connector\",\n service_type=\"google_drive\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.put({\n connector_id: \"my-connector\",\n index_name: \"search-google-drive\",\n name: \"My Connector\",\n service_type: \"google_drive\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.put(\n connector_id: \"my-connector\",\n body: {\n \"index_name\": \"search-google-drive\",\n \"name\": \"My Connector\",\n \"service_type\": \"google_drive\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->put([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"index_name\" => \"search-google-drive\",\n \"name\" => \"My Connector\",\n \"service_type\" => \"google_drive\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_name\":\"search-google-drive\",\"name\":\"My Connector\",\"service_type\":\"google_drive\"}' \"$ELASTICSEARCH_URL/_connector/my-connector\"", + "language": "curl" + } + ], "method_request": "PUT _connector/my-connector", "value": "{\n \"index_name\": \"search-google-drive\",\n \"name\": \"My Connector\",\n \"service_type\": \"google_drive\"\n}" }, "ConnectorPutRequestExample2": { + "alternatives": [ + { + "code": "resp = client.connector.put(\n connector_id=\"my-connector\",\n index_name=\"search-google-drive\",\n name=\"My Connector\",\n description=\"My Connector to sync data to Elastic index from Google Drive\",\n service_type=\"google_drive\",\n language=\"english\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.put({\n connector_id: \"my-connector\",\n index_name: \"search-google-drive\",\n name: \"My Connector\",\n description: \"My Connector to sync data to Elastic index from Google Drive\",\n service_type: \"google_drive\",\n language: \"english\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.put(\n connector_id: \"my-connector\",\n body: {\n \"index_name\": \"search-google-drive\",\n \"name\": \"My Connector\",\n \"description\": \"My Connector to sync data to Elastic index from Google Drive\",\n \"service_type\": \"google_drive\",\n \"language\": \"english\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->put([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"index_name\" => \"search-google-drive\",\n \"name\" => \"My Connector\",\n \"description\" => \"My Connector to sync data to Elastic index from Google Drive\",\n \"service_type\" => \"google_drive\",\n \"language\" => \"english\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_name\":\"search-google-drive\",\"name\":\"My Connector\",\"description\":\"My Connector to sync data to Elastic index from Google Drive\",\"service_type\":\"google_drive\",\"language\":\"english\"}' \"$ELASTICSEARCH_URL/_connector/my-connector\"", + "language": "curl" + } + ], "method_request": "PUT _connector/my-connector", "value": "{\n \"index_name\": \"search-google-drive\",\n \"name\": \"My Connector\",\n \"description\": \"My Connector to sync data to Elastic index from Google Drive\",\n \"service_type\": \"google_drive\",\n \"language\": \"english\"\n}" } @@ -123549,6 +127002,28 @@ "description": "Cancel a connector sync job.\n\nCancel a connector sync job, which sets the status to cancelling and updates `cancellation_requested_at` to the current time.\nThe connector service is then responsible for setting the status of connector sync jobs to cancelled.", "examples": { "ConnectorSyncJobCancelExample1": { + "alternatives": [ + { + "code": "resp = client.connector.sync_job_cancel(\n connector_sync_job_id=\"my-connector-sync-job-id\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.syncJobCancel({\n connector_sync_job_id: \"my-connector-sync-job-id\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.sync_job_cancel(\n connector_sync_job_id: \"my-connector-sync-job-id\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->syncJobCancel([\n \"connector_sync_job_id\" => \"my-connector-sync-job-id\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job-id/_cancel\"", + "language": "curl" + } + ], "method_request": "PUT _connector/_sync_job/my-connector-sync-job-id/_cancel" } }, @@ -123614,6 +127089,28 @@ "description": "Check in a connector sync job.\nCheck in a connector sync job and set the `last_seen` field to the current time before updating it in the internal index.\n\nTo sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure.\nThis service runs automatically on Elastic Cloud for Elastic managed connectors.", "examples": { "ConnectorSyncJobCheckInExample1": { + "alternatives": [ + { + "code": "resp = client.connector.sync_job_check_in(\n connector_sync_job_id=\"my-connector-sync-job\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.syncJobCheckIn({\n connector_sync_job_id: \"my-connector-sync-job\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.sync_job_check_in(\n connector_sync_job_id: \"my-connector-sync-job\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->syncJobCheckIn([\n \"connector_sync_job_id\" => \"my-connector-sync-job\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job/_check_in\"", + "language": "curl" + } + ], "method_request": "PUT _connector/_sync_job/my-connector-sync-job/_check_in" } }, @@ -123689,6 +127186,28 @@ "description": "Claim a connector sync job.\nThis action updates the job status to `in_progress` and sets the `last_seen` and `started_at` timestamps to the current time.\nAdditionally, it can set the `sync_cursor` property for the sync job.\n\nThis API is not intended for direct connector management by users.\nIt supports the implementation of services that utilize the connector protocol to communicate with Elasticsearch.\n\nTo sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure.\nThis service runs automatically on Elastic Cloud for Elastic managed connectors.", "examples": { "ConnectorSyncJobClaimExample1": { + "alternatives": [ + { + "code": "resp = client.connector.sync_job_claim(\n connector_sync_job_id=\"my-connector-sync-job-id\",\n worker_hostname=\"some-machine\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.syncJobClaim({\n connector_sync_job_id: \"my-connector-sync-job-id\",\n worker_hostname: \"some-machine\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.sync_job_claim(\n connector_sync_job_id: \"my-connector-sync-job-id\",\n body: {\n \"worker_hostname\": \"some-machine\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->syncJobClaim([\n \"connector_sync_job_id\" => \"my-connector-sync-job-id\",\n \"body\" => [\n \"worker_hostname\" => \"some-machine\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"worker_hostname\":\"some-machine\"}' \"$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job-id/_claim\"", + "language": "curl" + } + ], "description": "An example body for a `PUT _connector/_sync_job/my-connector-sync-job-id/_claim` request.", "method_request": "PUT _connector/_sync_job/my-connector-sync-job-id/_claim", "value": "{\n \"worker_hostname\": \"some-machine\"\n}" @@ -123744,6 +127263,28 @@ "description": "Delete a connector sync job.\n\nRemove a connector sync job and its associated data.\nThis is a destructive action that is not recoverable.", "examples": { "ConnectorSyncJobDeleteExample1": { + "alternatives": [ + { + "code": "resp = client.connector.sync_job_delete(\n connector_sync_job_id=\"my-connector-sync-job-id\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.syncJobDelete({\n connector_sync_job_id: \"my-connector-sync-job-id\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.sync_job_delete(\n connector_sync_job_id: \"my-connector-sync-job-id\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->syncJobDelete([\n \"connector_sync_job_id\" => \"my-connector-sync-job-id\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job-id\"", + "language": "curl" + } + ], "method_request": "DELETE _connector/_sync_job/my-connector-sync-job-id" } }, @@ -123823,6 +127364,28 @@ "description": "Set a connector sync job error.\nSet the `error` field for a connector sync job and set its `status` to `error`.\n\nTo sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure.\nThis service runs automatically on Elastic Cloud for Elastic managed connectors.", "examples": { "SyncJobErrorRequestExample1": { + "alternatives": [ + { + "code": "resp = client.connector.sync_job_error(\n connector_sync_job_id=\"my-connector-sync-job\",\n error=\"some-error\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.syncJobError({\n connector_sync_job_id: \"my-connector-sync-job\",\n error: \"some-error\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.sync_job_error(\n connector_sync_job_id: \"my-connector-sync-job\",\n body: {\n \"error\": \"some-error\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->syncJobError([\n \"connector_sync_job_id\" => \"my-connector-sync-job\",\n \"body\" => [\n \"error\" => \"some-error\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"error\":\"some-error\"}' \"$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job/_error\"", + "language": "curl" + } + ], "method_request": "PUT _connector/_sync_job/my-connector-sync-job/_error", "value": "{\n \"error\": \"some-error\"\n}" } @@ -123877,6 +127440,28 @@ "description": "Get a connector sync job.", "examples": { "ConnectorSyncJobGetExample1": { + "alternatives": [ + { + "code": "resp = client.connector.sync_job_get(\n connector_sync_job_id=\"my-connector-sync-job\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.syncJobGet({\n connector_sync_job_id: \"my-connector-sync-job\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.sync_job_get(\n connector_sync_job_id: \"my-connector-sync-job\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->syncJobGet([\n \"connector_sync_job_id\" => \"my-connector-sync-job\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job\"", + "language": "curl" + } + ], "method_request": "GET _connector/_sync_job/my-connector-sync-job" } }, @@ -123937,6 +127522,28 @@ "description": "Get all connector sync jobs.\n\nGet information about all stored connector sync jobs listed by their creation date in ascending order.", "examples": { "ConnectorSyncJobListExample1": { + "alternatives": [ + { + "code": "resp = client.connector.sync_job_list(\n connector_id=\"my-connector-id\",\n size=\"1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.syncJobList({\n connector_id: \"my-connector-id\",\n size: 1,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.sync_job_list(\n connector_id: \"my-connector-id\",\n size: \"1\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->syncJobList([\n \"connector_id\" => \"my-connector-id\",\n \"size\" => \"1\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/_sync_job?connector_id=my-connector-id&size=1\"", + "language": "curl" + } + ], "method_request": "GET _connector/_sync_job?connector_id=my-connector-id&size=1" } }, @@ -124115,6 +127722,28 @@ "description": "Create a connector sync job.\n\nCreate a connector sync job document in the internal index and initialize its counters and timestamps with default values.", "examples": { "SyncJobPostRequestExample1": { + "alternatives": [ + { + "code": "resp = client.connector.sync_job_post(\n id=\"connector-id\",\n job_type=\"full\",\n trigger_method=\"on_demand\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.syncJobPost({\n id: \"connector-id\",\n job_type: \"full\",\n trigger_method: \"on_demand\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.sync_job_post(\n body: {\n \"id\": \"connector-id\",\n \"job_type\": \"full\",\n \"trigger_method\": \"on_demand\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->syncJobPost([\n \"body\" => [\n \"id\" => \"connector-id\",\n \"job_type\" => \"full\",\n \"trigger_method\" => \"on_demand\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"connector-id\",\"job_type\":\"full\",\"trigger_method\":\"on_demand\"}' \"$ELASTICSEARCH_URL/_connector/_sync_job\"", + "language": "curl" + } + ], "method_request": "POST _connector/_sync_job", "value": "{\n \"id\": \"connector-id\",\n \"job_type\": \"full\",\n \"trigger_method\": \"on_demand\"\n}" } @@ -124242,6 +127871,28 @@ "description": "Set the connector sync job stats.\nStats include: `deleted_document_count`, `indexed_document_count`, `indexed_document_volume`, and `total_document_count`.\nYou can also update `last_seen`.\nThis API is mainly used by the connector service for updating sync job information.\n\nTo sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure.\nThis service runs automatically on Elastic Cloud for Elastic managed connectors.", "examples": { "ConnectorSyncJobUpdateStatsExample1": { + "alternatives": [ + { + "code": "resp = client.connector.sync_job_update_stats(\n connector_sync_job_id=\"my-connector-sync-job\",\n deleted_document_count=10,\n indexed_document_count=20,\n indexed_document_volume=1000,\n total_document_count=2000,\n last_seen=\"2023-01-02T10:00:00Z\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.syncJobUpdateStats({\n connector_sync_job_id: \"my-connector-sync-job\",\n deleted_document_count: 10,\n indexed_document_count: 20,\n indexed_document_volume: 1000,\n total_document_count: 2000,\n last_seen: \"2023-01-02T10:00:00Z\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.sync_job_update_stats(\n connector_sync_job_id: \"my-connector-sync-job\",\n body: {\n \"deleted_document_count\": 10,\n \"indexed_document_count\": 20,\n \"indexed_document_volume\": 1000,\n \"total_document_count\": 2000,\n \"last_seen\": \"2023-01-02T10:00:00Z\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->syncJobUpdateStats([\n \"connector_sync_job_id\" => \"my-connector-sync-job\",\n \"body\" => [\n \"deleted_document_count\" => 10,\n \"indexed_document_count\" => 20,\n \"indexed_document_volume\" => 1000,\n \"total_document_count\" => 2000,\n \"last_seen\" => \"2023-01-02T10:00:00Z\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"deleted_document_count\":10,\"indexed_document_count\":20,\"indexed_document_volume\":1000,\"total_document_count\":2000,\"last_seen\":\"2023-01-02T10:00:00Z\"}' \"$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job/_stats\"", + "language": "curl" + } + ], "description": "An example body for a `PUT _connector/_sync_job/my-connector-sync-job/_stats` request.", "method_request": "PUT _connector/_sync_job/my-connector-sync-job/_stats", "value": "{\n \"deleted_document_count\": 10,\n \"indexed_document_count\": 20,\n \"indexed_document_volume\": 1000,\n \"total_document_count\": 2000,\n \"last_seen\": \"2023-01-02T10:00:00Z\"\n}" @@ -124381,6 +128032,28 @@ "description": "Update the connector API key ID.\n\nUpdate the `api_key_id` and `api_key_secret_id` fields of a connector.\nYou can specify the ID of the API key used for authorization and the ID of the connector secret where the API key is stored.\nThe connector secret ID is required only for Elastic managed (native) connectors.\nSelf-managed connectors (connector clients) do not use this field.", "examples": { "ConnectorUpdateApiKeyIDRequestExample1": { + "alternatives": [ + { + "code": "resp = client.connector.update_api_key_id(\n connector_id=\"my-connector\",\n api_key_id=\"my-api-key-id\",\n api_key_secret_id=\"my-connector-secret-id\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.updateApiKeyId({\n connector_id: \"my-connector\",\n api_key_id: \"my-api-key-id\",\n api_key_secret_id: \"my-connector-secret-id\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.update_api_key_id(\n connector_id: \"my-connector\",\n body: {\n \"api_key_id\": \"my-api-key-id\",\n \"api_key_secret_id\": \"my-connector-secret-id\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->updateApiKeyId([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"api_key_id\" => \"my-api-key-id\",\n \"api_key_secret_id\" => \"my-connector-secret-id\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"api_key_id\":\"my-api-key-id\",\"api_key_secret_id\":\"my-connector-secret-id\"}' \"$ELASTICSEARCH_URL/_connector/my-connector/_api_key_id\"", + "language": "curl" + } + ], "method_request": "PUT _connector/my-connector/_api_key_id", "value": "{\n \"api_key_id\": \"my-api-key-id\",\n \"api_key_secret_id\": \"my-connector-secret-id\"\n}" } @@ -124483,10 +128156,54 @@ "description": "Update the connector configuration.\n\nUpdate the configuration field in the connector document.", "examples": { "ConnectorUpdateConfigurationRequestExample1": { + "alternatives": [ + { + "code": "resp = client.connector.update_configuration(\n connector_id=\"my-spo-connector\",\n values={\n \"tenant_id\": \"my-tenant-id\",\n \"tenant_name\": \"my-sharepoint-site\",\n \"client_id\": \"foo\",\n \"secret_value\": \"bar\",\n \"site_collections\": \"*\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.updateConfiguration({\n connector_id: \"my-spo-connector\",\n values: {\n tenant_id: \"my-tenant-id\",\n tenant_name: \"my-sharepoint-site\",\n client_id: \"foo\",\n secret_value: \"bar\",\n site_collections: \"*\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.update_configuration(\n connector_id: \"my-spo-connector\",\n body: {\n \"values\": {\n \"tenant_id\": \"my-tenant-id\",\n \"tenant_name\": \"my-sharepoint-site\",\n \"client_id\": \"foo\",\n \"secret_value\": \"bar\",\n \"site_collections\": \"*\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->updateConfiguration([\n \"connector_id\" => \"my-spo-connector\",\n \"body\" => [\n \"values\" => [\n \"tenant_id\" => \"my-tenant-id\",\n \"tenant_name\" => \"my-sharepoint-site\",\n \"client_id\" => \"foo\",\n \"secret_value\" => \"bar\",\n \"site_collections\" => \"*\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"values\":{\"tenant_id\":\"my-tenant-id\",\"tenant_name\":\"my-sharepoint-site\",\"client_id\":\"foo\",\"secret_value\":\"bar\",\"site_collections\":\"*\"}}' \"$ELASTICSEARCH_URL/_connector/my-spo-connector/_configuration\"", + "language": "curl" + } + ], "method_request": "PUT _connector/my-spo-connector/_configuration", "value": "{\n \"values\": {\n \"tenant_id\": \"my-tenant-id\",\n \"tenant_name\": \"my-sharepoint-site\",\n \"client_id\": \"foo\",\n \"secret_value\": \"bar\",\n \"site_collections\": \"*\"\n }\n}" }, "ConnectorUpdateConfigurationRequestExample2": { + "alternatives": [ + { + "code": "resp = client.connector.update_configuration(\n connector_id=\"my-spo-connector\",\n values={\n \"secret_value\": \"foo-bar\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.updateConfiguration({\n connector_id: \"my-spo-connector\",\n values: {\n secret_value: \"foo-bar\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.update_configuration(\n connector_id: \"my-spo-connector\",\n body: {\n \"values\": {\n \"secret_value\": \"foo-bar\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->updateConfiguration([\n \"connector_id\" => \"my-spo-connector\",\n \"body\" => [\n \"values\" => [\n \"secret_value\" => \"foo-bar\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"values\":{\"secret_value\":\"foo-bar\"}}' \"$ELASTICSEARCH_URL/_connector/my-spo-connector/_configuration\"", + "language": "curl" + } + ], "method_request": "PUT _connector/my-spo-connector/_configuration", "value": "{\n \"values\": {\n \"secret_value\": \"foo-bar\"\n }\n}" } @@ -124580,6 +128297,28 @@ "description": "Update the connector error field.\n\nSet the error field for the connector.\nIf the error provided in the request body is non-null, the connector’s status is updated to error.\nOtherwise, if the error is reset to null, the connector status is updated to connected.", "examples": { "ConnectorUpdateErrorRequestExample1": { + "alternatives": [ + { + "code": "resp = client.connector.update_error(\n connector_id=\"my-connector\",\n error=\"Houston, we have a problem!\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.updateError({\n connector_id: \"my-connector\",\n error: \"Houston, we have a problem!\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.update_error(\n connector_id: \"my-connector\",\n body: {\n \"error\": \"Houston, we have a problem!\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->updateError([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"error\" => \"Houston, we have a problem!\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"error\":\"Houston, we have a problem!\"}' \"$ELASTICSEARCH_URL/_connector/my-connector/_error\"", + "language": "curl" + } + ], "method_request": "PUT _connector/my-connector/_error", "value": "{\n \"error\": \"Houston, we have a problem!\"\n}" } @@ -124664,10 +128403,54 @@ "description": "Update the connector features.\nUpdate the connector features in the connector document.\nThis API can be used to control the following aspects of a connector:\n\n* document-level security\n* incremental syncs\n* advanced sync rules\n* basic sync rules\n\nNormally, the running connector service automatically manages these features.\nHowever, you can use this API to override the default behavior.\n\nTo sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure.\nThis service runs automatically on Elastic Cloud for Elastic managed connectors.", "examples": { "ConnectorUpdateFeaturesRequestExample1": { + "alternatives": [ + { + "code": "resp = client.connector.update_features(\n connector_id=\"my-connector\",\n features={\n \"document_level_security\": {\n \"enabled\": True\n },\n \"incremental_sync\": {\n \"enabled\": True\n },\n \"sync_rules\": {\n \"advanced\": {\n \"enabled\": False\n },\n \"basic\": {\n \"enabled\": True\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.updateFeatures({\n connector_id: \"my-connector\",\n features: {\n document_level_security: {\n enabled: true,\n },\n incremental_sync: {\n enabled: true,\n },\n sync_rules: {\n advanced: {\n enabled: false,\n },\n basic: {\n enabled: true,\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.update_features(\n connector_id: \"my-connector\",\n body: {\n \"features\": {\n \"document_level_security\": {\n \"enabled\": true\n },\n \"incremental_sync\": {\n \"enabled\": true\n },\n \"sync_rules\": {\n \"advanced\": {\n \"enabled\": false\n },\n \"basic\": {\n \"enabled\": true\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->updateFeatures([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"features\" => [\n \"document_level_security\" => [\n \"enabled\" => true,\n ],\n \"incremental_sync\" => [\n \"enabled\" => true,\n ],\n \"sync_rules\" => [\n \"advanced\" => [\n \"enabled\" => false,\n ],\n \"basic\" => [\n \"enabled\" => true,\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"features\":{\"document_level_security\":{\"enabled\":true},\"incremental_sync\":{\"enabled\":true},\"sync_rules\":{\"advanced\":{\"enabled\":false},\"basic\":{\"enabled\":true}}}}' \"$ELASTICSEARCH_URL/_connector/my-connector/_features\"", + "language": "curl" + } + ], "method_request": "PUT _connector/my-connector/_features", "value": "{\n \"features\": {\n \"document_level_security\": {\n \"enabled\": true\n },\n \"incremental_sync\": {\n \"enabled\": true\n },\n \"sync_rules\": {\n \"advanced\": {\n \"enabled\": false\n },\n \"basic\": {\n \"enabled\": true\n }\n }\n }\n}" }, "ConnectorUpdateFeaturesRequestExample2": { + "alternatives": [ + { + "code": "resp = client.connector.update_features(\n connector_id=\"my-connector\",\n features={\n \"document_level_security\": {\n \"enabled\": True\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.updateFeatures({\n connector_id: \"my-connector\",\n features: {\n document_level_security: {\n enabled: true,\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.update_features(\n connector_id: \"my-connector\",\n body: {\n \"features\": {\n \"document_level_security\": {\n \"enabled\": true\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->updateFeatures([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"features\" => [\n \"document_level_security\" => [\n \"enabled\" => true,\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"features\":{\"document_level_security\":{\"enabled\":true}}}' \"$ELASTICSEARCH_URL/_connector/my-connector/_features\"", + "language": "curl" + } + ], "method_request": "PUT _connector/my-connector/_features", "value": "{\n \"features\": {\n \"document_level_security\": {\n \"enabled\": true\n }\n }\n}" } @@ -124780,10 +128563,54 @@ "description": "Update the connector filtering.\n\nUpdate the draft filtering configuration of a connector and marks the draft validation state as edited.\nThe filtering draft is activated once validated by the running Elastic connector service.\nThe filtering property is used to configure sync rules (both basic and advanced) for a connector.", "examples": { "ConnectorUpdateFilteringRequestExample1": { + "alternatives": [ + { + "code": "resp = client.connector.update_filtering(\n connector_id=\"my-g-drive-connector\",\n rules=[\n {\n \"field\": \"file_extension\",\n \"id\": \"exclude-txt-files\",\n \"order\": 0,\n \"policy\": \"exclude\",\n \"rule\": \"equals\",\n \"value\": \"txt\"\n },\n {\n \"field\": \"_\",\n \"id\": \"DEFAULT\",\n \"order\": 1,\n \"policy\": \"include\",\n \"rule\": \"regex\",\n \"value\": \".*\"\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.updateFiltering({\n connector_id: \"my-g-drive-connector\",\n rules: [\n {\n field: \"file_extension\",\n id: \"exclude-txt-files\",\n order: 0,\n policy: \"exclude\",\n rule: \"equals\",\n value: \"txt\",\n },\n {\n field: \"_\",\n id: \"DEFAULT\",\n order: 1,\n policy: \"include\",\n rule: \"regex\",\n value: \".*\",\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.update_filtering(\n connector_id: \"my-g-drive-connector\",\n body: {\n \"rules\": [\n {\n \"field\": \"file_extension\",\n \"id\": \"exclude-txt-files\",\n \"order\": 0,\n \"policy\": \"exclude\",\n \"rule\": \"equals\",\n \"value\": \"txt\"\n },\n {\n \"field\": \"_\",\n \"id\": \"DEFAULT\",\n \"order\": 1,\n \"policy\": \"include\",\n \"rule\": \"regex\",\n \"value\": \".*\"\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->updateFiltering([\n \"connector_id\" => \"my-g-drive-connector\",\n \"body\" => [\n \"rules\" => array(\n [\n \"field\" => \"file_extension\",\n \"id\" => \"exclude-txt-files\",\n \"order\" => 0,\n \"policy\" => \"exclude\",\n \"rule\" => \"equals\",\n \"value\" => \"txt\",\n ],\n [\n \"field\" => \"_\",\n \"id\" => \"DEFAULT\",\n \"order\" => 1,\n \"policy\" => \"include\",\n \"rule\" => \"regex\",\n \"value\" => \".*\",\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"rules\":[{\"field\":\"file_extension\",\"id\":\"exclude-txt-files\",\"order\":0,\"policy\":\"exclude\",\"rule\":\"equals\",\"value\":\"txt\"},{\"field\":\"_\",\"id\":\"DEFAULT\",\"order\":1,\"policy\":\"include\",\"rule\":\"regex\",\"value\":\".*\"}]}' \"$ELASTICSEARCH_URL/_connector/my-g-drive-connector/_filtering\"", + "language": "curl" + } + ], "method_request": "PUT _connector/my-g-drive-connector/_filtering", "value": "{\n \"rules\": [\n {\n \"field\": \"file_extension\",\n \"id\": \"exclude-txt-files\",\n \"order\": 0,\n \"policy\": \"exclude\",\n \"rule\": \"equals\",\n \"value\": \"txt\"\n },\n {\n \"field\": \"_\",\n \"id\": \"DEFAULT\",\n \"order\": 1,\n \"policy\": \"include\",\n \"rule\": \"regex\",\n \"value\": \".*\"\n }\n ]\n}" }, "ConnectorUpdateFilteringRequestExample2": { + "alternatives": [ + { + "code": "resp = client.connector.update_filtering(\n connector_id=\"my-sql-connector\",\n advanced_snippet={\n \"value\": [\n {\n \"tables\": [\n \"users\",\n \"orders\"\n ],\n \"query\": \"SELECT users.id AS id, orders.order_id AS order_id FROM users JOIN orders ON users.id = orders.user_id\"\n }\n ]\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.updateFiltering({\n connector_id: \"my-sql-connector\",\n advanced_snippet: {\n value: [\n {\n tables: [\"users\", \"orders\"],\n query:\n \"SELECT users.id AS id, orders.order_id AS order_id FROM users JOIN orders ON users.id = orders.user_id\",\n },\n ],\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.update_filtering(\n connector_id: \"my-sql-connector\",\n body: {\n \"advanced_snippet\": {\n \"value\": [\n {\n \"tables\": [\n \"users\",\n \"orders\"\n ],\n \"query\": \"SELECT users.id AS id, orders.order_id AS order_id FROM users JOIN orders ON users.id = orders.user_id\"\n }\n ]\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->updateFiltering([\n \"connector_id\" => \"my-sql-connector\",\n \"body\" => [\n \"advanced_snippet\" => [\n \"value\" => array(\n [\n \"tables\" => array(\n \"users\",\n \"orders\",\n ),\n \"query\" => \"SELECT users.id AS id, orders.order_id AS order_id FROM users JOIN orders ON users.id = orders.user_id\",\n ],\n ),\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"advanced_snippet\":{\"value\":[{\"tables\":[\"users\",\"orders\"],\"query\":\"SELECT users.id AS id, orders.order_id AS order_id FROM users JOIN orders ON users.id = orders.user_id\"}]}}' \"$ELASTICSEARCH_URL/_connector/my-sql-connector/_filtering\"", + "language": "curl" + } + ], "method_request": "PUT _connector/my-sql-connector/_filtering", "value": "{\n \"advanced_snippet\": {\n \"value\": [{\n \"tables\": [\n \"users\",\n \"orders\"\n ],\n \"query\": \"SELECT users.id AS id, orders.order_id AS order_id FROM users JOIN orders ON users.id = orders.user_id\"\n }]\n }\n}" } @@ -124950,6 +128777,28 @@ "description": "Update the connector index name.\n\nUpdate the `index_name` field of a connector, specifying the index where the data ingested by the connector is stored.", "examples": { "ConnectorUpdateIndexNameRequestExample1": { + "alternatives": [ + { + "code": "resp = client.connector.update_index_name(\n connector_id=\"my-connector\",\n index_name=\"data-from-my-google-drive\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.updateIndexName({\n connector_id: \"my-connector\",\n index_name: \"data-from-my-google-drive\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.update_index_name(\n connector_id: \"my-connector\",\n body: {\n \"index_name\": \"data-from-my-google-drive\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->updateIndexName([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"index_name\" => \"data-from-my-google-drive\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_name\":\"data-from-my-google-drive\"}' \"$ELASTICSEARCH_URL/_connector/my-connector/_index_name\"", + "language": "curl" + } + ], "method_request": "PUT _connector/my-connector/_index_name", "value": "{\n \"index_name\": \"data-from-my-google-drive\"\n}" } @@ -125045,6 +128894,28 @@ "description": "Update the connector name and description.", "examples": { "ConnectorUpdateNameRequestExample1": { + "alternatives": [ + { + "code": "resp = client.connector.update_name(\n connector_id=\"my-connector\",\n name=\"Custom connector\",\n description=\"This is my customized connector\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.updateName({\n connector_id: \"my-connector\",\n name: \"Custom connector\",\n description: \"This is my customized connector\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.update_name(\n connector_id: \"my-connector\",\n body: {\n \"name\": \"Custom connector\",\n \"description\": \"This is my customized connector\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->updateName([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"name\" => \"Custom connector\",\n \"description\" => \"This is my customized connector\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"name\":\"Custom connector\",\"description\":\"This is my customized connector\"}' \"$ELASTICSEARCH_URL/_connector/my-connector/_name\"", + "language": "curl" + } + ], "method_request": "PUT _connector/my-connector/_name", "value": "{\n \"name\": \"Custom connector\",\n \"description\": \"This is my customized connector\"\n}" } @@ -125202,6 +129073,28 @@ "description": "Update the connector pipeline.\n\nWhen you create a new connector, the configuration of an ingest pipeline is populated with default settings.", "examples": { "ConnectorUpdatePipelineRequestExample1": { + "alternatives": [ + { + "code": "resp = client.connector.update_pipeline(\n connector_id=\"my-connector\",\n pipeline={\n \"extract_binary_content\": True,\n \"name\": \"my-connector-pipeline\",\n \"reduce_whitespace\": True,\n \"run_ml_inference\": True\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.updatePipeline({\n connector_id: \"my-connector\",\n pipeline: {\n extract_binary_content: true,\n name: \"my-connector-pipeline\",\n reduce_whitespace: true,\n run_ml_inference: true,\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.update_pipeline(\n connector_id: \"my-connector\",\n body: {\n \"pipeline\": {\n \"extract_binary_content\": true,\n \"name\": \"my-connector-pipeline\",\n \"reduce_whitespace\": true,\n \"run_ml_inference\": true\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->updatePipeline([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"pipeline\" => [\n \"extract_binary_content\" => true,\n \"name\" => \"my-connector-pipeline\",\n \"reduce_whitespace\" => true,\n \"run_ml_inference\" => true,\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"pipeline\":{\"extract_binary_content\":true,\"name\":\"my-connector-pipeline\",\"reduce_whitespace\":true,\"run_ml_inference\":true}}' \"$ELASTICSEARCH_URL/_connector/my-connector/_pipeline\"", + "language": "curl" + } + ], "method_request": "PUT _connector/my-connector/_pipeline", "value": "{\n \"pipeline\": {\n \"extract_binary_content\": true,\n \"name\": \"my-connector-pipeline\",\n \"reduce_whitespace\": true,\n \"run_ml_inference\": true\n }\n}" } @@ -125286,10 +129179,54 @@ "description": "Update the connector scheduling.", "examples": { "ConnectorUpdateSchedulingRequestExample1": { + "alternatives": [ + { + "code": "resp = client.connector.update_scheduling(\n connector_id=\"my-connector\",\n scheduling={\n \"access_control\": {\n \"enabled\": True,\n \"interval\": \"0 10 0 * * ?\"\n },\n \"full\": {\n \"enabled\": True,\n \"interval\": \"0 20 0 * * ?\"\n },\n \"incremental\": {\n \"enabled\": False,\n \"interval\": \"0 30 0 * * ?\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.updateScheduling({\n connector_id: \"my-connector\",\n scheduling: {\n access_control: {\n enabled: true,\n interval: \"0 10 0 * * ?\",\n },\n full: {\n enabled: true,\n interval: \"0 20 0 * * ?\",\n },\n incremental: {\n enabled: false,\n interval: \"0 30 0 * * ?\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.update_scheduling(\n connector_id: \"my-connector\",\n body: {\n \"scheduling\": {\n \"access_control\": {\n \"enabled\": true,\n \"interval\": \"0 10 0 * * ?\"\n },\n \"full\": {\n \"enabled\": true,\n \"interval\": \"0 20 0 * * ?\"\n },\n \"incremental\": {\n \"enabled\": false,\n \"interval\": \"0 30 0 * * ?\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->updateScheduling([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"scheduling\" => [\n \"access_control\" => [\n \"enabled\" => true,\n \"interval\" => \"0 10 0 * * ?\",\n ],\n \"full\" => [\n \"enabled\" => true,\n \"interval\" => \"0 20 0 * * ?\",\n ],\n \"incremental\" => [\n \"enabled\" => false,\n \"interval\" => \"0 30 0 * * ?\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"scheduling\":{\"access_control\":{\"enabled\":true,\"interval\":\"0 10 0 * * ?\"},\"full\":{\"enabled\":true,\"interval\":\"0 20 0 * * ?\"},\"incremental\":{\"enabled\":false,\"interval\":\"0 30 0 * * ?\"}}}' \"$ELASTICSEARCH_URL/_connector/my-connector/_scheduling\"", + "language": "curl" + } + ], "method_request": "PUT _connector/my-connector/_scheduling", "value": "{\n \"scheduling\": {\n \"access_control\": {\n \"enabled\": true,\n \"interval\": \"0 10 0 * * ?\"\n },\n \"full\": {\n \"enabled\": true,\n \"interval\": \"0 20 0 * * ?\"\n },\n \"incremental\": {\n \"enabled\": false,\n \"interval\": \"0 30 0 * * ?\"\n }\n }\n}" }, "ConnectorUpdateSchedulingRequestExample2": { + "alternatives": [ + { + "code": "resp = client.connector.update_scheduling(\n connector_id=\"my-connector\",\n scheduling={\n \"full\": {\n \"enabled\": True,\n \"interval\": \"0 10 0 * * ?\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.updateScheduling({\n connector_id: \"my-connector\",\n scheduling: {\n full: {\n enabled: true,\n interval: \"0 10 0 * * ?\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.update_scheduling(\n connector_id: \"my-connector\",\n body: {\n \"scheduling\": {\n \"full\": {\n \"enabled\": true,\n \"interval\": \"0 10 0 * * ?\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->updateScheduling([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"scheduling\" => [\n \"full\" => [\n \"enabled\" => true,\n \"interval\" => \"0 10 0 * * ?\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"scheduling\":{\"full\":{\"enabled\":true,\"interval\":\"0 10 0 * * ?\"}}}' \"$ELASTICSEARCH_URL/_connector/my-connector/_scheduling\"", + "language": "curl" + } + ], "method_request": "PUT _connector/my-connector/_scheduling", "value": "{\n \"scheduling\": {\n \"full\": {\n \"enabled\": true,\n \"interval\": \"0 10 0 * * ?\"\n }\n }\n}" } @@ -125374,6 +129311,28 @@ "description": "Update the connector service type.", "examples": { "ConnectorUpdateServiceTypeRequestExample1": { + "alternatives": [ + { + "code": "resp = client.connector.update_service_type(\n connector_id=\"my-connector\",\n service_type=\"sharepoint_online\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.updateServiceType({\n connector_id: \"my-connector\",\n service_type: \"sharepoint_online\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.update_service_type(\n connector_id: \"my-connector\",\n body: {\n \"service_type\": \"sharepoint_online\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->updateServiceType([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"service_type\" => \"sharepoint_online\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service_type\":\"sharepoint_online\"}' \"$ELASTICSEARCH_URL/_connector/my-connector/_service_type\"", + "language": "curl" + } + ], "method_request": "PUT _connector/my-connector/_service_type", "value": "{\n \"service_type\": \"sharepoint_online\"\n}" } @@ -125458,6 +129417,28 @@ "description": "Update the connector status.", "examples": { "ConnectorUpdateStatusRequestExample1": { + "alternatives": [ + { + "code": "resp = client.connector.update_status(\n connector_id=\"my-connector\",\n status=\"needs_configuration\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.connector.updateStatus({\n connector_id: \"my-connector\",\n status: \"needs_configuration\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.connector.update_status(\n connector_id: \"my-connector\",\n body: {\n \"status\": \"needs_configuration\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->connector()->updateStatus([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"status\" => \"needs_configuration\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"status\":\"needs_configuration\"}' \"$ELASTICSEARCH_URL/_connector/my-connector/_status\"", + "language": "curl" + } + ], "method_request": "PUT _connector/my-connector/_status", "value": "{\n \"status\": \"needs_configuration\"\n}" } @@ -125529,6 +129510,28 @@ "description": "Delete a dangling index.\nIf Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling.\nFor example, this can happen if you delete more than `cluster.indices.tombstones.size` indices while an Elasticsearch node is offline.", "examples": { "DanglingIndicesDeleteDanglingIndexExample1": { + "alternatives": [ + { + "code": "resp = client.dangling_indices.delete_dangling_index(\n index_uuid=\"\",\n accept_data_loss=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.danglingIndices.deleteDanglingIndex({\n index_uuid: \"\",\n accept_data_loss: \"true\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.dangling_indices.delete_dangling_index(\n index_uuid: \"\",\n accept_data_loss: \"true\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->danglingIndices()->deleteDanglingIndex([\n \"index_uuid\" => \"\",\n \"accept_data_loss\" => \"true\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_dangling/?accept_data_loss=true\"", + "language": "curl" + } + ], "method_request": "DELETE /_dangling/?accept_data_loss=true" } }, @@ -125626,6 +129629,28 @@ "description": "Import a dangling index.\n\nIf Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling.\nFor example, this can happen if you delete more than `cluster.indices.tombstones.size` indices while an Elasticsearch node is offline.", "examples": { "ImportDanglingIndexRequestExample1": { + "alternatives": [ + { + "code": "resp = client.dangling_indices.import_dangling_index(\n index_uuid=\"zmM4e0JtBkeUjiHD-MihPQ\",\n accept_data_loss=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.danglingIndices.importDanglingIndex({\n index_uuid: \"zmM4e0JtBkeUjiHD-MihPQ\",\n accept_data_loss: \"true\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.dangling_indices.import_dangling_index(\n index_uuid: \"zmM4e0JtBkeUjiHD-MihPQ\",\n accept_data_loss: \"true\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->danglingIndices()->importDanglingIndex([\n \"index_uuid\" => \"zmM4e0JtBkeUjiHD-MihPQ\",\n \"accept_data_loss\" => \"true\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_dangling/zmM4e0JtBkeUjiHD-MihPQ?accept_data_loss=true\"", + "language": "curl" + } + ], "method_request": "POST /_dangling/zmM4e0JtBkeUjiHD-MihPQ?accept_data_loss=true" } }, @@ -125792,6 +129817,28 @@ "description": "Get the dangling indices.\n\nIf Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling.\nFor example, this can happen if you delete more than `cluster.indices.tombstones.size` indices while an Elasticsearch node is offline.\n\nUse this API to list dangling indices, which you can then import or delete.", "examples": { "DanglingIndicesListDanglingIndicesExample1": { + "alternatives": [ + { + "code": "resp = client.dangling_indices.list_dangling_indices()", + "language": "Python" + }, + { + "code": "const response = await client.danglingIndices.listDanglingIndices();", + "language": "JavaScript" + }, + { + "code": "response = client.dangling_indices.list_dangling_indices", + "language": "Ruby" + }, + { + "code": "$resp = $client->danglingIndices()->listDanglingIndices();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_dangling\"", + "language": "curl" + } + ], "method_request": "GET /_dangling" } }, @@ -125979,6 +130026,28 @@ "description": "Delete an enrich policy.\nDeletes an existing enrich policy and its enrich index.", "examples": { "EnrichDeletePolicyExample1": { + "alternatives": [ + { + "code": "resp = client.enrich.delete_policy(\n name=\"my-policy\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.enrich.deletePolicy({\n name: \"my-policy\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.enrich.delete_policy(\n name: \"my-policy\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->enrich()->deletePolicy([\n \"name\" => \"my-policy\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_enrich/policy/my-policy\"", + "language": "curl" + } + ], "method_request": "DELETE /_enrich/policy/my-policy" } }, @@ -126110,6 +130179,28 @@ "description": "Run an enrich policy.\nCreate the enrich index for an existing enrich policy.", "examples": { "EnrichExecutePolicyExample1": { + "alternatives": [ + { + "code": "resp = client.enrich.execute_policy(\n name=\"my-policy\",\n wait_for_completion=False,\n)", + "language": "Python" + }, + { + "code": "const response = await client.enrich.executePolicy({\n name: \"my-policy\",\n wait_for_completion: \"false\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.enrich.execute_policy(\n name: \"my-policy\",\n wait_for_completion: \"false\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->enrich()->executePolicy([\n \"name\" => \"my-policy\",\n \"wait_for_completion\" => \"false\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_enrich/policy/my-policy/_execute?wait_for_completion=false\"", + "language": "curl" + } + ], "method_request": "PUT /_enrich/policy/my-policy/_execute?wait_for_completion=false" } }, @@ -126213,6 +130304,28 @@ "description": "Get an enrich policy.\nReturns information about an enrich policy.", "examples": { "EnrichGetPolicyExample1": { + "alternatives": [ + { + "code": "resp = client.enrich.get_policy(\n name=\"my-policy\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.enrich.getPolicy({\n name: \"my-policy\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.enrich.get_policy(\n name: \"my-policy\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->enrich()->getPolicy([\n \"name\" => \"my-policy\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_enrich/policy/my-policy\"", + "language": "curl" + } + ], "method_request": "GET /_enrich/policy/my-policy" } }, @@ -126333,6 +130446,28 @@ "description": "Create an enrich policy.\nCreates an enrich policy.", "examples": { "EnrichPutPolicyExample1": { + "alternatives": [ + { + "code": "resp = client.enrich.put_policy(\n name=\"postal_policy\",\n geo_match={\n \"indices\": \"postal_codes\",\n \"match_field\": \"location\",\n \"enrich_fields\": [\n \"location\",\n \"postal_code\"\n ]\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.enrich.putPolicy({\n name: \"postal_policy\",\n geo_match: {\n indices: \"postal_codes\",\n match_field: \"location\",\n enrich_fields: [\"location\", \"postal_code\"],\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.enrich.put_policy(\n name: \"postal_policy\",\n body: {\n \"geo_match\": {\n \"indices\": \"postal_codes\",\n \"match_field\": \"location\",\n \"enrich_fields\": [\n \"location\",\n \"postal_code\"\n ]\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->enrich()->putPolicy([\n \"name\" => \"postal_policy\",\n \"body\" => [\n \"geo_match\" => [\n \"indices\" => \"postal_codes\",\n \"match_field\" => \"location\",\n \"enrich_fields\" => array(\n \"location\",\n \"postal_code\",\n ),\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"geo_match\":{\"indices\":\"postal_codes\",\"match_field\":\"location\",\"enrich_fields\":[\"location\",\"postal_code\"]}}' \"$ELASTICSEARCH_URL/_enrich/policy/postal_policy\"", + "language": "curl" + } + ], "description": "An example body for a `PUT /_enrich/policy/postal_policy` request.", "method_request": "PUT /_enrich/policy/postal_policy", "value": "{\n \"geo_match\": {\n \"indices\": \"postal_codes\",\n \"match_field\": \"location\",\n \"enrich_fields\": [ \"location\", \"postal_code\" ]\n }\n}" @@ -126622,6 +130757,28 @@ "description": "Get enrich stats.\nReturns enrich coordinator statistics and information about enrich policies that are currently executing.", "examples": { "EnrichStatsExample1": { + "alternatives": [ + { + "code": "resp = client.enrich.stats()", + "language": "Python" + }, + { + "code": "const response = await client.enrich.stats();", + "language": "JavaScript" + }, + { + "code": "response = client.enrich.stats", + "language": "Ruby" + }, + { + "code": "$resp = $client->enrich()->stats();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_enrich/_stats\"", + "language": "curl" + } + ], "method_request": "GET /_enrich/_stats" } }, @@ -127067,6 +131224,28 @@ "description": "Delete an async EQL search.\nDelete an async EQL search or a stored synchronous EQL search.\nThe API also deletes results for the search.", "examples": { "EqlDeleteExample1": { + "alternatives": [ + { + "code": "resp = client.eql.delete(\n id=\"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.eql.delete({\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.eql.delete(\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->eql()->delete([\n \"id\" => \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_eql/search/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\"", + "language": "curl" + } + ], "method_request": "DELETE /_eql/search/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=" } }, @@ -127127,6 +131306,28 @@ "description": "Get async EQL search results.\nGet the current status and available results for an async EQL search or a stored synchronous EQL search.", "examples": { "EqlGetExample1": { + "alternatives": [ + { + "code": "resp = client.eql.get(\n id=\"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n wait_for_completion_timeout=\"2s\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.eql.get({\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n wait_for_completion_timeout: \"2s\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.eql.get(\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n wait_for_completion_timeout: \"2s\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->eql()->get([\n \"id\" => \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n \"wait_for_completion_timeout\" => \"2s\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_eql/search/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=?wait_for_completion_timeout=2s\"", + "language": "curl" + } + ], "method_request": "GET /_eql/search/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=?wait_for_completion_timeout=2s" } }, @@ -127227,6 +131428,28 @@ "description": "Get the async EQL status.\nGet the current status for an async EQL search or a stored synchronous EQL search without returning results.", "examples": { "EqlGetStatusExample1": { + "alternatives": [ + { + "code": "resp = client.eql.get_status(\n id=\"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.eql.getStatus({\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.eql.get_status(\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->eql()->getStatus([\n \"id\" => \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_eql/search/status/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\"", + "language": "curl" + } + ], "method_request": "GET /_eql/search/status/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=" } }, @@ -127625,12 +131848,56 @@ "description": "Get EQL search results.\nReturns search results for an Event Query Language (EQL) query.\nEQL assumes each document in a data stream or index corresponds to an event.", "examples": { "EqlSearchRequestExample1": { + "alternatives": [ + { + "code": "resp = client.eql.search(\n index=\"my-data-stream\",\n query=\"\\n process where (process.name == \\\"cmd.exe\\\" and process.pid != 2013)\\n \",\n)", + "language": "Python" + }, + { + "code": "const response = await client.eql.search({\n index: \"my-data-stream\",\n query:\n '\\n process where (process.name == \"cmd.exe\" and process.pid != 2013)\\n ',\n});", + "language": "JavaScript" + }, + { + "code": "response = client.eql.search(\n index: \"my-data-stream\",\n body: {\n \"query\": \"\\n process where (process.name == \\\"cmd.exe\\\" and process.pid != 2013)\\n \"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->eql()->search([\n \"index\" => \"my-data-stream\",\n \"body\" => [\n \"query\" => \"\\n process where (process.name == \\\"cmd.exe\\\" and process.pid != 2013)\\n \",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":\"\\n process where (process.name == \\\"cmd.exe\\\" and process.pid != 2013)\\n \"}' \"$ELASTICSEARCH_URL/my-data-stream/_eql/search\"", + "language": "curl" + } + ], "description": "Run `GET /my-data-stream/_eql/search` to search for events that have a `process.name` of `cmd.exe` and a `process.pid` other than `2013`.\n", "method_request": "GET /my-data-stream/_eql/search", "summary": "Basic query", "value": "{\n \"query\": \"\"\"\n process where (process.name == \"cmd.exe\" and process.pid != 2013)\n \"\"\"\n}" }, "EqlSearchRequestExample2": { + "alternatives": [ + { + "code": "resp = client.eql.search(\n index=\"my-data-stream\",\n query=\"\\n sequence by process.pid\\n [ file where file.name == \\\"cmd.exe\\\" and process.pid != 2013 ]\\n [ process where stringContains(process.executable, \\\"regsvr32\\\") ]\\n \",\n)", + "language": "Python" + }, + { + "code": "const response = await client.eql.search({\n index: \"my-data-stream\",\n query:\n '\\n sequence by process.pid\\n [ file where file.name == \"cmd.exe\" and process.pid != 2013 ]\\n [ process where stringContains(process.executable, \"regsvr32\") ]\\n ',\n});", + "language": "JavaScript" + }, + { + "code": "response = client.eql.search(\n index: \"my-data-stream\",\n body: {\n \"query\": \"\\n sequence by process.pid\\n [ file where file.name == \\\"cmd.exe\\\" and process.pid != 2013 ]\\n [ process where stringContains(process.executable, \\\"regsvr32\\\") ]\\n \"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->eql()->search([\n \"index\" => \"my-data-stream\",\n \"body\" => [\n \"query\" => \"\\n sequence by process.pid\\n [ file where file.name == \\\"cmd.exe\\\" and process.pid != 2013 ]\\n [ process where stringContains(process.executable, \\\"regsvr32\\\") ]\\n \",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":\"\\n sequence by process.pid\\n [ file where file.name == \\\"cmd.exe\\\" and process.pid != 2013 ]\\n [ process where stringContains(process.executable, \\\"regsvr32\\\") ]\\n \"}' \"$ELASTICSEARCH_URL/my-data-stream/_eql/search\"", + "language": "curl" + } + ], "description": "Run `GET /my-data-stream/_eql/search` to search for a sequence of events. The sequence starts with an event with an `event.category` of `file`, a `file.name` of `cmd.exe`, and a `process.pid` other than `2013`. It is followed by an event with an `event.category` of `process` and a `process.executable` that contains the substring `regsvr32`. These events must also share the same `process.pid` value.\n", "method_request": "GET /my-data-stream/_eql/search", "summary": "Sequence query", @@ -128681,6 +132948,28 @@ "description": "Run an async ES|QL query.\nAsynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available.\n\nThe API accepts the same parameters and request body as the synchronous query API, along with additional async related properties.", "examples": { "AsyncQueryRequestExample1": { + "alternatives": [ + { + "code": "resp = client.esql.async_query(\n query=\"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\n wait_for_completion_timeout=\"2s\",\n include_ccs_metadata=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.esql.asyncQuery({\n query:\n \"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\n wait_for_completion_timeout: \"2s\",\n include_ccs_metadata: true,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.esql.async_query(\n body: {\n \"query\": \"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\n \"wait_for_completion_timeout\": \"2s\",\n \"include_ccs_metadata\": true\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->esql()->asyncQuery([\n \"body\" => [\n \"query\" => \"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\n \"wait_for_completion_timeout\" => \"2s\",\n \"include_ccs_metadata\" => true,\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":\"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\"wait_for_completion_timeout\":\"2s\",\"include_ccs_metadata\":true}' \"$ELASTICSEARCH_URL/_query/async\"", + "language": "curl" + } + ], "method_request": "POST /_query/async", "value": "{\n \"query\": \"\"\"\n FROM library,remote-*:library\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n | STATS MAX(page_count) BY year\n | SORT year\n | LIMIT 5\n \"\"\",\n \"wait_for_completion_timeout\": \"2s\",\n \"include_ccs_metadata\": true\n}" } @@ -128806,6 +133095,28 @@ "description": "Delete an async ES|QL query.\nIf the query is still running, it is cancelled.\nOtherwise, the stored results are deleted.\n\nIf the Elasticsearch security features are enabled, only the following users can use this API to delete a query:\n\n* The authenticated user that submitted the original query request\n* Users with the `cancel_task` cluster privilege", "examples": { "EsqlAsyncQueryDeleteExample1": { + "alternatives": [ + { + "code": "resp = client.esql.async_query_delete(\n id=\"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.esql.asyncQueryDelete({\n id: \"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.esql.async_query_delete(\n id: \"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->esql()->asyncQueryDelete([\n \"id\" => \"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query/async/FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\"", + "language": "curl" + } + ], "method_request": "DELETE /_query/async/FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=" } }, @@ -128866,6 +133177,28 @@ "description": "Get async ES|QL query results.\nGet the current status and available results or stored results for an ES|QL asynchronous query.\nIf the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API.", "examples": { "EsqlAsyncQueryGetExample1": { + "alternatives": [ + { + "code": "resp = client.esql.async_query_get(\n id=\"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n wait_for_completion_timeout=\"30s\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.esql.asyncQueryGet({\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n wait_for_completion_timeout: \"30s\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.esql.async_query_get(\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n wait_for_completion_timeout: \"30s\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->esql()->asyncQueryGet([\n \"id\" => \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n \"wait_for_completion_timeout\" => \"30s\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query/async/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=?wait_for_completion_timeout=30s\"", + "language": "curl" + } + ], "method_request": "GET /_query/async/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=?wait_for_completion_timeout=30s" } }, @@ -128964,6 +133297,28 @@ "description": "Stop async ES|QL query.\n\nThis API interrupts the query execution and returns the results so far.\nIf the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can stop it.", "examples": { "EsqlAsyncQueryStopExample1": { + "alternatives": [ + { + "code": "resp = client.esql.async_query_stop(\n id=\"FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.esql.asyncQueryStop({\n id: \"FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.esql.async_query_stop(\n id: \"FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->esql()->asyncQueryStop([\n \"id\" => \"FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query/async/FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=/stop\"", + "language": "curl" + } + ], "method_request": "POST /_query/async/FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=/stop" } }, @@ -129163,6 +133518,28 @@ "description": "Run an ES|QL query.\nGet search results for an ES|QL (Elasticsearch query language) query.", "examples": { "QueryRequestExample1": { + "alternatives": [ + { + "code": "resp = client.esql.query(\n query=\"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\n include_ccs_metadata=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.esql.query({\n query:\n \"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\n include_ccs_metadata: true,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.esql.query(\n body: {\n \"query\": \"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\n \"include_ccs_metadata\": true\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->esql()->query([\n \"body\" => [\n \"query\" => \"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\n \"include_ccs_metadata\" => true,\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":\"\\n FROM library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | SORT year\\n | LIMIT 5\\n \",\"include_ccs_metadata\":true}' \"$ELASTICSEARCH_URL/_query\"", + "language": "curl" + } + ], "description": "Run `POST /_query` to get results for an ES|QL query.", "method_request": "POST /_query", "value": "{\n \"query\": \"\"\"\n FROM library,remote-*:library\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n | STATS MAX(page_count) BY year\n | SORT year\n | LIMIT 5\n \"\"\",\n \"include_ccs_metadata\": true\n}" @@ -129282,6 +133659,28 @@ "description": "Get the features.\nGet a list of features that can be included in snapshots using the `feature_states` field when creating a snapshot.\nYou can use this API to determine which feature states to include when taking a snapshot.\nBy default, all feature states are included in a snapshot if that snapshot includes the global state, or none if it does not.\n\nA feature state includes one or more system indices necessary for a given feature to function.\nIn order to ensure data integrity, all system indices that comprise a feature state are snapshotted and restored together.\n\nThe features listed by this API are a combination of built-in features and features defined by plugins.\nIn order for a feature state to be listed in this API and recognized as a valid feature state by the create snapshot API, the plugin that defines that feature must be installed on the master node.", "examples": { "FeaturesGetFeaturesExample1": { + "alternatives": [ + { + "code": "resp = client.features.get_features()", + "language": "Python" + }, + { + "code": "const response = await client.features.getFeatures();", + "language": "JavaScript" + }, + { + "code": "response = client.features.get_features", + "language": "Ruby" + }, + { + "code": "$resp = $client->features()->getFeatures();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_features\"", + "language": "curl" + } + ], "method_request": "GET _features" } }, @@ -129357,6 +133756,28 @@ "description": "Reset the features.\nClear all of the state information stored in system indices by Elasticsearch features, including the security and machine learning indices.\n\nWARNING: Intended for development and testing use only. Do not reset features on a production cluster.\n\nReturn a cluster to the same state as a new installation by resetting the feature state for all Elasticsearch features.\nThis deletes all state information stored in system indices.\n\nThe response code is HTTP 200 if the state is successfully reset for all features.\nIt is HTTP 500 if the reset operation failed for any feature.\n\nNote that select features might provide a way to reset particular system indices.\nUsing this API resets all features, both those that are built-in and implemented as plugins.\n\nTo list the features that will be affected, use the get features API.\n\nIMPORTANT: The features installed on the node you submit this request to are the features that will be reset. Run on the master node if you have any doubts about which plugins are installed on individual nodes.", "examples": { "FeaturesResetFeaturesExample1": { + "alternatives": [ + { + "code": "resp = client.features.reset_features()", + "language": "Python" + }, + { + "code": "const response = await client.features.resetFeatures();", + "language": "JavaScript" + }, + { + "code": "response = client.features.reset_features", + "language": "Ruby" + }, + { + "code": "$resp = $client->features()->resetFeatures();", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_features/_reset\"", + "language": "curl" + } + ], "method_request": "POST /_features/_reset" } }, @@ -131498,6 +135919,28 @@ "description": "Explore graph analytics.\nExtract and summarize information about the documents and terms in an Elasticsearch data stream or index.\nThe easiest way to understand the behavior of this API is to use the Graph UI to explore connections.\nAn initial request to the `_explore` API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph.\nSubsequent requests enable you to spider out from one more vertices of interest.\nYou can exclude vertices that have already been returned.", "examples": { "GraphExploreRequestExample1": { + "alternatives": [ + { + "code": "resp = client.graph.explore(\n index=\"clicklogs\",\n query={\n \"match\": {\n \"query.raw\": \"midi\"\n }\n },\n vertices=[\n {\n \"field\": \"product\"\n }\n ],\n connections={\n \"vertices\": [\n {\n \"field\": \"query.raw\"\n }\n ]\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.graph.explore({\n index: \"clicklogs\",\n query: {\n match: {\n \"query.raw\": \"midi\",\n },\n },\n vertices: [\n {\n field: \"product\",\n },\n ],\n connections: {\n vertices: [\n {\n field: \"query.raw\",\n },\n ],\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.graph.explore(\n index: \"clicklogs\",\n body: {\n \"query\": {\n \"match\": {\n \"query.raw\": \"midi\"\n }\n },\n \"vertices\": [\n {\n \"field\": \"product\"\n }\n ],\n \"connections\": {\n \"vertices\": [\n {\n \"field\": \"query.raw\"\n }\n ]\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->graph()->explore([\n \"index\" => \"clicklogs\",\n \"body\" => [\n \"query\" => [\n \"match\" => [\n \"query.raw\" => \"midi\",\n ],\n ],\n \"vertices\" => array(\n [\n \"field\" => \"product\",\n ],\n ),\n \"connections\" => [\n \"vertices\" => array(\n [\n \"field\" => \"query.raw\",\n ],\n ),\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"match\":{\"query.raw\":\"midi\"}},\"vertices\":[{\"field\":\"product\"}],\"connections\":{\"vertices\":[{\"field\":\"query.raw\"}]}}' \"$ELASTICSEARCH_URL/clicklogs/_graph/explore\"", + "language": "curl" + } + ], "description": "Run `POST clicklogs/_graph/explore` for a basic exploration An initial graph explore query typically begins with a query to identify strongly related terms. Seed the exploration with a query. This example is searching `clicklogs` for people who searched for the term `midi`.Identify the vertices to include in the graph. This example is looking for product codes that are significantly associated with searches for `midi`. Find the connections. This example is looking for other search terms that led people to click on the products that are associated with searches for `midi`.\n", "method_request": "POST clicklogs/_graph/explore", "value": "{\n \"query\": {\n \"match\": {\n \"query.raw\": \"midi\"\n }\n },\n \"vertices\": [\n {\n \"field\": \"product\"\n }\n ],\n \"connections\": {\n \"vertices\": [\n {\n \"field\": \"query.raw\"\n }\n ]\n }\n}" @@ -132384,6 +136827,28 @@ "description": "Delete a lifecycle policy.\nYou cannot delete policies that are currently in use. If the policy is being used to manage any indices, the request fails and returns an error.", "examples": { "IlmDeleteLifecycleExample1": { + "alternatives": [ + { + "code": "resp = client.ilm.delete_lifecycle(\n name=\"my_policy\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ilm.deleteLifecycle({\n name: \"my_policy\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ilm.delete_lifecycle(\n policy: \"my_policy\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ilm()->deleteLifecycle([\n \"policy\" => \"my_policy\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ilm/policy/my_policy\"", + "language": "curl" + } + ], "method_request": "DELETE _ilm/policy/my_policy" } }, @@ -132964,6 +137429,28 @@ "description": "Explain the lifecycle state.\nGet the current lifecycle status for one or more indices.\nFor data streams, the API retrieves the current lifecycle status for the stream's backing indices.\n\nThe response indicates when the index entered each lifecycle state, provides the definition of the running phase, and information about any failures.", "examples": { "IlmExplainLifecycleExample1": { + "alternatives": [ + { + "code": "resp = client.ilm.explain_lifecycle(\n index=\".ds-timeseries-*\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ilm.explainLifecycle({\n index: \".ds-timeseries-*\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ilm.explain_lifecycle(\n index: \".ds-timeseries-*\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ilm()->explainLifecycle([\n \"index\" => \".ds-timeseries-*\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/.ds-timeseries-*/_ilm/explain\"", + "language": "curl" + } + ], "method_request": "GET .ds-timeseries-*/_ilm/explain" } }, @@ -133127,6 +137614,28 @@ "description": "Get lifecycle policies.", "examples": { "IlmGetLifecycleExample1": { + "alternatives": [ + { + "code": "resp = client.ilm.get_lifecycle(\n name=\"my_policy\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ilm.getLifecycle({\n name: \"my_policy\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ilm.get_lifecycle(\n policy: \"my_policy\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ilm()->getLifecycle([\n \"policy\" => \"my_policy\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ilm/policy/my_policy\"", + "language": "curl" + } + ], "method_request": "GET _ilm/policy/my_policy" } }, @@ -133232,6 +137741,28 @@ "description": "Get the ILM status.\n\nGet the current index lifecycle management status.", "examples": { "IlmGetStatusExample1": { + "alternatives": [ + { + "code": "resp = client.ilm.get_status()", + "language": "Python" + }, + { + "code": "const response = await client.ilm.getStatus();", + "language": "JavaScript" + }, + { + "code": "response = client.ilm.get_status", + "language": "Ruby" + }, + { + "code": "$resp = $client->ilm()->getStatus();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ilm/status\"", + "language": "curl" + } + ], "method_request": "GET _ilm/status" } }, @@ -133314,6 +137845,28 @@ "description": "Migrate to data tiers routing.\nSwitch the indices, ILM policies, and legacy, composable, and component templates from using custom node attributes and attribute-based allocation filters to using data tiers.\nOptionally, delete one legacy index template.\nUsing node roles enables ILM to automatically move the indices between data tiers.\n\nMigrating away from custom node attributes routing can be manually performed.\nThis API provides an automated way of performing three out of the four manual steps listed in the migration guide:\n\n1. Stop setting the custom hot attribute on new indices.\n1. Remove custom allocation settings from existing ILM policies.\n1. Replace custom allocation settings from existing indices with the corresponding tier preference.\n\nILM must be stopped before performing the migration.\nUse the stop ILM and get ILM status APIs to wait until the reported operation mode is `STOPPED`.", "examples": { "MigrateToDataTiersRequestExample1": { + "alternatives": [ + { + "code": "resp = client.ilm.migrate_to_data_tiers(\n legacy_template_to_delete=\"global-template\",\n node_attribute=\"custom_attribute_name\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ilm.migrateToDataTiers({\n legacy_template_to_delete: \"global-template\",\n node_attribute: \"custom_attribute_name\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ilm.migrate_to_data_tiers(\n body: {\n \"legacy_template_to_delete\": \"global-template\",\n \"node_attribute\": \"custom_attribute_name\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ilm()->migrateToDataTiers([\n \"body\" => [\n \"legacy_template_to_delete\" => \"global-template\",\n \"node_attribute\" => \"custom_attribute_name\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"legacy_template_to_delete\":\"global-template\",\"node_attribute\":\"custom_attribute_name\"}' \"$ELASTICSEARCH_URL/_ilm/migrate_to_data_tiers\"", + "language": "curl" + } + ], "description": "Run `POST /_ilm/migrate_to_data_tiers` to migrate the indices, ILM policies, legacy templates, composable, and component templates away from defining custom allocation filtering using the `custom_attribute_name` node attribute. It also deletes the legacy template with name `global-template` if it exists in the system.\n", "method_request": "POST /_ilm/migrate_to_data_tiers", "value": "{\n \"legacy_template_to_delete\": \"global-template\",\n \"node_attribute\": \"custom_attribute_name\"\n}" @@ -133511,12 +138064,56 @@ "description": "Move to a lifecycle step.\nManually move an index into a specific step in the lifecycle policy and run that step.\n\nWARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API.\n\nYou must specify both the current step and the step to be executed in the body of the request.\nThe request will fail if the current step does not match the step currently running for the index\nThis is to prevent the index from being moved from an unexpected step into the next step.\n\nWhen specifying the target (`next_step`) to which the index will be moved, either the name or both the action and name fields are optional.\nIf only the phase is specified, the index will move to the first step of the first action in the target phase.\nIf the phase and action are specified, the index will move to the first step of the specified action in the specified phase.\nOnly actions specified in the ILM policy are considered valid.\nAn index cannot move to a step that is not part of its policy.", "examples": { "MoveToStepRequestExample1": { + "alternatives": [ + { + "code": "resp = client.ilm.move_to_step(\n index=\"my-index-000001\",\n current_step={\n \"phase\": \"new\",\n \"action\": \"complete\",\n \"name\": \"complete\"\n },\n next_step={\n \"phase\": \"warm\",\n \"action\": \"forcemerge\",\n \"name\": \"forcemerge\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.ilm.moveToStep({\n index: \"my-index-000001\",\n current_step: {\n phase: \"new\",\n action: \"complete\",\n name: \"complete\",\n },\n next_step: {\n phase: \"warm\",\n action: \"forcemerge\",\n name: \"forcemerge\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ilm.move_to_step(\n index: \"my-index-000001\",\n body: {\n \"current_step\": {\n \"phase\": \"new\",\n \"action\": \"complete\",\n \"name\": \"complete\"\n },\n \"next_step\": {\n \"phase\": \"warm\",\n \"action\": \"forcemerge\",\n \"name\": \"forcemerge\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ilm()->moveToStep([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"current_step\" => [\n \"phase\" => \"new\",\n \"action\" => \"complete\",\n \"name\" => \"complete\",\n ],\n \"next_step\" => [\n \"phase\" => \"warm\",\n \"action\" => \"forcemerge\",\n \"name\" => \"forcemerge\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"current_step\":{\"phase\":\"new\",\"action\":\"complete\",\"name\":\"complete\"},\"next_step\":{\"phase\":\"warm\",\"action\":\"forcemerge\",\"name\":\"forcemerge\"}}' \"$ELASTICSEARCH_URL/_ilm/move/my-index-000001\"", + "language": "curl" + } + ], "description": "Run `POST _ilm/move/my-index-000001` to move `my-index-000001` from the initial step to the `forcemerge` step.\n", "method_request": "POST _ilm/move/my-index-000001", "summary": "Move to forcemerge step", "value": "{\n \"current_step\": {\n \"phase\": \"new\",\n \"action\": \"complete\",\n \"name\": \"complete\"\n },\n \"next_step\": {\n \"phase\": \"warm\",\n \"action\": \"forcemerge\",\n \"name\": \"forcemerge\"\n }\n}" }, "MoveToStepRequestExample2": { + "alternatives": [ + { + "code": "resp = client.ilm.move_to_step(\n index=\"my-index-000001\",\n current_step={\n \"phase\": \"hot\",\n \"action\": \"complete\",\n \"name\": \"complete\"\n },\n next_step={\n \"phase\": \"warm\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.ilm.moveToStep({\n index: \"my-index-000001\",\n current_step: {\n phase: \"hot\",\n action: \"complete\",\n name: \"complete\",\n },\n next_step: {\n phase: \"warm\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ilm.move_to_step(\n index: \"my-index-000001\",\n body: {\n \"current_step\": {\n \"phase\": \"hot\",\n \"action\": \"complete\",\n \"name\": \"complete\"\n },\n \"next_step\": {\n \"phase\": \"warm\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ilm()->moveToStep([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"current_step\" => [\n \"phase\" => \"hot\",\n \"action\" => \"complete\",\n \"name\" => \"complete\",\n ],\n \"next_step\" => [\n \"phase\" => \"warm\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"current_step\":{\"phase\":\"hot\",\"action\":\"complete\",\"name\":\"complete\"},\"next_step\":{\"phase\":\"warm\"}}' \"$ELASTICSEARCH_URL/_ilm/move/my-index-000001\"", + "language": "curl" + } + ], "description": "Run `POST _ilm/move/my-index-000001` to move `my-index-000001` from the end of hot phase into the start of warm.\n", "method_request": "POST _ilm/move/my-index-000001", "summary": "Move to warm step", @@ -133644,6 +138241,28 @@ "description": "Create or update a lifecycle policy.\nIf the specified policy exists, it is replaced and the policy version is incremented.\n\nNOTE: Only the latest version of the policy is stored, you cannot revert to previous versions.", "examples": { "PutLifecycleRequestExample1": { + "alternatives": [ + { + "code": "resp = client.ilm.put_lifecycle(\n name=\"my_policy\",\n policy={\n \"_meta\": {\n \"description\": \"used for nginx log\",\n \"project\": {\n \"name\": \"myProject\",\n \"department\": \"myDepartment\"\n }\n },\n \"phases\": {\n \"warm\": {\n \"min_age\": \"10d\",\n \"actions\": {\n \"forcemerge\": {\n \"max_num_segments\": 1\n }\n }\n },\n \"delete\": {\n \"min_age\": \"30d\",\n \"actions\": {\n \"delete\": {}\n }\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.ilm.putLifecycle({\n name: \"my_policy\",\n policy: {\n _meta: {\n description: \"used for nginx log\",\n project: {\n name: \"myProject\",\n department: \"myDepartment\",\n },\n },\n phases: {\n warm: {\n min_age: \"10d\",\n actions: {\n forcemerge: {\n max_num_segments: 1,\n },\n },\n },\n delete: {\n min_age: \"30d\",\n actions: {\n delete: {},\n },\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ilm.put_lifecycle(\n policy: \"my_policy\",\n body: {\n \"policy\": {\n \"_meta\": {\n \"description\": \"used for nginx log\",\n \"project\": {\n \"name\": \"myProject\",\n \"department\": \"myDepartment\"\n }\n },\n \"phases\": {\n \"warm\": {\n \"min_age\": \"10d\",\n \"actions\": {\n \"forcemerge\": {\n \"max_num_segments\": 1\n }\n }\n },\n \"delete\": {\n \"min_age\": \"30d\",\n \"actions\": {\n \"delete\": {}\n }\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ilm()->putLifecycle([\n \"policy\" => \"my_policy\",\n \"body\" => [\n \"policy\" => [\n \"_meta\" => [\n \"description\" => \"used for nginx log\",\n \"project\" => [\n \"name\" => \"myProject\",\n \"department\" => \"myDepartment\",\n ],\n ],\n \"phases\" => [\n \"warm\" => [\n \"min_age\" => \"10d\",\n \"actions\" => [\n \"forcemerge\" => [\n \"max_num_segments\" => 1,\n ],\n ],\n ],\n \"delete\" => [\n \"min_age\" => \"30d\",\n \"actions\" => [\n \"delete\" => new ArrayObject([]),\n ],\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"policy\":{\"_meta\":{\"description\":\"used for nginx log\",\"project\":{\"name\":\"myProject\",\"department\":\"myDepartment\"}},\"phases\":{\"warm\":{\"min_age\":\"10d\",\"actions\":{\"forcemerge\":{\"max_num_segments\":1}}},\"delete\":{\"min_age\":\"30d\",\"actions\":{\"delete\":{}}}}}}' \"$ELASTICSEARCH_URL/_ilm/policy/my_policy\"", + "language": "curl" + } + ], "description": "Run `PUT _ilm/policy/my_policy` to create a new policy with arbitrary metadata.\n", "method_request": "PUT _ilm/policy/my_policy", "value": "{\n \"policy\": {\n \"_meta\": {\n \"description\": \"used for nginx log\",\n \"project\": {\n \"name\": \"myProject\",\n \"department\": \"myDepartment\"\n }\n },\n \"phases\": {\n \"warm\": {\n \"min_age\": \"10d\",\n \"actions\": {\n \"forcemerge\": {\n \"max_num_segments\": 1\n }\n }\n },\n \"delete\": {\n \"min_age\": \"30d\",\n \"actions\": {\n \"delete\": {}\n }\n }\n }\n }\n}" @@ -133740,6 +138359,28 @@ "description": "Remove policies from an index.\nRemove the assigned lifecycle policies from an index or a data stream's backing indices.\nIt also stops managing the indices.", "examples": { "IlmRemovePolicyExample1": { + "alternatives": [ + { + "code": "resp = client.ilm.remove_policy(\n index=\"logs-my_app-default\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ilm.removePolicy({\n index: \"logs-my_app-default\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ilm.remove_policy(\n index: \"logs-my_app-default\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ilm()->removePolicy([\n \"index\" => \"logs-my_app-default\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/logs-my_app-default/_ilm/remove\"", + "language": "curl" + } + ], "method_request": "POST logs-my_app-default/_ilm/remove" } }, @@ -133825,6 +138466,28 @@ "description": "Retry a policy.\nRetry running the lifecycle policy for an index that is in the ERROR step.\nThe API sets the policy back to the step where the error occurred and runs the step.\nUse the explain lifecycle state API to determine whether an index is in the ERROR step.", "examples": { "IlmRetryExample1": { + "alternatives": [ + { + "code": "resp = client.ilm.retry(\n index=\"my-index-000001\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ilm.retry({\n index: \"my-index-000001\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ilm.retry(\n index: \"my-index-000001\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ilm()->retry([\n \"index\" => \"my-index-000001\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_ilm/retry\"", + "language": "curl" + } + ], "method_request": "POST /my-index-000001/_ilm/retry" } }, @@ -133885,6 +138548,28 @@ "description": "Start the ILM plugin.\nStart the index lifecycle management plugin if it is currently stopped.\nILM is started automatically when the cluster is formed.\nRestarting ILM is necessary only when it has been stopped using the stop ILM API.", "examples": { "IlmStartExample1": { + "alternatives": [ + { + "code": "resp = client.ilm.start()", + "language": "Python" + }, + { + "code": "const response = await client.ilm.start();", + "language": "JavaScript" + }, + { + "code": "response = client.ilm.start", + "language": "Ruby" + }, + { + "code": "$resp = $client->ilm()->start();", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ilm/start\"", + "language": "curl" + } + ], "method_request": "POST _ilm/start" } }, @@ -133965,6 +138650,28 @@ "description": "Stop the ILM plugin.\nHalt all lifecycle management operations and stop the index lifecycle management plugin.\nThis is useful when you are performing maintenance on the cluster and need to prevent ILM from performing any actions on your indices.\n\nThe API returns as soon as the stop request has been acknowledged, but the plugin might continue to run until in-progress operations complete and the plugin can be safely stopped.\nUse the get ILM status API to check whether ILM is running.", "examples": { "IlmStopExample1": { + "alternatives": [ + { + "code": "resp = client.ilm.stop()", + "language": "Python" + }, + { + "code": "const response = await client.ilm.stop();", + "language": "JavaScript" + }, + { + "code": "response = client.ilm.stop", + "language": "Ruby" + }, + { + "code": "$resp = $client->ilm()->stop();", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ilm/stop\"", + "language": "curl" + } + ], "method_request": "POST _ilm/stop" } }, @@ -138648,6 +143355,28 @@ "description": "Add an index block.\n\nAdd an index block to an index.\nIndex blocks limit the operations allowed on an index by blocking specific operation types.", "examples": { "IndicesAddBlockRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.add_block(\n index=\"my-index-000001\",\n block=\"write\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.addBlock({\n index: \"my-index-000001\",\n block: \"write\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.add_block(\n index: \"my-index-000001\",\n block: \"write\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->addBlock([\n \"index\" => \"my-index-000001\",\n \"block\" => \"write\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_block/write\"", + "language": "curl" + } + ], "method_request": "PUT /my-index-000001/_block/write" } }, @@ -139305,42 +144034,196 @@ "description": "Get tokens from text analysis.\nThe analyze API performs analysis on a text string and returns the resulting tokens.\n\nGenerating excessive amount of tokens may cause a node to run out of memory.\nThe `index.analyze.max_token_count` setting enables you to limit the number of tokens that can be produced.\nIf more than this limit of tokens gets generated, an error occurs.\nThe `_analyze` endpoint without a specified index will always use `10000` as its limit.", "examples": { "indicesAnalyzeRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.analyze(\n analyzer=\"standard\",\n text=\"this is a test\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.analyze({\n analyzer: \"standard\",\n text: \"this is a test\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.analyze(\n body: {\n \"analyzer\": \"standard\",\n \"text\": \"this is a test\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->analyze([\n \"body\" => [\n \"analyzer\" => \"standard\",\n \"text\" => \"this is a test\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"analyzer\":\"standard\",\"text\":\"this is a test\"}' \"$ELASTICSEARCH_URL/_analyze\"", + "language": "curl" + } + ], "description": "You can apply any of the built-in analyzers to the text string without specifying an index.", "method_request": "GET /_analyze", "summary": "No index specified", "value": "{\n \"analyzer\": \"standard\",\n \"text\": \"this is a test\"\n}" }, "indicesAnalyzeRequestExample2": { + "alternatives": [ + { + "code": "resp = client.indices.analyze(\n analyzer=\"standard\",\n text=[\n \"this is a test\",\n \"the second text\"\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.analyze({\n analyzer: \"standard\",\n text: [\"this is a test\", \"the second text\"],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.analyze(\n body: {\n \"analyzer\": \"standard\",\n \"text\": [\n \"this is a test\",\n \"the second text\"\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->analyze([\n \"body\" => [\n \"analyzer\" => \"standard\",\n \"text\" => array(\n \"this is a test\",\n \"the second text\",\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"analyzer\":\"standard\",\"text\":[\"this is a test\",\"the second text\"]}' \"$ELASTICSEARCH_URL/_analyze\"", + "language": "curl" + } + ], "description": "If the text parameter is provided as array of strings, it is analyzed as a multi-value field.", "method_request": "GET /_analyze", "summary": "An array of text strings", "value": "{\n \"analyzer\": \"standard\",\n \"text\": [\n \"this is a test\",\n \"the second text\"\n ]\n}" }, "indicesAnalyzeRequestExample3": { + "alternatives": [ + { + "code": "resp = client.indices.analyze(\n tokenizer=\"keyword\",\n filter=[\n \"lowercase\"\n ],\n char_filter=[\n \"html_strip\"\n ],\n text=\"this is a test\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.analyze({\n tokenizer: \"keyword\",\n filter: [\"lowercase\"],\n char_filter: [\"html_strip\"],\n text: \"this is a test\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.analyze(\n body: {\n \"tokenizer\": \"keyword\",\n \"filter\": [\n \"lowercase\"\n ],\n \"char_filter\": [\n \"html_strip\"\n ],\n \"text\": \"this is a test\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->analyze([\n \"body\" => [\n \"tokenizer\" => \"keyword\",\n \"filter\" => array(\n \"lowercase\",\n ),\n \"char_filter\" => array(\n \"html_strip\",\n ),\n \"text\" => \"this is a test\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"tokenizer\":\"keyword\",\"filter\":[\"lowercase\"],\"char_filter\":[\"html_strip\"],\"text\":\"this is a test\"}' \"$ELASTICSEARCH_URL/_analyze\"", + "language": "curl" + } + ], "description": "You can test a custom transient analyzer built from tokenizers, token filters, and char filters. Token filters use the filter parameter.", "method_request": "GET /_analyze", "summary": "Custom analyzer example 1", "value": "{\n \"tokenizer\": \"keyword\",\n \"filter\": [\n \"lowercase\"\n ],\n \"char_filter\": [\n \"html_strip\"\n ],\n \"text\": \"this is a test\"\n}" }, "indicesAnalyzeRequestExample4": { + "alternatives": [ + { + "code": "resp = client.indices.analyze(\n tokenizer=\"whitespace\",\n filter=[\n \"lowercase\",\n {\n \"type\": \"stop\",\n \"stopwords\": [\n \"a\",\n \"is\",\n \"this\"\n ]\n }\n ],\n text=\"this is a test\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.analyze({\n tokenizer: \"whitespace\",\n filter: [\n \"lowercase\",\n {\n type: \"stop\",\n stopwords: [\"a\", \"is\", \"this\"],\n },\n ],\n text: \"this is a test\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.analyze(\n body: {\n \"tokenizer\": \"whitespace\",\n \"filter\": [\n \"lowercase\",\n {\n \"type\": \"stop\",\n \"stopwords\": [\n \"a\",\n \"is\",\n \"this\"\n ]\n }\n ],\n \"text\": \"this is a test\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->analyze([\n \"body\" => [\n \"tokenizer\" => \"whitespace\",\n \"filter\" => array(\n \"lowercase\",\n [\n \"type\" => \"stop\",\n \"stopwords\" => array(\n \"a\",\n \"is\",\n \"this\",\n ),\n ],\n ),\n \"text\" => \"this is a test\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"tokenizer\":\"whitespace\",\"filter\":[\"lowercase\",{\"type\":\"stop\",\"stopwords\":[\"a\",\"is\",\"this\"]}],\"text\":\"this is a test\"}' \"$ELASTICSEARCH_URL/_analyze\"", + "language": "curl" + } + ], "description": "Custom tokenizers, token filters, and character filters can be specified in the request body.", "method_request": "GET /_analyze", "summary": "Custom analyzer example 2", "value": "{\n \"tokenizer\": \"whitespace\",\n \"filter\": [\n \"lowercase\",\n {\n \"type\": \"stop\",\n \"stopwords\": [\n \"a\",\n \"is\",\n \"this\"\n ]\n }\n ],\n \"text\": \"this is a test\"\n}" }, "indicesAnalyzeRequestExample5": { + "alternatives": [ + { + "code": "resp = client.indices.analyze(\n index=\"analyze_sample\",\n field=\"obj1.field1\",\n text=\"this is a test\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.analyze({\n index: \"analyze_sample\",\n field: \"obj1.field1\",\n text: \"this is a test\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.analyze(\n index: \"analyze_sample\",\n body: {\n \"field\": \"obj1.field1\",\n \"text\": \"this is a test\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->analyze([\n \"index\" => \"analyze_sample\",\n \"body\" => [\n \"field\" => \"obj1.field1\",\n \"text\" => \"this is a test\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"field\":\"obj1.field1\",\"text\":\"this is a test\"}' \"$ELASTICSEARCH_URL/analyze_sample/_analyze\"", + "language": "curl" + } + ], "description": "Run `GET /analyze_sample/_analyze` to run an analysis on the text using the default index analyzer associated with the `analyze_sample` index. Alternatively, the analyzer can be derived based on a field mapping.", "method_request": "GET /analyze_sample/_analyze", "summary": "Derive analyzer from field mapping", "value": "{\n \"field\": \"obj1.field1\",\n \"text\": \"this is a test\"\n}" }, "indicesAnalyzeRequestExample6": { + "alternatives": [ + { + "code": "resp = client.indices.analyze(\n index=\"analyze_sample\",\n normalizer=\"my_normalizer\",\n text=\"BaR\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.analyze({\n index: \"analyze_sample\",\n normalizer: \"my_normalizer\",\n text: \"BaR\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.analyze(\n index: \"analyze_sample\",\n body: {\n \"normalizer\": \"my_normalizer\",\n \"text\": \"BaR\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->analyze([\n \"index\" => \"analyze_sample\",\n \"body\" => [\n \"normalizer\" => \"my_normalizer\",\n \"text\" => \"BaR\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"normalizer\":\"my_normalizer\",\"text\":\"BaR\"}' \"$ELASTICSEARCH_URL/analyze_sample/_analyze\"", + "language": "curl" + } + ], "description": "Run `GET /analyze_sample/_analyze` and supply a normalizer for a keyword field if there is a normalizer associated with the specified index.", "method_request": "GET /analyze_sample/_analyze", "summary": "Normalizer", "value": "{\n \"normalizer\": \"my_normalizer\",\n \"text\": \"BaR\"\n}" }, "indicesAnalyzeRequestExample7": { + "alternatives": [ + { + "code": "resp = client.indices.analyze(\n tokenizer=\"standard\",\n filter=[\n \"snowball\"\n ],\n text=\"detailed output\",\n explain=True,\n attributes=[\n \"keyword\"\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.analyze({\n tokenizer: \"standard\",\n filter: [\"snowball\"],\n text: \"detailed output\",\n explain: true,\n attributes: [\"keyword\"],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.analyze(\n body: {\n \"tokenizer\": \"standard\",\n \"filter\": [\n \"snowball\"\n ],\n \"text\": \"detailed output\",\n \"explain\": true,\n \"attributes\": [\n \"keyword\"\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->analyze([\n \"body\" => [\n \"tokenizer\" => \"standard\",\n \"filter\" => array(\n \"snowball\",\n ),\n \"text\" => \"detailed output\",\n \"explain\" => true,\n \"attributes\" => array(\n \"keyword\",\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"tokenizer\":\"standard\",\"filter\":[\"snowball\"],\"text\":\"detailed output\",\"explain\":true,\"attributes\":[\"keyword\"]}' \"$ELASTICSEARCH_URL/_analyze\"", + "language": "curl" + } + ], "description": "If you want to get more advanced details, set `explain` to `true`. It will output all token attributes for each token. You can filter token attributes you want to output by setting the `attributes` option. NOTE: The format of the additional detail information is labelled as experimental in Lucene and it may change in the future.\n", "method_request": "GET /_analyze", "summary": "Explain analysis", @@ -139511,6 +144394,28 @@ "description": "Cancel a migration reindex operation.\n\nCancel a migration reindex attempt for a data stream or index.", "examples": { "IndicesCancelMigrateReindexExample1": { + "alternatives": [ + { + "code": "resp = client.perform_request(\n \"POST\",\n \"/_migration/reindex/my-data-stream/_cancel\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.transport.request({\n method: \"POST\",\n path: \"/_migration/reindex/my-data-stream/_cancel\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.perform_request(\n \"POST\",\n \"/_migration/reindex/my-data-stream/_cancel\",\n {},\n)", + "language": "Ruby" + }, + { + "code": "$requestFactory = Psr17FactoryDiscovery::findRequestFactory();\n$request = $requestFactory->createRequest(\n \"POST\",\n \"/_migration/reindex/my-data-stream/_cancel\",\n);\n$resp = $client->sendRequest($request);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_migration/reindex/my-data-stream/_cancel\"", + "language": "curl" + } + ], "method_request": "POST /_migration/reindex/my-data-stream/_cancel" } }, @@ -139571,6 +144476,28 @@ "description": "Clear the cache.\nClear the cache of one or more indices.\nFor data streams, the API clears the caches of the stream's backing indices.\n\nBy default, the clear cache API clears all caches.\nTo clear only specific caches, use the `fielddata`, `query`, or `request` parameters.\nTo clear the cache only of specific fields, use the `fields` parameter.", "examples": { "IndicesClearCacheExample1": { + "alternatives": [ + { + "code": "resp = client.indices.clear_cache(\n index=\"my-index-000001,my-index-000002\",\n request=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.clearCache({\n index: \"my-index-000001,my-index-000002\",\n request: \"true\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.clear_cache(\n index: \"my-index-000001,my-index-000002\",\n request: \"true\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->clearCache([\n \"index\" => \"my-index-000001,my-index-000002\",\n \"request\" => \"true\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001,my-index-000002/_cache/clear?request=true\"", + "language": "curl" + } + ], "method_request": "POST /my-index-000001,my-index-000002/_cache/clear?request=true" } }, @@ -139777,6 +144704,28 @@ "description": "Clone an index.\nClone an existing index into a new index.\nEach original primary shard is cloned into a new primary shard in the new index.\n\nIMPORTANT: Elasticsearch does not apply index templates to the resulting index.\nThe API also does not copy index metadata from the original index.\nIndex metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information.\nFor example, if you clone a CCR follower index, the resulting clone will not be a follower index.\n\nThe clone API copies most index settings from the source index to the resulting index, with the exception of `index.number_of_replicas` and `index.auto_expand_replicas`.\nTo set the number of replicas in the resulting index, configure these settings in the clone request.\n\nCloning works as follows:\n\n* First, it creates a new target index with the same definition as the source index.\n* Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process.\n* Finally, it recovers the target index as though it were a closed index which had just been re-opened.\n\nIMPORTANT: Indices can only be cloned if they meet the following requirements:\n\n* The index must be marked as read-only and have a cluster health status of green.\n* The target index must not exist.\n* The source index must have the same number of primary shards as the target index.\n* The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index.\n\nThe current write index on a data stream cannot be cloned.\nIn order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned.\n\nNOTE: Mappings cannot be specified in the `_clone` request. The mappings of the source index will be used for the target index.\n\n**Monitor the cloning process**\n\nThe cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the `wait_for_status` parameter to `yellow`.\n\nThe `_clone` API returns as soon as the target index has been added to the cluster state, before any shards have been allocated.\nAt this point, all shards are in the state unassigned.\nIf, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node.\n\nOnce the primary shard is allocated, it moves to state initializing, and the clone process begins.\nWhen the clone operation completes, the shard will become active.\nAt that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node.\n\n**Wait for active shards**\n\nBecause the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well.", "examples": { "indicesCloneRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.clone(\n index=\"my_source_index\",\n target=\"my_target_index\",\n settings={\n \"index.number_of_shards\": 5\n },\n aliases={\n \"my_search_indices\": {}\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.clone({\n index: \"my_source_index\",\n target: \"my_target_index\",\n settings: {\n \"index.number_of_shards\": 5,\n },\n aliases: {\n my_search_indices: {},\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.clone(\n index: \"my_source_index\",\n target: \"my_target_index\",\n body: {\n \"settings\": {\n \"index.number_of_shards\": 5\n },\n \"aliases\": {\n \"my_search_indices\": {}\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->clone([\n \"index\" => \"my_source_index\",\n \"target\" => \"my_target_index\",\n \"body\" => [\n \"settings\" => [\n \"index.number_of_shards\" => 5,\n ],\n \"aliases\" => [\n \"my_search_indices\" => new ArrayObject([]),\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"settings\":{\"index.number_of_shards\":5},\"aliases\":{\"my_search_indices\":{}}}' \"$ELASTICSEARCH_URL/my_source_index/_clone/my_target_index\"", + "language": "curl" + } + ], "description": "Clone `my_source_index` into a new index called `my_target_index` with `POST /my_source_index/_clone/my_target_index`. The API accepts `settings` and `aliases` parameters for the target index.\n", "method_request": "POST /my_source_index/_clone/my_target_index", "summary": "Clone an existing index.", @@ -139988,6 +144937,28 @@ "description": "Close an index.\nA closed index is blocked for read or write operations and does not allow all operations that opened indices allow.\nIt is not possible to index documents or to search for documents in a closed index.\nClosed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster.\n\nWhen opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index.\nThe shards will then go through the normal recovery process.\nThe data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times.\n\nYou can open and close multiple indices.\nAn error is thrown if the request explicitly refers to a missing index.\nThis behaviour can be turned off using the `ignore_unavailable=true` parameter.\n\nBy default, you must explicitly name the indices you are opening or closing.\nTo open or close indices with `_all`, `*`, or other wildcard expressions, change the` action.destructive_requires_name` setting to `false`. This setting can also be changed with the cluster update settings API.\n\nClosed indices consume a significant amount of disk-space which can cause problems in managed environments.\nClosing indices can be turned off with the cluster settings API by setting `cluster.indices.close.enable` to `false`.", "examples": { "CloseIndexRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.close(\n index=\"my-index-00001\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.close({\n index: \"my-index-00001\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.close(\n index: \"my-index-00001\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->close([\n \"index\" => \"my-index-00001\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-00001/_close\"", + "language": "curl" + } + ], "method_request": "POST /my-index-00001/_close" } }, @@ -140222,18 +145193,84 @@ "description": "Create an index.\nYou can use the create index API to add a new index to an Elasticsearch cluster.\nWhen creating an index, you can specify the following:\n\n* Settings for the index.\n* Mappings for fields in the index.\n* Index aliases\n\n**Wait for active shards**\n\nBy default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out.\nThe index creation response will indicate what happened.\nFor example, `acknowledged` indicates whether the index was successfully created in the cluster, `while shards_acknowledged` indicates whether the requisite number of shard copies were started for each shard in the index before timing out.\nNote that it is still possible for either `acknowledged` or `shards_acknowledged` to be `false`, but for the index creation to be successful.\nThese values simply indicate whether the operation completed before the timeout.\nIf `acknowledged` is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon.\nIf `shards_acknowledged` is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, `acknowledged` is `true`).\n\nYou can change the default of only waiting for the primary shards to start through the index setting `index.write.wait_for_active_shards`.\nNote that changing this setting will also affect the `wait_for_active_shards` value on all subsequent write operations.", "examples": { "indicesCreateRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.create(\n index=\"my-index-000001\",\n settings={\n \"number_of_shards\": 3,\n \"number_of_replicas\": 2\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.create({\n index: \"my-index-000001\",\n settings: {\n number_of_shards: 3,\n number_of_replicas: 2,\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.create(\n index: \"my-index-000001\",\n body: {\n \"settings\": {\n \"number_of_shards\": 3,\n \"number_of_replicas\": 2\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->create([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"settings\" => [\n \"number_of_shards\" => 3,\n \"number_of_replicas\" => 2,\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"settings\":{\"number_of_shards\":3,\"number_of_replicas\":2}}' \"$ELASTICSEARCH_URL/my-index-000001\"", + "language": "curl" + } + ], "description": "This request specifies the `number_of_shards` and `number_of_replicas`.", "method_request": "PUT /my-index-000001", "summary": "Create an index.", "value": "{\n \"settings\": {\n \"number_of_shards\": 3,\n \"number_of_replicas\": 2\n }\n}" }, "indicesCreateRequestExample2": { + "alternatives": [ + { + "code": "resp = client.indices.create(\n index=\"test\",\n settings={\n \"number_of_shards\": 1\n },\n mappings={\n \"properties\": {\n \"field1\": {\n \"type\": \"text\"\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.create({\n index: \"test\",\n settings: {\n number_of_shards: 1,\n },\n mappings: {\n properties: {\n field1: {\n type: \"text\",\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.create(\n index: \"test\",\n body: {\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"mappings\": {\n \"properties\": {\n \"field1\": {\n \"type\": \"text\"\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->create([\n \"index\" => \"test\",\n \"body\" => [\n \"settings\" => [\n \"number_of_shards\" => 1,\n ],\n \"mappings\" => [\n \"properties\" => [\n \"field1\" => [\n \"type\" => \"text\",\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"settings\":{\"number_of_shards\":1},\"mappings\":{\"properties\":{\"field1\":{\"type\":\"text\"}}}}' \"$ELASTICSEARCH_URL/test\"", + "language": "curl" + } + ], "description": "You can provide mapping definitions in the create index API requests.", "method_request": "PUT /test", "summary": "Create an index with mappings.", "value": "{\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"mappings\": {\n \"properties\": {\n \"field1\": { \"type\": \"text\" }\n }\n }\n}" }, "indicesCreateRequestExample3": { + "alternatives": [ + { + "code": "resp = client.indices.create(\n index=\"test\",\n aliases={\n \"alias_1\": {},\n \"alias_2\": {\n \"filter\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n \"routing\": \"shard-1\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.create({\n index: \"test\",\n aliases: {\n alias_1: {},\n alias_2: {\n filter: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n routing: \"shard-1\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.create(\n index: \"test\",\n body: {\n \"aliases\": {\n \"alias_1\": {},\n \"alias_2\": {\n \"filter\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n \"routing\": \"shard-1\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->create([\n \"index\" => \"test\",\n \"body\" => [\n \"aliases\" => [\n \"alias_1\" => new ArrayObject([]),\n \"alias_2\" => [\n \"filter\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n \"routing\" => \"shard-1\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"aliases\":{\"alias_1\":{},\"alias_2\":{\"filter\":{\"term\":{\"user.id\":\"kimchy\"}},\"routing\":\"shard-1\"}}}' \"$ELASTICSEARCH_URL/test\"", + "language": "curl" + } + ], "description": "You can provide mapping definitions in the create index API requests. Index alias names also support date math.\n", "method_request": "PUT /test", "summary": "Create an index with aliases.", @@ -140364,6 +145401,28 @@ "description": "Create a data stream.\n\nYou must have a matching index template with data stream enabled.", "examples": { "IndicesCreateDataStreamExample1": { + "alternatives": [ + { + "code": "resp = client.indices.create_data_stream(\n name=\"logs-foo-bar\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.createDataStream({\n name: \"logs-foo-bar\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.create_data_stream(\n name: \"logs-foo-bar\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->createDataStream([\n \"name\" => \"logs-foo-bar\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/logs-foo-bar\"", + "language": "curl" + } + ], "method_request": "PUT _data_stream/logs-foo-bar" } }, @@ -140506,6 +145565,28 @@ "description": "Create an index from a source index.\n\nCopy the mappings and settings from the source index to a destination index while allowing request settings and mappings to override the source values.", "examples": { "IndicesCreateFromExample1": { + "alternatives": [ + { + "code": "resp = client.perform_request(\n \"POST\",\n \"/_create_from/my-index/my-new-index\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.transport.request({\n method: \"POST\",\n path: \"/_create_from/my-index/my-new-index\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.perform_request(\n \"POST\",\n \"/_create_from/my-index/my-new-index\",\n {},\n)", + "language": "Ruby" + }, + { + "code": "$requestFactory = Psr17FactoryDiscovery::findRequestFactory();\n$request = $requestFactory->createRequest(\n \"POST\",\n \"/_create_from/my-index/my-new-index\",\n);\n$resp = $client->sendRequest($request);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_create_from/my-index/my-new-index\"", + "language": "curl" + } + ], "method_request": "POST _create_from/my-index/my-new-index" } }, @@ -140684,6 +145765,28 @@ "description": "Get data stream stats.\n\nGet statistics for one or more data streams.", "examples": { "indicesDataStreamStatsExampleRequest1": { + "alternatives": [ + { + "code": "resp = client.indices.data_streams_stats(\n name=\"my-index-000001\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.dataStreamsStats({\n name: \"my-index-000001\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.data_streams_stats(\n name: \"my-index-000001\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->dataStreamsStats([\n \"name\" => \"my-index-000001\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/my-index-000001/_stats\"", + "language": "curl" + } + ], "method_request": "GET /_data_stream/my-index-000001/_stats" } }, @@ -140833,6 +145936,28 @@ "description": "Delete indices.\nDeleting an index deletes its documents, shards, and metadata.\nIt does not delete related Kibana components, such as data views, visualizations, or dashboards.\n\nYou cannot delete the current write index of a data stream.\nTo delete the index, you must roll over the data stream so a new write index is created.\nYou can then use the delete index API to delete the previous write index.", "examples": { "IndicesDeleteExample1": { + "alternatives": [ + { + "code": "resp = client.indices.delete(\n index=\"books\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.delete({\n index: \"books\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.delete(\n index: \"books\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->delete([\n \"index\" => \"books\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/books\"", + "language": "curl" + } + ], "method_request": "DELETE /books" } }, @@ -140959,6 +146084,28 @@ "description": "Delete an alias.\nRemoves a data stream or index from an alias.", "examples": { "IndicesDeleteAliasExample1": { + "alternatives": [ + { + "code": "resp = client.indices.delete_alias(\n index=\"my-data-stream\",\n name=\"my-alias\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.deleteAlias({\n index: \"my-data-stream\",\n name: \"my-alias\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.delete_alias(\n index: \"my-data-stream\",\n name: \"my-alias\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->deleteAlias([\n \"index\" => \"my-data-stream\",\n \"name\" => \"my-alias\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-data-stream/_alias/my-alias\"", + "language": "curl" + } + ], "method_request": "DELETE my-data-stream/_alias/my-alias" } }, @@ -141058,6 +146205,28 @@ "description": "Delete data stream lifecycles.\nRemoves the data stream lifecycle from a data stream, rendering it not managed by the data stream lifecycle.", "examples": { "IndicesDeleteDataLifecycleExample1": { + "alternatives": [ + { + "code": "resp = client.indices.delete_data_lifecycle(\n name=\"my-data-stream\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.deleteDataLifecycle({\n name: \"my-data-stream\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.delete_data_lifecycle(\n name: \"my-data-stream\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->deleteDataLifecycle([\n \"name\" => \"my-data-stream\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/my-data-stream/_lifecycle\"", + "language": "curl" + } + ], "method_request": "DELETE _data_stream/my-data-stream/_lifecycle" } }, @@ -141161,6 +146330,28 @@ "description": "Delete data streams.\nDeletes one or more data streams and their backing indices.", "examples": { "IndicesDeleteDataStreamExample1": { + "alternatives": [ + { + "code": "resp = client.indices.delete_data_stream(\n name=\"my-data-stream\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.deleteDataStream({\n name: \"my-data-stream\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.delete_data_stream(\n name: \"my-data-stream\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->deleteDataStream([\n \"name\" => \"my-data-stream\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/my-data-stream\"", + "language": "curl" + } + ], "method_request": "DELETE _data_stream/my-data-stream" } }, @@ -141248,6 +146439,28 @@ "description": "Delete an index template.\nThe provided may contain multiple template names separated by a comma. If multiple template\nnames are specified then there is no wildcard support and the provided names should match completely with\nexisting templates.", "examples": { "IndicesDeleteIndexTemplateExample1": { + "alternatives": [ + { + "code": "resp = client.indices.delete_index_template(\n name=\"my-index-template\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.deleteIndexTemplate({\n name: \"my-index-template\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.delete_index_template(\n name: \"my-index-template\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->deleteIndexTemplate([\n \"name\" => \"my-index-template\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_index_template/my-index-template\"", + "language": "curl" + } + ], "method_request": "DELETE /_index_template/my-index-template" } }, @@ -141339,6 +146552,28 @@ "description": "Delete a legacy index template.\nIMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.", "examples": { "IndicesDeleteTemplateExample1": { + "alternatives": [ + { + "code": "resp = client.indices.delete_template(\n name=\".cloud-hot-warm-allocation-0\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.deleteTemplate({\n name: \".cloud-hot-warm-allocation-0\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.delete_template(\n name: \".cloud-hot-warm-allocation-0\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->deleteTemplate([\n \"name\" => \".cloud-hot-warm-allocation-0\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_template/.cloud-hot-warm-allocation-0\"", + "language": "curl" + } + ], "method_request": "DELETE _template/.cloud-hot-warm-allocation-0" } }, @@ -141426,6 +146661,28 @@ "description": "Analyze the index disk usage.\nAnalyze the disk usage of each field of an index or data stream.\nThis API might not support indices created in previous Elasticsearch versions.\nThe result of a small index can be inaccurate as some parts of an index might not be analyzed by the API.\n\nNOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index `store_size` value because some small metadata files are ignored and some parts of data files might not be scanned by the API.\nSince stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate.\nThe stored size of the `_id` field is likely underestimated while the `_source` field is overestimated.", "examples": { "IndicesDiskUsageExample1": { + "alternatives": [ + { + "code": "resp = client.indices.disk_usage(\n index=\"my-index-000001\",\n run_expensive_tasks=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.diskUsage({\n index: \"my-index-000001\",\n run_expensive_tasks: \"true\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.disk_usage(\n index: \"my-index-000001\",\n run_expensive_tasks: \"true\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->diskUsage([\n \"index\" => \"my-index-000001\",\n \"run_expensive_tasks\" => \"true\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_disk_usage?run_expensive_tasks=true\"", + "language": "curl" + } + ], "method_request": "POST /my-index-000001/_disk_usage?run_expensive_tasks=true" } }, @@ -141556,6 +146813,28 @@ "description": "Downsample an index.\nAggregate a time series (TSDS) index and store pre-computed statistical summaries (`min`, `max`, `sum`, `value_count` and `avg`) for each metric field grouped by a configured time interval.\nFor example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index.\nAll documents within an hour interval are summarized and stored as a single document in the downsample index.\n\nNOTE: Only indices in a time series data stream are supported.\nNeither field nor document level security can be defined on the source index.\nThe source index must be read only (`index.blocks.write: true`).", "examples": { "DownsampleRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.downsample(\n index=\"my-time-series-index\",\n target_index=\"my-downsampled-time-series-index\",\n config={\n \"fixed_interval\": \"1d\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.downsample({\n index: \"my-time-series-index\",\n target_index: \"my-downsampled-time-series-index\",\n config: {\n fixed_interval: \"1d\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.downsample(\n index: \"my-time-series-index\",\n target_index: \"my-downsampled-time-series-index\",\n body: {\n \"fixed_interval\": \"1d\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->downsample([\n \"index\" => \"my-time-series-index\",\n \"target_index\" => \"my-downsampled-time-series-index\",\n \"body\" => [\n \"fixed_interval\" => \"1d\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"fixed_interval\":\"1d\"}' \"$ELASTICSEARCH_URL/my-time-series-index/_downsample/my-downsampled-time-series-index\"", + "language": "curl" + } + ], "method_request": "POST /my-time-series-index/_downsample/my-downsampled-time-series-index", "value": "{\n \"fixed_interval\": \"1d\"\n}" } @@ -141625,6 +146904,28 @@ "description": "Check indices.\nCheck if one or more indices, index aliases, or data streams exist.", "examples": { "IndicesExistsExample1": { + "alternatives": [ + { + "code": "resp = client.indices.exists(\n index=\"my-data-stream\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.exists({\n index: \"my-data-stream\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.exists(\n index: \"my-data-stream\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->exists([\n \"index\" => \"my-data-stream\",\n]);", + "language": "PHP" + }, + { + "code": "curl --head -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-data-stream\"", + "language": "curl" + } + ], "method_request": "HEAD my-data-stream" } }, @@ -141756,6 +147057,28 @@ "description": "Check aliases.\n\nCheck if one or more data stream or index aliases exist.", "examples": { "IndicesExistsAliasExample1": { + "alternatives": [ + { + "code": "resp = client.indices.exists_alias(\n name=\"my-alias\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.existsAlias({\n name: \"my-alias\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.exists_alias(\n name: \"my-alias\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->existsAlias([\n \"name\" => \"my-alias\",\n]);", + "language": "PHP" + }, + { + "code": "curl --head -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_alias/my-alias\"", + "language": "curl" + } + ], "method_request": "HEAD _alias/my-alias" } }, @@ -141960,6 +147283,28 @@ "description": "Check existence of index templates.\nGet information about whether index templates exist.\nIndex templates define settings, mappings, and aliases that can be applied automatically to new indices.\n\nIMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.", "examples": { "IndicesExistsTemplateExample1": { + "alternatives": [ + { + "code": "resp = client.indices.exists_template(\n name=\"template_1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.existsTemplate({\n name: \"template_1\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.exists_template(\n name: \"template_1\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->existsTemplate([\n \"name\" => \"template_1\",\n]);", + "language": "PHP" + }, + { + "code": "curl --head -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_template/template_1\"", + "language": "curl" + } + ], "method_request": "HEAD /_template/template_1" } }, @@ -142179,6 +147524,28 @@ "description": "Get the status for a data stream lifecycle.\nGet 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.", "examples": { "IndicesExplainDataLifecycleRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.explain_data_lifecycle(\n index=\".ds-metrics-2023.03.22-000001\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.explainDataLifecycle({\n index: \".ds-metrics-2023.03.22-000001\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.explain_data_lifecycle(\n index: \".ds-metrics-2023.03.22-000001\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->explainDataLifecycle([\n \"index\" => \".ds-metrics-2023.03.22-000001\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/.ds-metrics-2023.03.22-000001/_lifecycle/explain\"", + "language": "curl" + } + ], "method_request": "GET .ds-metrics-2023.03.22-000001/_lifecycle/explain" } }, @@ -142529,6 +147896,28 @@ "description": "Get field usage stats.\nGet field usage information for each shard and field of an index.\nField usage statistics are automatically captured when queries are running on a cluster.\nA shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use.\n\nThe response body reports the per-shard usage count of the data structures that back the fields in the index.\nA given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times.", "examples": { "indicesFieldUsageStatsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.field_usage_stats(\n index=\"my-index-000001\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.fieldUsageStats({\n index: \"my-index-000001\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.field_usage_stats(\n index: \"my-index-000001\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->fieldUsageStats([\n \"index\" => \"my-index-000001\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_field_usage_stats\"", + "language": "curl" + } + ], "method_request": "GET /my-index-000001/_field_usage_stats" } }, @@ -142775,6 +148164,28 @@ "description": "Flush data streams or indices.\nFlushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index.\nWhen restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart.\nElasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush.\n\nAfter each operation has been flushed it is permanently stored in the Lucene index.\nThis may mean that there is no need to maintain an additional copy of it in the transaction log.\nThe transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space.\n\nIt is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly.\nIf you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called.", "examples": { "IndicesFlushExample1": { + "alternatives": [ + { + "code": "resp = client.indices.flush()", + "language": "Python" + }, + { + "code": "const response = await client.indices.flush();", + "language": "JavaScript" + }, + { + "code": "response = client.indices.flush", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->flush();", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_flush\"", + "language": "curl" + } + ], "method_request": "POST /_flush" } }, @@ -142901,6 +148312,28 @@ "description": "Force a merge.\nPerform the force merge operation on the shards of one or more indices.\nFor data streams, the API forces a merge on the shards of the stream's backing indices.\n\nMerging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents.\nMerging normally happens automatically, but sometimes it is useful to trigger a merge manually.\n\nWARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes).\nWhen documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a \"tombstone\".\nThese soft-deleted documents are automatically cleaned up during regular segment merges.\nBut force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges.\nSo the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance.\nIf you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally.\n\n**Blocks during a force merge**\n\nCalls to this API block until the merge is complete (unless request contains `wait_for_completion=false`).\nIf the client connection is lost before completion then the force merge process will continue in the background.\nAny new requests to force merge the same indices will also block until the ongoing force merge is complete.\n\n**Running force merge asynchronously**\n\nIf the request contains `wait_for_completion=false`, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task.\nHowever, you can not cancel this task as the force merge task is not cancelable.\nElasticsearch creates a record of this task as a document at `_tasks/`.\nWhen you are done with a task, you should delete the task document so Elasticsearch can reclaim the space.\n\n**Force merging multiple indices**\n\nYou can force merge multiple indices with a single request by targeting:\n\n* One or more data streams that contain multiple backing indices\n* Multiple indices\n* One or more aliases\n* All data streams and indices in a cluster\n\nEach targeted shard is force-merged separately using the force_merge threadpool.\nBy default each node only has a single `force_merge` thread which means that the shards on that node are force-merged one at a time.\nIf you expand the `force_merge` threadpool on a node then it will force merge its shards in parallel\n\nForce merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case `max_num_segments parameter` is set to `1`, to rewrite all segments into a new one.\n\n**Data streams and time-based indices**\n\nForce-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover.\nIn these cases, each index only receives indexing traffic for a certain period of time.\nOnce an index receive no more writes, its shards can be force-merged to a single segment.\nThis can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches.\nFor example:\n\n```\nPOST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1\n```", "examples": { "IndicesForcemergeExample1": { + "alternatives": [ + { + "code": "resp = client.indices.forcemerge(\n index=\"my-index-000001\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.forcemerge({\n index: \"my-index-000001\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.forcemerge(\n index: \"my-index-000001\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->forcemerge([\n \"index\" => \"my-index-000001\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_forcemerge\"", + "language": "curl" + } + ], "method_request": "POST my-index-000001/_forcemerge" } }, @@ -143123,6 +148556,28 @@ "description": "Get index information.\nGet information about one or more indices. For data streams, the API returns information about the\nstream’s backing indices.", "examples": { "IndicesGetExample1": { + "alternatives": [ + { + "code": "resp = client.indices.get(\n index=\"my-index-000001\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.get({\n index: \"my-index-000001\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.get(\n index: \"my-index-000001\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->get([\n \"index\" => \"my-index-000001\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001\"", + "language": "curl" + } + ], "method_request": "GET /my-index-000001" } }, @@ -143337,6 +148792,28 @@ "description": "Get aliases.\nRetrieves information for one or more data stream or index aliases.", "examples": { "IndicesGetAliasExample1": { + "alternatives": [ + { + "code": "resp = client.indices.get_alias()", + "language": "Python" + }, + { + "code": "const response = await client.indices.getAlias();", + "language": "JavaScript" + }, + { + "code": "response = client.indices.get_alias", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->getAlias();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_alias\"", + "language": "curl" + } + ], "method_request": "GET _alias" } }, @@ -143534,6 +149011,28 @@ "description": "Get data stream lifecycles.\n\nGet the data stream lifecycle configuration of one or more data streams.", "examples": { "IndicesGetDataLifecycleRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.get_data_lifecycle(\n name=\"{name}\",\n human=True,\n pretty=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.getDataLifecycle({\n name: \"{name}\",\n human: \"true\",\n pretty: \"true\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.get_data_lifecycle(\n name: \"{name}\",\n human: \"true\",\n pretty: \"true\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->getDataLifecycle([\n \"name\" => \"{name}\",\n \"human\" => \"true\",\n \"pretty\" => \"true\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/%7Bname%7D/_lifecycle?human&pretty\"", + "language": "curl" + } + ], "method_request": "GET /_data_stream/{name}/_lifecycle?human&pretty" } }, @@ -143694,6 +149193,28 @@ "description": "Get data stream lifecycle stats.\nGet statistics about the data streams that are managed by a data stream lifecycle.", "examples": { "IndicesGetDataLifecycleStatsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.get_data_lifecycle_stats(\n human=True,\n pretty=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.getDataLifecycleStats({\n human: \"true\",\n pretty: \"true\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.get_data_lifecycle_stats(\n human: \"true\",\n pretty: \"true\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->getDataLifecycleStats([\n \"human\" => \"true\",\n \"pretty\" => \"true\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_lifecycle/stats?human&pretty\"", + "language": "curl" + } + ], "method_request": "GET _lifecycle/stats?human&pretty" } }, @@ -143810,6 +149331,28 @@ "description": "Get data streams.\n\nGet information about one or more data streams.", "examples": { "IndicesGetDataStreamExample1": { + "alternatives": [ + { + "code": "resp = client.indices.get_data_stream(\n name=\"my-data-stream\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.getDataStream({\n name: \"my-data-stream\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.get_data_stream(\n name: \"my-data-stream\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->getDataStream([\n \"name\" => \"my-data-stream\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/my-data-stream\"", + "language": "curl" + } + ], "method_request": "GET _data_stream/my-data-stream" } }, @@ -143946,6 +149489,28 @@ "description": "Get mapping definitions.\nRetrieves mapping definitions for one or more fields.\nFor data streams, the API retrieves field mappings for the stream’s backing indices.\n\nThis API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields.", "examples": { "indicesGetFieldMappingRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.get_field_mapping(\n index=\"publications\",\n fields=\"title\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.getFieldMapping({\n index: \"publications\",\n fields: \"title\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.get_field_mapping(\n index: \"publications\",\n fields: \"title\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->getFieldMapping([\n \"index\" => \"publications\",\n \"fields\" => \"title\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/publications/_mapping/field/title\"", + "language": "curl" + } + ], "method_request": "GET publications/_mapping/field/title" } }, @@ -144176,6 +149741,28 @@ "description": "Get index templates.\nGet information about one or more index templates.", "examples": { "IndicesGetIndexTemplateExample1": { + "alternatives": [ + { + "code": "resp = client.indices.get_index_template(\n name=\"*\",\n filter_path=\"index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.getIndexTemplate({\n name: \"*\",\n filter_path:\n \"index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.get_index_template(\n name: \"*\",\n filter_path: \"index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->getIndexTemplate([\n \"name\" => \"*\",\n \"filter_path\" => \"index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\"", + "language": "curl" + } + ], "method_request": "GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream" } }, @@ -144338,6 +149925,28 @@ "description": "Get mapping definitions.\nFor data streams, the API retrieves mappings for the stream’s backing indices.", "examples": { "IndicesGetMappingExample1": { + "alternatives": [ + { + "code": "resp = client.indices.get_mapping(\n index=\"books\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.getMapping({\n index: \"books\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.get_mapping(\n index: \"books\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->getMapping([\n \"index\" => \"books\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/books/_mapping\"", + "language": "curl" + } + ], "method_request": "GET /books/_mapping" } }, @@ -144479,6 +150088,28 @@ "description": "Get the migration reindexing status.\n\nGet the status of a migration reindex attempt for a data stream or index.", "examples": { "IndicesGetMigrateReindexStatusExample1": { + "alternatives": [ + { + "code": "resp = client.perform_request(\n \"GET\",\n \"/_migration/reindex/my-data-stream/_status\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.transport.request({\n method: \"GET\",\n path: \"/_migration/reindex/my-data-stream/_status\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.perform_request(\n \"GET\",\n \"/_migration/reindex/my-data-stream/_status\",\n {},\n)", + "language": "Ruby" + }, + { + "code": "$requestFactory = Psr17FactoryDiscovery::findRequestFactory();\n$request = $requestFactory->createRequest(\n \"GET\",\n \"/_migration/reindex/my-data-stream/_status\",\n);\n$resp = $client->sendRequest($request);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_migration/reindex/my-data-stream/_status\"", + "language": "curl" + } + ], "method_request": "GET /_migration/reindex/my-data-stream/_status" } }, @@ -144733,6 +150364,28 @@ "description": "Get index settings.\nGet setting information for one or more indices.\nFor data streams, it returns setting information for the stream's backing indices.", "examples": { "IndicesGetSettingsExample1": { + "alternatives": [ + { + "code": "resp = client.indices.get_settings(\n index=\"_all\",\n expand_wildcards=\"all\",\n filter_path=\"*.settings.index.*.slowlog\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.getSettings({\n index: \"_all\",\n expand_wildcards: \"all\",\n filter_path: \"*.settings.index.*.slowlog\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.get_settings(\n index: \"_all\",\n expand_wildcards: \"all\",\n filter_path: \"*.settings.index.*.slowlog\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->getSettings([\n \"index\" => \"_all\",\n \"expand_wildcards\" => \"all\",\n \"filter_path\" => \"*.settings.index.*.slowlog\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_all/_settings?expand_wildcards=all&filter_path=*.settings.index.*.slowlog\"", + "language": "curl" + } + ], "method_request": "GET _all/_settings?expand_wildcards=all&filter_path=*.settings.index.*.slowlog" } }, @@ -144912,6 +150565,28 @@ "description": "Get legacy index templates.\nGet information about one or more index templates.\n\nIMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.", "examples": { "IndicesGetTemplateExample1": { + "alternatives": [ + { + "code": "resp = client.indices.get_template(\n name=\".monitoring-*\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.getTemplate({\n name: \".monitoring-*\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.get_template(\n name: \".monitoring-*\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->getTemplate([\n \"name\" => \".monitoring-*\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_template/.monitoring-*\"", + "language": "curl" + } + ], "method_request": "GET /_template/.monitoring-*" } }, @@ -145078,6 +150753,28 @@ "description": "Reindex legacy backing indices.\n\nReindex all legacy backing indices for a data stream.\nThis operation occurs in a persistent task.\nThe persistent task ID is returned immediately and the reindexing work is completed in that task.", "examples": { "IndicesMigrateReindexExample1": { + "alternatives": [ + { + "code": "resp = client.perform_request(\n \"POST\",\n \"/_migration/reindex\",\n headers={\"Content-Type\": \"application/json\"},\n body={\n \"source\": {\n \"index\": \"my-data-stream\"\n },\n \"mode\": \"upgrade\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.transport.request({\n method: \"POST\",\n path: \"/_migration/reindex\",\n body: {\n source: {\n index: \"my-data-stream\",\n },\n mode: \"upgrade\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.perform_request(\n \"POST\",\n \"/_migration/reindex\",\n {},\n {\n \"source\": {\n \"index\": \"my-data-stream\"\n },\n \"mode\": \"upgrade\"\n },\n { \"Content-Type\": \"application/json\" },\n)", + "language": "Ruby" + }, + { + "code": "$requestFactory = Psr17FactoryDiscovery::findRequestFactory();\n$streamFactory = Psr17FactoryDiscovery::findStreamFactory();\n$request = $requestFactory->createRequest(\n \"POST\",\n \"/_migration/reindex\",\n);\n$request = $request->withHeader(\"Content-Type\", \"application/json\");\n$request = $request->withBody($streamFactory->createStream(\n json_encode([\n \"source\" => [\n \"index\" => \"my-data-stream\",\n ],\n \"mode\" => \"upgrade\",\n ]),\n));\n$resp = $client->sendRequest($request);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"my-data-stream\"},\"mode\":\"upgrade\"}' \"$ELASTICSEARCH_URL/_migration/reindex\"", + "language": "curl" + } + ], "description": "An example body for a `POST _migration/reindex` request.", "method_request": "POST _migration/reindex", "value": "{\n \"source\": {\n \"index\": \"my-data-stream\"\n },\n \"mode\": \"upgrade\"\n}" @@ -145148,6 +150845,28 @@ "description": "Convert an index alias to a data stream.\nConverts an index alias to a data stream.\nYou must have a matching index template that is data stream enabled.\nThe alias must meet the following criteria:\nThe alias must have a write index;\nAll indices for the alias must have a `@timestamp` field mapping of a `date` or `date_nanos` field type;\nThe alias must not have any filters;\nThe alias must not use custom routing.\nIf successful, the request removes the alias and creates a data stream with the same name.\nThe indices for the alias become hidden backing indices for the stream.\nThe write index for the alias becomes the write index for the stream.", "examples": { "IndicesMigrateToDataStreamExample1": { + "alternatives": [ + { + "code": "resp = client.indices.migrate_to_data_stream(\n name=\"my-time-series-data\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.migrateToDataStream({\n name: \"my-time-series-data\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.migrate_to_data_stream(\n name: \"my-time-series-data\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->migrateToDataStream([\n \"name\" => \"my-time-series-data\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/_migrate/my-time-series-data\"", + "language": "curl" + } + ], "method_request": "POST _data_stream/_migrate/my-time-series-data" } }, @@ -145323,6 +151042,28 @@ "description": "Update data streams.\nPerforms one or more data stream modification actions in a single atomic operation.", "examples": { "IndicesModifyDataStreamExample1": { + "alternatives": [ + { + "code": "resp = client.indices.modify_data_stream(\n actions=[\n {\n \"remove_backing_index\": {\n \"data_stream\": \"my-data-stream\",\n \"index\": \".ds-my-data-stream-2023.07.26-000001\"\n }\n },\n {\n \"add_backing_index\": {\n \"data_stream\": \"my-data-stream\",\n \"index\": \".ds-my-data-stream-2023.07.26-000001-downsample\"\n }\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.modifyDataStream({\n actions: [\n {\n remove_backing_index: {\n data_stream: \"my-data-stream\",\n index: \".ds-my-data-stream-2023.07.26-000001\",\n },\n },\n {\n add_backing_index: {\n data_stream: \"my-data-stream\",\n index: \".ds-my-data-stream-2023.07.26-000001-downsample\",\n },\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.modify_data_stream(\n body: {\n \"actions\": [\n {\n \"remove_backing_index\": {\n \"data_stream\": \"my-data-stream\",\n \"index\": \".ds-my-data-stream-2023.07.26-000001\"\n }\n },\n {\n \"add_backing_index\": {\n \"data_stream\": \"my-data-stream\",\n \"index\": \".ds-my-data-stream-2023.07.26-000001-downsample\"\n }\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->modifyDataStream([\n \"body\" => [\n \"actions\" => array(\n [\n \"remove_backing_index\" => [\n \"data_stream\" => \"my-data-stream\",\n \"index\" => \".ds-my-data-stream-2023.07.26-000001\",\n ],\n ],\n [\n \"add_backing_index\" => [\n \"data_stream\" => \"my-data-stream\",\n \"index\" => \".ds-my-data-stream-2023.07.26-000001-downsample\",\n ],\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"actions\":[{\"remove_backing_index\":{\"data_stream\":\"my-data-stream\",\"index\":\".ds-my-data-stream-2023.07.26-000001\"}},{\"add_backing_index\":{\"data_stream\":\"my-data-stream\",\"index\":\".ds-my-data-stream-2023.07.26-000001-downsample\"}}]}' \"$ELASTICSEARCH_URL/_data_stream/_modify\"", + "language": "curl" + } + ], "description": "An example body for a `POST _data_stream/_modify` request.", "method_request": "POST _data_stream/_modify", "value": "{\n \"actions\": [\n {\n \"remove_backing_index\": {\n \"data_stream\": \"my-data-stream\",\n \"index\": \".ds-my-data-stream-2023.07.26-000001\"\n }\n },\n {\n \"add_backing_index\": {\n \"data_stream\": \"my-data-stream\",\n \"index\": \".ds-my-data-stream-2023.07.26-000001-downsample\"\n }\n }\n ]\n}" @@ -145372,6 +151113,28 @@ "description": "Open a closed index.\nFor data streams, the API opens any closed backing indices.\n\nA closed index is blocked for read/write operations and does not allow all operations that opened indices allow.\nIt is not possible to index documents or to search for documents in a closed index.\nThis allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster.\n\nWhen opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index.\nThe shards will then go through the normal recovery process.\nThe data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times.\n\nYou can open and close multiple indices.\nAn error is thrown if the request explicitly refers to a missing index.\nThis behavior can be turned off by using the `ignore_unavailable=true` parameter.\n\nBy default, you must explicitly name the indices you are opening or closing.\nTo open or close indices with `_all`, `*`, or other wildcard expressions, change the `action.destructive_requires_name` setting to `false`.\nThis setting can also be changed with the cluster update settings API.\n\nClosed indices consume a significant amount of disk-space which can cause problems in managed environments.\nClosing indices can be turned off with the cluster settings API by setting `cluster.indices.close.enable` to `false`.\n\nBecause opening or closing an index allocates its shards, the `wait_for_active_shards` setting on index creation applies to the `_open` and `_close` index actions as well.", "examples": { "IndicesOpenExample1": { + "alternatives": [ + { + "code": "resp = client.indices.open(\n index=\".ds-my-data-stream-2099.03.07-000001\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.open({\n index: \".ds-my-data-stream-2099.03.07-000001\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.open(\n index: \".ds-my-data-stream-2099.03.07-000001\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->open([\n \"index\" => \".ds-my-data-stream-2099.03.07-000001\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/.ds-my-data-stream-2099.03.07-000001/_open/\"", + "language": "curl" + } + ], "method_request": "POST /.ds-my-data-stream-2099.03.07-000001/_open/" } }, @@ -145535,6 +151298,28 @@ "description": "Promote a data stream.\nPromote a data stream from a replicated data stream managed by cross-cluster replication (CCR) to a regular data stream.\n\nWith CCR auto following, a data stream from a remote cluster can be replicated to the local cluster.\nThese data streams can't be rolled over in the local cluster.\nThese replicated data streams roll over only if the upstream data stream rolls over.\nIn the event that the remote cluster is no longer available, the data stream in the local cluster can be promoted to a regular data stream, which allows these data streams to be rolled over in the local cluster.\n\nNOTE: When promoting a data stream, ensure the local cluster has a data stream enabled index template that matches the data stream.\nIf this is missing, the data stream will not be able to roll over until a matching index template is created.\nThis will affect the lifecycle management of the data stream and interfere with the data stream size and retention.", "examples": { "IndicesPromoteDataStreamExample1": { + "alternatives": [ + { + "code": "resp = client.indices.promote_data_stream(\n name=\"my-data-stream\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.promoteDataStream({\n name: \"my-data-stream\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.promote_data_stream(\n name: \"my-data-stream\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->promoteDataStream([\n \"name\" => \"my-data-stream\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/_promote/my-data-stream\"", + "language": "curl" + } + ], "method_request": "POST /_data_stream/_promote/my-data-stream" } }, @@ -145667,6 +151452,28 @@ "description": "Create or update an alias.\nAdds a data stream or index to an alias.", "examples": { "indicesPutAliasRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.update_aliases(\n actions=[\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.updateAliases({\n actions: [\n {\n add: {\n index: \"my-data-stream\",\n alias: \"my-alias\",\n },\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.update_aliases(\n body: {\n \"actions\": [\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->updateAliases([\n \"body\" => [\n \"actions\" => array(\n [\n \"add\" => [\n \"index\" => \"my-data-stream\",\n \"alias\" => \"my-alias\",\n ],\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"actions\":[{\"add\":{\"index\":\"my-data-stream\",\"alias\":\"my-alias\"}}]}' \"$ELASTICSEARCH_URL/_aliases\"", + "language": "curl" + } + ], "method_request": "POST _aliases", "value": "{\n \"actions\": [\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ]\n}" } @@ -145808,11 +151615,55 @@ "description": "Update data stream lifecycles.\nUpdate the data stream lifecycle of the specified data streams.", "examples": { "IndicesPutDataLifecycleRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.put_data_lifecycle(\n name=\"my-data-stream\",\n data_retention=\"7d\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.putDataLifecycle({\n name: \"my-data-stream\",\n data_retention: \"7d\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.put_data_lifecycle(\n name: \"my-data-stream\",\n body: {\n \"data_retention\": \"7d\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->putDataLifecycle([\n \"name\" => \"my-data-stream\",\n \"body\" => [\n \"data_retention\" => \"7d\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"data_retention\":\"7d\"}' \"$ELASTICSEARCH_URL/_data_stream/my-data-stream/_lifecycle\"", + "language": "curl" + } + ], "method_request": "PUT _data_stream/my-data-stream/_lifecycle", "summary": "Set the data stream lifecycle retention", "value": "{\n \"data_retention\": \"7d\"\n}" }, "IndicesPutDataLifecycleRequestExample2": { + "alternatives": [ + { + "code": "resp = client.indices.put_data_lifecycle(\n name=\"my-weather-sensor-data-stream\",\n downsampling=[\n {\n \"after\": \"1d\",\n \"fixed_interval\": \"10m\"\n },\n {\n \"after\": \"7d\",\n \"fixed_interval\": \"1d\"\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.putDataLifecycle({\n name: \"my-weather-sensor-data-stream\",\n downsampling: [\n {\n after: \"1d\",\n fixed_interval: \"10m\",\n },\n {\n after: \"7d\",\n fixed_interval: \"1d\",\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.put_data_lifecycle(\n name: \"my-weather-sensor-data-stream\",\n body: {\n \"downsampling\": [\n {\n \"after\": \"1d\",\n \"fixed_interval\": \"10m\"\n },\n {\n \"after\": \"7d\",\n \"fixed_interval\": \"1d\"\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->putDataLifecycle([\n \"name\" => \"my-weather-sensor-data-stream\",\n \"body\" => [\n \"downsampling\" => array(\n [\n \"after\" => \"1d\",\n \"fixed_interval\" => \"10m\",\n ],\n [\n \"after\" => \"7d\",\n \"fixed_interval\" => \"1d\",\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"downsampling\":[{\"after\":\"1d\",\"fixed_interval\":\"10m\"},{\"after\":\"7d\",\"fixed_interval\":\"1d\"}]}' \"$ELASTICSEARCH_URL/_data_stream/my-weather-sensor-data-stream/_lifecycle\"", + "language": "curl" + } + ], "description": "This example configures two downsampling rounds.", "method_request": "PUT _data_stream/my-weather-sensor-data-stream/_lifecycle", "summary": "Set the data stream lifecycle downsampling", @@ -146129,11 +151980,55 @@ "description": "Create or update an index template.\nIndex templates define settings, mappings, and aliases that can be applied automatically to new indices.\n\nElasticsearch applies templates to new indices based on an wildcard pattern that matches the index name.\nIndex templates are applied during data stream or index creation.\nFor data streams, these settings and mappings are applied when the stream's backing indices are created.\nSettings and mappings specified in a create index API request override any settings or mappings specified in an index template.\nChanges to index templates do not affect existing indices, including the existing backing indices of a data stream.\n\nYou can use C-style `/* *\\/` block comments in index templates.\nYou can include comments anywhere in the request body, except before the opening curly bracket.\n\n**Multiple matching templates**\n\nIf multiple index templates match the name of a new index or data stream, the template with the highest priority is used.\n\nMultiple templates with overlapping index patterns at the same priority are not allowed and an error will be thrown when attempting to create a template matching an existing index template at identical priorities.\n\n**Composing aliases, mappings, and settings**\n\nWhen multiple component templates are specified in the `composed_of` field for an index template, they are merged in the order specified, meaning that later component templates override earlier component templates.\nAny mappings, settings, or aliases from the parent index template are merged in next.\nFinally, any configuration on the index request itself is merged.\nMapping definitions are merged recursively, which means that later mapping components can introduce new field mappings and update the mapping configuration.\nIf a field mapping is already contained in an earlier component, its definition will be completely overwritten by the later one.\nThis recursive merging strategy applies not only to field mappings, but also root options like `dynamic_templates` and `meta`.\nIf an earlier component contains a `dynamic_templates` block, then by default new `dynamic_templates` entries are appended onto the end.\nIf an entry already exists with the same key, then it is overwritten by the new definition.", "examples": { "IndicesPutIndexTemplateRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.put_index_template(\n name=\"template_1\",\n index_patterns=[\n \"template*\"\n ],\n priority=1,\n template={\n \"settings\": {\n \"number_of_shards\": 2\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.putIndexTemplate({\n name: \"template_1\",\n index_patterns: [\"template*\"],\n priority: 1,\n template: {\n settings: {\n number_of_shards: 2,\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.put_index_template(\n name: \"template_1\",\n body: {\n \"index_patterns\": [\n \"template*\"\n ],\n \"priority\": 1,\n \"template\": {\n \"settings\": {\n \"number_of_shards\": 2\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->putIndexTemplate([\n \"name\" => \"template_1\",\n \"body\" => [\n \"index_patterns\" => array(\n \"template*\",\n ),\n \"priority\" => 1,\n \"template\" => [\n \"settings\" => [\n \"number_of_shards\" => 2,\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_patterns\":[\"template*\"],\"priority\":1,\"template\":{\"settings\":{\"number_of_shards\":2}}}' \"$ELASTICSEARCH_URL/_index_template/template_1\"", + "language": "curl" + } + ], "method_request": "PUT /_index_template/template_1", "summary": "Create a template", "value": "{\n \"index_patterns\" : [\"template*\"],\n \"priority\" : 1,\n \"template\": {\n \"settings\" : {\n \"number_of_shards\" : 2\n }\n }\n}" }, "IndicesPutIndexTemplateRequestExample2": { + "alternatives": [ + { + "code": "resp = client.indices.put_index_template(\n name=\"template_1\",\n index_patterns=[\n \"template*\"\n ],\n template={\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"aliases\": {\n \"alias1\": {},\n \"alias2\": {\n \"filter\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n \"routing\": \"shard-1\"\n },\n \"{index}-alias\": {}\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.putIndexTemplate({\n name: \"template_1\",\n index_patterns: [\"template*\"],\n template: {\n settings: {\n number_of_shards: 1,\n },\n aliases: {\n alias1: {},\n alias2: {\n filter: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n routing: \"shard-1\",\n },\n \"{index}-alias\": {},\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.put_index_template(\n name: \"template_1\",\n body: {\n \"index_patterns\": [\n \"template*\"\n ],\n \"template\": {\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"aliases\": {\n \"alias1\": {},\n \"alias2\": {\n \"filter\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n \"routing\": \"shard-1\"\n },\n \"{index}-alias\": {}\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->putIndexTemplate([\n \"name\" => \"template_1\",\n \"body\" => [\n \"index_patterns\" => array(\n \"template*\",\n ),\n \"template\" => [\n \"settings\" => [\n \"number_of_shards\" => 1,\n ],\n \"aliases\" => [\n \"alias1\" => new ArrayObject([]),\n \"alias2\" => [\n \"filter\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n \"routing\" => \"shard-1\",\n ],\n \"{index}-alias\" => new ArrayObject([]),\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_patterns\":[\"template*\"],\"template\":{\"settings\":{\"number_of_shards\":1},\"aliases\":{\"alias1\":{},\"alias2\":{\"filter\":{\"term\":{\"user.id\":\"kimchy\"}},\"routing\":\"shard-1\"},\"{index}-alias\":{}}}}' \"$ELASTICSEARCH_URL/_index_template/template_1\"", + "language": "curl" + } + ], "description": "You can include index aliases in an index template.\nDuring index creation, the `{index}` placeholder in the alias name will be replaced with the actual index name that the template gets applied to.\n", "method_request": "PUT /_index_template/template_1", "summary": "Create a template with aliases", @@ -146399,6 +152294,28 @@ "description": "Update field mappings.\nAdd new fields to an existing data stream or index.\nYou can also use this API to change the search settings of existing fields and add new properties to existing object fields.\nFor data streams, these changes are applied to all backing indices by default.\n\n**Add multi-fields to an existing field**\n\nMulti-fields let you index the same field in different ways.\nYou can use this API to update the fields mapping parameter and enable multi-fields for an existing field.\nWARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field.\nYou can populate the new multi-field with the update by query API.\n\n**Change supported mapping parameters for an existing field**\n\nThe documentation for each mapping parameter indicates whether you can update it for an existing field using this API.\nFor example, you can use the update mapping API to update the `ignore_above` parameter.\n\n**Change the mapping of an existing field**\n\nExcept for supported mapping parameters, you can't change the mapping or field type of an existing field.\nChanging an existing field could invalidate data that's already indexed.\n\nIf you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams.\nIf you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index.\n\n**Rename a field**\n\nRenaming a field would invalidate data already indexed under the old field name.\nInstead, add an alias field to create an alternate field name.", "examples": { "indicesPutMappingRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.put_mapping(\n index=\"my-index-000001\",\n properties={\n \"user\": {\n \"properties\": {\n \"name\": {\n \"type\": \"keyword\"\n }\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.putMapping({\n index: \"my-index-000001\",\n properties: {\n user: {\n properties: {\n name: {\n type: \"keyword\",\n },\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.put_mapping(\n index: \"my-index-000001\",\n body: {\n \"properties\": {\n \"user\": {\n \"properties\": {\n \"name\": {\n \"type\": \"keyword\"\n }\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->putMapping([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"properties\" => [\n \"user\" => [\n \"properties\" => [\n \"name\" => [\n \"type\" => \"keyword\",\n ],\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"properties\":{\"user\":{\"properties\":{\"name\":{\"type\":\"keyword\"}}}}}' \"$ELASTICSEARCH_URL/my-index-000001/_mapping\"", + "language": "curl" + } + ], "description": "The update mapping API can be applied to multiple data streams or indices with a single request. For example, run `PUT /my-index-000001,my-index-000002/_mapping` to update mappings for the `my-index-000001` and `my-index-000002` indices at the same time.\n", "method_request": "PUT /my-index-000001/_mapping", "summary": "Update multiple targets", @@ -146549,17 +152466,83 @@ "description": "Update index settings.\nChanges dynamic index settings in real time.\nFor data streams, index setting changes are applied to all backing indices by default.\n\nTo revert a setting to the default value, use a null value.\nThe list of per-index settings that can be updated dynamically on live indices can be found in index settings documentation.\nTo preserve existing settings from being updated, set the `preserve_existing` parameter to `true`.\n\nFor performance optimization during bulk indexing, you can disable the refresh interval.\nRefer to [disable refresh interval](https://www.elastic.co/docs/deploy-manage/production-guidance/optimize-performance/indexing-speed#disable-refresh-interval) for an example.\nThere are multiple valid ways to represent index settings in the request body. You can specify only the setting, for example:\n\n```\n{\n \"number_of_replicas\": 1\n}\n```\n\nOr you can use an `index` setting object:\n```\n{\n \"index\": {\n \"number_of_replicas\": 1\n }\n}\n```\n\nOr you can use dot annotation:\n```\n{\n \"index.number_of_replicas\": 1\n}\n```\n\nOr you can embed any of the aforementioned options in a `settings` object. For example:\n\n```\n{\n \"settings\": {\n \"index\": {\n \"number_of_replicas\": 1\n }\n }\n}\n```\n\nNOTE: You can only define new analyzers on closed indices.\nTo add an analyzer, you must close the index, define the analyzer, and reopen the index.\nYou cannot close the write index of a data stream.\nTo update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream.\nThen roll over the data stream to apply the new analyzer to the stream's write index and future backing indices.\nThis affects searches and any new data added to the stream after the rollover.\nHowever, it does not affect the data stream's backing indices or their existing data.\nTo change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it.\nRefer to [updating analyzers on existing indices](https://www.elastic.co/docs/manage-data/data-store/text-analysis/specify-an-analyzer#update-analyzers-on-existing-indices) for step-by-step examples.", "examples": { "IndicesPutSettingsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.put_settings(\n index=\"my-index-000001\",\n settings={\n \"index\": {\n \"number_of_replicas\": 2\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.putSettings({\n index: \"my-index-000001\",\n settings: {\n index: {\n number_of_replicas: 2,\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.put_settings(\n index: \"my-index-000001\",\n body: {\n \"index\": {\n \"number_of_replicas\": 2\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->putSettings([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"index\" => [\n \"number_of_replicas\" => 2,\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index\":{\"number_of_replicas\":2}}' \"$ELASTICSEARCH_URL/my-index-000001/_settings\"", + "language": "curl" + } + ], "method_request": "PUT /my-index-000001/_settings", "summary": "Change a dynamic index setting", "value": "{\n \"index\" : {\n \"number_of_replicas\" : 2\n }\n}" }, "indicesPutSettingsRequestExample2": { + "alternatives": [ + { + "code": "resp = client.indices.put_settings(\n index=\"my-index-000001\",\n settings={\n \"index\": {\n \"refresh_interval\": None\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.putSettings({\n index: \"my-index-000001\",\n settings: {\n index: {\n refresh_interval: null,\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.put_settings(\n index: \"my-index-000001\",\n body: {\n \"index\": {\n \"refresh_interval\": nil\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->putSettings([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"index\" => [\n \"refresh_interval\" => null,\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index\":{\"refresh_interval\":null}}' \"$ELASTICSEARCH_URL/my-index-000001/_settings\"", + "language": "curl" + } + ], "description": "To revert a setting to the default value, use `null`.", "method_request": "PUT /my-index-000001/_settings", "summary": "Reset an index setting", "value": "{\n \"index\" : {\n \"refresh_interval\" : null\n }\n}" }, "indicesPutSettingsRequestExample3": { + "alternatives": [ + { + "code": "resp = client.indices.close(\n index=\"my-index-000001\",\n)\n\nresp1 = client.indices.open(\n index=\"my-index-000001\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.close({\n index: \"my-index-000001\",\n});\n\nconst response1 = await client.indices.open({\n index: \"my-index-000001\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.close(\n index: \"my-index-000001\",\n body: {\n \"analysis\": {\n \"analyzer\": {\n \"content\": {\n \"type\": \"custom\",\n \"tokenizer\": \"whitespace\"\n }\n }\n }\n }\n)\n\nresponse1 = client.indices.open(\n index: \"my-index-000001\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->close([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"analysis\" => [\n \"analyzer\" => [\n \"content\" => [\n \"type\" => \"custom\",\n \"tokenizer\" => \"whitespace\",\n ],\n ],\n ],\n ],\n]);\n\n$resp1 = $client->indices()->open([\n \"index\" => \"my-index-000001\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"analysis\":{\"analyzer\":{\"content\":{\"type\":\"custom\",\"tokenizer\":\"whitespace\"}}}}' \"$ELASTICSEARCH_URL/my-index-000001/_close\"\ncurl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_open\"", + "language": "curl" + } + ], "description": "To add an analyzer, you must close the index, define the analyzer, then reopen the index.", "method_request": "POST /my-index-000001/_close", "summary": "Update index analysis", @@ -146832,11 +152815,57 @@ "description": "Create or update a legacy index template.\nIndex templates define settings, mappings, and aliases that can be applied automatically to new indices.\nElasticsearch applies templates to new indices based on an index pattern that matches the index name.\n\nIMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.\n\nComposable templates always take precedence over legacy templates.\nIf no composable template matches a new index, matching legacy templates are applied according to their order.\n\nIndex templates are only applied during index creation.\nChanges to index templates do not affect existing indices.\nSettings and mappings specified in create index API requests override any settings or mappings specified in an index template.\n\nYou can use C-style `/* *\\/` block comments in index templates.\nYou can include comments anywhere in the request body, except before the opening curly bracket.\n\n**Indices matching multiple templates**\n\nMultiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index.\nThe order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them.\nNOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order.", "examples": { "indicesPutTemplateRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.put_template(\n name=\"template_1\",\n index_patterns=[\n \"te*\",\n \"bar*\"\n ],\n settings={\n \"number_of_shards\": 1\n },\n mappings={\n \"_source\": {\n \"enabled\": False\n }\n },\n properties={\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.putTemplate({\n name: \"template_1\",\n index_patterns: [\"te*\", \"bar*\"],\n settings: {\n number_of_shards: 1,\n },\n mappings: {\n _source: {\n enabled: false,\n },\n },\n properties: {\n host_name: {\n type: \"keyword\",\n },\n created_at: {\n type: \"date\",\n format: \"EEE MMM dd HH:mm:ss Z yyyy\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.put_template(\n name: \"template_1\",\n body: {\n \"index_patterns\": [\n \"te*\",\n \"bar*\"\n ],\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"mappings\": {\n \"_source\": {\n \"enabled\": false\n }\n },\n \"properties\": {\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->putTemplate([\n \"name\" => \"template_1\",\n \"body\" => [\n \"index_patterns\" => array(\n \"te*\",\n \"bar*\",\n ),\n \"settings\" => [\n \"number_of_shards\" => 1,\n ],\n \"mappings\" => [\n \"_source\" => [\n \"enabled\" => false,\n ],\n ],\n \"properties\" => [\n \"host_name\" => [\n \"type\" => \"keyword\",\n ],\n \"created_at\" => [\n \"type\" => \"date\",\n \"format\" => \"EEE MMM dd HH:mm:ss Z yyyy\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_patterns\":[\"te*\",\"bar*\"],\"settings\":{\"number_of_shards\":1},\"mappings\":{\"_source\":{\"enabled\":false}},\"properties\":{\"host_name\":{\"type\":\"keyword\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z yyyy\"}}}' \"$ELASTICSEARCH_URL/_template/template_1\"", + "language": "curl" + } + ], + "method_request": "PUT _template/template_1", "summary": "Create an index template", "value": "{\n \"index_patterns\": [\n \"te*\",\n \"bar*\"\n ],\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"mappings\": {\n \"_source\": {\n \"enabled\": false\n }\n },\n \"properties\": {\n \"host_name\": {\n \"type\": \"keyword\"\n },\n \"created_at\": {\n \"type\": \"date\",\n \"format\": \"EEE MMM dd HH:mm:ss Z yyyy\"\n }\n }\n}" }, "indicesPutTemplateRequestExample2": { + "alternatives": [ + { + "code": "resp = client.indices.put_template(\n name=\"template_1\",\n index_patterns=[\n \"te*\"\n ],\n settings={\n \"number_of_shards\": 1\n },\n aliases={\n \"alias1\": {},\n \"alias2\": {\n \"filter\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n \"routing\": \"shard-1\"\n },\n \"{index}-alias\": {}\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.putTemplate({\n name: \"template_1\",\n index_patterns: [\"te*\"],\n settings: {\n number_of_shards: 1,\n },\n aliases: {\n alias1: {},\n alias2: {\n filter: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n routing: \"shard-1\",\n },\n \"{index}-alias\": {},\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.put_template(\n name: \"template_1\",\n body: {\n \"index_patterns\": [\n \"te*\"\n ],\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"aliases\": {\n \"alias1\": {},\n \"alias2\": {\n \"filter\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n \"routing\": \"shard-1\"\n },\n \"{index}-alias\": {}\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->putTemplate([\n \"name\" => \"template_1\",\n \"body\" => [\n \"index_patterns\" => array(\n \"te*\",\n ),\n \"settings\" => [\n \"number_of_shards\" => 1,\n ],\n \"aliases\" => [\n \"alias1\" => new ArrayObject([]),\n \"alias2\" => [\n \"filter\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n \"routing\" => \"shard-1\",\n ],\n \"{index}-alias\" => new ArrayObject([]),\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_patterns\":[\"te*\"],\"settings\":{\"number_of_shards\":1},\"aliases\":{\"alias1\":{},\"alias2\":{\"filter\":{\"term\":{\"user.id\":\"kimchy\"}},\"routing\":\"shard-1\"},\"{index}-alias\":{}}}' \"$ELASTICSEARCH_URL/_template/template_1\"", + "language": "curl" + } + ], "description": "You can include index aliases in an index template. During index creation, the `{index}` placeholder in the alias name will be replaced with the actual index name that the template gets applied to.\n", + "method_request": "PUT _template/template_1", "summary": "Create an index template with aliases", "value": "{\n \"index_patterns\": [\n \"te*\"\n ],\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"aliases\": {\n \"alias1\": {},\n \"alias2\": {\n \"filter\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n \"routing\": \"shard-1\"\n },\n \"{index}-alias\": {}\n }\n}" } @@ -147543,6 +153572,28 @@ "description": "Get index recovery information.\nGet information about ongoing and completed shard recoveries for one or more indices.\nFor data streams, the API returns information for the stream's backing indices.\n\nAll recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time.\n\nShard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard.\nWhen a shard recovery completes, the recovered shard is available for search and indexing.\n\nRecovery automatically occurs during the following processes:\n\n* When creating an index for the first time.\n* When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path.\n* Creation of new replica shard copies from the primary.\n* Relocation of a shard copy to a different node in the same cluster.\n* A snapshot restore operation.\n* A clone, shrink, or split operation.\n\nYou can determine the cause of a shard recovery using the recovery or cat recovery APIs.\n\nThe index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster.\nIt only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist.\nThis means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API.", "examples": { "indicesRecoveryRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.recovery(\n human=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.recovery({\n human: \"true\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.recovery(\n human: \"true\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->recovery([\n \"human\" => \"true\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_recovery?human\"", + "language": "curl" + } + ], "method_request": "GET /_recovery?human" } }, @@ -148023,6 +154074,28 @@ "description": "Refresh an index.\nA refresh makes recent operations performed on one or more indices available for search.\nFor data streams, the API runs the refresh operation on the stream’s backing indices.\n\nBy default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds.\nYou can change this default interval with the `index.refresh_interval` setting.\n\nRefresh requests are synchronous and do not return a response until the refresh operation completes.\n\nRefreshes are resource-intensive.\nTo ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible.\n\nIf your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's `refresh=wait_for` query parameter option.\nThis option ensures the indexing operation waits for a periodic refresh before running the search.", "examples": { "IndicesRefreshExample1": { + "alternatives": [ + { + "code": "resp = client.indices.refresh()", + "language": "Python" + }, + { + "code": "const response = await client.indices.refresh();", + "language": "JavaScript" + }, + { + "code": "response = client.indices.refresh", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->refresh();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_refresh\"", + "language": "curl" + } + ], "method_request": "GET _refresh" } }, @@ -148207,6 +154280,28 @@ "description": "Reload search analyzers.\nReload an index's search analyzers and their resources.\nFor data streams, the API reloads search analyzers and resources for the stream's backing indices.\n\nIMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer.\n\nYou can use the reload search analyzers API to pick up changes to synonym files used in the `synonym_graph` or `synonym` token filter of a search analyzer.\nTo be eligible, the token filter must have an `updateable` flag of `true` and only be used in search analyzers.\n\nNOTE: This API does not perform a reload for each shard of an index.\nInstead, it performs a reload for each node containing index shards.\nAs a result, the total shard count returned by the API can differ from the number of index shards.\nBecause reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API.\nThis ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future.", "examples": { "ReloadSearchAnalyzersRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.reload_search_analyzers(\n index=\"my-index-000001\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.reloadSearchAnalyzers({\n index: \"my-index-000001\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.reload_search_analyzers(\n index: \"my-index-000001\",\n body: {\n \"_shards\": {\n \"total\": 2,\n \"successful\": 2,\n \"failed\": 0\n },\n \"reload_details\": [\n {\n \"index\": \"my-index-000001\",\n \"reloaded_analyzers\": [\n \"my_synonyms\"\n ],\n \"reloaded_node_ids\": [\n \"mfdqTXn_T7SGr2Ho2KT8uw\"\n ]\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->reloadSearchAnalyzers([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"_shards\" => [\n \"total\" => 2,\n \"successful\" => 2,\n \"failed\" => 0,\n ],\n \"reload_details\" => array(\n [\n \"index\" => \"my-index-000001\",\n \"reloaded_analyzers\" => array(\n \"my_synonyms\",\n ),\n \"reloaded_node_ids\" => array(\n \"mfdqTXn_T7SGr2Ho2KT8uw\",\n ),\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"_shards\":{\"total\":2,\"successful\":2,\"failed\":0},\"reload_details\":[{\"index\":\"my-index-000001\",\"reloaded_analyzers\":[\"my_synonyms\"],\"reloaded_node_ids\":[\"mfdqTXn_T7SGr2Ho2KT8uw\"]}]}' \"$ELASTICSEARCH_URL/my-index-000001/_reload_search_analyzers\"", + "language": "curl" + } + ], "method_request": "POST /my-index-000001/_reload_search_analyzers", "value": "{\n \"_shards\": {\n \"total\": 2,\n \"successful\": 2,\n \"failed\": 0\n },\n \"reload_details\": [\n {\n \"index\": \"my-index-000001\",\n \"reloaded_analyzers\": [\n \"my_synonyms\"\n ],\n \"reloaded_node_ids\": [\n \"mfdqTXn_T7SGr2Ho2KT8uw\"\n ]\n }\n ]\n}" } @@ -148317,6 +154412,28 @@ "description": "Resolve the cluster.\n\nResolve the specified index expressions to return information about each cluster, including the local \"querying\" cluster, if included.\nIf no index expression is provided, the API will return information about all the remote clusters that are configured on the querying cluster.\n\nThis endpoint is useful before doing a cross-cluster search in order to determine which remote clusters should be included in a search.\n\nYou use the same index expression with this endpoint as you would for cross-cluster search.\nIndex and cluster exclusions are also supported with this endpoint.\n\nFor each cluster in the index expression, information is returned about:\n\n* Whether the querying (\"local\") cluster is currently connected to each remote cluster specified in the index expression. Note that this endpoint actively attempts to contact the remote clusters, unlike the `remote/info` endpoint.\n* Whether each remote cluster is configured with `skip_unavailable` as `true` or `false`.\n* Whether there are any indices, aliases, or data streams on that cluster that match the index expression.\n* Whether the search is likely to have errors returned when you do the cross-cluster search (including any authorization errors if you do not have permission to query the index).\n* Cluster version information, including the Elasticsearch server version.\n\nFor example, `GET /_resolve/cluster/my-index-*,cluster*:my-index-*` returns information about the local cluster and all remotely configured clusters that start with the alias `cluster*`.\nEach cluster returns information about whether it has any indices, aliases or data streams that match `my-index-*`.\n\n## Note on backwards compatibility\nThe ability to query without an index expression was added in version 8.18, so when\nquerying remote clusters older than that, the local cluster will send the index\nexpression `dummy*` to those remote clusters. Thus, if an errors occur, you may see a reference\nto that index expression even though you didn't request it. If it causes a problem, you can\ninstead include an index expression like `*:*` to bypass the issue.\n\n## Advantages of using this endpoint before a cross-cluster search\n\nYou may want to exclude a cluster or index from a search when:\n\n* A remote cluster is not currently connected and is configured with `skip_unavailable=false`. Running a cross-cluster search under those conditions will cause the entire search to fail.\n* A cluster has no matching indices, aliases or data streams for the index expression (or your user does not have permissions to search them). For example, suppose your index expression is `logs*,remote1:logs*` and the remote1 cluster has no indices, aliases or data streams that match `logs*`. In that case, that cluster will return no results from that cluster if you include it in a cross-cluster search.\n* The index expression (combined with any query parameters you specify) will likely cause an exception to be thrown when you do the search. In these cases, the \"error\" field in the `_resolve/cluster` response will be present. (This is also where security/permission errors will be shown.)\n* A remote cluster is an older version that does not support the feature you want to use in your search.\n\n## Test availability of remote clusters\n\nThe `remote/info` endpoint is commonly used to test whether the \"local\" cluster (the cluster being queried) is connected to its remote clusters, but it does not necessarily reflect whether the remote cluster is available or not.\nThe remote cluster may be available, while the local cluster is not currently connected to it.\n\nYou can use the `_resolve/cluster` API to attempt to reconnect to remote clusters.\nFor example with `GET _resolve/cluster` or `GET _resolve/cluster/*:*`.\nThe `connected` field in the response will indicate whether it was successful.\nIf a connection was (re-)established, this will also cause the `remote/info` endpoint to now indicate a connected status.", "examples": { "ResolveClusterRequestExample2": { + "alternatives": [ + { + "code": "resp = client.indices.resolve_cluster(\n name=\"not-present,clust*:my-index*,oldcluster:*\",\n ignore_unavailable=False,\n timeout=\"5s\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.resolveCluster({\n name: \"not-present,clust*:my-index*,oldcluster:*\",\n ignore_unavailable: \"false\",\n timeout: \"5s\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.resolve_cluster(\n name: \"not-present,clust*:my-index*,oldcluster:*\",\n ignore_unavailable: \"false\",\n timeout: \"5s\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->resolveCluster([\n \"name\" => \"not-present,clust*:my-index*,oldcluster:*\",\n \"ignore_unavailable\" => \"false\",\n \"timeout\" => \"5s\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_resolve/cluster/not-present,clust*:my-index*,oldcluster:*?ignore_unavailable=false&timeout=5s\"", + "language": "curl" + } + ], "method_request": "GET /_resolve/cluster/not-present,clust*:my-index*,oldcluster:*?ignore_unavailable=false&timeout=5s" } }, @@ -148540,6 +154657,28 @@ "description": "Resolve indices.\nResolve the names and/or index patterns for indices, aliases, and data streams.\nMultiple patterns and remote clusters are supported.", "examples": { "ResolveIndexRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.resolve_index(\n name=\"f*,remoteCluster1:bar*\",\n expand_wildcards=\"all\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.resolveIndex({\n name: \"f*,remoteCluster1:bar*\",\n expand_wildcards: \"all\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.resolve_index(\n name: \"f*,remoteCluster1:bar*\",\n expand_wildcards: \"all\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->resolveIndex([\n \"name\" => \"f*,remoteCluster1:bar*\",\n \"expand_wildcards\" => \"all\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_resolve/index/f*,remoteCluster1:bar*?expand_wildcards=all\"", + "language": "curl" + } + ], "method_request": "GET /_resolve/index/f*,remoteCluster1:bar*?expand_wildcards=all" } }, @@ -148885,6 +155024,28 @@ "description": "Roll over to a new index.\nTIP: It is recommended to use the index lifecycle rollover action to automate rollovers.\n\nThe rollover API creates a new index for a data stream or index alias.\nThe API behavior depends on the rollover target.\n\n**Roll over a data stream**\n\nIf you roll over a data stream, the API creates a new write index for the stream.\nThe stream's previous write index becomes a regular backing index.\nA rollover also increments the data stream's generation.\n\n**Roll over an index alias with a write index**\n\nTIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data.\nData streams replace this functionality, require less maintenance, and automatically integrate with data tiers.\n\nIf an index alias points to multiple indices, one of the indices must be a write index.\nThe rollover API creates a new write index for the alias with `is_write_index` set to `true`.\nThe API also `sets is_write_index` to `false` for the previous write index.\n\n**Roll over an index alias with one index**\n\nIf you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias.\n\nNOTE: A rollover creates a new index and is subject to the `wait_for_active_shards` setting.\n\n**Increment index names for an alias**\n\nWhen you roll over an index alias, you can specify a name for the new index.\nIf you don't specify a name and the current index ends with `-` and a number, such as `my-index-000001` or `my-index-3`, the new index name increments that number.\nFor example, if you roll over an alias with a current index of `my-index-000001`, the rollover creates a new index named `my-index-000002`.\nThis number is always six characters and zero-padded, regardless of the previous index's name.\n\nIf you use an index alias for time series data, you can use date math in the index name to track the rollover date.\nFor example, you can create an alias that points to an index named ``.\nIf you create the index on May 6, 2099, the index's name is `my-index-2099.05.06-000001`.\nIf you roll over the alias on May 7, 2099, the new index's name is `my-index-2099.05.07-000002`.", "examples": { "indicesRolloverRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.rollover(\n alias=\"my-data-stream\",\n conditions={\n \"max_age\": \"7d\",\n \"max_docs\": 1000,\n \"max_primary_shard_size\": \"50gb\",\n \"max_primary_shard_docs\": \"2000\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.rollover({\n alias: \"my-data-stream\",\n conditions: {\n max_age: \"7d\",\n max_docs: 1000,\n max_primary_shard_size: \"50gb\",\n max_primary_shard_docs: \"2000\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.rollover(\n alias: \"my-data-stream\",\n body: {\n \"conditions\": {\n \"max_age\": \"7d\",\n \"max_docs\": 1000,\n \"max_primary_shard_size\": \"50gb\",\n \"max_primary_shard_docs\": \"2000\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->rollover([\n \"alias\" => \"my-data-stream\",\n \"body\" => [\n \"conditions\" => [\n \"max_age\" => \"7d\",\n \"max_docs\" => 1000,\n \"max_primary_shard_size\" => \"50gb\",\n \"max_primary_shard_docs\" => \"2000\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"conditions\":{\"max_age\":\"7d\",\"max_docs\":1000,\"max_primary_shard_size\":\"50gb\",\"max_primary_shard_docs\":\"2000\"}}' \"$ELASTICSEARCH_URL/my-data-stream/_rollover\"", + "language": "curl" + } + ], "method_request": "POST my-data-stream/_rollover", "summary": "Create a new index for a data stream.", "value": "{\n \"conditions\": {\n \"max_age\": \"7d\",\n \"max_docs\": 1000,\n \"max_primary_shard_size\": \"50gb\",\n \"max_primary_shard_docs\": \"2000\"\n }\n}" @@ -149344,6 +155505,28 @@ "description": "Get index segments.\nGet low-level information about the Lucene segments in index shards.\nFor data streams, the API returns information about the stream's backing indices.", "examples": { "IndicesSegmentsExample1": { + "alternatives": [ + { + "code": "resp = client.indices.segments(\n index=\"my-index-000001\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.segments({\n index: \"my-index-000001\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.segments(\n index: \"my-index-000001\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->segments([\n \"index\" => \"my-index-000001\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_segments\"", + "language": "curl" + } + ], "method_request": "GET /my-index-000001/_segments" } }, @@ -149737,6 +155920,28 @@ "description": "Get index shard stores.\nGet store information about replica shards in one or more indices.\nFor data streams, the API retrieves store information for the stream's backing indices.\n\nThe index shard stores API returns the following information:\n\n* The node on which each replica shard exists.\n* The allocation ID for each replica shard.\n* A unique ID for each replica shard.\n* Any errors encountered while opening the shard index or from an earlier failure.\n\nBy default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards.", "examples": { "indicesShardStoresRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.shard_stores(\n status=\"green\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.shardStores({\n status: \"green\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.shard_stores(\n status: \"green\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->shardStores([\n \"status\" => \"green\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_shard_stores?status=green\"", + "language": "curl" + } + ], "method_request": "GET /_shard_stores?status=green" } }, @@ -150194,6 +156399,28 @@ "description": "Shrink an index.\nShrink an index into a new index with fewer primary shards.\n\nBefore you can shrink an index:\n\n* The index must be read-only.\n* A copy of every shard in the index must reside on the same node.\n* The index must have a green health status.\n\nTo make shard allocation easier, we recommend you also remove the index's replica shards.\nYou can later re-add replica shards as part of the shrink operation.\n\nThe requested number of primary shards in the target index must be a factor of the number of shards in the source index.\nFor example an index with 8 primary shards can be shrunk into 4, 2 or 1 primary shards or an index with 15 primary shards can be shrunk into 5, 3 or 1.\nIf the number of shards in the index is a prime number it can only be shrunk into a single primary shard\n Before shrinking, a (primary or replica) copy of every shard in the index must be present on the same node.\n\nThe current write index on a data stream cannot be shrunk. In order to shrink the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be shrunk.\n\nA shrink operation:\n\n* Creates a new target index with the same definition as the source index, but with a smaller number of primary shards.\n* Hard-links segments from the source index into the target index. If the file system does not support hard-linking, then all segments are copied into the new index, which is a much more time consuming process. Also if using multiple data paths, shards on different data paths require a full copy of segment files if they are not on the same disk since hardlinks do not work across disks.\n* Recovers the target index as though it were a closed index which had just been re-opened. Recovers shards to the `.routing.allocation.initial_recovery._id` index setting.\n\nIMPORTANT: Indices can only be shrunk if they satisfy the following requirements:\n\n* The target index must not exist.\n* The source index must have more primary shards than the target index.\n* The number of primary shards in the target index must be a factor of the number of primary shards in the source index. The source index must have more primary shards than the target index.\n* The index must not contain more than 2,147,483,519 documents in total across all shards that will be shrunk into a single shard on the target index as this is the maximum number of docs that can fit into a single shard.\n* The node handling the shrink process must have sufficient free disk space to accommodate a second copy of the existing index.", "examples": { "indicesShrinkRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.shrink(\n index=\"my_source_index\",\n target=\"my_target_index\",\n settings={\n \"index.routing.allocation.require._name\": None,\n \"index.blocks.write\": None\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.shrink({\n index: \"my_source_index\",\n target: \"my_target_index\",\n settings: {\n \"index.routing.allocation.require._name\": null,\n \"index.blocks.write\": null,\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.shrink(\n index: \"my_source_index\",\n target: \"my_target_index\",\n body: {\n \"settings\": {\n \"index.routing.allocation.require._name\": nil,\n \"index.blocks.write\": nil\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->shrink([\n \"index\" => \"my_source_index\",\n \"target\" => \"my_target_index\",\n \"body\" => [\n \"settings\" => [\n \"index.routing.allocation.require._name\" => null,\n \"index.blocks.write\" => null,\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"settings\":{\"index.routing.allocation.require._name\":null,\"index.blocks.write\":null}}' \"$ELASTICSEARCH_URL/my_source_index/_shrink/my_target_index\"", + "language": "curl" + } + ], "method_request": "POST /my_source_index/_shrink/my_target_index", "summary": "Shrink an existing index into a new index with fewer primary shards.", "value": "{\n \"settings\": {\n \"index.routing.allocation.require._name\": null,\n \"index.blocks.write\": null\n }\n}" @@ -150335,6 +156562,28 @@ "description": "Simulate an index.\nGet the index configuration that would be applied to the specified index from an existing index template.", "examples": { "indicesSimulateIndexTemplateRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.simulate_index_template(\n name=\"my-index-000001\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.simulateIndexTemplate({\n name: \"my-index-000001\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.simulate_index_template(\n name: \"my-index-000001\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->simulateIndexTemplate([\n \"name\" => \"my-index-000001\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_index_template/_simulate_index/my-index-000001\"", + "language": "curl" + } + ], "method_request": "POST /_index_template/_simulate_index/my-index-000001" } }, @@ -150649,6 +156898,28 @@ "description": "Simulate an index template.\nGet the index configuration that would be applied by a particular index template.", "examples": { "indicesSimulateTemplateRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.simulate_template(\n index_patterns=[\n \"my-index-*\"\n ],\n composed_of=[\n \"ct2\"\n ],\n priority=10,\n template={\n \"settings\": {\n \"index.number_of_replicas\": 1\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.simulateTemplate({\n index_patterns: [\"my-index-*\"],\n composed_of: [\"ct2\"],\n priority: 10,\n template: {\n settings: {\n \"index.number_of_replicas\": 1,\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.simulate_template(\n body: {\n \"index_patterns\": [\n \"my-index-*\"\n ],\n \"composed_of\": [\n \"ct2\"\n ],\n \"priority\": 10,\n \"template\": {\n \"settings\": {\n \"index.number_of_replicas\": 1\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->simulateTemplate([\n \"body\" => [\n \"index_patterns\" => array(\n \"my-index-*\",\n ),\n \"composed_of\" => array(\n \"ct2\",\n ),\n \"priority\" => 10,\n \"template\" => [\n \"settings\" => [\n \"index.number_of_replicas\" => 1,\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_patterns\":[\"my-index-*\"],\"composed_of\":[\"ct2\"],\"priority\":10,\"template\":{\"settings\":{\"index.number_of_replicas\":1}}}' \"$ELASTICSEARCH_URL/_index_template/_simulate\"", + "language": "curl" + } + ], "description": "To see what settings will be applied by a template before you add it to the cluster, you can pass a template configuration in the request body. The specified template is used for the simulation if it has a higher priority than existing templates.\n", "method_request": "POST /_index_template/_simulate", "value": "{\n \"index_patterns\": [\"my-index-*\"],\n \"composed_of\": [\"ct2\"],\n \"priority\": 10,\n \"template\": {\n \"settings\": {\n \"index.number_of_replicas\": 1\n }\n }\n}" @@ -150895,6 +157166,28 @@ "description": "Split an index.\nSplit an index into a new index with more primary shards.\n* Before you can split an index:\n\n* The index must be read-only.\n* The cluster health status must be green.\n\nYou can do make an index read-only with the following request using the add index block API:\n\n```\nPUT /my_source_index/_block/write\n```\n\nThe current write index on a data stream cannot be split.\nIn order to split the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be split.\n\nThe number of times the index can be split (and the number of shards that each original shard can be split into) is determined by the `index.number_of_routing_shards` setting.\nThe number of routing shards specifies the hashing space that is used internally to distribute documents across shards with consistent hashing.\nFor instance, a 5 shard index with `number_of_routing_shards` set to 30 (5 x 2 x 3) could be split by a factor of 2 or 3.\n\nA split operation:\n\n* Creates a new target index with the same definition as the source index, but with a larger number of primary shards.\n* Hard-links segments from the source index into the target index. If the file system doesn't support hard-linking, all segments are copied into the new index, which is a much more time consuming process.\n* Hashes all documents again, after low level files are created, to delete documents that belong to a different shard.\n* Recovers the target index as though it were a closed index which had just been re-opened.\n\nIMPORTANT: Indices can only be split if they satisfy the following requirements:\n\n* The target index must not exist.\n* The source index must have fewer primary shards than the target index.\n* The number of primary shards in the target index must be a multiple of the number of primary shards in the source index.\n* The node handling the split process must have sufficient free disk space to accommodate a second copy of the existing index.", "examples": { "indicesSplitRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.split(\n index=\"my-index-000001\",\n target=\"split-my-index-000001\",\n settings={\n \"index.number_of_shards\": 2\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.split({\n index: \"my-index-000001\",\n target: \"split-my-index-000001\",\n settings: {\n \"index.number_of_shards\": 2,\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.split(\n index: \"my-index-000001\",\n target: \"split-my-index-000001\",\n body: {\n \"settings\": {\n \"index.number_of_shards\": 2\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->split([\n \"index\" => \"my-index-000001\",\n \"target\" => \"split-my-index-000001\",\n \"body\" => [\n \"settings\" => [\n \"index.number_of_shards\" => 2,\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"settings\":{\"index.number_of_shards\":2}}' \"$ELASTICSEARCH_URL/my-index-000001/_split/split-my-index-000001\"", + "language": "curl" + } + ], "description": "Split an existing index into a new index with more primary shards.", "method_request": "POST /my-index-000001/_split/split-my-index-000001", "value": "{\n \"settings\": {\n \"index.number_of_shards\": 2\n }\n}" @@ -151439,6 +157732,28 @@ "description": "Get index statistics.\nFor data streams, the API retrieves statistics for the stream's backing indices.\n\nBy default, the returned statistics are index-level with `primaries` and `total` aggregations.\n`primaries` are the values for only the primary shards.\n`total` are the accumulated values for both primary and replica shards.\n\nTo get shard-level statistics, set the `level` parameter to `shards`.\n\nNOTE: When moving to another node, the shard-level statistics for a shard are cleared.\nAlthough the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed.", "examples": { "IndicesStatsExample1": { + "alternatives": [ + { + "code": "resp = client.indices.stats(\n metric=\"fielddata\",\n human=True,\n fields=\"my_join_field\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.stats({\n metric: \"fielddata\",\n human: \"true\",\n fields: \"my_join_field\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.stats(\n metric: \"fielddata\",\n human: \"true\",\n fields: \"my_join_field\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->stats([\n \"metric\" => \"fielddata\",\n \"human\" => \"true\",\n \"fields\" => \"my_join_field\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_stats/fielddata?human&fields=my_join_field#question\"", + "language": "curl" + } + ], "method_request": "GET _stats/fielddata?human&fields=my_join_field#question" } }, @@ -152866,6 +159181,28 @@ "description": "Create or update an alias.\nAdds a data stream or index to an alias.", "examples": { "IndicesUpdateAliasesExample1": { + "alternatives": [ + { + "code": "resp = client.indices.update_aliases(\n actions=[\n {\n \"add\": {\n \"index\": \"logs-nginx.access-prod\",\n \"alias\": \"logs\"\n }\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.updateAliases({\n actions: [\n {\n add: {\n index: \"logs-nginx.access-prod\",\n alias: \"logs\",\n },\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.update_aliases(\n body: {\n \"actions\": [\n {\n \"add\": {\n \"index\": \"logs-nginx.access-prod\",\n \"alias\": \"logs\"\n }\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->updateAliases([\n \"body\" => [\n \"actions\" => array(\n [\n \"add\" => [\n \"index\" => \"logs-nginx.access-prod\",\n \"alias\" => \"logs\",\n ],\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"actions\":[{\"add\":{\"index\":\"logs-nginx.access-prod\",\"alias\":\"logs\"}}]}' \"$ELASTICSEARCH_URL/_aliases\"", + "language": "curl" + } + ], "description": "An example body for a `POST _aliases` request.", "method_request": "POST _aliases", "value": "{\n \"actions\": [\n {\n \"add\": {\n \"index\": \"logs-nginx.access-prod\",\n \"alias\": \"logs\"\n }\n }\n ]\n}" @@ -153010,6 +159347,28 @@ "description": "Validate a query.\nValidates a query without running it.", "examples": { "IndicesValidateQueryExample1": { + "alternatives": [ + { + "code": "resp = client.indices.validate_query(\n index=\"my-index-000001\",\n q=\"user.id:kimchy\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.validateQuery({\n index: \"my-index-000001\",\n q: \"user.id:kimchy\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.validate_query(\n index: \"my-index-000001\",\n q: \"user.id:kimchy\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->validateQuery([\n \"index\" => \"my-index-000001\",\n \"q\" => \"user.id:kimchy\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_validate/query?q=user.id:kimchy\"", + "language": "curl" + } + ], "method_request": "GET my-index-000001/_validate/query?q=user.id:kimchy" } }, @@ -157582,19 +163941,85 @@ "description": "Perform chat completion inference\n\nThe chat completion inference API enables real-time responses for chat completion tasks by delivering answers incrementally, reducing response times during computation.\nIt only works with the `chat_completion` task type for `openai` and `elastic` inference services.\n\nNOTE: The `chat_completion` task type is only available within the _stream API and only supports streaming.\nThe Chat completion inference API and the Stream inference API differ in their response structure and capabilities.\nThe Chat completion inference API provides more comprehensive customization options through more fields and function calling support.\nIf you use the `openai` service or the `elastic` service, use the Chat completion inference API.", "examples": { "PostChatCompletionRequestExample1": { + "alternatives": [ + { + "code": "resp = client.inference.chat_completion_unified(\n inference_id=\"openai-completion\",\n chat_completion_request={\n \"model\": \"gpt-4o\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is Elastic?\"\n }\n ]\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.chatCompletionUnified({\n inference_id: \"openai-completion\",\n chat_completion_request: {\n model: \"gpt-4o\",\n messages: [\n {\n role: \"user\",\n content: \"What is Elastic?\",\n },\n ],\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.chat_completion_unified(\n inference_id: \"openai-completion\",\n body: {\n \"model\": \"gpt-4o\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is Elastic?\"\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->chatCompletionUnified([\n \"inference_id\" => \"openai-completion\",\n \"body\" => [\n \"model\" => \"gpt-4o\",\n \"messages\" => array(\n [\n \"role\" => \"user\",\n \"content\" => \"What is Elastic?\",\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"model\":\"gpt-4o\",\"messages\":[{\"role\":\"user\",\"content\":\"What is Elastic?\"}]}' \"$ELASTICSEARCH_URL/_inference/chat_completion/openai-completion/_stream\"", + "language": "curl" + } + ], "description": "Run `POST _inference/chat_completion/openai-completion/_stream` to perform a chat completion on the example question with streaming.", "method_request": "POST _inference/chat_completion/openai-completion/_stream", "summary": "A chat completion task", "value": "{\n \"model\": \"gpt-4o\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is Elastic?\"\n }\n ]\n}" }, "PostChatCompletionRequestExample2": { - "description": "Run `POST POST _inference/chat_completion/openai-completion/_stream` to perform a chat completion using an Assistant message with `tool_calls`.", + "alternatives": [ + { + "code": "resp = client.inference.chat_completion_unified(\n inference_id=\"openai-completion\",\n chat_completion_request={\n \"messages\": [\n {\n \"role\": \"assistant\",\n \"content\": \"Let's find out what the weather is\",\n \"tool_calls\": [\n {\n \"id\": \"call_KcAjWtAww20AihPHphUh46Gd\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"arguments\": \"{\\\"location\\\":\\\"Boston, MA\\\"}\"\n }\n }\n ]\n },\n {\n \"role\": \"tool\",\n \"content\": \"The weather is cold\",\n \"tool_call_id\": \"call_KcAjWtAww20AihPHphUh46Gd\"\n }\n ]\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.chatCompletionUnified({\n inference_id: \"openai-completion\",\n chat_completion_request: {\n messages: [\n {\n role: \"assistant\",\n content: \"Let's find out what the weather is\",\n tool_calls: [\n {\n id: \"call_KcAjWtAww20AihPHphUh46Gd\",\n type: \"function\",\n function: {\n name: \"get_current_weather\",\n arguments: '{\"location\":\"Boston, MA\"}',\n },\n },\n ],\n },\n {\n role: \"tool\",\n content: \"The weather is cold\",\n tool_call_id: \"call_KcAjWtAww20AihPHphUh46Gd\",\n },\n ],\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.chat_completion_unified(\n inference_id: \"openai-completion\",\n body: {\n \"messages\": [\n {\n \"role\": \"assistant\",\n \"content\": \"Let's find out what the weather is\",\n \"tool_calls\": [\n {\n \"id\": \"call_KcAjWtAww20AihPHphUh46Gd\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"arguments\": \"{\\\"location\\\":\\\"Boston, MA\\\"}\"\n }\n }\n ]\n },\n {\n \"role\": \"tool\",\n \"content\": \"The weather is cold\",\n \"tool_call_id\": \"call_KcAjWtAww20AihPHphUh46Gd\"\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->chatCompletionUnified([\n \"inference_id\" => \"openai-completion\",\n \"body\" => [\n \"messages\" => array(\n [\n \"role\" => \"assistant\",\n \"content\" => \"Let's find out what the weather is\",\n \"tool_calls\" => array(\n [\n \"id\" => \"call_KcAjWtAww20AihPHphUh46Gd\",\n \"type\" => \"function\",\n \"function\" => [\n \"name\" => \"get_current_weather\",\n \"arguments\" => \"{\\\"location\\\":\\\"Boston, MA\\\"}\",\n ],\n ],\n ),\n ],\n [\n \"role\" => \"tool\",\n \"content\" => \"The weather is cold\",\n \"tool_call_id\" => \"call_KcAjWtAww20AihPHphUh46Gd\",\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"messages\":[{\"role\":\"assistant\",\"content\":\"Let'\"'\"'s find out what the weather is\",\"tool_calls\":[{\"id\":\"call_KcAjWtAww20AihPHphUh46Gd\",\"type\":\"function\",\"function\":{\"name\":\"get_current_weather\",\"arguments\":\"{\\\"location\\\":\\\"Boston, MA\\\"}\"}}]},{\"role\":\"tool\",\"content\":\"The weather is cold\",\"tool_call_id\":\"call_KcAjWtAww20AihPHphUh46Gd\"}]}' \"$ELASTICSEARCH_URL/_inference/chat_completion/openai-completion/_stream\"", + "language": "curl" + } + ], + "description": "Run `POST _inference/chat_completion/openai-completion/_stream` to perform a chat completion using an Assistant message with `tool_calls`.", "method_request": "POST _inference/chat_completion/openai-completion/_stream", "summary": "A chat completion task with tool_calls", "value": "{\n \"messages\": [\n {\n \"role\": \"assistant\",\n \"content\": \"Let's find out what the weather is\",\n \"tool_calls\": [ \n {\n \"id\": \"call_KcAjWtAww20AihPHphUh46Gd\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"arguments\": \"{\\\"location\\\":\\\"Boston, MA\\\"}\"\n }\n }\n ]\n },\n { \n \"role\": \"tool\",\n \"content\": \"The weather is cold\",\n \"tool_call_id\": \"call_KcAjWtAww20AihPHphUh46Gd\"\n }\n ]\n}" }, "PostChatCompletionRequestExample3": { - "description": "Run `POST POST _inference/chat_completion/openai-completion/_stream` to perform a chat completion using a User message with `tools` and `tool_choice`.", + "alternatives": [ + { + "code": "resp = client.inference.chat_completion_unified(\n inference_id=\"openai-completion\",\n chat_completion_request={\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"What's the price of a scarf?\"\n }\n ]\n }\n ],\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_price\",\n \"description\": \"Get the current price of a item\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"item\": {\n \"id\": \"123\"\n }\n }\n }\n }\n }\n ],\n \"tool_choice\": {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_price\"\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.chatCompletionUnified({\n inference_id: \"openai-completion\",\n chat_completion_request: {\n messages: [\n {\n role: \"user\",\n content: [\n {\n type: \"text\",\n text: \"What's the price of a scarf?\",\n },\n ],\n },\n ],\n tools: [\n {\n type: \"function\",\n function: {\n name: \"get_current_price\",\n description: \"Get the current price of a item\",\n parameters: {\n type: \"object\",\n properties: {\n item: {\n id: \"123\",\n },\n },\n },\n },\n },\n ],\n tool_choice: {\n type: \"function\",\n function: {\n name: \"get_current_price\",\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.chat_completion_unified(\n inference_id: \"openai-completion\",\n body: {\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"What's the price of a scarf?\"\n }\n ]\n }\n ],\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_price\",\n \"description\": \"Get the current price of a item\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"item\": {\n \"id\": \"123\"\n }\n }\n }\n }\n }\n ],\n \"tool_choice\": {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_price\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->chatCompletionUnified([\n \"inference_id\" => \"openai-completion\",\n \"body\" => [\n \"messages\" => array(\n [\n \"role\" => \"user\",\n \"content\" => array(\n [\n \"type\" => \"text\",\n \"text\" => \"What's the price of a scarf?\",\n ],\n ),\n ],\n ),\n \"tools\" => array(\n [\n \"type\" => \"function\",\n \"function\" => [\n \"name\" => \"get_current_price\",\n \"description\" => \"Get the current price of a item\",\n \"parameters\" => [\n \"type\" => \"object\",\n \"properties\" => [\n \"item\" => [\n \"id\" => \"123\",\n ],\n ],\n ],\n ],\n ],\n ),\n \"tool_choice\" => [\n \"type\" => \"function\",\n \"function\" => [\n \"name\" => \"get_current_price\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"messages\":[{\"role\":\"user\",\"content\":[{\"type\":\"text\",\"text\":\"What'\"'\"'s the price of a scarf?\"}]}],\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_price\",\"description\":\"Get the current price of a item\",\"parameters\":{\"type\":\"object\",\"properties\":{\"item\":{\"id\":\"123\"}}}}}],\"tool_choice\":{\"type\":\"function\",\"function\":{\"name\":\"get_current_price\"}}}' \"$ELASTICSEARCH_URL/_inference/chat_completion/openai-completion/_stream\"", + "language": "curl" + } + ], + "description": "Run `POST _inference/chat_completion/openai-completion/_stream` to perform a chat completion using a User message with `tools` and `tool_choice`.", "method_request": "POST _inference/chat_completion/openai-completion/_stream", "summary": "A chat completion task with tools and tool_calls", "value": "{\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"What's the price of a scarf?\"\n }\n ]\n }\n ],\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_price\",\n \"description\": \"Get the current price of a item\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"item\": {\n \"id\": \"123\"\n }\n }\n }\n }\n }\n ],\n \"tool_choice\": {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_price\"\n }\n }\n}" @@ -157718,6 +164143,28 @@ "description": "Perform completion inference on the service", "examples": { "CompletionRequestExample1": { + "alternatives": [ + { + "code": "resp = client.inference.completion(\n inference_id=\"openai_chat_completions\",\n input=\"What is Elastic?\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.completion({\n inference_id: \"openai_chat_completions\",\n input: \"What is Elastic?\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.completion(\n inference_id: \"openai_chat_completions\",\n body: {\n \"input\": \"What is Elastic?\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->completion([\n \"inference_id\" => \"openai_chat_completions\",\n \"body\" => [\n \"input\" => \"What is Elastic?\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"input\":\"What is Elastic?\"}' \"$ELASTICSEARCH_URL/_inference/completion/openai_chat_completions\"", + "language": "curl" + } + ], "description": "Run `POST _inference/completion/openai_chat_completions` to perform a completion on the example question.", "method_request": "POST _inference/completion/openai_chat_completions", "summary": "Completion task", @@ -157802,6 +164249,28 @@ "description": "Delete an inference endpoint", "examples": { "InferenceDeleteExample1": { + "alternatives": [ + { + "code": "resp = client.inference.delete(\n task_type=\"sparse_embedding\",\n inference_id=\"my-elser-model\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.delete({\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.delete(\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->delete([\n \"task_type\" => \"sparse_embedding\",\n \"inference_id\" => \"my-elser-model\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"", + "language": "curl" + } + ], "method_request": "DELETE /_inference/sparse_embedding/my-elser-model" } }, @@ -157901,6 +164370,28 @@ "description": "Get an inference endpoint", "examples": { "InferenceGetExample1": { + "alternatives": [ + { + "code": "resp = client.inference.get(\n task_type=\"sparse_embedding\",\n inference_id=\"my-elser-model\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.get({\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.get(\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->get([\n \"task_type\" => \"sparse_embedding\",\n \"inference_id\" => \"my-elser-model\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"", + "language": "curl" + } + ], "method_request": "GET _inference/sparse_embedding/my-elser-model" } }, @@ -158123,6 +164614,28 @@ "description": "Create an inference endpoint.\n\nIMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face.\nFor built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models.\nHowever, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs.\n\nThe following integrations are available through the inference API. You can find the available task types next to the integration name:\n* AlibabaCloud AI Search (`completion`, `rerank`, `sparse_embedding`, `text_embedding`)\n* Amazon Bedrock (`completion`, `text_embedding`)\n* Anthropic (`completion`)\n* Azure AI Studio (`completion`, `text_embedding`)\n* Azure OpenAI (`completion`, `text_embedding`)\n* Cohere (`completion`, `rerank`, `text_embedding`)\n* Elasticsearch (`rerank`, `sparse_embedding`, `text_embedding` - this service is for built-in models and models uploaded through Eland)\n* ELSER (`sparse_embedding`)\n* Google AI Studio (`completion`, `text_embedding`)\n* Google Vertex AI (`rerank`, `text_embedding`)\n* Hugging Face (`text_embedding`)\n* Mistral (`text_embedding`)\n* OpenAI (`chat_completion`, `completion`, `text_embedding`)\n* VoyageAI (`text_embedding`, `rerank`)\n* Watsonx inference integration (`text_embedding`)\n* JinaAI (`text_embedding`, `rerank`)", "examples": { "InferencePutExample1": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"rerank\",\n inference_id=\"my-rerank-model\",\n inference_config={\n \"service\": \"cohere\",\n \"service_settings\": {\n \"model_id\": \"rerank-english-v3.0\",\n \"api_key\": \"{{COHERE_API_KEY}}\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"rerank\",\n inference_id: \"my-rerank-model\",\n inference_config: {\n service: \"cohere\",\n service_settings: {\n model_id: \"rerank-english-v3.0\",\n api_key: \"{{COHERE_API_KEY}}\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"rerank\",\n inference_id: \"my-rerank-model\",\n body: {\n \"service\": \"cohere\",\n \"service_settings\": {\n \"model_id\": \"rerank-english-v3.0\",\n \"api_key\": \"{{COHERE_API_KEY}}\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"rerank\",\n \"inference_id\" => \"my-rerank-model\",\n \"body\" => [\n \"service\" => \"cohere\",\n \"service_settings\" => [\n \"model_id\" => \"rerank-english-v3.0\",\n \"api_key\" => \"{{COHERE_API_KEY}}\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"cohere\",\"service_settings\":{\"model_id\":\"rerank-english-v3.0\",\"api_key\":\"{{COHERE_API_KEY}}\"}}' \"$ELASTICSEARCH_URL/_inference/rerank/my-rerank-model\"", + "language": "curl" + } + ], "description": "An example body for a `PUT _inference/rerank/my-rerank-model` request.", "method_request": "PUT _inference/rerank/my-rerank-model", "value": "{\n \"service\": \"cohere\",\n \"service_settings\": {\n \"model_id\": \"rerank-english-v3.0\",\n \"api_key\": \"{{COHERE_API_KEY}}\"\n }\n}" @@ -158249,24 +164762,112 @@ "description": "Create an AlibabaCloud AI Search inference endpoint.\n\nCreate an inference endpoint to perform an inference task with the `alibabacloud-ai-search` service.", "examples": { "PutAlibabaCloudRequestExample1": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"completion\",\n inference_id=\"alibabacloud_ai_search_completion\",\n inference_config={\n \"service\": \"alibabacloud-ai-search\",\n \"service_settings\": {\n \"host\": \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n \"api_key\": \"AlibabaCloud-API-Key\",\n \"service_id\": \"ops-qwen-turbo\",\n \"workspace\": \"default\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"completion\",\n inference_id: \"alibabacloud_ai_search_completion\",\n inference_config: {\n service: \"alibabacloud-ai-search\",\n service_settings: {\n host: \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n api_key: \"AlibabaCloud-API-Key\",\n service_id: \"ops-qwen-turbo\",\n workspace: \"default\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"completion\",\n inference_id: \"alibabacloud_ai_search_completion\",\n body: {\n \"service\": \"alibabacloud-ai-search\",\n \"service_settings\": {\n \"host\": \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n \"api_key\": \"AlibabaCloud-API-Key\",\n \"service_id\": \"ops-qwen-turbo\",\n \"workspace\": \"default\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"completion\",\n \"inference_id\" => \"alibabacloud_ai_search_completion\",\n \"body\" => [\n \"service\" => \"alibabacloud-ai-search\",\n \"service_settings\" => [\n \"host\" => \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n \"api_key\" => \"AlibabaCloud-API-Key\",\n \"service_id\" => \"ops-qwen-turbo\",\n \"workspace\" => \"default\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"alibabacloud-ai-search\",\"service_settings\":{\"host\":\"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\"api_key\":\"AlibabaCloud-API-Key\",\"service_id\":\"ops-qwen-turbo\",\"workspace\":\"default\"}}' \"$ELASTICSEARCH_URL/_inference/completion/alibabacloud_ai_search_completion\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/completion/alibabacloud_ai_search_completion` to create an inference endpoint that performs a completion task.", "method_request": "PUT _inference/completion/alibabacloud_ai_search_completion", "summary": "A completion task", "value": "{\n \"service\": \"alibabacloud-ai-search\",\n \"service_settings\": {\n \"host\" : \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n \"api_key\": \"AlibabaCloud-API-Key\",\n \"service_id\": \"ops-qwen-turbo\",\n \"workspace\" : \"default\"\n }\n}" }, "PutAlibabaCloudRequestExample2": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"rerank\",\n inference_id=\"alibabacloud_ai_search_rerank\",\n inference_config={\n \"service\": \"alibabacloud-ai-search\",\n \"service_settings\": {\n \"api_key\": \"AlibabaCloud-API-Key\",\n \"service_id\": \"ops-bge-reranker-larger\",\n \"host\": \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n \"workspace\": \"default\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"rerank\",\n inference_id: \"alibabacloud_ai_search_rerank\",\n inference_config: {\n service: \"alibabacloud-ai-search\",\n service_settings: {\n api_key: \"AlibabaCloud-API-Key\",\n service_id: \"ops-bge-reranker-larger\",\n host: \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n workspace: \"default\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"rerank\",\n inference_id: \"alibabacloud_ai_search_rerank\",\n body: {\n \"service\": \"alibabacloud-ai-search\",\n \"service_settings\": {\n \"api_key\": \"AlibabaCloud-API-Key\",\n \"service_id\": \"ops-bge-reranker-larger\",\n \"host\": \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n \"workspace\": \"default\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"rerank\",\n \"inference_id\" => \"alibabacloud_ai_search_rerank\",\n \"body\" => [\n \"service\" => \"alibabacloud-ai-search\",\n \"service_settings\" => [\n \"api_key\" => \"AlibabaCloud-API-Key\",\n \"service_id\" => \"ops-bge-reranker-larger\",\n \"host\" => \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n \"workspace\" => \"default\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"alibabacloud-ai-search\",\"service_settings\":{\"api_key\":\"AlibabaCloud-API-Key\",\"service_id\":\"ops-bge-reranker-larger\",\"host\":\"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\"workspace\":\"default\"}}' \"$ELASTICSEARCH_URL/_inference/rerank/alibabacloud_ai_search_rerank\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/rerank/alibabacloud_ai_search_rerank` to create an inference endpoint that performs a rerank task.", "method_request": "PUT _inference/rerank/alibabacloud_ai_search_rerank", "summary": "A rerank task", "value": "{\n \"service\": \"alibabacloud-ai-search\",\n \"service_settings\": {\n \"api_key\": \"AlibabaCloud-API-Key\",\n \"service_id\": \"ops-bge-reranker-larger\",\n \"host\": \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n \"workspace\": \"default\"\n }\n}" }, "PutAlibabaCloudRequestExample3": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"sparse_embedding\",\n inference_id=\"alibabacloud_ai_search_sparse\",\n inference_config={\n \"service\": \"alibabacloud-ai-search\",\n \"service_settings\": {\n \"api_key\": \"AlibabaCloud-API-Key\",\n \"service_id\": \"ops-text-sparse-embedding-001\",\n \"host\": \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n \"workspace\": \"default\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"sparse_embedding\",\n inference_id: \"alibabacloud_ai_search_sparse\",\n inference_config: {\n service: \"alibabacloud-ai-search\",\n service_settings: {\n api_key: \"AlibabaCloud-API-Key\",\n service_id: \"ops-text-sparse-embedding-001\",\n host: \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n workspace: \"default\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"sparse_embedding\",\n inference_id: \"alibabacloud_ai_search_sparse\",\n body: {\n \"service\": \"alibabacloud-ai-search\",\n \"service_settings\": {\n \"api_key\": \"AlibabaCloud-API-Key\",\n \"service_id\": \"ops-text-sparse-embedding-001\",\n \"host\": \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n \"workspace\": \"default\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"sparse_embedding\",\n \"inference_id\" => \"alibabacloud_ai_search_sparse\",\n \"body\" => [\n \"service\" => \"alibabacloud-ai-search\",\n \"service_settings\" => [\n \"api_key\" => \"AlibabaCloud-API-Key\",\n \"service_id\" => \"ops-text-sparse-embedding-001\",\n \"host\" => \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n \"workspace\" => \"default\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"alibabacloud-ai-search\",\"service_settings\":{\"api_key\":\"AlibabaCloud-API-Key\",\"service_id\":\"ops-text-sparse-embedding-001\",\"host\":\"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\"workspace\":\"default\"}}' \"$ELASTICSEARCH_URL/_inference/sparse_embedding/alibabacloud_ai_search_sparse\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/sparse_embedding/alibabacloud_ai_search_sparse` to create an inference endpoint that performs perform a sparse embedding task.", "method_request": "PUT _inference/sparse_embedding/alibabacloud_ai_search_sparse", "summary": "A sparse embedding task", "value": "{\n \"service\": \"alibabacloud-ai-search\",\n \"service_settings\": {\n \"api_key\": \"AlibabaCloud-API-Key\",\n \"service_id\": \"ops-text-sparse-embedding-001\",\n \"host\": \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n \"workspace\": \"default\"\n }\n}" }, "PutAlibabaCloudRequestExample4": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"alibabacloud_ai_search_embeddings\",\n inference_config={\n \"service\": \"alibabacloud-ai-search\",\n \"service_settings\": {\n \"api_key\": \"AlibabaCloud-API-Key\",\n \"service_id\": \"ops-text-embedding-001\",\n \"host\": \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n \"workspace\": \"default\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"alibabacloud_ai_search_embeddings\",\n inference_config: {\n service: \"alibabacloud-ai-search\",\n service_settings: {\n api_key: \"AlibabaCloud-API-Key\",\n service_id: \"ops-text-embedding-001\",\n host: \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n workspace: \"default\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"alibabacloud_ai_search_embeddings\",\n body: {\n \"service\": \"alibabacloud-ai-search\",\n \"service_settings\": {\n \"api_key\": \"AlibabaCloud-API-Key\",\n \"service_id\": \"ops-text-embedding-001\",\n \"host\": \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n \"workspace\": \"default\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"alibabacloud_ai_search_embeddings\",\n \"body\" => [\n \"service\" => \"alibabacloud-ai-search\",\n \"service_settings\" => [\n \"api_key\" => \"AlibabaCloud-API-Key\",\n \"service_id\" => \"ops-text-embedding-001\",\n \"host\" => \"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\n \"workspace\" => \"default\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"alibabacloud-ai-search\",\"service_settings\":{\"api_key\":\"AlibabaCloud-API-Key\",\"service_id\":\"ops-text-embedding-001\",\"host\":\"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\"workspace\":\"default\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/alibabacloud_ai_search_embeddings\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/text_embedding/alibabacloud_ai_search_embeddings` to create an inference endpoint that performs a text embedding task.", "method_request": "PUT _inference/text_embedding/alibabacloud_ai_search_embeddings", "summary": "A text embedding task", @@ -158394,12 +164995,56 @@ "description": "Create an Amazon Bedrock inference endpoint.\n\nCreate an inference endpoint to perform an inference task with the `amazonbedrock` service.\n\n>info\n> You need to provide the access and secret keys only once, during the inference model creation. The get inference API does not retrieve your access or secret keys. After creating the inference model, you cannot change the associated key pairs. If you want to use a different access and secret key pair, delete the inference model and recreate it with the same name and the updated keys.", "examples": { "PutAmazonBedrockRequestExample1": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"amazon_bedrock_embeddings\",\n inference_config={\n \"service\": \"amazonbedrock\",\n \"service_settings\": {\n \"access_key\": \"AWS-access-key\",\n \"secret_key\": \"AWS-secret-key\",\n \"region\": \"us-east-1\",\n \"provider\": \"amazontitan\",\n \"model\": \"amazon.titan-embed-text-v2:0\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"amazon_bedrock_embeddings\",\n inference_config: {\n service: \"amazonbedrock\",\n service_settings: {\n access_key: \"AWS-access-key\",\n secret_key: \"AWS-secret-key\",\n region: \"us-east-1\",\n provider: \"amazontitan\",\n model: \"amazon.titan-embed-text-v2:0\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"amazon_bedrock_embeddings\",\n body: {\n \"service\": \"amazonbedrock\",\n \"service_settings\": {\n \"access_key\": \"AWS-access-key\",\n \"secret_key\": \"AWS-secret-key\",\n \"region\": \"us-east-1\",\n \"provider\": \"amazontitan\",\n \"model\": \"amazon.titan-embed-text-v2:0\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"amazon_bedrock_embeddings\",\n \"body\" => [\n \"service\" => \"amazonbedrock\",\n \"service_settings\" => [\n \"access_key\" => \"AWS-access-key\",\n \"secret_key\" => \"AWS-secret-key\",\n \"region\" => \"us-east-1\",\n \"provider\" => \"amazontitan\",\n \"model\" => \"amazon.titan-embed-text-v2:0\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"amazonbedrock\",\"service_settings\":{\"access_key\":\"AWS-access-key\",\"secret_key\":\"AWS-secret-key\",\"region\":\"us-east-1\",\"provider\":\"amazontitan\",\"model\":\"amazon.titan-embed-text-v2:0\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/amazon_bedrock_embeddings\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/text_embedding/amazon_bedrock_embeddings` to create an inference endpoint that performs a text embedding task.", "method_request": "PUT _inference/text_embedding/amazon_bedrock_embeddings", "summary": "A text embedding task", "value": "{\n \"service\": \"amazonbedrock\",\n \"service_settings\": {\n \"access_key\": \"AWS-access-key\",\n \"secret_key\": \"AWS-secret-key\",\n \"region\": \"us-east-1\",\n \"provider\": \"amazontitan\",\n \"model\": \"amazon.titan-embed-text-v2:0\"\n }\n}" }, "PutAmazonBedrockRequestExample2": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"completion\",\n inference_id=\"openai-completion\",\n inference_config={\n \"service\": \"openai\",\n \"service_settings\": {\n \"api_key\": \"OpenAI-API-Key\",\n \"model_id\": \"gpt-3.5-turbo\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"completion\",\n inference_id: \"openai-completion\",\n inference_config: {\n service: \"openai\",\n service_settings: {\n api_key: \"OpenAI-API-Key\",\n model_id: \"gpt-3.5-turbo\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"completion\",\n inference_id: \"openai-completion\",\n body: {\n \"service\": \"openai\",\n \"service_settings\": {\n \"api_key\": \"OpenAI-API-Key\",\n \"model_id\": \"gpt-3.5-turbo\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"completion\",\n \"inference_id\" => \"openai-completion\",\n \"body\" => [\n \"service\" => \"openai\",\n \"service_settings\" => [\n \"api_key\" => \"OpenAI-API-Key\",\n \"model_id\" => \"gpt-3.5-turbo\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"openai\",\"service_settings\":{\"api_key\":\"OpenAI-API-Key\",\"model_id\":\"gpt-3.5-turbo\"}}' \"$ELASTICSEARCH_URL/_inference/completion/openai-completion\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/completion/openai-completion` to create an inference endpoint to perform a completion task type.", "method_request": "PUT _inference/completion/openai-completion", "summary": "A completion task", @@ -158527,6 +165172,28 @@ "description": "Create an Anthropic inference endpoint.\n\nCreate an inference endpoint to perform an inference task with the `anthropic` service.", "examples": { "PutAnthropicRequestExample1": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"completion\",\n inference_id=\"anthropic_completion\",\n inference_config={\n \"service\": \"anthropic\",\n \"service_settings\": {\n \"api_key\": \"Anthropic-Api-Key\",\n \"model_id\": \"Model-ID\"\n },\n \"task_settings\": {\n \"max_tokens\": 1024\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"completion\",\n inference_id: \"anthropic_completion\",\n inference_config: {\n service: \"anthropic\",\n service_settings: {\n api_key: \"Anthropic-Api-Key\",\n model_id: \"Model-ID\",\n },\n task_settings: {\n max_tokens: 1024,\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"completion\",\n inference_id: \"anthropic_completion\",\n body: {\n \"service\": \"anthropic\",\n \"service_settings\": {\n \"api_key\": \"Anthropic-Api-Key\",\n \"model_id\": \"Model-ID\"\n },\n \"task_settings\": {\n \"max_tokens\": 1024\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"completion\",\n \"inference_id\" => \"anthropic_completion\",\n \"body\" => [\n \"service\" => \"anthropic\",\n \"service_settings\" => [\n \"api_key\" => \"Anthropic-Api-Key\",\n \"model_id\" => \"Model-ID\",\n ],\n \"task_settings\" => [\n \"max_tokens\" => 1024,\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"anthropic\",\"service_settings\":{\"api_key\":\"Anthropic-Api-Key\",\"model_id\":\"Model-ID\"},\"task_settings\":{\"max_tokens\":1024}}' \"$ELASTICSEARCH_URL/_inference/completion/anthropic_completion\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/completion/anthropic_completion` to create an inference endpoint that performs a completion task.", "method_request": "PUT _inference/completion/anthropic_completion", "value": "{\n \"service\": \"anthropic\",\n \"service_settings\": {\n \"api_key\": \"Anthropic-Api-Key\",\n \"model_id\": \"Model-ID\"\n },\n \"task_settings\": {\n \"max_tokens\": 1024\n }\n}" @@ -158653,12 +165320,56 @@ "description": "Create an Azure AI studio inference endpoint.\n\nCreate an inference endpoint to perform an inference task with the `azureaistudio` service.", "examples": { "PutAzureAiStudioRequestExample1": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"azure_ai_studio_embeddings\",\n inference_config={\n \"service\": \"azureaistudio\",\n \"service_settings\": {\n \"api_key\": \"Azure-AI-Studio-API-key\",\n \"target\": \"Target-Uri\",\n \"provider\": \"openai\",\n \"endpoint_type\": \"token\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"azure_ai_studio_embeddings\",\n inference_config: {\n service: \"azureaistudio\",\n service_settings: {\n api_key: \"Azure-AI-Studio-API-key\",\n target: \"Target-Uri\",\n provider: \"openai\",\n endpoint_type: \"token\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"azure_ai_studio_embeddings\",\n body: {\n \"service\": \"azureaistudio\",\n \"service_settings\": {\n \"api_key\": \"Azure-AI-Studio-API-key\",\n \"target\": \"Target-Uri\",\n \"provider\": \"openai\",\n \"endpoint_type\": \"token\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"azure_ai_studio_embeddings\",\n \"body\" => [\n \"service\" => \"azureaistudio\",\n \"service_settings\" => [\n \"api_key\" => \"Azure-AI-Studio-API-key\",\n \"target\" => \"Target-Uri\",\n \"provider\" => \"openai\",\n \"endpoint_type\" => \"token\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"azureaistudio\",\"service_settings\":{\"api_key\":\"Azure-AI-Studio-API-key\",\"target\":\"Target-Uri\",\"provider\":\"openai\",\"endpoint_type\":\"token\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/azure_ai_studio_embeddings\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/text_embedding/azure_ai_studio_embeddings` to create an inference endpoint that performs a text_embedding task. Note that you do not specify a model here, as it is defined already in the Azure AI Studio deployment.", "method_request": "PUT _inference/text_embedding/azure_ai_studio_embeddings", "summary": "A text embedding task", "value": "{\n \"service\": \"azureaistudio\",\n \"service_settings\": {\n \"api_key\": \"Azure-AI-Studio-API-key\",\n \"target\": \"Target-Uri\",\n \"provider\": \"openai\",\n \"endpoint_type\": \"token\"\n }\n}" }, "PutAzureAiStudioRequestExample2": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"completion\",\n inference_id=\"azure_ai_studio_completion\",\n inference_config={\n \"service\": \"azureaistudio\",\n \"service_settings\": {\n \"api_key\": \"Azure-AI-Studio-API-key\",\n \"target\": \"Target-URI\",\n \"provider\": \"databricks\",\n \"endpoint_type\": \"realtime\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"completion\",\n inference_id: \"azure_ai_studio_completion\",\n inference_config: {\n service: \"azureaistudio\",\n service_settings: {\n api_key: \"Azure-AI-Studio-API-key\",\n target: \"Target-URI\",\n provider: \"databricks\",\n endpoint_type: \"realtime\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"completion\",\n inference_id: \"azure_ai_studio_completion\",\n body: {\n \"service\": \"azureaistudio\",\n \"service_settings\": {\n \"api_key\": \"Azure-AI-Studio-API-key\",\n \"target\": \"Target-URI\",\n \"provider\": \"databricks\",\n \"endpoint_type\": \"realtime\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"completion\",\n \"inference_id\" => \"azure_ai_studio_completion\",\n \"body\" => [\n \"service\" => \"azureaistudio\",\n \"service_settings\" => [\n \"api_key\" => \"Azure-AI-Studio-API-key\",\n \"target\" => \"Target-URI\",\n \"provider\" => \"databricks\",\n \"endpoint_type\" => \"realtime\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"azureaistudio\",\"service_settings\":{\"api_key\":\"Azure-AI-Studio-API-key\",\"target\":\"Target-URI\",\"provider\":\"databricks\",\"endpoint_type\":\"realtime\"}}' \"$ELASTICSEARCH_URL/_inference/completion/azure_ai_studio_completion\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/completion/azure_ai_studio_completion` to create an inference endpoint that performs a completion task.", "method_request": "PUT _inference/completion/azure_ai_studio_completion", "summary": "A completion task", @@ -158786,12 +165497,56 @@ "description": "Create an Azure OpenAI inference endpoint.\n\nCreate an inference endpoint to perform an inference task with the `azureopenai` service.\n\nThe list of chat completion models that you can choose from in your Azure OpenAI deployment include:\n\n* [GPT-4 and GPT-4 Turbo models](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models?tabs=global-standard%2Cstandard-chat-completions#gpt-4-and-gpt-4-turbo-models)\n* [GPT-3.5](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models?tabs=global-standard%2Cstandard-chat-completions#gpt-35)\n\nThe list of embeddings models that you can choose from in your deployment can be found in the [Azure models documentation](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models?tabs=global-standard%2Cstandard-chat-completions#embeddings).", "examples": { "PutAzureOpenAiRequestExample1": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"azure_openai_embeddings\",\n inference_config={\n \"service\": \"azureopenai\",\n \"service_settings\": {\n \"api_key\": \"Api-Key\",\n \"resource_name\": \"Resource-name\",\n \"deployment_id\": \"Deployment-id\",\n \"api_version\": \"2024-02-01\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"azure_openai_embeddings\",\n inference_config: {\n service: \"azureopenai\",\n service_settings: {\n api_key: \"Api-Key\",\n resource_name: \"Resource-name\",\n deployment_id: \"Deployment-id\",\n api_version: \"2024-02-01\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"azure_openai_embeddings\",\n body: {\n \"service\": \"azureopenai\",\n \"service_settings\": {\n \"api_key\": \"Api-Key\",\n \"resource_name\": \"Resource-name\",\n \"deployment_id\": \"Deployment-id\",\n \"api_version\": \"2024-02-01\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"azure_openai_embeddings\",\n \"body\" => [\n \"service\" => \"azureopenai\",\n \"service_settings\" => [\n \"api_key\" => \"Api-Key\",\n \"resource_name\" => \"Resource-name\",\n \"deployment_id\" => \"Deployment-id\",\n \"api_version\" => \"2024-02-01\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"azureopenai\",\"service_settings\":{\"api_key\":\"Api-Key\",\"resource_name\":\"Resource-name\",\"deployment_id\":\"Deployment-id\",\"api_version\":\"2024-02-01\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/azure_openai_embeddings\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/text_embedding/azure_openai_embeddings` to create an inference endpoint that performs a `text_embedding` task. You do not specify a model, as it is defined already in the Azure OpenAI deployment.", "method_request": "PUT _inference/text_embedding/azure_openai_embeddings", "summary": "A text embedding task", "value": "{\n \"service\": \"azureopenai\",\n \"service_settings\": {\n \"api_key\": \"Api-Key\",\n \"resource_name\": \"Resource-name\",\n \"deployment_id\": \"Deployment-id\",\n \"api_version\": \"2024-02-01\"\n }\n}" }, "PutAzureOpenAiRequestExample2": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"completion\",\n inference_id=\"azure_openai_completion\",\n inference_config={\n \"service\": \"azureopenai\",\n \"service_settings\": {\n \"api_key\": \"Api-Key\",\n \"resource_name\": \"Resource-name\",\n \"deployment_id\": \"Deployment-id\",\n \"api_version\": \"2024-02-01\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"completion\",\n inference_id: \"azure_openai_completion\",\n inference_config: {\n service: \"azureopenai\",\n service_settings: {\n api_key: \"Api-Key\",\n resource_name: \"Resource-name\",\n deployment_id: \"Deployment-id\",\n api_version: \"2024-02-01\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"completion\",\n inference_id: \"azure_openai_completion\",\n body: {\n \"service\": \"azureopenai\",\n \"service_settings\": {\n \"api_key\": \"Api-Key\",\n \"resource_name\": \"Resource-name\",\n \"deployment_id\": \"Deployment-id\",\n \"api_version\": \"2024-02-01\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"completion\",\n \"inference_id\" => \"azure_openai_completion\",\n \"body\" => [\n \"service\" => \"azureopenai\",\n \"service_settings\" => [\n \"api_key\" => \"Api-Key\",\n \"resource_name\" => \"Resource-name\",\n \"deployment_id\" => \"Deployment-id\",\n \"api_version\" => \"2024-02-01\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"azureopenai\",\"service_settings\":{\"api_key\":\"Api-Key\",\"resource_name\":\"Resource-name\",\"deployment_id\":\"Deployment-id\",\"api_version\":\"2024-02-01\"}}' \"$ELASTICSEARCH_URL/_inference/completion/azure_openai_completion\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/completion/azure_openai_completion` to create an inference endpoint that performs a `completion` task.", "method_request": "PUT _inference/completion/azure_openai_completion", "summary": "A completion task", @@ -158919,12 +165674,56 @@ "description": "Create a Cohere inference endpoint.\n\nCreate an inference endpoint to perform an inference task with the `cohere` service.", "examples": { "PutCohereRequestExample1": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"cohere-embeddings\",\n inference_config={\n \"service\": \"cohere\",\n \"service_settings\": {\n \"api_key\": \"Cohere-Api-key\",\n \"model_id\": \"embed-english-light-v3.0\",\n \"embedding_type\": \"byte\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"cohere-embeddings\",\n inference_config: {\n service: \"cohere\",\n service_settings: {\n api_key: \"Cohere-Api-key\",\n model_id: \"embed-english-light-v3.0\",\n embedding_type: \"byte\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"cohere-embeddings\",\n body: {\n \"service\": \"cohere\",\n \"service_settings\": {\n \"api_key\": \"Cohere-Api-key\",\n \"model_id\": \"embed-english-light-v3.0\",\n \"embedding_type\": \"byte\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"cohere-embeddings\",\n \"body\" => [\n \"service\" => \"cohere\",\n \"service_settings\" => [\n \"api_key\" => \"Cohere-Api-key\",\n \"model_id\" => \"embed-english-light-v3.0\",\n \"embedding_type\" => \"byte\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"cohere\",\"service_settings\":{\"api_key\":\"Cohere-Api-key\",\"model_id\":\"embed-english-light-v3.0\",\"embedding_type\":\"byte\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/cohere-embeddings\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/text_embedding/cohere-embeddings` to create an inference endpoint that performs a text embedding task.", "method_request": "PUT _inference/text_embedding/cohere-embeddings", "summary": "A text embedding task", "value": "{\n \"service\": \"cohere\",\n \"service_settings\": {\n \"api_key\": \"Cohere-Api-key\",\n \"model_id\": \"embed-english-light-v3.0\",\n \"embedding_type\": \"byte\"\n }\n}" }, "PutCohereRequestExample2": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"rerank\",\n inference_id=\"cohere-rerank\",\n inference_config={\n \"service\": \"cohere\",\n \"service_settings\": {\n \"api_key\": \"Cohere-API-key\",\n \"model_id\": \"rerank-english-v3.0\"\n },\n \"task_settings\": {\n \"top_n\": 10,\n \"return_documents\": True\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"rerank\",\n inference_id: \"cohere-rerank\",\n inference_config: {\n service: \"cohere\",\n service_settings: {\n api_key: \"Cohere-API-key\",\n model_id: \"rerank-english-v3.0\",\n },\n task_settings: {\n top_n: 10,\n return_documents: true,\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"rerank\",\n inference_id: \"cohere-rerank\",\n body: {\n \"service\": \"cohere\",\n \"service_settings\": {\n \"api_key\": \"Cohere-API-key\",\n \"model_id\": \"rerank-english-v3.0\"\n },\n \"task_settings\": {\n \"top_n\": 10,\n \"return_documents\": true\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"rerank\",\n \"inference_id\" => \"cohere-rerank\",\n \"body\" => [\n \"service\" => \"cohere\",\n \"service_settings\" => [\n \"api_key\" => \"Cohere-API-key\",\n \"model_id\" => \"rerank-english-v3.0\",\n ],\n \"task_settings\" => [\n \"top_n\" => 10,\n \"return_documents\" => true,\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"cohere\",\"service_settings\":{\"api_key\":\"Cohere-API-key\",\"model_id\":\"rerank-english-v3.0\"},\"task_settings\":{\"top_n\":10,\"return_documents\":true}}' \"$ELASTICSEARCH_URL/_inference/rerank/cohere-rerank\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/rerank/cohere-rerank` to create an inference endpoint that performs a rerank task.", "method_request": "PUT _inference/rerank/cohere-rerank", "summary": "A rerank task", @@ -159052,36 +165851,168 @@ "description": "Create an Elasticsearch inference endpoint.\n\nCreate an inference endpoint to perform an inference task with the `elasticsearch` service.\n\n> info\n> Your Elasticsearch deployment contains preconfigured ELSER and E5 inference endpoints, you only need to create the enpoints using the API if you want to customize the settings.\n\nIf you use the ELSER or the E5 model through the `elasticsearch` service, the API request will automatically download and deploy the model if it isn't downloaded yet.\n\n> info\n> You might see a 502 bad gateway error in the response when using the Kibana Console. This error usually just reflects a timeout, while the model downloads in the background. You can check the download progress in the Machine Learning UI. If using the Python client, you can set the timeout parameter to a higher value.\n\nAfter creating the endpoint, wait for the model deployment to complete before using it.\nTo verify the deployment status, use the get trained model statistics API.\nLook for `\"state\": \"fully_allocated\"` in the response and ensure that the `\"allocation_count\"` matches the `\"target_allocation_count\"`.\nAvoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources.", "examples": { "PutElasticsearchRequestExample1": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"sparse_embedding\",\n inference_id=\"my-elser-model\",\n inference_config={\n \"service\": \"elasticsearch\",\n \"service_settings\": {\n \"adaptive_allocations\": {\n \"enabled\": True,\n \"min_number_of_allocations\": 1,\n \"max_number_of_allocations\": 4\n },\n \"num_threads\": 1,\n \"model_id\": \".elser_model_2\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n inference_config: {\n service: \"elasticsearch\",\n service_settings: {\n adaptive_allocations: {\n enabled: true,\n min_number_of_allocations: 1,\n max_number_of_allocations: 4,\n },\n num_threads: 1,\n model_id: \".elser_model_2\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n body: {\n \"service\": \"elasticsearch\",\n \"service_settings\": {\n \"adaptive_allocations\": {\n \"enabled\": true,\n \"min_number_of_allocations\": 1,\n \"max_number_of_allocations\": 4\n },\n \"num_threads\": 1,\n \"model_id\": \".elser_model_2\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"sparse_embedding\",\n \"inference_id\" => \"my-elser-model\",\n \"body\" => [\n \"service\" => \"elasticsearch\",\n \"service_settings\" => [\n \"adaptive_allocations\" => [\n \"enabled\" => true,\n \"min_number_of_allocations\" => 1,\n \"max_number_of_allocations\" => 4,\n ],\n \"num_threads\" => 1,\n \"model_id\" => \".elser_model_2\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"elasticsearch\",\"service_settings\":{\"adaptive_allocations\":{\"enabled\":true,\"min_number_of_allocations\":1,\"max_number_of_allocations\":4},\"num_threads\":1,\"model_id\":\".elser_model_2\"}}' \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/sparse_embedding/my-elser-model` to create an inference endpoint that performs a `sparse_embedding` task. The `model_id` must be the ID of one of the built-in ELSER models. The API will automatically download the ELSER model if it isn't already downloaded and then deploy the model.", "method_request": "PUT _inference/sparse_embedding/my-elser-model", "summary": "ELSER sparse embedding task", "value": "{\n \"service\": \"elasticsearch\",\n \"service_settings\": {\n \"adaptive_allocations\": { \n \"enabled\": true,\n \"min_number_of_allocations\": 1,\n \"max_number_of_allocations\": 4\n },\n \"num_threads\": 1,\n \"model_id\": \".elser_model_2\" \n }\n}" }, "PutElasticsearchRequestExample2": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"rerank\",\n inference_id=\"my-elastic-rerank\",\n inference_config={\n \"service\": \"elasticsearch\",\n \"service_settings\": {\n \"model_id\": \".rerank-v1\",\n \"num_threads\": 1,\n \"adaptive_allocations\": {\n \"enabled\": True,\n \"min_number_of_allocations\": 1,\n \"max_number_of_allocations\": 4\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"rerank\",\n inference_id: \"my-elastic-rerank\",\n inference_config: {\n service: \"elasticsearch\",\n service_settings: {\n model_id: \".rerank-v1\",\n num_threads: 1,\n adaptive_allocations: {\n enabled: true,\n min_number_of_allocations: 1,\n max_number_of_allocations: 4,\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"rerank\",\n inference_id: \"my-elastic-rerank\",\n body: {\n \"service\": \"elasticsearch\",\n \"service_settings\": {\n \"model_id\": \".rerank-v1\",\n \"num_threads\": 1,\n \"adaptive_allocations\": {\n \"enabled\": true,\n \"min_number_of_allocations\": 1,\n \"max_number_of_allocations\": 4\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"rerank\",\n \"inference_id\" => \"my-elastic-rerank\",\n \"body\" => [\n \"service\" => \"elasticsearch\",\n \"service_settings\" => [\n \"model_id\" => \".rerank-v1\",\n \"num_threads\" => 1,\n \"adaptive_allocations\" => [\n \"enabled\" => true,\n \"min_number_of_allocations\" => 1,\n \"max_number_of_allocations\" => 4,\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"elasticsearch\",\"service_settings\":{\"model_id\":\".rerank-v1\",\"num_threads\":1,\"adaptive_allocations\":{\"enabled\":true,\"min_number_of_allocations\":1,\"max_number_of_allocations\":4}}}' \"$ELASTICSEARCH_URL/_inference/rerank/my-elastic-rerank\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/rerank/my-elastic-rerank` to create an inference endpoint that performs a rerank task using the built-in Elastic Rerank cross-encoder model. The `model_id` must be `.rerank-v1`, which is the ID of the built-in Elastic Rerank model. The API will automatically download the Elastic Rerank model if it isn't already downloaded and then deploy the model. Once deployed, the model can be used for semantic re-ranking with a `text_similarity_reranker` retriever.", "method_request": "PUT _inference/rerank/my-elastic-rerank", "summary": "Elastic rerank task", "value": "{\n \"service\": \"elasticsearch\",\n \"service_settings\": {\n \"model_id\": \".rerank-v1\", \n \"num_threads\": 1,\n \"adaptive_allocations\": { \n \"enabled\": true,\n \"min_number_of_allocations\": 1,\n \"max_number_of_allocations\": 4\n }\n }\n}" }, "PutElasticsearchRequestExample3": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"my-e5-model\",\n inference_config={\n \"service\": \"elasticsearch\",\n \"service_settings\": {\n \"num_allocations\": 1,\n \"num_threads\": 1,\n \"model_id\": \".multilingual-e5-small\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"my-e5-model\",\n inference_config: {\n service: \"elasticsearch\",\n service_settings: {\n num_allocations: 1,\n num_threads: 1,\n model_id: \".multilingual-e5-small\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"my-e5-model\",\n body: {\n \"service\": \"elasticsearch\",\n \"service_settings\": {\n \"num_allocations\": 1,\n \"num_threads\": 1,\n \"model_id\": \".multilingual-e5-small\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"my-e5-model\",\n \"body\" => [\n \"service\" => \"elasticsearch\",\n \"service_settings\" => [\n \"num_allocations\" => 1,\n \"num_threads\" => 1,\n \"model_id\" => \".multilingual-e5-small\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"elasticsearch\",\"service_settings\":{\"num_allocations\":1,\"num_threads\":1,\"model_id\":\".multilingual-e5-small\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/my-e5-model\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/text_embedding/my-e5-model` to create an inference endpoint that performs a `text_embedding` task. The `model_id` must be the ID of one of the built-in E5 models. The API will automatically download the E5 model if it isn't already downloaded and then deploy the model.", "method_request": "PUT _inference/text_embedding/my-e5-model", "summary": "E5 text embedding task", "value": "{\n \"service\": \"elasticsearch\",\n \"service_settings\": {\n \"num_allocations\": 1,\n \"num_threads\": 1,\n \"model_id\": \".multilingual-e5-small\" \n }\n}" }, "PutElasticsearchRequestExample4": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"my-msmarco-minilm-model\",\n inference_config={\n \"service\": \"elasticsearch\",\n \"service_settings\": {\n \"num_allocations\": 1,\n \"num_threads\": 1,\n \"model_id\": \"msmarco-MiniLM-L12-cos-v5\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"my-msmarco-minilm-model\",\n inference_config: {\n service: \"elasticsearch\",\n service_settings: {\n num_allocations: 1,\n num_threads: 1,\n model_id: \"msmarco-MiniLM-L12-cos-v5\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"my-msmarco-minilm-model\",\n body: {\n \"service\": \"elasticsearch\",\n \"service_settings\": {\n \"num_allocations\": 1,\n \"num_threads\": 1,\n \"model_id\": \"msmarco-MiniLM-L12-cos-v5\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"my-msmarco-minilm-model\",\n \"body\" => [\n \"service\" => \"elasticsearch\",\n \"service_settings\" => [\n \"num_allocations\" => 1,\n \"num_threads\" => 1,\n \"model_id\" => \"msmarco-MiniLM-L12-cos-v5\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"elasticsearch\",\"service_settings\":{\"num_allocations\":1,\"num_threads\":1,\"model_id\":\"msmarco-MiniLM-L12-cos-v5\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/my-msmarco-minilm-model\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/text_embedding/my-msmarco-minilm-model` to create an inference endpoint that performs a `text_embedding` task with a model that was uploaded by Eland.", "method_request": "PUT _inference/text_embedding/my-msmarco-minilm-model", "summary": "Eland text embedding task", "value": "{\n \"service\": \"elasticsearch\",\n \"service_settings\": {\n \"num_allocations\": 1,\n \"num_threads\": 1,\n \"model_id\": \"msmarco-MiniLM-L12-cos-v5\" \n }\n}" }, "PutElasticsearchRequestExample5": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"my-e5-model\",\n inference_config={\n \"service\": \"elasticsearch\",\n \"service_settings\": {\n \"adaptive_allocations\": {\n \"enabled\": True,\n \"min_number_of_allocations\": 3,\n \"max_number_of_allocations\": 10\n },\n \"num_threads\": 1,\n \"model_id\": \".multilingual-e5-small\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"my-e5-model\",\n inference_config: {\n service: \"elasticsearch\",\n service_settings: {\n adaptive_allocations: {\n enabled: true,\n min_number_of_allocations: 3,\n max_number_of_allocations: 10,\n },\n num_threads: 1,\n model_id: \".multilingual-e5-small\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"my-e5-model\",\n body: {\n \"service\": \"elasticsearch\",\n \"service_settings\": {\n \"adaptive_allocations\": {\n \"enabled\": true,\n \"min_number_of_allocations\": 3,\n \"max_number_of_allocations\": 10\n },\n \"num_threads\": 1,\n \"model_id\": \".multilingual-e5-small\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"my-e5-model\",\n \"body\" => [\n \"service\" => \"elasticsearch\",\n \"service_settings\" => [\n \"adaptive_allocations\" => [\n \"enabled\" => true,\n \"min_number_of_allocations\" => 3,\n \"max_number_of_allocations\" => 10,\n ],\n \"num_threads\" => 1,\n \"model_id\" => \".multilingual-e5-small\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"elasticsearch\",\"service_settings\":{\"adaptive_allocations\":{\"enabled\":true,\"min_number_of_allocations\":3,\"max_number_of_allocations\":10},\"num_threads\":1,\"model_id\":\".multilingual-e5-small\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/my-e5-model\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/text_embedding/my-e5-model` to create an inference endpoint that performs a `text_embedding` task and to configure adaptive allocations. The API request will automatically download the E5 model if it isn't already downloaded and then deploy the model.", "method_request": "PUT _inference/text_embedding/my-e5-model", "summary": "Adaptive allocation", "value": "{\n \"service\": \"elasticsearch\",\n \"service_settings\": {\n \"adaptive_allocations\": {\n \"enabled\": true,\n \"min_number_of_allocations\": 3,\n \"max_number_of_allocations\": 10\n },\n \"num_threads\": 1,\n \"model_id\": \".multilingual-e5-small\"\n }\n}" }, "PutElasticsearchRequestExample6": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"sparse_embedding\",\n inference_id=\"use_existing_deployment\",\n inference_config={\n \"service\": \"elasticsearch\",\n \"service_settings\": {\n \"deployment_id\": \".elser_model_2\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"sparse_embedding\",\n inference_id: \"use_existing_deployment\",\n inference_config: {\n service: \"elasticsearch\",\n service_settings: {\n deployment_id: \".elser_model_2\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"sparse_embedding\",\n inference_id: \"use_existing_deployment\",\n body: {\n \"service\": \"elasticsearch\",\n \"service_settings\": {\n \"deployment_id\": \".elser_model_2\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"sparse_embedding\",\n \"inference_id\" => \"use_existing_deployment\",\n \"body\" => [\n \"service\" => \"elasticsearch\",\n \"service_settings\" => [\n \"deployment_id\" => \".elser_model_2\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"elasticsearch\",\"service_settings\":{\"deployment_id\":\".elser_model_2\"}}' \"$ELASTICSEARCH_URL/_inference/sparse_embedding/use_existing_deployment\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/sparse_embedding/use_existing_deployment` to use an already existing model deployment when creating an inference endpoint.", "method_request": "PUT _inference/sparse_embedding/use_existing_deployment", "summary": "Existing model deployment", @@ -159207,12 +166138,56 @@ "description": "Create an ELSER inference endpoint.\n\nCreate an inference endpoint to perform an inference task with the `elser` service.\nYou can also deploy ELSER by using the Elasticsearch inference integration.\n\n> info\n> Your Elasticsearch deployment contains a preconfigured ELSER inference endpoint, you only need to create the enpoint using the API if you want to customize the settings.\n\nThe API request will automatically download and deploy the ELSER model if it isn't already downloaded.\n\n> info\n> You might see a 502 bad gateway error in the response when using the Kibana Console. This error usually just reflects a timeout, while the model downloads in the background. You can check the download progress in the Machine Learning UI. If using the Python client, you can set the timeout parameter to a higher value.\n\nAfter creating the endpoint, wait for the model deployment to complete before using it.\nTo verify the deployment status, use the get trained model statistics API.\nLook for `\"state\": \"fully_allocated\"` in the response and ensure that the `\"allocation_count\"` matches the `\"target_allocation_count\"`.\nAvoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources.", "examples": { "PutElserRequestExample1": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"sparse_embedding\",\n inference_id=\"my-elser-model\",\n inference_config={\n \"service\": \"elser\",\n \"service_settings\": {\n \"num_allocations\": 1,\n \"num_threads\": 1\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n inference_config: {\n service: \"elser\",\n service_settings: {\n num_allocations: 1,\n num_threads: 1,\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n body: {\n \"service\": \"elser\",\n \"service_settings\": {\n \"num_allocations\": 1,\n \"num_threads\": 1\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"sparse_embedding\",\n \"inference_id\" => \"my-elser-model\",\n \"body\" => [\n \"service\" => \"elser\",\n \"service_settings\" => [\n \"num_allocations\" => 1,\n \"num_threads\" => 1,\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"elser\",\"service_settings\":{\"num_allocations\":1,\"num_threads\":1}}' \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/sparse_embedding/my-elser-model` to create an inference endpoint that performs a `sparse_embedding` task. The request will automatically download the ELSER model if it isn't already downloaded and then deploy the model.", "method_request": "PUT _inference/sparse_embedding/my-elser-model", "summary": "A sparse embedding task", "value": "{\n \"service\": \"elser\",\n \"service_settings\": {\n \"num_allocations\": 1,\n \"num_threads\": 1\n }\n}" }, "PutElserRequestExample2": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"sparse_embedding\",\n inference_id=\"my-elser-model\",\n inference_config={\n \"service\": \"elser\",\n \"service_settings\": {\n \"adaptive_allocations\": {\n \"enabled\": True,\n \"min_number_of_allocations\": 3,\n \"max_number_of_allocations\": 10\n },\n \"num_threads\": 1\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n inference_config: {\n service: \"elser\",\n service_settings: {\n adaptive_allocations: {\n enabled: true,\n min_number_of_allocations: 3,\n max_number_of_allocations: 10,\n },\n num_threads: 1,\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n body: {\n \"service\": \"elser\",\n \"service_settings\": {\n \"adaptive_allocations\": {\n \"enabled\": true,\n \"min_number_of_allocations\": 3,\n \"max_number_of_allocations\": 10\n },\n \"num_threads\": 1\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"sparse_embedding\",\n \"inference_id\" => \"my-elser-model\",\n \"body\" => [\n \"service\" => \"elser\",\n \"service_settings\" => [\n \"adaptive_allocations\" => [\n \"enabled\" => true,\n \"min_number_of_allocations\" => 3,\n \"max_number_of_allocations\" => 10,\n ],\n \"num_threads\" => 1,\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"elser\",\"service_settings\":{\"adaptive_allocations\":{\"enabled\":true,\"min_number_of_allocations\":3,\"max_number_of_allocations\":10},\"num_threads\":1}}' \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/sparse_embedding/my-elser-model` to create an inference endpoint that performs a `sparse_embedding` task with adaptive allocations. When adaptive allocations are enabled, the number of allocations of the model is set automatically based on the current load.", "method_request": "PUT _inference/sparse_embedding/my-elser-model", "summary": "Adaptive allocations", @@ -159334,6 +166309,28 @@ "description": "Create an Google AI Studio inference endpoint.\n\nCreate an inference endpoint to perform an inference task with the `googleaistudio` service.", "examples": { "PutGoogleAiStudioRequestExample1": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"completion\",\n inference_id=\"google_ai_studio_completion\",\n inference_config={\n \"service\": \"googleaistudio\",\n \"service_settings\": {\n \"api_key\": \"api-key\",\n \"model_id\": \"model-id\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"completion\",\n inference_id: \"google_ai_studio_completion\",\n inference_config: {\n service: \"googleaistudio\",\n service_settings: {\n api_key: \"api-key\",\n model_id: \"model-id\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"completion\",\n inference_id: \"google_ai_studio_completion\",\n body: {\n \"service\": \"googleaistudio\",\n \"service_settings\": {\n \"api_key\": \"api-key\",\n \"model_id\": \"model-id\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"completion\",\n \"inference_id\" => \"google_ai_studio_completion\",\n \"body\" => [\n \"service\" => \"googleaistudio\",\n \"service_settings\" => [\n \"api_key\" => \"api-key\",\n \"model_id\" => \"model-id\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"googleaistudio\",\"service_settings\":{\"api_key\":\"api-key\",\"model_id\":\"model-id\"}}' \"$ELASTICSEARCH_URL/_inference/completion/google_ai_studio_completion\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/completion/google_ai_studio_completion` to create an inference endpoint to perform a `completion` task type.", "method_request": "PUT _inference/completion/google_ai_studio_completion", "summary": "A completion task", @@ -159461,12 +166458,56 @@ "description": "Create a Google Vertex AI inference endpoint.\n\nCreate an inference endpoint to perform an inference task with the `googlevertexai` service.", "examples": { "PutGoogleVertexAiRequestExample1": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"google_vertex_ai_embeddingss\",\n inference_config={\n \"service\": \"googlevertexai\",\n \"service_settings\": {\n \"service_account_json\": \"service-account-json\",\n \"model_id\": \"model-id\",\n \"location\": \"location\",\n \"project_id\": \"project-id\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"google_vertex_ai_embeddingss\",\n inference_config: {\n service: \"googlevertexai\",\n service_settings: {\n service_account_json: \"service-account-json\",\n model_id: \"model-id\",\n location: \"location\",\n project_id: \"project-id\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"google_vertex_ai_embeddingss\",\n body: {\n \"service\": \"googlevertexai\",\n \"service_settings\": {\n \"service_account_json\": \"service-account-json\",\n \"model_id\": \"model-id\",\n \"location\": \"location\",\n \"project_id\": \"project-id\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"google_vertex_ai_embeddingss\",\n \"body\" => [\n \"service\" => \"googlevertexai\",\n \"service_settings\" => [\n \"service_account_json\" => \"service-account-json\",\n \"model_id\" => \"model-id\",\n \"location\" => \"location\",\n \"project_id\" => \"project-id\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"googlevertexai\",\"service_settings\":{\"service_account_json\":\"service-account-json\",\"model_id\":\"model-id\",\"location\":\"location\",\"project_id\":\"project-id\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/google_vertex_ai_embeddingss\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/text_embedding/google_vertex_ai_embeddings` to create an inference endpoint to perform a `text_embedding` task type.", "method_request": "PUT _inference/text_embedding/google_vertex_ai_embeddingss", "summary": "A text embedding task", "value": "{\n \"service\": \"googlevertexai\",\n \"service_settings\": {\n \"service_account_json\": \"service-account-json\",\n \"model_id\": \"model-id\",\n \"location\": \"location\",\n \"project_id\": \"project-id\"\n }\n}" }, "PutGoogleVertexAiRequestExample2": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"rerank\",\n inference_id=\"google_vertex_ai_rerank\",\n inference_config={\n \"service\": \"googlevertexai\",\n \"service_settings\": {\n \"service_account_json\": \"service-account-json\",\n \"project_id\": \"project-id\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"rerank\",\n inference_id: \"google_vertex_ai_rerank\",\n inference_config: {\n service: \"googlevertexai\",\n service_settings: {\n service_account_json: \"service-account-json\",\n project_id: \"project-id\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"rerank\",\n inference_id: \"google_vertex_ai_rerank\",\n body: {\n \"service\": \"googlevertexai\",\n \"service_settings\": {\n \"service_account_json\": \"service-account-json\",\n \"project_id\": \"project-id\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"rerank\",\n \"inference_id\" => \"google_vertex_ai_rerank\",\n \"body\" => [\n \"service\" => \"googlevertexai\",\n \"service_settings\" => [\n \"service_account_json\" => \"service-account-json\",\n \"project_id\" => \"project-id\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"googlevertexai\",\"service_settings\":{\"service_account_json\":\"service-account-json\",\"project_id\":\"project-id\"}}' \"$ELASTICSEARCH_URL/_inference/rerank/google_vertex_ai_rerank\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/rerank/google_vertex_ai_rerank` to create an inference endpoint to perform a `rerank` task type.", "method_request": "PUT _inference/rerank/google_vertex_ai_rerank", "summary": "A rerank task", @@ -159582,6 +166623,28 @@ "description": "Create a Hugging Face inference endpoint.\n\nCreate an inference endpoint to perform an inference task with the `hugging_face` service.\n\nYou must first create an inference endpoint on the Hugging Face endpoint page to get an endpoint URL.\nSelect the model you want to use on the new endpoint creation page (for example `intfloat/e5-small-v2`), then select the sentence embeddings task under the advanced configuration section.\nCreate the endpoint and copy the URL after the endpoint initialization has been finished.\n\nThe following models are recommended for the Hugging Face service:\n\n* `all-MiniLM-L6-v2`\n* `all-MiniLM-L12-v2`\n* `all-mpnet-base-v2`\n* `e5-base-v2`\n* `e5-small-v2`\n* `multilingual-e5-base`\n* `multilingual-e5-small`", "examples": { "PutHuggingFaceRequestExample1": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"hugging-face-embeddings\",\n inference_config={\n \"service\": \"hugging_face\",\n \"service_settings\": {\n \"api_key\": \"hugging-face-access-token\",\n \"url\": \"url-endpoint\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"hugging-face-embeddings\",\n inference_config: {\n service: \"hugging_face\",\n service_settings: {\n api_key: \"hugging-face-access-token\",\n url: \"url-endpoint\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"hugging-face-embeddings\",\n body: {\n \"service\": \"hugging_face\",\n \"service_settings\": {\n \"api_key\": \"hugging-face-access-token\",\n \"url\": \"url-endpoint\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"hugging-face-embeddings\",\n \"body\" => [\n \"service\" => \"hugging_face\",\n \"service_settings\" => [\n \"api_key\" => \"hugging-face-access-token\",\n \"url\" => \"url-endpoint\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"hugging_face\",\"service_settings\":{\"api_key\":\"hugging-face-access-token\",\"url\":\"url-endpoint\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/hugging-face-embeddings\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/text_embedding/hugging-face-embeddings` to create an inference endpoint that performs a `text_embedding` task type.", "method_request": "PUT _inference/text_embedding/hugging-face-embeddings", "summary": "A text embedding task", @@ -159709,12 +166772,56 @@ "description": "Create an JinaAI inference endpoint.\n\nCreate an inference endpoint to perform an inference task with the `jinaai` service.\n\nTo review the available `rerank` models, refer to .\nTo review the available `text_embedding` models, refer to the .", "examples": { "PutJinaAiRequestExample1": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"jinaai-embeddings\",\n inference_config={\n \"service\": \"jinaai\",\n \"service_settings\": {\n \"model_id\": \"jina-embeddings-v3\",\n \"api_key\": \"JinaAi-Api-key\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"jinaai-embeddings\",\n inference_config: {\n service: \"jinaai\",\n service_settings: {\n model_id: \"jina-embeddings-v3\",\n api_key: \"JinaAi-Api-key\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"jinaai-embeddings\",\n body: {\n \"service\": \"jinaai\",\n \"service_settings\": {\n \"model_id\": \"jina-embeddings-v3\",\n \"api_key\": \"JinaAi-Api-key\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"jinaai-embeddings\",\n \"body\" => [\n \"service\" => \"jinaai\",\n \"service_settings\" => [\n \"model_id\" => \"jina-embeddings-v3\",\n \"api_key\" => \"JinaAi-Api-key\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"jinaai\",\"service_settings\":{\"model_id\":\"jina-embeddings-v3\",\"api_key\":\"JinaAi-Api-key\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/jinaai-embeddings\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/text_embedding/jinaai-embeddings` to create an inference endpoint for text embedding tasks using the JinaAI service.", "method_request": "PUT _inference/text_embedding/jinaai-embeddings", "summary": "A text embedding task", "value": "{\n \"service\": \"jinaai\",\n \"service_settings\": {\n \"model_id\": \"jina-embeddings-v3\",\n \"api_key\": \"JinaAi-Api-key\"\n }\n}" }, "PutJinaAiRequestExample2": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"rerank\",\n inference_id=\"jinaai-rerank\",\n inference_config={\n \"service\": \"jinaai\",\n \"service_settings\": {\n \"api_key\": \"JinaAI-Api-key\",\n \"model_id\": \"jina-reranker-v2-base-multilingual\"\n },\n \"task_settings\": {\n \"top_n\": 10,\n \"return_documents\": True\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"rerank\",\n inference_id: \"jinaai-rerank\",\n inference_config: {\n service: \"jinaai\",\n service_settings: {\n api_key: \"JinaAI-Api-key\",\n model_id: \"jina-reranker-v2-base-multilingual\",\n },\n task_settings: {\n top_n: 10,\n return_documents: true,\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"rerank\",\n inference_id: \"jinaai-rerank\",\n body: {\n \"service\": \"jinaai\",\n \"service_settings\": {\n \"api_key\": \"JinaAI-Api-key\",\n \"model_id\": \"jina-reranker-v2-base-multilingual\"\n },\n \"task_settings\": {\n \"top_n\": 10,\n \"return_documents\": true\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"rerank\",\n \"inference_id\" => \"jinaai-rerank\",\n \"body\" => [\n \"service\" => \"jinaai\",\n \"service_settings\" => [\n \"api_key\" => \"JinaAI-Api-key\",\n \"model_id\" => \"jina-reranker-v2-base-multilingual\",\n ],\n \"task_settings\" => [\n \"top_n\" => 10,\n \"return_documents\" => true,\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"jinaai\",\"service_settings\":{\"api_key\":\"JinaAI-Api-key\",\"model_id\":\"jina-reranker-v2-base-multilingual\"},\"task_settings\":{\"top_n\":10,\"return_documents\":true}}' \"$ELASTICSEARCH_URL/_inference/rerank/jinaai-rerank\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/rerank/jinaai-rerank` to create an inference endpoint for rerank tasks using the JinaAI service.", "method_request": "PUT _inference/rerank/jinaai-rerank", "summary": "A rerank task", @@ -159830,6 +166937,28 @@ "description": "Create a Mistral inference endpoint.\n\nCreates an inference endpoint to perform an inference task with the `mistral` service.", "examples": { "PutMistralRequestExample1": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"mistral-embeddings-test\",\n inference_config={\n \"service\": \"mistral\",\n \"service_settings\": {\n \"api_key\": \"Mistral-API-Key\",\n \"model\": \"mistral-embed\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"mistral-embeddings-test\",\n inference_config: {\n service: \"mistral\",\n service_settings: {\n api_key: \"Mistral-API-Key\",\n model: \"mistral-embed\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"mistral-embeddings-test\",\n body: {\n \"service\": \"mistral\",\n \"service_settings\": {\n \"api_key\": \"Mistral-API-Key\",\n \"model\": \"mistral-embed\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"mistral-embeddings-test\",\n \"body\" => [\n \"service\" => \"mistral\",\n \"service_settings\" => [\n \"api_key\" => \"Mistral-API-Key\",\n \"model\" => \"mistral-embed\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"mistral\",\"service_settings\":{\"api_key\":\"Mistral-API-Key\",\"model\":\"mistral-embed\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/mistral-embeddings-test\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/text_embedding/mistral-embeddings-test` to create a Mistral inference endpoint that performs a text embedding task.", "method_request": "PUT _inference/text_embedding/mistral-embeddings-test", "value": "{\n \"service\": \"mistral\",\n \"service_settings\": {\n \"api_key\": \"Mistral-API-Key\",\n \"model\": \"mistral-embed\" \n }\n}" @@ -159956,12 +167085,56 @@ "description": "Create an OpenAI inference endpoint.\n\nCreate an inference endpoint to perform an inference task with the `openai` service or `openai` compatible APIs.", "examples": { "PutOpenAiRequestExample1": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"openai-embeddings\",\n inference_config={\n \"service\": \"openai\",\n \"service_settings\": {\n \"api_key\": \"OpenAI-API-Key\",\n \"model_id\": \"text-embedding-3-small\",\n \"dimensions\": 128\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"openai-embeddings\",\n inference_config: {\n service: \"openai\",\n service_settings: {\n api_key: \"OpenAI-API-Key\",\n model_id: \"text-embedding-3-small\",\n dimensions: 128,\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"openai-embeddings\",\n body: {\n \"service\": \"openai\",\n \"service_settings\": {\n \"api_key\": \"OpenAI-API-Key\",\n \"model_id\": \"text-embedding-3-small\",\n \"dimensions\": 128\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"openai-embeddings\",\n \"body\" => [\n \"service\" => \"openai\",\n \"service_settings\" => [\n \"api_key\" => \"OpenAI-API-Key\",\n \"model_id\" => \"text-embedding-3-small\",\n \"dimensions\" => 128,\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"openai\",\"service_settings\":{\"api_key\":\"OpenAI-API-Key\",\"model_id\":\"text-embedding-3-small\",\"dimensions\":128}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/openai-embeddings\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/text_embedding/openai-embeddings` to create an inference endpoint that performs a `text_embedding` task. The embeddings created by requests to this endpoint will have 128 dimensions.", "method_request": "PUT _inference/text_embedding/openai-embeddings", "summary": "A text embedding task", "value": "{\n \"service\": \"openai\",\n \"service_settings\": {\n \"api_key\": \"OpenAI-API-Key\",\n \"model_id\": \"text-embedding-3-small\",\n \"dimensions\": 128\n }\n}" }, "PutOpenAiRequestExample2": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"completion\",\n inference_id=\"amazon_bedrock_completion\",\n inference_config={\n \"service\": \"amazonbedrock\",\n \"service_settings\": {\n \"access_key\": \"AWS-access-key\",\n \"secret_key\": \"AWS-secret-key\",\n \"region\": \"us-east-1\",\n \"provider\": \"amazontitan\",\n \"model\": \"amazon.titan-text-premier-v1:0\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"completion\",\n inference_id: \"amazon_bedrock_completion\",\n inference_config: {\n service: \"amazonbedrock\",\n service_settings: {\n access_key: \"AWS-access-key\",\n secret_key: \"AWS-secret-key\",\n region: \"us-east-1\",\n provider: \"amazontitan\",\n model: \"amazon.titan-text-premier-v1:0\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"completion\",\n inference_id: \"amazon_bedrock_completion\",\n body: {\n \"service\": \"amazonbedrock\",\n \"service_settings\": {\n \"access_key\": \"AWS-access-key\",\n \"secret_key\": \"AWS-secret-key\",\n \"region\": \"us-east-1\",\n \"provider\": \"amazontitan\",\n \"model\": \"amazon.titan-text-premier-v1:0\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"completion\",\n \"inference_id\" => \"amazon_bedrock_completion\",\n \"body\" => [\n \"service\" => \"amazonbedrock\",\n \"service_settings\" => [\n \"access_key\" => \"AWS-access-key\",\n \"secret_key\" => \"AWS-secret-key\",\n \"region\" => \"us-east-1\",\n \"provider\" => \"amazontitan\",\n \"model\" => \"amazon.titan-text-premier-v1:0\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"amazonbedrock\",\"service_settings\":{\"access_key\":\"AWS-access-key\",\"secret_key\":\"AWS-secret-key\",\"region\":\"us-east-1\",\"provider\":\"amazontitan\",\"model\":\"amazon.titan-text-premier-v1:0\"}}' \"$ELASTICSEARCH_URL/_inference/completion/amazon_bedrock_completion\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/completion/amazon_bedrock_completion` to create an inference endpoint to perform a completion task.", "method_request": "PUT _inference/completion/amazon_bedrock_completion", "summary": "A completion task", @@ -160089,12 +167262,56 @@ "description": "Create a VoyageAI inference endpoint.\n\nCreate an inference endpoint to perform an inference task with the `voyageai` service.\n\nAvoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources.", "examples": { "PutVoyageAIRequestExample1": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"openai-embeddings\",\n inference_config={\n \"service\": \"voyageai\",\n \"service_settings\": {\n \"model_id\": \"voyage-3-large\",\n \"dimensions\": 512\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"openai-embeddings\",\n inference_config: {\n service: \"voyageai\",\n service_settings: {\n model_id: \"voyage-3-large\",\n dimensions: 512,\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"openai-embeddings\",\n body: {\n \"service\": \"voyageai\",\n \"service_settings\": {\n \"model_id\": \"voyage-3-large\",\n \"dimensions\": 512\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"openai-embeddings\",\n \"body\" => [\n \"service\" => \"voyageai\",\n \"service_settings\" => [\n \"model_id\" => \"voyage-3-large\",\n \"dimensions\" => 512,\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"voyageai\",\"service_settings\":{\"model_id\":\"voyage-3-large\",\"dimensions\":512}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/openai-embeddings\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/text_embedding/voyageai-embeddings` to create an inference endpoint that performs a `text_embedding` task. The embeddings created by requests to this endpoint will have 512 dimensions.", "method_request": "PUT _inference/text_embedding/openai-embeddings", "summary": "A text embedding task", "value": "{\n \"service\": \"voyageai\",\n \"service_settings\": {\n \"model_id\": \"voyage-3-large\",\n \"dimensions\": 512\n }\n}" }, "PutVoyageAIRequestExample2": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"rerank\",\n inference_id=\"voyageai-rerank\",\n inference_config={\n \"service\": \"voyageai\",\n \"service_settings\": {\n \"model_id\": \"rerank-2\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"rerank\",\n inference_id: \"voyageai-rerank\",\n inference_config: {\n service: \"voyageai\",\n service_settings: {\n model_id: \"rerank-2\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"rerank\",\n inference_id: \"voyageai-rerank\",\n body: {\n \"service\": \"voyageai\",\n \"service_settings\": {\n \"model_id\": \"rerank-2\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"rerank\",\n \"inference_id\" => \"voyageai-rerank\",\n \"body\" => [\n \"service\" => \"voyageai\",\n \"service_settings\" => [\n \"model_id\" => \"rerank-2\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"voyageai\",\"service_settings\":{\"model_id\":\"rerank-2\"}}' \"$ELASTICSEARCH_URL/_inference/rerank/voyageai-rerank\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/rerank/voyageai-rerank` to create an inference endpoint that performs a `rerank` task.", "method_request": "PUT _inference/rerank/voyageai-rerank", "summary": "A rerank task", @@ -160196,6 +167413,28 @@ "description": "Create a Watsonx inference endpoint.\n\nCreate an inference endpoint to perform an inference task with the `watsonxai` service.\nYou need an IBM Cloud Databases for Elasticsearch deployment to use the `watsonxai` inference service.\nYou can provision one through the IBM catalog, the Cloud Databases CLI plug-in, the Cloud Databases API, or Terraform.", "examples": { "PutWatsonxRequestExample1": { + "alternatives": [ + { + "code": "resp = client.inference.put(\n task_type=\"text_embedding\",\n inference_id=\"watsonx-embeddings\",\n inference_config={\n \"service\": \"watsonxai\",\n \"service_settings\": {\n \"api_key\": \"Watsonx-API-Key\",\n \"url\": \"Wastonx-URL\",\n \"model_id\": \"ibm/slate-30m-english-rtrvr\",\n \"project_id\": \"IBM-Cloud-ID\",\n \"api_version\": \"2024-03-14\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.put({\n task_type: \"text_embedding\",\n inference_id: \"watsonx-embeddings\",\n inference_config: {\n service: \"watsonxai\",\n service_settings: {\n api_key: \"Watsonx-API-Key\",\n url: \"Wastonx-URL\",\n model_id: \"ibm/slate-30m-english-rtrvr\",\n project_id: \"IBM-Cloud-ID\",\n api_version: \"2024-03-14\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.put(\n task_type: \"text_embedding\",\n inference_id: \"watsonx-embeddings\",\n body: {\n \"service\": \"watsonxai\",\n \"service_settings\": {\n \"api_key\": \"Watsonx-API-Key\",\n \"url\": \"Wastonx-URL\",\n \"model_id\": \"ibm/slate-30m-english-rtrvr\",\n \"project_id\": \"IBM-Cloud-ID\",\n \"api_version\": \"2024-03-14\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"text_embedding\",\n \"inference_id\" => \"watsonx-embeddings\",\n \"body\" => [\n \"service\" => \"watsonxai\",\n \"service_settings\" => [\n \"api_key\" => \"Watsonx-API-Key\",\n \"url\" => \"Wastonx-URL\",\n \"model_id\" => \"ibm/slate-30m-english-rtrvr\",\n \"project_id\" => \"IBM-Cloud-ID\",\n \"api_version\" => \"2024-03-14\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service\":\"watsonxai\",\"service_settings\":{\"api_key\":\"Watsonx-API-Key\",\"url\":\"Wastonx-URL\",\"model_id\":\"ibm/slate-30m-english-rtrvr\",\"project_id\":\"IBM-Cloud-ID\",\"api_version\":\"2024-03-14\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/watsonx-embeddings\"", + "language": "curl" + } + ], "description": "Run `PUT _inference/text_embedding/watsonx-embeddings` to create an Watonsx inference endpoint that performs a text embedding task.", "method_request": "PUT _inference/text_embedding/watsonx-embeddings", "value": "{\n \"service\": \"watsonxai\",\n \"service_settings\": {\n \"api_key\": \"Watsonx-API-Key\", \n \"url\": \"Wastonx-URL\", \n \"model_id\": \"ibm/slate-30m-english-rtrvr\",\n \"project_id\": \"IBM-Cloud-ID\", \n \"api_version\": \"2024-03-14\"\n }\n}" @@ -160323,6 +167562,28 @@ "description": "Perform rereanking inference on the service", "examples": { "RerankRequestExample1": { + "alternatives": [ + { + "code": "resp = client.inference.rerank(\n inference_id=\"cohere_rerank\",\n input=[\n \"luke\",\n \"like\",\n \"leia\",\n \"chewy\",\n \"r2d2\",\n \"star\",\n \"wars\"\n ],\n query=\"star wars main character\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.rerank({\n inference_id: \"cohere_rerank\",\n input: [\"luke\", \"like\", \"leia\", \"chewy\", \"r2d2\", \"star\", \"wars\"],\n query: \"star wars main character\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.rerank(\n inference_id: \"cohere_rerank\",\n body: {\n \"input\": [\n \"luke\",\n \"like\",\n \"leia\",\n \"chewy\",\n \"r2d2\",\n \"star\",\n \"wars\"\n ],\n \"query\": \"star wars main character\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->rerank([\n \"inference_id\" => \"cohere_rerank\",\n \"body\" => [\n \"input\" => array(\n \"luke\",\n \"like\",\n \"leia\",\n \"chewy\",\n \"r2d2\",\n \"star\",\n \"wars\",\n ),\n \"query\" => \"star wars main character\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"input\":[\"luke\",\"like\",\"leia\",\"chewy\",\"r2d2\",\"star\",\"wars\"],\"query\":\"star wars main character\"}' \"$ELASTICSEARCH_URL/_inference/rerank/cohere_rerank\"", + "language": "curl" + } + ], "description": "Run `POST _inference/rerank/cohere_rerank` to perform reranking on the example input.", "method_request": "POST _inference/rerank/cohere_rerank", "summary": "Rerank task", @@ -160448,6 +167709,28 @@ "description": "Perform sparse embedding inference on the service", "examples": { "SparseEmbeddingRequestExample1": { + "alternatives": [ + { + "code": "resp = client.inference.sparse_embedding(\n inference_id=\"my-elser-model\",\n input=\"The sky above the port was the color of television tuned to a dead channel.\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.sparseEmbedding({\n inference_id: \"my-elser-model\",\n input:\n \"The sky above the port was the color of television tuned to a dead channel.\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.sparse_embedding(\n inference_id: \"my-elser-model\",\n body: {\n \"input\": \"The sky above the port was the color of television tuned to a dead channel.\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->sparseEmbedding([\n \"inference_id\" => \"my-elser-model\",\n \"body\" => [\n \"input\" => \"The sky above the port was the color of television tuned to a dead channel.\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"input\":\"The sky above the port was the color of television tuned to a dead channel.\"}' \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"", + "language": "curl" + } + ], "description": "Run `POST _inference/sparse_embedding/my-elser-model` to perform sparse embedding on the example sentence.", "method_request": "POST _inference/sparse_embedding/my-elser-model", "summary": "Sparse embedding task", @@ -160573,6 +167856,28 @@ "description": "Perform streaming inference.\nGet real-time responses for completion tasks by delivering answers incrementally, reducing response times during computation.\nThis API works only with the completion task type.\n\nIMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs.\n\nThis API requires the `monitor_inference` cluster privilege (the built-in `inference_admin` and `inference_user` roles grant this privilege). You must use a client that supports streaming.", "examples": { "StreamInferenceRequestExample1": { + "alternatives": [ + { + "code": "resp = client.inference.stream_completion(\n inference_id=\"openai-completion\",\n input=\"What is Elastic?\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.streamCompletion({\n inference_id: \"openai-completion\",\n input: \"What is Elastic?\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.stream_completion(\n inference_id: \"openai-completion\",\n body: {\n \"input\": \"What is Elastic?\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->streamCompletion([\n \"inference_id\" => \"openai-completion\",\n \"body\" => [\n \"input\" => \"What is Elastic?\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"input\":\"What is Elastic?\"}' \"$ELASTICSEARCH_URL/_inference/completion/openai-completion/_stream\"", + "language": "curl" + } + ], "description": "Run `POST _inference/completion/openai-completion/_stream` to perform a completion on the example question with streaming.", "method_request": "POST _inference/completion/openai-completion/_stream", "summary": "Perform a completion task", @@ -160677,6 +167982,28 @@ "description": "Perform text embedding inference on the service", "examples": { "TextEmbeddingRequestExample1": { + "alternatives": [ + { + "code": "resp = client.inference.text_embedding(\n inference_id=\"my-cohere-endpoint\",\n input=\"The sky above the port was the color of television tuned to a dead channel.\",\n task_settings={\n \"input_type\": \"ingest\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.textEmbedding({\n inference_id: \"my-cohere-endpoint\",\n input:\n \"The sky above the port was the color of television tuned to a dead channel.\",\n task_settings: {\n input_type: \"ingest\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.text_embedding(\n inference_id: \"my-cohere-endpoint\",\n body: {\n \"input\": \"The sky above the port was the color of television tuned to a dead channel.\",\n \"task_settings\": {\n \"input_type\": \"ingest\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->textEmbedding([\n \"inference_id\" => \"my-cohere-endpoint\",\n \"body\" => [\n \"input\" => \"The sky above the port was the color of television tuned to a dead channel.\",\n \"task_settings\" => [\n \"input_type\" => \"ingest\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"input\":\"The sky above the port was the color of television tuned to a dead channel.\",\"task_settings\":{\"input_type\":\"ingest\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/my-cohere-endpoint\"", + "language": "curl" + } + ], "description": "Run `POST _inference/text_embedding/my-cohere-endpoint` to perform text embedding on the example sentence using the Cohere integration,", "method_request": "POST _inference/text_embedding/my-cohere-endpoint", "summary": "Text embedding task", @@ -160769,6 +168096,28 @@ "description": "Update an inference endpoint.\n\nModify `task_settings`, secrets (within `service_settings`), or `num_allocations` for an inference endpoint, depending on the specific endpoint service and `task_type`.\n\nIMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face.\nFor built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models.\nHowever, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs.", "examples": { "InferenceUpdateExample1": { + "alternatives": [ + { + "code": "resp = client.inference.update(\n inference_id=\"my-inference-endpoint\",\n inference_config={\n \"service_settings\": {\n \"api_key\": \"\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.inference.update({\n inference_id: \"my-inference-endpoint\",\n inference_config: {\n service_settings: {\n api_key: \"\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.inference.update(\n inference_id: \"my-inference-endpoint\",\n body: {\n \"service_settings\": {\n \"api_key\": \"\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->inference()->update([\n \"inference_id\" => \"my-inference-endpoint\",\n \"body\" => [\n \"service_settings\" => [\n \"api_key\" => \"\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"service_settings\":{\"api_key\":\"\"}}' \"$ELASTICSEARCH_URL/_inference/my-inference-endpoint/_update\"", + "language": "curl" + } + ], "description": "An example body for a `PUT _inference/my-inference-endpoint/_update` request.", "method_request": "PUT _inference/my-inference-endpoint/_update", "value": "{\n \"service_settings\": {\n \"api_key\": \"\"\n }\n}" @@ -166184,6 +173533,28 @@ "description": "Delete IP geolocation database configurations.", "examples": { "IngestDeleteIpLocationDatabaseExample1": { + "alternatives": [ + { + "code": "resp = client.ingest.delete_ip_location_database(\n id=\"my-database-id\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ingest.deleteIpLocationDatabase({\n id: \"my-database-id\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ingest.delete_ip_location_database(\n id: \"my-database-id\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ingest()->deleteIpLocationDatabase([\n \"id\" => \"my-database-id\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ingest/ip_location/database/my-database-id\"", + "language": "curl" + } + ], "method_request": "DELETE /_ingest/ip_location/database/my-database-id" } }, @@ -166271,6 +173642,28 @@ "description": "Delete pipelines.\nDelete one or more ingest pipelines.", "examples": { "IngestDeletePipelineExample1": { + "alternatives": [ + { + "code": "resp = client.ingest.delete_pipeline(\n id=\"my-pipeline-id\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ingest.deletePipeline({\n id: \"my-pipeline-id\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ingest.delete_pipeline(\n id: \"my-pipeline-id\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ingest()->deletePipeline([\n \"id\" => \"my-pipeline-id\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ingest/pipeline/my-pipeline-id\"", + "language": "curl" + } + ], "method_request": "DELETE /_ingest/pipeline/my-pipeline-id" } }, @@ -166512,6 +173905,28 @@ "description": "Get GeoIP statistics.\nGet download statistics for GeoIP2 databases that are used with the GeoIP processor.", "examples": { "IngestGeoIpStatsExample1": { + "alternatives": [ + { + "code": "resp = client.ingest.geo_ip_stats()", + "language": "Python" + }, + { + "code": "const response = await client.ingest.geoIpStats();", + "language": "JavaScript" + }, + { + "code": "response = client.ingest.geo_ip_stats", + "language": "Ruby" + }, + { + "code": "$resp = $client->ingest()->geoIpStats();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ingest/geoip/stats\"", + "language": "curl" + } + ], "method_request": "GET _ingest/geoip/stats" } }, @@ -166797,6 +174212,28 @@ "description": "Get IP geolocation database configurations.", "examples": { "IngestGetIpLocationDatabaseExample1": { + "alternatives": [ + { + "code": "resp = client.ingest.get_ip_location_database(\n id=\"my-database-id\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ingest.getIpLocationDatabase({\n id: \"my-database-id\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ingest.get_ip_location_database(\n id: \"my-database-id\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ingest()->getIpLocationDatabase([\n \"id\" => \"my-database-id\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ingest/ip_location/database/my-database-id\"", + "language": "curl" + } + ], "method_request": "GET /_ingest/ip_location/database/my-database-id" } }, @@ -166879,6 +174316,28 @@ "description": "Get pipelines.\n\nGet information about one or more ingest pipelines.\nThis API returns a local reference of the pipeline.", "examples": { "IngestGetPipelineExample1": { + "alternatives": [ + { + "code": "resp = client.ingest.get_pipeline(\n id=\"my-pipeline-id\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ingest.getPipeline({\n id: \"my-pipeline-id\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ingest.get_pipeline(\n id: \"my-pipeline-id\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ingest()->getPipeline([\n \"id\" => \"my-pipeline-id\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ingest/pipeline/my-pipeline-id\"", + "language": "curl" + } + ], "method_request": "GET /_ingest/pipeline/my-pipeline-id" } }, @@ -166983,6 +174442,28 @@ "description": "Run a grok processor.\nExtract structured fields out of a single text field within a document.\nYou must choose which field to extract matched fields from, as well as the grok pattern you expect will match.\nA grok pattern is like a regular expression that supports aliased expressions that can be reused.", "examples": { "IngestProcessorGrokExample1": { + "alternatives": [ + { + "code": "resp = client.ingest.processor_grok()", + "language": "Python" + }, + { + "code": "const response = await client.ingest.processorGrok();", + "language": "JavaScript" + }, + { + "code": "response = client.ingest.processor_grok", + "language": "Ruby" + }, + { + "code": "$resp = $client->ingest()->processorGrok();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ingest/processor/grok\"", + "language": "curl" + } + ], "method_request": "GET _ingest/processor/grok" } }, @@ -167162,6 +174643,28 @@ "description": "Create or update an IP geolocation database configuration.", "examples": { "IngestPutIpLocationDatabaseExample1": { + "alternatives": [ + { + "code": "resp = client.ingest.put_ip_location_database(\n id=\"my-database-1\",\n configuration={\n \"name\": \"GeoIP2-Domain\",\n \"maxmind\": {\n \"account_id\": \"1234567\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.ingest.putIpLocationDatabase({\n id: \"my-database-1\",\n configuration: {\n name: \"GeoIP2-Domain\",\n maxmind: {\n account_id: \"1234567\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ingest.put_ip_location_database(\n id: \"my-database-1\",\n body: {\n \"name\": \"GeoIP2-Domain\",\n \"maxmind\": {\n \"account_id\": \"1234567\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ingest()->putIpLocationDatabase([\n \"id\" => \"my-database-1\",\n \"body\" => [\n \"name\" => \"GeoIP2-Domain\",\n \"maxmind\" => [\n \"account_id\" => \"1234567\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"name\":\"GeoIP2-Domain\",\"maxmind\":{\"account_id\":\"1234567\"}}' \"$ELASTICSEARCH_URL/_ingest/ip_location/database/my-database-1\"", + "language": "curl" + } + ], "description": "An example body for a `PUT _ingest/ip_location/database/my-database-1` request.", "method_request": "PUT _ingest/ip_location/database/my-database-1", "value": "{\n \"name\": \"GeoIP2-Domain\",\n \"maxmind\": {\n \"account_id\": \"1234567\"\n }\n}" @@ -167332,11 +174835,55 @@ "description": "Create or update a pipeline.\nChanges made using this API take effect immediately.", "examples": { "PutPipelineRequestExample1": { + "alternatives": [ + { + "code": "resp = client.ingest.put_pipeline(\n id=\"my-pipeline-id\",\n description=\"My optional pipeline description\",\n processors=[\n {\n \"set\": {\n \"description\": \"My optional processor description\",\n \"field\": \"my-keyword-field\",\n \"value\": \"foo\"\n }\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.ingest.putPipeline({\n id: \"my-pipeline-id\",\n description: \"My optional pipeline description\",\n processors: [\n {\n set: {\n description: \"My optional processor description\",\n field: \"my-keyword-field\",\n value: \"foo\",\n },\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ingest.put_pipeline(\n id: \"my-pipeline-id\",\n body: {\n \"description\": \"My optional pipeline description\",\n \"processors\": [\n {\n \"set\": {\n \"description\": \"My optional processor description\",\n \"field\": \"my-keyword-field\",\n \"value\": \"foo\"\n }\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ingest()->putPipeline([\n \"id\" => \"my-pipeline-id\",\n \"body\" => [\n \"description\" => \"My optional pipeline description\",\n \"processors\" => array(\n [\n \"set\" => [\n \"description\" => \"My optional processor description\",\n \"field\" => \"my-keyword-field\",\n \"value\" => \"foo\",\n ],\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"My optional pipeline description\",\"processors\":[{\"set\":{\"description\":\"My optional processor description\",\"field\":\"my-keyword-field\",\"value\":\"foo\"}}]}' \"$ELASTICSEARCH_URL/_ingest/pipeline/my-pipeline-id\"", + "language": "curl" + } + ], "method_request": "PUT _ingest/pipeline/my-pipeline-id", "summary": "Create an ingest pipeline.", "value": "{\n \"description\" : \"My optional pipeline description\",\n \"processors\" : [\n {\n \"set\" : {\n \"description\" : \"My optional processor description\",\n \"field\": \"my-keyword-field\",\n \"value\": \"foo\"\n }\n }\n ]\n}" }, "PutPipelineRequestExample2": { + "alternatives": [ + { + "code": "resp = client.ingest.put_pipeline(\n id=\"my-pipeline-id\",\n description=\"My optional pipeline description\",\n processors=[\n {\n \"set\": {\n \"description\": \"My optional processor description\",\n \"field\": \"my-keyword-field\",\n \"value\": \"foo\"\n }\n }\n ],\n meta={\n \"reason\": \"set my-keyword-field to foo\",\n \"serialization\": {\n \"class\": \"MyPipeline\",\n \"id\": 10\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.ingest.putPipeline({\n id: \"my-pipeline-id\",\n description: \"My optional pipeline description\",\n processors: [\n {\n set: {\n description: \"My optional processor description\",\n field: \"my-keyword-field\",\n value: \"foo\",\n },\n },\n ],\n meta: {\n reason: \"set my-keyword-field to foo\",\n serialization: {\n class: \"MyPipeline\",\n id: 10,\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ingest.put_pipeline(\n id: \"my-pipeline-id\",\n body: {\n \"description\": \"My optional pipeline description\",\n \"processors\": [\n {\n \"set\": {\n \"description\": \"My optional processor description\",\n \"field\": \"my-keyword-field\",\n \"value\": \"foo\"\n }\n }\n ],\n \"_meta\": {\n \"reason\": \"set my-keyword-field to foo\",\n \"serialization\": {\n \"class\": \"MyPipeline\",\n \"id\": 10\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ingest()->putPipeline([\n \"id\" => \"my-pipeline-id\",\n \"body\" => [\n \"description\" => \"My optional pipeline description\",\n \"processors\" => array(\n [\n \"set\" => [\n \"description\" => \"My optional processor description\",\n \"field\" => \"my-keyword-field\",\n \"value\" => \"foo\",\n ],\n ],\n ),\n \"_meta\" => [\n \"reason\" => \"set my-keyword-field to foo\",\n \"serialization\" => [\n \"class\" => \"MyPipeline\",\n \"id\" => 10,\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"My optional pipeline description\",\"processors\":[{\"set\":{\"description\":\"My optional processor description\",\"field\":\"my-keyword-field\",\"value\":\"foo\"}}],\"_meta\":{\"reason\":\"set my-keyword-field to foo\",\"serialization\":{\"class\":\"MyPipeline\",\"id\":10}}}' \"$ELASTICSEARCH_URL/_ingest/pipeline/my-pipeline-id\"", + "language": "curl" + } + ], "description": "You can use the `_meta` parameter to add arbitrary metadata to a pipeline.", "method_request": "PUT /_ingest/pipeline/my-pipeline-id", "summary": "Create an ingest pipeline with metadata.", @@ -167468,6 +175015,28 @@ "description": "Simulate a pipeline.\n\nRun an ingest pipeline against a set of provided documents.\nYou can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request.", "examples": { "SimulatePipelineRequestExample1": { + "alternatives": [ + { + "code": "resp = client.ingest.simulate(\n pipeline={\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\": {\n \"field\": \"field2\",\n \"value\": \"_value\"\n }\n }\n ]\n },\n docs=[\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.ingest.simulate({\n pipeline: {\n description: \"_description\",\n processors: [\n {\n set: {\n field: \"field2\",\n value: \"_value\",\n },\n },\n ],\n },\n docs: [\n {\n _index: \"index\",\n _id: \"id\",\n _source: {\n foo: \"bar\",\n },\n },\n {\n _index: \"index\",\n _id: \"id\",\n _source: {\n foo: \"rab\",\n },\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ingest.simulate(\n body: {\n \"pipeline\": {\n \"description\": \"_description\",\n \"processors\": [\n {\n \"set\": {\n \"field\": \"field2\",\n \"value\": \"_value\"\n }\n }\n ]\n },\n \"docs\": [\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ingest()->simulate([\n \"body\" => [\n \"pipeline\" => [\n \"description\" => \"_description\",\n \"processors\" => array(\n [\n \"set\" => [\n \"field\" => \"field2\",\n \"value\" => \"_value\",\n ],\n ],\n ),\n ],\n \"docs\" => array(\n [\n \"_index\" => \"index\",\n \"_id\" => \"id\",\n \"_source\" => [\n \"foo\" => \"bar\",\n ],\n ],\n [\n \"_index\" => \"index\",\n \"_id\" => \"id\",\n \"_source\" => [\n \"foo\" => \"rab\",\n ],\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"pipeline\":{\"description\":\"_description\",\"processors\":[{\"set\":{\"field\":\"field2\",\"value\":\"_value\"}}]},\"docs\":[{\"_index\":\"index\",\"_id\":\"id\",\"_source\":{\"foo\":\"bar\"}},{\"_index\":\"index\",\"_id\":\"id\",\"_source\":{\"foo\":\"rab\"}}]}' \"$ELASTICSEARCH_URL/_ingest/pipeline/_simulate\"", + "language": "curl" + } + ], "description": "You can specify the used pipeline either in the request body or as a path parameter.", "method_request": "POST /_ingest/pipeline/_simulate", "summary": "Run an ingest pipeline against a set of provided documents.", @@ -167776,6 +175345,28 @@ "description": "Delete the license.\n\nWhen the license expires, your subscription level reverts to Basic.\n\nIf the operator privileges feature is enabled, only operator users can use this API.", "examples": { "LicenseDeleteExample1": { + "alternatives": [ + { + "code": "resp = client.license.delete()", + "language": "Python" + }, + { + "code": "const response = await client.license.delete();", + "language": "JavaScript" + }, + { + "code": "response = client.license.delete", + "language": "Ruby" + }, + { + "code": "$resp = $client->license()->delete();", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_license\"", + "language": "curl" + } + ], "method_request": "DELETE /_license" } }, @@ -168043,6 +175634,28 @@ "description": "Get license information.\n\nGet information about your Elastic license including its type, its status, when it was issued, and when it expires.\n\n>info\n> If the master node is generating a new cluster state, the get license API may return a `404 Not Found` response.\n> If you receive an unexpected 404 response after cluster startup, wait a short period and retry the request.", "examples": { "GetLicenseRequestExample1": { + "alternatives": [ + { + "code": "resp = client.license.get()", + "language": "Python" + }, + { + "code": "const response = await client.license.get();", + "language": "JavaScript" + }, + { + "code": "response = client.license.get", + "language": "Ruby" + }, + { + "code": "$resp = $client->license()->get();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_license\"", + "language": "curl" + } + ], "method_request": "GET /_license" } }, @@ -168132,6 +175745,28 @@ "description": "Get the basic license status.", "examples": { "GetBasicLicenseStatusRequestExample1": { + "alternatives": [ + { + "code": "resp = client.license.get_basic_status()", + "language": "Python" + }, + { + "code": "const response = await client.license.getBasicStatus();", + "language": "JavaScript" + }, + { + "code": "response = client.license.get_basic_status", + "language": "Ruby" + }, + { + "code": "$resp = $client->license()->getBasicStatus();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_license/basic_status\"", + "language": "curl" + } + ], "method_request": "GET /_license/basic_status" } }, @@ -168190,6 +175825,28 @@ "description": "Get the trial status.", "examples": { "GetTrialLicenseStatusRequestExample1": { + "alternatives": [ + { + "code": "resp = client.license.get_trial_status()", + "language": "Python" + }, + { + "code": "const response = await client.license.getTrialStatus();", + "language": "JavaScript" + }, + { + "code": "response = client.license.get_trial_status", + "language": "Ruby" + }, + { + "code": "$resp = $client->license()->getTrialStatus();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_license/trial_status\"", + "language": "curl" + } + ], "method_request": "GET /_license/trial_status" } }, @@ -168311,6 +175968,28 @@ "description": "Update the license.\n\nYou can update your license at runtime without shutting down your nodes.\nLicense updates take effect immediately.\nIf the license you are installing does not support all of the features that were available with your previous license, however, you are notified in the response.\nYou must then re-submit the API request with the acknowledge parameter set to true.\n\nNOTE: If Elasticsearch security features are enabled and you are installing a gold or higher license, you must enable TLS on the transport networking layer before you install the license.\nIf the operator privileges feature is enabled, only operator users can use this API.", "examples": { "PostLicenseRequestExample1": { + "alternatives": [ + { + "code": "resp = client.license.post(\n licenses=[\n {\n \"uid\": \"893361dc-9749-4997-93cb-802e3d7fa4xx\",\n \"type\": \"basic\",\n \"issue_date_in_millis\": 1411948800000,\n \"expiry_date_in_millis\": 1914278399999,\n \"max_nodes\": 1,\n \"issued_to\": \"issuedTo\",\n \"issuer\": \"issuer\",\n \"signature\": \"xx\"\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.license.post({\n licenses: [\n {\n uid: \"893361dc-9749-4997-93cb-802e3d7fa4xx\",\n type: \"basic\",\n issue_date_in_millis: 1411948800000,\n expiry_date_in_millis: 1914278399999,\n max_nodes: 1,\n issued_to: \"issuedTo\",\n issuer: \"issuer\",\n signature: \"xx\",\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.license.post(\n body: {\n \"licenses\": [\n {\n \"uid\": \"893361dc-9749-4997-93cb-802e3d7fa4xx\",\n \"type\": \"basic\",\n \"issue_date_in_millis\": 1411948800000,\n \"expiry_date_in_millis\": 1914278399999,\n \"max_nodes\": 1,\n \"issued_to\": \"issuedTo\",\n \"issuer\": \"issuer\",\n \"signature\": \"xx\"\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->license()->post([\n \"body\" => [\n \"licenses\" => array(\n [\n \"uid\" => \"893361dc-9749-4997-93cb-802e3d7fa4xx\",\n \"type\" => \"basic\",\n \"issue_date_in_millis\" => 1411948800000,\n \"expiry_date_in_millis\" => 1914278399999,\n \"max_nodes\" => 1,\n \"issued_to\" => \"issuedTo\",\n \"issuer\" => \"issuer\",\n \"signature\" => \"xx\",\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"licenses\":[{\"uid\":\"893361dc-9749-4997-93cb-802e3d7fa4xx\",\"type\":\"basic\",\"issue_date_in_millis\":1411948800000,\"expiry_date_in_millis\":1914278399999,\"max_nodes\":1,\"issued_to\":\"issuedTo\",\"issuer\":\"issuer\",\"signature\":\"xx\"}]}' \"$ELASTICSEARCH_URL/_license\"", + "language": "curl" + } + ], "description": "Run `PUT _license` to update to a basic license. NOTE: These values are invalid; you must substitute the appropriate contents from your license file.\n", "method_request": "PUT _license", "value": "{\n \"licenses\": [\n {\n \"uid\":\"893361dc-9749-4997-93cb-802e3d7fa4xx\",\n \"type\":\"basic\",\n \"issue_date_in_millis\":1411948800000,\n \"expiry_date_in_millis\":1914278399999,\n \"max_nodes\":1,\n \"issued_to\":\"issuedTo\",\n \"issuer\":\"issuer\",\n \"signature\":\"xx\"\n }\n ]\n}" @@ -168433,6 +176112,28 @@ "description": "Start a basic license.\n\nStart an indefinite basic license, which gives access to all the basic features.\n\nNOTE: In order to start a basic license, you must not currently have a basic license.\n\nIf the basic license does not support all of the features that are available with your current license, however, you are notified in the response.\nYou must then re-submit the API request with the `acknowledge` parameter set to `true`.\n\nTo check the status of your basic license, use the get basic license API.", "examples": { "StartBasicLicenseRequestExample1": { + "alternatives": [ + { + "code": "resp = client.license.post_start_basic(\n acknowledge=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.license.postStartBasic({\n acknowledge: \"true\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.license.post_start_basic(\n acknowledge: \"true\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->license()->postStartBasic([\n \"acknowledge\" => \"true\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_license/start_basic?acknowledge=true\"", + "language": "curl" + } + ], "method_request": "POST /_license/start_basic?acknowledge=true" } }, @@ -168600,6 +176301,28 @@ "description": "Start a trial.\nStart a 30-day trial, which gives access to all subscription features.\n\nNOTE: You are allowed to start a trial only if your cluster has not already activated a trial for the current major product version.\nFor example, if you have already activated a trial for v8.0, you cannot start a new trial until v9.0. You can, however, request an extended trial at https://www.elastic.co/trialextension.\n\nTo check the status of your trial, use the get trial status API.", "examples": { "StartTrialLicenseRequestExample1": { + "alternatives": [ + { + "code": "resp = client.license.post_start_trial(\n acknowledge=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.license.postStartTrial({\n acknowledge: \"true\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.license.post_start_trial(\n acknowledge: \"true\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->license()->postStartTrial([\n \"acknowledge\" => \"true\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_license/start_trial?acknowledge=true\"", + "language": "curl" + } + ], "method_request": "POST /_license/start_trial?acknowledge=true" } }, @@ -168932,6 +176655,28 @@ "description": "Delete a Logstash pipeline.\nDelete a pipeline that is used for Logstash Central Management.\nIf the request succeeds, you receive an empty response with an appropriate status code.", "examples": { "LogstashDeletePipelineExample1": { + "alternatives": [ + { + "code": "resp = client.logstash.delete_pipeline(\n id=\"my_pipeline\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.logstash.deletePipeline({\n id: \"my_pipeline\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.logstash.delete_pipeline(\n id: \"my_pipeline\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->logstash()->deletePipeline([\n \"id\" => \"my_pipeline\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_logstash/pipeline/my_pipeline\"", + "language": "curl" + } + ], "method_request": "DELETE _logstash/pipeline/my_pipeline" } }, @@ -168984,6 +176729,28 @@ "description": "Get Logstash pipelines.\nGet pipelines that are used for Logstash Central Management.", "examples": { "LogstashGetPipelineRequestExample1": { + "alternatives": [ + { + "code": "resp = client.logstash.get_pipeline(\n id=\"my_pipeline\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.logstash.getPipeline({\n id: \"my_pipeline\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.logstash.get_pipeline(\n id: \"my_pipeline\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->logstash()->getPipeline([\n \"id\" => \"my_pipeline\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_logstash/pipeline/my_pipeline\"", + "language": "curl" + } + ], "method_request": "GET _logstash/pipeline/my_pipeline" } }, @@ -169069,6 +176836,28 @@ "description": "Create or update a Logstash pipeline.\n\nCreate a pipeline that is used for Logstash Central Management.\nIf the specified pipeline exists, it is replaced.", "examples": { "LogstashPutPipelineRequestExample1": { + "alternatives": [ + { + "code": "resp = client.logstash.put_pipeline(\n id=\"my_pipeline\",\n pipeline={\n \"description\": \"Sample pipeline for illustration purposes\",\n \"last_modified\": \"2021-01-02T02:50:51.250Z\",\n \"pipeline_metadata\": {\n \"type\": \"logstash_pipeline\",\n \"version\": 1\n },\n \"username\": \"elastic\",\n \"pipeline\": \"input {}\\\\n filter { grok {} }\\\\n output {}\",\n \"pipeline_settings\": {\n \"pipeline.workers\": 1,\n \"pipeline.batch.size\": 125,\n \"pipeline.batch.delay\": 50,\n \"queue.type\": \"memory\",\n \"queue.max_bytes\": \"1gb\",\n \"queue.checkpoint.writes\": 1024\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.logstash.putPipeline({\n id: \"my_pipeline\",\n pipeline: {\n description: \"Sample pipeline for illustration purposes\",\n last_modified: \"2021-01-02T02:50:51.250Z\",\n pipeline_metadata: {\n type: \"logstash_pipeline\",\n version: 1,\n },\n username: \"elastic\",\n pipeline: \"input {}\\\\n filter { grok {} }\\\\n output {}\",\n pipeline_settings: {\n \"pipeline.workers\": 1,\n \"pipeline.batch.size\": 125,\n \"pipeline.batch.delay\": 50,\n \"queue.type\": \"memory\",\n \"queue.max_bytes\": \"1gb\",\n \"queue.checkpoint.writes\": 1024,\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.logstash.put_pipeline(\n id: \"my_pipeline\",\n body: {\n \"description\": \"Sample pipeline for illustration purposes\",\n \"last_modified\": \"2021-01-02T02:50:51.250Z\",\n \"pipeline_metadata\": {\n \"type\": \"logstash_pipeline\",\n \"version\": 1\n },\n \"username\": \"elastic\",\n \"pipeline\": \"input {}\\\\n filter { grok {} }\\\\n output {}\",\n \"pipeline_settings\": {\n \"pipeline.workers\": 1,\n \"pipeline.batch.size\": 125,\n \"pipeline.batch.delay\": 50,\n \"queue.type\": \"memory\",\n \"queue.max_bytes\": \"1gb\",\n \"queue.checkpoint.writes\": 1024\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->logstash()->putPipeline([\n \"id\" => \"my_pipeline\",\n \"body\" => [\n \"description\" => \"Sample pipeline for illustration purposes\",\n \"last_modified\" => \"2021-01-02T02:50:51.250Z\",\n \"pipeline_metadata\" => [\n \"type\" => \"logstash_pipeline\",\n \"version\" => 1,\n ],\n \"username\" => \"elastic\",\n \"pipeline\" => \"input {}\\\\n filter { grok {} }\\\\n output {}\",\n \"pipeline_settings\" => [\n \"pipeline.workers\" => 1,\n \"pipeline.batch.size\" => 125,\n \"pipeline.batch.delay\" => 50,\n \"queue.type\" => \"memory\",\n \"queue.max_bytes\" => \"1gb\",\n \"queue.checkpoint.writes\" => 1024,\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"Sample pipeline for illustration purposes\",\"last_modified\":\"2021-01-02T02:50:51.250Z\",\"pipeline_metadata\":{\"type\":\"logstash_pipeline\",\"version\":1},\"username\":\"elastic\",\"pipeline\":\"input {}\\\\n filter { grok {} }\\\\n output {}\",\"pipeline_settings\":{\"pipeline.workers\":1,\"pipeline.batch.size\":125,\"pipeline.batch.delay\":50,\"queue.type\":\"memory\",\"queue.max_bytes\":\"1gb\",\"queue.checkpoint.writes\":1024}}' \"$ELASTICSEARCH_URL/_logstash/pipeline/my_pipeline\"", + "language": "curl" + } + ], "description": "Run `PUT _logstash/pipeline/my_pipeline` to create a pipeline.", "method_request": "PUT _logstash/pipeline/my_pipeline", "summary": "Create a pipeline", @@ -169235,6 +177024,28 @@ "description": "Get deprecation information.\nGet information about different cluster, node, and index level settings that use deprecated features that will be removed or changed in the next major version.\n\nTIP: This APIs is designed for indirect use by the Upgrade Assistant.\nYou are strongly recommended to use the Upgrade Assistant.", "examples": { "DeprecationInfoRequestExample1": { + "alternatives": [ + { + "code": "resp = client.migration.deprecations()", + "language": "Python" + }, + { + "code": "const response = await client.migration.deprecations();", + "language": "JavaScript" + }, + { + "code": "response = client.migration.deprecations", + "language": "Ruby" + }, + { + "code": "$resp = $client->migration()->deprecations();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_migration/deprecations\"", + "language": "curl" + } + ], "method_request": "GET /_migration/deprecations" } }, @@ -169565,6 +177376,28 @@ "description": "Get feature migration information.\nVersion upgrades sometimes require changes to how features store configuration information and data in system indices.\nCheck which features need to be migrated and the status of any migrations that are in progress.\n\nTIP: This API is designed for indirect use by the Upgrade Assistant.\nYou are strongly recommended to use the Upgrade Assistant.", "examples": { "GetFeatureUpgradeStatusRequestExample1": { + "alternatives": [ + { + "code": "resp = client.migration.get_feature_upgrade_status()", + "language": "Python" + }, + { + "code": "const response = await client.migration.getFeatureUpgradeStatus();", + "language": "JavaScript" + }, + { + "code": "response = client.migration.get_feature_upgrade_status", + "language": "Ruby" + }, + { + "code": "$resp = $client->migration()->getFeatureUpgradeStatus();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_migration/system_features\"", + "language": "curl" + } + ], "method_request": "GET /_migration/system_features" } }, @@ -169658,6 +177491,28 @@ "description": "Start the feature migration.\nVersion upgrades sometimes require changes to how features store configuration information and data in system indices.\nThis API starts the automatic migration process.\n\nSome functionality might be temporarily unavailable during the migration process.\n\nTIP: The API is designed for indirect use by the Upgrade Assistant. We strongly recommend you use the Upgrade Assistant.", "examples": { "PostFeatureUpgradeRequestExample1": { + "alternatives": [ + { + "code": "resp = client.migration.post_feature_upgrade()", + "language": "Python" + }, + { + "code": "const response = await client.migration.postFeatureUpgrade();", + "language": "JavaScript" + }, + { + "code": "response = client.migration.post_feature_upgrade", + "language": "Ruby" + }, + { + "code": "$resp = $client->migration()->postFeatureUpgrade();", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_migration/system_features\"", + "language": "curl" + } + ], "method_request": "POST /_migration/system_features" } }, @@ -182497,6 +190352,28 @@ "description": "Clear trained model deployment cache.\n\nCache will be cleared on all nodes where the trained model is assigned.\nA trained model deployment may have an inference cache enabled.\nAs requests are handled by each allocated node, their responses may be cached on that individual node.\nCalling this API clears the caches without restarting the deployment.", "examples": { "MlClearTrainedModelDeploymentCacheExample1": { + "alternatives": [ + { + "code": "resp = client.ml.clear_trained_model_deployment_cache(\n model_id=\"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.clearTrainedModelDeploymentCache({\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.clear_trained_model_deployment_cache(\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->clearTrainedModelDeploymentCache([\n \"model_id\" => \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/cache/_clear\"", + "language": "curl" + } + ], "method_request": "POST _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/cache/_clear" } }, @@ -182609,6 +190486,28 @@ "description": "Close anomaly detection jobs.\n\nA job can be opened and closed multiple times throughout its lifecycle. A closed job cannot receive data or perform analysis operations, but you can still explore and navigate results.\nWhen you close a job, it runs housekeeping tasks such as pruning the model history, flushing buffers, calculating final results and persisting the model snapshots. Depending upon the size of the job, it could take several minutes to close and the equivalent time to re-open. After it is closed, the job has a minimal overhead on the cluster except for maintaining its meta data. Therefore it is a best practice to close jobs that are no longer required to process data.\nIf you close an anomaly detection job whose datafeed is running, the request first tries to stop the datafeed. This behavior is equivalent to calling stop datafeed API with the same timeout and force parameters as the close job request.\nWhen a datafeed that has a specified end date stops, it automatically closes its associated job.", "examples": { "MlCloseJobExample1": { + "alternatives": [ + { + "code": "resp = client.ml.close_job(\n job_id=\"low_request_rate\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.closeJob({\n job_id: \"low_request_rate\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.close_job(\n job_id: \"low_request_rate\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->closeJob([\n \"job_id\" => \"low_request_rate\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_close\"", + "language": "curl" + } + ], "method_request": "POST _ml/anomaly_detectors/low_request_rate/_close" } }, @@ -182720,6 +190619,28 @@ "description": "Delete a calendar.\n\nRemove all scheduled events from a calendar, then delete it.", "examples": { "MlDeleteCalendarExample1": { + "alternatives": [ + { + "code": "resp = client.ml.delete_calendar(\n calendar_id=\"planned-outages\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.deleteCalendar({\n calendar_id: \"planned-outages\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.delete_calendar(\n calendar_id: \"planned-outages\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->deleteCalendar([\n \"calendar_id\" => \"planned-outages\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages\"", + "language": "curl" + } + ], "method_request": "DELETE _ml/calendars/planned-outages" } }, @@ -182786,6 +190707,28 @@ "description": "Delete events from a calendar.", "examples": { "MlDeleteCalendarEventExample1": { + "alternatives": [ + { + "code": "resp = client.ml.delete_calendar_event(\n calendar_id=\"planned-outages\",\n event_id=\"LS8LJGEBMTCMA-qz49st\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.deleteCalendarEvent({\n calendar_id: \"planned-outages\",\n event_id: \"LS8LJGEBMTCMA-qz49st\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.delete_calendar_event(\n calendar_id: \"planned-outages\",\n event_id: \"LS8LJGEBMTCMA-qz49st\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->deleteCalendarEvent([\n \"calendar_id\" => \"planned-outages\",\n \"event_id\" => \"LS8LJGEBMTCMA-qz49st\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages/events/LS8LJGEBMTCMA-qz49st\"", + "language": "curl" + } + ], "method_request": "DELETE _ml/calendars/planned-outages/events/LS8LJGEBMTCMA-qz49st" } }, @@ -182864,6 +190807,28 @@ "description": "Delete anomaly jobs from a calendar.", "examples": { "MlDeleteCalendarJobExample1": { + "alternatives": [ + { + "code": "resp = client.ml.delete_calendar_job(\n calendar_id=\"planned-outages\",\n job_id=\"total-requests\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.deleteCalendarJob({\n calendar_id: \"planned-outages\",\n job_id: \"total-requests\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.delete_calendar_job(\n calendar_id: \"planned-outages\",\n job_id: \"total-requests\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->deleteCalendarJob([\n \"calendar_id\" => \"planned-outages\",\n \"job_id\" => \"total-requests\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages/jobs/total-requests\"", + "language": "curl" + } + ], "method_request": "DELETE _ml/calendars/planned-outages/jobs/total-requests" } }, @@ -182972,6 +190937,28 @@ "description": "Delete a data frame analytics job.", "examples": { "MlDeleteDataFrameAnalyticsExample1": { + "alternatives": [ + { + "code": "resp = client.ml.delete_data_frame_analytics(\n id=\"loganalytics\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.deleteDataFrameAnalytics({\n id: \"loganalytics\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.delete_data_frame_analytics(\n id: \"loganalytics\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->deleteDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics\"", + "language": "curl" + } + ], "method_request": "DELETE _ml/data_frame/analytics/loganalytics" } }, @@ -183065,6 +191052,28 @@ "description": "Delete a datafeed.", "examples": { "MlDeleteDatafeedExample1": { + "alternatives": [ + { + "code": "resp = client.ml.delete_datafeed(\n datafeed_id=\"datafeed-total-requests\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.deleteDatafeed({\n datafeed_id: \"datafeed-total-requests\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.delete_datafeed(\n datafeed_id: \"datafeed-total-requests\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->deleteDatafeed([\n \"datafeed_id\" => \"datafeed-total-requests\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-total-requests\"", + "language": "curl" + } + ], "method_request": "DELETE _ml/datafeeds/datafeed-total-requests" } }, @@ -183171,6 +191180,28 @@ "description": "Delete expired ML data.\n\nDelete all job results, model snapshots and forecast data that have exceeded\ntheir retention days period. Machine learning state documents that are not\nassociated with any job are also deleted.\nYou can limit the request to a single or set of anomaly detection jobs by\nusing a job identifier, a group name, a comma-separated list of jobs, or a\nwildcard expression. You can delete expired data for all anomaly detection\njobs by using `_all`, by specifying `*` as the ``, or by omitting the\n``.", "examples": { "MlDeleteExpiredDataExample1": { + "alternatives": [ + { + "code": "resp = client.ml.delete_expired_data(\n timeout=\"1h\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.deleteExpiredData({\n timeout: \"1h\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.delete_expired_data(\n timeout: \"1h\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->deleteExpiredData([\n \"timeout\" => \"1h\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/_delete_expired_data?timeout=1h\"", + "language": "curl" + } + ], "method_request": "DELETE _ml/_delete_expired_data?timeout=1h" } }, @@ -183268,6 +191299,28 @@ "description": "Delete a filter.\n\nIf an anomaly detection job references the filter, you cannot delete the\nfilter. You must update or delete the job before you can delete the filter.", "examples": { "MlDeleteFilterExample1": { + "alternatives": [ + { + "code": "resp = client.ml.delete_filter(\n filter_id=\"safe_domains\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.deleteFilter({\n filter_id: \"safe_domains\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.delete_filter(\n filter_id: \"safe_domains\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->deleteFilter([\n \"filter_id\" => \"safe_domains\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/filters/safe_domains\"", + "language": "curl" + } + ], "method_request": "DELETE _ml/filters/safe_domains" } }, @@ -183334,6 +191387,28 @@ "description": "Delete forecasts from a job.\n\nBy default, forecasts are retained for 14 days. You can specify a\ndifferent retention period with the `expires_in` parameter in the forecast\njobs API. The delete forecast API enables you to delete one or more\nforecasts before they expire.", "examples": { "MlDeleteForecastExample1": { + "alternatives": [ + { + "code": "resp = client.ml.delete_forecast(\n job_id=\"total-requests\",\n forecast_id=\"_all\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.deleteForecast({\n job_id: \"total-requests\",\n forecast_id: \"_all\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.delete_forecast(\n job_id: \"total-requests\",\n forecast_id: \"_all\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->deleteForecast([\n \"job_id\" => \"total-requests\",\n \"forecast_id\" => \"_all\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/total-requests/_forecast/_all\"", + "language": "curl" + } + ], "method_request": "DELETE _ml/anomaly_detectors/total-requests/_forecast/_all" } }, @@ -183439,6 +191514,28 @@ "description": "Delete an anomaly detection job.\n\nAll job configuration, model state and results are deleted.\nIt is not currently possible to delete multiple jobs using wildcards or a\ncomma separated list. If you delete a job that has a datafeed, the request\nfirst tries to delete the datafeed. This behavior is equivalent to calling\nthe delete datafeed API with the same timeout and force parameters as the\ndelete job request.", "examples": { "MlDeleteJobExample1": { + "alternatives": [ + { + "code": "resp = client.ml.delete_job(\n job_id=\"total-requests\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.deleteJob({\n job_id: \"total-requests\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.delete_job(\n job_id: \"total-requests\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->deleteJob([\n \"job_id\" => \"total-requests\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/total-requests\"", + "language": "curl" + } + ], "method_request": "DELETE _ml/anomaly_detectors/total-requests" } }, @@ -183550,6 +191647,28 @@ "description": "Delete a model snapshot.\n\nYou cannot delete the active model snapshot. To delete that snapshot, first\nrevert to a different one. To identify the active model snapshot, refer to\nthe `model_snapshot_id` in the results from the get jobs API.", "examples": { "MlDeleteModelSnapshotExample1": { + "alternatives": [ + { + "code": "resp = client.ml.delete_model_snapshot(\n job_id=\"farequote\",\n snapshot_id=\"1491948163\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.deleteModelSnapshot({\n job_id: \"farequote\",\n snapshot_id: 1491948163,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.delete_model_snapshot(\n job_id: \"farequote\",\n snapshot_id: \"1491948163\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->deleteModelSnapshot([\n \"job_id\" => \"farequote\",\n \"snapshot_id\" => \"1491948163\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/farequote/model_snapshots/1491948163\"", + "language": "curl" + } + ], "method_request": "DELETE _ml/anomaly_detectors/farequote/model_snapshots/1491948163" } }, @@ -183628,6 +191747,28 @@ "description": "Delete an unreferenced trained model.\n\nThe request deletes a trained inference model that is not referenced by an ingest pipeline.", "examples": { "MlDeleteTrainedModelExample1": { + "alternatives": [ + { + "code": "resp = client.ml.delete_trained_model(\n model_id=\"regression-job-one-1574775307356\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.deleteTrainedModel({\n model_id: \"regression-job-one-1574775307356\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.delete_trained_model(\n model_id: \"regression-job-one-1574775307356\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->deleteTrainedModel([\n \"model_id\" => \"regression-job-one-1574775307356\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/regression-job-one-1574775307356\"", + "language": "curl" + } + ], "method_request": "DELETE _ml/trained_models/regression-job-one-1574775307356" } }, @@ -183720,6 +191861,28 @@ "description": "Delete a trained model alias.\n\nThis API deletes an existing model alias that refers to a trained model. If\nthe model alias is missing or refers to a model other than the one identified\nby the `model_id`, this API returns an error.", "examples": { "MlDeleteTrainedModelAliasExample1": { + "alternatives": [ + { + "code": "resp = client.ml.delete_trained_model_alias(\n model_id=\"flight-delay-prediction-1574775339910\",\n model_alias=\"flight_delay_model\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.deleteTrainedModelAlias({\n model_id: \"flight-delay-prediction-1574775339910\",\n model_alias: \"flight_delay_model\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.delete_trained_model_alias(\n model_id: \"flight-delay-prediction-1574775339910\",\n model_alias: \"flight_delay_model\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->deleteTrainedModelAlias([\n \"model_id\" => \"flight-delay-prediction-1574775339910\",\n \"model_alias\" => \"flight_delay_model\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/flight-delay-prediction-1574775339910/model_aliases/flight_delay_model\"", + "language": "curl" + } + ], "method_request": "DELETE _ml/trained_models/flight-delay-prediction-1574775339910/model_aliases/flight_delay_model" } }, @@ -183858,6 +192021,28 @@ "description": "Estimate job model memory usage.\n\nMake an estimation of the memory usage for an anomaly detection job model.\nThe estimate is based on analysis configuration details for the job and cardinality\nestimates for the fields it references.", "examples": { "MlEstimateModelMemoryRequestExample1": { + "alternatives": [ + { + "code": "resp = client.ml.estimate_model_memory(\n analysis_config={\n \"bucket_span\": \"5m\",\n \"detectors\": [\n {\n \"function\": \"sum\",\n \"field_name\": \"bytes\",\n \"by_field_name\": \"status\",\n \"partition_field_name\": \"app\"\n }\n ],\n \"influencers\": [\n \"source_ip\",\n \"dest_ip\"\n ]\n },\n overall_cardinality={\n \"status\": 10,\n \"app\": 50\n },\n max_bucket_cardinality={\n \"source_ip\": 300,\n \"dest_ip\": 30\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.estimateModelMemory({\n analysis_config: {\n bucket_span: \"5m\",\n detectors: [\n {\n function: \"sum\",\n field_name: \"bytes\",\n by_field_name: \"status\",\n partition_field_name: \"app\",\n },\n ],\n influencers: [\"source_ip\", \"dest_ip\"],\n },\n overall_cardinality: {\n status: 10,\n app: 50,\n },\n max_bucket_cardinality: {\n source_ip: 300,\n dest_ip: 30,\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.estimate_model_memory(\n body: {\n \"analysis_config\": {\n \"bucket_span\": \"5m\",\n \"detectors\": [\n {\n \"function\": \"sum\",\n \"field_name\": \"bytes\",\n \"by_field_name\": \"status\",\n \"partition_field_name\": \"app\"\n }\n ],\n \"influencers\": [\n \"source_ip\",\n \"dest_ip\"\n ]\n },\n \"overall_cardinality\": {\n \"status\": 10,\n \"app\": 50\n },\n \"max_bucket_cardinality\": {\n \"source_ip\": 300,\n \"dest_ip\": 30\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->estimateModelMemory([\n \"body\" => [\n \"analysis_config\" => [\n \"bucket_span\" => \"5m\",\n \"detectors\" => array(\n [\n \"function\" => \"sum\",\n \"field_name\" => \"bytes\",\n \"by_field_name\" => \"status\",\n \"partition_field_name\" => \"app\",\n ],\n ),\n \"influencers\" => array(\n \"source_ip\",\n \"dest_ip\",\n ),\n ],\n \"overall_cardinality\" => [\n \"status\" => 10,\n \"app\" => 50,\n ],\n \"max_bucket_cardinality\" => [\n \"source_ip\" => 300,\n \"dest_ip\" => 30,\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"analysis_config\":{\"bucket_span\":\"5m\",\"detectors\":[{\"function\":\"sum\",\"field_name\":\"bytes\",\"by_field_name\":\"status\",\"partition_field_name\":\"app\"}],\"influencers\":[\"source_ip\",\"dest_ip\"]},\"overall_cardinality\":{\"status\":10,\"app\":50},\"max_bucket_cardinality\":{\"source_ip\":300,\"dest_ip\":30}}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/_estimate_model_memory\"", + "language": "curl" + } + ], "description": "Run `POST _ml/anomaly_detectors/_estimate_model_memory` to estimate the model memory limit based on the analysis configuration details provided in the request body.", "method_request": "POST _ml/anomaly_detectors/_estimate_model_memory", "value": "{\n \"analysis_config\": {\n \"bucket_span\": \"5m\",\n \"detectors\": [\n {\n \"function\": \"sum\",\n \"field_name\": \"bytes\",\n \"by_field_name\": \"status\",\n \"partition_field_name\": \"app\"\n }\n ],\n \"influencers\": [\n \"source_ip\",\n \"dest_ip\"\n ]\n },\n \"overall_cardinality\": {\n \"status\": 10,\n \"app\": 50\n },\n \"max_bucket_cardinality\": {\n \"source_ip\": 300,\n \"dest_ip\": 30\n }\n}" @@ -184590,30 +192775,140 @@ "description": "Evaluate data frame analytics.\n\nThe API packages together commonly used evaluation metrics for various types\nof machine learning features. This has been designed for use on indexes\ncreated by data frame analytics. Evaluation requires both a ground truth\nfield and an analytics result field to be present.", "examples": { "MlEvaluateDataFrameRequestExample1": { + "alternatives": [ + { + "code": "resp = client.ml.evaluate_data_frame(\n index=\"animal_classification\",\n evaluation={\n \"classification\": {\n \"actual_field\": \"animal_class\",\n \"predicted_field\": \"ml.animal_class_prediction\",\n \"metrics\": {\n \"multiclass_confusion_matrix\": {}\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.evaluateDataFrame({\n index: \"animal_classification\",\n evaluation: {\n classification: {\n actual_field: \"animal_class\",\n predicted_field: \"ml.animal_class_prediction\",\n metrics: {\n multiclass_confusion_matrix: {},\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.evaluate_data_frame(\n body: {\n \"index\": \"animal_classification\",\n \"evaluation\": {\n \"classification\": {\n \"actual_field\": \"animal_class\",\n \"predicted_field\": \"ml.animal_class_prediction\",\n \"metrics\": {\n \"multiclass_confusion_matrix\": {}\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->evaluateDataFrame([\n \"body\" => [\n \"index\" => \"animal_classification\",\n \"evaluation\" => [\n \"classification\" => [\n \"actual_field\" => \"animal_class\",\n \"predicted_field\" => \"ml.animal_class_prediction\",\n \"metrics\" => [\n \"multiclass_confusion_matrix\" => new ArrayObject([]),\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index\":\"animal_classification\",\"evaluation\":{\"classification\":{\"actual_field\":\"animal_class\",\"predicted_field\":\"ml.animal_class_prediction\",\"metrics\":{\"multiclass_confusion_matrix\":{}}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/_evaluate\"", + "language": "curl" + } + ], "description": "Run `POST _ml/data_frame/_evaluate` to evaluate a a classification job for an annotated index. The `actual_field` contains the ground truth for classification. The `predicted_field` contains the predicted value calculated by the classification analysis.\n", "method_request": "POST _ml/data_frame/_evaluate", "summary": "Classification example 1", "value": "{\n \"index\": \"animal_classification\",\n \"evaluation\": {\n \"classification\": {\n \"actual_field\": \"animal_class\",\n \"predicted_field\": \"ml.animal_class_prediction\",\n \"metrics\": {\n \"multiclass_confusion_matrix\": {}\n }\n }\n }\n}" }, "MlEvaluateDataFrameRequestExample2": { + "alternatives": [ + { + "code": "resp = client.ml.evaluate_data_frame(\n index=\"animal_classification\",\n evaluation={\n \"classification\": {\n \"actual_field\": \"animal_class\",\n \"metrics\": {\n \"auc_roc\": {\n \"class_name\": \"dog\"\n }\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.evaluateDataFrame({\n index: \"animal_classification\",\n evaluation: {\n classification: {\n actual_field: \"animal_class\",\n metrics: {\n auc_roc: {\n class_name: \"dog\",\n },\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.evaluate_data_frame(\n body: {\n \"index\": \"animal_classification\",\n \"evaluation\": {\n \"classification\": {\n \"actual_field\": \"animal_class\",\n \"metrics\": {\n \"auc_roc\": {\n \"class_name\": \"dog\"\n }\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->evaluateDataFrame([\n \"body\" => [\n \"index\" => \"animal_classification\",\n \"evaluation\" => [\n \"classification\" => [\n \"actual_field\" => \"animal_class\",\n \"metrics\" => [\n \"auc_roc\" => [\n \"class_name\" => \"dog\",\n ],\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index\":\"animal_classification\",\"evaluation\":{\"classification\":{\"actual_field\":\"animal_class\",\"metrics\":{\"auc_roc\":{\"class_name\":\"dog\"}}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/_evaluate\"", + "language": "curl" + } + ], "description": "Run `POST _ml/data_frame/_evaluate` to evaluate a classification job with AUC ROC metrics for an annotated index. The `actual_field` contains the ground truth value for the actual animal classification. This is required in order to evaluate results. The `class_name` specifies the class name that is treated as positive during the evaluation, all the other classes are treated as negative.\n", "method_request": "POST _ml/data_frame/_evaluate", "summary": "Classification example 2", "value": "{\n \"index\": \"animal_classification\",\n \"evaluation\": {\n \"classification\": {\n \"actual_field\": \"animal_class\",\n \"metrics\": {\n \"auc_roc\": {\n \"class_name\": \"dog\"\n }\n }\n }\n }\n}" }, "MlEvaluateDataFrameRequestExample3": { + "alternatives": [ + { + "code": "resp = client.ml.evaluate_data_frame(\n index=\"my_analytics_dest_index\",\n evaluation={\n \"outlier_detection\": {\n \"actual_field\": \"is_outlier\",\n \"predicted_probability_field\": \"ml.outlier_score\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.evaluateDataFrame({\n index: \"my_analytics_dest_index\",\n evaluation: {\n outlier_detection: {\n actual_field: \"is_outlier\",\n predicted_probability_field: \"ml.outlier_score\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.evaluate_data_frame(\n body: {\n \"index\": \"my_analytics_dest_index\",\n \"evaluation\": {\n \"outlier_detection\": {\n \"actual_field\": \"is_outlier\",\n \"predicted_probability_field\": \"ml.outlier_score\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->evaluateDataFrame([\n \"body\" => [\n \"index\" => \"my_analytics_dest_index\",\n \"evaluation\" => [\n \"outlier_detection\" => [\n \"actual_field\" => \"is_outlier\",\n \"predicted_probability_field\" => \"ml.outlier_score\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index\":\"my_analytics_dest_index\",\"evaluation\":{\"outlier_detection\":{\"actual_field\":\"is_outlier\",\"predicted_probability_field\":\"ml.outlier_score\"}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/_evaluate\"", + "language": "curl" + } + ], "description": "Run `POST _ml/data_frame/_evaluate` to evaluate an outlier detection job for an annotated index.\n", "method_request": "POST _ml/data_frame/_evaluate", "summary": "Outlier detection", "value": "{\n \"index\": \"my_analytics_dest_index\",\n \"evaluation\": {\n \"outlier_detection\": {\n \"actual_field\": \"is_outlier\",\n \"predicted_probability_field\": \"ml.outlier_score\"\n }\n }\n}" }, "MlEvaluateDataFrameRequestExample4": { + "alternatives": [ + { + "code": "resp = client.ml.evaluate_data_frame(\n index=\"house_price_predictions\",\n query={\n \"bool\": {\n \"filter\": [\n {\n \"term\": {\n \"ml.is_training\": False\n }\n }\n ]\n }\n },\n evaluation={\n \"regression\": {\n \"actual_field\": \"price\",\n \"predicted_field\": \"ml.price_prediction\",\n \"metrics\": {\n \"r_squared\": {},\n \"mse\": {},\n \"msle\": {\n \"offset\": 10\n },\n \"huber\": {\n \"delta\": 1.5\n }\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.evaluateDataFrame({\n index: \"house_price_predictions\",\n query: {\n bool: {\n filter: [\n {\n term: {\n \"ml.is_training\": false,\n },\n },\n ],\n },\n },\n evaluation: {\n regression: {\n actual_field: \"price\",\n predicted_field: \"ml.price_prediction\",\n metrics: {\n r_squared: {},\n mse: {},\n msle: {\n offset: 10,\n },\n huber: {\n delta: 1.5,\n },\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.evaluate_data_frame(\n body: {\n \"index\": \"house_price_predictions\",\n \"query\": {\n \"bool\": {\n \"filter\": [\n {\n \"term\": {\n \"ml.is_training\": false\n }\n }\n ]\n }\n },\n \"evaluation\": {\n \"regression\": {\n \"actual_field\": \"price\",\n \"predicted_field\": \"ml.price_prediction\",\n \"metrics\": {\n \"r_squared\": {},\n \"mse\": {},\n \"msle\": {\n \"offset\": 10\n },\n \"huber\": {\n \"delta\": 1.5\n }\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->evaluateDataFrame([\n \"body\" => [\n \"index\" => \"house_price_predictions\",\n \"query\" => [\n \"bool\" => [\n \"filter\" => array(\n [\n \"term\" => [\n \"ml.is_training\" => false,\n ],\n ],\n ),\n ],\n ],\n \"evaluation\" => [\n \"regression\" => [\n \"actual_field\" => \"price\",\n \"predicted_field\" => \"ml.price_prediction\",\n \"metrics\" => [\n \"r_squared\" => new ArrayObject([]),\n \"mse\" => new ArrayObject([]),\n \"msle\" => [\n \"offset\" => 10,\n ],\n \"huber\" => [\n \"delta\" => 1.5,\n ],\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index\":\"house_price_predictions\",\"query\":{\"bool\":{\"filter\":[{\"term\":{\"ml.is_training\":false}}]}},\"evaluation\":{\"regression\":{\"actual_field\":\"price\",\"predicted_field\":\"ml.price_prediction\",\"metrics\":{\"r_squared\":{},\"mse\":{},\"msle\":{\"offset\":10},\"huber\":{\"delta\":1.5}}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/_evaluate\"", + "language": "curl" + } + ], "description": "Run `POST _ml/data_frame/_evaluate` to evaluate the testing error of a regression job for an annotated index. The term query in the body limits evaluation to be performed on the test split only. The `actual_field` contains the ground truth for house prices. The `predicted_field` contains the house price calculated by the regression analysis.\n", "method_request": "POST _ml/data_frame/_evaluate", "summary": "Regression example 1", "value": "{\n \"index\": \"house_price_predictions\",\n \"query\": {\n \"bool\": {\n \"filter\": [\n {\n \"term\": {\n \"ml.is_training\": false\n }\n }\n ]\n }\n },\n \"evaluation\": {\n \"regression\": {\n \"actual_field\": \"price\",\n \"predicted_field\": \"ml.price_prediction\",\n \"metrics\": {\n \"r_squared\": {},\n \"mse\": {},\n \"msle\": {\n \"offset\": 10\n },\n \"huber\": {\n \"delta\": 1.5\n }\n }\n }\n }\n}" }, "MlEvaluateDataFrameRequestExample5": { + "alternatives": [ + { + "code": "resp = client.ml.evaluate_data_frame(\n index=\"house_price_predictions\",\n query={\n \"term\": {\n \"ml.is_training\": {\n \"value\": True\n }\n }\n },\n evaluation={\n \"regression\": {\n \"actual_field\": \"price\",\n \"predicted_field\": \"ml.price_prediction\",\n \"metrics\": {\n \"r_squared\": {},\n \"mse\": {},\n \"msle\": {},\n \"huber\": {}\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.evaluateDataFrame({\n index: \"house_price_predictions\",\n query: {\n term: {\n \"ml.is_training\": {\n value: true,\n },\n },\n },\n evaluation: {\n regression: {\n actual_field: \"price\",\n predicted_field: \"ml.price_prediction\",\n metrics: {\n r_squared: {},\n mse: {},\n msle: {},\n huber: {},\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.evaluate_data_frame(\n body: {\n \"index\": \"house_price_predictions\",\n \"query\": {\n \"term\": {\n \"ml.is_training\": {\n \"value\": true\n }\n }\n },\n \"evaluation\": {\n \"regression\": {\n \"actual_field\": \"price\",\n \"predicted_field\": \"ml.price_prediction\",\n \"metrics\": {\n \"r_squared\": {},\n \"mse\": {},\n \"msle\": {},\n \"huber\": {}\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->evaluateDataFrame([\n \"body\" => [\n \"index\" => \"house_price_predictions\",\n \"query\" => [\n \"term\" => [\n \"ml.is_training\" => [\n \"value\" => true,\n ],\n ],\n ],\n \"evaluation\" => [\n \"regression\" => [\n \"actual_field\" => \"price\",\n \"predicted_field\" => \"ml.price_prediction\",\n \"metrics\" => [\n \"r_squared\" => new ArrayObject([]),\n \"mse\" => new ArrayObject([]),\n \"msle\" => new ArrayObject([]),\n \"huber\" => new ArrayObject([]),\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index\":\"house_price_predictions\",\"query\":{\"term\":{\"ml.is_training\":{\"value\":true}}},\"evaluation\":{\"regression\":{\"actual_field\":\"price\",\"predicted_field\":\"ml.price_prediction\",\"metrics\":{\"r_squared\":{},\"mse\":{},\"msle\":{},\"huber\":{}}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/_evaluate\"", + "language": "curl" + } + ], "description": "Run `POST _ml/data_frame/_evaluate` to evaluate the training error of a regression job for an annotated index. The term query in the body limits evaluation to be performed on the training split only. The `actual_field` contains the ground truth for house prices. The `predicted_field` contains the house price calculated by the regression analysis.\n", "method_request": "POST _ml/data_frame/_evaluate", "summary": "Regression example 2", @@ -184816,6 +193111,28 @@ "description": "Explain data frame analytics config.\n\nThis API provides explanations for a data frame analytics config that either\nexists already or one that has not been created yet. The following\nexplanations are provided:\n* which fields are included or not in the analysis and why,\n* how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on.\nIf you have object fields or fields that are excluded via source filtering, they are not included in the explanation.", "examples": { "MlExplainDataFrameAnalyticsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.ml.explain_data_frame_analytics(\n source={\n \"index\": \"houses_sold_last_10_yrs\"\n },\n analysis={\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.explainDataFrameAnalytics({\n source: {\n index: \"houses_sold_last_10_yrs\",\n },\n analysis: {\n regression: {\n dependent_variable: \"price\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.explain_data_frame_analytics(\n body: {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->explainDataFrameAnalytics([\n \"body\" => [\n \"source\" => [\n \"index\" => \"houses_sold_last_10_yrs\",\n ],\n \"analysis\" => [\n \"regression\" => [\n \"dependent_variable\" => \"price\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"houses_sold_last_10_yrs\"},\"analysis\":{\"regression\":{\"dependent_variable\":\"price\"}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/_explain\"", + "language": "curl" + } + ], "description": "Run `POST _ml/data_frame/analytics/_explain` to explain a data frame analytics job configuration.", "method_request": "POST _ml/data_frame/analytics/_explain", "value": "{\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n}" @@ -184967,6 +193284,28 @@ "description": "Force buffered data to be processed.\nThe flush jobs API is only applicable when sending data for analysis using\nthe post data API. Depending on the content of the buffer, then it might\nadditionally calculate new results. Both flush and close operations are\nsimilar, however the flush is more efficient if you are expecting to send\nmore data for analysis. When flushing, the job remains open and is available\nto continue analyzing data. A close operation additionally prunes and\npersists the model state to disk and the job must be opened again before\nanalyzing further data.", "examples": { "MlFlushJobExample1": { + "alternatives": [ + { + "code": "resp = client.ml.flush_job(\n job_id=\"low_request_rate\",\n calc_interim=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.flushJob({\n job_id: \"low_request_rate\",\n calc_interim: true,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.flush_job(\n job_id: \"low_request_rate\",\n body: {\n \"calc_interim\": true\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->flushJob([\n \"job_id\" => \"low_request_rate\",\n \"body\" => [\n \"calc_interim\" => true,\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"calc_interim\":true}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_flush\"", + "language": "curl" + } + ], "description": "An example body for a `POST _ml/anomaly_detectors/low_request_rate/_flush` request.", "method_request": "POST _ml/anomaly_detectors/low_request_rate/_flush", "value": "{\n \"calc_interim\": true\n}" @@ -185148,6 +193487,28 @@ "description": "Predict future behavior of a time series.\n\nForecasts are not supported for jobs that perform population analysis; an\nerror occurs if you try to create a forecast for a job that has an\n`over_field_name` in its configuration. Forcasts predict future behavior\nbased on historical data.", "examples": { "MlForecastExample1": { + "alternatives": [ + { + "code": "resp = client.ml.forecast(\n job_id=\"low_request_rate\",\n duration=\"10d\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.forecast({\n job_id: \"low_request_rate\",\n duration: \"10d\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.forecast(\n job_id: \"low_request_rate\",\n body: {\n \"duration\": \"10d\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->forecast([\n \"job_id\" => \"low_request_rate\",\n \"body\" => [\n \"duration\" => \"10d\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"duration\":\"10d\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_forecast\"", + "language": "curl" + } + ], "description": "An example body for a `POST _ml/anomaly_detectors/low_request_rate/_forecast` request.", "method_request": "POST _ml/anomaly_detectors/low_request_rate/_forecast", "value": "{\n \"duration\": \"10d\"\n}" @@ -185370,6 +193731,28 @@ "description": "Get anomaly detection job results for buckets.\nThe API presents a chronological view of the records, grouped by bucket.", "examples": { "MlGetBucketsExample1": { + "alternatives": [ + { + "code": "resp = client.ml.get_buckets(\n job_id=\"low_request_rate\",\n anomaly_score=80,\n start=\"1454530200001\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.getBuckets({\n job_id: \"low_request_rate\",\n anomaly_score: 80,\n start: 1454530200001,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.get_buckets(\n job_id: \"low_request_rate\",\n body: {\n \"anomaly_score\": 80,\n \"start\": \"1454530200001\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->getBuckets([\n \"job_id\" => \"low_request_rate\",\n \"body\" => [\n \"anomaly_score\" => 80,\n \"start\" => \"1454530200001\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"anomaly_score\":80,\"start\":\"1454530200001\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/results/buckets\"", + "language": "curl" + } + ], "description": "An example body for a `GET _ml/anomaly_detectors/low_request_rate/results/buckets` request.", "method_request": "GET _ml/anomaly_detectors/low_request_rate/results/buckets", "value": "{\n \"anomaly_score\": 80,\n \"start\": \"1454530200001\"\n}" @@ -185581,6 +193964,28 @@ "description": "Get info about events in calendars.", "examples": { "MlGetCalendarEventsExample1": { + "alternatives": [ + { + "code": "resp = client.ml.get_calendar_events(\n calendar_id=\"planned-outages\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.getCalendarEvents({\n calendar_id: \"planned-outages\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.get_calendar_events(\n calendar_id: \"planned-outages\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->getCalendarEvents([\n \"calendar_id\" => \"planned-outages\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages/events\"", + "language": "curl" + } + ], "method_request": "GET _ml/calendars/planned-outages/events" } }, @@ -185786,6 +194191,28 @@ "description": "Get calendar configuration info.", "examples": { "MlGetCalendarsExample1": { + "alternatives": [ + { + "code": "resp = client.ml.get_calendars(\n calendar_id=\"planned-outages\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.getCalendars({\n calendar_id: \"planned-outages\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.get_calendars(\n calendar_id: \"planned-outages\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->getCalendars([\n \"calendar_id\" => \"planned-outages\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages\"", + "language": "curl" + } + ], "method_request": "GET _ml/calendars/planned-outages" } }, @@ -185906,6 +194333,28 @@ "description": "Get anomaly detection job results for categories.", "examples": { "MlGetCategoriesExample1": { + "alternatives": [ + { + "code": "resp = client.ml.get_categories(\n job_id=\"esxi_log\",\n page={\n \"size\": 1\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.getCategories({\n job_id: \"esxi_log\",\n page: {\n size: 1,\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.get_categories(\n job_id: \"esxi_log\",\n body: {\n \"page\": {\n \"size\": 1\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->getCategories([\n \"job_id\" => \"esxi_log\",\n \"body\" => [\n \"page\" => [\n \"size\" => 1,\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"page\":{\"size\":1}}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/esxi_log/results/categories\"", + "language": "curl" + } + ], "description": "An example body for a `GET _ml/anomaly_detectors/esxi_log/results/categories` request.", "method_request": "GET _ml/anomaly_detectors/esxi_log/results/categories", "value": "{\n \"page\":{\n \"size\": 1\n }\n}" @@ -186038,6 +194487,28 @@ "description": "Get data frame analytics job configuration info.\nYou can get information for multiple data frame analytics jobs in a single\nAPI request by using a comma-separated list of data frame analytics jobs or a\nwildcard expression.", "examples": { "MlGetDataFrameAnalyticsExample1": { + "alternatives": [ + { + "code": "resp = client.ml.get_data_frame_analytics(\n id=\"loganalytics\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.getDataFrameAnalytics({\n id: \"loganalytics\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.get_data_frame_analytics(\n id: \"loganalytics\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->getDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics\"", + "language": "curl" + } + ], "method_request": "GET _ml/data_frame/analytics/loganalytics" } }, @@ -186171,6 +194642,28 @@ "description": "Get data frame analytics job stats.", "examples": { "MlGetDataFrameAnalyticsStatsExample1": { + "alternatives": [ + { + "code": "resp = client.ml.get_data_frame_analytics_stats(\n id=\"weblog-outliers\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.getDataFrameAnalyticsStats({\n id: \"weblog-outliers\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.get_data_frame_analytics_stats(\n id: \"weblog-outliers\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->getDataFrameAnalyticsStats([\n \"id\" => \"weblog-outliers\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/weblog-outliers/_stats\"", + "language": "curl" + } + ], "method_request": "GET _ml/data_frame/analytics/weblog-outliers/_stats" } }, @@ -186304,6 +194797,28 @@ "description": "Get datafeed stats.\nYou can get statistics for multiple datafeeds in a single API request by\nusing a comma-separated list of datafeeds or a wildcard expression. You can\nget statistics for all datafeeds by using `_all`, by specifying `*` as the\n``, or by omitting the ``. If the datafeed is stopped, the\nonly information you receive is the `datafeed_id` and the `state`.\nThis API returns a maximum of 10,000 datafeeds.", "examples": { "MlGetDatafeedStatsExample1": { + "alternatives": [ + { + "code": "resp = client.ml.get_datafeed_stats(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.getDatafeedStats({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.get_datafeed_stats(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->getDatafeedStats([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales/_stats\"", + "language": "curl" + } + ], "method_request": "GET _ml/datafeeds/datafeed-high_sum_total_sales/_stats" } }, @@ -186396,6 +194911,28 @@ "description": "Get datafeeds configuration info.\nYou can get information for multiple datafeeds in a single API request by\nusing a comma-separated list of datafeeds or a wildcard expression. You can\nget information for all datafeeds by using `_all`, by specifying `*` as the\n``, or by omitting the ``.\nThis API returns a maximum of 10,000 datafeeds.", "examples": { "MlGetDatafeedsExample1": { + "alternatives": [ + { + "code": "resp = client.ml.get_datafeeds(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.getDatafeeds({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.get_datafeeds(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->getDatafeeds([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales\"", + "language": "curl" + } + ], "method_request": "GET _ml/datafeeds/datafeed-high_sum_total_sales" } }, @@ -186501,6 +195038,28 @@ "description": "Get filters.\nYou can get a single filter or all filters.", "examples": { "MlGetFiltersExample1": { + "alternatives": [ + { + "code": "resp = client.ml.get_filters(\n filter_id=\"safe_domains\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.getFilters({\n filter_id: \"safe_domains\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.get_filters(\n filter_id: \"safe_domains\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->getFilters([\n \"filter_id\" => \"safe_domains\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/filters/safe_domains\"", + "language": "curl" + } + ], "method_request": "GET _ml/filters/safe_domains" } }, @@ -186621,6 +195180,28 @@ "description": "Get anomaly detection job results for influencers.\nInfluencers are the entities that have contributed to, or are to blame for,\nthe anomalies. Influencer results are available only if an\n`influencer_field_name` is specified in the job configuration.", "examples": { "MlGetInfluencersExample1": { + "alternatives": [ + { + "code": "resp = client.ml.get_influencers(\n job_id=\"high_sum_total_sales\",\n sort=\"influencer_score\",\n desc=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.getInfluencers({\n job_id: \"high_sum_total_sales\",\n sort: \"influencer_score\",\n desc: true,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.get_influencers(\n job_id: \"high_sum_total_sales\",\n body: {\n \"sort\": \"influencer_score\",\n \"desc\": true\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->getInfluencers([\n \"job_id\" => \"high_sum_total_sales\",\n \"body\" => [\n \"sort\" => \"influencer_score\",\n \"desc\" => true,\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"sort\":\"influencer_score\",\"desc\":true}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/high_sum_total_sales/results/influencers\"", + "language": "curl" + } + ], "description": "An example body for a `GET _ml/anomaly_detectors/high_sum_total_sales/results/influencers` request.", "method_request": "GET _ml/anomaly_detectors/high_sum_total_sales/results/influencers", "value": "{\n \"sort\": \"influencer_score\",\n \"desc\": true\n}" @@ -186807,6 +195388,28 @@ "description": "Get anomaly detection job stats.", "examples": { "MlGetJobStatsExample1": { + "alternatives": [ + { + "code": "resp = client.ml.get_job_stats(\n job_id=\"low_request_rate\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.getJobStats({\n job_id: \"low_request_rate\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.get_job_stats(\n job_id: \"low_request_rate\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->getJobStats([\n \"job_id\" => \"low_request_rate\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_stats\"", + "language": "curl" + } + ], "method_request": "GET _ml/anomaly_detectors/low_request_rate/_stats" } }, @@ -186900,6 +195503,28 @@ "description": "Get anomaly detection jobs configuration info.\nYou can get information for multiple anomaly detection jobs in a single API\nrequest by using a group name, a comma-separated list of jobs, or a wildcard\nexpression. You can get information for all anomaly detection jobs by using\n`_all`, by specifying `*` as the ``, or by omitting the ``.", "examples": { "MlGetJobsExample1": { + "alternatives": [ + { + "code": "resp = client.ml.get_jobs(\n job_id=\"high_sum_total_sales\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.getJobs({\n job_id: \"high_sum_total_sales\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.get_jobs(\n job_id: \"high_sum_total_sales\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->getJobs([\n \"job_id\" => \"high_sum_total_sales\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/high_sum_total_sales\"", + "language": "curl" + } + ], "method_request": "GET _ml/anomaly_detectors/high_sum_total_sales" } }, @@ -187394,6 +196019,28 @@ "description": "Get machine learning memory usage info.\nGet information about how machine learning jobs and trained models are using memory,\non each node, both within the JVM heap, and natively, outside of the JVM.", "examples": { "MlGetMemoryStatsExample1": { + "alternatives": [ + { + "code": "resp = client.ml.get_memory_stats(\n human=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.getMemoryStats({\n human: \"true\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.get_memory_stats(\n human: \"true\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->getMemoryStats([\n \"human\" => \"true\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/memory/_stats?human\"", + "language": "curl" + } + ], "method_request": "GET _ml/memory/_stats?human" } }, @@ -187519,6 +196166,28 @@ "description": "Get anomaly detection job model snapshot upgrade usage info.", "examples": { "MlGetModelSnapshotUpgradeStatsExample1": { + "alternatives": [ + { + "code": "resp = client.ml.get_model_snapshot_upgrade_stats(\n job_id=\"low_request_rate\",\n snapshot_id=\"_all\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.getModelSnapshotUpgradeStats({\n job_id: \"low_request_rate\",\n snapshot_id: \"_all\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.get_model_snapshot_upgrade_stats(\n job_id: \"low_request_rate\",\n snapshot_id: \"_all\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->getModelSnapshotUpgradeStats([\n \"job_id\" => \"low_request_rate\",\n \"snapshot_id\" => \"_all\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/model_snapshots/_all/_upgrade/_stats\"", + "language": "curl" + } + ], "method_request": "GET _ml/anomaly_detectors/low_request_rate/model_snapshots/_all/_upgrade/_stats" } }, @@ -187685,6 +196354,28 @@ "description": "Get model snapshots info.", "examples": { "MlGetModelSnapshotsExample1": { + "alternatives": [ + { + "code": "resp = client.ml.get_model_snapshots(\n job_id=\"high_sum_total_sales\",\n start=\"1575402236000\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.getModelSnapshots({\n job_id: \"high_sum_total_sales\",\n start: 1575402236000,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.get_model_snapshots(\n job_id: \"high_sum_total_sales\",\n body: {\n \"start\": \"1575402236000\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->getModelSnapshots([\n \"job_id\" => \"high_sum_total_sales\",\n \"body\" => [\n \"start\" => \"1575402236000\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"start\":\"1575402236000\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/high_sum_total_sales/model_snapshots\"", + "language": "curl" + } + ], "description": "An example body for a `GET _ml/anomaly_detectors/high_sum_total_sales/model_snapshots` request.", "method_request": "GET _ml/anomaly_detectors/high_sum_total_sales/model_snapshots", "value": "{\n \"start\": \"1575402236000\"\n}" @@ -187955,6 +196646,28 @@ "description": "Get overall bucket results.\n\nRetrievs overall bucket results that summarize the bucket results of\nmultiple anomaly detection jobs.\n\nThe `overall_score` is calculated by combining the scores of all the\nbuckets within the overall bucket span. First, the maximum\n`anomaly_score` per anomaly detection job in the overall bucket is\ncalculated. Then the `top_n` of those scores are averaged to result in\nthe `overall_score`. This means that you can fine-tune the\n`overall_score` so that it is more or less sensitive to the number of\njobs that detect an anomaly at the same time. For example, if you set\n`top_n` to `1`, the `overall_score` is the maximum bucket score in the\noverall bucket. Alternatively, if you set `top_n` to the number of jobs,\nthe `overall_score` is high only when all jobs detect anomalies in that\noverall bucket. If you set the `bucket_span` parameter (to a value\ngreater than its default), the `overall_score` is the maximum\n`overall_score` of the overall buckets that have a span equal to the\njobs' largest bucket span.", "examples": { "MlGetOverallBucketsExample1": { + "alternatives": [ + { + "code": "resp = client.ml.get_overall_buckets(\n job_id=\"job-*\",\n overall_score=80,\n start=\"1403532000000\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.getOverallBuckets({\n job_id: \"job-*\",\n overall_score: 80,\n start: 1403532000000,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.get_overall_buckets(\n job_id: \"job-*\",\n body: {\n \"overall_score\": 80,\n \"start\": \"1403532000000\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->getOverallBuckets([\n \"job_id\" => \"job-*\",\n \"body\" => [\n \"overall_score\" => 80,\n \"start\" => \"1403532000000\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"overall_score\":80,\"start\":\"1403532000000\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/job-*/results/overall_buckets\"", + "language": "curl" + } + ], "description": "An example body for a `GET _ml/anomaly_detectors/job-*/results/overall_buckets` request.", "method_request": "GET _ml/anomaly_detectors/job-*/results/overall_buckets", "value": "{\n \"overall_score\": 80,\n \"start\": \"1403532000000\"\n}" @@ -188228,6 +196941,28 @@ "description": "Get anomaly records for an anomaly detection job.\nRecords contain the detailed analytical results. They describe the anomalous\nactivity that has been identified in the input data based on the detector\nconfiguration.\nThere can be many anomaly records depending on the characteristics and size\nof the input data. In practice, there are often too many to be able to\nmanually process them. The machine learning features therefore perform a\nsophisticated aggregation of the anomaly records into buckets.\nThe number of record results depends on the number of anomalies found in each\nbucket, which relates to the number of time series being modeled and the\nnumber of detectors.", "examples": { "MlGetRecordsExample1": { + "alternatives": [ + { + "code": "resp = client.ml.get_records(\n job_id=\"low_request_rate\",\n sort=\"record_score\",\n desc=True,\n start=\"1454944100000\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.getRecords({\n job_id: \"low_request_rate\",\n sort: \"record_score\",\n desc: true,\n start: 1454944100000,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.get_records(\n job_id: \"low_request_rate\",\n body: {\n \"sort\": \"record_score\",\n \"desc\": true,\n \"start\": \"1454944100000\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->getRecords([\n \"job_id\" => \"low_request_rate\",\n \"body\" => [\n \"sort\" => \"record_score\",\n \"desc\" => true,\n \"start\" => \"1454944100000\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"sort\":\"record_score\",\"desc\":true,\"start\":\"1454944100000\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/results/records\"", + "language": "curl" + } + ], "description": "An example body for a `GET _ml/anomaly_detectors/low_request_rate/results/records` request.", "method_request": "GET _ml/anomaly_detectors/low_request_rate/results/records", "value": "{\n \"sort\": \"record_score\",\n \"desc\": true,\n \"start\": \"1454944100000\"\n}" @@ -188414,6 +197149,28 @@ "description": "Get trained model configuration info.", "examples": { "MlGetTrainedModelsExample1": { + "alternatives": [ + { + "code": "resp = client.ml.get_trained_models()", + "language": "Python" + }, + { + "code": "const response = await client.ml.getTrainedModels();", + "language": "JavaScript" + }, + { + "code": "response = client.ml.get_trained_models", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->getTrainedModels();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/\"", + "language": "curl" + } + ], "method_request": "GET _ml/trained_models/" } }, @@ -188599,6 +197356,28 @@ "description": "Get trained models usage info.\nYou can get usage information for multiple trained\nmodels in a single API request by using a comma-separated list of model IDs or a wildcard expression.", "examples": { "MlGetTrainedModelsStatsExample1": { + "alternatives": [ + { + "code": "resp = client.ml.get_trained_models_stats()", + "language": "Python" + }, + { + "code": "const response = await client.ml.getTrainedModelsStats();", + "language": "JavaScript" + }, + { + "code": "response = client.ml.get_trained_models_stats", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->getTrainedModelsStats();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/_stats\"", + "language": "curl" + } + ], "method_request": "GET _ml/trained_models/_stats" } }, @@ -188756,6 +197535,28 @@ "description": "Evaluate a trained model.", "examples": { "MlInferTrainedModelExample1": { + "alternatives": [ + { + "code": "resp = client.ml.infer_trained_model(\n model_id=\"lang_ident_model_1\",\n docs=[\n {\n \"text\": \"The fool doth think he is wise, but the wise man knows himself to be a fool.\"\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.inferTrainedModel({\n model_id: \"lang_ident_model_1\",\n docs: [\n {\n text: \"The fool doth think he is wise, but the wise man knows himself to be a fool.\",\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.infer_trained_model(\n model_id: \"lang_ident_model_1\",\n body: {\n \"docs\": [\n {\n \"text\": \"The fool doth think he is wise, but the wise man knows himself to be a fool.\"\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->inferTrainedModel([\n \"model_id\" => \"lang_ident_model_1\",\n \"body\" => [\n \"docs\" => array(\n [\n \"text\" => \"The fool doth think he is wise, but the wise man knows himself to be a fool.\",\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"text\":\"The fool doth think he is wise, but the wise man knows himself to be a fool.\"}]}' \"$ELASTICSEARCH_URL/_ml/trained_models/lang_ident_model_1/_infer\"", + "language": "curl" + } + ], "description": "An example body for a `POST _ml/trained_models/lang_ident_model_1/_infer` request.", "method_request": "POST _ml/trained_models/lang_ident_model_1/_infer", "value": "{\n \"docs\":[{\"text\": \"The fool doth think he is wise, but the wise man knows himself to be a fool.\"}]\n}" @@ -189055,6 +197856,28 @@ "description": "Get machine learning information.\nGet defaults and limits used by machine learning.\nThis endpoint is designed to be used by a user interface that needs to fully\nunderstand machine learning configurations where some options are not\nspecified, meaning that the defaults should be used. This endpoint may be\nused to find out what those defaults are. It also provides information about\nthe maximum size of machine learning jobs that could run in the current\ncluster configuration.", "examples": { "MlInfoExample1": { + "alternatives": [ + { + "code": "resp = client.ml.info()", + "language": "Python" + }, + { + "code": "const response = await client.ml.info();", + "language": "JavaScript" + }, + { + "code": "response = client.ml.info", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->info();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/info\"", + "language": "curl" + } + ], "method_request": "GET _ml/info" } }, @@ -189155,7 +197978,30 @@ "description": "Open anomaly detection jobs.\n\nAn anomaly detection job must be opened to be ready to receive and analyze\ndata. It can be opened and closed multiple times throughout its lifecycle.\nWhen you open a new job, it starts with an empty model.\nWhen you open an existing job, the most recent model state is automatically\nloaded. The job is ready to resume its analysis from where it left off, once\nnew data is received.", "examples": { "MlOpenJobRequestExample1": { + "alternatives": [ + { + "code": "resp = client.ml.open_job(\n job_id=\"job-01\",\n timeout=\"35m\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.openJob({\n job_id: \"job-01\",\n timeout: \"35m\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.open_job(\n job_id: \"job-01\",\n body: {\n \"timeout\": \"35m\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->openJob([\n \"job_id\" => \"job-01\",\n \"body\" => [\n \"timeout\" => \"35m\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"timeout\":\"35m\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/job-01/_open\"", + "language": "curl" + } + ], "description": "A request to open anomaly detection jobs. The timeout specifies to wait 35 minutes for the job to open.\n", + "method_request": "POST /_ml/anomaly_detectors/job-01/_open", "value": "{\n \"timeout\": \"35m\"\n}" } }, @@ -189270,6 +198116,28 @@ "description": "Add scheduled events to the calendar.", "examples": { "MlPostCalendarEventsExample1": { + "alternatives": [ + { + "code": "resp = client.ml.post_calendar_events(\n calendar_id=\"planned-outages\",\n events=[\n {\n \"description\": \"event 1\",\n \"start_time\": 1513641600000,\n \"end_time\": 1513728000000\n },\n {\n \"description\": \"event 2\",\n \"start_time\": 1513814400000,\n \"end_time\": 1513900800000\n },\n {\n \"description\": \"event 3\",\n \"start_time\": 1514160000000,\n \"end_time\": 1514246400000\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.postCalendarEvents({\n calendar_id: \"planned-outages\",\n events: [\n {\n description: \"event 1\",\n start_time: 1513641600000,\n end_time: 1513728000000,\n },\n {\n description: \"event 2\",\n start_time: 1513814400000,\n end_time: 1513900800000,\n },\n {\n description: \"event 3\",\n start_time: 1514160000000,\n end_time: 1514246400000,\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.post_calendar_events(\n calendar_id: \"planned-outages\",\n body: {\n \"events\": [\n {\n \"description\": \"event 1\",\n \"start_time\": 1513641600000,\n \"end_time\": 1513728000000\n },\n {\n \"description\": \"event 2\",\n \"start_time\": 1513814400000,\n \"end_time\": 1513900800000\n },\n {\n \"description\": \"event 3\",\n \"start_time\": 1514160000000,\n \"end_time\": 1514246400000\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->postCalendarEvents([\n \"calendar_id\" => \"planned-outages\",\n \"body\" => [\n \"events\" => array(\n [\n \"description\" => \"event 1\",\n \"start_time\" => 1513641600000,\n \"end_time\" => 1513728000000,\n ],\n [\n \"description\" => \"event 2\",\n \"start_time\" => 1513814400000,\n \"end_time\" => 1513900800000,\n ],\n [\n \"description\" => \"event 3\",\n \"start_time\" => 1514160000000,\n \"end_time\" => 1514246400000,\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"events\":[{\"description\":\"event 1\",\"start_time\":1513641600000,\"end_time\":1513728000000},{\"description\":\"event 2\",\"start_time\":1513814400000,\"end_time\":1513900800000},{\"description\":\"event 3\",\"start_time\":1514160000000,\"end_time\":1514246400000}]}' \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages/events\"", + "language": "curl" + } + ], "description": "An example body for a `POST _ml/calendars/planned-outages/events` request.", "method_request": "POST _ml/calendars/planned-outages/events", "value": "{\n \"events\" : [\n {\"description\": \"event 1\", \"start_time\": 1513641600000, \"end_time\": 1513728000000},\n {\"description\": \"event 2\", \"start_time\": 1513814400000, \"end_time\": 1513900800000},\n {\"description\": \"event 3\", \"start_time\": 1514160000000, \"end_time\": 1514246400000}\n ]\n}" @@ -189768,6 +198636,28 @@ "description": "Preview features used by data frame analytics.\nPreview the extracted features used by a data frame analytics config.", "examples": { "MlPreviewDataFrameAnalyticsExample1": { + "alternatives": [ + { + "code": "resp = client.ml.preview_data_frame_analytics(\n config={\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.previewDataFrameAnalytics({\n config: {\n source: {\n index: \"houses_sold_last_10_yrs\",\n },\n analysis: {\n regression: {\n dependent_variable: \"price\",\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.preview_data_frame_analytics(\n body: {\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->previewDataFrameAnalytics([\n \"body\" => [\n \"config\" => [\n \"source\" => [\n \"index\" => \"houses_sold_last_10_yrs\",\n ],\n \"analysis\" => [\n \"regression\" => [\n \"dependent_variable\" => \"price\",\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"config\":{\"source\":{\"index\":\"houses_sold_last_10_yrs\"},\"analysis\":{\"regression\":{\"dependent_variable\":\"price\"}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/_preview\"", + "language": "curl" + } + ], "description": "An example body for a `POST _ml/data_frame/analytics/_preview` request.", "method_request": "POST _ml/data_frame/analytics/_preview", "value": "{\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n}" @@ -189876,6 +198766,28 @@ "description": "Preview a datafeed.\nThis API returns the first \"page\" of search results from a datafeed.\nYou can preview an existing datafeed or provide configuration details for a datafeed\nand anomaly detection job in the API. The preview shows the structure of the data\nthat will be passed to the anomaly detection engine.\nIMPORTANT: When Elasticsearch security features are enabled, the preview uses the credentials of the user that\ncalled the API. However, when the datafeed starts it uses the roles of the last user that created or updated the\ndatafeed. To get a preview that accurately reflects the behavior of the datafeed, use the appropriate credentials.\nYou can also use secondary authorization headers to supply the credentials.", "examples": { "MlPreviewDatafeedExample1": { + "alternatives": [ + { + "code": "resp = client.ml.preview_datafeed(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.previewDatafeed({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.preview_datafeed(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->previewDatafeed([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales/_preview\"", + "language": "curl" + } + ], "method_request": "GET _ml/datafeeds/datafeed-high_sum_total_sales/_preview" } }, @@ -189999,6 +198911,28 @@ "description": "Create a calendar.", "examples": { "MlPutCalendarExample1": { + "alternatives": [ + { + "code": "resp = client.ml.put_calendar(\n calendar_id=\"planned-outages\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.putCalendar({\n calendar_id: \"planned-outages\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.put_calendar(\n calendar_id: \"planned-outages\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->putCalendar([\n \"calendar_id\" => \"planned-outages\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages\"", + "language": "curl" + } + ], "method_request": "PUT _ml/calendars/planned-outages" } }, @@ -190089,6 +199023,28 @@ "description": "Add anomaly detection job to calendar.", "examples": { "MlPutCalendarJobExample1": { + "alternatives": [ + { + "code": "resp = client.ml.put_calendar_job(\n calendar_id=\"planned-outages\",\n job_id=\"total-requests\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.putCalendarJob({\n calendar_id: \"planned-outages\",\n job_id: \"total-requests\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.put_calendar_job(\n calendar_id: \"planned-outages\",\n job_id: \"total-requests\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->putCalendarJob([\n \"calendar_id\" => \"planned-outages\",\n \"job_id\" => \"total-requests\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages/jobs/total-requests\"", + "language": "curl" + } + ], "method_request": "PUT _ml/calendars/planned-outages/jobs/total-requests" } }, @@ -190339,6 +199295,28 @@ "description": "Create a data frame analytics job.\nThis API creates a data frame analytics job that performs an analysis on the\nsource indices and stores the outcome in a destination index.\nBy default, the query used in the source configuration is `{\"match_all\": {}}`.\n\nIf the destination index does not exist, it is created automatically when you start the job.\n\nIf you supply only a subset of the regression or classification parameters, hyperparameter optimization occurs. It determines a value for each of the undefined parameters.", "examples": { "MlPutDataFrameAnalyticsExample1": { + "alternatives": [ + { + "code": "resp = client.ml.put_data_frame_analytics(\n id=\"model-flight-delays-pre\",\n source={\n \"index\": [\n \"kibana_sample_data_flights\"\n ],\n \"query\": {\n \"range\": {\n \"DistanceKilometers\": {\n \"gt\": 0\n }\n }\n },\n \"_source\": {\n \"includes\": [],\n \"excludes\": [\n \"FlightDelay\",\n \"FlightDelayType\"\n ]\n }\n },\n dest={\n \"index\": \"df-flight-delays\",\n \"results_field\": \"ml-results\"\n },\n analysis={\n \"regression\": {\n \"dependent_variable\": \"FlightDelayMin\",\n \"training_percent\": 90\n }\n },\n analyzed_fields={\n \"includes\": [],\n \"excludes\": [\n \"FlightNum\"\n ]\n },\n model_memory_limit=\"100mb\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.putDataFrameAnalytics({\n id: \"model-flight-delays-pre\",\n source: {\n index: [\"kibana_sample_data_flights\"],\n query: {\n range: {\n DistanceKilometers: {\n gt: 0,\n },\n },\n },\n _source: {\n includes: [],\n excludes: [\"FlightDelay\", \"FlightDelayType\"],\n },\n },\n dest: {\n index: \"df-flight-delays\",\n results_field: \"ml-results\",\n },\n analysis: {\n regression: {\n dependent_variable: \"FlightDelayMin\",\n training_percent: 90,\n },\n },\n analyzed_fields: {\n includes: [],\n excludes: [\"FlightNum\"],\n },\n model_memory_limit: \"100mb\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.put_data_frame_analytics(\n id: \"model-flight-delays-pre\",\n body: {\n \"source\": {\n \"index\": [\n \"kibana_sample_data_flights\"\n ],\n \"query\": {\n \"range\": {\n \"DistanceKilometers\": {\n \"gt\": 0\n }\n }\n },\n \"_source\": {\n \"includes\": [],\n \"excludes\": [\n \"FlightDelay\",\n \"FlightDelayType\"\n ]\n }\n },\n \"dest\": {\n \"index\": \"df-flight-delays\",\n \"results_field\": \"ml-results\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"FlightDelayMin\",\n \"training_percent\": 90\n }\n },\n \"analyzed_fields\": {\n \"includes\": [],\n \"excludes\": [\n \"FlightNum\"\n ]\n },\n \"model_memory_limit\": \"100mb\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->putDataFrameAnalytics([\n \"id\" => \"model-flight-delays-pre\",\n \"body\" => [\n \"source\" => [\n \"index\" => array(\n \"kibana_sample_data_flights\",\n ),\n \"query\" => [\n \"range\" => [\n \"DistanceKilometers\" => [\n \"gt\" => 0,\n ],\n ],\n ],\n \"_source\" => [\n \"includes\" => array(\n ),\n \"excludes\" => array(\n \"FlightDelay\",\n \"FlightDelayType\",\n ),\n ],\n ],\n \"dest\" => [\n \"index\" => \"df-flight-delays\",\n \"results_field\" => \"ml-results\",\n ],\n \"analysis\" => [\n \"regression\" => [\n \"dependent_variable\" => \"FlightDelayMin\",\n \"training_percent\" => 90,\n ],\n ],\n \"analyzed_fields\" => [\n \"includes\" => array(\n ),\n \"excludes\" => array(\n \"FlightNum\",\n ),\n ],\n \"model_memory_limit\" => \"100mb\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":[\"kibana_sample_data_flights\"],\"query\":{\"range\":{\"DistanceKilometers\":{\"gt\":0}}},\"_source\":{\"includes\":[],\"excludes\":[\"FlightDelay\",\"FlightDelayType\"]}},\"dest\":{\"index\":\"df-flight-delays\",\"results_field\":\"ml-results\"},\"analysis\":{\"regression\":{\"dependent_variable\":\"FlightDelayMin\",\"training_percent\":90}},\"analyzed_fields\":{\"includes\":[],\"excludes\":[\"FlightNum\"]},\"model_memory_limit\":\"100mb\"}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/model-flight-delays-pre\"", + "language": "curl" + } + ], "description": "An example body for a `PUT _ml/data_frame/analytics/model-flight-delays-pre` request.", "method_request": "PUT _ml/data_frame/analytics/model-flight-delays-pre", "value": "{\n \"source\": {\n \"index\": [\n \"kibana_sample_data_flights\"\n ],\n \"query\": {\n \"range\": {\n \"DistanceKilometers\": {\n \"gt\": 0\n }\n }\n },\n \"_source\": {\n \"includes\": [],\n \"excludes\": [\n \"FlightDelay\",\n \"FlightDelayType\"\n ]\n }\n },\n \"dest\": {\n \"index\": \"df-flight-delays\",\n \"results_field\": \"ml-results\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"FlightDelayMin\",\n \"training_percent\": 90\n }\n },\n \"analyzed_fields\": {\n \"includes\": [],\n \"excludes\": [\n \"FlightNum\"\n ]\n },\n \"model_memory_limit\": \"100mb\"\n}" @@ -190749,9 +199727,31 @@ } ] }, - "description": "Create a datafeed.\nDatafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job.\nYou can associate only one datafeed with each anomaly detection job.\nThe datafeed contains a query that runs at a defined interval (`frequency`).\nIf you are concerned about delayed data, you can add a delay (`query_delay') at each interval.\nBy default, the datafeed uses the following query: `{\"match_all\": {\"boost\": 1}}`.\n\nWhen Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had\nat the time of creation and runs the query using those same roles. If you provide secondary authorization headers,\nthose credentials are used instead.\nYou must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed\ndirectly to the `.ml-config` index. Do not give users `write` privileges on the `.ml-config` index.", + "description": "Create a datafeed.\nDatafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job.\nYou can associate only one datafeed with each anomaly detection job.\nThe datafeed contains a query that runs at a defined interval (`frequency`).\nIf you are concerned about delayed data, you can add a delay (`query_delay`) at each interval.\nBy default, the datafeed uses the following query: `{\"match_all\": {\"boost\": 1}}`.\n\nWhen Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had\nat the time of creation and runs the query using those same roles. If you provide secondary authorization headers,\nthose credentials are used instead.\nYou must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed\ndirectly to the `.ml-config` index. Do not give users `write` privileges on the `.ml-config` index.", "examples": { "MlPutDatafeedExample1": { + "alternatives": [ + { + "code": "resp = client.ml.put_datafeed(\n datafeed_id=\"datafeed-test-job\",\n pretty=True,\n indices=[\n \"kibana_sample_data_logs\"\n ],\n query={\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ]\n }\n },\n job_id=\"test-job\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.putDatafeed({\n datafeed_id: \"datafeed-test-job\",\n pretty: \"true\",\n indices: [\"kibana_sample_data_logs\"],\n query: {\n bool: {\n must: [\n {\n match_all: {},\n },\n ],\n },\n },\n job_id: \"test-job\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.put_datafeed(\n datafeed_id: \"datafeed-test-job\",\n pretty: \"true\",\n body: {\n \"indices\": [\n \"kibana_sample_data_logs\"\n ],\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ]\n }\n },\n \"job_id\": \"test-job\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->putDatafeed([\n \"datafeed_id\" => \"datafeed-test-job\",\n \"pretty\" => \"true\",\n \"body\" => [\n \"indices\" => array(\n \"kibana_sample_data_logs\",\n ),\n \"query\" => [\n \"bool\" => [\n \"must\" => array(\n [\n \"match_all\" => new ArrayObject([]),\n ],\n ),\n ],\n ],\n \"job_id\" => \"test-job\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"indices\":[\"kibana_sample_data_logs\"],\"query\":{\"bool\":{\"must\":[{\"match_all\":{}}]}},\"job_id\":\"test-job\"}' \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-test-job?pretty\"", + "language": "curl" + } + ], "description": "An example body for a `PUT _ml/datafeeds/datafeed-test-job?pretty` request.", "method_request": "PUT _ml/datafeeds/datafeed-test-job?pretty", "value": "{\n \"indices\": [\n \"kibana_sample_data_logs\"\n ],\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ]\n }\n },\n \"job_id\": \"test-job\"\n}" @@ -191084,6 +200084,28 @@ "description": "Create a filter.\nA filter contains a list of strings. It can be used by one or more anomaly detection jobs.\nSpecifically, filters are referenced in the `custom_rules` property of detector configuration objects.", "examples": { "MlPutFilterExample1": { + "alternatives": [ + { + "code": "resp = client.ml.put_filter(\n filter_id=\"safe_domains\",\n description=\"A list of safe domains\",\n items=[\n \"*.google.com\",\n \"wikipedia.org\"\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.putFilter({\n filter_id: \"safe_domains\",\n description: \"A list of safe domains\",\n items: [\"*.google.com\", \"wikipedia.org\"],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.put_filter(\n filter_id: \"safe_domains\",\n body: {\n \"description\": \"A list of safe domains\",\n \"items\": [\n \"*.google.com\",\n \"wikipedia.org\"\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->putFilter([\n \"filter_id\" => \"safe_domains\",\n \"body\" => [\n \"description\" => \"A list of safe domains\",\n \"items\" => array(\n \"*.google.com\",\n \"wikipedia.org\",\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"A list of safe domains\",\"items\":[\"*.google.com\",\"wikipedia.org\"]}' \"$ELASTICSEARCH_URL/_ml/filters/safe_domains\"", + "language": "curl" + } + ], "description": "An example body for a `PUT _ml/filters/safe_domains` request.", "method_request": "PUT _ml/filters/safe_domains", "value": "{\n \"description\": \"A list of safe domains\",\n \"items\": [\"*.google.com\", \"wikipedia.org\"]\n}" @@ -191377,7 +200399,30 @@ "description": "Create an anomaly detection job.\n\nIf you include a `datafeed_config`, you must have read index privileges on the source index.\nIf you include a `datafeed_config` but do not provide a query, the datafeed uses `{\"match_all\": {\"boost\": 1}}`.", "examples": { "MlPutJobRequestExample1": { + "alternatives": [ + { + "code": "resp = client.ml.put_job(\n job_id=\"job-01\",\n analysis_config={\n \"bucket_span\": \"15m\",\n \"detectors\": [\n {\n \"detector_description\": \"Sum of bytes\",\n \"function\": \"sum\",\n \"field_name\": \"bytes\"\n }\n ]\n },\n data_description={\n \"time_field\": \"timestamp\",\n \"time_format\": \"epoch_ms\"\n },\n analysis_limits={\n \"model_memory_limit\": \"11MB\"\n },\n model_plot_config={\n \"enabled\": True,\n \"annotations_enabled\": True\n },\n results_index_name=\"test-job1\",\n datafeed_config={\n \"indices\": [\n \"kibana_sample_data_logs\"\n ],\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ]\n }\n },\n \"runtime_mappings\": {\n \"hour_of_day\": {\n \"type\": \"long\",\n \"script\": {\n \"source\": \"emit(doc['timestamp'].value.getHour());\"\n }\n }\n },\n \"datafeed_id\": \"datafeed-test-job1\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.putJob({\n job_id: \"job-01\",\n analysis_config: {\n bucket_span: \"15m\",\n detectors: [\n {\n detector_description: \"Sum of bytes\",\n function: \"sum\",\n field_name: \"bytes\",\n },\n ],\n },\n data_description: {\n time_field: \"timestamp\",\n time_format: \"epoch_ms\",\n },\n analysis_limits: {\n model_memory_limit: \"11MB\",\n },\n model_plot_config: {\n enabled: true,\n annotations_enabled: true,\n },\n results_index_name: \"test-job1\",\n datafeed_config: {\n indices: [\"kibana_sample_data_logs\"],\n query: {\n bool: {\n must: [\n {\n match_all: {},\n },\n ],\n },\n },\n runtime_mappings: {\n hour_of_day: {\n type: \"long\",\n script: {\n source: \"emit(doc['timestamp'].value.getHour());\",\n },\n },\n },\n datafeed_id: \"datafeed-test-job1\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.put_job(\n job_id: \"job-01\",\n body: {\n \"analysis_config\": {\n \"bucket_span\": \"15m\",\n \"detectors\": [\n {\n \"detector_description\": \"Sum of bytes\",\n \"function\": \"sum\",\n \"field_name\": \"bytes\"\n }\n ]\n },\n \"data_description\": {\n \"time_field\": \"timestamp\",\n \"time_format\": \"epoch_ms\"\n },\n \"analysis_limits\": {\n \"model_memory_limit\": \"11MB\"\n },\n \"model_plot_config\": {\n \"enabled\": true,\n \"annotations_enabled\": true\n },\n \"results_index_name\": \"test-job1\",\n \"datafeed_config\": {\n \"indices\": [\n \"kibana_sample_data_logs\"\n ],\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ]\n }\n },\n \"runtime_mappings\": {\n \"hour_of_day\": {\n \"type\": \"long\",\n \"script\": {\n \"source\": \"emit(doc['timestamp'].value.getHour());\"\n }\n }\n },\n \"datafeed_id\": \"datafeed-test-job1\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->putJob([\n \"job_id\" => \"job-01\",\n \"body\" => [\n \"analysis_config\" => [\n \"bucket_span\" => \"15m\",\n \"detectors\" => array(\n [\n \"detector_description\" => \"Sum of bytes\",\n \"function\" => \"sum\",\n \"field_name\" => \"bytes\",\n ],\n ),\n ],\n \"data_description\" => [\n \"time_field\" => \"timestamp\",\n \"time_format\" => \"epoch_ms\",\n ],\n \"analysis_limits\" => [\n \"model_memory_limit\" => \"11MB\",\n ],\n \"model_plot_config\" => [\n \"enabled\" => true,\n \"annotations_enabled\" => true,\n ],\n \"results_index_name\" => \"test-job1\",\n \"datafeed_config\" => [\n \"indices\" => array(\n \"kibana_sample_data_logs\",\n ),\n \"query\" => [\n \"bool\" => [\n \"must\" => array(\n [\n \"match_all\" => new ArrayObject([]),\n ],\n ),\n ],\n ],\n \"runtime_mappings\" => [\n \"hour_of_day\" => [\n \"type\" => \"long\",\n \"script\" => [\n \"source\" => \"emit(doc['timestamp'].value.getHour());\",\n ],\n ],\n ],\n \"datafeed_id\" => \"datafeed-test-job1\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"analysis_config\":{\"bucket_span\":\"15m\",\"detectors\":[{\"detector_description\":\"Sum of bytes\",\"function\":\"sum\",\"field_name\":\"bytes\"}]},\"data_description\":{\"time_field\":\"timestamp\",\"time_format\":\"epoch_ms\"},\"analysis_limits\":{\"model_memory_limit\":\"11MB\"},\"model_plot_config\":{\"enabled\":true,\"annotations_enabled\":true},\"results_index_name\":\"test-job1\",\"datafeed_config\":{\"indices\":[\"kibana_sample_data_logs\"],\"query\":{\"bool\":{\"must\":[{\"match_all\":{}}]}},\"runtime_mappings\":{\"hour_of_day\":{\"type\":\"long\",\"script\":{\"source\":\"emit(doc['\"'\"'timestamp'\"'\"'].value.getHour());\"}}},\"datafeed_id\":\"datafeed-test-job1\"}}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/job-01\"", + "language": "curl" + } + ], "description": "A request to create an anomaly detection job and datafeed.", + "method_request": "PUT /_ml/anomaly_detectors/job-01", "value": "{\n \"analysis_config\": {\n \"bucket_span\": \"15m\",\n \"detectors\": [\n {\n \"detector_description\": \"Sum of bytes\",\n \"function\": \"sum\",\n \"field_name\": \"bytes\"\n }\n ]\n },\n \"data_description\": {\n \"time_field\": \"timestamp\",\n \"time_format\": \"epoch_ms\"\n },\n \"analysis_limits\": {\n \"model_memory_limit\": \"11MB\"\n },\n \"model_plot_config\": {\n \"enabled\": true,\n \"annotations_enabled\": true\n },\n \"results_index_name\": \"test-job1\",\n \"datafeed_config\": {\n \"indices\": [\n \"kibana_sample_data_logs\"\n ],\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"match_all\": {}\n }\n ]\n }\n },\n \"runtime_mappings\": {\n \"hour_of_day\": {\n \"type\": \"long\",\n \"script\": {\n \"source\": \"emit(doc['timestamp'].value.getHour());\"\n }\n }\n },\n \"datafeed_id\": \"datafeed-test-job1\"\n }\n}" } }, @@ -192583,6 +201628,28 @@ "description": "Create or update a trained model alias.\nA trained model alias is a logical name used to reference a single trained\nmodel.\nYou can use aliases instead of trained model identifiers to make it easier to\nreference your models. For example, you can use aliases in inference\naggregations and processors.\nAn alias must be unique and refer to only a single trained model. However,\nyou can have multiple aliases for each trained model.\nIf you use this API to update an alias such that it references a different\ntrained model ID and the model uses a different type of data frame analytics,\nan error occurs. For example, this situation occurs if you have a trained\nmodel for regression analysis and a trained model for classification\nanalysis; you cannot reassign an alias from one type of trained model to\nanother.\nIf you use this API to update an alias and there are very few input fields in\ncommon between the old and new trained models for the model alias, the API\nreturns a warning.", "examples": { "MlPutTrainedModelAliasExample1": { + "alternatives": [ + { + "code": "resp = client.ml.put_trained_model_alias(\n model_id=\"flight-delay-prediction-1574775339910\",\n model_alias=\"flight_delay_model\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.putTrainedModelAlias({\n model_id: \"flight-delay-prediction-1574775339910\",\n model_alias: \"flight_delay_model\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.put_trained_model_alias(\n model_id: \"flight-delay-prediction-1574775339910\",\n model_alias: \"flight_delay_model\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->putTrainedModelAlias([\n \"model_id\" => \"flight-delay-prediction-1574775339910\",\n \"model_alias\" => \"flight_delay_model\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/flight-delay-prediction-1574775339910/model_aliases/flight_delay_model\"", + "language": "curl" + } + ], "method_request": "PUT _ml/trained_models/flight-delay-prediction-1574775339910/model_aliases/flight_delay_model" } }, @@ -192707,6 +201774,28 @@ "description": "Create part of a trained model definition.", "examples": { "MlPutTrainedModelDefinitionPartExample1": { + "alternatives": [ + { + "code": "resp = client.ml.put_trained_model_definition_part(\n model_id=\"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n part=\"0\",\n definition=\"...\",\n total_definition_length=265632637,\n total_parts=64,\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.putTrainedModelDefinitionPart({\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n part: 0,\n definition: \"...\",\n total_definition_length: 265632637,\n total_parts: 64,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.put_trained_model_definition_part(\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n part: \"0\",\n body: {\n \"definition\": \"...\",\n \"total_definition_length\": 265632637,\n \"total_parts\": 64\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->putTrainedModelDefinitionPart([\n \"model_id\" => \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n \"part\" => \"0\",\n \"body\" => [\n \"definition\" => \"...\",\n \"total_definition_length\" => 265632637,\n \"total_parts\" => 64,\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"definition\":\"...\",\"total_definition_length\":265632637,\"total_parts\":64}' \"$ELASTICSEARCH_URL/_ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/definition/0\"", + "language": "curl" + } + ], "description": "An example body for a `PUT _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/definition/0` request.", "method_request": "PUT _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/definition/0", "value": "{\n \"definition\": \"...\",\n \"total_definition_length\": 265632637,\n \"total_parts\": 64\n}" @@ -192840,9 +201929,31 @@ "description": "Create a trained model vocabulary.\nThis API is supported only for natural language processing (NLP) models.\nThe vocabulary is stored in the index as described in `inference_config.*.vocabulary` of the trained model definition.", "examples": { "MlPutTrainedModelVocabularyExample1": { + "alternatives": [ + { + "code": "resp = client.ml.put_trained_model_vocabulary(\n model_id=\"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n vocabulary=[\n \"[PAD]\",\n \"[unused0]\"\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.putTrainedModelVocabulary({\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n vocabulary: [\"[PAD]\", \"[unused0]\"],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.put_trained_model_vocabulary(\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n body: {\n \"vocabulary\": [\n \"[PAD]\",\n \"[unused0]\"\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->putTrainedModelVocabulary([\n \"model_id\" => \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n \"body\" => [\n \"vocabulary\" => array(\n \"[PAD]\",\n \"[unused0]\",\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"vocabulary\":[\"[PAD]\",\"[unused0]\"]}' \"$ELASTICSEARCH_URL/_ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/vocabulary\"", + "language": "curl" + } + ], "description": "An example body for a `PUT _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/vocabulary` request.", "method_request": "PUT _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/vocabulary", - "value": "{\n \"vocabulary\": [\n \"[PAD]\",\n \"[unused0]\",\n ...\n ]\n}" + "value": "{\n \"vocabulary\": [\n \"[PAD]\",\n \"[unused0]\",\n ]\n}" } }, "inherits": { @@ -192902,6 +202013,28 @@ "description": "Reset an anomaly detection job.\nAll model state and results are deleted. The job is ready to start over as if\nit had just been created.\nIt is not currently possible to reset multiple jobs using wildcards or a\ncomma separated list.", "examples": { "MlResetJobExample1": { + "alternatives": [ + { + "code": "resp = client.ml.reset_job(\n job_id=\"total-requests\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.resetJob({\n job_id: \"total-requests\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.reset_job(\n job_id: \"total-requests\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->resetJob([\n \"job_id\" => \"total-requests\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/total-requests/_reset\"", + "language": "curl" + } + ], "method_request": "POST _ml/anomaly_detectors/total-requests/_reset" } }, @@ -193004,6 +202137,28 @@ "description": "Revert to a snapshot.\nThe machine learning features react quickly to anomalous input, learning new\nbehaviors in data. Highly anomalous input increases the variance in the\nmodels whilst the system learns whether this is a new step-change in behavior\nor a one-off event. In the case where this anomalous input is known to be a\none-off, then it might be appropriate to reset the model state to a time\nbefore this event. For example, you might consider reverting to a saved\nsnapshot after Black Friday or a critical system failure.", "examples": { "MlRevertModelSnapshotExample1": { + "alternatives": [ + { + "code": "resp = client.ml.revert_model_snapshot(\n job_id=\"low_request_rate\",\n snapshot_id=\"1637092688\",\n delete_intervening_results=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.revertModelSnapshot({\n job_id: \"low_request_rate\",\n snapshot_id: 1637092688,\n delete_intervening_results: true,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.revert_model_snapshot(\n job_id: \"low_request_rate\",\n snapshot_id: \"1637092688\",\n body: {\n \"delete_intervening_results\": true\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->revertModelSnapshot([\n \"job_id\" => \"low_request_rate\",\n \"snapshot_id\" => \"1637092688\",\n \"body\" => [\n \"delete_intervening_results\" => true,\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"delete_intervening_results\":true}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/model_snapshots/1637092688/_revert\"", + "language": "curl" + } + ], "description": "An example body for a `POST _ml/anomaly_detectors/low_request_rate/model_snapshots/1637092688/_revert` request.", "method_request": "POST _ml/anomaly_detectors/low_request_rate/model_snapshots/1637092688/_revert", "value": "{\n \"delete_intervening_results\": true\n}" @@ -193097,6 +202252,28 @@ "description": "Set upgrade_mode for ML indices.\nSets a cluster wide upgrade_mode setting that prepares machine learning\nindices for an upgrade.\nWhen upgrading your cluster, in some circumstances you must restart your\nnodes and reindex your machine learning indices. In those circumstances,\nthere must be no machine learning jobs running. You can close the machine\nlearning jobs, do the upgrade, then open all the jobs again. Alternatively,\nyou can use this API to temporarily halt tasks associated with the jobs and\ndatafeeds and prevent new jobs from opening. You can also use this API\nduring upgrades that do not require you to reindex your machine learning\nindices, though stopping jobs is not a requirement in that case.\nYou can see the current value for the upgrade_mode setting by using the get\nmachine learning info API.", "examples": { "MlSetUpgradeModeExample1": { + "alternatives": [ + { + "code": "resp = client.ml.set_upgrade_mode(\n enabled=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.setUpgradeMode({\n enabled: \"true\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.set_upgrade_mode(\n enabled: \"true\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->setUpgradeMode([\n \"enabled\" => \"true\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/set_upgrade_mode?enabled=true\"", + "language": "curl" + } + ], "method_request": "POST _ml/set_upgrade_mode?enabled=true" } }, @@ -193171,6 +202348,28 @@ "description": "Start a data frame analytics job.\nA data frame analytics job can be started and stopped multiple times\nthroughout its lifecycle.\nIf the destination index does not exist, it is created automatically the\nfirst time you start the data frame analytics job. The\n`index.number_of_shards` and `index.number_of_replicas` settings for the\ndestination index are copied from the source index. If there are multiple\nsource indices, the destination index copies the highest setting values. The\nmappings for the destination index are also copied from the source indices.\nIf there are any mapping conflicts, the job fails to start.\nIf the destination index exists, it is used as is. You can therefore set up\nthe destination index in advance with custom settings and mappings.", "examples": { "MlStartDataFrameAnalyticsExample1": { + "alternatives": [ + { + "code": "resp = client.ml.start_data_frame_analytics(\n id=\"loganalytics\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.startDataFrameAnalytics({\n id: \"loganalytics\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.start_data_frame_analytics(\n id: \"loganalytics\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->startDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics/_start\"", + "language": "curl" + } + ], "method_request": "POST _ml/data_frame/analytics/loganalytics/_start" } }, @@ -193301,6 +202500,28 @@ "description": "Start datafeeds.\n\nA datafeed must be started in order to retrieve data from Elasticsearch. A datafeed can be started and stopped\nmultiple times throughout its lifecycle.\n\nBefore you can start a datafeed, the anomaly detection job must be open. Otherwise, an error occurs.\n\nIf you restart a stopped datafeed, it continues processing input data from the next millisecond after it was stopped.\nIf new data was indexed for that exact millisecond between stopping and starting, it will be ignored.\n\nWhen Elasticsearch security features are enabled, your datafeed remembers which roles the last user to create or\nupdate it had at the time of creation or update and runs the query using those same roles. If you provided secondary\nauthorization headers when you created or updated the datafeed, those credentials are used instead.", "examples": { "MlStartDatafeedExample1": { + "alternatives": [ + { + "code": "resp = client.ml.start_datafeed(\n datafeed_id=\"datafeed-low_request_rate\",\n start=\"2019-04-07T18:22:16Z\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.startDatafeed({\n datafeed_id: \"datafeed-low_request_rate\",\n start: \"2019-04-07T18:22:16Z\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.start_datafeed(\n datafeed_id: \"datafeed-low_request_rate\",\n body: {\n \"start\": \"2019-04-07T18:22:16Z\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->startDatafeed([\n \"datafeed_id\" => \"datafeed-low_request_rate\",\n \"body\" => [\n \"start\" => \"2019-04-07T18:22:16Z\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"start\":\"2019-04-07T18:22:16Z\"}' \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-low_request_rate/_start\"", + "language": "curl" + } + ], "description": "An example body for a `POST _ml/datafeeds/datafeed-low_request_rate/_start` request.", "method_request": "POST _ml/datafeeds/datafeed-low_request_rate/_start", "value": "{\n \"start\": \"2019-04-07T18:22:16Z\"\n}" @@ -193433,6 +202654,28 @@ "description": "Start a trained model deployment.\nIt allocates the model to every machine learning node.", "examples": { "MlStartTrainedModelDeploymentExample1": { + "alternatives": [ + { + "code": "resp = client.ml.start_trained_model_deployment(\n model_id=\"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n wait_for=\"started\",\n timeout=\"1m\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.startTrainedModelDeployment({\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n wait_for: \"started\",\n timeout: \"1m\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.start_trained_model_deployment(\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n wait_for: \"started\",\n timeout: \"1m\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->startTrainedModelDeployment([\n \"model_id\" => \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n \"wait_for\" => \"started\",\n \"timeout\" => \"1m\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_start?wait_for=started&timeout=1m\"", + "language": "curl" + } + ], "method_request": "POST _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_start?wait_for=started&timeout=1m" } }, @@ -193605,6 +202848,28 @@ "description": "Stop data frame analytics jobs.\nA data frame analytics job can be started and stopped multiple times\nthroughout its lifecycle.", "examples": { "MlStopDataFrameAnalyticsExample1": { + "alternatives": [ + { + "code": "resp = client.ml.stop_data_frame_analytics(\n id=\"loganalytics\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.stopDataFrameAnalytics({\n id: \"loganalytics\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.stop_data_frame_analytics(\n id: \"loganalytics\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->stopDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics/_stop\"", + "language": "curl" + } + ], "method_request": "POST _ml/data_frame/analytics/loganalytics/_stop" } }, @@ -193751,6 +203016,28 @@ "description": "Stop datafeeds.\nA datafeed that is stopped ceases to retrieve data from Elasticsearch. A datafeed can be started and stopped\nmultiple times throughout its lifecycle.", "examples": { "MlStopDatafeedExample1": { + "alternatives": [ + { + "code": "resp = client.ml.stop_datafeed(\n datafeed_id=\"datafeed-low_request_rate\",\n timeout=\"30s\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.stopDatafeed({\n datafeed_id: \"datafeed-low_request_rate\",\n timeout: \"30s\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.stop_datafeed(\n datafeed_id: \"datafeed-low_request_rate\",\n body: {\n \"timeout\": \"30s\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->stopDatafeed([\n \"datafeed_id\" => \"datafeed-low_request_rate\",\n \"body\" => [\n \"timeout\" => \"30s\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"timeout\":\"30s\"}' \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-low_request_rate/_stop\"", + "language": "curl" + } + ], "description": "An example body for a `POST _ml/datafeeds/datafeed-low_request_rate/_stop` request.", "method_request": "POST _ml/datafeeds/datafeed-low_request_rate/_stop", "value": "{\n \"timeout\": \"30s\"\n}" @@ -193858,6 +203145,28 @@ "description": "Stop a trained model deployment.", "examples": { "MlStopTrainedModelDeploymentExample1": { + "alternatives": [ + { + "code": "resp = client.ml.stop_trained_model_deployment(\n model_id=\"my_model_for_search\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.stopTrainedModelDeployment({\n model_id: \"my_model_for_search\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.stop_trained_model_deployment(\n model_id: \"my_model_for_search\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->stopTrainedModelDeployment([\n \"model_id\" => \"my_model_for_search\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/my_model_for_search/deployment/_stop\"", + "language": "curl" + } + ], "method_request": "POST _ml/trained_models/my_model_for_search/deployment/_stop" } }, @@ -194007,6 +203316,28 @@ "description": "Update a data frame analytics job.", "examples": { "MlUpdateDataFrameAnalyticsExample1": { + "alternatives": [ + { + "code": "resp = client.ml.update_data_frame_analytics(\n id=\"loganalytics\",\n model_memory_limit=\"200mb\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.updateDataFrameAnalytics({\n id: \"loganalytics\",\n model_memory_limit: \"200mb\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.update_data_frame_analytics(\n id: \"loganalytics\",\n body: {\n \"model_memory_limit\": \"200mb\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->updateDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n \"body\" => [\n \"model_memory_limit\" => \"200mb\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"model_memory_limit\":\"200mb\"}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics/_update\"", + "language": "curl" + } + ], "description": "An example body for a `POST _ml/data_frame/analytics/loganalytics/_update` request.", "method_request": "POST _ml/data_frame/analytics/loganalytics/_update", "value": "{\n \"model_memory_limit\": \"200mb\"\n}" @@ -194382,6 +203713,28 @@ "description": "Update a datafeed.\nYou must stop and start the datafeed for the changes to be applied.\nWhen Elasticsearch security features are enabled, your datafeed remembers which roles the user who updated it had at\nthe time of the update and runs the query using those same roles. If you provide secondary authorization headers,\nthose credentials are used instead.", "examples": { "MlUpdateDatafeedExample1": { + "alternatives": [ + { + "code": "resp = client.ml.update_datafeed(\n datafeed_id=\"datafeed-test-job\",\n query={\n \"term\": {\n \"geo.src\": \"US\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.updateDatafeed({\n datafeed_id: \"datafeed-test-job\",\n query: {\n term: {\n \"geo.src\": \"US\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.update_datafeed(\n datafeed_id: \"datafeed-test-job\",\n body: {\n \"query\": {\n \"term\": {\n \"geo.src\": \"US\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->updateDatafeed([\n \"datafeed_id\" => \"datafeed-test-job\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"geo.src\" => \"US\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"geo.src\":\"US\"}}}' \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-test-job/_update\"", + "language": "curl" + } + ], "description": "An example body for a `POST _ml/datafeeds/datafeed-test-job/_update` request.", "method_request": "POST _ml/datafeeds/datafeed-test-job/_update", "value": "{\n \"query\": {\n \"term\": {\n \"geo.src\": \"US\"\n }\n }\n}" @@ -194729,6 +204082,28 @@ "description": "Update a filter.\nUpdates the description of a filter, adds items, or removes items from the list.", "examples": { "MlUpdateFilterExample1": { + "alternatives": [ + { + "code": "resp = client.ml.update_filter(\n filter_id=\"safe_domains\",\n description=\"Updated list of domains\",\n add_items=[\n \"*.myorg.com\"\n ],\n remove_items=[\n \"wikipedia.org\"\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.updateFilter({\n filter_id: \"safe_domains\",\n description: \"Updated list of domains\",\n add_items: [\"*.myorg.com\"],\n remove_items: [\"wikipedia.org\"],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.update_filter(\n filter_id: \"safe_domains\",\n body: {\n \"description\": \"Updated list of domains\",\n \"add_items\": [\n \"*.myorg.com\"\n ],\n \"remove_items\": [\n \"wikipedia.org\"\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->updateFilter([\n \"filter_id\" => \"safe_domains\",\n \"body\" => [\n \"description\" => \"Updated list of domains\",\n \"add_items\" => array(\n \"*.myorg.com\",\n ),\n \"remove_items\" => array(\n \"wikipedia.org\",\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"Updated list of domains\",\"add_items\":[\"*.myorg.com\"],\"remove_items\":[\"wikipedia.org\"]}' \"$ELASTICSEARCH_URL/_ml/filters/safe_domains/_update\"", + "language": "curl" + } + ], "description": "An example body for a `POST _ml/filters/safe_domains/_update` request.", "method_request": "POST _ml/filters/safe_domains/_update", "value": "{\n \"description\": \"Updated list of domains\",\n \"add_items\": [\"*.myorg.com\"],\n \"remove_items\": [\"wikipedia.org\"]\n}" @@ -195025,6 +204400,28 @@ "description": "Update an anomaly detection job.\nUpdates certain properties of an anomaly detection job.", "examples": { "MlUpdateJobExample1": { + "alternatives": [ + { + "code": "resp = client.ml.update_job(\n job_id=\"low_request_rate\",\n description=\"An updated job\",\n detectors={\n \"detector_index\": 0,\n \"description\": \"An updated detector description\"\n },\n groups=[\n \"kibana_sample_data\",\n \"kibana_sample_web_logs\"\n ],\n model_plot_config={\n \"enabled\": True\n },\n renormalization_window_days=30,\n background_persist_interval=\"2h\",\n model_snapshot_retention_days=7,\n results_retention_days=60,\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.updateJob({\n job_id: \"low_request_rate\",\n description: \"An updated job\",\n detectors: {\n detector_index: 0,\n description: \"An updated detector description\",\n },\n groups: [\"kibana_sample_data\", \"kibana_sample_web_logs\"],\n model_plot_config: {\n enabled: true,\n },\n renormalization_window_days: 30,\n background_persist_interval: \"2h\",\n model_snapshot_retention_days: 7,\n results_retention_days: 60,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.update_job(\n job_id: \"low_request_rate\",\n body: {\n \"description\": \"An updated job\",\n \"detectors\": {\n \"detector_index\": 0,\n \"description\": \"An updated detector description\"\n },\n \"groups\": [\n \"kibana_sample_data\",\n \"kibana_sample_web_logs\"\n ],\n \"model_plot_config\": {\n \"enabled\": true\n },\n \"renormalization_window_days\": 30,\n \"background_persist_interval\": \"2h\",\n \"model_snapshot_retention_days\": 7,\n \"results_retention_days\": 60\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->updateJob([\n \"job_id\" => \"low_request_rate\",\n \"body\" => [\n \"description\" => \"An updated job\",\n \"detectors\" => [\n \"detector_index\" => 0,\n \"description\" => \"An updated detector description\",\n ],\n \"groups\" => array(\n \"kibana_sample_data\",\n \"kibana_sample_web_logs\",\n ),\n \"model_plot_config\" => [\n \"enabled\" => true,\n ],\n \"renormalization_window_days\" => 30,\n \"background_persist_interval\" => \"2h\",\n \"model_snapshot_retention_days\" => 7,\n \"results_retention_days\" => 60,\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"An updated job\",\"detectors\":{\"detector_index\":0,\"description\":\"An updated detector description\"},\"groups\":[\"kibana_sample_data\",\"kibana_sample_web_logs\"],\"model_plot_config\":{\"enabled\":true},\"renormalization_window_days\":30,\"background_persist_interval\":\"2h\",\"model_snapshot_retention_days\":7,\"results_retention_days\":60}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_update\"", + "language": "curl" + } + ], "description": "An example body for a `POST _ml/anomaly_detectors/low_request_rate/_update` request.", "method_request": "POST _ml/anomaly_detectors/low_request_rate/_update", "value": "{\n \"description\":\"An updated job\",\n \"detectors\": {\n \"detector_index\": 0,\n \"description\": \"An updated detector description\"\n },\n \"groups\": [\"kibana_sample_data\",\"kibana_sample_web_logs\"],\n \"model_plot_config\": {\n \"enabled\": true\n },\n \"renormalization_window_days\": 30,\n \"background_persist_interval\": \"2h\",\n \"model_snapshot_retention_days\": 7,\n \"results_retention_days\": 60\n}" @@ -195371,6 +204768,28 @@ "description": "Update a snapshot.\nUpdates certain properties of a snapshot.", "examples": { "MlUpdateModelSnapshotExample1": { + "alternatives": [ + { + "code": "resp = client.ml.update_model_snapshot(\n job_id=\"it_ops_new_logs\",\n snapshot_id=\"1491852978\",\n description=\"Snapshot 1\",\n retain=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.updateModelSnapshot({\n job_id: \"it_ops_new_logs\",\n snapshot_id: 1491852978,\n description: \"Snapshot 1\",\n retain: true,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.update_model_snapshot(\n job_id: \"it_ops_new_logs\",\n snapshot_id: \"1491852978\",\n body: {\n \"description\": \"Snapshot 1\",\n \"retain\": true\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->updateModelSnapshot([\n \"job_id\" => \"it_ops_new_logs\",\n \"snapshot_id\" => \"1491852978\",\n \"body\" => [\n \"description\" => \"Snapshot 1\",\n \"retain\" => true,\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"Snapshot 1\",\"retain\":true}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/it_ops_new_logs/model_snapshots/1491852978/_update\"", + "language": "curl" + } + ], "description": "An example body for a `POST` request.", "method_request": "POST", "value": "_ml/anomaly_detectors/it_ops_new_logs/model_snapshots/1491852978/_update\n{\n \"description\": \"Snapshot 1\",\n \"retain\": true\n}" @@ -195488,6 +204907,28 @@ "description": "Update a trained model deployment.", "examples": { "MlUpdateTrainedModelDeploymentExample1": { + "alternatives": [ + { + "code": "resp = client.ml.update_trained_model_deployment(\n model_id=\"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n number_of_allocations=4,\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.updateTrainedModelDeployment({\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n number_of_allocations: 4,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.update_trained_model_deployment(\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n body: {\n \"number_of_allocations\": 4\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->updateTrainedModelDeployment([\n \"model_id\" => \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n \"body\" => [\n \"number_of_allocations\" => 4,\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"number_of_allocations\":4}' \"$ELASTICSEARCH_URL/_ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_update\"", + "language": "curl" + } + ], "description": "An example body for a `POST _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_update` request.", "method_request": "POST _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_update", "value": "{\n \"number_of_allocations\": 4\n}" @@ -195569,6 +205010,28 @@ "description": "Upgrade a snapshot.\nUpgrade an anomaly detection model snapshot to the latest major version.\nOver time, older snapshot formats are deprecated and removed. Anomaly\ndetection jobs support only snapshots that are from the current or previous\nmajor version.\nThis API provides a means to upgrade a snapshot to the current major version.\nThis aids in preparing the cluster for an upgrade to the next major version.\nOnly one snapshot per anomaly detection job can be upgraded at a time and the\nupgraded snapshot cannot be the current snapshot of the anomaly detection\njob.", "examples": { "MlUpgradeJobSnapshotExample1": { + "alternatives": [ + { + "code": "resp = client.ml.upgrade_job_snapshot(\n job_id=\"low_request_rate\",\n snapshot_id=\"1828371\",\n timeout=\"45m\",\n wait_for_completion=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.ml.upgradeJobSnapshot({\n job_id: \"low_request_rate\",\n snapshot_id: 1828371,\n timeout: \"45m\",\n wait_for_completion: \"true\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.ml.upgrade_job_snapshot(\n job_id: \"low_request_rate\",\n snapshot_id: \"1828371\",\n timeout: \"45m\",\n wait_for_completion: \"true\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->ml()->upgradeJobSnapshot([\n \"job_id\" => \"low_request_rate\",\n \"snapshot_id\" => \"1828371\",\n \"timeout\" => \"45m\",\n \"wait_for_completion\" => \"true\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/model_snapshots/1828371/_upgrade?timeout=45m&wait_for_completion=true\"", + "language": "curl" + } + ], "method_request": "POST _ml/anomaly_detectors/low_request_rate/model_snapshots/1828371/_upgrade?timeout=45m&wait_for_completion=true" } }, @@ -200962,6 +210425,28 @@ "description": "Get the hot threads for nodes.\nGet a breakdown of the hot threads on each selected node in the cluster.\nThe output is plain text with a breakdown of the top hot threads for each node.", "examples": { "NodesHotThreadsExample1": { + "alternatives": [ + { + "code": "resp = client.nodes.hot_threads()", + "language": "Python" + }, + { + "code": "const response = await client.nodes.hotThreads();", + "language": "JavaScript" + }, + { + "code": "response = client.nodes.hot_threads", + "language": "Ruby" + }, + { + "code": "$resp = $client->nodes()->hotThreads();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/hot_threads\"", + "language": "curl" + } + ], "method_request": "GET /_nodes/hot_threads" } }, @@ -204077,6 +213562,28 @@ "description": "Get node information.\n\nBy default, the API returns all attributes and core settings for cluster nodes.", "examples": { "NodesInfoExample1": { + "alternatives": [ + { + "code": "resp = client.nodes.info(\n node_id=\"_all\",\n metric=\"jvm\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.nodes.info({\n node_id: \"_all\",\n metric: \"jvm\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.nodes.info(\n node_id: \"_all\",\n metric: \"jvm\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->nodes()->info([\n \"node_id\" => \"_all\",\n \"metric\" => \"jvm\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/_all/jvm\"", + "language": "curl" + } + ], "method_request": "GET _nodes/_all/jvm" } }, @@ -204245,6 +213752,28 @@ "description": "Reload the keystore on nodes in the cluster.\n\nSecure settings are stored in an on-disk keystore. Certain of these settings are reloadable.\nThat is, you can change them on disk and reload them without restarting any nodes in the cluster.\nWhen you have updated reloadable secure settings in your keystore, you can use this API to reload those settings on each node.\n\nWhen the Elasticsearch keystore is password protected and not simply obfuscated, you must provide the password for the keystore when you reload the secure settings.\nReloading the settings for the whole cluster assumes that the keystores for all nodes are protected with the same password; this method is allowed only when inter-node communications are encrypted.\nAlternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password.", "examples": { "ReloadSecureSettingsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.nodes.reload_secure_settings(\n secure_settings_password=\"keystore-password\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.nodes.reloadSecureSettings({\n secure_settings_password: \"keystore-password\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.nodes.reload_secure_settings(\n body: {\n \"secure_settings_password\": \"keystore-password\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->nodes()->reloadSecureSettings([\n \"body\" => [\n \"secure_settings_password\" => \"keystore-password\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"secure_settings_password\":\"keystore-password\"}' \"$ELASTICSEARCH_URL/_nodes/reload_secure_settings\"", + "language": "curl" + } + ], "description": "Run `POST _nodes/reload_secure_settings` to reload the keystore on nodes in the cluster.", "method_request": "POST _nodes/reload_secure_settings", "value": "{\n \"secure_settings_password\": \"keystore-password\"\n}" @@ -204376,6 +213905,28 @@ "description": "Get node statistics.\nGet statistics for nodes in a cluster.\nBy default, all stats are returned. You can limit the returned information by using metrics.", "examples": { "NodesStatsExample1": { + "alternatives": [ + { + "code": "resp = client.nodes.stats(\n metric=\"process\",\n filter_path=\"**.max_file_descriptors\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.nodes.stats({\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.nodes.stats(\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->nodes()->stats([\n \"metric\" => \"process\",\n \"filter_path\" => \"**.max_file_descriptors\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/stats/process?filter_path=**.max_file_descriptors\"", + "language": "curl" + } + ], "method_request": "GET _nodes/stats/process?filter_path=**.max_file_descriptors" } }, @@ -204714,6 +214265,28 @@ "description": "Get feature usage information.", "examples": { "NodesUsageExample1": { + "alternatives": [ + { + "code": "resp = client.nodes.usage()", + "language": "Python" + }, + { + "code": "const response = await client.nodes.usage();", + "language": "JavaScript" + }, + { + "code": "response = client.nodes.usage", + "language": "Ruby" + }, + { + "code": "$resp = $client->nodes()->usage();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/usage\"", + "language": "curl" + } + ], "method_request": "GET _nodes/usage" } }, @@ -205117,6 +214690,28 @@ "description": "Delete a query rule.\nDelete a query rule within a query ruleset.\nThis is a destructive action that is only recoverable by re-adding the same rule with the create or update query rule API.", "examples": { "QueryRulesDeleteRuleExample1": { + "alternatives": [ + { + "code": "resp = client.query_rules.delete_rule(\n ruleset_id=\"my-ruleset\",\n rule_id=\"my-rule1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.queryRules.deleteRule({\n ruleset_id: \"my-ruleset\",\n rule_id: \"my-rule1\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.query_rules.delete_rule(\n ruleset_id: \"my-ruleset\",\n rule_id: \"my-rule1\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->queryRules()->deleteRule([\n \"ruleset_id\" => \"my-ruleset\",\n \"rule_id\" => \"my-rule1\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/my-ruleset/_rule/my-rule1\"", + "language": "curl" + } + ], "method_request": "DELETE _query_rules/my-ruleset/_rule/my-rule1" } }, @@ -205189,6 +214784,28 @@ "description": "Delete a query ruleset.\nRemove a query ruleset and its associated data.\nThis is a destructive action that is not recoverable.", "examples": { "QueryRulesDeleteRulesetExample1": { + "alternatives": [ + { + "code": "resp = client.query_rules.delete_ruleset(\n ruleset_id=\"my-ruleset\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.queryRules.deleteRuleset({\n ruleset_id: \"my-ruleset\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.query_rules.delete_ruleset(\n ruleset_id: \"my-ruleset\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->queryRules()->deleteRuleset([\n \"ruleset_id\" => \"my-ruleset\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/my-ruleset/\"", + "language": "curl" + } + ], "method_request": "DELETE _query_rules/my-ruleset/" } }, @@ -205249,6 +214866,28 @@ "description": "Get a query rule.\nGet details about a query rule within a query ruleset.", "examples": { "QueryRuleGetRequestExample1": { + "alternatives": [ + { + "code": "resp = client.query_rules.get_rule(\n ruleset_id=\"my-ruleset\",\n rule_id=\"my-rule1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.queryRules.getRule({\n ruleset_id: \"my-ruleset\",\n rule_id: \"my-rule1\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.query_rules.get_rule(\n ruleset_id: \"my-ruleset\",\n rule_id: \"my-rule1\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->queryRules()->getRule([\n \"ruleset_id\" => \"my-ruleset\",\n \"rule_id\" => \"my-rule1\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/my-ruleset/_rule/my-rule1\"", + "language": "curl" + } + ], "method_request": "GET _query_rules/my-ruleset/_rule/my-rule1" } }, @@ -205327,6 +214966,28 @@ "description": "Get a query ruleset.\nGet details about a query ruleset.", "examples": { "QueryRulesetGetRequestExample1": { + "alternatives": [ + { + "code": "resp = client.query_rules.get_ruleset(\n ruleset_id=\"my-ruleset\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.queryRules.getRuleset({\n ruleset_id: \"my-ruleset\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.query_rules.get_ruleset(\n ruleset_id: \"my-ruleset\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->queryRules()->getRuleset([\n \"ruleset_id\" => \"my-ruleset\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/my-ruleset/\"", + "language": "curl" + } + ], "method_request": "GET _query_rules/my-ruleset/" } }, @@ -205473,6 +215134,28 @@ "description": "Get all query rulesets.\nGet summarized information about the query rulesets.", "examples": { "QueryRulesetListRequestExample1": { + "alternatives": [ + { + "code": "resp = client.query_rules.list_rulesets(\n from=\"0\",\n size=\"3\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.queryRules.listRulesets({\n from: 0,\n size: 3,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.query_rules.list_rulesets(\n from: \"0\",\n size: \"3\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->queryRules()->listRulesets([\n \"from\" => \"0\",\n \"size\" => \"3\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/?from=0&size=3\"", + "language": "curl" + } + ], "method_request": "GET _query_rules/?from=0&size=3" } }, @@ -205635,6 +215318,28 @@ "description": "Create or update a query rule.\nCreate or update a query rule within a query ruleset.\n\nIMPORTANT: Due to limitations within pinned queries, you can only pin documents using ids or docs, but cannot use both in single rule.\nIt is advised to use one or the other in query rulesets, to avoid errors.\nAdditionally, pinned queries have a maximum limit of 100 pinned hits.\nIf multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset.", "examples": { "QueryRulePutRequestExample1": { + "alternatives": [ + { + "code": "resp = client.query_rules.test(\n ruleset_id=\"my-ruleset\",\n match_criteria={\n \"query_string\": \"puggles\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.queryRules.test({\n ruleset_id: \"my-ruleset\",\n match_criteria: {\n query_string: \"puggles\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.query_rules.test(\n ruleset_id: \"my-ruleset\",\n body: {\n \"match_criteria\": {\n \"query_string\": \"puggles\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->queryRules()->test([\n \"ruleset_id\" => \"my-ruleset\",\n \"body\" => [\n \"match_criteria\" => [\n \"query_string\" => \"puggles\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"match_criteria\":{\"query_string\":\"puggles\"}}' \"$ELASTICSEARCH_URL/_query_rules/my-ruleset/_test\"", + "language": "curl" + } + ], "description": "Run `POST _query_rules/my-ruleset/_test` to test a ruleset. Provide the match criteria that you want to test against.\n", "method_request": "POST _query_rules/my-ruleset/_test", "value": "{\n \"match_criteria\": {\n \"query_string\": \"puggles\"\n }\n}" @@ -205742,6 +215447,28 @@ "description": "Create or update a query ruleset.\nThere is a limit of 100 rules per ruleset.\nThis limit can be increased by using the `xpack.applications.rules.max_rules_per_ruleset` cluster setting.\n\nIMPORTANT: Due to limitations within pinned queries, you can only select documents using `ids` or `docs`, but cannot use both in single rule.\nIt is advised to use one or the other in query rulesets, to avoid errors.\nAdditionally, pinned queries have a maximum limit of 100 pinned hits.\nIf multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset.", "examples": { "QueryRulesetPutRequestExample1": { + "alternatives": [ + { + "code": "resp = client.query_rules.put_ruleset(\n ruleset_id=\"my-ruleset\",\n rules=[\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"pugs\",\n \"puggles\"\n ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [\n \"us\"\n ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"rescue dogs\"\n ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.queryRules.putRuleset({\n ruleset_id: \"my-ruleset\",\n rules: [\n {\n rule_id: \"my-rule1\",\n type: \"pinned\",\n criteria: [\n {\n type: \"contains\",\n metadata: \"user_query\",\n values: [\"pugs\", \"puggles\"],\n },\n {\n type: \"exact\",\n metadata: \"user_country\",\n values: [\"us\"],\n },\n ],\n actions: {\n ids: [\"id1\", \"id2\"],\n },\n },\n {\n rule_id: \"my-rule2\",\n type: \"pinned\",\n criteria: [\n {\n type: \"fuzzy\",\n metadata: \"user_query\",\n values: [\"rescue dogs\"],\n },\n ],\n actions: {\n docs: [\n {\n _index: \"index1\",\n _id: \"id3\",\n },\n {\n _index: \"index2\",\n _id: \"id4\",\n },\n ],\n },\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.query_rules.put_ruleset(\n ruleset_id: \"my-ruleset\",\n body: {\n \"rules\": [\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"pugs\",\n \"puggles\"\n ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [\n \"us\"\n ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"rescue dogs\"\n ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->queryRules()->putRuleset([\n \"ruleset_id\" => \"my-ruleset\",\n \"body\" => [\n \"rules\" => array(\n [\n \"rule_id\" => \"my-rule1\",\n \"type\" => \"pinned\",\n \"criteria\" => array(\n [\n \"type\" => \"contains\",\n \"metadata\" => \"user_query\",\n \"values\" => array(\n \"pugs\",\n \"puggles\",\n ),\n ],\n [\n \"type\" => \"exact\",\n \"metadata\" => \"user_country\",\n \"values\" => array(\n \"us\",\n ),\n ],\n ),\n \"actions\" => [\n \"ids\" => array(\n \"id1\",\n \"id2\",\n ),\n ],\n ],\n [\n \"rule_id\" => \"my-rule2\",\n \"type\" => \"pinned\",\n \"criteria\" => array(\n [\n \"type\" => \"fuzzy\",\n \"metadata\" => \"user_query\",\n \"values\" => array(\n \"rescue dogs\",\n ),\n ],\n ),\n \"actions\" => [\n \"docs\" => array(\n [\n \"_index\" => \"index1\",\n \"_id\" => \"id3\",\n ],\n [\n \"_index\" => \"index2\",\n \"_id\" => \"id4\",\n ],\n ),\n ],\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"rules\":[{\"rule_id\":\"my-rule1\",\"type\":\"pinned\",\"criteria\":[{\"type\":\"contains\",\"metadata\":\"user_query\",\"values\":[\"pugs\",\"puggles\"]},{\"type\":\"exact\",\"metadata\":\"user_country\",\"values\":[\"us\"]}],\"actions\":{\"ids\":[\"id1\",\"id2\"]}},{\"rule_id\":\"my-rule2\",\"type\":\"pinned\",\"criteria\":[{\"type\":\"fuzzy\",\"metadata\":\"user_query\",\"values\":[\"rescue dogs\"]}],\"actions\":{\"docs\":[{\"_index\":\"index1\",\"_id\":\"id3\"},{\"_index\":\"index2\",\"_id\":\"id4\"}]}}]}' \"$ELASTICSEARCH_URL/_query_rules/my-ruleset\"", + "language": "curl" + } + ], "description": "Run `PUT _query_rules/my-ruleset` to create a new query ruleset. Two rules are associated with `my-ruleset`. `my-rule1` will pin documents with IDs `id1` and `id2` when `user_query` contains `pugs` or `puggles` and `user_country` exactly matches `us`. `my-rule2` will exclude documents from different specified indices with IDs `id3` and `id4` when the `query_string` fuzzily matches `rescue dogs`.\n", "method_request": "PUT _query_rules/my-ruleset", "value": "{\n \"rules\": [\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [ \"pugs\", \"puggles\" ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [ \"us\" ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [ \"rescue dogs\" ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ]\n}" @@ -205864,6 +215591,28 @@ "description": "Test a query ruleset.\nEvaluate match criteria against a query ruleset to identify the rules that would match that criteria.", "examples": { "QueryRulesetTestRequestExample1": { + "alternatives": [ + { + "code": "resp = client.query_rules.put_ruleset(\n ruleset_id=\"my-ruleset\",\n rules=[\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"pugs\",\n \"puggles\"\n ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [\n \"us\"\n ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"rescue dogs\"\n ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.queryRules.putRuleset({\n ruleset_id: \"my-ruleset\",\n rules: [\n {\n rule_id: \"my-rule1\",\n type: \"pinned\",\n criteria: [\n {\n type: \"contains\",\n metadata: \"user_query\",\n values: [\"pugs\", \"puggles\"],\n },\n {\n type: \"exact\",\n metadata: \"user_country\",\n values: [\"us\"],\n },\n ],\n actions: {\n ids: [\"id1\", \"id2\"],\n },\n },\n {\n rule_id: \"my-rule2\",\n type: \"pinned\",\n criteria: [\n {\n type: \"fuzzy\",\n metadata: \"user_query\",\n values: [\"rescue dogs\"],\n },\n ],\n actions: {\n docs: [\n {\n _index: \"index1\",\n _id: \"id3\",\n },\n {\n _index: \"index2\",\n _id: \"id4\",\n },\n ],\n },\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.query_rules.put_ruleset(\n ruleset_id: \"my-ruleset\",\n body: {\n \"rules\": [\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"pugs\",\n \"puggles\"\n ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [\n \"us\"\n ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"rescue dogs\"\n ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->queryRules()->putRuleset([\n \"ruleset_id\" => \"my-ruleset\",\n \"body\" => [\n \"rules\" => array(\n [\n \"rule_id\" => \"my-rule1\",\n \"type\" => \"pinned\",\n \"criteria\" => array(\n [\n \"type\" => \"contains\",\n \"metadata\" => \"user_query\",\n \"values\" => array(\n \"pugs\",\n \"puggles\",\n ),\n ],\n [\n \"type\" => \"exact\",\n \"metadata\" => \"user_country\",\n \"values\" => array(\n \"us\",\n ),\n ],\n ),\n \"actions\" => [\n \"ids\" => array(\n \"id1\",\n \"id2\",\n ),\n ],\n ],\n [\n \"rule_id\" => \"my-rule2\",\n \"type\" => \"pinned\",\n \"criteria\" => array(\n [\n \"type\" => \"fuzzy\",\n \"metadata\" => \"user_query\",\n \"values\" => array(\n \"rescue dogs\",\n ),\n ],\n ),\n \"actions\" => [\n \"docs\" => array(\n [\n \"_index\" => \"index1\",\n \"_id\" => \"id3\",\n ],\n [\n \"_index\" => \"index2\",\n \"_id\" => \"id4\",\n ],\n ),\n ],\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"rules\":[{\"rule_id\":\"my-rule1\",\"type\":\"pinned\",\"criteria\":[{\"type\":\"contains\",\"metadata\":\"user_query\",\"values\":[\"pugs\",\"puggles\"]},{\"type\":\"exact\",\"metadata\":\"user_country\",\"values\":[\"us\"]}],\"actions\":{\"ids\":[\"id1\",\"id2\"]}},{\"rule_id\":\"my-rule2\",\"type\":\"pinned\",\"criteria\":[{\"type\":\"fuzzy\",\"metadata\":\"user_query\",\"values\":[\"rescue dogs\"]}],\"actions\":{\"docs\":[{\"_index\":\"index1\",\"_id\":\"id3\"},{\"_index\":\"index2\",\"_id\":\"id4\"}]}}]}' \"$ELASTICSEARCH_URL/_query_rules/my-ruleset\"", + "language": "curl" + } + ], "description": "Run `PUT _query_rules/my-ruleset` to create a new query ruleset. Two rules are associated with `my-ruleset`. `my-rule1` will pin documents with IDs `id1` and `id2` when `user_query` contains `pugs` or `puggles` and `user_country` exactly matches `us`. `my-rule2` will exclude documents from different specified indices with IDs `id3` and `id4` when the `query_string` fuzzily matches `rescue dogs`.\n", "method_request": "PUT _query_rules/my-ruleset", "value": "{\n \"rules\": [\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [ \"pugs\", \"puggles\" ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [ \"us\" ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [ \"rescue dogs\" ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ]\n}" @@ -206215,6 +215964,28 @@ "description": "Delete a rollup job.\n\nA job must be stopped before it can be deleted.\nIf you attempt to delete a started job, an error occurs.\nSimilarly, if you attempt to delete a nonexistent job, an exception occurs.\n\nIMPORTANT: When you delete a job, you remove only the process that is actively monitoring and rolling up data.\nThe API does not delete any previously rolled up data.\nThis is by design; a user may wish to roll up a static data set.\nBecause the data set is static, after it has been fully rolled up there is no need to keep the indexing rollup job around (as there will be no new data).\nThus the job can be deleted, leaving behind the rolled up data for analysis.\nIf you wish to also remove the rollup data and the rollup index contains the data for only a single job, you can delete the whole rollup index.\nIf the rollup index stores data from several jobs, you must issue a delete-by-query that targets the rollup job's identifier in the rollup index. For example:\n\n```\nPOST my_rollup_index/_delete_by_query\n{\n \"query\": {\n \"term\": {\n \"_rollup.id\": \"the_rollup_job_id\"\n }\n }\n}\n```", "examples": { "DeleteRollupJobRequestExample1": { + "alternatives": [ + { + "code": "resp = client.rollup.delete_job(\n id=\"sensor\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.rollup.deleteJob({\n id: \"sensor\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.rollup.delete_job(\n id: \"sensor\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->rollup()->deleteJob([\n \"id\" => \"sensor\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_rollup/job/sensor\"", + "language": "curl" + } + ], "method_request": "DELETE _rollup/job/sensor" } }, @@ -206329,6 +216100,28 @@ "description": "Get rollup job information.\nGet the configuration, stats, and status of rollup jobs.\n\nNOTE: This API returns only active (both `STARTED` and `STOPPED`) jobs.\nIf a job was created, ran for a while, then was deleted, the API does not return any details about it.\nFor details about a historical rollup job, the rollup capabilities API may be more useful.", "examples": { "GetRollupJobRequestExample1": { + "alternatives": [ + { + "code": "resp = client.rollup.get_jobs(\n id=\"sensor\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.rollup.getJobs({\n id: \"sensor\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.rollup.get_jobs(\n id: \"sensor\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->rollup()->getJobs([\n \"id\" => \"sensor\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_rollup/job/sensor\"", + "language": "curl" + } + ], "method_request": "GET _rollup/job/sensor" } }, @@ -206773,6 +216566,28 @@ "description": "Get the rollup job capabilities.\nGet the capabilities of any rollup jobs that have been configured for a specific index or index pattern.\n\nThis API is useful because a rollup job is often configured to rollup only a subset of fields from the source index.\nFurthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration.\nThis API enables you to inspect an index and determine:\n\n1. Does this index have associated rollup data somewhere in the cluster?\n2. If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live?", "examples": { "GetRollupCapabilitiesRequestExample1": { + "alternatives": [ + { + "code": "resp = client.rollup.get_rollup_caps(\n id=\"sensor-*\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.rollup.getRollupCaps({\n id: \"sensor-*\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.rollup.get_rollup_caps(\n id: \"sensor-*\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->rollup()->getRollupCaps([\n \"id\" => \"sensor-*\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_rollup/data/sensor-*\"", + "language": "curl" + } + ], "method_request": "GET _rollup/data/sensor-*" } }, @@ -207014,6 +216829,28 @@ "description": "Get the rollup index capabilities.\nGet the rollup capabilities of all jobs inside of a rollup index.\nA single rollup index may store the data for multiple rollup jobs and may have a variety of capabilities depending on those jobs. This API enables you to determine:\n\n* What jobs are stored in an index (or indices specified via a pattern)?\n* What target indices were rolled up, what fields were used in those rollups, and what aggregations can be performed on each job?", "examples": { "GetRollupIndexCapabilitiesRequestExample1": { + "alternatives": [ + { + "code": "resp = client.rollup.get_rollup_index_caps(\n index=\"sensor_rollup\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.rollup.getRollupIndexCaps({\n index: \"sensor_rollup\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.rollup.get_rollup_index_caps(\n index: \"sensor_rollup\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->rollup()->getRollupIndexCaps([\n \"index\" => \"sensor_rollup\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/sensor_rollup/_rollup/data\"", + "language": "curl" + } + ], "method_request": "GET /sensor_rollup/_rollup/data" } }, @@ -207307,6 +217144,28 @@ "description": "Create a rollup job.\n\nWARNING: From 8.15.0, calling this API in a cluster with no rollup usage will fail with a message about the deprecation and planned removal of rollup features. A cluster needs to contain either a rollup job or a rollup index in order for this API to be allowed to run.\n\nThe rollup job configuration contains all the details about how the job should run, when it indexes documents, and what future queries will be able to run against the rollup index.\n\nThere are three main sections to the job configuration: the logistical details about the job (for example, the cron schedule), the fields that are used for grouping, and what metrics to collect for each group.\n\nJobs are created in a `STOPPED` state. You can start them with the start rollup jobs API.", "examples": { "CreateRollupJobRequestExample1": { + "alternatives": [ + { + "code": "resp = client.rollup.put_job(\n id=\"sensor\",\n index_pattern=\"sensor-*\",\n rollup_index=\"sensor_rollup\",\n cron=\"*/30 * * * * ?\",\n page_size=1000,\n groups={\n \"date_histogram\": {\n \"field\": \"timestamp\",\n \"fixed_interval\": \"1h\",\n \"delay\": \"7d\"\n },\n \"terms\": {\n \"fields\": [\n \"node\"\n ]\n }\n },\n metrics=[\n {\n \"field\": \"temperature\",\n \"metrics\": [\n \"min\",\n \"max\",\n \"sum\"\n ]\n },\n {\n \"field\": \"voltage\",\n \"metrics\": [\n \"avg\"\n ]\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.rollup.putJob({\n id: \"sensor\",\n index_pattern: \"sensor-*\",\n rollup_index: \"sensor_rollup\",\n cron: \"*/30 * * * * ?\",\n page_size: 1000,\n groups: {\n date_histogram: {\n field: \"timestamp\",\n fixed_interval: \"1h\",\n delay: \"7d\",\n },\n terms: {\n fields: [\"node\"],\n },\n },\n metrics: [\n {\n field: \"temperature\",\n metrics: [\"min\", \"max\", \"sum\"],\n },\n {\n field: \"voltage\",\n metrics: [\"avg\"],\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.rollup.put_job(\n id: \"sensor\",\n body: {\n \"index_pattern\": \"sensor-*\",\n \"rollup_index\": \"sensor_rollup\",\n \"cron\": \"*/30 * * * * ?\",\n \"page_size\": 1000,\n \"groups\": {\n \"date_histogram\": {\n \"field\": \"timestamp\",\n \"fixed_interval\": \"1h\",\n \"delay\": \"7d\"\n },\n \"terms\": {\n \"fields\": [\n \"node\"\n ]\n }\n },\n \"metrics\": [\n {\n \"field\": \"temperature\",\n \"metrics\": [\n \"min\",\n \"max\",\n \"sum\"\n ]\n },\n {\n \"field\": \"voltage\",\n \"metrics\": [\n \"avg\"\n ]\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->rollup()->putJob([\n \"id\" => \"sensor\",\n \"body\" => [\n \"index_pattern\" => \"sensor-*\",\n \"rollup_index\" => \"sensor_rollup\",\n \"cron\" => \"*/30 * * * * ?\",\n \"page_size\" => 1000,\n \"groups\" => [\n \"date_histogram\" => [\n \"field\" => \"timestamp\",\n \"fixed_interval\" => \"1h\",\n \"delay\" => \"7d\",\n ],\n \"terms\" => [\n \"fields\" => array(\n \"node\",\n ),\n ],\n ],\n \"metrics\" => array(\n [\n \"field\" => \"temperature\",\n \"metrics\" => array(\n \"min\",\n \"max\",\n \"sum\",\n ),\n ],\n [\n \"field\" => \"voltage\",\n \"metrics\" => array(\n \"avg\",\n ),\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_pattern\":\"sensor-*\",\"rollup_index\":\"sensor_rollup\",\"cron\":\"*/30 * * * * ?\",\"page_size\":1000,\"groups\":{\"date_histogram\":{\"field\":\"timestamp\",\"fixed_interval\":\"1h\",\"delay\":\"7d\"},\"terms\":{\"fields\":[\"node\"]}},\"metrics\":[{\"field\":\"temperature\",\"metrics\":[\"min\",\"max\",\"sum\"]},{\"field\":\"voltage\",\"metrics\":[\"avg\"]}]}' \"$ELASTICSEARCH_URL/_rollup/job/sensor\"", + "language": "curl" + } + ], "description": "Run `PUT _rollup/job/sensor` to create a rollup job that targets the `sensor-*` index pattern. This configuration enables date histograms to be used on the `timestamp` field and terms aggregations to be used on the `node` field. This configuration defines metrics over two fields: `temperature` and `voltage`. For the `temperature` field, it collects the `min`, `max`, and `sum` of the temperature. For `voltage`, it collects the `average`.\n", "method_request": "PUT _rollup/job/sensor", "value": "{\n \"index_pattern\": \"sensor-*\",\n \"rollup_index\": \"sensor_rollup\",\n \"cron\": \"*/30 * * * * ?\",\n \"page_size\": 1000,\n \"groups\": {\n \"date_histogram\": {\n \"field\": \"timestamp\",\n \"fixed_interval\": \"1h\",\n \"delay\": \"7d\"\n },\n \"terms\": {\n \"fields\": [ \"node\" ]\n }\n },\n \"metrics\": [\n {\n \"field\": \"temperature\",\n \"metrics\": [ \"min\", \"max\", \"sum\" ]\n },\n {\n \"field\": \"voltage\",\n \"metrics\": [ \"avg\" ]\n }\n ]\n}" @@ -207434,6 +217293,28 @@ "description": "Search rolled-up data.\nThe rollup search endpoint is needed because, internally, rolled-up documents utilize a different document structure than the original data.\nIt rewrites standard Query DSL into a format that matches the rollup documents then takes the response and rewrites it back to what a client would expect given the original query.\n\nThe request body supports a subset of features from the regular search API.\nThe following functionality is not available:\n\n`size`: Because rollups work on pre-aggregated data, no search hits can be returned and so size must be set to zero or omitted entirely.\n`highlighter`, `suggestors`, `post_filter`, `profile`, `explain`: These are similarly disallowed.\n\n**Searching both historical rollup and non-rollup data**\n\nThe rollup search API has the capability to search across both \"live\" non-rollup data and the aggregated rollup data.\nThis is done by simply adding the live indices to the URI. For example:\n\n```\nGET sensor-1,sensor_rollup/_rollup_search\n{\n \"size\": 0,\n \"aggregations\": {\n \"max_temperature\": {\n \"max\": {\n \"field\": \"temperature\"\n }\n }\n }\n}\n```\n\nThe rollup search endpoint does two things when the search runs:\n\n* The original request is sent to the non-rollup index unaltered.\n* A rewritten version of the original request is sent to the rollup index.\n\nWhen the two responses are received, the endpoint rewrites the rollup response and merges the two together.\nDuring the merging process, if there is any overlap in buckets between the two responses, the buckets from the non-rollup index are used.", "examples": { "RollupSearchRequestExample1": { + "alternatives": [ + { + "code": "resp = client.rollup.rollup_search(\n index=\"sensor_rollup\",\n size=0,\n aggregations={\n \"max_temperature\": {\n \"max\": {\n \"field\": \"temperature\"\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.rollup.rollupSearch({\n index: \"sensor_rollup\",\n size: 0,\n aggregations: {\n max_temperature: {\n max: {\n field: \"temperature\",\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.rollup.rollup_search(\n index: \"sensor_rollup\",\n body: {\n \"size\": 0,\n \"aggregations\": {\n \"max_temperature\": {\n \"max\": {\n \"field\": \"temperature\"\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->rollup()->rollupSearch([\n \"index\" => \"sensor_rollup\",\n \"body\" => [\n \"size\" => 0,\n \"aggregations\" => [\n \"max_temperature\" => [\n \"max\" => [\n \"field\" => \"temperature\",\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"size\":0,\"aggregations\":{\"max_temperature\":{\"max\":{\"field\":\"temperature\"}}}}' \"$ELASTICSEARCH_URL/sensor_rollup/_rollup_search\"", + "language": "curl" + } + ], "description": "Search rolled up data stored in `sensor_rollup` with `GET /sensor_rollup/_rollup_search`", "method_request": "GET /sensor_rollup/_rollup_search", "value": "{\n \"size\": 0,\n \"aggregations\": {\n \"max_temperature\": {\n \"max\": {\n \"field\": \"temperature\"\n }\n }\n }\n}" @@ -207617,6 +217498,28 @@ "description": "Start rollup jobs.\nIf you try to start a job that does not exist, an exception occurs.\nIf you try to start a job that is already started, nothing happens.", "examples": { "StartRollupJobRequestExample1": { + "alternatives": [ + { + "code": "resp = client.rollup.start_job(\n id=\"sensor\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.rollup.startJob({\n id: \"sensor\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.rollup.start_job(\n id: \"sensor\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->rollup()->startJob([\n \"id\" => \"sensor\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_rollup/job/sensor/_start\"", + "language": "curl" + } + ], "method_request": "POST _rollup/job/sensor/_start" } }, @@ -207692,6 +217595,28 @@ "description": "Stop rollup jobs.\nIf you try to stop a job that does not exist, an exception occurs.\nIf you try to stop a job that is already stopped, nothing happens.\n\nSince only a stopped job can be deleted, it can be useful to block the API until the indexer has fully stopped.\nThis is accomplished with the `wait_for_completion` query parameter, and optionally a timeout. For example:\n\n```\nPOST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s\n```\nThe parameter blocks the API call from returning until either the job has moved to STOPPED or the specified time has elapsed.\nIf the specified time elapses without the job moving to STOPPED, a timeout exception occurs.", "examples": { "RollupStopJobExample1": { + "alternatives": [ + { + "code": "resp = client.rollup.stop_job(\n id=\"sensor\",\n wait_for_completion=True,\n timeout=\"10s\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.rollup.stopJob({\n id: \"sensor\",\n wait_for_completion: \"true\",\n timeout: \"10s\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.rollup.stop_job(\n id: \"sensor\",\n wait_for_completion: \"true\",\n timeout: \"10s\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->rollup()->stopJob([\n \"id\" => \"sensor\",\n \"wait_for_completion\" => \"true\",\n \"timeout\" => \"10s\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s\"", + "language": "curl" + } + ], "method_request": "POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s" } }, @@ -207969,6 +217894,28 @@ "description": "Delete a search application.\n\nRemove a search application and its associated alias. Indices attached to the search application are not removed.", "examples": { "SearchApplicationDeleteExample1": { + "alternatives": [ + { + "code": "resp = client.search_application.delete(\n name=\"my-app\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.searchApplication.delete({\n name: \"my-app\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.search_application.delete(\n name: \"my-app\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->searchApplication()->delete([\n \"name\" => \"my-app\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/search_application/my-app/\"", + "language": "curl" + } + ], "method_request": "DELETE _application/search_application/my-app/" } }, @@ -208033,6 +217980,28 @@ "description": "Delete a behavioral analytics collection.\nThe associated data stream is also deleted.", "examples": { "SearchApplicationDeleteBehavioralAnalyticsExample1": { + "alternatives": [ + { + "code": "resp = client.search_application.delete_behavioral_analytics(\n name=\"my_analytics_collection\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.searchApplication.deleteBehavioralAnalytics({\n name: \"my_analytics_collection\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.search_application.delete_behavioral_analytics(\n name: \"my_analytics_collection\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->searchApplication()->deleteBehavioralAnalytics([\n \"name\" => \"my_analytics_collection\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/analytics/my_analytics_collection/\"", + "language": "curl" + } + ], "method_request": "DELETE _application/analytics/my_analytics_collection/" } }, @@ -208093,6 +218062,28 @@ "description": "Get search application details.", "examples": { "SearchApplicationGetRequestExample1": { + "alternatives": [ + { + "code": "resp = client.search_application.get(\n name=\"my-app\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.searchApplication.get({\n name: \"my-app\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.search_application.get(\n name: \"my-app\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->searchApplication()->get([\n \"name\" => \"my-app\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/search_application/my-app/\"", + "language": "curl" + } + ], "method_request": "GET _application/search_application/my-app/" } }, @@ -208163,6 +218154,28 @@ "description": "Get behavioral analytics collections.", "examples": { "BehavioralAnalyticsGetRequestExample1": { + "alternatives": [ + { + "code": "resp = client.search_application.get_behavioral_analytics(\n name=\"my*\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.searchApplication.getBehavioralAnalytics({\n name: \"my*\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.search_application.get_behavioral_analytics(\n name: \"my*\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->searchApplication()->getBehavioralAnalytics([\n \"name\" => \"my*\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/analytics/my*\"", + "language": "curl" + } + ], "method_request": "GET _application/analytics/my*" } }, @@ -208243,6 +218256,28 @@ "description": "Get search applications.\nGet information about search applications.", "examples": { "SearchApplicationsListRequestExample1": { + "alternatives": [ + { + "code": "resp = client.search_application.list(\n from=\"0\",\n size=\"3\",\n q=\"app*\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.searchApplication.list({\n from: 0,\n size: 3,\n q: \"app*\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.search_application.list(\n from: \"0\",\n size: \"3\",\n q: \"app*\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->searchApplication()->list([\n \"from\" => \"0\",\n \"size\" => \"3\",\n \"q\" => \"app*\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/search_application?from=0&size=3&q=app*\"", + "language": "curl" + } + ], "method_request": "GET _application/search_application?from=0&size=3&q=app*" } }, @@ -208361,6 +218396,28 @@ "description": "Create a behavioral analytics collection event.", "examples": { "BehavioralAnalyticsEventPostRequestExample1": { + "alternatives": [ + { + "code": "resp = client.search_application.post_behavioral_analytics_event(\n collection_name=\"my_analytics_collection\",\n event_type=\"search_click\",\n payload={\n \"session\": {\n \"id\": \"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\"\n },\n \"user\": {\n \"id\": \"5f26f01a-bbee-4202-9298-81261067abbd\"\n },\n \"search\": {\n \"query\": \"search term\",\n \"results\": {\n \"items\": [\n {\n \"document\": {\n \"id\": \"123\",\n \"index\": \"products\"\n }\n }\n ],\n \"total_results\": 10\n },\n \"sort\": {\n \"name\": \"relevance\"\n },\n \"search_application\": \"website\"\n },\n \"document\": {\n \"id\": \"123\",\n \"index\": \"products\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.searchApplication.postBehavioralAnalyticsEvent({\n collection_name: \"my_analytics_collection\",\n event_type: \"search_click\",\n payload: {\n session: {\n id: \"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\",\n },\n user: {\n id: \"5f26f01a-bbee-4202-9298-81261067abbd\",\n },\n search: {\n query: \"search term\",\n results: {\n items: [\n {\n document: {\n id: \"123\",\n index: \"products\",\n },\n },\n ],\n total_results: 10,\n },\n sort: {\n name: \"relevance\",\n },\n search_application: \"website\",\n },\n document: {\n id: \"123\",\n index: \"products\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.search_application.post_behavioral_analytics_event(\n collection_name: \"my_analytics_collection\",\n event_type: \"search_click\",\n body: {\n \"session\": {\n \"id\": \"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\"\n },\n \"user\": {\n \"id\": \"5f26f01a-bbee-4202-9298-81261067abbd\"\n },\n \"search\": {\n \"query\": \"search term\",\n \"results\": {\n \"items\": [\n {\n \"document\": {\n \"id\": \"123\",\n \"index\": \"products\"\n }\n }\n ],\n \"total_results\": 10\n },\n \"sort\": {\n \"name\": \"relevance\"\n },\n \"search_application\": \"website\"\n },\n \"document\": {\n \"id\": \"123\",\n \"index\": \"products\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->searchApplication()->postBehavioralAnalyticsEvent([\n \"collection_name\" => \"my_analytics_collection\",\n \"event_type\" => \"search_click\",\n \"body\" => [\n \"session\" => [\n \"id\" => \"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\",\n ],\n \"user\" => [\n \"id\" => \"5f26f01a-bbee-4202-9298-81261067abbd\",\n ],\n \"search\" => [\n \"query\" => \"search term\",\n \"results\" => [\n \"items\" => array(\n [\n \"document\" => [\n \"id\" => \"123\",\n \"index\" => \"products\",\n ],\n ],\n ),\n \"total_results\" => 10,\n ],\n \"sort\" => [\n \"name\" => \"relevance\",\n ],\n \"search_application\" => \"website\",\n ],\n \"document\" => [\n \"id\" => \"123\",\n \"index\" => \"products\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"session\":{\"id\":\"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\"},\"user\":{\"id\":\"5f26f01a-bbee-4202-9298-81261067abbd\"},\"search\":{\"query\":\"search term\",\"results\":{\"items\":[{\"document\":{\"id\":\"123\",\"index\":\"products\"}}],\"total_results\":10},\"sort\":{\"name\":\"relevance\"},\"search_application\":\"website\"},\"document\":{\"id\":\"123\",\"index\":\"products\"}}' \"$ELASTICSEARCH_URL/_application/analytics/my_analytics_collection/event/search_click\"", + "language": "curl" + } + ], "description": "Run `POST _application/analytics/my_analytics_collection/event/search_click` to send a `search_click` event to an analytics collection called `my_analytics_collection`.", "method_request": "POST _application/analytics/my_analytics_collection/event/search_click", "value": "{\n \"session\": {\n \"id\": \"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\"\n },\n \"user\": {\n \"id\": \"5f26f01a-bbee-4202-9298-81261067abbd\"\n },\n \"search\":{\n \"query\": \"search term\",\n \"results\": {\n \"items\": [\n {\n \"document\": {\n \"id\": \"123\",\n \"index\": \"products\"\n }\n }\n ],\n \"total_results\": 10\n },\n \"sort\": {\n \"name\": \"relevance\"\n },\n \"search_application\": \"website\"\n },\n \"document\":{\n \"id\": \"123\",\n \"index\": \"products\"\n }\n}" @@ -208497,6 +218554,28 @@ "description": "Create or update a search application.", "examples": { "SearchApplicationPutRequestExample1": { + "alternatives": [ + { + "code": "resp = client.search_application.put(\n name=\"my-app\",\n search_application={\n \"indices\": [\n \"index1\",\n \"index2\"\n ],\n \"template\": {\n \"script\": {\n \"source\": {\n \"query\": {\n \"query_string\": {\n \"query\": \"{{query_string}}\",\n \"default_field\": \"{{default_field}}\"\n }\n }\n },\n \"params\": {\n \"query_string\": \"*\",\n \"default_field\": \"*\"\n }\n },\n \"dictionary\": {\n \"properties\": {\n \"query_string\": {\n \"type\": \"string\"\n },\n \"default_field\": {\n \"type\": \"string\",\n \"enum\": [\n \"title\",\n \"description\"\n ]\n },\n \"additionalProperties\": False\n },\n \"required\": [\n \"query_string\"\n ]\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.searchApplication.put({\n name: \"my-app\",\n search_application: {\n indices: [\"index1\", \"index2\"],\n template: {\n script: {\n source: {\n query: {\n query_string: {\n query: \"{{query_string}}\",\n default_field: \"{{default_field}}\",\n },\n },\n },\n params: {\n query_string: \"*\",\n default_field: \"*\",\n },\n },\n dictionary: {\n properties: {\n query_string: {\n type: \"string\",\n },\n default_field: {\n type: \"string\",\n enum: [\"title\", \"description\"],\n },\n additionalProperties: false,\n },\n required: [\"query_string\"],\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.search_application.put(\n name: \"my-app\",\n body: {\n \"indices\": [\n \"index1\",\n \"index2\"\n ],\n \"template\": {\n \"script\": {\n \"source\": {\n \"query\": {\n \"query_string\": {\n \"query\": \"{{query_string}}\",\n \"default_field\": \"{{default_field}}\"\n }\n }\n },\n \"params\": {\n \"query_string\": \"*\",\n \"default_field\": \"*\"\n }\n },\n \"dictionary\": {\n \"properties\": {\n \"query_string\": {\n \"type\": \"string\"\n },\n \"default_field\": {\n \"type\": \"string\",\n \"enum\": [\n \"title\",\n \"description\"\n ]\n },\n \"additionalProperties\": false\n },\n \"required\": [\n \"query_string\"\n ]\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->searchApplication()->put([\n \"name\" => \"my-app\",\n \"body\" => [\n \"indices\" => array(\n \"index1\",\n \"index2\",\n ),\n \"template\" => [\n \"script\" => [\n \"source\" => [\n \"query\" => [\n \"query_string\" => [\n \"query\" => \"{{query_string}}\",\n \"default_field\" => \"{{default_field}}\",\n ],\n ],\n ],\n \"params\" => [\n \"query_string\" => \"*\",\n \"default_field\" => \"*\",\n ],\n ],\n \"dictionary\" => [\n \"properties\" => [\n \"query_string\" => [\n \"type\" => \"string\",\n ],\n \"default_field\" => [\n \"type\" => \"string\",\n \"enum\" => array(\n \"title\",\n \"description\",\n ),\n ],\n \"additionalProperties\" => false,\n ],\n \"required\" => array(\n \"query_string\",\n ),\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"indices\":[\"index1\",\"index2\"],\"template\":{\"script\":{\"source\":{\"query\":{\"query_string\":{\"query\":\"{{query_string}}\",\"default_field\":\"{{default_field}}\"}}},\"params\":{\"query_string\":\"*\",\"default_field\":\"*\"}},\"dictionary\":{\"properties\":{\"query_string\":{\"type\":\"string\"},\"default_field\":{\"type\":\"string\",\"enum\":[\"title\",\"description\"]},\"additionalProperties\":false},\"required\":[\"query_string\"]}}}' \"$ELASTICSEARCH_URL/_application/search_application/my-app\"", + "language": "curl" + } + ], "description": "Run `PUT _application/search_application/my-app` to create or update a search application called `my-app`. When the dictionary parameter is specified, the search application search API will perform the following parameter validation: it accepts only the `query_string` and `default_field` parameters; it verifies that `query_string` and `default_field` are both strings; it accepts `default_field` only if it takes the values title or description. If the parameters are not valid, the search application search API will return an error.\n", "method_request": "PUT _application/search_application/my-app", "value": "{\n \"indices\": [ \"index1\", \"index2\" ],\n \"template\": {\n \"script\": {\n \"source\": {\n \"query\": {\n \"query_string\": {\n \"query\": \"{{query_string}}\",\n \"default_field\": \"{{default_field}}\"\n }\n }\n },\n \"params\": {\n \"query_string\": \"*\",\n \"default_field\": \"*\"\n }\n },\n \"dictionary\": {\n \"properties\": {\n \"query_string\": {\n \"type\": \"string\"\n },\n \"default_field\": {\n \"type\": \"string\",\n \"enum\": [\n \"title\",\n \"description\"\n ]\n },\n \"additionalProperties\": false\n },\n \"required\": [\n \"query_string\"\n ]\n }\n }\n}" @@ -208610,6 +218689,28 @@ "description": "Create a behavioral analytics collection.", "examples": { "SearchApplicationPutBehavioralAnalyticsExample1": { + "alternatives": [ + { + "code": "resp = client.search_application.put_behavioral_analytics(\n name=\"my_analytics_collection\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.searchApplication.putBehavioralAnalytics({\n name: \"my_analytics_collection\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.search_application.put_behavioral_analytics(\n name: \"my_analytics_collection\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->searchApplication()->putBehavioralAnalytics([\n \"name\" => \"my_analytics_collection\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/analytics/my_analytics_collection\"", + "language": "curl" + } + ], "method_request": "PUT _application/analytics/my_analytics_collection" } }, @@ -208690,6 +218791,28 @@ "description": "Render a search application query.\nGenerate an Elasticsearch query using the specified query parameters and the search template associated with the search application or a default template if none is specified.\nIf a parameter used in the search template is not specified in `params`, the parameter's default value will be used.\nThe API returns the specific Elasticsearch query that would be generated and run by calling the search application search API.\n\nYou must have `read` privileges on the backing alias of the search application.", "examples": { "SearchApplicationsRenderQueryRequestExample1": { + "alternatives": [ + { + "code": "resp = client.search_application.render_query(\n name=\"my-app\",\n params={\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\n \"name\": \"title\",\n \"boost\": 5\n },\n {\n \"name\": \"description\",\n \"boost\": 1\n }\n ]\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.searchApplication.renderQuery({\n name: \"my-app\",\n params: {\n query_string: \"my first query\",\n text_fields: [\n {\n name: \"title\",\n boost: 5,\n },\n {\n name: \"description\",\n boost: 1,\n },\n ],\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.search_application.render_query(\n name: \"my-app\",\n body: {\n \"params\": {\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\n \"name\": \"title\",\n \"boost\": 5\n },\n {\n \"name\": \"description\",\n \"boost\": 1\n }\n ]\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->searchApplication()->renderQuery([\n \"name\" => \"my-app\",\n \"body\" => [\n \"params\" => [\n \"query_string\" => \"my first query\",\n \"text_fields\" => array(\n [\n \"name\" => \"title\",\n \"boost\" => 5,\n ],\n [\n \"name\" => \"description\",\n \"boost\" => 1,\n ],\n ),\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"params\":{\"query_string\":\"my first query\",\"text_fields\":[{\"name\":\"title\",\"boost\":5},{\"name\":\"description\",\"boost\":1}]}}' \"$ELASTICSEARCH_URL/_application/search_application/my-app/_render_query\"", + "language": "curl" + } + ], "description": "Run `POST _application/search_application/my-app/_render_query` to generate a query for a search application called `my-app` that uses the search template.", "method_request": "POST _application/search_application/my-app/_render_query", "value": "{\n \"params\": {\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\n \"name\": \"title\",\n \"boost\": 5\n },\n {\n \"name\": \"description\",\n \"boost\": 1\n }\n ]\n }\n}" @@ -208772,6 +218895,28 @@ "description": "Run a search application search.\nGenerate and run an Elasticsearch query that uses the specified query parameteter and the search template associated with the search application or default template.\nUnspecified template parameters are assigned their default values if applicable.", "examples": { "SearchApplicationsSearchRequestExample1": { + "alternatives": [ + { + "code": "resp = client.search_application.search(\n name=\"my-app\",\n params={\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\n \"name\": \"title\",\n \"boost\": 5\n },\n {\n \"name\": \"description\",\n \"boost\": 1\n }\n ]\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.searchApplication.search({\n name: \"my-app\",\n params: {\n query_string: \"my first query\",\n text_fields: [\n {\n name: \"title\",\n boost: 5,\n },\n {\n name: \"description\",\n boost: 1,\n },\n ],\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.search_application.search(\n name: \"my-app\",\n body: {\n \"params\": {\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\n \"name\": \"title\",\n \"boost\": 5\n },\n {\n \"name\": \"description\",\n \"boost\": 1\n }\n ]\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->searchApplication()->search([\n \"name\" => \"my-app\",\n \"body\" => [\n \"params\" => [\n \"query_string\" => \"my first query\",\n \"text_fields\" => array(\n [\n \"name\" => \"title\",\n \"boost\" => 5,\n ],\n [\n \"name\" => \"description\",\n \"boost\" => 1,\n ],\n ),\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"params\":{\"query_string\":\"my first query\",\"text_fields\":[{\"name\":\"title\",\"boost\":5},{\"name\":\"description\",\"boost\":1}]}}' \"$ELASTICSEARCH_URL/_application/search_application/my-app/_search\"", + "language": "curl" + } + ], "description": "Use `POST _application/search_application/my-app/_search` to run a search against a search application called `my-app` that uses a search template.", "method_request": "POST _application/search_application/my-app/_search", "value": "{\n \"params\": {\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\"name\": \"title\", \"boost\": 5},\n {\"name\": \"description\", \"boost\": 1}\n ]\n }\n}" @@ -208909,6 +219054,28 @@ "description": "Get cache statistics.\nGet statistics about the shared cache for partially mounted indices.", "examples": { "CacheStatsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.searchable_snapshots.cache_stats()", + "language": "Python" + }, + { + "code": "const response = await client.searchableSnapshots.cacheStats();", + "language": "JavaScript" + }, + { + "code": "response = client.searchable_snapshots.cache_stats", + "language": "Ruby" + }, + { + "code": "$resp = $client->searchableSnapshots()->cacheStats();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_searchable_snapshots/cache/stats\"", + "language": "curl" + } + ], "method_request": "GET /_searchable_snapshots/cache/stats" } }, @@ -209101,6 +219268,28 @@ "description": "Clear the cache.\nClear indices and data streams from the shared cache for partially mounted indices.", "examples": { "SearchableSnapshotsClearCacheExample1": { + "alternatives": [ + { + "code": "resp = client.searchable_snapshots.clear_cache(\n index=\"my-index\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.searchableSnapshots.clearCache({\n index: \"my-index\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.searchable_snapshots.clear_cache(\n index: \"my-index\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->searchableSnapshots()->clearCache([\n \"index\" => \"my-index\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index/_searchable_snapshots/cache/clear\"", + "language": "curl" + } + ], "method_request": "POST /my-index/_searchable_snapshots/cache/clear" } }, @@ -209297,6 +219486,28 @@ "description": "Mount a snapshot.\nMount a snapshot as a searchable snapshot index.\nDo not use this API for snapshots managed by index lifecycle management (ILM).\nManually mounting ILM-managed snapshots can interfere with ILM processes.", "examples": { "SearchableSnapshotsMountSnapshotRequestExample1": { + "alternatives": [ + { + "code": "resp = client.searchable_snapshots.mount(\n repository=\"my_repository\",\n snapshot=\"my_snapshot\",\n wait_for_completion=True,\n index=\"my_docs\",\n renamed_index=\"docs\",\n index_settings={\n \"index.number_of_replicas\": 0\n },\n ignore_index_settings=[\n \"index.refresh_interval\"\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.searchableSnapshots.mount({\n repository: \"my_repository\",\n snapshot: \"my_snapshot\",\n wait_for_completion: \"true\",\n index: \"my_docs\",\n renamed_index: \"docs\",\n index_settings: {\n \"index.number_of_replicas\": 0,\n },\n ignore_index_settings: [\"index.refresh_interval\"],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.searchable_snapshots.mount(\n repository: \"my_repository\",\n snapshot: \"my_snapshot\",\n wait_for_completion: \"true\",\n body: {\n \"index\": \"my_docs\",\n \"renamed_index\": \"docs\",\n \"index_settings\": {\n \"index.number_of_replicas\": 0\n },\n \"ignore_index_settings\": [\n \"index.refresh_interval\"\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->searchableSnapshots()->mount([\n \"repository\" => \"my_repository\",\n \"snapshot\" => \"my_snapshot\",\n \"wait_for_completion\" => \"true\",\n \"body\" => [\n \"index\" => \"my_docs\",\n \"renamed_index\" => \"docs\",\n \"index_settings\" => [\n \"index.number_of_replicas\" => 0,\n ],\n \"ignore_index_settings\" => array(\n \"index.refresh_interval\",\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index\":\"my_docs\",\"renamed_index\":\"docs\",\"index_settings\":{\"index.number_of_replicas\":0},\"ignore_index_settings\":[\"index.refresh_interval\"]}' \"$ELASTICSEARCH_URL/_snapshot/my_repository/my_snapshot/_mount?wait_for_completion=true\"", + "language": "curl" + } + ], "description": "Run `POST /_snapshot/my_repository/my_snapshot/_mount?wait_for_completion=true` to mount the index `my_docs` from an existing snapshot named `my_snapshot` stored in `my_repository` as a new index `docs`.\n", "method_request": "POST /_snapshot/my_repository/my_snapshot/_mount?wait_for_completion=true", "summary": null, @@ -209417,6 +219628,28 @@ "description": "Get searchable snapshot statistics.", "examples": { "SearchableSnapshotsStatsExample1": { + "alternatives": [ + { + "code": "resp = client.searchable_snapshots.stats(\n index=\"my-index\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.searchableSnapshots.stats({\n index: \"my-index\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.searchable_snapshots.stats(\n index: \"my-index\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->searchableSnapshots()->stats([\n \"index\" => \"my-index\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index/_searchable_snapshots/stats\"", + "language": "curl" + } + ], "method_request": "GET /my-index/_searchable_snapshots/stats" } }, @@ -212420,6 +222653,28 @@ "description": "Activate a user profile.\n\nCreate or update a user profile on behalf of another user.\n\nNOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions.\nIndividual users and external applications should not call this API directly.\nThe calling application must have either an `access_token` or a combination of `username` and `password` for the user that the profile document is intended for.\nElastic reserves the right to change or remove this feature in future releases without prior notice.\n\nThis API creates or updates a profile document for end users with information that is extracted from the user's authentication object including `username`, `full_name,` `roles`, and the authentication realm.\nFor example, in the JWT `access_token` case, the profile user's `username` is extracted from the JWT token claim pointed to by the `claims.principal` setting of the JWT realm that authenticated the token.\n\nWhen updating a profile document, the API enables the document if it was disabled.\nAny updates do not change existing content for either the `labels` or `data` fields.", "examples": { "ActivateUserProfileRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.activate_user_profile(\n grant_type=\"password\",\n username=\"jacknich\",\n password=\"l0ng-r4nd0m-p@ssw0rd\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.activateUserProfile({\n grant_type: \"password\",\n username: \"jacknich\",\n password: \"l0ng-r4nd0m-p@ssw0rd\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.activate_user_profile(\n body: {\n \"grant_type\": \"password\",\n \"username\": \"jacknich\",\n \"password\": \"l0ng-r4nd0m-p@ssw0rd\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->activateUserProfile([\n \"body\" => [\n \"grant_type\" => \"password\",\n \"username\" => \"jacknich\",\n \"password\" => \"l0ng-r4nd0m-p@ssw0rd\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"grant_type\":\"password\",\"username\":\"jacknich\",\"password\":\"l0ng-r4nd0m-p@ssw0rd\"}' \"$ELASTICSEARCH_URL/_security/profile/_activate\"", + "language": "curl" + } + ], "description": "Run `POST /_security/profile/_activate` to activate a user profile.\n", "method_request": "POST /_security/profile/_activate", "value": "{\n \"grant_type\": \"password\",\n \"username\" : \"jacknich\",\n \"password\" : \"l0ng-r4nd0m-p@ssw0rd\"\n}" @@ -212507,6 +222762,28 @@ "description": "Authenticate a user.\n\nAuthenticates a user and returns information about the authenticated user.\nInclude the user information in a [basic auth header](https://en.wikipedia.org/wiki/Basic_access_authentication).\nA successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user.\nIf the user cannot be authenticated, this API returns a 401 status code.", "examples": { "SecurityAuthenticateRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.authenticate()", + "language": "Python" + }, + { + "code": "const response = await client.security.authenticate();", + "language": "JavaScript" + }, + { + "code": "response = client.security.authenticate", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->authenticate();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/_authenticate\"", + "language": "curl" + } + ], "method_request": "GET /_security/_authenticate" } }, @@ -212763,6 +223040,28 @@ "description": "Bulk delete roles.\n\nThe role management APIs are generally the preferred way to manage roles, rather than using file-based role management.\nThe bulk delete roles API cannot delete roles that are defined in roles files.", "examples": { "SecurityBulkDeleteRoleRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.bulk_delete_role(\n names=[\n \"my_admin_role\",\n \"my_user_role\"\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.bulkDeleteRole({\n names: [\"my_admin_role\", \"my_user_role\"],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.bulk_delete_role(\n body: {\n \"names\": [\n \"my_admin_role\",\n \"my_user_role\"\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->bulkDeleteRole([\n \"body\" => [\n \"names\" => array(\n \"my_admin_role\",\n \"my_user_role\",\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"names\":[\"my_admin_role\",\"my_user_role\"]}' \"$ELASTICSEARCH_URL/_security/role\"", + "language": "curl" + } + ], "description": "Run DELETE /_security/role` to delete `my_admin_role` and `my_user_role` roles.\n", "method_request": "DELETE /_security/role", "summary": "Bulk delete example 1", @@ -212904,18 +223203,84 @@ "description": "Bulk create or update roles.\n\nThe role management APIs are generally the preferred way to manage roles, rather than using file-based role management.\nThe bulk create or update roles API cannot update roles that are defined in roles files.", "examples": { "SecurityBulkPutRoleRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.bulk_put_role(\n roles={\n \"my_admin_role\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index1\",\n \"index2\"\n ],\n \"privileges\": [\n \"all\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n \"run_as\": [\n \"other_user\"\n ],\n \"metadata\": {\n \"version\": 1\n }\n },\n \"my_user_role\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index1\"\n ],\n \"privileges\": [\n \"read\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n \"run_as\": [\n \"other_user\"\n ],\n \"metadata\": {\n \"version\": 1\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.bulkPutRole({\n roles: {\n my_admin_role: {\n cluster: [\"all\"],\n indices: [\n {\n names: [\"index1\", \"index2\"],\n privileges: [\"all\"],\n field_security: {\n grant: [\"title\", \"body\"],\n },\n query: '{\"match\": {\"title\": \"foo\"}}',\n },\n ],\n applications: [\n {\n application: \"myapp\",\n privileges: [\"admin\", \"read\"],\n resources: [\"*\"],\n },\n ],\n run_as: [\"other_user\"],\n metadata: {\n version: 1,\n },\n },\n my_user_role: {\n cluster: [\"all\"],\n indices: [\n {\n names: [\"index1\"],\n privileges: [\"read\"],\n field_security: {\n grant: [\"title\", \"body\"],\n },\n query: '{\"match\": {\"title\": \"foo\"}}',\n },\n ],\n applications: [\n {\n application: \"myapp\",\n privileges: [\"admin\", \"read\"],\n resources: [\"*\"],\n },\n ],\n run_as: [\"other_user\"],\n metadata: {\n version: 1,\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.bulk_put_role(\n body: {\n \"roles\": {\n \"my_admin_role\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index1\",\n \"index2\"\n ],\n \"privileges\": [\n \"all\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n \"run_as\": [\n \"other_user\"\n ],\n \"metadata\": {\n \"version\": 1\n }\n },\n \"my_user_role\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index1\"\n ],\n \"privileges\": [\n \"read\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n \"run_as\": [\n \"other_user\"\n ],\n \"metadata\": {\n \"version\": 1\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->bulkPutRole([\n \"body\" => [\n \"roles\" => [\n \"my_admin_role\" => [\n \"cluster\" => array(\n \"all\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index1\",\n \"index2\",\n ),\n \"privileges\" => array(\n \"all\",\n ),\n \"field_security\" => [\n \"grant\" => array(\n \"title\",\n \"body\",\n ),\n ],\n \"query\" => \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\",\n ],\n ),\n \"applications\" => array(\n [\n \"application\" => \"myapp\",\n \"privileges\" => array(\n \"admin\",\n \"read\",\n ),\n \"resources\" => array(\n \"*\",\n ),\n ],\n ),\n \"run_as\" => array(\n \"other_user\",\n ),\n \"metadata\" => [\n \"version\" => 1,\n ],\n ],\n \"my_user_role\" => [\n \"cluster\" => array(\n \"all\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index1\",\n ),\n \"privileges\" => array(\n \"read\",\n ),\n \"field_security\" => [\n \"grant\" => array(\n \"title\",\n \"body\",\n ),\n ],\n \"query\" => \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\",\n ],\n ),\n \"applications\" => array(\n [\n \"application\" => \"myapp\",\n \"privileges\" => array(\n \"admin\",\n \"read\",\n ),\n \"resources\" => array(\n \"*\",\n ),\n ],\n ),\n \"run_as\" => array(\n \"other_user\",\n ),\n \"metadata\" => [\n \"version\" => 1,\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"roles\":{\"my_admin_role\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index1\",\"index2\"],\"privileges\":[\"all\"],\"field_security\":{\"grant\":[\"title\",\"body\"]},\"query\":\"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"}],\"applications\":[{\"application\":\"myapp\",\"privileges\":[\"admin\",\"read\"],\"resources\":[\"*\"]}],\"run_as\":[\"other_user\"],\"metadata\":{\"version\":1}},\"my_user_role\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index1\"],\"privileges\":[\"read\"],\"field_security\":{\"grant\":[\"title\",\"body\"]},\"query\":\"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"}],\"applications\":[{\"application\":\"myapp\",\"privileges\":[\"admin\",\"read\"],\"resources\":[\"*\"]}],\"run_as\":[\"other_user\"],\"metadata\":{\"version\":1}}}}' \"$ELASTICSEARCH_URL/_security/role\"", + "language": "curl" + } + ], "description": "Run `POST /_security/role` to add roles called `my_admin_role` and `my_user_role`.\n", "method_request": "POST /_security/role", "summary": "Bulk role success", "value": "{\n \"roles\": {\n \"my_admin_role\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index1\",\n \"index2\"\n ],\n \"privileges\": [\n \"all\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n \"run_as\": [\n \"other_user\"\n ],\n \"metadata\": {\n \"version\": 1\n }\n },\n \"my_user_role\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index1\"\n ],\n \"privileges\": [\n \"read\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n \"run_as\": [\n \"other_user\"\n ],\n \"metadata\": {\n \"version\": 1\n }\n }\n }\n}" }, "SecurityBulkPutRoleRequestExample2": { + "alternatives": [ + { + "code": "resp = client.security.bulk_put_role(\n roles={\n \"my_admin_role\": {\n \"cluster\": [\n \"bad_cluster_privilege\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index1\",\n \"index2\"\n ],\n \"privileges\": [\n \"all\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n \"run_as\": [\n \"other_user\"\n ],\n \"metadata\": {\n \"version\": 1\n }\n },\n \"my_user_role\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index1\"\n ],\n \"privileges\": [\n \"read\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n \"run_as\": [\n \"other_user\"\n ],\n \"metadata\": {\n \"version\": 1\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.bulkPutRole({\n roles: {\n my_admin_role: {\n cluster: [\"bad_cluster_privilege\"],\n indices: [\n {\n names: [\"index1\", \"index2\"],\n privileges: [\"all\"],\n field_security: {\n grant: [\"title\", \"body\"],\n },\n query: '{\"match\": {\"title\": \"foo\"}}',\n },\n ],\n applications: [\n {\n application: \"myapp\",\n privileges: [\"admin\", \"read\"],\n resources: [\"*\"],\n },\n ],\n run_as: [\"other_user\"],\n metadata: {\n version: 1,\n },\n },\n my_user_role: {\n cluster: [\"all\"],\n indices: [\n {\n names: [\"index1\"],\n privileges: [\"read\"],\n field_security: {\n grant: [\"title\", \"body\"],\n },\n query: '{\"match\": {\"title\": \"foo\"}}',\n },\n ],\n applications: [\n {\n application: \"myapp\",\n privileges: [\"admin\", \"read\"],\n resources: [\"*\"],\n },\n ],\n run_as: [\"other_user\"],\n metadata: {\n version: 1,\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.bulk_put_role(\n body: {\n \"roles\": {\n \"my_admin_role\": {\n \"cluster\": [\n \"bad_cluster_privilege\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index1\",\n \"index2\"\n ],\n \"privileges\": [\n \"all\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n \"run_as\": [\n \"other_user\"\n ],\n \"metadata\": {\n \"version\": 1\n }\n },\n \"my_user_role\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index1\"\n ],\n \"privileges\": [\n \"read\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n \"run_as\": [\n \"other_user\"\n ],\n \"metadata\": {\n \"version\": 1\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->bulkPutRole([\n \"body\" => [\n \"roles\" => [\n \"my_admin_role\" => [\n \"cluster\" => array(\n \"bad_cluster_privilege\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index1\",\n \"index2\",\n ),\n \"privileges\" => array(\n \"all\",\n ),\n \"field_security\" => [\n \"grant\" => array(\n \"title\",\n \"body\",\n ),\n ],\n \"query\" => \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\",\n ],\n ),\n \"applications\" => array(\n [\n \"application\" => \"myapp\",\n \"privileges\" => array(\n \"admin\",\n \"read\",\n ),\n \"resources\" => array(\n \"*\",\n ),\n ],\n ),\n \"run_as\" => array(\n \"other_user\",\n ),\n \"metadata\" => [\n \"version\" => 1,\n ],\n ],\n \"my_user_role\" => [\n \"cluster\" => array(\n \"all\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index1\",\n ),\n \"privileges\" => array(\n \"read\",\n ),\n \"field_security\" => [\n \"grant\" => array(\n \"title\",\n \"body\",\n ),\n ],\n \"query\" => \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\",\n ],\n ),\n \"applications\" => array(\n [\n \"application\" => \"myapp\",\n \"privileges\" => array(\n \"admin\",\n \"read\",\n ),\n \"resources\" => array(\n \"*\",\n ),\n ],\n ),\n \"run_as\" => array(\n \"other_user\",\n ),\n \"metadata\" => [\n \"version\" => 1,\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"roles\":{\"my_admin_role\":{\"cluster\":[\"bad_cluster_privilege\"],\"indices\":[{\"names\":[\"index1\",\"index2\"],\"privileges\":[\"all\"],\"field_security\":{\"grant\":[\"title\",\"body\"]},\"query\":\"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"}],\"applications\":[{\"application\":\"myapp\",\"privileges\":[\"admin\",\"read\"],\"resources\":[\"*\"]}],\"run_as\":[\"other_user\"],\"metadata\":{\"version\":1}},\"my_user_role\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index1\"],\"privileges\":[\"read\"],\"field_security\":{\"grant\":[\"title\",\"body\"]},\"query\":\"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"}],\"applications\":[{\"application\":\"myapp\",\"privileges\":[\"admin\",\"read\"],\"resources\":[\"*\"]}],\"run_as\":[\"other_user\"],\"metadata\":{\"version\":1}}}}' \"$ELASTICSEARCH_URL/_security/role\"", + "language": "curl" + } + ], "description": "Because errors are handled individually for each role create or update, the API allows partial success. For example, `POST /_security/role` would throw an error for `my_admin_role` because the privilege `bad_cluster_privilege` doesn't exist, but would be successful for the `my_user_role`.\n", "method_request": "POST /_security/role", "summary": "Bulk role errors", "value": "{\n \"roles\": {\n \"my_admin_role\": {\n \"cluster\": [\n \"bad_cluster_privilege\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index1\",\n \"index2\"\n ],\n \"privileges\": [\"all\"],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n \"run_as\": [\n \"other_user\"\n ],\n \"metadata\": {\n \"version\": 1\n }\n },\n \"my_user_role\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index1\"\n ],\n \"privileges\": [\n \"read\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n \"run_as\": [\n \"other_user\"\n ],\n \"metadata\": {\n \"version\": 1\n }\n }\n }\n}" }, "SecurityBulkPutRoleRequestExample3": { + "alternatives": [ + { + "code": "resp = client.security.put_role(\n name=\"only_remote_access_role\",\n remote_indices=[\n {\n \"clusters\": [\n \"my_remote\"\n ],\n \"names\": [\n \"logs*\"\n ],\n \"privileges\": [\n \"read\",\n \"read_cross_cluster\",\n \"view_index_metadata\"\n ]\n }\n ],\n remote_cluster=[\n {\n \"clusters\": [\n \"my_remote\"\n ],\n \"privileges\": [\n \"monitor_stats\"\n ]\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.putRole({\n name: \"only_remote_access_role\",\n remote_indices: [\n {\n clusters: [\"my_remote\"],\n names: [\"logs*\"],\n privileges: [\"read\", \"read_cross_cluster\", \"view_index_metadata\"],\n },\n ],\n remote_cluster: [\n {\n clusters: [\"my_remote\"],\n privileges: [\"monitor_stats\"],\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.put_role(\n name: \"only_remote_access_role\",\n body: {\n \"remote_indices\": [\n {\n \"clusters\": [\n \"my_remote\"\n ],\n \"names\": [\n \"logs*\"\n ],\n \"privileges\": [\n \"read\",\n \"read_cross_cluster\",\n \"view_index_metadata\"\n ]\n }\n ],\n \"remote_cluster\": [\n {\n \"clusters\": [\n \"my_remote\"\n ],\n \"privileges\": [\n \"monitor_stats\"\n ]\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->putRole([\n \"name\" => \"only_remote_access_role\",\n \"body\" => [\n \"remote_indices\" => array(\n [\n \"clusters\" => array(\n \"my_remote\",\n ),\n \"names\" => array(\n \"logs*\",\n ),\n \"privileges\" => array(\n \"read\",\n \"read_cross_cluster\",\n \"view_index_metadata\",\n ),\n ],\n ),\n \"remote_cluster\" => array(\n [\n \"clusters\" => array(\n \"my_remote\",\n ),\n \"privileges\" => array(\n \"monitor_stats\",\n ),\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"remote_indices\":[{\"clusters\":[\"my_remote\"],\"names\":[\"logs*\"],\"privileges\":[\"read\",\"read_cross_cluster\",\"view_index_metadata\"]}],\"remote_cluster\":[{\"clusters\":[\"my_remote\"],\"privileges\":[\"monitor_stats\"]}]}' \"$ELASTICSEARCH_URL/_security/role/only_remote_access_role\"", + "language": "curl" + } + ], "description": "Run `POST /_security/role/only_remote_access_role` to configure a role with remote indices and remote cluster privileges for a remote cluster.", "method_request": "POST /_security/role/only_remote_access_role", "summary": "Role example 3", @@ -213118,11 +223483,57 @@ "description": "Bulk update API keys.\nUpdate the attributes for multiple API keys.\n\nIMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required.\n\nThis API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates.\n\nIt is not possible to update expired or invalidated API keys.\n\nThis API supports updates to API key access scope, metadata and expiration.\nThe access scope of each API key is derived from the `role_descriptors` you specify in the request and a snapshot of the owner user's permissions at the time of the request.\nThe snapshot of the owner's permissions is updated automatically on every call.\n\nIMPORTANT: If you don't specify `role_descriptors` in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified.\n\nA successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update.", "examples": { "SecurityBulkUpdateApiKeysRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.bulk_update_api_keys(\n ids=[\n \"VuaCfGcBCdbkQm-e5aOx\",\n \"H3_AhoIBA9hmeQJdg7ij\"\n ],\n role_descriptors={\n \"role-a\": {\n \"indices\": [\n {\n \"names\": [\n \"*\"\n ],\n \"privileges\": [\n \"write\"\n ]\n }\n ]\n }\n },\n metadata={\n \"environment\": {\n \"level\": 2,\n \"trusted\": True,\n \"tags\": [\n \"production\"\n ]\n }\n },\n expiration=\"30d\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.bulkUpdateApiKeys({\n ids: [\"VuaCfGcBCdbkQm-e5aOx\", \"H3_AhoIBA9hmeQJdg7ij\"],\n role_descriptors: {\n \"role-a\": {\n indices: [\n {\n names: [\"*\"],\n privileges: [\"write\"],\n },\n ],\n },\n },\n metadata: {\n environment: {\n level: 2,\n trusted: true,\n tags: [\"production\"],\n },\n },\n expiration: \"30d\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.bulk_update_api_keys(\n body: {\n \"ids\": [\n \"VuaCfGcBCdbkQm-e5aOx\",\n \"H3_AhoIBA9hmeQJdg7ij\"\n ],\n \"role_descriptors\": {\n \"role-a\": {\n \"indices\": [\n {\n \"names\": [\n \"*\"\n ],\n \"privileges\": [\n \"write\"\n ]\n }\n ]\n }\n },\n \"metadata\": {\n \"environment\": {\n \"level\": 2,\n \"trusted\": true,\n \"tags\": [\n \"production\"\n ]\n }\n },\n \"expiration\": \"30d\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->bulkUpdateApiKeys([\n \"body\" => [\n \"ids\" => array(\n \"VuaCfGcBCdbkQm-e5aOx\",\n \"H3_AhoIBA9hmeQJdg7ij\",\n ),\n \"role_descriptors\" => [\n \"role-a\" => [\n \"indices\" => array(\n [\n \"names\" => array(\n \"*\",\n ),\n \"privileges\" => array(\n \"write\",\n ),\n ],\n ),\n ],\n ],\n \"metadata\" => [\n \"environment\" => [\n \"level\" => 2,\n \"trusted\" => true,\n \"tags\" => array(\n \"production\",\n ),\n ],\n ],\n \"expiration\" => \"30d\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"ids\":[\"VuaCfGcBCdbkQm-e5aOx\",\"H3_AhoIBA9hmeQJdg7ij\"],\"role_descriptors\":{\"role-a\":{\"indices\":[{\"names\":[\"*\"],\"privileges\":[\"write\"]}]}},\"metadata\":{\"environment\":{\"level\":2,\"trusted\":true,\"tags\":[\"production\"]}},\"expiration\":\"30d\"}' \"$ELASTICSEARCH_URL/_security/api_key/_bulk_update\"", + "language": "curl" + } + ], "description": "Assign new role descriptors and metadata and update the expiration time for two API keys.", + "method_request": "POST /_security/api_key/_bulk_update", "value": "{\n \"ids\": [\n \"VuaCfGcBCdbkQm-e5aOx\",\n \"H3_AhoIBA9hmeQJdg7ij\"\n ],\n \"role_descriptors\": {\n \"role-a\": {\n \"indices\": [\n {\n \"names\": [\n \"*\"\n ],\n \"privileges\": [\n \"write\"\n ]\n }\n ]\n }\n },\n \"metadata\": {\n \"environment\": {\n \"level\": 2,\n \"trusted\": true,\n \"tags\": [\n \"production\"\n ]\n }\n },\n \"expiration\": \"30d\"\n}" }, "SecurityBulkUpdateApiKeysRequestExample2": { + "alternatives": [ + { + "code": "resp = client.security.bulk_update_api_keys(\n ids=[\n \"VuaCfGcBCdbkQm-e5aOx\",\n \"H3_AhoIBA9hmeQJdg7ij\"\n ],\n role_descriptors={},\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.bulkUpdateApiKeys({\n ids: [\"VuaCfGcBCdbkQm-e5aOx\", \"H3_AhoIBA9hmeQJdg7ij\"],\n role_descriptors: {},\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.bulk_update_api_keys(\n body: {\n \"ids\": [\n \"VuaCfGcBCdbkQm-e5aOx\",\n \"H3_AhoIBA9hmeQJdg7ij\"\n ],\n \"role_descriptors\": {}\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->bulkUpdateApiKeys([\n \"body\" => [\n \"ids\" => array(\n \"VuaCfGcBCdbkQm-e5aOx\",\n \"H3_AhoIBA9hmeQJdg7ij\",\n ),\n \"role_descriptors\" => new ArrayObject([]),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"ids\":[\"VuaCfGcBCdbkQm-e5aOx\",\"H3_AhoIBA9hmeQJdg7ij\"],\"role_descriptors\":{}}' \"$ELASTICSEARCH_URL/_security/api_key/_bulk_update\"", + "language": "curl" + } + ], "description": "Remove the previously assigned permissions for two API keys, making them inherit the owner user's full permissions.", + "method_request": "POST /_security/api_key/_bulk_update", "value": "{\n \"ids\": [\n \"VuaCfGcBCdbkQm-e5aOx\",\n \"H3_AhoIBA9hmeQJdg7ij\"\n ],\n \"role_descriptors\": {}\n}" } }, @@ -213235,6 +223646,28 @@ "description": "Change passwords.\n\nChange the passwords of users in the native realm and built-in users.", "examples": { "SecurityChangePasswordRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.change_password(\n username=\"jacknich\",\n password=\"new-test-password\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.changePassword({\n username: \"jacknich\",\n password: \"new-test-password\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.change_password(\n username: \"jacknich\",\n body: {\n \"password\": \"new-test-password\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->changePassword([\n \"username\" => \"jacknich\",\n \"body\" => [\n \"password\" => \"new-test-password\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"password\":\"new-test-password\"}' \"$ELASTICSEARCH_URL/_security/user/jacknich/_password\"", + "language": "curl" + } + ], "description": "Run `POST /_security/user/jacknich/_password` to update the password for the `jacknich` user.\n", "method_request": "POST /_security/user/jacknich/_password", "value": "{\n \"password\" : \"new-test-password\"\n}" @@ -213303,6 +223736,28 @@ "description": "Clear the API key cache.\n\nEvict a subset of all entries from the API key cache.\nThe cache is also automatically cleared on state changes of the security index.", "examples": { "SecurityClearApiKeyCacheExample1": { + "alternatives": [ + { + "code": "resp = client.security.clear_api_key_cache(\n ids=\"yVGMr3QByxdh1MSaicYx\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.clearApiKeyCache({\n ids: \"yVGMr3QByxdh1MSaicYx\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.clear_api_key_cache(\n ids: \"yVGMr3QByxdh1MSaicYx\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->clearApiKeyCache([\n \"ids\" => \"yVGMr3QByxdh1MSaicYx\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/api_key/yVGMr3QByxdh1MSaicYx/_clear_cache\"", + "language": "curl" + } + ], "method_request": "POST /_security/api_key/yVGMr3QByxdh1MSaicYx/_clear_cache" } }, @@ -213402,6 +223857,28 @@ "description": "Clear the privileges cache.\n\nEvict privileges from the native application privilege cache.\nThe cache is also automatically cleared for applications that have their privileges updated.", "examples": { "SecurityClearCachedPrivilegesExample1": { + "alternatives": [ + { + "code": "resp = client.security.clear_cached_privileges(\n application=\"myapp\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.clearCachedPrivileges({\n application: \"myapp\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.clear_cached_privileges(\n application: \"myapp\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->clearCachedPrivileges([\n \"application\" => \"myapp\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/privilege/myapp/_clear_cache\"", + "language": "curl" + } + ], "method_request": "POST /_security/privilege/myapp/_clear_cache" } }, @@ -213501,6 +223978,28 @@ "description": "Clear the user cache.\n\nEvict users from the user cache.\nYou can completely clear the cache or evict specific users.\n\nUser credentials are cached in memory on each node to avoid connecting to a remote authentication service or hitting the disk for every incoming request.\nThere are realm settings that you can use to configure the user cache.\nFor more information, refer to the documentation about controlling the user cache.", "examples": { "SecurityClearCachedRealmsExample1": { + "alternatives": [ + { + "code": "resp = client.security.clear_cached_realms(\n realms=\"default_file\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.clearCachedRealms({\n realms: \"default_file\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.clear_cached_realms(\n realms: \"default_file\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->clearCachedRealms([\n \"realms\" => \"default_file\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/realm/default_file/_clear_cache\"", + "language": "curl" + } + ], "method_request": "POST /_security/realm/default_file/_clear_cache" } }, @@ -213616,6 +224115,28 @@ "description": "Clear the roles cache.\n\nEvict roles from the native role cache.", "examples": { "SecurityClearCachedRolesExample1": { + "alternatives": [ + { + "code": "resp = client.security.clear_cached_roles(\n name=\"my_admin_role\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.clearCachedRoles({\n name: \"my_admin_role\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.clear_cached_roles(\n name: \"my_admin_role\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->clearCachedRoles([\n \"name\" => \"my_admin_role\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/role/my_admin_role/_clear_cache\"", + "language": "curl" + } + ], "method_request": "POST /_security/role/my_admin_role/_clear_cache" } }, @@ -213715,6 +224236,28 @@ "description": "Clear service account token caches.\n\nEvict a subset of all entries from the service account token caches.\nTwo separate caches exist for service account tokens: one cache for tokens backed by the `service_tokens` file, and another for tokens backed by the `.security` index.\nThis API clears matching entries from both caches.\n\nThe cache for service account tokens backed by the `.security` index is cleared automatically on state changes of the security index.\nThe cache for tokens backed by the `service_tokens` file is cleared automatically on file changes.", "examples": { "SecurityClearCachedServiceTokensExample1": { + "alternatives": [ + { + "code": "resp = client.security.clear_cached_service_tokens(\n namespace=\"elastic\",\n service=\"fleet-server\",\n name=\"token1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.clearCachedServiceTokens({\n namespace: \"elastic\",\n service: \"fleet-server\",\n name: \"token1\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.clear_cached_service_tokens(\n namespace: \"elastic\",\n service: \"fleet-server\",\n name: \"token1\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->clearCachedServiceTokens([\n \"namespace\" => \"elastic\",\n \"service\" => \"fleet-server\",\n \"name\" => \"token1\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/service/elastic/fleet-server/credential/token/token1/_clear_cache\"", + "language": "curl" + } + ], "method_request": "POST /_security/service/elastic/fleet-server/credential/token/token1/_clear_cache" } }, @@ -213907,6 +224450,28 @@ "description": "Create an API key.\n\nCreate an API key for access without requiring basic authentication.\n\nIMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges.\nIf you specify privileges, the API returns an error.\n\nA successful request returns a JSON structure that contains the API key, its unique id, and its name.\nIf applicable, it also returns expiration information for the API key in milliseconds.\n\nNOTE: By default, API keys never expire. You can specify expiration information when you create the API keys.\n\nThe API keys are created by the Elasticsearch API key service, which is automatically enabled.\nTo configure or turn off the API key service, refer to API key service setting documentation.", "examples": { "SecurityCreateApiKeyRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.create_api_key(\n name=\"my-api-key\",\n expiration=\"1d\",\n role_descriptors={\n \"role-a\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-a*\"\n ],\n \"privileges\": [\n \"read\"\n ]\n }\n ]\n },\n \"role-b\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-b*\"\n ],\n \"privileges\": [\n \"all\"\n ]\n }\n ]\n }\n },\n metadata={\n \"application\": \"my-application\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": True,\n \"tags\": [\n \"dev\",\n \"staging\"\n ]\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.createApiKey({\n name: \"my-api-key\",\n expiration: \"1d\",\n role_descriptors: {\n \"role-a\": {\n cluster: [\"all\"],\n indices: [\n {\n names: [\"index-a*\"],\n privileges: [\"read\"],\n },\n ],\n },\n \"role-b\": {\n cluster: [\"all\"],\n indices: [\n {\n names: [\"index-b*\"],\n privileges: [\"all\"],\n },\n ],\n },\n },\n metadata: {\n application: \"my-application\",\n environment: {\n level: 1,\n trusted: true,\n tags: [\"dev\", \"staging\"],\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.create_api_key(\n body: {\n \"name\": \"my-api-key\",\n \"expiration\": \"1d\",\n \"role_descriptors\": {\n \"role-a\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-a*\"\n ],\n \"privileges\": [\n \"read\"\n ]\n }\n ]\n },\n \"role-b\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-b*\"\n ],\n \"privileges\": [\n \"all\"\n ]\n }\n ]\n }\n },\n \"metadata\": {\n \"application\": \"my-application\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": true,\n \"tags\": [\n \"dev\",\n \"staging\"\n ]\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->createApiKey([\n \"body\" => [\n \"name\" => \"my-api-key\",\n \"expiration\" => \"1d\",\n \"role_descriptors\" => [\n \"role-a\" => [\n \"cluster\" => array(\n \"all\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index-a*\",\n ),\n \"privileges\" => array(\n \"read\",\n ),\n ],\n ),\n ],\n \"role-b\" => [\n \"cluster\" => array(\n \"all\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index-b*\",\n ),\n \"privileges\" => array(\n \"all\",\n ),\n ],\n ),\n ],\n ],\n \"metadata\" => [\n \"application\" => \"my-application\",\n \"environment\" => [\n \"level\" => 1,\n \"trusted\" => true,\n \"tags\" => array(\n \"dev\",\n \"staging\",\n ),\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"name\":\"my-api-key\",\"expiration\":\"1d\",\"role_descriptors\":{\"role-a\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index-a*\"],\"privileges\":[\"read\"]}]},\"role-b\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index-b*\"],\"privileges\":[\"all\"]}]}},\"metadata\":{\"application\":\"my-application\",\"environment\":{\"level\":1,\"trusted\":true,\"tags\":[\"dev\",\"staging\"]}}}' \"$ELASTICSEARCH_URL/_security/api_key\"", + "language": "curl" + } + ], "description": "Run `POST /_security/api_key` to create an API key. If `expiration` is not provided, the API keys do not expire. If `role_descriptors` is not provided, the permissions of the authenticated user are applied.\n", "method_request": "POST /_security/api_key", "value": "{\n \"name\": \"my-api-key\",\n \"expiration\": \"1d\", \n \"role_descriptors\": { \n \"role-a\": {\n \"cluster\": [\"all\"],\n \"indices\": [\n {\n \"names\": [\"index-a*\"],\n \"privileges\": [\"read\"]\n }\n ]\n },\n \"role-b\": {\n \"cluster\": [\"all\"],\n \"indices\": [\n {\n \"names\": [\"index-b*\"],\n \"privileges\": [\"all\"]\n }\n ]\n }\n },\n \"metadata\": {\n \"application\": \"my-application\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": true,\n \"tags\": [\"dev\", \"staging\"]\n }\n }\n}" @@ -214085,6 +224650,28 @@ "description": "Create a cross-cluster API key.\n\nCreate an API key of the `cross_cluster` type for the API key based remote cluster access.\nA `cross_cluster` API key cannot be used to authenticate through the REST interface.\n\nIMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error.\n\nCross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled.\n\nNOTE: Unlike REST API keys, a cross-cluster API key does not capture permissions of the authenticated user. The API key’s effective permission is exactly as specified with the `access` property.\n\nA successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds.\n\nBy default, API keys never expire. You can specify expiration information when you create the API keys.\n\nCross-cluster API keys can only be updated with the update cross-cluster API key API.\nAttempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error.", "examples": { "CreateCrossClusterApiKeyRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.create_cross_cluster_api_key(\n name=\"my-cross-cluster-api-key\",\n expiration=\"1d\",\n access={\n \"search\": [\n {\n \"names\": [\n \"logs*\"\n ]\n }\n ],\n \"replication\": [\n {\n \"names\": [\n \"archive*\"\n ]\n }\n ]\n },\n metadata={\n \"description\": \"phase one\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": True,\n \"tags\": [\n \"dev\",\n \"staging\"\n ]\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.createCrossClusterApiKey({\n name: \"my-cross-cluster-api-key\",\n expiration: \"1d\",\n access: {\n search: [\n {\n names: [\"logs*\"],\n },\n ],\n replication: [\n {\n names: [\"archive*\"],\n },\n ],\n },\n metadata: {\n description: \"phase one\",\n environment: {\n level: 1,\n trusted: true,\n tags: [\"dev\", \"staging\"],\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.create_cross_cluster_api_key(\n body: {\n \"name\": \"my-cross-cluster-api-key\",\n \"expiration\": \"1d\",\n \"access\": {\n \"search\": [\n {\n \"names\": [\n \"logs*\"\n ]\n }\n ],\n \"replication\": [\n {\n \"names\": [\n \"archive*\"\n ]\n }\n ]\n },\n \"metadata\": {\n \"description\": \"phase one\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": true,\n \"tags\": [\n \"dev\",\n \"staging\"\n ]\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->createCrossClusterApiKey([\n \"body\" => [\n \"name\" => \"my-cross-cluster-api-key\",\n \"expiration\" => \"1d\",\n \"access\" => [\n \"search\" => array(\n [\n \"names\" => array(\n \"logs*\",\n ),\n ],\n ),\n \"replication\" => array(\n [\n \"names\" => array(\n \"archive*\",\n ),\n ],\n ),\n ],\n \"metadata\" => [\n \"description\" => \"phase one\",\n \"environment\" => [\n \"level\" => 1,\n \"trusted\" => true,\n \"tags\" => array(\n \"dev\",\n \"staging\",\n ),\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"name\":\"my-cross-cluster-api-key\",\"expiration\":\"1d\",\"access\":{\"search\":[{\"names\":[\"logs*\"]}],\"replication\":[{\"names\":[\"archive*\"]}]},\"metadata\":{\"description\":\"phase one\",\"environment\":{\"level\":1,\"trusted\":true,\"tags\":[\"dev\",\"staging\"]}}}' \"$ELASTICSEARCH_URL/_security/cross_cluster/api_key\"", + "language": "curl" + } + ], "description": "Run `POST /_security/cross_cluster/api_key` to create a cross-cluster API key.\n", "method_request": "POST /_security/cross_cluster/api_key", "value": "{\n \"name\": \"my-cross-cluster-api-key\",\n \"expiration\": \"1d\", \n \"access\": {\n \"search\": [ \n {\n \"names\": [\"logs*\"]\n }\n ],\n \"replication\": [ \n {\n \"names\": [\"archive*\"]\n }\n ]\n },\n \"metadata\": {\n \"description\": \"phase one\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": true,\n \"tags\": [\"dev\", \"staging\"]\n }\n }\n}" @@ -214203,6 +224790,28 @@ "description": "Create a service account token.\n\nCreate a service accounts token for access without requiring basic authentication.\n\nNOTE: Service account tokens never expire.\nYou must actively delete them if they are no longer needed.", "examples": { "CreateServiceTokenRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.create_service_token(\n namespace=\"elastic\",\n service=\"fleet-server\",\n name=\"token1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.createServiceToken({\n namespace: \"elastic\",\n service: \"fleet-server\",\n name: \"token1\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.create_service_token(\n namespace: \"elastic\",\n service: \"fleet-server\",\n name: \"token1\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->createServiceToken([\n \"namespace\" => \"elastic\",\n \"service\" => \"fleet-server\",\n \"name\" => \"token1\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/service/elastic/fleet-server/credential/token/token1\"", + "language": "curl" + } + ], "method_request": "POST /_security/service/elastic/fleet-server/credential/token/token1" } }, @@ -214594,7 +225203,30 @@ "description": "Delegate PKI authentication.\n\nThis API implements the exchange of an X509Certificate chain for an Elasticsearch access token.\nThe certificate chain is validated, according to RFC 5280, by sequentially considering the trust configuration of every installed PKI realm that has `delegation.enabled` set to `true`.\nA successfully trusted client certificate is also subject to the validation of the subject distinguished name according to thw `username_pattern` of the respective realm.\n\nThis API is called by smart and trusted proxies, such as Kibana, which terminate the user's TLS session but still want to authenticate the user by using a PKI realm—-​as if the user connected directly to Elasticsearch.\n\nIMPORTANT: The association between the subject public key in the target certificate and the corresponding private key is not validated.\nThis is part of the TLS authentication process and it is delegated to the proxy that calls this API.\nThe proxy is trusted to have performed the TLS authentication and this API translates that authentication into an Elasticsearch access token.", "examples": { "SecurityDelegatePkiRequestExample1": { + "alternatives": [ + { + "code": "resp = client.perform_request(\n \"POST\",\n \"/_security/delegate_pki\",\n headers={\"Content-Type\": \"application/json\"},\n body={\n \"x509_certificate_chain\": [\n \"MIIDeDCCAmCgAwIBAgIUBzj/nGGKxP2iXawsSquHmQjCJmMwDQYJKoZIhvcNAQELBQAwUzErMCkGA1UEAxMiRWxhc3RpY3NlYXJjaCBUZXN0IEludGVybWVkaWF0ZSBDQTEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMB4XDTIzMDcxODE5MjkwNloXDTQzMDcxMzE5MjkwNlowSjEiMCAGA1UEAxMZRWxhc3RpY3NlYXJjaCBUZXN0IENsaWVudDEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAllHL4pQkkfwAm/oLkxYYO+r950DEy1bjH+4viCHzNADLCTWO+lOZJVlNx7QEzJE3QGMdif9CCBBxQFMapA7oUFCLq84fPSQQu5AnvvbltVD9nwVtCs+9ZGDjMKsz98RhSLMFIkxdxi6HkQ3Lfa4ZSI4lvba4oo+T/GveazBDS+NgmKyq00EOXt3tWi1G9vEVItommzXWfv0agJWzVnLMldwkPqsw0W7zrpyT7FZS4iLbQADGceOW8fiauOGMkscu9zAnDR/SbWl/chYioQOdw6ndFLn1YIFPd37xL0WsdsldTpn0vH3YfzgLMffT/3P6YlwBegWzsx6FnM/93Ecb4wIDAQABo00wSzAJBgNVHRMEAjAAMB0GA1UdDgQWBBQKNRwjW+Ad/FN1Rpoqme/5+jrFWzAfBgNVHSMEGDAWgBRcya0c0x/PaI7MbmJVIylWgLqXNjANBgkqhkiG9w0BAQsFAAOCAQEACZ3PF7Uqu47lplXHP6YlzYL2jL0D28hpj5lGtdha4Muw1m/BjDb0Pu8l0NQ1z3AP6AVcvjNDkQq6Y5jeSz0bwQlealQpYfo7EMXjOidrft1GbqOMFmTBLpLA9SvwYGobSTXWTkJzonqVaTcf80HpMgM2uEhodwTcvz6v1WEfeT/HMjmdIsq4ImrOL9RNrcZG6nWfw0HR3JNOgrbfyEztEI471jHznZ336OEcyX7gQuvHE8tOv5+oD1d7s3Xg1yuFp+Ynh+FfOi3hPCuaHA+7F6fLmzMDLVUBAllugst1C3U+L/paD7tqIa4ka+KNPCbSfwazmJrt4XNiivPR4hwH5g==\"\n ]\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.transport.request({\n method: \"POST\",\n path: \"/_security/delegate_pki\",\n body: {\n x509_certificate_chain: [\n \"MIIDeDCCAmCgAwIBAgIUBzj/nGGKxP2iXawsSquHmQjCJmMwDQYJKoZIhvcNAQELBQAwUzErMCkGA1UEAxMiRWxhc3RpY3NlYXJjaCBUZXN0IEludGVybWVkaWF0ZSBDQTEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMB4XDTIzMDcxODE5MjkwNloXDTQzMDcxMzE5MjkwNlowSjEiMCAGA1UEAxMZRWxhc3RpY3NlYXJjaCBUZXN0IENsaWVudDEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAllHL4pQkkfwAm/oLkxYYO+r950DEy1bjH+4viCHzNADLCTWO+lOZJVlNx7QEzJE3QGMdif9CCBBxQFMapA7oUFCLq84fPSQQu5AnvvbltVD9nwVtCs+9ZGDjMKsz98RhSLMFIkxdxi6HkQ3Lfa4ZSI4lvba4oo+T/GveazBDS+NgmKyq00EOXt3tWi1G9vEVItommzXWfv0agJWzVnLMldwkPqsw0W7zrpyT7FZS4iLbQADGceOW8fiauOGMkscu9zAnDR/SbWl/chYioQOdw6ndFLn1YIFPd37xL0WsdsldTpn0vH3YfzgLMffT/3P6YlwBegWzsx6FnM/93Ecb4wIDAQABo00wSzAJBgNVHRMEAjAAMB0GA1UdDgQWBBQKNRwjW+Ad/FN1Rpoqme/5+jrFWzAfBgNVHSMEGDAWgBRcya0c0x/PaI7MbmJVIylWgLqXNjANBgkqhkiG9w0BAQsFAAOCAQEACZ3PF7Uqu47lplXHP6YlzYL2jL0D28hpj5lGtdha4Muw1m/BjDb0Pu8l0NQ1z3AP6AVcvjNDkQq6Y5jeSz0bwQlealQpYfo7EMXjOidrft1GbqOMFmTBLpLA9SvwYGobSTXWTkJzonqVaTcf80HpMgM2uEhodwTcvz6v1WEfeT/HMjmdIsq4ImrOL9RNrcZG6nWfw0HR3JNOgrbfyEztEI471jHznZ336OEcyX7gQuvHE8tOv5+oD1d7s3Xg1yuFp+Ynh+FfOi3hPCuaHA+7F6fLmzMDLVUBAllugst1C3U+L/paD7tqIa4ka+KNPCbSfwazmJrt4XNiivPR4hwH5g==\",\n ],\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.perform_request(\n \"POST\",\n \"/_security/delegate_pki\",\n {},\n {\n \"x509_certificate_chain\": [\n \"MIIDeDCCAmCgAwIBAgIUBzj/nGGKxP2iXawsSquHmQjCJmMwDQYJKoZIhvcNAQELBQAwUzErMCkGA1UEAxMiRWxhc3RpY3NlYXJjaCBUZXN0IEludGVybWVkaWF0ZSBDQTEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMB4XDTIzMDcxODE5MjkwNloXDTQzMDcxMzE5MjkwNlowSjEiMCAGA1UEAxMZRWxhc3RpY3NlYXJjaCBUZXN0IENsaWVudDEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAllHL4pQkkfwAm/oLkxYYO+r950DEy1bjH+4viCHzNADLCTWO+lOZJVlNx7QEzJE3QGMdif9CCBBxQFMapA7oUFCLq84fPSQQu5AnvvbltVD9nwVtCs+9ZGDjMKsz98RhSLMFIkxdxi6HkQ3Lfa4ZSI4lvba4oo+T/GveazBDS+NgmKyq00EOXt3tWi1G9vEVItommzXWfv0agJWzVnLMldwkPqsw0W7zrpyT7FZS4iLbQADGceOW8fiauOGMkscu9zAnDR/SbWl/chYioQOdw6ndFLn1YIFPd37xL0WsdsldTpn0vH3YfzgLMffT/3P6YlwBegWzsx6FnM/93Ecb4wIDAQABo00wSzAJBgNVHRMEAjAAMB0GA1UdDgQWBBQKNRwjW+Ad/FN1Rpoqme/5+jrFWzAfBgNVHSMEGDAWgBRcya0c0x/PaI7MbmJVIylWgLqXNjANBgkqhkiG9w0BAQsFAAOCAQEACZ3PF7Uqu47lplXHP6YlzYL2jL0D28hpj5lGtdha4Muw1m/BjDb0Pu8l0NQ1z3AP6AVcvjNDkQq6Y5jeSz0bwQlealQpYfo7EMXjOidrft1GbqOMFmTBLpLA9SvwYGobSTXWTkJzonqVaTcf80HpMgM2uEhodwTcvz6v1WEfeT/HMjmdIsq4ImrOL9RNrcZG6nWfw0HR3JNOgrbfyEztEI471jHznZ336OEcyX7gQuvHE8tOv5+oD1d7s3Xg1yuFp+Ynh+FfOi3hPCuaHA+7F6fLmzMDLVUBAllugst1C3U+L/paD7tqIa4ka+KNPCbSfwazmJrt4XNiivPR4hwH5g==\"\n ]\n },\n { \"Content-Type\": \"application/json\" },\n)", + "language": "Ruby" + }, + { + "code": "$requestFactory = Psr17FactoryDiscovery::findRequestFactory();\n$streamFactory = Psr17FactoryDiscovery::findStreamFactory();\n$request = $requestFactory->createRequest(\n \"POST\",\n \"/_security/delegate_pki\",\n);\n$request = $request->withHeader(\"Content-Type\", \"application/json\");\n$request = $request->withBody($streamFactory->createStream(\n json_encode([\n \"x509_certificate_chain\" => array(\n \"MIIDeDCCAmCgAwIBAgIUBzj/nGGKxP2iXawsSquHmQjCJmMwDQYJKoZIhvcNAQELBQAwUzErMCkGA1UEAxMiRWxhc3RpY3NlYXJjaCBUZXN0IEludGVybWVkaWF0ZSBDQTEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMB4XDTIzMDcxODE5MjkwNloXDTQzMDcxMzE5MjkwNlowSjEiMCAGA1UEAxMZRWxhc3RpY3NlYXJjaCBUZXN0IENsaWVudDEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAllHL4pQkkfwAm/oLkxYYO+r950DEy1bjH+4viCHzNADLCTWO+lOZJVlNx7QEzJE3QGMdif9CCBBxQFMapA7oUFCLq84fPSQQu5AnvvbltVD9nwVtCs+9ZGDjMKsz98RhSLMFIkxdxi6HkQ3Lfa4ZSI4lvba4oo+T/GveazBDS+NgmKyq00EOXt3tWi1G9vEVItommzXWfv0agJWzVnLMldwkPqsw0W7zrpyT7FZS4iLbQADGceOW8fiauOGMkscu9zAnDR/SbWl/chYioQOdw6ndFLn1YIFPd37xL0WsdsldTpn0vH3YfzgLMffT/3P6YlwBegWzsx6FnM/93Ecb4wIDAQABo00wSzAJBgNVHRMEAjAAMB0GA1UdDgQWBBQKNRwjW+Ad/FN1Rpoqme/5+jrFWzAfBgNVHSMEGDAWgBRcya0c0x/PaI7MbmJVIylWgLqXNjANBgkqhkiG9w0BAQsFAAOCAQEACZ3PF7Uqu47lplXHP6YlzYL2jL0D28hpj5lGtdha4Muw1m/BjDb0Pu8l0NQ1z3AP6AVcvjNDkQq6Y5jeSz0bwQlealQpYfo7EMXjOidrft1GbqOMFmTBLpLA9SvwYGobSTXWTkJzonqVaTcf80HpMgM2uEhodwTcvz6v1WEfeT/HMjmdIsq4ImrOL9RNrcZG6nWfw0HR3JNOgrbfyEztEI471jHznZ336OEcyX7gQuvHE8tOv5+oD1d7s3Xg1yuFp+Ynh+FfOi3hPCuaHA+7F6fLmzMDLVUBAllugst1C3U+L/paD7tqIa4ka+KNPCbSfwazmJrt4XNiivPR4hwH5g==\",\n ),\n ]),\n));\n$resp = $client->sendRequest($request);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"x509_certificate_chain\":[\"MIIDeDCCAmCgAwIBAgIUBzj/nGGKxP2iXawsSquHmQjCJmMwDQYJKoZIhvcNAQELBQAwUzErMCkGA1UEAxMiRWxhc3RpY3NlYXJjaCBUZXN0IEludGVybWVkaWF0ZSBDQTEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMB4XDTIzMDcxODE5MjkwNloXDTQzMDcxMzE5MjkwNlowSjEiMCAGA1UEAxMZRWxhc3RpY3NlYXJjaCBUZXN0IENsaWVudDEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAllHL4pQkkfwAm/oLkxYYO+r950DEy1bjH+4viCHzNADLCTWO+lOZJVlNx7QEzJE3QGMdif9CCBBxQFMapA7oUFCLq84fPSQQu5AnvvbltVD9nwVtCs+9ZGDjMKsz98RhSLMFIkxdxi6HkQ3Lfa4ZSI4lvba4oo+T/GveazBDS+NgmKyq00EOXt3tWi1G9vEVItommzXWfv0agJWzVnLMldwkPqsw0W7zrpyT7FZS4iLbQADGceOW8fiauOGMkscu9zAnDR/SbWl/chYioQOdw6ndFLn1YIFPd37xL0WsdsldTpn0vH3YfzgLMffT/3P6YlwBegWzsx6FnM/93Ecb4wIDAQABo00wSzAJBgNVHRMEAjAAMB0GA1UdDgQWBBQKNRwjW+Ad/FN1Rpoqme/5+jrFWzAfBgNVHSMEGDAWgBRcya0c0x/PaI7MbmJVIylWgLqXNjANBgkqhkiG9w0BAQsFAAOCAQEACZ3PF7Uqu47lplXHP6YlzYL2jL0D28hpj5lGtdha4Muw1m/BjDb0Pu8l0NQ1z3AP6AVcvjNDkQq6Y5jeSz0bwQlealQpYfo7EMXjOidrft1GbqOMFmTBLpLA9SvwYGobSTXWTkJzonqVaTcf80HpMgM2uEhodwTcvz6v1WEfeT/HMjmdIsq4ImrOL9RNrcZG6nWfw0HR3JNOgrbfyEztEI471jHznZ336OEcyX7gQuvHE8tOv5+oD1d7s3Xg1yuFp+Ynh+FfOi3hPCuaHA+7F6fLmzMDLVUBAllugst1C3U+L/paD7tqIa4ka+KNPCbSfwazmJrt4XNiivPR4hwH5g==\"]}' \"$ELASTICSEARCH_URL/_security/delegate_pki\"", + "language": "curl" + } + ], "description": "Delegate a one element certificate chain.", + "method_request": "POST /_security/delegate_pki", "value": "{\n\"x509_certificate_chain\": [\"MIIDeDCCAmCgAwIBAgIUBzj/nGGKxP2iXawsSquHmQjCJmMwDQYJKoZIhvcNAQELBQAwUzErMCkGA1UEAxMiRWxhc3RpY3NlYXJjaCBUZXN0IEludGVybWVkaWF0ZSBDQTEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMB4XDTIzMDcxODE5MjkwNloXDTQzMDcxMzE5MjkwNlowSjEiMCAGA1UEAxMZRWxhc3RpY3NlYXJjaCBUZXN0IENsaWVudDEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAllHL4pQkkfwAm/oLkxYYO+r950DEy1bjH+4viCHzNADLCTWO+lOZJVlNx7QEzJE3QGMdif9CCBBxQFMapA7oUFCLq84fPSQQu5AnvvbltVD9nwVtCs+9ZGDjMKsz98RhSLMFIkxdxi6HkQ3Lfa4ZSI4lvba4oo+T/GveazBDS+NgmKyq00EOXt3tWi1G9vEVItommzXWfv0agJWzVnLMldwkPqsw0W7zrpyT7FZS4iLbQADGceOW8fiauOGMkscu9zAnDR/SbWl/chYioQOdw6ndFLn1YIFPd37xL0WsdsldTpn0vH3YfzgLMffT/3P6YlwBegWzsx6FnM/93Ecb4wIDAQABo00wSzAJBgNVHRMEAjAAMB0GA1UdDgQWBBQKNRwjW+Ad/FN1Rpoqme/5+jrFWzAfBgNVHSMEGDAWgBRcya0c0x/PaI7MbmJVIylWgLqXNjANBgkqhkiG9w0BAQsFAAOCAQEACZ3PF7Uqu47lplXHP6YlzYL2jL0D28hpj5lGtdha4Muw1m/BjDb0Pu8l0NQ1z3AP6AVcvjNDkQq6Y5jeSz0bwQlealQpYfo7EMXjOidrft1GbqOMFmTBLpLA9SvwYGobSTXWTkJzonqVaTcf80HpMgM2uEhodwTcvz6v1WEfeT/HMjmdIsq4ImrOL9RNrcZG6nWfw0HR3JNOgrbfyEztEI471jHznZ336OEcyX7gQuvHE8tOv5+oD1d7s3Xg1yuFp+Ynh+FfOi3hPCuaHA+7F6fLmzMDLVUBAllugst1C3U+L/paD7tqIa4ka+KNPCbSfwazmJrt4XNiivPR4hwH5g==\"]\n}" } }, @@ -214710,6 +225342,28 @@ "description": "Delete application privileges.\n\nTo use this API, you must have one of the following privileges:\n\n* The `manage_security` cluster privilege (or a greater privilege such as `all`).\n* The \"Manage Application Privileges\" global privilege for the application being referenced in the request.", "examples": { "SecurityDeletePrivilegesRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.delete_privileges(\n application=\"myapp\",\n name=\"read\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.deletePrivileges({\n application: \"myapp\",\n name: \"read\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.delete_privileges(\n application: \"myapp\",\n name: \"read\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->deletePrivileges([\n \"application\" => \"myapp\",\n \"name\" => \"read\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/privilege/myapp/read\"", + "language": "curl" + } + ], "method_request": "DELETE /_security/privilege/myapp/read" } }, @@ -214823,6 +225477,28 @@ "description": "Delete roles.\n\nDelete roles in the native realm.\nThe role management APIs are generally the preferred way to manage roles, rather than using file-based role management.\nThe delete roles API cannot remove roles that are defined in roles files.", "examples": { "SecurityDeleteRoleRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.delete_role(\n name=\"my_admin_role\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.deleteRole({\n name: \"my_admin_role\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.delete_role(\n name: \"my_admin_role\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->deleteRole([\n \"name\" => \"my_admin_role\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/role/my_admin_role\"", + "language": "curl" + } + ], "method_request": "DELETE /_security/role/my_admin_role" } }, @@ -214908,6 +225584,28 @@ "description": "Delete role mappings.\n\nRole mappings define which roles are assigned to each user.\nThe role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files.\nThe delete role mappings API cannot remove role mappings that are defined in role mapping files.", "examples": { "SecurityDeleteRoleMappingRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.delete_role_mapping(\n name=\"mapping1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.deleteRoleMapping({\n name: \"mapping1\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.delete_role_mapping(\n name: \"mapping1\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->deleteRoleMapping([\n \"name\" => \"mapping1\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/role_mapping/mapping1\"", + "language": "curl" + } + ], "method_request": "DELETE /_security/role_mapping/mapping1" } }, @@ -214993,6 +225691,28 @@ "description": "Delete service account tokens.\n\nDelete service account tokens for a service in a specified namespace.", "examples": { "DeleteServiceTokenRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.delete_service_token(\n namespace=\"elastic\",\n service=\"fleet-server\",\n name=\"token42\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.deleteServiceToken({\n namespace: \"elastic\",\n service: \"fleet-server\",\n name: \"token42\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.delete_service_token(\n namespace: \"elastic\",\n service: \"fleet-server\",\n name: \"token42\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->deleteServiceToken([\n \"namespace\" => \"elastic\",\n \"service\" => \"fleet-server\",\n \"name\" => \"token42\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/service/elastic/fleet-server/credential/token/token42\"", + "language": "curl" + } + ], "method_request": "DELETE /_security/service/elastic/fleet-server/credential/token/token42" } }, @@ -215102,6 +225822,28 @@ "description": "Delete users.\n\nDelete users from the native realm.", "examples": { "SecurityDeleteUserRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.delete_user(\n username=\"jacknich\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.deleteUser({\n username: \"jacknich\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.delete_user(\n username: \"jacknich\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->deleteUser([\n \"username\" => \"jacknich\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/user/jacknich\"", + "language": "curl" + } + ], "method_request": "DELETE /_security/user/jacknich" } }, @@ -215187,6 +225929,28 @@ "description": "Disable users.\n\nDisable users in the native realm.\nBy default, when you create users, they are enabled.\nYou can use this API to revoke a user's access to Elasticsearch.", "examples": { "SecurityDisableUserExample1": { + "alternatives": [ + { + "code": "resp = client.security.disable_user(\n username=\"jacknich\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.disableUser({\n username: \"jacknich\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.disable_user(\n username: \"jacknich\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->disableUser([\n \"username\" => \"jacknich\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/user/jacknich/_disable\"", + "language": "curl" + } + ], "method_request": "PUT /_security/user/jacknich/_disable" } }, @@ -215253,6 +226017,28 @@ "description": "Disable a user profile.\n\nDisable user profiles so that they are not visible in user profile searches.\n\nNOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions.\nIndividual users and external applications should not call this API directly.\nElastic reserves the right to change or remove this feature in future releases without prior notice.\n\nWhen you activate a user profile, its automatically enabled and visible in user profile searches. You can use the disable user profile API to disable a user profile so it’s not visible in these searches.\nTo re-enable a disabled user profile, use the enable user profile API .", "examples": { "SecurityDisableUserProfileExample1": { + "alternatives": [ + { + "code": "resp = client.security.disable_user_profile(\n uid=\"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.disableUserProfile({\n uid: \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.disable_user_profile(\n uid: \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->disableUserProfile([\n \"uid\" => \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0/_disable\"", + "language": "curl" + } + ], "method_request": "POST /_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0/_disable" } }, @@ -215327,6 +226113,28 @@ "description": "Enable users.\n\nEnable users in the native realm.\nBy default, when you create users, they are enabled.", "examples": { "SecurityEnableUserExample1": { + "alternatives": [ + { + "code": "resp = client.security.enable_user(\n username=\"logstash_system\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.enableUser({\n username: \"logstash_system\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.enable_user(\n username: \"logstash_system\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->enableUser([\n \"username\" => \"logstash_system\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/user/logstash_system/_enable\"", + "language": "curl" + } + ], "method_request": "PUT _security/user/logstash_system/_enable" } }, @@ -215393,6 +226201,28 @@ "description": "Enable a user profile.\n\nEnable user profiles to make them visible in user profile searches.\n\nNOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions.\nIndividual users and external applications should not call this API directly.\nElastic reserves the right to change or remove this feature in future releases without prior notice.\n\nWhen you activate a user profile, it's automatically enabled and visible in user profile searches.\nIf you later disable the user profile, you can use the enable user profile API to make the profile visible in these searches again.", "examples": { "SecurityEnableUserProfileExample1": { + "alternatives": [ + { + "code": "resp = client.security.enable_user_profile(\n uid=\"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.enableUserProfile({\n uid: \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.enable_user_profile(\n uid: \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->enableUserProfile([\n \"uid\" => \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0/_enable\"", + "language": "curl" + } + ], "method_request": "POST /_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0/_enable" } }, @@ -215467,6 +226297,28 @@ "description": "Enroll Kibana.\n\nEnable a Kibana instance to configure itself for communication with a secured Elasticsearch cluster.\n\nNOTE: This API is currently intended for internal use only by Kibana.\nKibana uses this API internally to configure itself for communications with an Elasticsearch cluster that already has security features enabled.", "examples": { "EnrollKibanaRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.enroll_kibana()", + "language": "Python" + }, + { + "code": "const response = await client.security.enrollKibana();", + "language": "JavaScript" + }, + { + "code": "response = client.security.enroll_kibana", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->enrollKibana();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/enroll/kibana\"", + "language": "curl" + } + ], "method_request": "GET /_security/enroll/kibana" } }, @@ -215688,6 +226540,28 @@ "description": "Get API key information.\n\nRetrieves information for one or more API keys.\nNOTE: If you have only the `manage_own_api_key` privilege, this API returns only the API keys that you own.\nIf you have `read_security`, `manage_api_key` or greater privileges (including `manage_security`), this API returns all API keys regardless of ownership.", "examples": { "SecurityGetApiKeyRequestExample2": { + "alternatives": [ + { + "code": "resp = client.security.get_api_key(\n username=\"myuser\",\n realm_name=\"native1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.getApiKey({\n username: \"myuser\",\n realm_name: \"native1\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.get_api_key(\n username: \"myuser\",\n realm_name: \"native1\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->getApiKey([\n \"username\" => \"myuser\",\n \"realm_name\" => \"native1\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/api_key?username=myuser&realm_name=native1\"", + "language": "curl" + } + ], "method_request": "GET /_security/api_key?username=myuser&realm_name=native1" } }, @@ -215874,6 +226748,28 @@ "description": "Get builtin privileges.\n\nGet the list of cluster privileges and index privileges that are available in this version of Elasticsearch.", "examples": { "SecurityGetBuiltinPrivilegesRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.get_builtin_privileges()", + "language": "Python" + }, + { + "code": "const response = await client.security.getBuiltinPrivileges();", + "language": "JavaScript" + }, + { + "code": "response = client.security.get_builtin_privileges", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->getBuiltinPrivileges();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/privilege/_builtin\"", + "language": "curl" + } + ], "method_request": "GET /_security/privilege/_builtin" } }, @@ -215971,6 +226867,28 @@ "description": "Get application privileges.\n\nTo use this API, you must have one of the following privileges:\n\n* The `read_security` cluster privilege (or a greater privilege such as `manage_security` or `all`).\n* The \"Manage Application Privileges\" global privilege for the application being referenced in the request.", "examples": { "SecurityGetPrivilegesRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.get_privileges(\n application=\"myapp\",\n name=\"read\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.getPrivileges({\n application: \"myapp\",\n name: \"read\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.get_privileges(\n application: \"myapp\",\n name: \"read\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->getPrivileges([\n \"application\" => \"myapp\",\n \"name\" => \"read\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/privilege/myapp/read\"", + "language": "curl" + } + ], "method_request": "GET /_security/privilege/myapp/read" } }, @@ -216071,6 +226989,28 @@ "description": "Get roles.\n\nGet roles in the native realm.\nThe role management APIs are generally the preferred way to manage roles, rather than using file-based role management.\nThe get roles API cannot retrieve roles that are defined in roles files.", "examples": { "SecurityGetRoleRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.get_role(\n name=\"my_admin_role\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.getRole({\n name: \"my_admin_role\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.get_role(\n name: \"my_admin_role\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->getRole([\n \"name\" => \"my_admin_role\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/role/my_admin_role\"", + "language": "curl" + } + ], "method_request": "GET /_security/role/my_admin_role" } }, @@ -216359,6 +227299,28 @@ "description": "Get role mappings.\n\nRole mappings define which roles are assigned to each user.\nThe role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files.\nThe get role mappings API cannot retrieve role mappings that are defined in role mapping files.", "examples": { "SecurityGetRoleMappingRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.get_role_mapping(\n name=\"mapping1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.getRoleMapping({\n name: \"mapping1\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.get_role_mapping(\n name: \"mapping1\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->getRoleMapping([\n \"name\" => \"mapping1\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/role_mapping/mapping1\"", + "language": "curl" + } + ], "method_request": "GET /_security/role_mapping/mapping1" } }, @@ -216436,6 +227398,28 @@ "description": "Get service accounts.\n\nGet a list of service accounts that match the provided path parameters.\n\nNOTE: Currently, only the `elastic/fleet-server` service account is available.", "examples": { "GetServiceAccountsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.get_service_accounts(\n namespace=\"elastic\",\n service=\"fleet-server\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.getServiceAccounts({\n namespace: \"elastic\",\n service: \"fleet-server\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.get_service_accounts(\n namespace: \"elastic\",\n service: \"fleet-server\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->getServiceAccounts([\n \"namespace\" => \"elastic\",\n \"service\" => \"fleet-server\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/service/elastic/fleet-server\"", + "language": "curl" + } + ], "method_request": "GET /_security/service/elastic/fleet-server" } }, @@ -216615,6 +227599,28 @@ "description": "Get service account credentials.\n\nTo use this API, you must have at least the `read_security` cluster privilege (or a greater privilege such as `manage_service_account` or `manage_security`).\n\nThe response includes service account tokens that were created with the create service account tokens API as well as file-backed tokens from all nodes of the cluster.\n\nNOTE: For tokens backed by the `service_tokens` file, the API collects them from all nodes of the cluster.\nTokens with the same name from different nodes are assumed to be the same token and are only counted once towards the total number of service tokens.", "examples": { "GetServiceCredentialsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.get_service_credentials(\n namespace=\"elastic\",\n service=\"fleet-server\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.getServiceCredentials({\n namespace: \"elastic\",\n service: \"fleet-server\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.get_service_credentials(\n namespace: \"elastic\",\n service: \"fleet-server\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->getServiceCredentials([\n \"namespace\" => \"elastic\",\n \"service\" => \"fleet-server\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/service/elastic/fleet-server/credential\"", + "language": "curl" + } + ], "method_request": "GET /_security/service/elastic/fleet-server/credential" } }, @@ -216743,6 +227749,28 @@ "description": "Get security index settings.\n\nGet the user-configurable settings for the security internal index (`.security` and associated indices).\nOnly a subset of the index settings — those that are user-configurable—will be shown.\nThis includes:\n\n* `index.auto_expand_replicas`\n* `index.number_of_replicas`", "examples": { "SecurityGetSettingsExample1": { + "alternatives": [ + { + "code": "resp = client.security.get_settings()", + "language": "Python" + }, + { + "code": "const response = await client.security.getSettings();", + "language": "JavaScript" + }, + { + "code": "response = client.security.get_settings", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->getSettings();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/settings\"", + "language": "curl" + } + ], "method_request": "GET /_security/settings" } }, @@ -217025,12 +228053,56 @@ "description": "Get a token.\n\nCreate a bearer token for access without requiring basic authentication.\nThe tokens are created by the Elasticsearch Token Service, which is automatically enabled when you configure TLS on the HTTP interface.\nAlternatively, you can explicitly enable the `xpack.security.authc.token.enabled` setting.\nWhen you are running in production mode, a bootstrap check prevents you from enabling the token service unless you also enable TLS on the HTTP interface.\n\nThe get token API takes the same parameters as a typical OAuth 2.0 token API except for the use of a JSON request body.\n\nA successful get token API call returns a JSON structure that contains the access token, the amount of time (seconds) that the token expires in, the type, and the scope if available.\n\nThe tokens returned by the get token API have a finite period of time for which they are valid and after that time period, they can no longer be used.\nThat time period is defined by the `xpack.security.authc.token.timeout` setting.\nIf you want to invalidate a token immediately, you can do so by using the invalidate token API.", "examples": { "GetUserAccessTokenRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.get_token(\n grant_type=\"client_credentials\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.getToken({\n grant_type: \"client_credentials\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.get_token(\n body: {\n \"grant_type\": \"client_credentials\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->getToken([\n \"body\" => [\n \"grant_type\" => \"client_credentials\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"grant_type\":\"client_credentials\"}' \"$ELASTICSEARCH_URL/_security/oauth2/token\"", + "language": "curl" + } + ], "description": "Run `POST /_security/oauth2/token` to obtain a token using the `client_credentials` grant type, which simply creates a token as the authenticated user.\n", "method_request": "POST /_security/oauth2/token", "summary": "A client_credentials grant type example", "value": "{\n \"grant_type\" : \"client_credentials\"\n}" }, "GetUserAccessTokenRequestExample2": { + "alternatives": [ + { + "code": "resp = client.security.get_token(\n grant_type=\"password\",\n username=\"test_admin\",\n password=\"x-pack-test-password\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.getToken({\n grant_type: \"password\",\n username: \"test_admin\",\n password: \"x-pack-test-password\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.get_token(\n body: {\n \"grant_type\": \"password\",\n \"username\": \"test_admin\",\n \"password\": \"x-pack-test-password\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->getToken([\n \"body\" => [\n \"grant_type\" => \"password\",\n \"username\" => \"test_admin\",\n \"password\" => \"x-pack-test-password\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"grant_type\":\"password\",\"username\":\"test_admin\",\"password\":\"x-pack-test-password\"}' \"$ELASTICSEARCH_URL/_security/oauth2/token\"", + "language": "curl" + } + ], "description": "Run `POST /_security/oauth2/token` to obtain a token for the `test_admin` user using the password grant type. This request needs to be made by an authenticated user with sufficient privileges that may or may not be the same as the one whose username is passed in the `username` parameter.\n", "method_request": "POST /_security/oauth2/token", "summary": "A password grant type example", @@ -217196,6 +228268,28 @@ "description": "Get users.\n\nGet information about users in the native realm and built-in users.", "examples": { "SecurityGetUserRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.get_user(\n username=\"jacknich\",\n with_profile_uid=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.getUser({\n username: \"jacknich\",\n with_profile_uid: \"true\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.get_user(\n username: \"jacknich\",\n with_profile_uid: \"true\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->getUser([\n \"username\" => \"jacknich\",\n \"with_profile_uid\" => \"true\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/user/jacknich?with_profile_uid=true\"", + "language": "curl" + } + ], "method_request": "GET /_security/user/jacknich?with_profile_uid=true" } }, @@ -217308,6 +228402,28 @@ "description": "Get user privileges.\n\nGet the security privileges for the logged in user.\nAll users can use this API, but only to determine their own privileges.\nTo check the privileges of other users, you must use the run as feature.\nTo check whether a user has a specific list of privileges, use the has privileges API.", "examples": { "SecurityGetUserPrivilegesRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.get_user_privileges()", + "language": "Python" + }, + { + "code": "const response = await client.security.getUserPrivileges();", + "language": "JavaScript" + }, + { + "code": "response = client.security.get_user_privileges", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->getUserPrivileges();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/user/_privileges\"", + "language": "curl" + } + ], "method_request": "GET /_security/user/_privileges" } }, @@ -217544,6 +228660,28 @@ "description": "Get a user profile.\n\nGet a user's profile using the unique profile ID.\n\nNOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions.\nIndividual users and external applications should not call this API directly.\nElastic reserves the right to change or remove this feature in future releases without prior notice.", "examples": { "GetUserProfileRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.get_user_profile(\n uid=\"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.getUserProfile({\n uid: \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.get_user_profile(\n uid: \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->getUserProfile([\n \"uid\" => \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"", + "language": "curl" + } + ], "method_request": "GET /_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0" } }, @@ -217868,12 +229006,56 @@ "description": "Grant an API key.\n\nCreate an API key on behalf of another user.\nThis API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API.\nThe caller must have authentication credentials for the user on whose behalf the API key will be created.\nIt is not possible to use this API to create an API key without that user's credentials.\nThe supported user authentication credential types are:\n\n* username and password\n* Elasticsearch access tokens\n* JWTs\n\nThe user, for whom the authentication credentials is provided, can optionally \"run as\" (impersonate) another user.\nIn this case, the API key will be created on behalf of the impersonated user.\n\nThis API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf.\nThe API keys are created by the Elasticsearch API key service, which is automatically enabled.\n\nA successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name.\nIf applicable, it also returns expiration information for the API key in milliseconds.\n\nBy default, API keys never expire. You can specify expiration information when you create the API keys.", "examples": { "SecurityGrantApiKeyRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.grant_api_key(\n grant_type=\"password\",\n username=\"test_admin\",\n password=\"x-pack-test-password\",\n api_key={\n \"name\": \"my-api-key\",\n \"expiration\": \"1d\",\n \"role_descriptors\": {\n \"role-a\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-a*\"\n ],\n \"privileges\": [\n \"read\"\n ]\n }\n ]\n },\n \"role-b\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-b*\"\n ],\n \"privileges\": [\n \"all\"\n ]\n }\n ]\n }\n },\n \"metadata\": {\n \"application\": \"my-application\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": True,\n \"tags\": [\n \"dev\",\n \"staging\"\n ]\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.grantApiKey({\n grant_type: \"password\",\n username: \"test_admin\",\n password: \"x-pack-test-password\",\n api_key: {\n name: \"my-api-key\",\n expiration: \"1d\",\n role_descriptors: {\n \"role-a\": {\n cluster: [\"all\"],\n indices: [\n {\n names: [\"index-a*\"],\n privileges: [\"read\"],\n },\n ],\n },\n \"role-b\": {\n cluster: [\"all\"],\n indices: [\n {\n names: [\"index-b*\"],\n privileges: [\"all\"],\n },\n ],\n },\n },\n metadata: {\n application: \"my-application\",\n environment: {\n level: 1,\n trusted: true,\n tags: [\"dev\", \"staging\"],\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.grant_api_key(\n body: {\n \"grant_type\": \"password\",\n \"username\": \"test_admin\",\n \"password\": \"x-pack-test-password\",\n \"api_key\": {\n \"name\": \"my-api-key\",\n \"expiration\": \"1d\",\n \"role_descriptors\": {\n \"role-a\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-a*\"\n ],\n \"privileges\": [\n \"read\"\n ]\n }\n ]\n },\n \"role-b\": {\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index-b*\"\n ],\n \"privileges\": [\n \"all\"\n ]\n }\n ]\n }\n },\n \"metadata\": {\n \"application\": \"my-application\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": true,\n \"tags\": [\n \"dev\",\n \"staging\"\n ]\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->grantApiKey([\n \"body\" => [\n \"grant_type\" => \"password\",\n \"username\" => \"test_admin\",\n \"password\" => \"x-pack-test-password\",\n \"api_key\" => [\n \"name\" => \"my-api-key\",\n \"expiration\" => \"1d\",\n \"role_descriptors\" => [\n \"role-a\" => [\n \"cluster\" => array(\n \"all\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index-a*\",\n ),\n \"privileges\" => array(\n \"read\",\n ),\n ],\n ),\n ],\n \"role-b\" => [\n \"cluster\" => array(\n \"all\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index-b*\",\n ),\n \"privileges\" => array(\n \"all\",\n ),\n ],\n ),\n ],\n ],\n \"metadata\" => [\n \"application\" => \"my-application\",\n \"environment\" => [\n \"level\" => 1,\n \"trusted\" => true,\n \"tags\" => array(\n \"dev\",\n \"staging\",\n ),\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"grant_type\":\"password\",\"username\":\"test_admin\",\"password\":\"x-pack-test-password\",\"api_key\":{\"name\":\"my-api-key\",\"expiration\":\"1d\",\"role_descriptors\":{\"role-a\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index-a*\"],\"privileges\":[\"read\"]}]},\"role-b\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index-b*\"],\"privileges\":[\"all\"]}]}},\"metadata\":{\"application\":\"my-application\",\"environment\":{\"level\":1,\"trusted\":true,\"tags\":[\"dev\",\"staging\"]}}}}' \"$ELASTICSEARCH_URL/_security/api_key/grant\"", + "language": "curl" + } + ], "description": "Run `POST /_security/api_key/grant` to create an API key on behalf of the `test_admin` user.\n", "method_request": "POST /_security/api_key/grant", "summary": "Grant an API key", "value": "{\n \"grant_type\": \"password\",\n \"username\" : \"test_admin\",\n \"password\" : \"x-pack-test-password\",\n \"api_key\" : {\n \"name\": \"my-api-key\",\n \"expiration\": \"1d\",\n \"role_descriptors\": {\n \"role-a\": {\n \"cluster\": [\"all\"],\n \"indices\": [\n {\n \"names\": [\"index-a*\"],\n \"privileges\": [\"read\"]\n }\n ]\n },\n \"role-b\": {\n \"cluster\": [\"all\"],\n \"indices\": [\n {\n \"names\": [\"index-b*\"],\n \"privileges\": [\"all\"]\n }\n ]\n }\n },\n \"metadata\": {\n \"application\": \"my-application\",\n \"environment\": {\n \"level\": 1,\n \"trusted\": true,\n \"tags\": [\"dev\", \"staging\"]\n }\n }\n }\n}" }, "SecurityGrantApiKeyRequestExample2": { + "alternatives": [ + { + "code": "resp = client.security.grant_api_key(\n grant_type=\"password\",\n username=\"test_admin\",\n password=\"x-pack-test-password\",\n run_as=\"test_user\",\n api_key={\n \"name\": \"another-api-key\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.grantApiKey({\n grant_type: \"password\",\n username: \"test_admin\",\n password: \"x-pack-test-password\",\n run_as: \"test_user\",\n api_key: {\n name: \"another-api-key\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.grant_api_key(\n body: {\n \"grant_type\": \"password\",\n \"username\": \"test_admin\",\n \"password\": \"x-pack-test-password\",\n \"run_as\": \"test_user\",\n \"api_key\": {\n \"name\": \"another-api-key\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->grantApiKey([\n \"body\" => [\n \"grant_type\" => \"password\",\n \"username\" => \"test_admin\",\n \"password\" => \"x-pack-test-password\",\n \"run_as\" => \"test_user\",\n \"api_key\" => [\n \"name\" => \"another-api-key\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"grant_type\":\"password\",\"username\":\"test_admin\",\"password\":\"x-pack-test-password\",\"run_as\":\"test_user\",\"api_key\":{\"name\":\"another-api-key\"}}' \"$ELASTICSEARCH_URL/_security/api_key/grant\"", + "language": "curl" + } + ], "description": "Run `POST /_security/api_key/grant`. The user (`test_admin`) whose credentials are provided can \"run as\" another user (`test_user`). The API key will be granted to the impersonated user (`test_user`).\n", "method_request": "POST /_security/api_key/grant", "summary": "Grant an API key with run_as", @@ -218180,6 +229362,28 @@ "description": "Check user privileges.\n\nDetermine whether the specified user has a specified list of privileges.\nAll users can use this API, but only to determine their own privileges.\nTo check the privileges of other users, you must use the run as feature.", "examples": { "SecurityHasPrivilegesRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.has_privileges(\n cluster=[\n \"monitor\",\n \"manage\"\n ],\n index=[\n {\n \"names\": [\n \"suppliers\",\n \"products\"\n ],\n \"privileges\": [\n \"read\"\n ]\n },\n {\n \"names\": [\n \"inventory\"\n ],\n \"privileges\": [\n \"read\",\n \"write\"\n ]\n }\n ],\n application=[\n {\n \"application\": \"inventory_manager\",\n \"privileges\": [\n \"read\",\n \"data:write/inventory\"\n ],\n \"resources\": [\n \"product/1852563\"\n ]\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.hasPrivileges({\n cluster: [\"monitor\", \"manage\"],\n index: [\n {\n names: [\"suppliers\", \"products\"],\n privileges: [\"read\"],\n },\n {\n names: [\"inventory\"],\n privileges: [\"read\", \"write\"],\n },\n ],\n application: [\n {\n application: \"inventory_manager\",\n privileges: [\"read\", \"data:write/inventory\"],\n resources: [\"product/1852563\"],\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.has_privileges(\n body: {\n \"cluster\": [\n \"monitor\",\n \"manage\"\n ],\n \"index\": [\n {\n \"names\": [\n \"suppliers\",\n \"products\"\n ],\n \"privileges\": [\n \"read\"\n ]\n },\n {\n \"names\": [\n \"inventory\"\n ],\n \"privileges\": [\n \"read\",\n \"write\"\n ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\": [\n \"read\",\n \"data:write/inventory\"\n ],\n \"resources\": [\n \"product/1852563\"\n ]\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->hasPrivileges([\n \"body\" => [\n \"cluster\" => array(\n \"monitor\",\n \"manage\",\n ),\n \"index\" => array(\n [\n \"names\" => array(\n \"suppliers\",\n \"products\",\n ),\n \"privileges\" => array(\n \"read\",\n ),\n ],\n [\n \"names\" => array(\n \"inventory\",\n ),\n \"privileges\" => array(\n \"read\",\n \"write\",\n ),\n ],\n ),\n \"application\" => array(\n [\n \"application\" => \"inventory_manager\",\n \"privileges\" => array(\n \"read\",\n \"data:write/inventory\",\n ),\n \"resources\" => array(\n \"product/1852563\",\n ),\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"cluster\":[\"monitor\",\"manage\"],\"index\":[{\"names\":[\"suppliers\",\"products\"],\"privileges\":[\"read\"]},{\"names\":[\"inventory\"],\"privileges\":[\"read\",\"write\"]}],\"application\":[{\"application\":\"inventory_manager\",\"privileges\":[\"read\",\"data:write/inventory\"],\"resources\":[\"product/1852563\"]}]}' \"$ELASTICSEARCH_URL/_security/user/_has_privileges\"", + "language": "curl" + } + ], "description": "Run `GET /_security/user/_has_privileges` to check whether the current user has a specific set of cluster, index, and application privileges.", "method_request": "GET /_security/user/_has_privileges", "value": "{\n \"cluster\": [ \"monitor\", \"manage\" ],\n \"index\" : [\n {\n \"names\": [ \"suppliers\", \"products\" ],\n \"privileges\": [ \"read\" ]\n },\n {\n \"names\": [ \"inventory\" ],\n \"privileges\" : [ \"read\", \"write\" ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\" : [ \"read\", \"data:write/inventory\" ],\n \"resources\" : [ \"product/1852563\" ]\n }\n ]\n}" @@ -218470,6 +229674,28 @@ "description": "Check user profile privileges.\n\nDetermine whether the users associated with the specified user profile IDs have all the requested privileges.\n\nNOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly.\nElastic reserves the right to change or remove this feature in future releases without prior notice.", "examples": { "HasPrivilegesUserProfileRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.has_privileges_user_profile(\n uids=[\n \"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0\",\n \"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1\",\n \"u_does-not-exist_0\"\n ],\n privileges={\n \"cluster\": [\n \"monitor\",\n \"create_snapshot\",\n \"manage_ml\"\n ],\n \"index\": [\n {\n \"names\": [\n \"suppliers\",\n \"products\"\n ],\n \"privileges\": [\n \"create_doc\"\n ]\n },\n {\n \"names\": [\n \"inventory\"\n ],\n \"privileges\": [\n \"read\",\n \"write\"\n ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\": [\n \"read\",\n \"data:write/inventory\"\n ],\n \"resources\": [\n \"product/1852563\"\n ]\n }\n ]\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.hasPrivilegesUserProfile({\n uids: [\n \"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0\",\n \"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1\",\n \"u_does-not-exist_0\",\n ],\n privileges: {\n cluster: [\"monitor\", \"create_snapshot\", \"manage_ml\"],\n index: [\n {\n names: [\"suppliers\", \"products\"],\n privileges: [\"create_doc\"],\n },\n {\n names: [\"inventory\"],\n privileges: [\"read\", \"write\"],\n },\n ],\n application: [\n {\n application: \"inventory_manager\",\n privileges: [\"read\", \"data:write/inventory\"],\n resources: [\"product/1852563\"],\n },\n ],\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.has_privileges_user_profile(\n body: {\n \"uids\": [\n \"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0\",\n \"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1\",\n \"u_does-not-exist_0\"\n ],\n \"privileges\": {\n \"cluster\": [\n \"monitor\",\n \"create_snapshot\",\n \"manage_ml\"\n ],\n \"index\": [\n {\n \"names\": [\n \"suppliers\",\n \"products\"\n ],\n \"privileges\": [\n \"create_doc\"\n ]\n },\n {\n \"names\": [\n \"inventory\"\n ],\n \"privileges\": [\n \"read\",\n \"write\"\n ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\": [\n \"read\",\n \"data:write/inventory\"\n ],\n \"resources\": [\n \"product/1852563\"\n ]\n }\n ]\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->hasPrivilegesUserProfile([\n \"body\" => [\n \"uids\" => array(\n \"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0\",\n \"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1\",\n \"u_does-not-exist_0\",\n ),\n \"privileges\" => [\n \"cluster\" => array(\n \"monitor\",\n \"create_snapshot\",\n \"manage_ml\",\n ),\n \"index\" => array(\n [\n \"names\" => array(\n \"suppliers\",\n \"products\",\n ),\n \"privileges\" => array(\n \"create_doc\",\n ),\n ],\n [\n \"names\" => array(\n \"inventory\",\n ),\n \"privileges\" => array(\n \"read\",\n \"write\",\n ),\n ],\n ),\n \"application\" => array(\n [\n \"application\" => \"inventory_manager\",\n \"privileges\" => array(\n \"read\",\n \"data:write/inventory\",\n ),\n \"resources\" => array(\n \"product/1852563\",\n ),\n ],\n ),\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"uids\":[\"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0\",\"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1\",\"u_does-not-exist_0\"],\"privileges\":{\"cluster\":[\"monitor\",\"create_snapshot\",\"manage_ml\"],\"index\":[{\"names\":[\"suppliers\",\"products\"],\"privileges\":[\"create_doc\"]},{\"names\":[\"inventory\"],\"privileges\":[\"read\",\"write\"]}],\"application\":[{\"application\":\"inventory_manager\",\"privileges\":[\"read\",\"data:write/inventory\"],\"resources\":[\"product/1852563\"]}]}}' \"$ELASTICSEARCH_URL/_security/profile/_has_privileges\"", + "language": "curl" + } + ], "description": "Run `POST /_security/profile/_has_privileges` to check whether the two users associated with the specified profiles have all the requested set of cluster, index, and application privileges.\n", "method_request": "POST /_security/profile/_has_privileges", "value": "{\n \"uids\": [\n \"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0\",\n \"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1\",\n \"u_does-not-exist_0\"\n ],\n \"privileges\": {\n \"cluster\": [ \"monitor\", \"create_snapshot\", \"manage_ml\" ],\n \"index\" : [\n {\n \"names\": [ \"suppliers\", \"products\" ],\n \"privileges\": [ \"create_doc\"]\n },\n {\n \"names\": [ \"inventory\" ],\n \"privileges\" : [ \"read\", \"write\" ]\n }\n ],\n \"application\": [\n {\n \"application\": \"inventory_manager\",\n \"privileges\" : [ \"read\", \"data:write/inventory\" ],\n \"resources\" : [ \"product/1852563\" ]\n }\n ]\n }\n}" @@ -218623,36 +229849,168 @@ "description": "Invalidate API keys.\n\nThis API invalidates API keys created by the create API key or grant API key APIs.\nInvalidated API keys fail authentication, but they can still be viewed using the get API key information and query API key information APIs, for at least the configured retention period, until they are automatically deleted.\n\nTo use this API, you must have at least the `manage_security`, `manage_api_key`, or `manage_own_api_key` cluster privileges.\nThe `manage_security` privilege allows deleting any API key, including both REST and cross cluster API keys.\nThe `manage_api_key` privilege allows deleting any REST API key, but not cross cluster API keys.\nThe `manage_own_api_key` only allows deleting REST API keys that are owned by the user.\nIn addition, with the `manage_own_api_key` privilege, an invalidation request must be issued in one of the three formats:\n\n- Set the parameter `owner=true`.\n- Or, set both `username` and `realm_name` to match the user's identity.\n- Or, if the request is issued by an API key, that is to say an API key invalidates itself, specify its ID in the `ids` field.", "examples": { "SecurityInvalidateApiKeyRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.invalidate_api_key(\n ids=[\n \"VuaCfGcBCdbkQm-e5aOx\"\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.invalidateApiKey({\n ids: [\"VuaCfGcBCdbkQm-e5aOx\"],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.invalidate_api_key(\n body: {\n \"ids\": [\n \"VuaCfGcBCdbkQm-e5aOx\"\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->invalidateApiKey([\n \"body\" => [\n \"ids\" => array(\n \"VuaCfGcBCdbkQm-e5aOx\",\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"ids\":[\"VuaCfGcBCdbkQm-e5aOx\"]}' \"$ELASTICSEARCH_URL/_security/api_key\"", + "language": "curl" + } + ], "description": "Run `DELETE /_security/api_key` to invalidate the API keys identified by ID.", "method_request": "DELETE /_security/api_key", "summary": "API keys by ID", "value": "{\n \"ids\" : [ \"VuaCfGcBCdbkQm-e5aOx\" ]\n}" }, "SecurityInvalidateApiKeyRequestExample2": { + "alternatives": [ + { + "code": "resp = client.security.invalidate_api_key(\n name=\"my-api-key\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.invalidateApiKey({\n name: \"my-api-key\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.invalidate_api_key(\n body: {\n \"name\": \"my-api-key\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->invalidateApiKey([\n \"body\" => [\n \"name\" => \"my-api-key\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"name\":\"my-api-key\"}' \"$ELASTICSEARCH_URL/_security/api_key\"", + "language": "curl" + } + ], "description": "Run `DELETE /_security/api_key` to invalidate the API keys identified by name.", "method_request": "DELETE /_security/api_key", "summary": "API keys by name", "value": "{\n \"name\" : \"my-api-key\"\n}" }, "SecurityInvalidateApiKeyRequestExample3": { + "alternatives": [ + { + "code": "resp = client.security.invalidate_api_key(\n realm_name=\"native1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.invalidateApiKey({\n realm_name: \"native1\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.invalidate_api_key(\n body: {\n \"realm_name\": \"native1\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->invalidateApiKey([\n \"body\" => [\n \"realm_name\" => \"native1\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"realm_name\":\"native1\"}' \"$ELASTICSEARCH_URL/_security/api_key\"", + "language": "curl" + } + ], "description": "Run `DELETE /_security/api_key` to invalidate all API keys for the `native1` realm.", "method_request": "DELETE /_security/api_key", "summary": "API keys by realm", "value": "{\n \"realm_name\" : \"native1\"\n}" }, "SecurityInvalidateApiKeyRequestExample4": { + "alternatives": [ + { + "code": "resp = client.security.invalidate_api_key(\n username=\"myuser\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.invalidateApiKey({\n username: \"myuser\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.invalidate_api_key(\n body: {\n \"username\": \"myuser\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->invalidateApiKey([\n \"body\" => [\n \"username\" => \"myuser\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"username\":\"myuser\"}' \"$ELASTICSEARCH_URL/_security/api_key\"", + "language": "curl" + } + ], "description": "Run `DELETE /_security/api_key` to invalidate all API keys for the user `myuser` in all realms.", "method_request": "DELETE /_security/api_key", "summary": "API keys by user", "value": "{\n \"username\" : \"myuser\"\n}" }, "SecurityInvalidateApiKeyRequestExample5": { + "alternatives": [ + { + "code": "resp = client.security.invalidate_api_key(\n ids=[\n \"VuaCfGcBCdbkQm-e5aOx\"\n ],\n owner=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.invalidateApiKey({\n ids: [\"VuaCfGcBCdbkQm-e5aOx\"],\n owner: \"true\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.invalidate_api_key(\n body: {\n \"ids\": [\n \"VuaCfGcBCdbkQm-e5aOx\"\n ],\n \"owner\": \"true\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->invalidateApiKey([\n \"body\" => [\n \"ids\" => array(\n \"VuaCfGcBCdbkQm-e5aOx\",\n ),\n \"owner\" => \"true\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"ids\":[\"VuaCfGcBCdbkQm-e5aOx\"],\"owner\":\"true\"}' \"$ELASTICSEARCH_URL/_security/api_key\"", + "language": "curl" + } + ], "description": "Run `DELETE /_security/api_key` to invalidate the API keys identified by ID if they are owned by the currently authenticated user.", "method_request": "DELETE /_security/api_key", "summary": "API keys by ID and owner", "value": "{\n \"ids\" : [\"VuaCfGcBCdbkQm-e5aOx\"],\n \"owner\" : \"true\"\n}" }, "SecurityInvalidateApiKeyRequestExample6": { + "alternatives": [ + { + "code": "resp = client.security.invalidate_api_key(\n username=\"myuser\",\n realm_name=\"native1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.invalidateApiKey({\n username: \"myuser\",\n realm_name: \"native1\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.invalidate_api_key(\n body: {\n \"username\": \"myuser\",\n \"realm_name\": \"native1\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->invalidateApiKey([\n \"body\" => [\n \"username\" => \"myuser\",\n \"realm_name\" => \"native1\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"username\":\"myuser\",\"realm_name\":\"native1\"}' \"$ELASTICSEARCH_URL/_security/api_key\"", + "language": "curl" + } + ], "description": "Run `DELETE /_security/api_key` to invalidate all API keys for the user `myuser` in the `native1` realm .", "method_request": "DELETE /_security/api_key", "summary": "API keys by user and realm", @@ -218810,30 +230168,140 @@ "description": "Invalidate a token.\n\nThe access tokens returned by the get token API have a finite period of time for which they are valid.\nAfter that time period, they can no longer be used.\nThe time period is defined by the `xpack.security.authc.token.timeout` setting.\n\nThe refresh tokens returned by the get token API are only valid for 24 hours.\nThey can also be used exactly once.\nIf you want to invalidate one or more access or refresh tokens immediately, use this invalidate token API.\n\nNOTE: While all parameters are optional, at least one of them is required.\nMore specifically, either one of `token` or `refresh_token` parameters is required.\nIf none of these two are specified, then `realm_name` and/or `username` need to be specified.", "examples": { "SecurityInvalidateTokenRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.invalidate_token(\n token=\"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.invalidateToken({\n token:\n \"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.invalidate_token(\n body: {\n \"token\": \"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->invalidateToken([\n \"body\" => [\n \"token\" => \"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"token\":\"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\"}' \"$ELASTICSEARCH_URL/_security/oauth2/token\"", + "language": "curl" + } + ], "description": "Run `DELETE /_security/oauth2/token` to invalidate an access token.\n", "method_request": "DELETE /_security/oauth2/token", "summary": "Invalidate an access token", "value": "{\n \"token\" : \"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\"\n}" }, "SecurityInvalidateTokenRequestExample2": { + "alternatives": [ + { + "code": "resp = client.security.invalidate_token(\n refresh_token=\"vLBPvmAB6KvwvJZr27cS\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.invalidateToken({\n refresh_token: \"vLBPvmAB6KvwvJZr27cS\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.invalidate_token(\n body: {\n \"refresh_token\": \"vLBPvmAB6KvwvJZr27cS\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->invalidateToken([\n \"body\" => [\n \"refresh_token\" => \"vLBPvmAB6KvwvJZr27cS\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"refresh_token\":\"vLBPvmAB6KvwvJZr27cS\"}' \"$ELASTICSEARCH_URL/_security/oauth2/token\"", + "language": "curl" + } + ], "description": "Run `DELETE /_security/oauth2/token` to invalidate a refresh token.\n", "method_request": "DELETE /_security/oauth2/token", "summary": "Invalidate a refresh token", "value": "{\n \"refresh_token\" : \"vLBPvmAB6KvwvJZr27cS\"\n}" }, "SecurityInvalidateTokenRequestExample3": { + "alternatives": [ + { + "code": "resp = client.security.invalidate_token(\n realm_name=\"saml1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.invalidateToken({\n realm_name: \"saml1\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.invalidate_token(\n body: {\n \"realm_name\": \"saml1\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->invalidateToken([\n \"body\" => [\n \"realm_name\" => \"saml1\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"realm_name\":\"saml1\"}' \"$ELASTICSEARCH_URL/_security/oauth2/token\"", + "language": "curl" + } + ], "description": "Run `DELETE /_security/oauth2/token` to invalidate all access tokens and refresh tokens for the `saml1` realm.", "method_request": "DELETE /_security/oauth2/token", "summary": "Invalidate tokens by realm", "value": "{\n \"realm_name\" : \"saml1\"\n}" }, "SecurityInvalidateTokenRequestExample4": { + "alternatives": [ + { + "code": "resp = client.security.invalidate_token(\n username=\"myuser\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.invalidateToken({\n username: \"myuser\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.invalidate_token(\n body: {\n \"username\": \"myuser\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->invalidateToken([\n \"body\" => [\n \"username\" => \"myuser\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"username\":\"myuser\"}' \"$ELASTICSEARCH_URL/_security/oauth2/token\"", + "language": "curl" + } + ], "description": "Run `DELETE /_security/oauth2/token` to invalidate all access tokens and refresh tokens for the user `myuser` in all realms.", "method_request": "DELETE /_security/oauth2/token", "summary": "Invalidate tokens by user", "value": "{\n \"username\" : \"myuser\"\n}" }, "SecurityInvalidateTokenRequestExample5": { + "alternatives": [ + { + "code": "resp = client.security.invalidate_token(\n username=\"myuser\",\n realm_name=\"saml1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.invalidateToken({\n username: \"myuser\",\n realm_name: \"saml1\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.invalidate_token(\n body: {\n \"username\": \"myuser\",\n \"realm_name\": \"saml1\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->invalidateToken([\n \"body\" => [\n \"username\" => \"myuser\",\n \"realm_name\" => \"saml1\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"username\":\"myuser\",\"realm_name\":\"saml1\"}' \"$ELASTICSEARCH_URL/_security/oauth2/token\"", + "language": "curl" + } + ], "description": "Run `DELETE /_security/oauth2/token` to invalidate all access tokens and refresh tokens for the user `myuser` in the `saml1` realm.", "method_request": "DELETE /_security/oauth2/token", "summary": "Invalidate tokens by user and realm", @@ -218985,6 +230453,28 @@ "description": "Authenticate OpenID Connect.\n\nExchange an OpenID Connect authentication response message for an Elasticsearch internal access token and refresh token that can be subsequently used for authentication.\n\nElasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs.\nThese APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients.", "examples": { "OidcAuthenticateRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.oidc_authenticate(\n redirect_uri=\"https://oidc-kibana.elastic.co:5603/api/security/oidc/callback?code=jtI3Ntt8v3_XvcLzCFGq&state=4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\n state=\"4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\n nonce=\"WaBPH0KqPVdG5HHdSxPRjfoZbXMCicm5v1OiAj0DUFM\",\n realm=\"oidc1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.oidcAuthenticate({\n redirect_uri:\n \"https://oidc-kibana.elastic.co:5603/api/security/oidc/callback?code=jtI3Ntt8v3_XvcLzCFGq&state=4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\n state: \"4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\n nonce: \"WaBPH0KqPVdG5HHdSxPRjfoZbXMCicm5v1OiAj0DUFM\",\n realm: \"oidc1\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.oidc_authenticate(\n body: {\n \"redirect_uri\": \"https://oidc-kibana.elastic.co:5603/api/security/oidc/callback?code=jtI3Ntt8v3_XvcLzCFGq&state=4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\n \"state\": \"4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\n \"nonce\": \"WaBPH0KqPVdG5HHdSxPRjfoZbXMCicm5v1OiAj0DUFM\",\n \"realm\": \"oidc1\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->oidcAuthenticate([\n \"body\" => [\n \"redirect_uri\" => \"https://oidc-kibana.elastic.co:5603/api/security/oidc/callback?code=jtI3Ntt8v3_XvcLzCFGq&state=4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\n \"state\" => \"4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\n \"nonce\" => \"WaBPH0KqPVdG5HHdSxPRjfoZbXMCicm5v1OiAj0DUFM\",\n \"realm\" => \"oidc1\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"redirect_uri\":\"https://oidc-kibana.elastic.co:5603/api/security/oidc/callback?code=jtI3Ntt8v3_XvcLzCFGq&state=4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\"state\":\"4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\"nonce\":\"WaBPH0KqPVdG5HHdSxPRjfoZbXMCicm5v1OiAj0DUFM\",\"realm\":\"oidc1\"}' \"$ELASTICSEARCH_URL/_security/oidc/authenticate\"", + "language": "curl" + } + ], "description": "Run `POST /_security/oidc/authenticate` to exchange the response that was returned from the OpenID Connect Provider after a successful authentication for an Elasticsearch access token and refresh token. This example is from an authentication that uses the authorization code grant flow.\n", "method_request": "POST /_security/oidc/authenticate", "value": "{\n \"redirect_uri\" : \"https://oidc-kibana.elastic.co:5603/api/security/oidc/callback?code=jtI3Ntt8v3_XvcLzCFGq&state=4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\n \"state\" : \"4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\n \"nonce\" : \"WaBPH0KqPVdG5HHdSxPRjfoZbXMCicm5v1OiAj0DUFM\",\n \"realm\" : \"oidc1\"\n}" @@ -219108,6 +230598,28 @@ "description": "Logout of OpenID Connect.\n\nInvalidate an access token and a refresh token that were generated as a response to the `/_security/oidc/authenticate` API.\n\nIf the OpenID Connect authentication realm in Elasticsearch is accordingly configured, the response to this call will contain a URI pointing to the end session endpoint of the OpenID Connect Provider in order to perform single logout.\n\nElasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs.\nThese APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients.", "examples": { "OidcLogoutRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.oidc_logout(\n token=\"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\n refresh_token=\"vLBPvmAB6KvwvJZr27cS\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.oidcLogout({\n token:\n \"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\n refresh_token: \"vLBPvmAB6KvwvJZr27cS\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.oidc_logout(\n body: {\n \"token\": \"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\n \"refresh_token\": \"vLBPvmAB6KvwvJZr27cS\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->oidcLogout([\n \"body\" => [\n \"token\" => \"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\n \"refresh_token\" => \"vLBPvmAB6KvwvJZr27cS\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"token\":\"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\"refresh_token\":\"vLBPvmAB6KvwvJZr27cS\"}' \"$ELASTICSEARCH_URL/_security/oidc/logout\"", + "language": "curl" + } + ], "description": "Run `POST /_security/oidc/logout` to perform the logout.", "method_request": "POST /_security/oidc/logout", "value": "{\n \"token\" : \"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\n \"refresh_token\": \"vLBPvmAB6KvwvJZr27cS\"\n}" @@ -219231,18 +230743,84 @@ "description": "Prepare OpenID connect authentication.\n\nCreate an oAuth 2.0 authentication request as a URL string based on the configuration of the OpenID Connect authentication realm in Elasticsearch.\n\nThe response of this API is a URL pointing to the Authorization Endpoint of the configured OpenID Connect Provider, which can be used to redirect the browser of the user in order to continue the authentication process.\n\nElasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs.\nThese APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients.", "examples": { "OidcPrepareAuthenticationRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.oidc_prepare_authentication(\n realm=\"oidc1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.oidcPrepareAuthentication({\n realm: \"oidc1\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.oidc_prepare_authentication(\n body: {\n \"realm\": \"oidc1\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->oidcPrepareAuthentication([\n \"body\" => [\n \"realm\" => \"oidc1\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"realm\":\"oidc1\"}' \"$ELASTICSEARCH_URL/_security/oidc/prepare\"", + "language": "curl" + } + ], "description": "Run `POST /_security/oidc/prepare` to generate an authentication request for the OpenID Connect Realm `oidc1`.\n", "method_request": "POST /_security/oidc/prepare", "summary": "Prepare with realm", "value": "{\n \"realm\" : \"oidc1\"\n}" }, "OidcPrepareAuthenticationRequestExample2": { + "alternatives": [ + { + "code": "resp = client.security.oidc_prepare_authentication(\n realm=\"oidc1\",\n state=\"lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO\",\n nonce=\"zOBXLJGUooRrbLbQk5YCcyC8AXw3iloynvluYhZ5\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.oidcPrepareAuthentication({\n realm: \"oidc1\",\n state: \"lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO\",\n nonce: \"zOBXLJGUooRrbLbQk5YCcyC8AXw3iloynvluYhZ5\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.oidc_prepare_authentication(\n body: {\n \"realm\": \"oidc1\",\n \"state\": \"lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO\",\n \"nonce\": \"zOBXLJGUooRrbLbQk5YCcyC8AXw3iloynvluYhZ5\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->oidcPrepareAuthentication([\n \"body\" => [\n \"realm\" => \"oidc1\",\n \"state\" => \"lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO\",\n \"nonce\" => \"zOBXLJGUooRrbLbQk5YCcyC8AXw3iloynvluYhZ5\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"realm\":\"oidc1\",\"state\":\"lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO\",\"nonce\":\"zOBXLJGUooRrbLbQk5YCcyC8AXw3iloynvluYhZ5\"}' \"$ELASTICSEARCH_URL/_security/oidc/prepare\"", + "language": "curl" + } + ], "description": "Run `POST /_security/oidc/prepare` to generate an authentication request for the OpenID Connect Realm `oidc1`, where the values for the `state` and the `nonce` have been generated by the client.\n", "method_request": "POST /_security/oidc/prepare", "summary": "Prepare with realm, state, and nonce", "value": "{\n \"realm\" : \"oidc1\",\n \"state\" : \"lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO\",\n \"nonce\" : \"zOBXLJGUooRrbLbQk5YCcyC8AXw3iloynvluYhZ5\"\n}" }, "OidcPrepareAuthenticationRequestExample3": { + "alternatives": [ + { + "code": "resp = client.security.oidc_prepare_authentication(\n iss=\"http://127.0.0.1:8080\",\n login_hint=\"this_is_an_opaque_string\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.oidcPrepareAuthentication({\n iss: \"http://127.0.0.1:8080\",\n login_hint: \"this_is_an_opaque_string\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.oidc_prepare_authentication(\n body: {\n \"iss\": \"http://127.0.0.1:8080\",\n \"login_hint\": \"this_is_an_opaque_string\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->oidcPrepareAuthentication([\n \"body\" => [\n \"iss\" => \"http://127.0.0.1:8080\",\n \"login_hint\" => \"this_is_an_opaque_string\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"iss\":\"http://127.0.0.1:8080\",\"login_hint\":\"this_is_an_opaque_string\"}' \"$ELASTICSEARCH_URL/_security/oidc/prepare\"", + "language": "curl" + } + ], "description": "Run `POST /_security/oidc/prepare` to generate an authentication request for a third party initiated single sign on. Specify the issuer that should be used for matching the appropriate OpenID Connect Authentication realm.\n", "method_request": "POST /_security/oidc/prepare", "summary": "Prepare by realm", @@ -219425,12 +231003,56 @@ "description": "Create or update application privileges.\n\nTo use this API, you must have one of the following privileges:\n\n* The `manage_security` cluster privilege (or a greater privilege such as `all`).\n* The \"Manage Application Privileges\" global privilege for the application being referenced in the request.\n\nApplication names are formed from a prefix, with an optional suffix that conform to the following rules:\n\n* The prefix must begin with a lowercase ASCII letter.\n* The prefix must contain only ASCII letters or digits.\n* The prefix must be at least 3 characters long.\n* If the suffix exists, it must begin with either a dash `-` or `_`.\n* The suffix cannot contain any of the following characters: `\\`, `/`, `*`, `?`, `\"`, `<`, `>`, `|`, `,`, `*`.\n* No part of the name can contain whitespace.\n\nPrivilege names must begin with a lowercase ASCII letter and must contain only ASCII letters and digits along with the characters `_`, `-`, and `.`.\n\nAction names can contain any number of printable ASCII characters and must contain at least one of the following characters: `/`, `*`, `:`.", "examples": { "SecurityPutPrivilegesRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.put_privileges(\n privileges={\n \"myapp\": {\n \"read\": {\n \"actions\": [\n \"data:read/*\",\n \"action:login\"\n ],\n \"metadata\": {\n \"description\": \"Read access to myapp\"\n }\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.putPrivileges({\n privileges: {\n myapp: {\n read: {\n actions: [\"data:read/*\", \"action:login\"],\n metadata: {\n description: \"Read access to myapp\",\n },\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.put_privileges(\n body: {\n \"myapp\": {\n \"read\": {\n \"actions\": [\n \"data:read/*\",\n \"action:login\"\n ],\n \"metadata\": {\n \"description\": \"Read access to myapp\"\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->putPrivileges([\n \"body\" => [\n \"myapp\" => [\n \"read\" => [\n \"actions\" => array(\n \"data:read/*\",\n \"action:login\",\n ),\n \"metadata\" => [\n \"description\" => \"Read access to myapp\",\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"myapp\":{\"read\":{\"actions\":[\"data:read/*\",\"action:login\"],\"metadata\":{\"description\":\"Read access to myapp\"}}}}' \"$ELASTICSEARCH_URL/_security/privilege\"", + "language": "curl" + } + ], "description": "Run `PUT /_security/privilege` to add a single application privilege. The wildcard (`*`) means that this privilege grants access to all actions that start with `data:read/`. Elasticsearch does not assign any meaning to these actions. However, if the request includes an application privilege such as `data:read/users` or `data:read/settings`, the has privileges API respects the use of a wildcard and returns `true`.\n", "method_request": "PUT /_security/privilege", "summary": "Add a privilege", "value": "{\n \"myapp\": {\n \"read\": {\n \"actions\": [ \n \"data:read/*\" , \n \"action:login\" ],\n \"metadata\": { \n \"description\": \"Read access to myapp\"\n }\n }\n }\n}" }, "SecurityPutPrivilegesRequestExample2": { + "alternatives": [ + { + "code": "resp = client.security.put_privileges(\n privileges={\n \"app01\": {\n \"read\": {\n \"actions\": [\n \"action:login\",\n \"data:read/*\"\n ]\n },\n \"write\": {\n \"actions\": [\n \"action:login\",\n \"data:write/*\"\n ]\n }\n },\n \"app02\": {\n \"all\": {\n \"actions\": [\n \"*\"\n ]\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.putPrivileges({\n privileges: {\n app01: {\n read: {\n actions: [\"action:login\", \"data:read/*\"],\n },\n write: {\n actions: [\"action:login\", \"data:write/*\"],\n },\n },\n app02: {\n all: {\n actions: [\"*\"],\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.put_privileges(\n body: {\n \"app01\": {\n \"read\": {\n \"actions\": [\n \"action:login\",\n \"data:read/*\"\n ]\n },\n \"write\": {\n \"actions\": [\n \"action:login\",\n \"data:write/*\"\n ]\n }\n },\n \"app02\": {\n \"all\": {\n \"actions\": [\n \"*\"\n ]\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->putPrivileges([\n \"body\" => [\n \"app01\" => [\n \"read\" => [\n \"actions\" => array(\n \"action:login\",\n \"data:read/*\",\n ),\n ],\n \"write\" => [\n \"actions\" => array(\n \"action:login\",\n \"data:write/*\",\n ),\n ],\n ],\n \"app02\" => [\n \"all\" => [\n \"actions\" => array(\n \"*\",\n ),\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"app01\":{\"read\":{\"actions\":[\"action:login\",\"data:read/*\"]},\"write\":{\"actions\":[\"action:login\",\"data:write/*\"]}},\"app02\":{\"all\":{\"actions\":[\"*\"]}}}' \"$ELASTICSEARCH_URL/_security/privilege\"", + "language": "curl" + } + ], "description": "Run `PUT /_security/privilege` to add multiple application privileges.\n", "method_request": "PUT /_security/privilege", "summary": "Add multiple privileges", @@ -219695,18 +231317,84 @@ "description": "Create or update roles.\n\nThe role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management.\nThe create or update roles API cannot update roles that are defined in roles files.\nFile-based role management is not available in Elastic Serverless.", "examples": { "SecurityPutRoleRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.put_role(\n name=\"my_admin_role\",\n description=\"Grants full access to all management features within the cluster.\",\n cluster=[\n \"all\"\n ],\n indices=[\n {\n \"names\": [\n \"index1\",\n \"index2\"\n ],\n \"privileges\": [\n \"all\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n applications=[\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n run_as=[\n \"other_user\"\n ],\n metadata={\n \"version\": 1\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.putRole({\n name: \"my_admin_role\",\n description:\n \"Grants full access to all management features within the cluster.\",\n cluster: [\"all\"],\n indices: [\n {\n names: [\"index1\", \"index2\"],\n privileges: [\"all\"],\n field_security: {\n grant: [\"title\", \"body\"],\n },\n query: '{\"match\": {\"title\": \"foo\"}}',\n },\n ],\n applications: [\n {\n application: \"myapp\",\n privileges: [\"admin\", \"read\"],\n resources: [\"*\"],\n },\n ],\n run_as: [\"other_user\"],\n metadata: {\n version: 1,\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.put_role(\n name: \"my_admin_role\",\n body: {\n \"description\": \"Grants full access to all management features within the cluster.\",\n \"cluster\": [\n \"all\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"index1\",\n \"index2\"\n ],\n \"privileges\": [\n \"all\"\n ],\n \"field_security\": {\n \"grant\": [\n \"title\",\n \"body\"\n ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [\n \"admin\",\n \"read\"\n ],\n \"resources\": [\n \"*\"\n ]\n }\n ],\n \"run_as\": [\n \"other_user\"\n ],\n \"metadata\": {\n \"version\": 1\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->putRole([\n \"name\" => \"my_admin_role\",\n \"body\" => [\n \"description\" => \"Grants full access to all management features within the cluster.\",\n \"cluster\" => array(\n \"all\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"index1\",\n \"index2\",\n ),\n \"privileges\" => array(\n \"all\",\n ),\n \"field_security\" => [\n \"grant\" => array(\n \"title\",\n \"body\",\n ),\n ],\n \"query\" => \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\",\n ],\n ),\n \"applications\" => array(\n [\n \"application\" => \"myapp\",\n \"privileges\" => array(\n \"admin\",\n \"read\",\n ),\n \"resources\" => array(\n \"*\",\n ),\n ],\n ),\n \"run_as\" => array(\n \"other_user\",\n ),\n \"metadata\" => [\n \"version\" => 1,\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"Grants full access to all management features within the cluster.\",\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index1\",\"index2\"],\"privileges\":[\"all\"],\"field_security\":{\"grant\":[\"title\",\"body\"]},\"query\":\"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\"}],\"applications\":[{\"application\":\"myapp\",\"privileges\":[\"admin\",\"read\"],\"resources\":[\"*\"]}],\"run_as\":[\"other_user\"],\"metadata\":{\"version\":1}}' \"$ELASTICSEARCH_URL/_security/role/my_admin_role\"", + "language": "curl" + } + ], "description": "Run `POST /_security/role/my_admin_role` to create a role.", "method_request": "POST /_security/role/my_admin_role", "summary": "Role example 1", "value": "{\n \"description\": \"Grants full access to all management features within the cluster.\",\n \"cluster\": [\"all\"],\n \"indices\": [\n {\n \"names\": [ \"index1\", \"index2\" ],\n \"privileges\": [\"all\"],\n \"field_security\" : { // optional\n \"grant\" : [ \"title\", \"body\" ]\n },\n \"query\": \"{\\\"match\\\": {\\\"title\\\": \\\"foo\\\"}}\" // optional\n }\n ],\n \"applications\": [\n {\n \"application\": \"myapp\",\n \"privileges\": [ \"admin\", \"read\" ],\n \"resources\": [ \"*\" ]\n }\n ],\n \"run_as\": [ \"other_user\" ], // optional\n \"metadata\" : { // optional\n \"version\" : 1\n }\n}" }, "SecurityPutRoleRequestExample2": { + "alternatives": [ + { + "code": "resp = client.security.put_role(\n name=\"cli_or_drivers_minimal\",\n cluster=[\n \"cluster:monitor/main\"\n ],\n indices=[\n {\n \"names\": [\n \"test\"\n ],\n \"privileges\": [\n \"read\",\n \"indices:admin/get\"\n ]\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.putRole({\n name: \"cli_or_drivers_minimal\",\n cluster: [\"cluster:monitor/main\"],\n indices: [\n {\n names: [\"test\"],\n privileges: [\"read\", \"indices:admin/get\"],\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.put_role(\n name: \"cli_or_drivers_minimal\",\n body: {\n \"cluster\": [\n \"cluster:monitor/main\"\n ],\n \"indices\": [\n {\n \"names\": [\n \"test\"\n ],\n \"privileges\": [\n \"read\",\n \"indices:admin/get\"\n ]\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->putRole([\n \"name\" => \"cli_or_drivers_minimal\",\n \"body\" => [\n \"cluster\" => array(\n \"cluster:monitor/main\",\n ),\n \"indices\" => array(\n [\n \"names\" => array(\n \"test\",\n ),\n \"privileges\" => array(\n \"read\",\n \"indices:admin/get\",\n ),\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"cluster\":[\"cluster:monitor/main\"],\"indices\":[{\"names\":[\"test\"],\"privileges\":[\"read\",\"indices:admin/get\"]}]}' \"$ELASTICSEARCH_URL/_security/role/cli_or_drivers_minimal\"", + "language": "curl" + } + ], "description": "Run `POST /_security/role/cli_or_drivers_minimal` to configure a role that can run SQL in JDBC.", "method_request": "POST /_security/role/cli_or_drivers_minimal", "summary": "Role example 2", "value": "{\n \"cluster\": [\"cluster:monitor/main\"],\n \"indices\": [\n {\n \"names\": [\"test\"],\n \"privileges\": [\"read\", \"indices:admin/get\"]\n }\n ]\n}" }, "SecurityPutRoleRequestExample3": { + "alternatives": [ + { + "code": "resp = client.security.put_role(\n name=\"only_remote_access_role\",\n remote_indices=[\n {\n \"clusters\": [\n \"my_remote\"\n ],\n \"names\": [\n \"logs*\"\n ],\n \"privileges\": [\n \"read\",\n \"read_cross_cluster\",\n \"view_index_metadata\"\n ]\n }\n ],\n remote_cluster=[\n {\n \"clusters\": [\n \"my_remote\"\n ],\n \"privileges\": [\n \"monitor_stats\"\n ]\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.putRole({\n name: \"only_remote_access_role\",\n remote_indices: [\n {\n clusters: [\"my_remote\"],\n names: [\"logs*\"],\n privileges: [\"read\", \"read_cross_cluster\", \"view_index_metadata\"],\n },\n ],\n remote_cluster: [\n {\n clusters: [\"my_remote\"],\n privileges: [\"monitor_stats\"],\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.put_role(\n name: \"only_remote_access_role\",\n body: {\n \"remote_indices\": [\n {\n \"clusters\": [\n \"my_remote\"\n ],\n \"names\": [\n \"logs*\"\n ],\n \"privileges\": [\n \"read\",\n \"read_cross_cluster\",\n \"view_index_metadata\"\n ]\n }\n ],\n \"remote_cluster\": [\n {\n \"clusters\": [\n \"my_remote\"\n ],\n \"privileges\": [\n \"monitor_stats\"\n ]\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->putRole([\n \"name\" => \"only_remote_access_role\",\n \"body\" => [\n \"remote_indices\" => array(\n [\n \"clusters\" => array(\n \"my_remote\",\n ),\n \"names\" => array(\n \"logs*\",\n ),\n \"privileges\" => array(\n \"read\",\n \"read_cross_cluster\",\n \"view_index_metadata\",\n ),\n ],\n ),\n \"remote_cluster\" => array(\n [\n \"clusters\" => array(\n \"my_remote\",\n ),\n \"privileges\" => array(\n \"monitor_stats\",\n ),\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"remote_indices\":[{\"clusters\":[\"my_remote\"],\"names\":[\"logs*\"],\"privileges\":[\"read\",\"read_cross_cluster\",\"view_index_metadata\"]}],\"remote_cluster\":[{\"clusters\":[\"my_remote\"],\"privileges\":[\"monitor_stats\"]}]}' \"$ELASTICSEARCH_URL/_security/role/only_remote_access_role\"", + "language": "curl" + } + ], "description": "Run `POST /_security/role/only_remote_access_role` to configure a role with remote indices and remote cluster privileges for a remote cluster.", "method_request": "POST /_security/role/only_remote_access_role", "summary": "Role example 3", @@ -219877,54 +231565,252 @@ "description": "Create or update role mappings.\n\nRole mappings define which roles are assigned to each user.\nEach mapping has rules that identify users and a list of roles that are granted to those users.\nThe role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. The create or update role mappings API cannot update role mappings that are defined in role mapping files.\n\nNOTE: This API does not create roles. Rather, it maps users to existing roles.\nRoles can be created by using the create or update roles API or roles files.\n\n**Role templates**\n\nThe most common use for role mappings is to create a mapping from a known value on the user to a fixed role name.\nFor example, all users in the `cn=admin,dc=example,dc=com` LDAP group should be given the superuser role in Elasticsearch.\nThe `roles` field is used for this purpose.\n\nFor more complex needs, it is possible to use Mustache templates to dynamically determine the names of the roles that should be granted to the user.\nThe `role_templates` field is used for this purpose.\n\nNOTE: To use role templates successfully, the relevant scripting feature must be enabled.\nOtherwise, all attempts to create a role mapping with role templates fail.\n\nAll of the user fields that are available in the role mapping rules are also available in the role templates.\nThus it is possible to assign a user to a role that reflects their username, their groups, or the name of the realm to which they authenticated.\n\nBy default a template is evaluated to produce a single string that is the name of the role which should be assigned to the user.\nIf the format of the template is set to \"json\" then the template is expected to produce a JSON string or an array of JSON strings for the role names.", "examples": { "SecurityPutRoleMappingRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.put_role_mapping(\n name=\"mapping1\",\n roles=[\n \"user\"\n ],\n enabled=True,\n rules={\n \"field\": {\n \"username\": \"*\"\n }\n },\n metadata={\n \"version\": 1\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.putRoleMapping({\n name: \"mapping1\",\n roles: [\"user\"],\n enabled: true,\n rules: {\n field: {\n username: \"*\",\n },\n },\n metadata: {\n version: 1,\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.put_role_mapping(\n name: \"mapping1\",\n body: {\n \"roles\": [\n \"user\"\n ],\n \"enabled\": true,\n \"rules\": {\n \"field\": {\n \"username\": \"*\"\n }\n },\n \"metadata\": {\n \"version\": 1\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->putRoleMapping([\n \"name\" => \"mapping1\",\n \"body\" => [\n \"roles\" => array(\n \"user\",\n ),\n \"enabled\" => true,\n \"rules\" => [\n \"field\" => [\n \"username\" => \"*\",\n ],\n ],\n \"metadata\" => [\n \"version\" => 1,\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"roles\":[\"user\"],\"enabled\":true,\"rules\":{\"field\":{\"username\":\"*\"}},\"metadata\":{\"version\":1}}' \"$ELASTICSEARCH_URL/_security/role_mapping/mapping1\"", + "language": "curl" + } + ], "description": "Run `POST /_security/role_mapping/mapping1` to assign the `user` role to all users.\n", "method_request": "POST /_security/role_mapping/mapping1", "summary": "Roles for all users", "value": "{\n \"roles\": [ \"user\"],\n \"enabled\": true, \n \"rules\": {\n \"field\" : { \"username\" : \"*\" }\n },\n \"metadata\" : { \n \"version\" : 1\n }\n}" }, "SecurityPutRoleMappingRequestExample2": { + "alternatives": [ + { + "code": "resp = client.security.put_role_mapping(\n name=\"mapping2\",\n roles=[\n \"user\",\n \"admin\"\n ],\n enabled=True,\n rules={\n \"field\": {\n \"username\": [\n \"esadmin01\",\n \"esadmin02\"\n ]\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.putRoleMapping({\n name: \"mapping2\",\n roles: [\"user\", \"admin\"],\n enabled: true,\n rules: {\n field: {\n username: [\"esadmin01\", \"esadmin02\"],\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.put_role_mapping(\n name: \"mapping2\",\n body: {\n \"roles\": [\n \"user\",\n \"admin\"\n ],\n \"enabled\": true,\n \"rules\": {\n \"field\": {\n \"username\": [\n \"esadmin01\",\n \"esadmin02\"\n ]\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->putRoleMapping([\n \"name\" => \"mapping2\",\n \"body\" => [\n \"roles\" => array(\n \"user\",\n \"admin\",\n ),\n \"enabled\" => true,\n \"rules\" => [\n \"field\" => [\n \"username\" => array(\n \"esadmin01\",\n \"esadmin02\",\n ),\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"roles\":[\"user\",\"admin\"],\"enabled\":true,\"rules\":{\"field\":{\"username\":[\"esadmin01\",\"esadmin02\"]}}}' \"$ELASTICSEARCH_URL/_security/role_mapping/mapping2\"", + "language": "curl" + } + ], "description": "Run `POST /_security/role_mapping/mapping2` to assign the \"user\" and \"admin\" roles to specific users.\n", "method_request": "POST /_security/role_mapping/mapping2", "summary": "Roles for specific users", "value": "{\n \"roles\": [ \"user\", \"admin\" ],\n \"enabled\": true,\n \"rules\": {\n \"field\" : { \"username\" : [ \"esadmin01\", \"esadmin02\" ] }\n }\n}" }, "SecurityPutRoleMappingRequestExample3": { + "alternatives": [ + { + "code": "resp = client.security.put_role_mapping(\n name=\"mapping3\",\n roles=[\n \"ldap-user\"\n ],\n enabled=True,\n rules={\n \"field\": {\n \"realm.name\": \"ldap1\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.putRoleMapping({\n name: \"mapping3\",\n roles: [\"ldap-user\"],\n enabled: true,\n rules: {\n field: {\n \"realm.name\": \"ldap1\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.put_role_mapping(\n name: \"mapping3\",\n body: {\n \"roles\": [\n \"ldap-user\"\n ],\n \"enabled\": true,\n \"rules\": {\n \"field\": {\n \"realm.name\": \"ldap1\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->putRoleMapping([\n \"name\" => \"mapping3\",\n \"body\" => [\n \"roles\" => array(\n \"ldap-user\",\n ),\n \"enabled\" => true,\n \"rules\" => [\n \"field\" => [\n \"realm.name\" => \"ldap1\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"roles\":[\"ldap-user\"],\"enabled\":true,\"rules\":{\"field\":{\"realm.name\":\"ldap1\"}}}' \"$ELASTICSEARCH_URL/_security/role_mapping/mapping3\"", + "language": "curl" + } + ], "description": "Run `POST /_security/role_mapping/mapping3` to match users who authenticated against a specific realm.\n", "method_request": "POST /_security/role_mapping/mapping3", "summary": "Roles for specific realms", "value": "{\n \"roles\": [ \"ldap-user\" ],\n \"enabled\": true,\n \"rules\": {\n \"field\" : { \"realm.name\" : \"ldap1\" }\n }\n}" }, "SecurityPutRoleMappingRequestExample4": { + "alternatives": [ + { + "code": "resp = client.security.put_role_mapping(\n name=\"mapping4\",\n roles=[\n \"superuser\"\n ],\n enabled=True,\n rules={\n \"any\": [\n {\n \"field\": {\n \"username\": \"esadmin\"\n }\n },\n {\n \"field\": {\n \"groups\": \"cn=admins,dc=example,dc=com\"\n }\n }\n ]\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.putRoleMapping({\n name: \"mapping4\",\n roles: [\"superuser\"],\n enabled: true,\n rules: {\n any: [\n {\n field: {\n username: \"esadmin\",\n },\n },\n {\n field: {\n groups: \"cn=admins,dc=example,dc=com\",\n },\n },\n ],\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.put_role_mapping(\n name: \"mapping4\",\n body: {\n \"roles\": [\n \"superuser\"\n ],\n \"enabled\": true,\n \"rules\": {\n \"any\": [\n {\n \"field\": {\n \"username\": \"esadmin\"\n }\n },\n {\n \"field\": {\n \"groups\": \"cn=admins,dc=example,dc=com\"\n }\n }\n ]\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->putRoleMapping([\n \"name\" => \"mapping4\",\n \"body\" => [\n \"roles\" => array(\n \"superuser\",\n ),\n \"enabled\" => true,\n \"rules\" => [\n \"any\" => array(\n [\n \"field\" => [\n \"username\" => \"esadmin\",\n ],\n ],\n [\n \"field\" => [\n \"groups\" => \"cn=admins,dc=example,dc=com\",\n ],\n ],\n ),\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"roles\":[\"superuser\"],\"enabled\":true,\"rules\":{\"any\":[{\"field\":{\"username\":\"esadmin\"}},{\"field\":{\"groups\":\"cn=admins,dc=example,dc=com\"}}]}}' \"$ELASTICSEARCH_URL/_security/role_mapping/mapping4\"", + "language": "curl" + } + ], "description": "Run `POST /_security/role_mapping/mapping4` to match any user where either the username is `esadmin` or the user is in the `cn=admin,dc=example,dc=com group`. This example is useful when the group names in your identity management system (such as Active Directory, or a SAML Identity Provider) do not have a one-to-one correspondence with the names of roles in Elasticsearch. The role mapping is the means by which you link a group name with a role name.\n", "method_request": "POST /_security/role_mapping/mapping4", "summary": "Roles for specific groups", "value": "{\n \"roles\": [ \"superuser\" ],\n \"enabled\": true,\n \"rules\": {\n \"any\": [\n {\n \"field\": {\n \"username\": \"esadmin\"\n }\n },\n {\n \"field\": {\n \"groups\": \"cn=admins,dc=example,dc=com\"\n }\n }\n ]\n }\n}" }, "SecurityPutRoleMappingRequestExample5": { + "alternatives": [ + { + "code": "resp = client.security.put_role_mapping(\n name=\"mapping5\",\n role_templates=[\n {\n \"template\": {\n \"source\": \"{{#tojson}}groups{{/tojson}}\"\n },\n \"format\": \"json\"\n }\n ],\n rules={\n \"field\": {\n \"realm.name\": \"saml1\"\n }\n },\n enabled=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.putRoleMapping({\n name: \"mapping5\",\n role_templates: [\n {\n template: {\n source: \"{{#tojson}}groups{{/tojson}}\",\n },\n format: \"json\",\n },\n ],\n rules: {\n field: {\n \"realm.name\": \"saml1\",\n },\n },\n enabled: true,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.put_role_mapping(\n name: \"mapping5\",\n body: {\n \"role_templates\": [\n {\n \"template\": {\n \"source\": \"{{#tojson}}groups{{/tojson}}\"\n },\n \"format\": \"json\"\n }\n ],\n \"rules\": {\n \"field\": {\n \"realm.name\": \"saml1\"\n }\n },\n \"enabled\": true\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->putRoleMapping([\n \"name\" => \"mapping5\",\n \"body\" => [\n \"role_templates\" => array(\n [\n \"template\" => [\n \"source\" => \"{{#tojson}}groups{{/tojson}}\",\n ],\n \"format\" => \"json\",\n ],\n ),\n \"rules\" => [\n \"field\" => [\n \"realm.name\" => \"saml1\",\n ],\n ],\n \"enabled\" => true,\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"role_templates\":[{\"template\":{\"source\":\"{{#tojson}}groups{{/tojson}}\"},\"format\":\"json\"}],\"rules\":{\"field\":{\"realm.name\":\"saml1\"}},\"enabled\":true}' \"$ELASTICSEARCH_URL/_security/role_mapping/mapping5\"", + "language": "curl" + } + ], "description": "Run `POST /_security/role_mapping/mapping5` to use an array syntax for the groups field when there are multiple groups. This pattern matches any of the groups (rather than all of the groups).\n", "method_request": "POST /_security/role_mapping/mapping5", "summary": "Roles for multiple groups", "value": "{\n \"role_templates\": [\n {\n \"template\": { \"source\": \"{{#tojson}}groups{{/tojson}}\" }, \n \"format\" : \"json\" \n }\n ],\n \"rules\": {\n \"field\" : { \"realm.name\" : \"saml1\" }\n },\n \"enabled\": true\n}" }, "SecurityPutRoleMappingRequestExample6": { + "alternatives": [ + { + "code": "resp = client.security.put_role_mapping(\n name=\"mapping6\",\n role_templates=[\n {\n \"template\": {\n \"source\": \"{{#tojson}}groups{{/tojson}}\"\n },\n \"format\": \"json\"\n }\n ],\n rules={\n \"field\": {\n \"realm.name\": \"saml1\"\n }\n },\n enabled=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.putRoleMapping({\n name: \"mapping6\",\n role_templates: [\n {\n template: {\n source: \"{{#tojson}}groups{{/tojson}}\",\n },\n format: \"json\",\n },\n ],\n rules: {\n field: {\n \"realm.name\": \"saml1\",\n },\n },\n enabled: true,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.put_role_mapping(\n name: \"mapping6\",\n body: {\n \"role_templates\": [\n {\n \"template\": {\n \"source\": \"{{#tojson}}groups{{/tojson}}\"\n },\n \"format\": \"json\"\n }\n ],\n \"rules\": {\n \"field\": {\n \"realm.name\": \"saml1\"\n }\n },\n \"enabled\": true\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->putRoleMapping([\n \"name\" => \"mapping6\",\n \"body\" => [\n \"role_templates\" => array(\n [\n \"template\" => [\n \"source\" => \"{{#tojson}}groups{{/tojson}}\",\n ],\n \"format\" => \"json\",\n ],\n ),\n \"rules\" => [\n \"field\" => [\n \"realm.name\" => \"saml1\",\n ],\n ],\n \"enabled\" => true,\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"role_templates\":[{\"template\":{\"source\":\"{{#tojson}}groups{{/tojson}}\"},\"format\":\"json\"}],\"rules\":{\"field\":{\"realm.name\":\"saml1\"}},\"enabled\":true}' \"$ELASTICSEARCH_URL/_security/role_mapping/mapping6\"", + "language": "curl" + } + ], "description": "Run `POST /_security/role_mapping/mapping6` for rare cases when the names of your groups may be an exact match for the names of your Elasticsearch roles. This can be the case when your SAML Identity Provider includes its own \"group mapping\" feature and can be configured to release Elasticsearch role names in the user's SAML attributes. In these cases it is possible to use a template that treats the group names as role names.\nNOTE: This should only be done if you intend to define roles for all of the provided groups. Mapping a user to a large number of unnecessary or undefined roles is inefficient and can have a negative effect on system performance. If you only need to map a subset of the groups, you should do it by using explicit mappings.\nThe `tojson` mustache function is used to convert the list of group names into a valid JSON array. Because the template produces a JSON array, the `format` must be set to `json`.\n", "method_request": "POST /_security/role_mapping/mapping6", "summary": "Templated roles for groups", "value": "{\n \"role_templates\": [\n {\n \"template\": { \"source\": \"{{#tojson}}groups{{/tojson}}\" }, \n \"format\" : \"json\" \n }\n ],\n \"rules\": {\n \"field\" : { \"realm.name\" : \"saml1\" }\n },\n \"enabled\": true\n}" }, "SecurityPutRoleMappingRequestExample7": { + "alternatives": [ + { + "code": "resp = client.security.put_role_mapping(\n name=\"mapping7\",\n roles=[\n \"ldap-example-user\"\n ],\n enabled=True,\n rules={\n \"all\": [\n {\n \"field\": {\n \"dn\": \"*,ou=subtree,dc=example,dc=com\"\n }\n },\n {\n \"field\": {\n \"realm.name\": \"ldap1\"\n }\n }\n ]\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.putRoleMapping({\n name: \"mapping7\",\n roles: [\"ldap-example-user\"],\n enabled: true,\n rules: {\n all: [\n {\n field: {\n dn: \"*,ou=subtree,dc=example,dc=com\",\n },\n },\n {\n field: {\n \"realm.name\": \"ldap1\",\n },\n },\n ],\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.put_role_mapping(\n name: \"mapping7\",\n body: {\n \"roles\": [\n \"ldap-example-user\"\n ],\n \"enabled\": true,\n \"rules\": {\n \"all\": [\n {\n \"field\": {\n \"dn\": \"*,ou=subtree,dc=example,dc=com\"\n }\n },\n {\n \"field\": {\n \"realm.name\": \"ldap1\"\n }\n }\n ]\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->putRoleMapping([\n \"name\" => \"mapping7\",\n \"body\" => [\n \"roles\" => array(\n \"ldap-example-user\",\n ),\n \"enabled\" => true,\n \"rules\" => [\n \"all\" => array(\n [\n \"field\" => [\n \"dn\" => \"*,ou=subtree,dc=example,dc=com\",\n ],\n ],\n [\n \"field\" => [\n \"realm.name\" => \"ldap1\",\n ],\n ],\n ),\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"roles\":[\"ldap-example-user\"],\"enabled\":true,\"rules\":{\"all\":[{\"field\":{\"dn\":\"*,ou=subtree,dc=example,dc=com\"}},{\"field\":{\"realm.name\":\"ldap1\"}}]}}' \"$ELASTICSEARCH_URL/_security/role_mapping/mapping7\"", + "language": "curl" + } + ], "description": "Run `POST /_security/role_mapping/mapping7` to match users within a particular LDAP sub-tree in a specific realm.\n", "method_request": "POST /_security/role_mapping/mapping7", "summary": "Users in a LDAP sub-tree and realm", "value": "{\n \"roles\": [ \"ldap-example-user\" ],\n \"enabled\": true,\n \"rules\": {\n \"all\": [\n { \"field\" : { \"dn\" : \"*,ou=subtree,dc=example,dc=com\" } },\n { \"field\" : { \"realm.name\" : \"ldap1\" } }\n ]\n }\n}" }, "SecurityPutRoleMappingRequestExample8": { + "alternatives": [ + { + "code": "resp = client.security.put_role_mapping(\n name=\"mapping8\",\n roles=[\n \"superuser\"\n ],\n enabled=True,\n rules={\n \"all\": [\n {\n \"any\": [\n {\n \"field\": {\n \"dn\": \"*,ou=admin,dc=example,dc=com\"\n }\n },\n {\n \"field\": {\n \"username\": [\n \"es-admin\",\n \"es-system\"\n ]\n }\n }\n ]\n },\n {\n \"field\": {\n \"groups\": \"cn=people,dc=example,dc=com\"\n }\n },\n {\n \"except\": {\n \"field\": {\n \"metadata.terminated_date\": None\n }\n }\n }\n ]\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.putRoleMapping({\n name: \"mapping8\",\n roles: [\"superuser\"],\n enabled: true,\n rules: {\n all: [\n {\n any: [\n {\n field: {\n dn: \"*,ou=admin,dc=example,dc=com\",\n },\n },\n {\n field: {\n username: [\"es-admin\", \"es-system\"],\n },\n },\n ],\n },\n {\n field: {\n groups: \"cn=people,dc=example,dc=com\",\n },\n },\n {\n except: {\n field: {\n \"metadata.terminated_date\": null,\n },\n },\n },\n ],\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.put_role_mapping(\n name: \"mapping8\",\n body: {\n \"roles\": [\n \"superuser\"\n ],\n \"enabled\": true,\n \"rules\": {\n \"all\": [\n {\n \"any\": [\n {\n \"field\": {\n \"dn\": \"*,ou=admin,dc=example,dc=com\"\n }\n },\n {\n \"field\": {\n \"username\": [\n \"es-admin\",\n \"es-system\"\n ]\n }\n }\n ]\n },\n {\n \"field\": {\n \"groups\": \"cn=people,dc=example,dc=com\"\n }\n },\n {\n \"except\": {\n \"field\": {\n \"metadata.terminated_date\": nil\n }\n }\n }\n ]\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->putRoleMapping([\n \"name\" => \"mapping8\",\n \"body\" => [\n \"roles\" => array(\n \"superuser\",\n ),\n \"enabled\" => true,\n \"rules\" => [\n \"all\" => array(\n [\n \"any\" => array(\n [\n \"field\" => [\n \"dn\" => \"*,ou=admin,dc=example,dc=com\",\n ],\n ],\n [\n \"field\" => [\n \"username\" => array(\n \"es-admin\",\n \"es-system\",\n ),\n ],\n ],\n ),\n ],\n [\n \"field\" => [\n \"groups\" => \"cn=people,dc=example,dc=com\",\n ],\n ],\n [\n \"except\" => [\n \"field\" => [\n \"metadata.terminated_date\" => null,\n ],\n ],\n ],\n ),\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"roles\":[\"superuser\"],\"enabled\":true,\"rules\":{\"all\":[{\"any\":[{\"field\":{\"dn\":\"*,ou=admin,dc=example,dc=com\"}},{\"field\":{\"username\":[\"es-admin\",\"es-system\"]}}]},{\"field\":{\"groups\":\"cn=people,dc=example,dc=com\"}},{\"except\":{\"field\":{\"metadata.terminated_date\":null}}}]}}' \"$ELASTICSEARCH_URL/_security/role_mapping/mapping8\"", + "language": "curl" + } + ], "description": "Run `POST /_security/role_mapping/mapping8` to assign rules that are complex and include wildcard matching. For example, this mapping matches any user where all of these conditions are met: the Distinguished Name matches the pattern `*,ou=admin,dc=example,dc=com`, or the `username` is `es-admin`, or the `username` is `es-system`; the user is in the `cn=people,dc=example,dc=com` group; the user does not have a `terminated_date`.\n", "method_request": "POST /_security/role_mapping/mapping8", "summary": "Complex roles", "value": "{\n \"roles\": [ \"superuser\" ],\n \"enabled\": true,\n \"rules\": {\n \"all\": [\n {\n \"any\": [\n {\n \"field\": {\n \"dn\": \"*,ou=admin,dc=example,dc=com\"\n }\n },\n {\n \"field\": {\n \"username\": [ \"es-admin\", \"es-system\" ]\n }\n }\n ]\n },\n {\n \"field\": {\n \"groups\": \"cn=people,dc=example,dc=com\"\n }\n },\n {\n \"except\": {\n \"field\": {\n \"metadata.terminated_date\": null\n }\n }\n }\n ]\n }\n}" }, "SecurityPutRoleMappingRequestExample9": { + "alternatives": [ + { + "code": "resp = client.security.put_role_mapping(\n name=\"mapping9\",\n rules={\n \"field\": {\n \"realm.name\": \"cloud-saml\"\n }\n },\n role_templates=[\n {\n \"template\": {\n \"source\": \"saml_user\"\n }\n },\n {\n \"template\": {\n \"source\": \"_user_{{username}}\"\n }\n }\n ],\n enabled=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.putRoleMapping({\n name: \"mapping9\",\n rules: {\n field: {\n \"realm.name\": \"cloud-saml\",\n },\n },\n role_templates: [\n {\n template: {\n source: \"saml_user\",\n },\n },\n {\n template: {\n source: \"_user_{{username}}\",\n },\n },\n ],\n enabled: true,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.put_role_mapping(\n name: \"mapping9\",\n body: {\n \"rules\": {\n \"field\": {\n \"realm.name\": \"cloud-saml\"\n }\n },\n \"role_templates\": [\n {\n \"template\": {\n \"source\": \"saml_user\"\n }\n },\n {\n \"template\": {\n \"source\": \"_user_{{username}}\"\n }\n }\n ],\n \"enabled\": true\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->putRoleMapping([\n \"name\" => \"mapping9\",\n \"body\" => [\n \"rules\" => [\n \"field\" => [\n \"realm.name\" => \"cloud-saml\",\n ],\n ],\n \"role_templates\" => array(\n [\n \"template\" => [\n \"source\" => \"saml_user\",\n ],\n ],\n [\n \"template\" => [\n \"source\" => \"_user_{{username}}\",\n ],\n ],\n ),\n \"enabled\" => true,\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"rules\":{\"field\":{\"realm.name\":\"cloud-saml\"}},\"role_templates\":[{\"template\":{\"source\":\"saml_user\"}},{\"template\":{\"source\":\"_user_{{username}}\"}}],\"enabled\":true}' \"$ELASTICSEARCH_URL/_security/role_mapping/mapping9\"", + "language": "curl" + } + ], "description": "Run `POST /_security/role_mapping/mapping9` to use templated roles to automatically map every user to their own custom role. In this example every user who authenticates using the `cloud-saml` realm will be automatically mapped to two roles: the `saml_user` role and a role that is their username prefixed with `_user_`. For example, the user `nwong` would be assigned the `saml_user` and `_user_nwong` roles.\n", "method_request": "POST /_security/role_mapping/mapping9", "summary": "Templated roles", @@ -220150,6 +232036,28 @@ "description": "Create or update users.\n\nAdd and update users in the native realm.\nA password is required for adding a new user but is optional when updating an existing user.\nTo change a user's password without updating any other fields, use the change password API.", "examples": { "SecurityPutUserRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.put_user(\n username=\"jacknich\",\n password=\"l0ng-r4nd0m-p@ssw0rd\",\n roles=[\n \"admin\",\n \"other_role1\"\n ],\n full_name=\"Jack Nicholson\",\n email=\"jacknich@example.com\",\n metadata={\n \"intelligence\": 7\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.putUser({\n username: \"jacknich\",\n password: \"l0ng-r4nd0m-p@ssw0rd\",\n roles: [\"admin\", \"other_role1\"],\n full_name: \"Jack Nicholson\",\n email: \"jacknich@example.com\",\n metadata: {\n intelligence: 7,\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.put_user(\n username: \"jacknich\",\n body: {\n \"password\": \"l0ng-r4nd0m-p@ssw0rd\",\n \"roles\": [\n \"admin\",\n \"other_role1\"\n ],\n \"full_name\": \"Jack Nicholson\",\n \"email\": \"jacknich@example.com\",\n \"metadata\": {\n \"intelligence\": 7\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->putUser([\n \"username\" => \"jacknich\",\n \"body\" => [\n \"password\" => \"l0ng-r4nd0m-p@ssw0rd\",\n \"roles\" => array(\n \"admin\",\n \"other_role1\",\n ),\n \"full_name\" => \"Jack Nicholson\",\n \"email\" => \"jacknich@example.com\",\n \"metadata\" => [\n \"intelligence\" => 7,\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"password\":\"l0ng-r4nd0m-p@ssw0rd\",\"roles\":[\"admin\",\"other_role1\"],\"full_name\":\"Jack Nicholson\",\"email\":\"jacknich@example.com\",\"metadata\":{\"intelligence\":7}}' \"$ELASTICSEARCH_URL/_security/user/jacknich\"", + "language": "curl" + } + ], "description": "Run `POST /_security/user/jacknich` to activate a user profile.", "method_request": "POST /_security/user/jacknich", "value": "{\n \"password\" : \"l0ng-r4nd0m-p@ssw0rd\",\n \"roles\" : [ \"admin\", \"other_role1\" ],\n \"full_name\" : \"Jack Nicholson\",\n \"email\" : \"jacknich@example.com\",\n \"metadata\" : {\n \"intelligence\" : 7\n }\n}" @@ -220912,18 +232820,84 @@ "description": "Find API keys with a query.\n\nGet a paginated list of API keys and their information.\nYou can optionally filter the results with a query.\n\nTo use this API, you must have at least the `manage_own_api_key` or the `read_security` cluster privileges.\nIf you have only the `manage_own_api_key` privilege, this API returns only the API keys that you own.\nIf you have the `read_security`, `manage_api_key`, or greater privileges (including `manage_security`), this API returns all API keys regardless of ownership.", "examples": { "QueryApiKeysRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.query_api_keys(\n with_limited_by=True,\n query={\n \"ids\": {\n \"values\": [\n \"VuaCfGcBCdbkQm-e5aOx\"\n ]\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.queryApiKeys({\n with_limited_by: \"true\",\n query: {\n ids: {\n values: [\"VuaCfGcBCdbkQm-e5aOx\"],\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.query_api_keys(\n with_limited_by: \"true\",\n body: {\n \"query\": {\n \"ids\": {\n \"values\": [\n \"VuaCfGcBCdbkQm-e5aOx\"\n ]\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->queryApiKeys([\n \"with_limited_by\" => \"true\",\n \"body\" => [\n \"query\" => [\n \"ids\" => [\n \"values\" => array(\n \"VuaCfGcBCdbkQm-e5aOx\",\n ),\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"ids\":{\"values\":[\"VuaCfGcBCdbkQm-e5aOx\"]}}}' \"$ELASTICSEARCH_URL/_security/_query/api_key?with_limited_by=true\"", + "language": "curl" + } + ], "description": "Run `GET /_security/_query/api_key?with_limited_by=true` to retrieve an API key by ID.", "method_request": "GET /_security/_query/api_key?with_limited_by=true", "summary": "Query API keys by ID", "value": "{\n \"query\": {\n \"ids\": {\n \"values\": [\n \"VuaCfGcBCdbkQm-e5aOx\"\n ]\n }\n }\n}" }, "QueryApiKeysRequestExample2": { + "alternatives": [ + { + "code": "resp = client.security.query_api_keys(\n query={\n \"bool\": {\n \"must\": [\n {\n \"prefix\": {\n \"name\": \"app1-key-\"\n }\n },\n {\n \"term\": {\n \"invalidated\": \"false\"\n }\n }\n ],\n \"must_not\": [\n {\n \"term\": {\n \"name\": \"app1-key-01\"\n }\n }\n ],\n \"filter\": [\n {\n \"wildcard\": {\n \"username\": \"org-*-user\"\n }\n },\n {\n \"term\": {\n \"metadata.environment\": \"production\"\n }\n }\n ]\n }\n },\n from=20,\n size=10,\n sort=[\n {\n \"creation\": {\n \"order\": \"desc\",\n \"format\": \"date_time\"\n }\n },\n \"name\"\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.queryApiKeys({\n query: {\n bool: {\n must: [\n {\n prefix: {\n name: \"app1-key-\",\n },\n },\n {\n term: {\n invalidated: \"false\",\n },\n },\n ],\n must_not: [\n {\n term: {\n name: \"app1-key-01\",\n },\n },\n ],\n filter: [\n {\n wildcard: {\n username: \"org-*-user\",\n },\n },\n {\n term: {\n \"metadata.environment\": \"production\",\n },\n },\n ],\n },\n },\n from: 20,\n size: 10,\n sort: [\n {\n creation: {\n order: \"desc\",\n format: \"date_time\",\n },\n },\n \"name\",\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.query_api_keys(\n body: {\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"prefix\": {\n \"name\": \"app1-key-\"\n }\n },\n {\n \"term\": {\n \"invalidated\": \"false\"\n }\n }\n ],\n \"must_not\": [\n {\n \"term\": {\n \"name\": \"app1-key-01\"\n }\n }\n ],\n \"filter\": [\n {\n \"wildcard\": {\n \"username\": \"org-*-user\"\n }\n },\n {\n \"term\": {\n \"metadata.environment\": \"production\"\n }\n }\n ]\n }\n },\n \"from\": 20,\n \"size\": 10,\n \"sort\": [\n {\n \"creation\": {\n \"order\": \"desc\",\n \"format\": \"date_time\"\n }\n },\n \"name\"\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->queryApiKeys([\n \"body\" => [\n \"query\" => [\n \"bool\" => [\n \"must\" => array(\n [\n \"prefix\" => [\n \"name\" => \"app1-key-\",\n ],\n ],\n [\n \"term\" => [\n \"invalidated\" => \"false\",\n ],\n ],\n ),\n \"must_not\" => array(\n [\n \"term\" => [\n \"name\" => \"app1-key-01\",\n ],\n ],\n ),\n \"filter\" => array(\n [\n \"wildcard\" => [\n \"username\" => \"org-*-user\",\n ],\n ],\n [\n \"term\" => [\n \"metadata.environment\" => \"production\",\n ],\n ],\n ),\n ],\n ],\n \"from\" => 20,\n \"size\" => 10,\n \"sort\" => array(\n [\n \"creation\" => [\n \"order\" => \"desc\",\n \"format\" => \"date_time\",\n ],\n ],\n \"name\",\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"bool\":{\"must\":[{\"prefix\":{\"name\":\"app1-key-\"}},{\"term\":{\"invalidated\":\"false\"}}],\"must_not\":[{\"term\":{\"name\":\"app1-key-01\"}}],\"filter\":[{\"wildcard\":{\"username\":\"org-*-user\"}},{\"term\":{\"metadata.environment\":\"production\"}}]}},\"from\":20,\"size\":10,\"sort\":[{\"creation\":{\"order\":\"desc\",\"format\":\"date_time\"}},\"name\"]}' \"$ELASTICSEARCH_URL/_security/_query/api_key\"", + "language": "curl" + } + ], "description": "Run `GET /_security/_query/api_key`. Use a `bool` query to issue complex logical conditions and use `from`, `size`, and `sort` to help paginate the result. For example, the API key name must begin with `app1-key-` and must not be `app1-key-01`. It must be owned by a username with the wildcard pattern `org-*-user` and the `environment` metadata field must have a `production` value. The offset to begin the search result is the twentieth (zero-based index) API key. The page size of the response is 10 API keys. The result is first sorted by creation date in descending order, then by name in ascending order.\n", "method_request": "GET /_security/_query/api_key", "summary": "Query API keys with pagination", "value": "{\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"prefix\": {\n \"name\": \"app1-key-\" \n }\n },\n {\n \"term\": {\n \"invalidated\": \"false\" \n }\n }\n ],\n \"must_not\": [\n {\n \"term\": {\n \"name\": \"app1-key-01\" \n }\n }\n ],\n \"filter\": [\n {\n \"wildcard\": {\n \"username\": \"org-*-user\" \n }\n },\n {\n \"term\": {\n \"metadata.environment\": \"production\" \n }\n }\n ]\n }\n },\n \"from\": 20, \n \"size\": 10, \n \"sort\": [ \n { \"creation\": { \"order\": \"desc\", \"format\": \"date_time\" } },\n \"name\"\n ]\n}" }, "QueryApiKeysRequestExample3": { + "alternatives": [ + { + "code": "resp = client.security.query_api_keys(\n query={\n \"term\": {\n \"name\": {\n \"value\": \"application-key-1\"\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.queryApiKeys({\n query: {\n term: {\n name: {\n value: \"application-key-1\",\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.query_api_keys(\n body: {\n \"query\": {\n \"term\": {\n \"name\": {\n \"value\": \"application-key-1\"\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->queryApiKeys([\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"name\" => [\n \"value\" => \"application-key-1\",\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"name\":{\"value\":\"application-key-1\"}}}}' \"$ELASTICSEARCH_URL/_security/_query/api_key\"", + "language": "curl" + } + ], "description": "Run `GET /_security/_query/api_key` to retrieve the API key by name.", "method_request": "GET /_security/_query/api_key", "summary": "Query API keys by name", @@ -221211,12 +233185,56 @@ "description": "Find roles with a query.\n\nGet roles in a paginated manner.\nThe role management APIs are generally the preferred way to manage roles, rather than using file-based role management.\nThe query roles API does not retrieve roles that are defined in roles files, nor built-in ones.\nYou can optionally filter the results with a query.\nAlso, the results can be paginated and sorted.", "examples": { "QueryRolesRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.query_role(\n sort=[\n \"name\"\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.queryRole({\n sort: [\"name\"],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.query_role(\n body: {\n \"sort\": [\n \"name\"\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->queryRole([\n \"body\" => [\n \"sort\" => array(\n \"name\",\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"sort\":[\"name\"]}' \"$ELASTICSEARCH_URL/_security/_query/role\"", + "language": "curl" + } + ], "description": "Run `POST /_security/_query/role` to lists all roles, sorted by the role name.", "method_request": "POST /_security/_query/role", "summary": "Query roles by name", "value": "{\n \"sort\": [\"name\"]\n}" }, "QueryRolesRequestExample2": { + "alternatives": [ + { + "code": "resp = client.security.query_role(\n query={\n \"match\": {\n \"description\": {\n \"query\": \"user access\"\n }\n }\n },\n size=1,\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.queryRole({\n query: {\n match: {\n description: {\n query: \"user access\",\n },\n },\n },\n size: 1,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.query_role(\n body: {\n \"query\": {\n \"match\": {\n \"description\": {\n \"query\": \"user access\"\n }\n }\n },\n \"size\": 1\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->queryRole([\n \"body\" => [\n \"query\" => [\n \"match\" => [\n \"description\" => [\n \"query\" => \"user access\",\n ],\n ],\n ],\n \"size\" => 1,\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"match\":{\"description\":{\"query\":\"user access\"}}},\"size\":1}' \"$ELASTICSEARCH_URL/_security/_query/role\"", + "language": "curl" + } + ], "description": "Run `POST /_security/_query/role` to query only the user access role, given its description. It returns only the best matching role because `size` is set to `1`.\n", "method_request": "POST /_security/_query/role", "summary": "Query roles by description", @@ -221630,12 +233648,56 @@ "description": "Find users with a query.\n\nGet information for users in a paginated manner.\nYou can optionally filter the results with a query.\n\nNOTE: As opposed to the get user API, built-in users are excluded from the result.\nThis API is only for native users.", "examples": { "SecurityQueryUserRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.query_user(\n with_profile_uid=True,\n query={\n \"prefix\": {\n \"roles\": \"other\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.queryUser({\n with_profile_uid: \"true\",\n query: {\n prefix: {\n roles: \"other\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.query_user(\n with_profile_uid: \"true\",\n body: {\n \"query\": {\n \"prefix\": {\n \"roles\": \"other\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->queryUser([\n \"with_profile_uid\" => \"true\",\n \"body\" => [\n \"query\" => [\n \"prefix\" => [\n \"roles\" => \"other\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"prefix\":{\"roles\":\"other\"}}}' \"$ELASTICSEARCH_URL/_security/_query/user?with_profile_uid=true\"", + "language": "curl" + } + ], "description": "Run `POST /_security/_query/user?with_profile_uid=true` to get users that have roles that are prefixed with `other`. It will also include the user `profile_uid` in the response.\n", "method_request": "POST /_security/_query/user?with_profile_uid=true", "summary": "Query users by role prefix", "value": "{\n \"query\": {\n \"prefix\": {\n \"roles\": \"other\"\n }\n }\n}" }, "SecurityQueryUserRequestExample2": { + "alternatives": [ + { + "code": "resp = client.security.query_user(\n query={\n \"bool\": {\n \"must\": [\n {\n \"wildcard\": {\n \"email\": \"*example.com\"\n }\n },\n {\n \"term\": {\n \"enabled\": True\n }\n }\n ],\n \"filter\": [\n {\n \"wildcard\": {\n \"roles\": \"*other*\"\n }\n }\n ]\n }\n },\n from=1,\n size=2,\n sort=[\n {\n \"username\": {\n \"order\": \"desc\"\n }\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.queryUser({\n query: {\n bool: {\n must: [\n {\n wildcard: {\n email: \"*example.com\",\n },\n },\n {\n term: {\n enabled: true,\n },\n },\n ],\n filter: [\n {\n wildcard: {\n roles: \"*other*\",\n },\n },\n ],\n },\n },\n from: 1,\n size: 2,\n sort: [\n {\n username: {\n order: \"desc\",\n },\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.query_user(\n body: {\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"wildcard\": {\n \"email\": \"*example.com\"\n }\n },\n {\n \"term\": {\n \"enabled\": true\n }\n }\n ],\n \"filter\": [\n {\n \"wildcard\": {\n \"roles\": \"*other*\"\n }\n }\n ]\n }\n },\n \"from\": 1,\n \"size\": 2,\n \"sort\": [\n {\n \"username\": {\n \"order\": \"desc\"\n }\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->queryUser([\n \"body\" => [\n \"query\" => [\n \"bool\" => [\n \"must\" => array(\n [\n \"wildcard\" => [\n \"email\" => \"*example.com\",\n ],\n ],\n [\n \"term\" => [\n \"enabled\" => true,\n ],\n ],\n ),\n \"filter\" => array(\n [\n \"wildcard\" => [\n \"roles\" => \"*other*\",\n ],\n ],\n ),\n ],\n ],\n \"from\" => 1,\n \"size\" => 2,\n \"sort\" => array(\n [\n \"username\" => [\n \"order\" => \"desc\",\n ],\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"bool\":{\"must\":[{\"wildcard\":{\"email\":\"*example.com\"}},{\"term\":{\"enabled\":true}}],\"filter\":[{\"wildcard\":{\"roles\":\"*other*\"}}]}},\"from\":1,\"size\":2,\"sort\":[{\"username\":{\"order\":\"desc\"}}]}' \"$ELASTICSEARCH_URL/_security/_query/user\"", + "language": "curl" + } + ], "description": "Run `POST /_security/_query/user`. Use a `bool` query to issue complex logical conditions: The `email` must end with `example.com`. The user must be enabled. The result will be filtered to only contain users with at least one role that contains the substring `other`. The offset to begin the search result is the second (zero-based index) user. The page size of the response is two users. The result is sorted by `username` in descending order.\n", "method_request": "POST /_security/_query/user", "summary": "Query users with multiple conditions", @@ -222011,6 +234073,28 @@ "description": "Authenticate SAML.\n\nSubmit a SAML response message to Elasticsearch for consumption.\n\nNOTE: This API is intended for use by custom web applications other than Kibana.\nIf you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.\n\nThe SAML message that is submitted can be:\n\n* A response to a SAML authentication request that was previously created using the SAML prepare authentication API.\n* An unsolicited SAML message in the case of an IdP-initiated single sign-on (SSO) flow.\n\nIn either case, the SAML message needs to be a base64 encoded XML document with a root element of ``.\n\nAfter successful validation, Elasticsearch responds with an Elasticsearch internal access token and refresh token that can be subsequently used for authentication.\nThis API endpoint essentially exchanges SAML responses that indicate successful authentication in the IdP for Elasticsearch access and refresh tokens, which can be used for authentication against Elasticsearch.", "examples": { "SamlAuthenticateRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.saml_authenticate(\n content=\"PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....\",\n ids=[\n \"4fee3b046395c4e751011e97f8900b5273d56685\"\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.samlAuthenticate({\n content:\n \"PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....\",\n ids: [\"4fee3b046395c4e751011e97f8900b5273d56685\"],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.saml_authenticate(\n body: {\n \"content\": \"PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....\",\n \"ids\": [\n \"4fee3b046395c4e751011e97f8900b5273d56685\"\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->samlAuthenticate([\n \"body\" => [\n \"content\" => \"PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....\",\n \"ids\" => array(\n \"4fee3b046395c4e751011e97f8900b5273d56685\",\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"content\":\"PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....\",\"ids\":[\"4fee3b046395c4e751011e97f8900b5273d56685\"]}' \"$ELASTICSEARCH_URL/_security/saml/authenticate\"", + "language": "curl" + } + ], "description": "Run `POST /_security/saml/authenticate` to exchange a SAML Response indicating a successful authentication at the SAML IdP for an Elasticsearch access token and refresh token to be used in subsequent requests.\n", "method_request": "POST /_security/saml/authenticate", "value": "{\n \"content\" : \"PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....\",\n \"ids\" : [\"4fee3b046395c4e751011e97f8900b5273d56685\"]\n}" @@ -222170,12 +234254,56 @@ "description": "Logout of SAML completely.\n\nVerifies the logout response sent from the SAML IdP.\n\nNOTE: This API is intended for use by custom web applications other than Kibana.\nIf you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.\n\nThe SAML IdP may send a logout response back to the SP after handling the SP-initiated SAML Single Logout.\nThis API verifies the response by ensuring the content is relevant and validating its signature.\nAn empty response is returned if the verification process is successful.\nThe response can be sent by the IdP with either the HTTP-Redirect or the HTTP-Post binding.\nThe caller of this API must prepare the request accordingly so that this API can handle either of them.", "examples": { "SamlCompleteLogoutRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.saml_complete_logout(\n realm=\"saml1\",\n ids=[\n \"_1c368075e0b3...\"\n ],\n query_string=\"SAMLResponse=fZHLasMwEEVbfb1bf...&SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=CuCmFn%2BLqnaZGZJqK...\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.samlCompleteLogout({\n realm: \"saml1\",\n ids: [\"_1c368075e0b3...\"],\n query_string:\n \"SAMLResponse=fZHLasMwEEVbfb1bf...&SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=CuCmFn%2BLqnaZGZJqK...\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.saml_complete_logout(\n body: {\n \"realm\": \"saml1\",\n \"ids\": [\n \"_1c368075e0b3...\"\n ],\n \"query_string\": \"SAMLResponse=fZHLasMwEEVbfb1bf...&SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=CuCmFn%2BLqnaZGZJqK...\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->samlCompleteLogout([\n \"body\" => [\n \"realm\" => \"saml1\",\n \"ids\" => array(\n \"_1c368075e0b3...\",\n ),\n \"query_string\" => \"SAMLResponse=fZHLasMwEEVbfb1bf...&SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=CuCmFn%2BLqnaZGZJqK...\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"realm\":\"saml1\",\"ids\":[\"_1c368075e0b3...\"],\"query_string\":\"SAMLResponse=fZHLasMwEEVbfb1bf...&SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=CuCmFn%2BLqnaZGZJqK...\"}' \"$ELASTICSEARCH_URL/_security/saml/complete_logout\"", + "language": "curl" + } + ], "description": "Run `POST /_security/saml/complete_logout` to verify the logout response sent by the SAML IdP using the HTTP-Redirect binding.\n", "method_request": "POST /_security/saml/complete_logout", "summary": "HTTP-Redirect binding", "value": "{\n \"realm\": \"saml1\",\n \"ids\": [ \"_1c368075e0b3...\" ],\n \"query_string\": \"SAMLResponse=fZHLasMwEEVbfb1bf...&SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=CuCmFn%2BLqnaZGZJqK...\"\n}" }, "SamlCompleteLogoutRequestExample2": { + "alternatives": [ + { + "code": "resp = client.security.saml_complete_logout(\n realm=\"saml1\",\n ids=[\n \"_1c368075e0b3...\"\n ],\n content=\"PHNhbWxwOkxvZ291dFJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46...\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.samlCompleteLogout({\n realm: \"saml1\",\n ids: [\"_1c368075e0b3...\"],\n content: \"PHNhbWxwOkxvZ291dFJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46...\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.saml_complete_logout(\n body: {\n \"realm\": \"saml1\",\n \"ids\": [\n \"_1c368075e0b3...\"\n ],\n \"content\": \"PHNhbWxwOkxvZ291dFJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46...\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->samlCompleteLogout([\n \"body\" => [\n \"realm\" => \"saml1\",\n \"ids\" => array(\n \"_1c368075e0b3...\",\n ),\n \"content\" => \"PHNhbWxwOkxvZ291dFJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46...\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"realm\":\"saml1\",\"ids\":[\"_1c368075e0b3...\"],\"content\":\"PHNhbWxwOkxvZ291dFJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46...\"}' \"$ELASTICSEARCH_URL/_security/saml/complete_logout\"", + "language": "curl" + } + ], "description": "Run `POST /_security/saml/complete_logout` to verify the logout response sent by the SAML IdP using the HTTP-Post binding.\n", "method_request": "POST /_security/saml/complete_logout", "summary": "HTTP-Post binding", @@ -222256,6 +234384,28 @@ "description": "Invalidate SAML.\n\nSubmit a SAML LogoutRequest message to Elasticsearch for consumption.\n\nNOTE: This API is intended for use by custom web applications other than Kibana.\nIf you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.\n\nThe logout request comes from the SAML IdP during an IdP initiated Single Logout.\nThe custom web application can use this API to have Elasticsearch process the `LogoutRequest`.\nAfter successful validation of the request, Elasticsearch invalidates the access token and refresh token that corresponds to that specific SAML principal and provides a URL that contains a SAML LogoutResponse message.\nThus the user can be redirected back to their IdP.", "examples": { "SamlInvalidateRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.saml_invalidate(\n query_string=\"SAMLRequest=nZFda4MwFIb%2FiuS%2BmviRpqFaClKQdbvo2g12M2KMraCJ9cRR9utnW4Wyi13sMie873MeznJ1aWrnS3VQGR0j4mLkKC1NUeljjA77zYyhVbIE0dR%2By7fmaHq7U%2BdegXWGpAZ%2B%2F4pR32luBFTAtWgUcCv56%2Fp5y30X87Yz1khTIycdgpUW9kY7WdsC9zxoXTvMvWuVV98YyMnSGH2SYE5pwALBIr9QKiwDGpW0oGVUznGeMyJZKFkQ4jBf5HnhUymjIhzCAL3KNFihbYx8TBYzzGaY7EnIyZwHzCWMfiDnbRIftkSjJr%2BFu0e9v%2B0EgOquRiiZjKpiVFp6j50T4WXoyNJ%2FEWC9fdqc1t%2F1%2B2F3aUpjzhPiXpqMz1%2FHSn4A&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256&Signature=MsAYz2NFdovMG2mXf6TSpu5vlQQyEJAg%2B4KCwBqJTmrb3yGXKUtIgvjqf88eCAK32v3eN8vupjPC8LglYmke1ZnjK0%2FKxzkvSjTVA7mMQe2AQdKbkyC038zzRq%2FYHcjFDE%2Bz0qISwSHZY2NyLePmwU7SexEXnIz37jKC6NMEhus%3D\",\n realm=\"saml1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.samlInvalidate({\n query_string:\n \"SAMLRequest=nZFda4MwFIb%2FiuS%2BmviRpqFaClKQdbvo2g12M2KMraCJ9cRR9utnW4Wyi13sMie873MeznJ1aWrnS3VQGR0j4mLkKC1NUeljjA77zYyhVbIE0dR%2By7fmaHq7U%2BdegXWGpAZ%2B%2F4pR32luBFTAtWgUcCv56%2Fp5y30X87Yz1khTIycdgpUW9kY7WdsC9zxoXTvMvWuVV98YyMnSGH2SYE5pwALBIr9QKiwDGpW0oGVUznGeMyJZKFkQ4jBf5HnhUymjIhzCAL3KNFihbYx8TBYzzGaY7EnIyZwHzCWMfiDnbRIftkSjJr%2BFu0e9v%2B0EgOquRiiZjKpiVFp6j50T4WXoyNJ%2FEWC9fdqc1t%2F1%2B2F3aUpjzhPiXpqMz1%2FHSn4A&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256&Signature=MsAYz2NFdovMG2mXf6TSpu5vlQQyEJAg%2B4KCwBqJTmrb3yGXKUtIgvjqf88eCAK32v3eN8vupjPC8LglYmke1ZnjK0%2FKxzkvSjTVA7mMQe2AQdKbkyC038zzRq%2FYHcjFDE%2Bz0qISwSHZY2NyLePmwU7SexEXnIz37jKC6NMEhus%3D\",\n realm: \"saml1\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.saml_invalidate(\n body: {\n \"query_string\": \"SAMLRequest=nZFda4MwFIb%2FiuS%2BmviRpqFaClKQdbvo2g12M2KMraCJ9cRR9utnW4Wyi13sMie873MeznJ1aWrnS3VQGR0j4mLkKC1NUeljjA77zYyhVbIE0dR%2By7fmaHq7U%2BdegXWGpAZ%2B%2F4pR32luBFTAtWgUcCv56%2Fp5y30X87Yz1khTIycdgpUW9kY7WdsC9zxoXTvMvWuVV98YyMnSGH2SYE5pwALBIr9QKiwDGpW0oGVUznGeMyJZKFkQ4jBf5HnhUymjIhzCAL3KNFihbYx8TBYzzGaY7EnIyZwHzCWMfiDnbRIftkSjJr%2BFu0e9v%2B0EgOquRiiZjKpiVFp6j50T4WXoyNJ%2FEWC9fdqc1t%2F1%2B2F3aUpjzhPiXpqMz1%2FHSn4A&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256&Signature=MsAYz2NFdovMG2mXf6TSpu5vlQQyEJAg%2B4KCwBqJTmrb3yGXKUtIgvjqf88eCAK32v3eN8vupjPC8LglYmke1ZnjK0%2FKxzkvSjTVA7mMQe2AQdKbkyC038zzRq%2FYHcjFDE%2Bz0qISwSHZY2NyLePmwU7SexEXnIz37jKC6NMEhus%3D\",\n \"realm\": \"saml1\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->samlInvalidate([\n \"body\" => [\n \"query_string\" => \"SAMLRequest=nZFda4MwFIb%2FiuS%2BmviRpqFaClKQdbvo2g12M2KMraCJ9cRR9utnW4Wyi13sMie873MeznJ1aWrnS3VQGR0j4mLkKC1NUeljjA77zYyhVbIE0dR%2By7fmaHq7U%2BdegXWGpAZ%2B%2F4pR32luBFTAtWgUcCv56%2Fp5y30X87Yz1khTIycdgpUW9kY7WdsC9zxoXTvMvWuVV98YyMnSGH2SYE5pwALBIr9QKiwDGpW0oGVUznGeMyJZKFkQ4jBf5HnhUymjIhzCAL3KNFihbYx8TBYzzGaY7EnIyZwHzCWMfiDnbRIftkSjJr%2BFu0e9v%2B0EgOquRiiZjKpiVFp6j50T4WXoyNJ%2FEWC9fdqc1t%2F1%2B2F3aUpjzhPiXpqMz1%2FHSn4A&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256&Signature=MsAYz2NFdovMG2mXf6TSpu5vlQQyEJAg%2B4KCwBqJTmrb3yGXKUtIgvjqf88eCAK32v3eN8vupjPC8LglYmke1ZnjK0%2FKxzkvSjTVA7mMQe2AQdKbkyC038zzRq%2FYHcjFDE%2Bz0qISwSHZY2NyLePmwU7SexEXnIz37jKC6NMEhus%3D\",\n \"realm\" => \"saml1\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query_string\":\"SAMLRequest=nZFda4MwFIb%2FiuS%2BmviRpqFaClKQdbvo2g12M2KMraCJ9cRR9utnW4Wyi13sMie873MeznJ1aWrnS3VQGR0j4mLkKC1NUeljjA77zYyhVbIE0dR%2By7fmaHq7U%2BdegXWGpAZ%2B%2F4pR32luBFTAtWgUcCv56%2Fp5y30X87Yz1khTIycdgpUW9kY7WdsC9zxoXTvMvWuVV98YyMnSGH2SYE5pwALBIr9QKiwDGpW0oGVUznGeMyJZKFkQ4jBf5HnhUymjIhzCAL3KNFihbYx8TBYzzGaY7EnIyZwHzCWMfiDnbRIftkSjJr%2BFu0e9v%2B0EgOquRiiZjKpiVFp6j50T4WXoyNJ%2FEWC9fdqc1t%2F1%2B2F3aUpjzhPiXpqMz1%2FHSn4A&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256&Signature=MsAYz2NFdovMG2mXf6TSpu5vlQQyEJAg%2B4KCwBqJTmrb3yGXKUtIgvjqf88eCAK32v3eN8vupjPC8LglYmke1ZnjK0%2FKxzkvSjTVA7mMQe2AQdKbkyC038zzRq%2FYHcjFDE%2Bz0qISwSHZY2NyLePmwU7SexEXnIz37jKC6NMEhus%3D\",\"realm\":\"saml1\"}' \"$ELASTICSEARCH_URL/_security/saml/invalidate\"", + "language": "curl" + } + ], "description": "Run `POST /_security/saml/invalidate` to invalidate all the tokens for realm `saml1` pertaining to the user that is identified in the SAML Logout Request.\n", "method_request": "POST /_security/saml/invalidate", "value": "{\n \"query_string\" : \"SAMLRequest=nZFda4MwFIb%2FiuS%2BmviRpqFaClKQdbvo2g12M2KMraCJ9cRR9utnW4Wyi13sMie873MeznJ1aWrnS3VQGR0j4mLkKC1NUeljjA77zYyhVbIE0dR%2By7fmaHq7U%2BdegXWGpAZ%2B%2F4pR32luBFTAtWgUcCv56%2Fp5y30X87Yz1khTIycdgpUW9kY7WdsC9zxoXTvMvWuVV98YyMnSGH2SYE5pwALBIr9QKiwDGpW0oGVUznGeMyJZKFkQ4jBf5HnhUymjIhzCAL3KNFihbYx8TBYzzGaY7EnIyZwHzCWMfiDnbRIftkSjJr%2BFu0e9v%2B0EgOquRiiZjKpiVFp6j50T4WXoyNJ%2FEWC9fdqc1t%2F1%2B2F3aUpjzhPiXpqMz1%2FHSn4A&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256&Signature=MsAYz2NFdovMG2mXf6TSpu5vlQQyEJAg%2B4KCwBqJTmrb3yGXKUtIgvjqf88eCAK32v3eN8vupjPC8LglYmke1ZnjK0%2FKxzkvSjTVA7mMQe2AQdKbkyC038zzRq%2FYHcjFDE%2Bz0qISwSHZY2NyLePmwU7SexEXnIz37jKC6NMEhus%3D\",\n \"realm\" : \"saml1\"\n}" @@ -222367,6 +234517,28 @@ "description": "Logout of SAML.\n\nSubmits a request to invalidate an access token and refresh token.\n\nNOTE: This API is intended for use by custom web applications other than Kibana.\nIf you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.\n\nThis API invalidates the tokens that were generated for a user by the SAML authenticate API.\nIf the SAML realm in Elasticsearch is configured accordingly and the SAML IdP supports this, the Elasticsearch response contains a URL to redirect the user to the IdP that contains a SAML logout request (starting an SP-initiated SAML Single Logout).", "examples": { "SamlLogoutRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.saml_logout(\n token=\"46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3\",\n refresh_token=\"mJdXLtmvTUSpoLwMvdBt_w\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.samlLogout({\n token: \"46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3\",\n refresh_token: \"mJdXLtmvTUSpoLwMvdBt_w\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.saml_logout(\n body: {\n \"token\": \"46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3\",\n \"refresh_token\": \"mJdXLtmvTUSpoLwMvdBt_w\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->samlLogout([\n \"body\" => [\n \"token\" => \"46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3\",\n \"refresh_token\" => \"mJdXLtmvTUSpoLwMvdBt_w\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"token\":\"46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3\",\"refresh_token\":\"mJdXLtmvTUSpoLwMvdBt_w\"}' \"$ELASTICSEARCH_URL/_security/saml/logout\"", + "language": "curl" + } + ], "description": "Run `POST /_security/saml/logout` to invalidate the pair of tokens that were generated by calling the SAML authenticate API with a successful SAML response.\n", "method_request": "POST /_security/saml/logout", "value": "{\n \"token\" : \"46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3\",\n \"refresh_token\" : \"mJdXLtmvTUSpoLwMvdBt_w\"\n}" @@ -222466,12 +234638,56 @@ "description": "Prepare SAML authentication.\n\nCreate a SAML authentication request (``) as a URL string based on the configuration of the respective SAML realm in Elasticsearch.\n\nNOTE: This API is intended for use by custom web applications other than Kibana.\nIf you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.\n\nThis API returns a URL pointing to the SAML Identity Provider.\nYou can use the URL to redirect the browser of the user in order to continue the authentication process.\nThe URL includes a single parameter named `SAMLRequest`, which contains a SAML Authentication request that is deflated and Base64 encoded.\nIf the configuration dictates that SAML authentication requests should be signed, the URL has two extra parameters named `SigAlg` and `Signature`.\nThese parameters contain the algorithm used for the signature and the signature value itself.\nIt also returns a random string that uniquely identifies this SAML Authentication request.\nThe caller of this API needs to store this identifier as it needs to be used in a following step of the authentication process.", "examples": { "SamlPrepareAuthenticationRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.saml_prepare_authentication(\n realm=\"saml1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.samlPrepareAuthentication({\n realm: \"saml1\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.saml_prepare_authentication(\n body: {\n \"realm\": \"saml1\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->samlPrepareAuthentication([\n \"body\" => [\n \"realm\" => \"saml1\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"realm\":\"saml1\"}' \"$ELASTICSEARCH_URL/_security/saml/prepare\"", + "language": "curl" + } + ], "description": "Run `POST /_security/saml/prepare` to generate a SAML authentication request for the SAML realm named `saml1`.\n", "method_request": "POST /_security/saml/prepare", "summary": "Prepare with a realm", "value": "{\n \"realm\" : \"saml1\"\n}" }, "SamlPrepareAuthenticationRequestExample2": { + "alternatives": [ + { + "code": "resp = client.security.saml_prepare_authentication(\n acs=\"https://kibana.org/api/security/saml/callback\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.samlPrepareAuthentication({\n acs: \"https://kibana.org/api/security/saml/callback\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.saml_prepare_authentication(\n body: {\n \"acs\": \"https://kibana.org/api/security/saml/callback\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->samlPrepareAuthentication([\n \"body\" => [\n \"acs\" => \"https://kibana.org/api/security/saml/callback\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"acs\":\"https://kibana.org/api/security/saml/callback\"}' \"$ELASTICSEARCH_URL/_security/saml/prepare\"", + "language": "curl" + } + ], "description": "Run `POST /_security/saml/prepare` to generate a SAML authentication request for the SAML realm with an Assertion Consuming Service (ACS) URL.\n", "method_request": "POST /_security/saml/prepare", "summary": "Prepare with an ACS", @@ -222558,6 +234774,28 @@ "description": "Create SAML service provider metadata.\n\nGenerate SAML metadata for a SAML 2.0 Service Provider.\n\nThe SAML 2.0 specification provides a mechanism for Service Providers to describe their capabilities and configuration using a metadata file.\nThis API generates Service Provider metadata based on the configuration of a SAML realm in Elasticsearch.", "examples": { "SamlServiceProviderMetadataRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.update_user_profile_data(\n uid=\"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.updateUserProfileData({\n uid: \"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.update_user_profile_data(\n uid: \"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->updateUserProfileData([\n \"uid\" => \"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/profile/u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0/_data\"", + "language": "curl" + } + ], "method_request": "POST /_security/profile/u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0/_data" } }, @@ -222759,6 +234997,28 @@ "description": "Suggest a user profile.\n\nGet suggestions for user profiles that match specified search criteria.\n\nNOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions.\nIndividual users and external applications should not call this API directly.\nElastic reserves the right to change or remove this feature in future releases without prior notice.", "examples": { "SuggestUserProfilesRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.suggest_user_profiles(\n name=\"jack\",\n hint={\n \"uids\": [\n \"u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0\",\n \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"\n ],\n \"labels\": {\n \"direction\": [\n \"north\",\n \"east\"\n ]\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.suggestUserProfiles({\n name: \"jack\",\n hint: {\n uids: [\n \"u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0\",\n \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n ],\n labels: {\n direction: [\"north\", \"east\"],\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.suggest_user_profiles(\n body: {\n \"name\": \"jack\",\n \"hint\": {\n \"uids\": [\n \"u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0\",\n \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"\n ],\n \"labels\": {\n \"direction\": [\n \"north\",\n \"east\"\n ]\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->suggestUserProfiles([\n \"body\" => [\n \"name\" => \"jack\",\n \"hint\" => [\n \"uids\" => array(\n \"u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0\",\n \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n ),\n \"labels\" => [\n \"direction\" => array(\n \"north\",\n \"east\",\n ),\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"name\":\"jack\",\"hint\":{\"uids\":[\"u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0\",\"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"],\"labels\":{\"direction\":[\"north\",\"east\"]}}}' \"$ELASTICSEARCH_URL/_security/profile/_suggest\"", + "language": "curl" + } + ], "description": "Run `POST /_security/profile/_suggest` to get suggestions for profile documents with name-related fields matching `jack`. It specifies both `uids` and `labels` hints for better relevance. The `labels` hint ranks profiles higher if their `direction` label matches either `north` or `east`.\n", "method_request": "POST /_security/profile/_suggest", "value": "{\n \"name\": \"jack\", \n \"hint\": {\n \"uids\": [ \n \"u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0\",\n \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"\n ],\n \"labels\": {\n \"direction\": [\"north\", \"east\"] \n }\n }\n}" @@ -222956,12 +235216,56 @@ "description": "Update an API key.\n\nUpdate attributes of an existing API key.\nThis API supports updates to an API key's access scope, expiration, and metadata.\n\nTo use this API, you must have at least the `manage_own_api_key` cluster privilege.\nUsers can only update API keys that they created or that were granted to them.\nTo update another user’s API key, use the `run_as` feature to submit a request on behalf of another user.\n\nIMPORTANT: It's not possible to use an API key as the authentication credential for this API. The owner user’s credentials are required.\n\nUse this API to update API keys created by the create API key or grant API Key APIs.\nIf you need to apply the same update to many API keys, you can use the bulk update API keys API to reduce overhead.\nIt's not possible to update expired API keys or API keys that have been invalidated by the invalidate API key API.\n\nThe access scope of an API key is derived from the `role_descriptors` you specify in the request and a snapshot of the owner user's permissions at the time of the request.\nThe snapshot of the owner's permissions is updated automatically on every call.\n\nIMPORTANT: If you don't specify `role_descriptors` in the request, a call to this API might still change the API key's access scope.\nThis change can occur if the owner user's permissions have changed since the API key was created or last modified.", "examples": { "UpdateApiKeyRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.update_api_key(\n id=\"VuaCfGcBCdbkQm-e5aOx\",\n role_descriptors={\n \"role-a\": {\n \"indices\": [\n {\n \"names\": [\n \"*\"\n ],\n \"privileges\": [\n \"write\"\n ]\n }\n ]\n }\n },\n metadata={\n \"environment\": {\n \"level\": 2,\n \"trusted\": True,\n \"tags\": [\n \"production\"\n ]\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.updateApiKey({\n id: \"VuaCfGcBCdbkQm-e5aOx\",\n role_descriptors: {\n \"role-a\": {\n indices: [\n {\n names: [\"*\"],\n privileges: [\"write\"],\n },\n ],\n },\n },\n metadata: {\n environment: {\n level: 2,\n trusted: true,\n tags: [\"production\"],\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.update_api_key(\n id: \"VuaCfGcBCdbkQm-e5aOx\",\n body: {\n \"role_descriptors\": {\n \"role-a\": {\n \"indices\": [\n {\n \"names\": [\n \"*\"\n ],\n \"privileges\": [\n \"write\"\n ]\n }\n ]\n }\n },\n \"metadata\": {\n \"environment\": {\n \"level\": 2,\n \"trusted\": true,\n \"tags\": [\n \"production\"\n ]\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->updateApiKey([\n \"id\" => \"VuaCfGcBCdbkQm-e5aOx\",\n \"body\" => [\n \"role_descriptors\" => [\n \"role-a\" => [\n \"indices\" => array(\n [\n \"names\" => array(\n \"*\",\n ),\n \"privileges\" => array(\n \"write\",\n ),\n ],\n ),\n ],\n ],\n \"metadata\" => [\n \"environment\" => [\n \"level\" => 2,\n \"trusted\" => true,\n \"tags\" => array(\n \"production\",\n ),\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"role_descriptors\":{\"role-a\":{\"indices\":[{\"names\":[\"*\"],\"privileges\":[\"write\"]}]}},\"metadata\":{\"environment\":{\"level\":2,\"trusted\":true,\"tags\":[\"production\"]}}}' \"$ELASTICSEARCH_URL/_security/api_key/VuaCfGcBCdbkQm-e5aOx\"", + "language": "curl" + } + ], "description": "Run `PUT /_security/api_key/VuaCfGcBCdbkQm-e5aOx` to assign new role descriptors and metadata to an API key.\n", "method_request": "PUT /_security/api_key/VuaCfGcBCdbkQm-e5aOx", "summary": "Update role and metadata", "value": "{\n \"role_descriptors\": {\n \"role-a\": {\n \"indices\": [\n {\n \"names\": [\"*\"],\n \"privileges\": [\"write\"]\n }\n ]\n }\n },\n \"metadata\": {\n \"environment\": {\n \"level\": 2,\n \"trusted\": true,\n \"tags\": [\"production\"]\n }\n }\n}" }, "UpdateApiKeyRequestExample2": { + "alternatives": [ + { + "code": "resp = client.security.update_api_key(\n id=\"VuaCfGcBCdbkQm-e5aOx\",\n role_descriptors={},\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.updateApiKey({\n id: \"VuaCfGcBCdbkQm-e5aOx\",\n role_descriptors: {},\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.update_api_key(\n id: \"VuaCfGcBCdbkQm-e5aOx\",\n body: {\n \"role_descriptors\": {}\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->updateApiKey([\n \"id\" => \"VuaCfGcBCdbkQm-e5aOx\",\n \"body\" => [\n \"role_descriptors\" => new ArrayObject([]),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"role_descriptors\":{}}' \"$ELASTICSEARCH_URL/_security/api_key/VuaCfGcBCdbkQm-e5aOx\"", + "language": "curl" + } + ], "description": "Run `PUT /_security/api_key/VuaCfGcBCdbkQm-e5aOx` to remove the API key's previously assigned permissions. It will inherit the owner user's full permissions.\n", "method_request": "PUT /_security/api_key/VuaCfGcBCdbkQm-e5aOx", "summary": "Remove permissions", @@ -223076,6 +235380,28 @@ "description": "Update a cross-cluster API key.\n\nUpdate the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access.\n\nTo use this API, you must have at least the `manage_security` cluster privilege.\nUsers can only update API keys that they created.\nTo update another user's API key, use the `run_as` feature to submit a request on behalf of another user.\n\nIMPORTANT: It's not possible to use an API key as the authentication credential for this API.\nTo update an API key, the owner user's credentials are required.\n\nIt's not possible to update expired API keys, or API keys that have been invalidated by the invalidate API key API.\n\nThis API supports updates to an API key's access scope, metadata, and expiration.\nThe owner user's information, such as the `username` and `realm`, is also updated automatically on every call.\n\nNOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API.", "examples": { "UpdateCrossClusterApiKeyRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.update_cross_cluster_api_key(\n id=\"VuaCfGcBCdbkQm-e5aOx\",\n access={\n \"replication\": [\n {\n \"names\": [\n \"archive\"\n ]\n }\n ]\n },\n metadata={\n \"application\": \"replication\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.updateCrossClusterApiKey({\n id: \"VuaCfGcBCdbkQm-e5aOx\",\n access: {\n replication: [\n {\n names: [\"archive\"],\n },\n ],\n },\n metadata: {\n application: \"replication\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.update_cross_cluster_api_key(\n id: \"VuaCfGcBCdbkQm-e5aOx\",\n body: {\n \"access\": {\n \"replication\": [\n {\n \"names\": [\n \"archive\"\n ]\n }\n ]\n },\n \"metadata\": {\n \"application\": \"replication\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->updateCrossClusterApiKey([\n \"id\" => \"VuaCfGcBCdbkQm-e5aOx\",\n \"body\" => [\n \"access\" => [\n \"replication\" => array(\n [\n \"names\" => array(\n \"archive\",\n ),\n ],\n ),\n ],\n \"metadata\" => [\n \"application\" => \"replication\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"access\":{\"replication\":[{\"names\":[\"archive\"]}]},\"metadata\":{\"application\":\"replication\"}}' \"$ELASTICSEARCH_URL/_security/cross_cluster/api_key/VuaCfGcBCdbkQm-e5aOx\"", + "language": "curl" + } + ], "description": "Run `PUT /_security/cross_cluster/api_key/VuaCfGcBCdbkQm-e5aOx` to update a cross-cluster API key, assigning it new access scope and metadata.\n", "method_request": "PUT /_security/cross_cluster/api_key/VuaCfGcBCdbkQm-e5aOx", "value": "{\n \"access\": {\n \"replication\": [\n {\n \"names\": [\"archive\"]\n }\n ]\n },\n \"metadata\": {\n \"application\": \"replication\"\n }\n}" @@ -223188,6 +235514,28 @@ "description": "Update security index settings.\n\nUpdate the user-configurable settings for the security internal index (`.security` and associated indices). Only a subset of settings are allowed to be modified. This includes `index.auto_expand_replicas` and `index.number_of_replicas`.\n\nNOTE: If `index.auto_expand_replicas` is set, `index.number_of_replicas` will be ignored during updates.\n\nIf a specific index is not in use on the system and settings are provided for it, the request will be rejected.\nThis API does not yet support configuring the settings for indices before they are in use.", "examples": { "SecurityUpdateSettingsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.update_settings(\n security={\n \"index.auto_expand_replicas\": \"0-all\"\n },\n security-tokens={\n \"index.auto_expand_replicas\": \"0-all\"\n },\n security-profile={\n \"index.auto_expand_replicas\": \"0-all\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.updateSettings({\n security: {\n \"index.auto_expand_replicas\": \"0-all\",\n },\n \"security-tokens\": {\n \"index.auto_expand_replicas\": \"0-all\",\n },\n \"security-profile\": {\n \"index.auto_expand_replicas\": \"0-all\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.update_settings(\n body: {\n \"security\": {\n \"index.auto_expand_replicas\": \"0-all\"\n },\n \"security-tokens\": {\n \"index.auto_expand_replicas\": \"0-all\"\n },\n \"security-profile\": {\n \"index.auto_expand_replicas\": \"0-all\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->updateSettings([\n \"body\" => [\n \"security\" => [\n \"index.auto_expand_replicas\" => \"0-all\",\n ],\n \"security-tokens\" => [\n \"index.auto_expand_replicas\" => \"0-all\",\n ],\n \"security-profile\" => [\n \"index.auto_expand_replicas\" => \"0-all\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"security\":{\"index.auto_expand_replicas\":\"0-all\"},\"security-tokens\":{\"index.auto_expand_replicas\":\"0-all\"},\"security-profile\":{\"index.auto_expand_replicas\":\"0-all\"}}' \"$ELASTICSEARCH_URL/_security/settings\"", + "language": "curl" + } + ], "description": "Run `PUT /_security/settings` to modify the security settings.", "method_request": "PUT /_security/settings", "value": "{\n \"security\": {\n \"index.auto_expand_replicas\": \"0-all\"\n },\n \"security-tokens\": {\n \"index.auto_expand_replicas\": \"0-all\"\n },\n \"security-profile\": {\n \"index.auto_expand_replicas\": \"0-all\"\n }\n}" @@ -223307,6 +235655,28 @@ "description": "Update user profile data.\n\nUpdate specific data for the user profile that is associated with a unique ID.\n\nNOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions.\nIndividual users and external applications should not call this API directly.\nElastic reserves the right to change or remove this feature in future releases without prior notice.\n\nTo use this API, you must have one of the following privileges:\n\n* The `manage_user_profile` cluster privilege.\n* The `update_profile_data` global privilege for the namespaces that are referenced in the request.\n\nThis API updates the `labels` and `data` fields of an existing user profile document with JSON objects.\nNew keys and their values are added to the profile document and conflicting keys are replaced by data that's included in the request.\n\nFor both labels and data, content is namespaced by the top-level fields.\nThe `update_profile_data` global privilege grants privileges for updating only the allowed namespaces.", "examples": { "UpdateUserProfileDataRequestExample1": { + "alternatives": [ + { + "code": "resp = client.security.update_user_profile_data(\n uid=\"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\",\n labels={\n \"direction\": \"east\"\n },\n data={\n \"app1\": {\n \"theme\": \"default\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.security.updateUserProfileData({\n uid: \"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\",\n labels: {\n direction: \"east\",\n },\n data: {\n app1: {\n theme: \"default\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.security.update_user_profile_data(\n uid: \"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\",\n body: {\n \"labels\": {\n \"direction\": \"east\"\n },\n \"data\": {\n \"app1\": {\n \"theme\": \"default\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->security()->updateUserProfileData([\n \"uid\" => \"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\",\n \"body\" => [\n \"labels\" => [\n \"direction\" => \"east\",\n ],\n \"data\" => [\n \"app1\" => [\n \"theme\" => \"default\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"labels\":{\"direction\":\"east\"},\"data\":{\"app1\":{\"theme\":\"default\"}}}' \"$ELASTICSEARCH_URL/_security/profile/u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0/_data\"", + "language": "curl" + } + ], "description": "Run `POST /_security/profile/u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0/_data` to update a profile document for the `u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0` user profile.\n", "method_request": "POST /_security/profile/u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0/_data", "value": "{\n \"labels\": {\n \"direction\": \"east\"\n },\n \"data\": {\n \"app1\": {\n \"theme\": \"default\"\n }\n }\n}" @@ -223432,6 +235802,28 @@ "description": "Cancel node shutdown preparations.\nRemove a node from the shutdown list so it can resume normal operations.\nYou must explicitly clear the shutdown request when a node rejoins the cluster or when a node has permanently left the cluster.\nShutdown requests are never removed automatically by Elasticsearch.\n\nNOTE: This feature is designed for indirect use by Elastic Cloud, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes.\nDirect use is not supported.\n\nIf the operator privileges feature is enabled, you must be an operator to use this API.", "examples": { "ShutdownDeleteNodeRequestExample1": { + "alternatives": [ + { + "code": "resp = client.shutdown.delete_node(\n node_id=\"USpTGYaBSIKbgSUJR2Z9lg\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.shutdown.deleteNode({\n node_id: \"USpTGYaBSIKbgSUJR2Z9lg\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.shutdown.delete_node(\n node_id: \"USpTGYaBSIKbgSUJR2Z9lg\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->shutdown()->deleteNode([\n \"node_id\" => \"USpTGYaBSIKbgSUJR2Z9lg\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown\"", + "language": "curl" + } + ], "method_request": "DELETE /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown" } }, @@ -223674,6 +236066,28 @@ "description": "Get the shutdown status.\n\nGet information about nodes that are ready to be shut down, have shut down preparations still in progress, or have stalled.\nThe API returns status information for each part of the shut down process.\n\nNOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.\n\nIf the operator privileges feature is enabled, you must be an operator to use this API.", "examples": { "ShutdownGetNodeRequestExample1": { + "alternatives": [ + { + "code": "resp = client.shutdown.get_node(\n node_id=\"USpTGYaBSIKbgSUJR2Z9lg\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.shutdown.getNode({\n node_id: \"USpTGYaBSIKbgSUJR2Z9lg\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.shutdown.get_node(\n node_id: \"USpTGYaBSIKbgSUJR2Z9lg\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->shutdown()->getNode([\n \"node_id\" => \"USpTGYaBSIKbgSUJR2Z9lg\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown\"", + "language": "curl" + } + ], "method_request": "GET /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown" } }, @@ -223871,6 +236285,28 @@ "description": "Prepare a node to be shut down.\n\nNOTE: This feature is designed for indirect use by Elastic Cloud, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.\n\nIf you specify a node that is offline, it will be prepared for shut down when it rejoins the cluster.\n\nIf the operator privileges feature is enabled, you must be an operator to use this API.\n\nThe API migrates ongoing tasks and index shards to other nodes as needed to prepare a node to be restarted or shut down and removed from the cluster.\nThis ensures that Elasticsearch can be stopped safely with minimal disruption to the cluster.\n\nYou must specify the type of shutdown: `restart`, `remove`, or `replace`.\nIf a node is already being prepared for shutdown, you can use this API to change the shutdown type.\n\nIMPORTANT: This API does NOT terminate the Elasticsearch process.\nMonitor the node shutdown status to determine when it is safe to stop Elasticsearch.", "examples": { "ShutdownPutNodeRequestExample1": { + "alternatives": [ + { + "code": "resp = client.shutdown.put_node(\n node_id=\"USpTGYaBSIKbgSUJR2Z9lg\",\n type=\"restart\",\n reason=\"Demonstrating how the node shutdown API works\",\n allocation_delay=\"20m\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.shutdown.putNode({\n node_id: \"USpTGYaBSIKbgSUJR2Z9lg\",\n type: \"restart\",\n reason: \"Demonstrating how the node shutdown API works\",\n allocation_delay: \"20m\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.shutdown.put_node(\n node_id: \"USpTGYaBSIKbgSUJR2Z9lg\",\n body: {\n \"type\": \"restart\",\n \"reason\": \"Demonstrating how the node shutdown API works\",\n \"allocation_delay\": \"20m\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->shutdown()->putNode([\n \"node_id\" => \"USpTGYaBSIKbgSUJR2Z9lg\",\n \"body\" => [\n \"type\" => \"restart\",\n \"reason\" => \"Demonstrating how the node shutdown API works\",\n \"allocation_delay\" => \"20m\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"type\":\"restart\",\"reason\":\"Demonstrating how the node shutdown API works\",\"allocation_delay\":\"20m\"}' \"$ELASTICSEARCH_URL/_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown\"", + "language": "curl" + } + ], "description": "Register a node for shutdown with `PUT /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown`. The `restart` type prepares the node to be restarted.\n", "method_request": "PUT /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown", "value": "{\n \"type\": \"restart\",\n \"reason\": \"Demonstrating how the node shutdown API works\",\n \"allocation_delay\": \"20m\"\n}" @@ -224216,24 +236652,112 @@ "description": "Simulate data ingestion.\nRun ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index.\n\nThis API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch.\n\nThe API runs the default and final pipeline for that index against a set of documents provided in the body of the request.\nIf a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would.\nNo data is indexed into Elasticsearch.\nInstead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation.\nThe transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result.\n\nThis API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline.\nThe simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index.\n\nBy default, the pipeline definitions that are currently in the system are used.\nHowever, you can supply substitute pipeline definitions in the body of the request.\nThese will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request.", "examples": { "SimulateIngestRequestExample1": { + "alternatives": [ + { + "code": "resp = client.simulate.ingest(\n docs=[\n {\n \"_id\": 123,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_id\": 456,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.simulate.ingest({\n docs: [\n {\n _id: 123,\n _index: \"my-index\",\n _source: {\n foo: \"bar\",\n },\n },\n {\n _id: 456,\n _index: \"my-index\",\n _source: {\n foo: \"rab\",\n },\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.simulate.ingest(\n body: {\n \"docs\": [\n {\n \"_id\": 123,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_id\": 456,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->simulate()->ingest([\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => 123,\n \"_index\" => \"my-index\",\n \"_source\" => [\n \"foo\" => \"bar\",\n ],\n ],\n [\n \"_id\" => 456,\n \"_index\" => \"my-index\",\n \"_source\" => [\n \"foo\" => \"rab\",\n ],\n ],\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":123,\"_index\":\"my-index\",\"_source\":{\"foo\":\"bar\"}},{\"_id\":456,\"_index\":\"my-index\",\"_source\":{\"foo\":\"rab\"}}]}' \"$ELASTICSEARCH_URL/_ingest/_simulate\"", + "language": "curl" + } + ], "description": "In this example the index `my-index` has a default pipeline called `my-pipeline` and a final pipeline called `my-final-pipeline`. Since both documents are being ingested into `my-index`, both pipelines are run using the pipeline definitions that are already in the system.", "method_request": "POST /_ingest/_simulate", "summary": "Existing pipeline definitions", "value": "{\n \"docs\": [\n {\n \"_id\": 123,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_id\": 456,\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ]\n}" }, "SimulateIngestRequestExample2": { + "alternatives": [ + { + "code": "resp = client.simulate.ingest(\n docs=[\n {\n \"_index\": \"my-index\",\n \"_id\": 123,\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"my-index\",\n \"_id\": 456,\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ],\n pipeline_substitutions={\n \"my-pipeline\": {\n \"processors\": [\n {\n \"uppercase\": {\n \"field\": \"foo\"\n }\n }\n ]\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.simulate.ingest({\n docs: [\n {\n _index: \"my-index\",\n _id: 123,\n _source: {\n foo: \"bar\",\n },\n },\n {\n _index: \"my-index\",\n _id: 456,\n _source: {\n foo: \"rab\",\n },\n },\n ],\n pipeline_substitutions: {\n \"my-pipeline\": {\n processors: [\n {\n uppercase: {\n field: \"foo\",\n },\n },\n ],\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.simulate.ingest(\n body: {\n \"docs\": [\n {\n \"_index\": \"my-index\",\n \"_id\": 123,\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"my-index\",\n \"_id\": 456,\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ],\n \"pipeline_substitutions\": {\n \"my-pipeline\": {\n \"processors\": [\n {\n \"uppercase\": {\n \"field\": \"foo\"\n }\n }\n ]\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->simulate()->ingest([\n \"body\" => [\n \"docs\" => array(\n [\n \"_index\" => \"my-index\",\n \"_id\" => 123,\n \"_source\" => [\n \"foo\" => \"bar\",\n ],\n ],\n [\n \"_index\" => \"my-index\",\n \"_id\" => 456,\n \"_source\" => [\n \"foo\" => \"rab\",\n ],\n ],\n ),\n \"pipeline_substitutions\" => [\n \"my-pipeline\" => [\n \"processors\" => array(\n [\n \"uppercase\" => [\n \"field\" => \"foo\",\n ],\n ],\n ),\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_index\":\"my-index\",\"_id\":123,\"_source\":{\"foo\":\"bar\"}},{\"_index\":\"my-index\",\"_id\":456,\"_source\":{\"foo\":\"rab\"}}],\"pipeline_substitutions\":{\"my-pipeline\":{\"processors\":[{\"uppercase\":{\"field\":\"foo\"}}]}}}' \"$ELASTICSEARCH_URL/_ingest/_simulate\"", + "language": "curl" + } + ], "description": "In this example the index `my-index` has a default pipeline called `my-pipeline` and a final pipeline called `my-final-pipeline`. But a substitute definition of `my-pipeline` is provided in `pipeline_substitutions`. The substitute `my-pipeline` will be used in place of the `my-pipeline` that is in the system, and then the `my-final-pipeline` that is already defined in the system will run.", "method_request": "POST /_ingest/_simulate", "summary": "Pipeline substitions", "value": "{\n \"docs\": [\n {\n \"_index\": \"my-index\",\n \"_id\": 123,\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"my-index\",\n \"_id\": 456,\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ],\n \"pipeline_substitutions\": {\n \"my-pipeline\": {\n \"processors\": [\n {\n \"uppercase\": {\n \"field\": \"foo\"\n }\n }\n ]\n }\n }\n}" }, "SimulateIngestRequestExample3": { + "alternatives": [ + { + "code": "resp = client.simulate.ingest(\n docs=[\n {\n \"_index\": \"my-index\",\n \"_id\": \"123\",\n \"_source\": {\n \"foo\": \"foo\"\n }\n },\n {\n \"_index\": \"my-index\",\n \"_id\": \"456\",\n \"_source\": {\n \"bar\": \"rab\"\n }\n }\n ],\n component_template_substitutions={\n \"my-mappings_template\": {\n \"template\": {\n \"mappings\": {\n \"dynamic\": \"strict\",\n \"properties\": {\n \"foo\": {\n \"type\": \"keyword\"\n },\n \"bar\": {\n \"type\": \"keyword\"\n }\n }\n }\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.simulate.ingest({\n docs: [\n {\n _index: \"my-index\",\n _id: \"123\",\n _source: {\n foo: \"foo\",\n },\n },\n {\n _index: \"my-index\",\n _id: \"456\",\n _source: {\n bar: \"rab\",\n },\n },\n ],\n component_template_substitutions: {\n \"my-mappings_template\": {\n template: {\n mappings: {\n dynamic: \"strict\",\n properties: {\n foo: {\n type: \"keyword\",\n },\n bar: {\n type: \"keyword\",\n },\n },\n },\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.simulate.ingest(\n body: {\n \"docs\": [\n {\n \"_index\": \"my-index\",\n \"_id\": \"123\",\n \"_source\": {\n \"foo\": \"foo\"\n }\n },\n {\n \"_index\": \"my-index\",\n \"_id\": \"456\",\n \"_source\": {\n \"bar\": \"rab\"\n }\n }\n ],\n \"component_template_substitutions\": {\n \"my-mappings_template\": {\n \"template\": {\n \"mappings\": {\n \"dynamic\": \"strict\",\n \"properties\": {\n \"foo\": {\n \"type\": \"keyword\"\n },\n \"bar\": {\n \"type\": \"keyword\"\n }\n }\n }\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->simulate()->ingest([\n \"body\" => [\n \"docs\" => array(\n [\n \"_index\" => \"my-index\",\n \"_id\" => \"123\",\n \"_source\" => [\n \"foo\" => \"foo\",\n ],\n ],\n [\n \"_index\" => \"my-index\",\n \"_id\" => \"456\",\n \"_source\" => [\n \"bar\" => \"rab\",\n ],\n ],\n ),\n \"component_template_substitutions\" => [\n \"my-mappings_template\" => [\n \"template\" => [\n \"mappings\" => [\n \"dynamic\" => \"strict\",\n \"properties\" => [\n \"foo\" => [\n \"type\" => \"keyword\",\n ],\n \"bar\" => [\n \"type\" => \"keyword\",\n ],\n ],\n ],\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_index\":\"my-index\",\"_id\":\"123\",\"_source\":{\"foo\":\"foo\"}},{\"_index\":\"my-index\",\"_id\":\"456\",\"_source\":{\"bar\":\"rab\"}}],\"component_template_substitutions\":{\"my-mappings_template\":{\"template\":{\"mappings\":{\"dynamic\":\"strict\",\"properties\":{\"foo\":{\"type\":\"keyword\"},\"bar\":{\"type\":\"keyword\"}}}}}}}' \"$ELASTICSEARCH_URL/_ingest/_simulate\"", + "language": "curl" + } + ], "description": "In this example, imagine that the index `my-index` has a strict mapping with only the `foo` keyword field defined. Say that field mapping came from a component template named `my-mappings-template`. You want to test adding a new field, `bar`. So a substitute definition of `my-mappings-template` is provided in `component_template_substitutions`. The substitute `my-mappings-template` will be used in place of the existing mapping for `my-index` and in place of the `my-mappings-template` that is in the system.\n", "method_request": "POST /_ingest/_simulate", "summary": "Component template substitutions", "value": "{\n \"docs\": [\n {\n \"_index\": \"my-index\",\n \"_id\": \"123\",\n \"_source\": {\n \"foo\": \"foo\"\n }\n },\n {\n \"_index\": \"my-index\",\n \"_id\": \"456\",\n \"_source\": {\n \"bar\": \"rab\"\n }\n }\n ],\n \"component_template_substitutions\": {\n \"my-mappings_template\": {\n \"template\": {\n \"mappings\": {\n \"dynamic\": \"strict\",\n \"properties\": {\n \"foo\": {\n \"type\": \"keyword\"\n },\n \"bar\": {\n \"type\": \"keyword\"\n }\n }\n }\n }\n }\n }\n}" }, "SimulateIngestRequestExample4": { + "alternatives": [ + { + "code": "resp = client.simulate.ingest(\n docs=[\n {\n \"_id\": \"id\",\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_id\": \"id\",\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ],\n pipeline_substitutions={\n \"my-pipeline\": {\n \"processors\": [\n {\n \"set\": {\n \"field\": \"field3\",\n \"value\": \"value3\"\n }\n }\n ]\n }\n },\n component_template_substitutions={\n \"my-component-template\": {\n \"template\": {\n \"mappings\": {\n \"dynamic\": True,\n \"properties\": {\n \"field3\": {\n \"type\": \"keyword\"\n }\n }\n },\n \"settings\": {\n \"index\": {\n \"default_pipeline\": \"my-pipeline\"\n }\n }\n }\n }\n },\n index_template_substitutions={\n \"my-index-template\": {\n \"index_patterns\": [\n \"my-index-*\"\n ],\n \"composed_of\": [\n \"component_template_1\",\n \"component_template_2\"\n ]\n }\n },\n mapping_addition={\n \"dynamic\": \"strict\",\n \"properties\": {\n \"foo\": {\n \"type\": \"keyword\"\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.simulate.ingest({\n docs: [\n {\n _id: \"id\",\n _index: \"my-index\",\n _source: {\n foo: \"bar\",\n },\n },\n {\n _id: \"id\",\n _index: \"my-index\",\n _source: {\n foo: \"rab\",\n },\n },\n ],\n pipeline_substitutions: {\n \"my-pipeline\": {\n processors: [\n {\n set: {\n field: \"field3\",\n value: \"value3\",\n },\n },\n ],\n },\n },\n component_template_substitutions: {\n \"my-component-template\": {\n template: {\n mappings: {\n dynamic: true,\n properties: {\n field3: {\n type: \"keyword\",\n },\n },\n },\n settings: {\n index: {\n default_pipeline: \"my-pipeline\",\n },\n },\n },\n },\n },\n index_template_substitutions: {\n \"my-index-template\": {\n index_patterns: [\"my-index-*\"],\n composed_of: [\"component_template_1\", \"component_template_2\"],\n },\n },\n mapping_addition: {\n dynamic: \"strict\",\n properties: {\n foo: {\n type: \"keyword\",\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.simulate.ingest(\n body: {\n \"docs\": [\n {\n \"_id\": \"id\",\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"bar\"\n }\n },\n {\n \"_id\": \"id\",\n \"_index\": \"my-index\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n }\n ],\n \"pipeline_substitutions\": {\n \"my-pipeline\": {\n \"processors\": [\n {\n \"set\": {\n \"field\": \"field3\",\n \"value\": \"value3\"\n }\n }\n ]\n }\n },\n \"component_template_substitutions\": {\n \"my-component-template\": {\n \"template\": {\n \"mappings\": {\n \"dynamic\": true,\n \"properties\": {\n \"field3\": {\n \"type\": \"keyword\"\n }\n }\n },\n \"settings\": {\n \"index\": {\n \"default_pipeline\": \"my-pipeline\"\n }\n }\n }\n }\n },\n \"index_template_substitutions\": {\n \"my-index-template\": {\n \"index_patterns\": [\n \"my-index-*\"\n ],\n \"composed_of\": [\n \"component_template_1\",\n \"component_template_2\"\n ]\n }\n },\n \"mapping_addition\": {\n \"dynamic\": \"strict\",\n \"properties\": {\n \"foo\": {\n \"type\": \"keyword\"\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->simulate()->ingest([\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"id\",\n \"_index\" => \"my-index\",\n \"_source\" => [\n \"foo\" => \"bar\",\n ],\n ],\n [\n \"_id\" => \"id\",\n \"_index\" => \"my-index\",\n \"_source\" => [\n \"foo\" => \"rab\",\n ],\n ],\n ),\n \"pipeline_substitutions\" => [\n \"my-pipeline\" => [\n \"processors\" => array(\n [\n \"set\" => [\n \"field\" => \"field3\",\n \"value\" => \"value3\",\n ],\n ],\n ),\n ],\n ],\n \"component_template_substitutions\" => [\n \"my-component-template\" => [\n \"template\" => [\n \"mappings\" => [\n \"dynamic\" => true,\n \"properties\" => [\n \"field3\" => [\n \"type\" => \"keyword\",\n ],\n ],\n ],\n \"settings\" => [\n \"index\" => [\n \"default_pipeline\" => \"my-pipeline\",\n ],\n ],\n ],\n ],\n ],\n \"index_template_substitutions\" => [\n \"my-index-template\" => [\n \"index_patterns\" => array(\n \"my-index-*\",\n ),\n \"composed_of\" => array(\n \"component_template_1\",\n \"component_template_2\",\n ),\n ],\n ],\n \"mapping_addition\" => [\n \"dynamic\" => \"strict\",\n \"properties\" => [\n \"foo\" => [\n \"type\" => \"keyword\",\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":\"id\",\"_index\":\"my-index\",\"_source\":{\"foo\":\"bar\"}},{\"_id\":\"id\",\"_index\":\"my-index\",\"_source\":{\"foo\":\"rab\"}}],\"pipeline_substitutions\":{\"my-pipeline\":{\"processors\":[{\"set\":{\"field\":\"field3\",\"value\":\"value3\"}}]}},\"component_template_substitutions\":{\"my-component-template\":{\"template\":{\"mappings\":{\"dynamic\":true,\"properties\":{\"field3\":{\"type\":\"keyword\"}}},\"settings\":{\"index\":{\"default_pipeline\":\"my-pipeline\"}}}}},\"index_template_substitutions\":{\"my-index-template\":{\"index_patterns\":[\"my-index-*\"],\"composed_of\":[\"component_template_1\",\"component_template_2\"]}},\"mapping_addition\":{\"dynamic\":\"strict\",\"properties\":{\"foo\":{\"type\":\"keyword\"}}}}' \"$ELASTICSEARCH_URL/_ingest/_simulate\"", + "language": "curl" + } + ], "description": "The pipeline, component template, and index template substitutions replace the existing pipeline details for the duration of this request.", "method_request": "POST /_ingest/_simulate", "summary": "Multiple substitutions", @@ -224997,6 +237521,28 @@ "description": "Delete a policy.\nDelete a snapshot lifecycle policy definition.\nThis operation prevents any future snapshots from being taken but does not cancel in-progress snapshots or remove previously-taken snapshots.", "examples": { "SlmDeleteLifecycleExample1": { + "alternatives": [ + { + "code": "resp = client.slm.delete_lifecycle(\n policy_id=\"daily-snapshots\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.slm.deleteLifecycle({\n policy_id: \"daily-snapshots\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.slm.delete_lifecycle(\n policy_id: \"daily-snapshots\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->slm()->deleteLifecycle([\n \"policy_id\" => \"daily-snapshots\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_slm/policy/daily-snapshots\"", + "language": "curl" + } + ], "method_request": "DELETE /_slm/policy/daily-snapshots" } }, @@ -225084,7 +237630,29 @@ "description": "Run a policy.\nImmediately create a snapshot according to the snapshot lifecycle policy without waiting for the scheduled time.\nThe snapshot policy is normally applied according to its schedule, but you might want to manually run a policy before performing an upgrade or other maintenance.", "examples": { "ExecuteSnapshotLifecycleRequestExample1": { - "method_request": "POST /_slm/policy/daily-snapshots/_execute" + "alternatives": [ + { + "code": "resp = client.slm.execute_lifecycle(\n policy_id=\"daily-snapshots\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.slm.executeLifecycle({\n policy_id: \"daily-snapshots\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.slm.execute_lifecycle(\n policy_id: \"daily-snapshots\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->slm()->executeLifecycle([\n \"policy_id\" => \"daily-snapshots\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_slm/policy/daily-snapshots/_execute\"", + "language": "curl" + } + ], + "method_request": "PUT /_slm/policy/daily-snapshots/_execute" } }, "inherits": { @@ -225182,6 +237750,28 @@ "description": "Run a retention policy.\nManually apply the retention policy to force immediate removal of snapshots that are expired according to the snapshot lifecycle policy retention rules.\nThe retention policy is normally applied according to its schedule.", "examples": { "SlmExecuteRetentionExample1": { + "alternatives": [ + { + "code": "resp = client.slm.execute_retention()", + "language": "Python" + }, + { + "code": "const response = await client.slm.executeRetention();", + "language": "JavaScript" + }, + { + "code": "response = client.slm.execute_retention", + "language": "Ruby" + }, + { + "code": "$resp = $client->slm()->executeRetention();", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_slm/_execute_retention\"", + "language": "curl" + } + ], "method_request": "POST _slm/_execute_retention" } }, @@ -225256,6 +237846,28 @@ "description": "Get policy information.\nGet snapshot lifecycle policy definitions and information about the latest snapshot attempts.", "examples": { "GetSnapshotLifecycleRequestExample1": { + "alternatives": [ + { + "code": "resp = client.slm.get_lifecycle(\n policy_id=\"daily-snapshots\",\n human=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.slm.getLifecycle({\n policy_id: \"daily-snapshots\",\n human: \"true\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.slm.get_lifecycle(\n policy_id: \"daily-snapshots\",\n human: \"true\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->slm()->getLifecycle([\n \"policy_id\" => \"daily-snapshots\",\n \"human\" => \"true\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_slm/policy/daily-snapshots?human\"", + "language": "curl" + } + ], "method_request": "GET _slm/policy/daily-snapshots?human" } }, @@ -225361,6 +237973,28 @@ "description": "Get snapshot lifecycle management statistics.\nGet global and policy-level statistics about actions taken by snapshot lifecycle management.", "examples": { "GetSnapshotLifecycleManagementStatsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.slm.get_stats()", + "language": "Python" + }, + { + "code": "const response = await client.slm.getStats();", + "language": "JavaScript" + }, + { + "code": "response = client.slm.get_stats", + "language": "Ruby" + }, + { + "code": "$resp = $client->slm()->getStats();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_slm/stats\"", + "language": "curl" + } + ], "method_request": "GET /_slm/stats" } }, @@ -225557,6 +238191,28 @@ "description": "Get the snapshot lifecycle management status.", "examples": { "GetSnapshotLifecycleManagementStatusRequestExample1": { + "alternatives": [ + { + "code": "resp = client.slm.get_status()", + "language": "Python" + }, + { + "code": "const response = await client.slm.getStatus();", + "language": "JavaScript" + }, + { + "code": "response = client.slm.get_status", + "language": "Ruby" + }, + { + "code": "$resp = $client->slm()->getStatus();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_slm/status\"", + "language": "curl" + } + ], "method_request": "GET _slm/status" } }, @@ -225704,12 +238360,56 @@ "description": "Create or update a policy.\nCreate or update a snapshot lifecycle policy.\nIf the policy already exists, this request increments the policy version.\nOnly the latest version of a policy is stored.", "examples": { "PutSnapshotLifecycleRequestExample1 copy": { + "alternatives": [ + { + "code": "resp = client.slm.put_lifecycle(\n policy_id=\"daily-snapshots\",\n schedule=\"0 30 1 * * ?\",\n name=\"\",\n repository=\"my_repository\",\n config={\n \"indices\": [\n \"data-*\",\n \"important\"\n ],\n \"ignore_unavailable\": False,\n \"include_global_state\": False\n },\n retention={\n \"expire_after\": \"30d\",\n \"min_count\": 5,\n \"max_count\": 50\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.slm.putLifecycle({\n policy_id: \"daily-snapshots\",\n schedule: \"0 30 1 * * ?\",\n name: \"\",\n repository: \"my_repository\",\n config: {\n indices: [\"data-*\", \"important\"],\n ignore_unavailable: false,\n include_global_state: false,\n },\n retention: {\n expire_after: \"30d\",\n min_count: 5,\n max_count: 50,\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.slm.put_lifecycle(\n policy_id: \"daily-snapshots\",\n body: {\n \"schedule\": \"0 30 1 * * ?\",\n \"name\": \"\",\n \"repository\": \"my_repository\",\n \"config\": {\n \"indices\": [\n \"data-*\",\n \"important\"\n ],\n \"ignore_unavailable\": false,\n \"include_global_state\": false\n },\n \"retention\": {\n \"expire_after\": \"30d\",\n \"min_count\": 5,\n \"max_count\": 50\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->slm()->putLifecycle([\n \"policy_id\" => \"daily-snapshots\",\n \"body\" => [\n \"schedule\" => \"0 30 1 * * ?\",\n \"name\" => \"\",\n \"repository\" => \"my_repository\",\n \"config\" => [\n \"indices\" => array(\n \"data-*\",\n \"important\",\n ),\n \"ignore_unavailable\" => false,\n \"include_global_state\" => false,\n ],\n \"retention\" => [\n \"expire_after\" => \"30d\",\n \"min_count\" => 5,\n \"max_count\" => 50,\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"schedule\":\"0 30 1 * * ?\",\"name\":\"\",\"repository\":\"my_repository\",\"config\":{\"indices\":[\"data-*\",\"important\"],\"ignore_unavailable\":false,\"include_global_state\":false},\"retention\":{\"expire_after\":\"30d\",\"min_count\":5,\"max_count\":50}}' \"$ELASTICSEARCH_URL/_slm/policy/daily-snapshots\"", + "language": "curl" + } + ], "description": "Run `PUT /_slm/policy/daily-snapshots` to create a lifecycle policy. The `schedule` is when the snapshot should be taken, in this case, 1:30am daily. The `retention` details specify to: keep snapshots for 30 days; always keep at least 5 successful snapshots, even if they're more than 30 days old; keep no more than 50 successful snapshots, even if they're less than 30 days old.\n", "method_request": "PUT /_slm/policy/daily-snapshots", "summary": "Create a policy", "value": "{\n \"schedule\": \"0 30 1 * * ?\",\n \"name\": \"\",\n \"repository\": \"my_repository\",\n \"config\": {\n \"indices\": [\"data-*\", \"important\"],\n \"ignore_unavailable\": false,\n \"include_global_state\": false\n },\n \"retention\": {\n \"expire_after\": \"30d\",\n \"min_count\": 5,\n \"max_count\": 50\n }\n}" }, "PutSnapshotLifecycleRequestExample2": { + "alternatives": [ + { + "code": "resp = client.slm.put_lifecycle(\n policy_id=\"hourly-snapshots\",\n schedule=\"1h\",\n name=\"\",\n repository=\"my_repository\",\n config={\n \"indices\": [\n \"data-*\",\n \"important\"\n ]\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.slm.putLifecycle({\n policy_id: \"hourly-snapshots\",\n schedule: \"1h\",\n name: \"\",\n repository: \"my_repository\",\n config: {\n indices: [\"data-*\", \"important\"],\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.slm.put_lifecycle(\n policy_id: \"hourly-snapshots\",\n body: {\n \"schedule\": \"1h\",\n \"name\": \"\",\n \"repository\": \"my_repository\",\n \"config\": {\n \"indices\": [\n \"data-*\",\n \"important\"\n ]\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->slm()->putLifecycle([\n \"policy_id\" => \"hourly-snapshots\",\n \"body\" => [\n \"schedule\" => \"1h\",\n \"name\" => \"\",\n \"repository\" => \"my_repository\",\n \"config\" => [\n \"indices\" => array(\n \"data-*\",\n \"important\",\n ),\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"schedule\":\"1h\",\"name\":\"\",\"repository\":\"my_repository\",\"config\":{\"indices\":[\"data-*\",\"important\"]}}' \"$ELASTICSEARCH_URL/_slm/policy/hourly-snapshots\"", + "language": "curl" + } + ], "description": "Run `PUT /_slm/policy/hourly-snapshots` to create a lifecycle policy that uses interval scheduling. It creates a snapshot once every hour. The first snapshot will be created one hour after the policy is modified, with subsequent snapshots every hour afterward.\n", "method_request": "PUT /_slm/policy/hourly-snapshots", "summary": "Create a policy with intevals", @@ -225800,6 +238500,28 @@ "description": "Start snapshot lifecycle management.\nSnapshot lifecycle management (SLM) starts automatically when a cluster is formed.\nManually starting SLM is necessary only if it has been stopped using the stop SLM API.", "examples": { "StartSnapshotLifecycleManagementRequestExample1": { + "alternatives": [ + { + "code": "resp = client.slm.start()", + "language": "Python" + }, + { + "code": "const response = await client.slm.start();", + "language": "JavaScript" + }, + { + "code": "response = client.slm.start", + "language": "Ruby" + }, + { + "code": "$resp = $client->slm()->start();", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_slm/start\"", + "language": "curl" + } + ], "method_request": "POST _slm/start" } }, @@ -228002,6 +240724,28 @@ "description": "Clean up the snapshot repository.\nTrigger the review of the contents of a snapshot repository and delete any stale data not referenced by existing snapshots.", "examples": { "SnapshotCleanupRepositoryRequestExample1": { + "alternatives": [ + { + "code": "resp = client.snapshot.cleanup_repository(\n name=\"my_repository\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.snapshot.cleanupRepository({\n name: \"my_repository\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.snapshot.cleanup_repository(\n repository: \"my_repository\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->snapshot()->cleanupRepository([\n \"repository\" => \"my_repository\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_repository/_cleanup\"", + "language": "curl" + } + ], "method_request": "POST /_snapshot/my_repository/_cleanup" } }, @@ -228116,6 +240860,28 @@ "description": "Clone a snapshot.\nClone part of all of a snapshot into another snapshot in the same repository.", "examples": { "SnapshotCloneRequestExample1": { + "alternatives": [ + { + "code": "resp = client.snapshot.clone(\n repository=\"my_repository\",\n snapshot=\"source_snapshot\",\n target_snapshot=\"target_snapshot\",\n indices=\"index_a,index_b\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.snapshot.clone({\n repository: \"my_repository\",\n snapshot: \"source_snapshot\",\n target_snapshot: \"target_snapshot\",\n indices: \"index_a,index_b\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.snapshot.clone(\n repository: \"my_repository\",\n snapshot: \"source_snapshot\",\n target_snapshot: \"target_snapshot\",\n body: {\n \"indices\": \"index_a,index_b\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->snapshot()->clone([\n \"repository\" => \"my_repository\",\n \"snapshot\" => \"source_snapshot\",\n \"target_snapshot\" => \"target_snapshot\",\n \"body\" => [\n \"indices\" => \"index_a,index_b\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"indices\":\"index_a,index_b\"}' \"$ELASTICSEARCH_URL/_snapshot/my_repository/source_snapshot/_clone/target_snapshot\"", + "language": "curl" + } + ], "description": "Run `PUT /_snapshot/my_repository/source_snapshot/_clone/target_snapshot` to clone the `source_snapshot` into a new `target_snapshot`.", "method_request": "PUT /_snapshot/my_repository/source_snapshot/_clone/target_snapshot", "value": "{\n \"indices\": \"index_a,index_b\"\n}" @@ -228311,6 +241077,28 @@ "description": "Create a snapshot.\nTake a snapshot of a cluster or of data streams and indices.", "examples": { "SnapshotCreateRequestExample1": { + "alternatives": [ + { + "code": "resp = client.snapshot.create(\n repository=\"my_repository\",\n snapshot=\"snapshot_2\",\n wait_for_completion=True,\n indices=\"index_1,index_2\",\n ignore_unavailable=True,\n include_global_state=False,\n metadata={\n \"taken_by\": \"user123\",\n \"taken_because\": \"backup before upgrading\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.snapshot.create({\n repository: \"my_repository\",\n snapshot: \"snapshot_2\",\n wait_for_completion: \"true\",\n indices: \"index_1,index_2\",\n ignore_unavailable: true,\n include_global_state: false,\n metadata: {\n taken_by: \"user123\",\n taken_because: \"backup before upgrading\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.snapshot.create(\n repository: \"my_repository\",\n snapshot: \"snapshot_2\",\n wait_for_completion: \"true\",\n body: {\n \"indices\": \"index_1,index_2\",\n \"ignore_unavailable\": true,\n \"include_global_state\": false,\n \"metadata\": {\n \"taken_by\": \"user123\",\n \"taken_because\": \"backup before upgrading\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->snapshot()->create([\n \"repository\" => \"my_repository\",\n \"snapshot\" => \"snapshot_2\",\n \"wait_for_completion\" => \"true\",\n \"body\" => [\n \"indices\" => \"index_1,index_2\",\n \"ignore_unavailable\" => true,\n \"include_global_state\" => false,\n \"metadata\" => [\n \"taken_by\" => \"user123\",\n \"taken_because\" => \"backup before upgrading\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"indices\":\"index_1,index_2\",\"ignore_unavailable\":true,\"include_global_state\":false,\"metadata\":{\"taken_by\":\"user123\",\"taken_because\":\"backup before upgrading\"}}' \"$ELASTICSEARCH_URL/_snapshot/my_repository/snapshot_2?wait_for_completion=true\"", + "language": "curl" + } + ], "description": "Run `PUT /_snapshot/my_repository/snapshot_2?wait_for_completion=true` to take a snapshot of `index_1` and `index_2`.", "method_request": "PUT /_snapshot/my_repository/snapshot_2?wait_for_completion=true", "value": "{\n \"indices\": \"index_1,index_2\",\n \"ignore_unavailable\": true,\n \"include_global_state\": false,\n \"metadata\": {\n \"taken_by\": \"user123\",\n \"taken_because\": \"backup before upgrading\"\n }\n}" @@ -228450,36 +241238,168 @@ "description": "Create or update a snapshot repository.\nIMPORTANT: If you are migrating searchable snapshots, the repository name must be identical in the source and destination clusters.\nTo register a snapshot repository, the cluster's global metadata must be writeable.\nEnsure there are no cluster blocks (for example, `cluster.blocks.read_only` and `clsuter.blocks.read_only_allow_delete` settings) that prevent write access.\n\nSeveral options for this API can be specified using a query parameter or a request body parameter.\nIf both parameters are specified, only the query parameter is used.", "examples": { "SnapshotCreateRepositoryRequestExample1": { + "alternatives": [ + { + "code": "resp = client.snapshot.create_repository(\n name=\"my_repository\",\n repository={\n \"type\": \"fs\",\n \"settings\": {\n \"location\": \"my_backup_location\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.snapshot.createRepository({\n name: \"my_repository\",\n repository: {\n type: \"fs\",\n settings: {\n location: \"my_backup_location\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.snapshot.create_repository(\n repository: \"my_repository\",\n body: {\n \"type\": \"fs\",\n \"settings\": {\n \"location\": \"my_backup_location\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->snapshot()->createRepository([\n \"repository\" => \"my_repository\",\n \"body\" => [\n \"type\" => \"fs\",\n \"settings\" => [\n \"location\" => \"my_backup_location\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"type\":\"fs\",\"settings\":{\"location\":\"my_backup_location\"}}' \"$ELASTICSEARCH_URL/_snapshot/my_repository\"", + "language": "curl" + } + ], "description": "Run `PUT /_snapshot/my_repository` to create or update a shared file system snapshot repository.", "method_request": "PUT /_snapshot/my_repository", "summary": "A shared file system repository", "value": "{\n \"type\": \"fs\",\n \"settings\": {\n \"location\": \"my_backup_location\"\n }\n}" }, "SnapshotCreateRepositoryRequestExample2": { + "alternatives": [ + { + "code": "resp = client.snapshot.create_repository(\n name=\"my_backup\",\n repository={\n \"type\": \"azure\",\n \"settings\": {\n \"client\": \"secondary\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.snapshot.createRepository({\n name: \"my_backup\",\n repository: {\n type: \"azure\",\n settings: {\n client: \"secondary\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.snapshot.create_repository(\n repository: \"my_backup\",\n body: {\n \"type\": \"azure\",\n \"settings\": {\n \"client\": \"secondary\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->snapshot()->createRepository([\n \"repository\" => \"my_backup\",\n \"body\" => [\n \"type\" => \"azure\",\n \"settings\" => [\n \"client\" => \"secondary\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"type\":\"azure\",\"settings\":{\"client\":\"secondary\"}}' \"$ELASTICSEARCH_URL/_snapshot/my_backup\"", + "language": "curl" + } + ], "description": "Run `PUT /_snapshot/my_repository` to create or update an Azure snapshot repository.", "method_request": "PUT _snapshot/my_backup", "summary": "An Azure repository", "value": "{\n \"type\": \"azure\",\n \"settings\": {\n \"client\": \"secondary\"\n }\n}" }, "SnapshotCreateRepositoryRequestExample3": { + "alternatives": [ + { + "code": "resp = client.snapshot.create_repository(\n name=\"my_gcs_repository\",\n repository={\n \"type\": \"gcs\",\n \"settings\": {\n \"bucket\": \"my_other_bucket\",\n \"base_path\": \"dev\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.snapshot.createRepository({\n name: \"my_gcs_repository\",\n repository: {\n type: \"gcs\",\n settings: {\n bucket: \"my_other_bucket\",\n base_path: \"dev\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.snapshot.create_repository(\n repository: \"my_gcs_repository\",\n body: {\n \"type\": \"gcs\",\n \"settings\": {\n \"bucket\": \"my_other_bucket\",\n \"base_path\": \"dev\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->snapshot()->createRepository([\n \"repository\" => \"my_gcs_repository\",\n \"body\" => [\n \"type\" => \"gcs\",\n \"settings\" => [\n \"bucket\" => \"my_other_bucket\",\n \"base_path\" => \"dev\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"type\":\"gcs\",\"settings\":{\"bucket\":\"my_other_bucket\",\"base_path\":\"dev\"}}' \"$ELASTICSEARCH_URL/_snapshot/my_gcs_repository\"", + "language": "curl" + } + ], "description": "Run `PUT /_snapshot/my_gcs_repository` to create or update a Google Cloud Storage snapshot repository.", "method_request": "PUT _snapshot/my_gcs_repository", "summary": "A Google Cloud Storage repository", "value": "{\n \"type\": \"gcs\",\n \"settings\": {\n \"bucket\": \"my_other_bucket\",\n \"base_path\": \"dev\"\n }\n}" }, "SnapshotCreateRepositoryRequestExample4": { + "alternatives": [ + { + "code": "resp = client.snapshot.create_repository(\n name=\"my_s3_repository\",\n repository={\n \"type\": \"s3\",\n \"settings\": {\n \"bucket\": \"my-bucket\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.snapshot.createRepository({\n name: \"my_s3_repository\",\n repository: {\n type: \"s3\",\n settings: {\n bucket: \"my-bucket\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.snapshot.create_repository(\n repository: \"my_s3_repository\",\n body: {\n \"type\": \"s3\",\n \"settings\": {\n \"bucket\": \"my-bucket\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->snapshot()->createRepository([\n \"repository\" => \"my_s3_repository\",\n \"body\" => [\n \"type\" => \"s3\",\n \"settings\" => [\n \"bucket\" => \"my-bucket\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"type\":\"s3\",\"settings\":{\"bucket\":\"my-bucket\"}}' \"$ELASTICSEARCH_URL/_snapshot/my_s3_repository\"", + "language": "curl" + } + ], "description": "Run `PUT /_snapshot/my_s3_repository` to create or update an AWS S3 snapshot repository.", "method_request": "PUT _snapshot/my_s3_repository", "summary": "An S3 repository", "value": "{\n \"type\": \"s3\",\n \"settings\": {\n \"bucket\": \"my-bucket\"\n }\n}" }, "SnapshotCreateRepositoryRequestExample5": { + "alternatives": [ + { + "code": "resp = client.snapshot.create_repository(\n name=\"my_src_only_repository\",\n repository={\n \"type\": \"source\",\n \"settings\": {\n \"delegate_type\": \"fs\",\n \"location\": \"my_backup_repository\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.snapshot.createRepository({\n name: \"my_src_only_repository\",\n repository: {\n type: \"source\",\n settings: {\n delegate_type: \"fs\",\n location: \"my_backup_repository\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.snapshot.create_repository(\n repository: \"my_src_only_repository\",\n body: {\n \"type\": \"source\",\n \"settings\": {\n \"delegate_type\": \"fs\",\n \"location\": \"my_backup_repository\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->snapshot()->createRepository([\n \"repository\" => \"my_src_only_repository\",\n \"body\" => [\n \"type\" => \"source\",\n \"settings\" => [\n \"delegate_type\" => \"fs\",\n \"location\" => \"my_backup_repository\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"type\":\"source\",\"settings\":{\"delegate_type\":\"fs\",\"location\":\"my_backup_repository\"}}' \"$ELASTICSEARCH_URL/_snapshot/my_src_only_repository\"", + "language": "curl" + } + ], "description": "Run `PUT _snapshot/my_src_only_repository` to create or update a source-only snapshot repository.", "method_request": "PUT _snapshot/my_src_only_repository", "summary": "A source-only repository", "value": "{\n \"type\": \"source\",\n \"settings\": {\n \"delegate_type\": \"fs\",\n \"location\": \"my_backup_repository\"\n }\n}" }, "SnapshotCreateRepositoryRequestExample6": { + "alternatives": [ + { + "code": "resp = client.snapshot.create_repository(\n name=\"my_read_only_url_repository\",\n repository={\n \"type\": \"url\",\n \"settings\": {\n \"url\": \"file:/mount/backups/my_fs_backup_location\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.snapshot.createRepository({\n name: \"my_read_only_url_repository\",\n repository: {\n type: \"url\",\n settings: {\n url: \"file:/mount/backups/my_fs_backup_location\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.snapshot.create_repository(\n repository: \"my_read_only_url_repository\",\n body: {\n \"type\": \"url\",\n \"settings\": {\n \"url\": \"file:/mount/backups/my_fs_backup_location\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->snapshot()->createRepository([\n \"repository\" => \"my_read_only_url_repository\",\n \"body\" => [\n \"type\" => \"url\",\n \"settings\" => [\n \"url\" => \"file:/mount/backups/my_fs_backup_location\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"type\":\"url\",\"settings\":{\"url\":\"file:/mount/backups/my_fs_backup_location\"}}' \"$ELASTICSEARCH_URL/_snapshot/my_read_only_url_repository\"", + "language": "curl" + } + ], "description": "Run `PUT _snapshot/my_read_only_url_repository` to create or update a read-only URL snapshot repository.", "method_request": "PUT _snapshot/my_read_only_url_repository", "summary": "A read-only URL repository", @@ -228584,6 +241504,28 @@ "description": "Delete snapshots.", "examples": { "SnapshotDeleteRequestExample1": { + "alternatives": [ + { + "code": "resp = client.snapshot.delete(\n repository=\"my_repository\",\n snapshot=\"snapshot_2,snapshot_3\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.snapshot.delete({\n repository: \"my_repository\",\n snapshot: \"snapshot_2,snapshot_3\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.snapshot.delete(\n repository: \"my_repository\",\n snapshot: \"snapshot_2,snapshot_3\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->snapshot()->delete([\n \"repository\" => \"my_repository\",\n \"snapshot\" => \"snapshot_2,snapshot_3\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_repository/snapshot_2,snapshot_3\"", + "language": "curl" + } + ], "method_request": "DELETE /_snapshot/my_repository/snapshot_2,snapshot_3" } }, @@ -228676,6 +241618,28 @@ "description": "Delete snapshot repositories.\nWhen a repository is unregistered, Elasticsearch removes only the reference to the location where the repository is storing the snapshots.\nThe snapshots themselves are left untouched and in place.", "examples": { "SnapshotDeleteRepositoryExample1": { + "alternatives": [ + { + "code": "resp = client.snapshot.delete_repository(\n name=\"my_repository\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.snapshot.deleteRepository({\n name: \"my_repository\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.snapshot.delete_repository(\n repository: \"my_repository\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->snapshot()->deleteRepository([\n \"repository\" => \"my_repository\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_repository\"", + "language": "curl" + } + ], "method_request": "DELETE /_snapshot/my_repository" } }, @@ -228764,6 +241728,28 @@ "description": "Get snapshot information.\n\nNOTE: The `after` parameter and `next` field enable you to iterate through snapshots with some consistency guarantees regarding concurrent creation or deletion of snapshots.\nIt is guaranteed that any snapshot that exists at the beginning of the iteration and is not concurrently deleted will be seen during the iteration.\nSnapshots concurrently created may be seen during an iteration.", "examples": { "SnapshotGetRequestExample1": { + "alternatives": [ + { + "code": "resp = client.snapshot.get(\n repository=\"my_repository\",\n snapshot=\"snapshot_*\",\n sort=\"start_time\",\n from_sort_value=\"1577833200000\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.snapshot.get({\n repository: \"my_repository\",\n snapshot: \"snapshot_*\",\n sort: \"start_time\",\n from_sort_value: 1577833200000,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.snapshot.get(\n repository: \"my_repository\",\n snapshot: \"snapshot_*\",\n sort: \"start_time\",\n from_sort_value: \"1577833200000\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->snapshot()->get([\n \"repository\" => \"my_repository\",\n \"snapshot\" => \"snapshot_*\",\n \"sort\" => \"start_time\",\n \"from_sort_value\" => \"1577833200000\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_repository/snapshot_*?sort=start_time&from_sort_value=1577833200000\"", + "language": "curl" + } + ], "method_request": "GET /_snapshot/my_repository/snapshot_*?sort=start_time&from_sort_value=1577833200000" } }, @@ -229179,6 +242165,28 @@ "description": "Get snapshot repository information.", "examples": { "SnapshotGetRepositoryRequestExample1": { + "alternatives": [ + { + "code": "resp = client.snapshot.get_repository(\n name=\"my_repository\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.snapshot.getRepository({\n name: \"my_repository\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.snapshot.get_repository(\n repository: \"my_repository\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->snapshot()->getRepository([\n \"repository\" => \"my_repository\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_repository\"", + "language": "curl" + } + ], "method_request": "GET /_snapshot/my_repository" } }, @@ -229845,6 +242853,28 @@ "description": "Analyze a snapshot repository.\nAnalyze the performance characteristics and any incorrect behaviour found in a repository.\n\nThe response exposes implementation details of the analysis which may change from version to version.\nThe response body format is therefore not considered stable and may be different in newer versions.\n\nThere are a large number of third-party storage systems available, not all of which are suitable for use as a snapshot repository by Elasticsearch.\nSome storage systems behave incorrectly, or perform poorly, especially when accessed concurrently by multiple clients as the nodes of an Elasticsearch cluster do. This API performs a collection of read and write operations on your repository which are designed to detect incorrect behaviour and to measure the performance characteristics of your storage system.\n\nThe default values for the parameters are deliberately low to reduce the impact of running an analysis inadvertently and to provide a sensible starting point for your investigations.\nRun your first analysis with the default parameter values to check for simple problems.\nIf successful, run a sequence of increasingly large analyses until you encounter a failure or you reach a `blob_count` of at least `2000`, a `max_blob_size` of at least `2gb`, a `max_total_data_size` of at least `1tb`, and a `register_operation_count` of at least `100`.\nAlways specify a generous timeout, possibly `1h` or longer, to allow time for each analysis to run to completion.\nPerform the analyses using a multi-node cluster of a similar size to your production cluster so that it can detect any problems that only arise when the repository is accessed by many nodes at once.\n\nIf the analysis fails, Elasticsearch detected that your repository behaved unexpectedly.\nThis usually means you are using a third-party storage system with an incorrect or incompatible implementation of the API it claims to support.\nIf so, this storage system is not suitable for use as a snapshot repository.\nYou will need to work with the supplier of your storage system to address the incompatibilities that Elasticsearch detects.\n\nIf the analysis is successful, the API returns details of the testing process, optionally including how long each operation took.\nYou can use this information to determine the performance of your storage system.\nIf any operation fails or returns an incorrect result, the API returns an error.\nIf the API returns an error, it may not have removed all the data it wrote to the repository.\nThe error will indicate the location of any leftover data and this path is also recorded in the Elasticsearch logs.\nYou should verify that this location has been cleaned up correctly.\nIf there is still leftover data at the specified location, you should manually remove it.\n\nIf the connection from your client to Elasticsearch is closed while the client is waiting for the result of the analysis, the test is cancelled.\nSome clients are configured to close their connection if no response is received within a certain timeout.\nAn analysis takes a long time to complete so you might need to relax any such client-side timeouts.\nOn cancellation the analysis attempts to clean up the data it was writing, but it may not be able to remove it all.\nThe path to the leftover data is recorded in the Elasticsearch logs.\nYou should verify that this location has been cleaned up correctly.\nIf there is still leftover data at the specified location, you should manually remove it.\n\nIf the analysis is successful then it detected no incorrect behaviour, but this does not mean that correct behaviour is guaranteed.\nThe analysis attempts to detect common bugs but it does not offer 100% coverage.\nAdditionally, it does not test the following:\n\n* Your repository must perform durable writes. Once a blob has been written it must remain in place until it is deleted, even after a power loss or similar disaster.\n* Your repository must not suffer from silent data corruption. Once a blob has been written, its contents must remain unchanged until it is deliberately modified or deleted.\n* Your repository must behave correctly even if connectivity from the cluster is disrupted. Reads and writes may fail in this case, but they must not return incorrect results.\n\nIMPORTANT: An analysis writes a substantial amount of data to your repository and then reads it back again.\nThis consumes bandwidth on the network between the cluster and the repository, and storage space and I/O bandwidth on the repository itself.\nYou must ensure this load does not affect other users of these systems.\nAnalyses respect the repository settings `max_snapshot_bytes_per_sec` and `max_restore_bytes_per_sec` if available and the cluster setting `indices.recovery.max_bytes_per_sec` which you can use to limit the bandwidth they consume.\n\nNOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions.\n\nNOTE: Different versions of Elasticsearch may perform different checks for repository compatibility, with newer versions typically being stricter than older ones.\nA storage system that passes repository analysis with one version of Elasticsearch may fail with a different version.\nThis indicates it behaves incorrectly in ways that the former version did not detect.\nYou must work with the supplier of your storage system to address the incompatibilities detected by the repository analysis API in any version of Elasticsearch.\n\nNOTE: This API may not work correctly in a mixed-version cluster.\n\n*Implementation details*\n\nNOTE: This section of documentation describes how the repository analysis API works in this version of Elasticsearch, but you should expect the implementation to vary between versions. The request parameters and response format depend on details of the implementation so may also be different in newer versions.\n\nThe analysis comprises a number of blob-level tasks, as set by the `blob_count` parameter and a number of compare-and-exchange operations on linearizable registers, as set by the `register_operation_count` parameter.\nThese tasks are distributed over the data and master-eligible nodes in the cluster for execution.\n\nFor most blob-level tasks, the executing node first writes a blob to the repository and then instructs some of the other nodes in the cluster to attempt to read the data it just wrote.\nThe size of the blob is chosen randomly, according to the `max_blob_size` and `max_total_data_size` parameters.\nIf any of these reads fails then the repository does not implement the necessary read-after-write semantics that Elasticsearch requires.\n\nFor some blob-level tasks, the executing node will instruct some of its peers to attempt to read the data before the writing process completes.\nThese reads are permitted to fail, but must not return partial data.\nIf any read returns partial data then the repository does not implement the necessary atomicity semantics that Elasticsearch requires.\n\nFor some blob-level tasks, the executing node will overwrite the blob while its peers are reading it.\nIn this case the data read may come from either the original or the overwritten blob, but the read operation must not return partial data or a mix of data from the two blobs.\nIf any of these reads returns partial data or a mix of the two blobs then the repository does not implement the necessary atomicity semantics that Elasticsearch requires for overwrites.\n\nThe executing node will use a variety of different methods to write the blob.\nFor instance, where applicable, it will use both single-part and multi-part uploads.\nSimilarly, the reading nodes will use a variety of different methods to read the data back again.\nFor instance they may read the entire blob from start to end or may read only a subset of the data.\n\nFor some blob-level tasks, the executing node will cancel the write before it is complete.\nIn this case, it still instructs some of the other nodes in the cluster to attempt to read the blob but all of these reads must fail to find the blob.\n\nLinearizable registers are special blobs that Elasticsearch manipulates using an atomic compare-and-exchange operation.\nThis operation ensures correct and strongly-consistent behavior even when the blob is accessed by multiple nodes at the same time.\nThe detailed implementation of the compare-and-exchange operation on linearizable registers varies by repository type.\nRepository analysis verifies that that uncontended compare-and-exchange operations on a linearizable register blob always succeed.\nRepository analysis also verifies that contended operations either succeed or report the contention but do not return incorrect results.\nIf an operation fails due to contention, Elasticsearch retries the operation until it succeeds.\nMost of the compare-and-exchange operations performed by repository analysis atomically increment a counter which is represented as an 8-byte blob.\nSome operations also verify the behavior on small blobs with sizes other than 8 bytes.", "examples": { "SnapshotRepositoryAnalyzeRequestExample1": { + "alternatives": [ + { + "code": "resp = client.snapshot.repository_analyze(\n name=\"my_repository\",\n blob_count=\"10\",\n max_blob_size=\"1mb\",\n timeout=\"120s\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.snapshot.repositoryAnalyze({\n name: \"my_repository\",\n blob_count: 10,\n max_blob_size: \"1mb\",\n timeout: \"120s\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.snapshot.repository_analyze(\n repository: \"my_repository\",\n blob_count: \"10\",\n max_blob_size: \"1mb\",\n timeout: \"120s\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->snapshot()->repositoryAnalyze([\n \"repository\" => \"my_repository\",\n \"blob_count\" => \"10\",\n \"max_blob_size\" => \"1mb\",\n \"timeout\" => \"120s\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_repository/_analyze?blob_count=10&max_blob_size=1mb&timeout=120s\"", + "language": "curl" + } + ], "description": "Analyze `my_repository` by writing 10 blobs of 1mb max. Cancel the test after 2 minutes.", "method_request": "POST /_snapshot/my_repository/_analyze?blob_count=10&max_blob_size=1mb&timeout=120s", "summary": "Analyze a repository", @@ -230489,6 +243519,28 @@ "description": "Verify the repository integrity.\nVerify the integrity of the contents of a snapshot repository.\n\nThis API enables you to perform a comprehensive check of the contents of a repository, looking for any anomalies in its data or metadata which might prevent you from restoring snapshots from the repository or which might cause future snapshot create or delete operations to fail.\n\nIf you suspect the integrity of the contents of one of your snapshot repositories, cease all write activity to this repository immediately, set its `read_only` option to `true`, and use this API to verify its integrity.\nUntil you do so:\n\n* It may not be possible to restore some snapshots from this repository.\n* Searchable snapshots may report errors when searched or may have unassigned shards.\n* Taking snapshots into this repository may fail or may appear to succeed but have created a snapshot which cannot be restored.\n* Deleting snapshots from this repository may fail or may appear to succeed but leave the underlying data on disk.\n* Continuing to write to the repository while it is in an invalid state may causing additional damage to its contents.\n\nIf the API finds any problems with the integrity of the contents of your repository, Elasticsearch will not be able to repair the damage.\nThe only way to bring the repository back into a fully working state after its contents have been damaged is by restoring its contents from a repository backup which was taken before the damage occurred.\nYou must also identify what caused the damage and take action to prevent it from happening again.\n\nIf you cannot restore a repository backup, register a new repository and use this for all future snapshot operations.\nIn some cases it may be possible to recover some of the contents of a damaged repository, either by restoring as many of its snapshots as needed and taking new snapshots of the restored data, or by using the reindex API to copy data from any searchable snapshots mounted from the damaged repository.\n\nAvoid all operations which write to the repository while the verify repository integrity API is running.\nIf something changes the repository contents while an integrity verification is running then Elasticsearch may incorrectly report having detected some anomalies in its contents due to the concurrent writes.\nIt may also incorrectly fail to report some anomalies that the concurrent writes prevented it from detecting.\n\nNOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions.\n\nNOTE: This API may not work correctly in a mixed-version cluster.\n\nThe default values for the parameters of this API are designed to limit the impact of the integrity verification on other activities in your cluster.\nFor instance, by default it will only use at most half of the `snapshot_meta` threads to verify the integrity of each snapshot, allowing other snapshot operations to use the other half of this thread pool.\nIf you modify these parameters to speed up the verification process, you risk disrupting other snapshot-related operations in your cluster.\nFor large repositories, consider setting up a separate single-node Elasticsearch cluster just for running the integrity verification API.\n\nThe response exposes implementation details of the analysis which may change from version to version.\nThe response body format is therefore not considered stable and may be different in newer versions.", "examples": { "SnapshotRepositoryVerifyIntegrityExample1": { + "alternatives": [ + { + "code": "resp = client.perform_request(\n \"POST\",\n \"/_snapshot/my_repository/_verify_integrity\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.transport.request({\n method: \"POST\",\n path: \"/_snapshot/my_repository/_verify_integrity\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.perform_request(\n \"POST\",\n \"/_snapshot/my_repository/_verify_integrity\",\n {},\n)", + "language": "Ruby" + }, + { + "code": "$requestFactory = Psr17FactoryDiscovery::findRequestFactory();\n$request = $requestFactory->createRequest(\n \"POST\",\n \"/_snapshot/my_repository/_verify_integrity\",\n);\n$resp = $client->sendRequest($request);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_repository/_verify_integrity\"", + "language": "curl" + } + ], "method_request": "POST /_snapshot/my_repository/_verify_integrity" } }, @@ -230787,12 +243839,56 @@ "description": "Restore a snapshot.\nRestore a snapshot of a cluster or data streams and indices.\n\nYou can restore a snapshot only to a running cluster with an elected master node.\nThe snapshot repository must be registered and available to the cluster.\nThe snapshot and cluster versions must be compatible.\n\nTo restore a snapshot, the cluster's global metadata must be writable. Ensure there are't any cluster blocks that prevent writes. The restore operation ignores index blocks.\n\nBefore you restore a data stream, ensure the cluster contains a matching index template with data streams enabled. To check, use the index management feature in Kibana or the get index template API:\n\n```\nGET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream\n```\n\nIf no such template exists, you can create one or restore a cluster state that contains one. Without a matching index template, a data stream can't roll over or create backing indices.\n\nIf your snapshot contains data from App Search or Workplace Search, you must restore the Enterprise Search encryption key before you restore the snapshot.", "examples": { "SnapshotRestoreRequestExample1": { + "alternatives": [ + { + "code": "resp = client.snapshot.restore(\n repository=\"my_repository\",\n snapshot=\"snapshot_2\",\n wait_for_completion=True,\n indices=\"index_1,index_2\",\n ignore_unavailable=True,\n include_global_state=False,\n rename_pattern=\"index_(.+)\",\n rename_replacement=\"restored_index_$1\",\n include_aliases=False,\n)", + "language": "Python" + }, + { + "code": "const response = await client.snapshot.restore({\n repository: \"my_repository\",\n snapshot: \"snapshot_2\",\n wait_for_completion: \"true\",\n indices: \"index_1,index_2\",\n ignore_unavailable: true,\n include_global_state: false,\n rename_pattern: \"index_(.+)\",\n rename_replacement: \"restored_index_$1\",\n include_aliases: false,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.snapshot.restore(\n repository: \"my_repository\",\n snapshot: \"snapshot_2\",\n wait_for_completion: \"true\",\n body: {\n \"indices\": \"index_1,index_2\",\n \"ignore_unavailable\": true,\n \"include_global_state\": false,\n \"rename_pattern\": \"index_(.+)\",\n \"rename_replacement\": \"restored_index_$1\",\n \"include_aliases\": false\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->snapshot()->restore([\n \"repository\" => \"my_repository\",\n \"snapshot\" => \"snapshot_2\",\n \"wait_for_completion\" => \"true\",\n \"body\" => [\n \"indices\" => \"index_1,index_2\",\n \"ignore_unavailable\" => true,\n \"include_global_state\" => false,\n \"rename_pattern\" => \"index_(.+)\",\n \"rename_replacement\" => \"restored_index_$1\",\n \"include_aliases\" => false,\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"indices\":\"index_1,index_2\",\"ignore_unavailable\":true,\"include_global_state\":false,\"rename_pattern\":\"index_(.+)\",\"rename_replacement\":\"restored_index_$1\",\"include_aliases\":false}' \"$ELASTICSEARCH_URL/_snapshot/my_repository/snapshot_2/_restore?wait_for_completion=true\"", + "language": "curl" + } + ], "description": "Run `POST /_snapshot/my_repository/snapshot_2/_restore?wait_for_completion=true`. It restores `index_1` and `index_2` from `snapshot_2`. The `rename_pattern` and `rename_replacement` parameters indicate any index matching the regular expression `index_(.+)` will be renamed using the pattern `restored_index_$1`. For example, `index_1` will be renamed to `restored_index_1`.\n", "method_request": "POST /_snapshot/my_repository/snapshot_2/_restore?wait_for_completion=true", "summary": "Restore with rename pattern", "value": "{\n \"indices\": \"index_1,index_2\",\n \"ignore_unavailable\": true,\n \"include_global_state\": false,\n \"rename_pattern\": \"index_(.+)\",\n \"rename_replacement\": \"restored_index_$1\",\n \"include_aliases\": false\n}" }, "SnapshotRestoreRequestExample2": { + "alternatives": [ + { + "code": "resp = client.cluster.put_settings(\n indices=\"index_1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.cluster.putSettings({\n indices: \"index_1\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.cluster.put_settings(\n body: {\n \"indices\": \"index_1\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->cluster()->putSettings([\n \"body\" => [\n \"indices\" => \"index_1\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"indices\":\"index_1\"}' \"$ELASTICSEARCH_URL/_cluster/settings\"", + "language": "curl" + } + ], "description": "Close `index_1` then run `POST /_snapshot/my_repository/snapshot_2/_restore?wait_for_completion=true` to restore an index in-place. For example, you might want to perform this type of restore operation when no alternative options surface after the cluster allocation explain API reports `no_valid_shard_copy`.\n", "method_request": "PUT _cluster/settings", "summary": "Restore in-place", @@ -230957,6 +244053,28 @@ "description": "Get the snapshot status.\nGet a detailed description of the current state for each shard participating in the snapshot.\n\nNote that this API should be used only to obtain detailed shard-level information for ongoing snapshots.\nIf this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API.\n\nIf you omit the `` request path parameter, the request retrieves information only for currently running snapshots.\nThis usage is preferred.\nIf needed, you can specify `` and `` to retrieve information for specific snapshots, even if they're not currently running.\n\nWARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive.\nThe API requires a read from the repository for each shard in each snapshot.\nFor example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards).\n\nDepending on the latency of your storage, such requests can take an extremely long time to return results.\nThese requests can also tax machine resources and, when using cloud storage, incur high processing costs.", "examples": { "SnapshotStatusRequestExample1": { + "alternatives": [ + { + "code": "resp = client.snapshot.status(\n repository=\"my_repository\",\n snapshot=\"snapshot_2\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.snapshot.status({\n repository: \"my_repository\",\n snapshot: \"snapshot_2\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.snapshot.status(\n repository: \"my_repository\",\n snapshot: \"snapshot_2\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->snapshot()->status([\n \"repository\" => \"my_repository\",\n \"snapshot\" => \"snapshot_2\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_repository/snapshot_2/_status\"", + "language": "curl" + } + ], "method_request": "GET _snapshot/my_repository/snapshot_2/_status" } }, @@ -231092,6 +244210,28 @@ "description": "Verify a snapshot repository.\nCheck for common misconfigurations in a snapshot repository.", "examples": { "SnapshotVerifyRepositoryExample1": { + "alternatives": [ + { + "code": "resp = client.snapshot.verify_repository(\n name=\"my_unverified_backup\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.snapshot.verifyRepository({\n name: \"my_unverified_backup\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.snapshot.verify_repository(\n repository: \"my_unverified_backup\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->snapshot()->verifyRepository([\n \"repository\" => \"my_unverified_backup\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_unverified_backup/_verify\"", + "language": "curl" + } + ], "method_request": "POST _snapshot/my_unverified_backup/_verify" } }, @@ -231257,6 +244397,28 @@ "description": "Clear an SQL search cursor.", "examples": { "ClearSqlCursorRequestExample1": { + "alternatives": [ + { + "code": "resp = client.sql.clear_cursor(\n cursor=\"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.sql.clearCursor({\n cursor:\n \"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.sql.clear_cursor(\n body: {\n \"cursor\": \"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->sql()->clearCursor([\n \"body\" => [\n \"cursor\" => \"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"cursor\":\"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\"}' \"$ELASTICSEARCH_URL/_sql/close\"", + "language": "curl" + } + ], "description": "Run `POST _sql/close` to clear an SQL search cursor.", "method_request": "POST _sql/close", "value": "{\n \"cursor\": \"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\"\n}" @@ -231311,6 +244473,28 @@ "description": "Delete an async SQL search.\nDelete an async SQL search or a stored synchronous SQL search.\nIf the search is still running, the API cancels it.\n\nIf the Elasticsearch security features are enabled, only the following users can use this API to delete a search:\n\n* Users with the `cancel_task` cluster privilege.\n* The user who first submitted the search.", "examples": { "SqlDeleteAsyncExample1": { + "alternatives": [ + { + "code": "resp = client.sql.delete_async(\n id=\"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.sql.deleteAsync({\n id: \"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.sql.delete_async(\n id: \"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->sql()->deleteAsync([\n \"id\" => \"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_sql/async/delete/FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\"", + "language": "curl" + } + ], "method_request": "DELETE _sql/async/delete/FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=" } }, @@ -231371,6 +244555,28 @@ "description": "Get async SQL search results.\nGet the current status and available results for an async SQL search or stored synchronous SQL search.\n\nIf the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API.", "examples": { "SqlGetAsyncExample1": { + "alternatives": [ + { + "code": "resp = client.sql.get_async(\n id=\"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n wait_for_completion_timeout=\"2s\",\n format=\"json\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.sql.getAsync({\n id: \"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n wait_for_completion_timeout: \"2s\",\n format: \"json\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.sql.get_async(\n id: \"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n wait_for_completion_timeout: \"2s\",\n format: \"json\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->sql()->getAsync([\n \"id\" => \"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n \"wait_for_completion_timeout\" => \"2s\",\n \"format\" => \"json\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_sql/async/FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=?wait_for_completion_timeout=2s&format=json\"", + "language": "curl" + } + ], "method_request": "GET _sql/async/FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=?wait_for_completion_timeout=2s&format=json" } }, @@ -231553,6 +244759,28 @@ "description": "Get the async SQL search status.\nGet the current status of an async SQL search or a stored synchronous SQL search.", "examples": { "SqlGetAsyncStatusExample1": { + "alternatives": [ + { + "code": "resp = client.sql.get_async_status(\n id=\"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.sql.getAsyncStatus({\n id: \"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.sql.get_async_status(\n id: \"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->sql()->getAsyncStatus([\n \"id\" => \"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_sql/async/status/FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\"", + "language": "curl" + } + ], "method_request": "GET _sql/async/status/FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=" } }, @@ -231929,6 +245157,28 @@ "description": "Get SQL search results.\nRun an SQL request.", "examples": { "QuerySqlRequestExample1": { + "alternatives": [ + { + "code": "resp = client.sql.query(\n format=\"txt\",\n query=\"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.sql.query({\n format: \"txt\",\n query: \"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.sql.query(\n format: \"txt\",\n body: {\n \"query\": \"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->sql()->query([\n \"format\" => \"txt\",\n \"body\" => [\n \"query\" => \"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":\"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\"}' \"$ELASTICSEARCH_URL/_sql?format=txt\"", + "language": "curl" + } + ], "description": "Run `POST _sql?format=txt` to get results for an SQL search.", "method_request": "POST _sql?format=txt", "value": "{\n \"query\": \"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\"\n}" @@ -232153,6 +245403,28 @@ "description": "Translate SQL into Elasticsearch queries.\nTranslate an SQL search into a search API request containing Query DSL.\nIt accepts the same request body parameters as the SQL search API, excluding `cursor`.", "examples": { "TranslateSqlRequestExample1": { + "alternatives": [ + { + "code": "resp = client.sql.translate(\n query=\"SELECT * FROM library ORDER BY page_count DESC\",\n fetch_size=10,\n)", + "language": "Python" + }, + { + "code": "const response = await client.sql.translate({\n query: \"SELECT * FROM library ORDER BY page_count DESC\",\n fetch_size: 10,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.sql.translate(\n body: {\n \"query\": \"SELECT * FROM library ORDER BY page_count DESC\",\n \"fetch_size\": 10\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->sql()->translate([\n \"body\" => [\n \"query\" => \"SELECT * FROM library ORDER BY page_count DESC\",\n \"fetch_size\" => 10,\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":\"SELECT * FROM library ORDER BY page_count DESC\",\"fetch_size\":10}' \"$ELASTICSEARCH_URL/_sql/translate\"", + "language": "curl" + } + ], "description": "", "method_request": "POST _sql/translate", "summary": "sql/apis/sql-translate-api.asciidoc:12", @@ -232396,6 +245668,28 @@ "description": "Get SSL certificates.\n\nGet information about the X.509 certificates that are used to encrypt communications in the cluster.\nThe API returns a list that includes certificates from all TLS contexts including:\n\n- Settings for transport and HTTP interfaces\n- TLS settings that are used within authentication realms\n- TLS settings for remote monitoring exporters\n\nThe list includes certificates that are used for configuring trust, such as those configured in the `xpack.security.transport.ssl.truststore` and `xpack.security.transport.ssl.certificate_authorities` settings.\nIt also includes certificates that are used for configuring server identity, such as `xpack.security.http.ssl.keystore` and `xpack.security.http.ssl.certificate settings`.\n\nThe list does not include certificates that are sourced from the default SSL context of the Java Runtime Environment (JRE), even if those certificates are in use within Elasticsearch.\n\nNOTE: When a PKCS#11 token is configured as the truststore of the JRE, the API returns all the certificates that are included in the PKCS#11 token irrespective of whether these are used in the Elasticsearch TLS configuration.\n\nIf Elasticsearch is configured to use a keystore or truststore, the API output includes all certificates in that store, even though some of the certificates might not be in active use within the cluster.", "examples": { "GetCertificatesRequestExample1": { + "alternatives": [ + { + "code": "resp = client.ssl.certificates()", + "language": "Python" + }, + { + "code": "const response = await client.ssl.certificates();", + "language": "JavaScript" + }, + { + "code": "response = client.ssl.certificates", + "language": "Ruby" + }, + { + "code": "$resp = $client->ssl()->certificates();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ssl/certificates\"", + "language": "curl" + } + ], "method_request": "GET /_ssl/certificates" } }, @@ -232593,6 +245887,28 @@ "description": "Delete a synonym set.\n\nYou can only delete a synonyms set that is not in use by any index analyzer.\n\nSynonyms sets can be used in synonym graph token filters and synonym token filters.\nThese synonym filters can be used as part of search analyzers.\n\nAnalyzers need to be loaded when an index is restored (such as when a node starts, or the index becomes open).\nEven if the analyzer is not used on any field mapping, it still needs to be loaded on the index recovery phase.\n\nIf any analyzers cannot be loaded, the index becomes unavailable and the cluster status becomes red or yellow as index shards are not available.\nTo prevent that, synonyms sets that are used in analyzers can't be deleted.\nA delete request in this case will return a 400 response code.\n\nTo remove a synonyms set, you must first remove all indices that contain analyzers using it.\nYou can migrate an index by creating a new index that does not contain the token filter with the synonyms set, and use the reindex API in order to copy over the index data.\nOnce finished, you can delete the index.\nWhen the synonyms set is not used in analyzers, you will be able to delete it.", "examples": { "SynonymsDeleteSynonymExample1": { + "alternatives": [ + { + "code": "resp = client.synonyms.delete_synonym(\n id=\"my-synonyms-set\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.synonyms.deleteSynonym({\n id: \"my-synonyms-set\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.synonyms.delete_synonym(\n id: \"my-synonyms-set\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->synonyms()->deleteSynonym([\n \"id\" => \"my-synonyms-set\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set\"", + "language": "curl" + } + ], "method_request": "DELETE _synonyms/my-synonyms-set" } }, @@ -232653,6 +245969,28 @@ "description": "Delete a synonym rule.\nDelete a synonym rule from a synonym set.", "examples": { "SynonymRuleDeleteRequestExample1": { + "alternatives": [ + { + "code": "resp = client.synonyms.delete_synonym_rule(\n set_id=\"my-synonyms-set\",\n rule_id=\"test-1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.synonyms.deleteSynonymRule({\n set_id: \"my-synonyms-set\",\n rule_id: \"test-1\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.synonyms.delete_synonym_rule(\n set_id: \"my-synonyms-set\",\n rule_id: \"test-1\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->synonyms()->deleteSynonymRule([\n \"set_id\" => \"my-synonyms-set\",\n \"rule_id\" => \"test-1\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set/test-1\"", + "language": "curl" + } + ], "method_request": "DELETE _synonyms/my-synonyms-set/test-1" } }, @@ -232731,6 +246069,28 @@ "description": "Get a synonym set.", "examples": { "SynonymsGetRequestExample1": { + "alternatives": [ + { + "code": "resp = client.synonyms.get_synonym(\n id=\"my-synonyms-set\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.synonyms.getSynonym({\n id: \"my-synonyms-set\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.synonyms.get_synonym(\n id: \"my-synonyms-set\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->synonyms()->getSynonym([\n \"id\" => \"my-synonyms-set\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set\"", + "language": "curl" + } + ], "method_request": "GET _synonyms/my-synonyms-set" } }, @@ -232845,6 +246205,28 @@ "description": "Get a synonym rule.\nGet a synonym rule from a synonym set.", "examples": { "SynonymRuleGetRequestExample1": { + "alternatives": [ + { + "code": "resp = client.synonyms.get_synonym_rule(\n set_id=\"my-synonyms-set\",\n rule_id=\"test-1\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.synonyms.getSynonymRule({\n set_id: \"my-synonyms-set\",\n rule_id: \"test-1\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.synonyms.get_synonym_rule(\n set_id: \"my-synonyms-set\",\n rule_id: \"test-1\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->synonyms()->getSynonymRule([\n \"set_id\" => \"my-synonyms-set\",\n \"rule_id\" => \"test-1\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set/test-1\"", + "language": "curl" + } + ], "method_request": "GET _synonyms/my-synonyms-set/test-1" } }, @@ -232923,6 +246305,28 @@ "description": "Get all synonym sets.\nGet a summary of all defined synonym sets.", "examples": { "SynonymsSetsGetRequestExample1": { + "alternatives": [ + { + "code": "resp = client.synonyms.get_synonyms_sets()", + "language": "Python" + }, + { + "code": "const response = await client.synonyms.getSynonymsSets();", + "language": "JavaScript" + }, + { + "code": "response = client.synonyms.get_synonyms_sets", + "language": "Ruby" + }, + { + "code": "$resp = $client->synonyms()->getSynonymsSets();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_synonyms\"", + "language": "curl" + } + ], "method_request": "GET _synonyms" } }, @@ -233087,6 +246491,28 @@ "description": "Create or update a synonym set.\nSynonyms sets are limited to a maximum of 10,000 synonym rules per set.\nIf you need to manage more synonym rules, you can create multiple synonym sets.\n\nWhen an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices.\nThis is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set.", "examples": { "SynonymsPutRequestExample1": { + "alternatives": [ + { + "code": "resp = client.synonyms.put_synonym(\n id=\"my-synonyms-set\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.synonyms.putSynonym({\n id: \"my-synonyms-set\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.synonyms.put_synonym(\n id: \"my-synonyms-set\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->synonyms()->putSynonym([\n \"id\" => \"my-synonyms-set\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set\"", + "language": "curl" + } + ], "method_request": "PUT _synonyms/my-synonyms-set" } }, @@ -233179,6 +246605,28 @@ "description": "Create or update a synonym rule.\nCreate or update a synonym rule in a synonym set.\n\nIf any of the synonym rules included is invalid, the API returns an error.\n\nWhen you update a synonym rule, all analyzers using the synonyms set will be reloaded automatically to reflect the new rule.", "examples": { "SynonymRulePutRequestExample1": { + "alternatives": [ + { + "code": "resp = client.synonyms.put_synonym_rule(\n set_id=\"my-synonyms-set\",\n rule_id=\"test-1\",\n synonyms=\"hello, hi, howdy\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.synonyms.putSynonymRule({\n set_id: \"my-synonyms-set\",\n rule_id: \"test-1\",\n synonyms: \"hello, hi, howdy\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.synonyms.put_synonym_rule(\n set_id: \"my-synonyms-set\",\n rule_id: \"test-1\",\n body: {\n \"synonyms\": \"hello, hi, howdy\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->synonyms()->putSynonymRule([\n \"set_id\" => \"my-synonyms-set\",\n \"rule_id\" => \"test-1\",\n \"body\" => [\n \"synonyms\" => \"hello, hi, howdy\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"synonyms\":\"hello, hi, howdy\"}' \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set/test-1\"", + "language": "curl" + } + ], "description": "", "method_request": "PUT _synonyms/my-synonyms-set/test-1", "summary": "synonyms/apis/put-synonym-rule.asciidoc:107", @@ -233723,6 +247171,28 @@ "description": "Cancel a task.\n\nWARNING: The task management API is new and should still be considered a beta feature.\nThe API may change in ways that are not backwards compatible.\n\nA task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away.\nIt is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation.\nThe get task information API will continue to list these cancelled tasks until they complete.\nThe cancelled flag in the response indicates that the cancellation command has been processed and the task will stop as soon as possible.\n\nTo troubleshoot why a cancelled task does not complete promptly, use the get task information API with the `?detailed` parameter to identify the other tasks the system is running.\nYou can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task.", "examples": { "TasksCancelExample1": { + "alternatives": [ + { + "code": "resp = client.tasks.cancel(\n task_id=\"\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.tasks.cancel({\n task_id: \"\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.tasks.cancel(\n task_id: \"\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->tasks()->cancel([\n \"task_id\" => \"\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_tasks//_cancel\"", + "language": "curl" + } + ], "method_request": "POST _tasks//_cancel" } }, @@ -233851,6 +247321,28 @@ "description": "Get task information.\nGet information about a task currently running in the cluster.\n\nWARNING: The task management API is new and should still be considered a beta feature.\nThe API may change in ways that are not backwards compatible.\n\nIf the task identifier is not found, a 404 response code indicates that there are no resources that match the request.", "examples": { "GetTaskRequestExample2": { + "alternatives": [ + { + "code": "resp = client.tasks.list(\n detailed=True,\n actions=\"*/delete/byquery\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.tasks.list({\n detailed: \"true\",\n actions: \"*/delete/byquery\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.tasks.list(\n detailed: \"true\",\n actions: \"*/delete/byquery\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->tasks()->list([\n \"detailed\" => \"true\",\n \"actions\" => \"*/delete/byquery\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_tasks?detailed=true&actions=*/delete/byquery\"", + "language": "curl" + } + ], "method_request": "GET _tasks?detailed=true&actions=*/delete/byquery" } }, @@ -233984,6 +247476,28 @@ "description": "Get all tasks.\nGet information about the tasks currently running on one or more nodes in the cluster.\n\nWARNING: The task management API is new and should still be considered a beta feature.\nThe API may change in ways that are not backwards compatible.\n\n**Identifying running tasks**\n\nThe `X-Opaque-Id header`, when provided on the HTTP request header, is going to be returned as a header in the response as well as in the headers field for in the task information.\nThis enables you to track certain calls or associate certain tasks with the client that started them.\nFor example:\n\n```\ncurl -i -H \"X-Opaque-Id: 123456\" \"http://localhost:9200/_tasks?group_by=parents\"\n```\n\nThe API returns the following result:\n\n```\nHTTP/1.1 200 OK\nX-Opaque-Id: 123456\ncontent-type: application/json; charset=UTF-8\ncontent-length: 831\n\n{\n \"tasks\" : {\n \"u5lcZHqcQhu-rUoFaqDphA:45\" : {\n \"node\" : \"u5lcZHqcQhu-rUoFaqDphA\",\n \"id\" : 45,\n \"type\" : \"transport\",\n \"action\" : \"cluster:monitor/tasks/lists\",\n \"start_time_in_millis\" : 1513823752749,\n \"running_time_in_nanos\" : 293139,\n \"cancellable\" : false,\n \"headers\" : {\n \"X-Opaque-Id\" : \"123456\"\n },\n \"children\" : [\n {\n \"node\" : \"u5lcZHqcQhu-rUoFaqDphA\",\n \"id\" : 46,\n \"type\" : \"direct\",\n \"action\" : \"cluster:monitor/tasks/lists[n]\",\n \"start_time_in_millis\" : 1513823752750,\n \"running_time_in_nanos\" : 92133,\n \"cancellable\" : false,\n \"parent_task_id\" : \"u5lcZHqcQhu-rUoFaqDphA:45\",\n \"headers\" : {\n \"X-Opaque-Id\" : \"123456\"\n }\n }\n ]\n }\n }\n }\n```\nIn this example, `X-Opaque-Id: 123456` is the ID as a part of the response header.\nThe `X-Opaque-Id` in the task `headers` is the ID for the task that was initiated by the REST request.\nThe `X-Opaque-Id` in the children `headers` is the child task of the task that was initiated by the REST request.", "examples": { "ListTasksRequestExample1": { + "alternatives": [ + { + "code": "resp = client.tasks.list(\n actions=\"*search\",\n detailed=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.tasks.list({\n actions: \"*search\",\n detailed: \"true\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.tasks.list(\n actions: \"*search\",\n detailed: \"true\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->tasks()->list([\n \"actions\" => \"*search\",\n \"detailed\" => \"true\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_tasks?actions=*search&detailed\"", + "language": "curl" + } + ], "method_request": "GET _tasks?actions=*search&detailed" } }, @@ -234318,6 +247832,28 @@ "description": "Find the structure of a text field.\nFind the structure of a text field in an Elasticsearch index.\n\nThis API provides a starting point for extracting further information from log messages already ingested into Elasticsearch.\nFor example, if you have ingested data into a very simple index that has just `@timestamp` and message fields, you can use this API to see what common structure exists in the message field.\n\nThe response from the API contains:\n\n* Sample messages.\n* Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields.\n* Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text.\n* Appropriate mappings for an Elasticsearch index, which you could use to ingest the text.\n\nAll this information can be calculated by the structure finder with no guidance.\nHowever, you can optionally override some of the decisions about the text structure by specifying one or more query parameters.\n\nIf the structure finder produces unexpected results, specify the `explain` query parameter and an explanation will appear in the response.\nIt helps determine why the returned structure was chosen.", "examples": { "FindFieldStructureRequestExample1": { + "alternatives": [ + { + "code": "resp = client.text_structure.find_field_structure(\n index=\"test-logs\",\n field=\"message\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.textStructure.findFieldStructure({\n index: \"test-logs\",\n field: \"message\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.text_structure.find_field_structure(\n index: \"test-logs\",\n field: \"message\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->textStructure()->findFieldStructure([\n \"index\" => \"test-logs\",\n \"field\" => \"message\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_text_structure/find_field_structure?index=test-logs&field=message\"", + "language": "curl" + } + ], "method_request": "GET _text_structure/find_field_structure?index=test-logs&field=message" } }, @@ -234737,6 +248273,28 @@ "description": "Find the structure of text messages.\nFind the structure of a list of text messages.\nThe messages must contain data that is suitable to be ingested into Elasticsearch.\n\nThis API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality.\nUse this API rather than the find text structure API if your input text has already been split up into separate messages by some other process.\n\nThe response from the API contains:\n\n* Sample messages.\n* Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields.\n* Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text.\nAppropriate mappings for an Elasticsearch index, which you could use to ingest the text.\n\nAll this information can be calculated by the structure finder with no guidance.\nHowever, you can optionally override some of the decisions about the text structure by specifying one or more query parameters.\n\nIf the structure finder produces unexpected results, specify the `explain` query parameter and an explanation will appear in the response.\nIt helps determine why the returned structure was chosen.", "examples": { "FindMessageStructureRequestExample1": { + "alternatives": [ + { + "code": "resp = client.text_structure.find_message_structure(\n messages=[\n \"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128\",\n \"[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]\",\n \"[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]\",\n \"[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]\",\n \"[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled\",\n \"[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled\",\n \"[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled\",\n \"[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]\",\n \"[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]\",\n \"[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized\",\n \"[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ...\"\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.textStructure.findMessageStructure({\n messages: [\n \"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128\",\n \"[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]\",\n \"[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]\",\n \"[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]\",\n \"[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled\",\n \"[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled\",\n \"[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled\",\n \"[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]\",\n \"[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]\",\n \"[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized\",\n \"[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ...\",\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.text_structure.find_message_structure(\n body: {\n \"messages\": [\n \"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128\",\n \"[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]\",\n \"[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]\",\n \"[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]\",\n \"[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled\",\n \"[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled\",\n \"[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled\",\n \"[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]\",\n \"[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]\",\n \"[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized\",\n \"[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ...\"\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->textStructure()->findMessageStructure([\n \"body\" => [\n \"messages\" => array(\n \"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128\",\n \"[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]\",\n \"[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]\",\n \"[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]\",\n \"[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled\",\n \"[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled\",\n \"[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled\",\n \"[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]\",\n \"[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]\",\n \"[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized\",\n \"[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ...\",\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"messages\":[\"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128\",\"[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]\",\"[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]\",\"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]\",\"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]\",\"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]\",\"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]\",\"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]\",\"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]\",\"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]\",\"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]\",\"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]\",\"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]\",\"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]\",\"[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]\",\"[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled\",\"[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled\",\"[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled\",\"[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]\",\"[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]\",\"[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized\",\"[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ...\"]}' \"$ELASTICSEARCH_URL/_text_structure/find_message_structure\"", + "language": "curl" + } + ], "description": "Run `POST _text_structure/find_message_structure` to analyze Elasticsearch log files.\n", "method_request": "POST _text_structure/find_message_structure", "value": "{\n \"messages\": [\n \"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128\",\n \"[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]\",\n \"[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]\",\n \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]\",\n \"[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]\",\n \"[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled\",\n \"[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled\",\n \"[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled\",\n \"[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]\",\n \"[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]\",\n \"[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized\",\n \"[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ...\"\n ]\n}" @@ -235112,6 +248670,28 @@ "description": "Find the structure of a text file.\nThe text file must contain data that is suitable to be ingested into Elasticsearch.\n\nThis API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality.\nUnlike other Elasticsearch endpoints, the data that is posted to this endpoint does not need to be UTF-8 encoded and in JSON format.\nIt must, however, be text; binary text formats are not currently supported.\nThe size is limited to the Elasticsearch HTTP receive buffer size, which defaults to 100 Mb.\n\nThe response from the API contains:\n\n* A couple of messages from the beginning of the text.\n* Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields.\n* Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text.\n* Appropriate mappings for an Elasticsearch index, which you could use to ingest the text.\n\nAll this information can be calculated by the structure finder with no guidance.\nHowever, you can optionally override some of the decisions about the text structure by specifying one or more query parameters.", "examples": { "FindStructureRequestExample1": { + "alternatives": [ + { + "code": "resp = client.text_structure.find_structure(\n text_files=[\n {\n \"name\": \"Leviathan Wakes\",\n \"author\": \"James S.A. Corey\",\n \"release_date\": \"2011-06-02\",\n \"page_count\": 561\n },\n {\n \"name\": \"Hyperion\",\n \"author\": \"Dan Simmons\",\n \"release_date\": \"1989-05-26\",\n \"page_count\": 482\n },\n {\n \"name\": \"Dune\",\n \"author\": \"Frank Herbert\",\n \"release_date\": \"1965-06-01\",\n \"page_count\": 604\n },\n {\n \"name\": \"Dune Messiah\",\n \"author\": \"Frank Herbert\",\n \"release_date\": \"1969-10-15\",\n \"page_count\": 331\n },\n {\n \"name\": \"Children of Dune\",\n \"author\": \"Frank Herbert\",\n \"release_date\": \"1976-04-21\",\n \"page_count\": 408\n },\n {\n \"name\": \"God Emperor of Dune\",\n \"author\": \"Frank Herbert\",\n \"release_date\": \"1981-05-28\",\n \"page_count\": 454\n },\n {\n \"name\": \"Consider Phlebas\",\n \"author\": \"Iain M. Banks\",\n \"release_date\": \"1987-04-23\",\n \"page_count\": 471\n },\n {\n \"name\": \"Pandora's Star\",\n \"author\": \"Peter F. Hamilton\",\n \"release_date\": \"2004-03-02\",\n \"page_count\": 768\n },\n {\n \"name\": \"Revelation Space\",\n \"author\": \"Alastair Reynolds\",\n \"release_date\": \"2000-03-15\",\n \"page_count\": 585\n },\n {\n \"name\": \"A Fire Upon the Deep\",\n \"author\": \"Vernor Vinge\",\n \"release_date\": \"1992-06-01\",\n \"page_count\": 613\n },\n {\n \"name\": \"Ender's Game\",\n \"author\": \"Orson Scott Card\",\n \"release_date\": \"1985-06-01\",\n \"page_count\": 324\n },\n {\n \"name\": \"1984\",\n \"author\": \"George Orwell\",\n \"release_date\": \"1985-06-01\",\n \"page_count\": 328\n },\n {\n \"name\": \"Fahrenheit 451\",\n \"author\": \"Ray Bradbury\",\n \"release_date\": \"1953-10-15\",\n \"page_count\": 227\n },\n {\n \"name\": \"Brave New World\",\n \"author\": \"Aldous Huxley\",\n \"release_date\": \"1932-06-01\",\n \"page_count\": 268\n },\n {\n \"name\": \"Foundation\",\n \"author\": \"Isaac Asimov\",\n \"release_date\": \"1951-06-01\",\n \"page_count\": 224\n },\n {\n \"name\": \"The Giver\",\n \"author\": \"Lois Lowry\",\n \"release_date\": \"1993-04-26\",\n \"page_count\": 208\n },\n {\n \"name\": \"Slaughterhouse-Five\",\n \"author\": \"Kurt Vonnegut\",\n \"release_date\": \"1969-06-01\",\n \"page_count\": 275\n },\n {\n \"name\": \"The Hitchhiker's Guide to the Galaxy\",\n \"author\": \"Douglas Adams\",\n \"release_date\": \"1979-10-12\",\n \"page_count\": 180\n },\n {\n \"name\": \"Snow Crash\",\n \"author\": \"Neal Stephenson\",\n \"release_date\": \"1992-06-01\",\n \"page_count\": 470\n },\n {\n \"name\": \"Neuromancer\",\n \"author\": \"William Gibson\",\n \"release_date\": \"1984-07-01\",\n \"page_count\": 271\n },\n {\n \"name\": \"The Handmaid's Tale\",\n \"author\": \"Margaret Atwood\",\n \"release_date\": \"1985-06-01\",\n \"page_count\": 311\n },\n {\n \"name\": \"Starship Troopers\",\n \"author\": \"Robert A. Heinlein\",\n \"release_date\": \"1959-12-01\",\n \"page_count\": 335\n },\n {\n \"name\": \"The Left Hand of Darkness\",\n \"author\": \"Ursula K. Le Guin\",\n \"release_date\": \"1969-06-01\",\n \"page_count\": 304\n },\n {\n \"name\": \"The Moon is a Harsh Mistress\",\n \"author\": \"Robert A. Heinlein\",\n \"release_date\": \"1966-04-01\",\n \"page_count\": 288\n }\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.textStructure.findStructure({\n text_files: [\n {\n name: \"Leviathan Wakes\",\n author: \"James S.A. Corey\",\n release_date: \"2011-06-02\",\n page_count: 561,\n },\n {\n name: \"Hyperion\",\n author: \"Dan Simmons\",\n release_date: \"1989-05-26\",\n page_count: 482,\n },\n {\n name: \"Dune\",\n author: \"Frank Herbert\",\n release_date: \"1965-06-01\",\n page_count: 604,\n },\n {\n name: \"Dune Messiah\",\n author: \"Frank Herbert\",\n release_date: \"1969-10-15\",\n page_count: 331,\n },\n {\n name: \"Children of Dune\",\n author: \"Frank Herbert\",\n release_date: \"1976-04-21\",\n page_count: 408,\n },\n {\n name: \"God Emperor of Dune\",\n author: \"Frank Herbert\",\n release_date: \"1981-05-28\",\n page_count: 454,\n },\n {\n name: \"Consider Phlebas\",\n author: \"Iain M. Banks\",\n release_date: \"1987-04-23\",\n page_count: 471,\n },\n {\n name: \"Pandora's Star\",\n author: \"Peter F. Hamilton\",\n release_date: \"2004-03-02\",\n page_count: 768,\n },\n {\n name: \"Revelation Space\",\n author: \"Alastair Reynolds\",\n release_date: \"2000-03-15\",\n page_count: 585,\n },\n {\n name: \"A Fire Upon the Deep\",\n author: \"Vernor Vinge\",\n release_date: \"1992-06-01\",\n page_count: 613,\n },\n {\n name: \"Ender's Game\",\n author: \"Orson Scott Card\",\n release_date: \"1985-06-01\",\n page_count: 324,\n },\n {\n name: \"1984\",\n author: \"George Orwell\",\n release_date: \"1985-06-01\",\n page_count: 328,\n },\n {\n name: \"Fahrenheit 451\",\n author: \"Ray Bradbury\",\n release_date: \"1953-10-15\",\n page_count: 227,\n },\n {\n name: \"Brave New World\",\n author: \"Aldous Huxley\",\n release_date: \"1932-06-01\",\n page_count: 268,\n },\n {\n name: \"Foundation\",\n author: \"Isaac Asimov\",\n release_date: \"1951-06-01\",\n page_count: 224,\n },\n {\n name: \"The Giver\",\n author: \"Lois Lowry\",\n release_date: \"1993-04-26\",\n page_count: 208,\n },\n {\n name: \"Slaughterhouse-Five\",\n author: \"Kurt Vonnegut\",\n release_date: \"1969-06-01\",\n page_count: 275,\n },\n {\n name: \"The Hitchhiker's Guide to the Galaxy\",\n author: \"Douglas Adams\",\n release_date: \"1979-10-12\",\n page_count: 180,\n },\n {\n name: \"Snow Crash\",\n author: \"Neal Stephenson\",\n release_date: \"1992-06-01\",\n page_count: 470,\n },\n {\n name: \"Neuromancer\",\n author: \"William Gibson\",\n release_date: \"1984-07-01\",\n page_count: 271,\n },\n {\n name: \"The Handmaid's Tale\",\n author: \"Margaret Atwood\",\n release_date: \"1985-06-01\",\n page_count: 311,\n },\n {\n name: \"Starship Troopers\",\n author: \"Robert A. Heinlein\",\n release_date: \"1959-12-01\",\n page_count: 335,\n },\n {\n name: \"The Left Hand of Darkness\",\n author: \"Ursula K. Le Guin\",\n release_date: \"1969-06-01\",\n page_count: 304,\n },\n {\n name: \"The Moon is a Harsh Mistress\",\n author: \"Robert A. Heinlein\",\n release_date: \"1966-04-01\",\n page_count: 288,\n },\n ],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.text_structure.find_structure(\n body: [\n {\n \"name\": \"Leviathan Wakes\",\n \"author\": \"James S.A. Corey\",\n \"release_date\": \"2011-06-02\",\n \"page_count\": 561\n },\n {\n \"name\": \"Hyperion\",\n \"author\": \"Dan Simmons\",\n \"release_date\": \"1989-05-26\",\n \"page_count\": 482\n },\n {\n \"name\": \"Dune\",\n \"author\": \"Frank Herbert\",\n \"release_date\": \"1965-06-01\",\n \"page_count\": 604\n },\n {\n \"name\": \"Dune Messiah\",\n \"author\": \"Frank Herbert\",\n \"release_date\": \"1969-10-15\",\n \"page_count\": 331\n },\n {\n \"name\": \"Children of Dune\",\n \"author\": \"Frank Herbert\",\n \"release_date\": \"1976-04-21\",\n \"page_count\": 408\n },\n {\n \"name\": \"God Emperor of Dune\",\n \"author\": \"Frank Herbert\",\n \"release_date\": \"1981-05-28\",\n \"page_count\": 454\n },\n {\n \"name\": \"Consider Phlebas\",\n \"author\": \"Iain M. Banks\",\n \"release_date\": \"1987-04-23\",\n \"page_count\": 471\n },\n {\n \"name\": \"Pandora's Star\",\n \"author\": \"Peter F. Hamilton\",\n \"release_date\": \"2004-03-02\",\n \"page_count\": 768\n },\n {\n \"name\": \"Revelation Space\",\n \"author\": \"Alastair Reynolds\",\n \"release_date\": \"2000-03-15\",\n \"page_count\": 585\n },\n {\n \"name\": \"A Fire Upon the Deep\",\n \"author\": \"Vernor Vinge\",\n \"release_date\": \"1992-06-01\",\n \"page_count\": 613\n },\n {\n \"name\": \"Ender's Game\",\n \"author\": \"Orson Scott Card\",\n \"release_date\": \"1985-06-01\",\n \"page_count\": 324\n },\n {\n \"name\": \"1984\",\n \"author\": \"George Orwell\",\n \"release_date\": \"1985-06-01\",\n \"page_count\": 328\n },\n {\n \"name\": \"Fahrenheit 451\",\n \"author\": \"Ray Bradbury\",\n \"release_date\": \"1953-10-15\",\n \"page_count\": 227\n },\n {\n \"name\": \"Brave New World\",\n \"author\": \"Aldous Huxley\",\n \"release_date\": \"1932-06-01\",\n \"page_count\": 268\n },\n {\n \"name\": \"Foundation\",\n \"author\": \"Isaac Asimov\",\n \"release_date\": \"1951-06-01\",\n \"page_count\": 224\n },\n {\n \"name\": \"The Giver\",\n \"author\": \"Lois Lowry\",\n \"release_date\": \"1993-04-26\",\n \"page_count\": 208\n },\n {\n \"name\": \"Slaughterhouse-Five\",\n \"author\": \"Kurt Vonnegut\",\n \"release_date\": \"1969-06-01\",\n \"page_count\": 275\n },\n {\n \"name\": \"The Hitchhiker's Guide to the Galaxy\",\n \"author\": \"Douglas Adams\",\n \"release_date\": \"1979-10-12\",\n \"page_count\": 180\n },\n {\n \"name\": \"Snow Crash\",\n \"author\": \"Neal Stephenson\",\n \"release_date\": \"1992-06-01\",\n \"page_count\": 470\n },\n {\n \"name\": \"Neuromancer\",\n \"author\": \"William Gibson\",\n \"release_date\": \"1984-07-01\",\n \"page_count\": 271\n },\n {\n \"name\": \"The Handmaid's Tale\",\n \"author\": \"Margaret Atwood\",\n \"release_date\": \"1985-06-01\",\n \"page_count\": 311\n },\n {\n \"name\": \"Starship Troopers\",\n \"author\": \"Robert A. Heinlein\",\n \"release_date\": \"1959-12-01\",\n \"page_count\": 335\n },\n {\n \"name\": \"The Left Hand of Darkness\",\n \"author\": \"Ursula K. Le Guin\",\n \"release_date\": \"1969-06-01\",\n \"page_count\": 304\n },\n {\n \"name\": \"The Moon is a Harsh Mistress\",\n \"author\": \"Robert A. Heinlein\",\n \"release_date\": \"1966-04-01\",\n \"page_count\": 288\n }\n ]\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->textStructure()->findStructure([\n \"body\" => array(\n [\n \"name\" => \"Leviathan Wakes\",\n \"author\" => \"James S.A. Corey\",\n \"release_date\" => \"2011-06-02\",\n \"page_count\" => 561,\n ],\n [\n \"name\" => \"Hyperion\",\n \"author\" => \"Dan Simmons\",\n \"release_date\" => \"1989-05-26\",\n \"page_count\" => 482,\n ],\n [\n \"name\" => \"Dune\",\n \"author\" => \"Frank Herbert\",\n \"release_date\" => \"1965-06-01\",\n \"page_count\" => 604,\n ],\n [\n \"name\" => \"Dune Messiah\",\n \"author\" => \"Frank Herbert\",\n \"release_date\" => \"1969-10-15\",\n \"page_count\" => 331,\n ],\n [\n \"name\" => \"Children of Dune\",\n \"author\" => \"Frank Herbert\",\n \"release_date\" => \"1976-04-21\",\n \"page_count\" => 408,\n ],\n [\n \"name\" => \"God Emperor of Dune\",\n \"author\" => \"Frank Herbert\",\n \"release_date\" => \"1981-05-28\",\n \"page_count\" => 454,\n ],\n [\n \"name\" => \"Consider Phlebas\",\n \"author\" => \"Iain M. Banks\",\n \"release_date\" => \"1987-04-23\",\n \"page_count\" => 471,\n ],\n [\n \"name\" => \"Pandora's Star\",\n \"author\" => \"Peter F. Hamilton\",\n \"release_date\" => \"2004-03-02\",\n \"page_count\" => 768,\n ],\n [\n \"name\" => \"Revelation Space\",\n \"author\" => \"Alastair Reynolds\",\n \"release_date\" => \"2000-03-15\",\n \"page_count\" => 585,\n ],\n [\n \"name\" => \"A Fire Upon the Deep\",\n \"author\" => \"Vernor Vinge\",\n \"release_date\" => \"1992-06-01\",\n \"page_count\" => 613,\n ],\n [\n \"name\" => \"Ender's Game\",\n \"author\" => \"Orson Scott Card\",\n \"release_date\" => \"1985-06-01\",\n \"page_count\" => 324,\n ],\n [\n \"name\" => \"1984\",\n \"author\" => \"George Orwell\",\n \"release_date\" => \"1985-06-01\",\n \"page_count\" => 328,\n ],\n [\n \"name\" => \"Fahrenheit 451\",\n \"author\" => \"Ray Bradbury\",\n \"release_date\" => \"1953-10-15\",\n \"page_count\" => 227,\n ],\n [\n \"name\" => \"Brave New World\",\n \"author\" => \"Aldous Huxley\",\n \"release_date\" => \"1932-06-01\",\n \"page_count\" => 268,\n ],\n [\n \"name\" => \"Foundation\",\n \"author\" => \"Isaac Asimov\",\n \"release_date\" => \"1951-06-01\",\n \"page_count\" => 224,\n ],\n [\n \"name\" => \"The Giver\",\n \"author\" => \"Lois Lowry\",\n \"release_date\" => \"1993-04-26\",\n \"page_count\" => 208,\n ],\n [\n \"name\" => \"Slaughterhouse-Five\",\n \"author\" => \"Kurt Vonnegut\",\n \"release_date\" => \"1969-06-01\",\n \"page_count\" => 275,\n ],\n [\n \"name\" => \"The Hitchhiker's Guide to the Galaxy\",\n \"author\" => \"Douglas Adams\",\n \"release_date\" => \"1979-10-12\",\n \"page_count\" => 180,\n ],\n [\n \"name\" => \"Snow Crash\",\n \"author\" => \"Neal Stephenson\",\n \"release_date\" => \"1992-06-01\",\n \"page_count\" => 470,\n ],\n [\n \"name\" => \"Neuromancer\",\n \"author\" => \"William Gibson\",\n \"release_date\" => \"1984-07-01\",\n \"page_count\" => 271,\n ],\n [\n \"name\" => \"The Handmaid's Tale\",\n \"author\" => \"Margaret Atwood\",\n \"release_date\" => \"1985-06-01\",\n \"page_count\" => 311,\n ],\n [\n \"name\" => \"Starship Troopers\",\n \"author\" => \"Robert A. Heinlein\",\n \"release_date\" => \"1959-12-01\",\n \"page_count\" => 335,\n ],\n [\n \"name\" => \"The Left Hand of Darkness\",\n \"author\" => \"Ursula K. Le Guin\",\n \"release_date\" => \"1969-06-01\",\n \"page_count\" => 304,\n ],\n [\n \"name\" => \"The Moon is a Harsh Mistress\",\n \"author\" => \"Robert A. Heinlein\",\n \"release_date\" => \"1966-04-01\",\n \"page_count\" => 288,\n ],\n ),\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '[{\"name\":\"Leviathan Wakes\",\"author\":\"James S.A. Corey\",\"release_date\":\"2011-06-02\",\"page_count\":561},{\"name\":\"Hyperion\",\"author\":\"Dan Simmons\",\"release_date\":\"1989-05-26\",\"page_count\":482},{\"name\":\"Dune\",\"author\":\"Frank Herbert\",\"release_date\":\"1965-06-01\",\"page_count\":604},{\"name\":\"Dune Messiah\",\"author\":\"Frank Herbert\",\"release_date\":\"1969-10-15\",\"page_count\":331},{\"name\":\"Children of Dune\",\"author\":\"Frank Herbert\",\"release_date\":\"1976-04-21\",\"page_count\":408},{\"name\":\"God Emperor of Dune\",\"author\":\"Frank Herbert\",\"release_date\":\"1981-05-28\",\"page_count\":454},{\"name\":\"Consider Phlebas\",\"author\":\"Iain M. Banks\",\"release_date\":\"1987-04-23\",\"page_count\":471},{\"name\":\"Pandora'\"'\"'s Star\",\"author\":\"Peter F. Hamilton\",\"release_date\":\"2004-03-02\",\"page_count\":768},{\"name\":\"Revelation Space\",\"author\":\"Alastair Reynolds\",\"release_date\":\"2000-03-15\",\"page_count\":585},{\"name\":\"A Fire Upon the Deep\",\"author\":\"Vernor Vinge\",\"release_date\":\"1992-06-01\",\"page_count\":613},{\"name\":\"Ender'\"'\"'s Game\",\"author\":\"Orson Scott Card\",\"release_date\":\"1985-06-01\",\"page_count\":324},{\"name\":\"1984\",\"author\":\"George Orwell\",\"release_date\":\"1985-06-01\",\"page_count\":328},{\"name\":\"Fahrenheit 451\",\"author\":\"Ray Bradbury\",\"release_date\":\"1953-10-15\",\"page_count\":227},{\"name\":\"Brave New World\",\"author\":\"Aldous Huxley\",\"release_date\":\"1932-06-01\",\"page_count\":268},{\"name\":\"Foundation\",\"author\":\"Isaac Asimov\",\"release_date\":\"1951-06-01\",\"page_count\":224},{\"name\":\"The Giver\",\"author\":\"Lois Lowry\",\"release_date\":\"1993-04-26\",\"page_count\":208},{\"name\":\"Slaughterhouse-Five\",\"author\":\"Kurt Vonnegut\",\"release_date\":\"1969-06-01\",\"page_count\":275},{\"name\":\"The Hitchhiker'\"'\"'s Guide to the Galaxy\",\"author\":\"Douglas Adams\",\"release_date\":\"1979-10-12\",\"page_count\":180},{\"name\":\"Snow Crash\",\"author\":\"Neal Stephenson\",\"release_date\":\"1992-06-01\",\"page_count\":470},{\"name\":\"Neuromancer\",\"author\":\"William Gibson\",\"release_date\":\"1984-07-01\",\"page_count\":271},{\"name\":\"The Handmaid'\"'\"'s Tale\",\"author\":\"Margaret Atwood\",\"release_date\":\"1985-06-01\",\"page_count\":311},{\"name\":\"Starship Troopers\",\"author\":\"Robert A. Heinlein\",\"release_date\":\"1959-12-01\",\"page_count\":335},{\"name\":\"The Left Hand of Darkness\",\"author\":\"Ursula K. Le Guin\",\"release_date\":\"1969-06-01\",\"page_count\":304},{\"name\":\"The Moon is a Harsh Mistress\",\"author\":\"Robert A. Heinlein\",\"release_date\":\"1966-04-01\",\"page_count\":288}]' \"$ELASTICSEARCH_URL/_text_structure/find_structure\"", + "language": "curl" + } + ], "description": "Run `POST _text_structure/find_structure` to analyze newline-delimited JSON text.", "method_request": "POST _text_structure/find_structure", "value": "{\"name\": \"Leviathan Wakes\", \"author\": \"James S.A. Corey\", \"release_date\": \"2011-06-02\", \"page_count\": 561}\n{\"name\": \"Hyperion\", \"author\": \"Dan Simmons\", \"release_date\": \"1989-05-26\", \"page_count\": 482}\n{\"name\": \"Dune\", \"author\": \"Frank Herbert\", \"release_date\": \"1965-06-01\", \"page_count\": 604}\n{\"name\": \"Dune Messiah\", \"author\": \"Frank Herbert\", \"release_date\": \"1969-10-15\", \"page_count\": 331}\n{\"name\": \"Children of Dune\", \"author\": \"Frank Herbert\", \"release_date\": \"1976-04-21\", \"page_count\": 408}\n{\"name\": \"God Emperor of Dune\", \"author\": \"Frank Herbert\", \"release_date\": \"1981-05-28\", \"page_count\": 454}\n{\"name\": \"Consider Phlebas\", \"author\": \"Iain M. Banks\", \"release_date\": \"1987-04-23\", \"page_count\": 471}\n{\"name\": \"Pandora's Star\", \"author\": \"Peter F. Hamilton\", \"release_date\": \"2004-03-02\", \"page_count\": 768}\n{\"name\": \"Revelation Space\", \"author\": \"Alastair Reynolds\", \"release_date\": \"2000-03-15\", \"page_count\": 585}\n{\"name\": \"A Fire Upon the Deep\", \"author\": \"Vernor Vinge\", \"release_date\": \"1992-06-01\", \"page_count\": 613}\n{\"name\": \"Ender's Game\", \"author\": \"Orson Scott Card\", \"release_date\": \"1985-06-01\", \"page_count\": 324}\n{\"name\": \"1984\", \"author\": \"George Orwell\", \"release_date\": \"1985-06-01\", \"page_count\": 328}\n{\"name\": \"Fahrenheit 451\", \"author\": \"Ray Bradbury\", \"release_date\": \"1953-10-15\", \"page_count\": 227}\n{\"name\": \"Brave New World\", \"author\": \"Aldous Huxley\", \"release_date\": \"1932-06-01\", \"page_count\": 268}\n{\"name\": \"Foundation\", \"author\": \"Isaac Asimov\", \"release_date\": \"1951-06-01\", \"page_count\": 224}\n{\"name\": \"The Giver\", \"author\": \"Lois Lowry\", \"release_date\": \"1993-04-26\", \"page_count\": 208}\n{\"name\": \"Slaughterhouse-Five\", \"author\": \"Kurt Vonnegut\", \"release_date\": \"1969-06-01\", \"page_count\": 275}\n{\"name\": \"The Hitchhiker's Guide to the Galaxy\", \"author\": \"Douglas Adams\", \"release_date\": \"1979-10-12\", \"page_count\": 180}\n{\"name\": \"Snow Crash\", \"author\": \"Neal Stephenson\", \"release_date\": \"1992-06-01\", \"page_count\": 470}\n{\"name\": \"Neuromancer\", \"author\": \"William Gibson\", \"release_date\": \"1984-07-01\", \"page_count\": 271}\n{\"name\": \"The Handmaid's Tale\", \"author\": \"Margaret Atwood\", \"release_date\": \"1985-06-01\", \"page_count\": 311}\n{\"name\": \"Starship Troopers\", \"author\": \"Robert A. Heinlein\", \"release_date\": \"1959-12-01\", \"page_count\": 335}\n{\"name\": \"The Left Hand of Darkness\", \"author\": \"Ursula K. Le Guin\", \"release_date\": \"1969-06-01\", \"page_count\": 304}\n{\"name\": \"The Moon is a Harsh Mistress\", \"author\": \"Robert A. Heinlein\", \"release_date\": \"1966-04-01\", \"page_count\": 288}" @@ -235743,6 +249323,28 @@ "description": "Test a Grok pattern.\nTest a Grok pattern on one or more lines of text.\nThe API indicates whether the lines match the pattern together with the offsets and lengths of the matched substrings.", "examples": { "TestGrokPatternRequestExample1": { + "alternatives": [ + { + "code": "resp = client.text_structure.test_grok_pattern(\n grok_pattern=\"Hello %{WORD:first_name} %{WORD:last_name}\",\n text=[\n \"Hello John Doe\",\n \"this does not match\"\n ],\n)", + "language": "Python" + }, + { + "code": "const response = await client.textStructure.testGrokPattern({\n grok_pattern: \"Hello %{WORD:first_name} %{WORD:last_name}\",\n text: [\"Hello John Doe\", \"this does not match\"],\n});", + "language": "JavaScript" + }, + { + "code": "response = client.text_structure.test_grok_pattern(\n body: {\n \"grok_pattern\": \"Hello %{WORD:first_name} %{WORD:last_name}\",\n \"text\": [\n \"Hello John Doe\",\n \"this does not match\"\n ]\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->textStructure()->testGrokPattern([\n \"body\" => [\n \"grok_pattern\" => \"Hello %{WORD:first_name} %{WORD:last_name}\",\n \"text\" => array(\n \"Hello John Doe\",\n \"this does not match\",\n ),\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"grok_pattern\":\"Hello %{WORD:first_name} %{WORD:last_name}\",\"text\":[\"Hello John Doe\",\"this does not match\"]}' \"$ELASTICSEARCH_URL/_text_structure/test_grok_pattern\"", + "language": "curl" + } + ], "description": "Run `GET _text_structure/test_grok_pattern` to test a Grok pattern.", "method_request": "GET _text_structure/test_grok_pattern", "value": "{\n \"grok_pattern\": \"Hello %{WORD:first_name} %{WORD:last_name}\",\n \"text\": [\n \"Hello John Doe\",\n \"this does not match\"\n ]\n}" @@ -236272,6 +249874,28 @@ "description": "Delete a transform.", "examples": { "TransformDeleteTransformExample1": { + "alternatives": [ + { + "code": "resp = client.transform.delete_transform(\n transform_id=\"ecommerce_transform\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.transform.deleteTransform({\n transform_id: \"ecommerce_transform\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.transform.delete_transform(\n transform_id: \"ecommerce_transform\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->transform()->deleteTransform([\n \"transform_id\" => \"ecommerce_transform\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/ecommerce_transform\"", + "language": "curl" + } + ], "method_request": "DELETE _transform/ecommerce_transform" } }, @@ -236378,6 +250002,28 @@ "description": "Get transforms.\nGet configuration information for transforms.", "examples": { "TransformGetTransformExample1": { + "alternatives": [ + { + "code": "resp = client.transform.get_transform(\n size=\"10\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.transform.getTransform({\n size: 10,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.transform.get_transform(\n size: \"10\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->transform()->getTransform([\n \"size\" => \"10\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform?size=10\"", + "language": "curl" + } + ], "method_request": "GET _transform?size=10" } }, @@ -236891,6 +250537,28 @@ "description": "Get transform stats.\n\nGet usage information for transforms.", "examples": { "TransformGetTransformStatsExample1": { + "alternatives": [ + { + "code": "resp = client.transform.get_transform_stats(\n transform_id=\"ecommerce-customer-transform\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.transform.getTransformStats({\n transform_id: \"ecommerce-customer-transform\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.transform.get_transform_stats(\n transform_id: \"ecommerce-customer-transform\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->transform()->getTransformStats([\n \"transform_id\" => \"ecommerce-customer-transform\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/ecommerce-customer-transform/_stats\"", + "language": "curl" + } + ], "method_request": "GET _transform/ecommerce-customer-transform/_stats" } }, @@ -237662,6 +251330,28 @@ "description": "Preview a transform.\nGenerates a preview of the results that you will get when you create a transform with the same configuration.\n\nIt returns a maximum of 100 results. The calculations are based on all the current data in the source index. It also\ngenerates a list of mappings and settings for the destination index. These values are determined based on the field\ntypes of the source index and the transform aggregations.", "examples": { "PreviewTransformRequestExample1": { + "alternatives": [ + { + "code": "resp = client.transform.preview_transform(\n source={\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n pivot={\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": True\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.transform.previewTransform({\n source: {\n index: \"kibana_sample_data_ecommerce\",\n },\n pivot: {\n group_by: {\n customer_id: {\n terms: {\n field: \"customer_id\",\n missing_bucket: true,\n },\n },\n },\n aggregations: {\n max_price: {\n max: {\n field: \"taxful_total_price\",\n },\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.transform.preview_transform(\n body: {\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->transform()->previewTransform([\n \"body\" => [\n \"source\" => [\n \"index\" => \"kibana_sample_data_ecommerce\",\n ],\n \"pivot\" => [\n \"group_by\" => [\n \"customer_id\" => [\n \"terms\" => [\n \"field\" => \"customer_id\",\n \"missing_bucket\" => true,\n ],\n ],\n ],\n \"aggregations\" => [\n \"max_price\" => [\n \"max\" => [\n \"field\" => \"taxful_total_price\",\n ],\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"kibana_sample_data_ecommerce\"},\"pivot\":{\"group_by\":{\"customer_id\":{\"terms\":{\"field\":\"customer_id\",\"missing_bucket\":true}}},\"aggregations\":{\"max_price\":{\"max\":{\"field\":\"taxful_total_price\"}}}}}' \"$ELASTICSEARCH_URL/_transform/_preview\"", + "language": "curl" + } + ], "description": "Run `POST _transform/_preview` to preview a transform that uses the pivot method.", "method_request": "POST _transform/_preview", "value": "{\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n }\n}" @@ -237892,12 +251582,56 @@ "description": "Create a transform.\nCreates a transform.\n\nA transform copies data from source indices, transforms it, and persists it into an entity-centric destination index. You can also think of the destination index as a two-dimensional tabular data structure (known as\na data frame). The ID for each document in the data frame is generated from a hash of the entity, so there is a\nunique row per entity.\n\nYou must choose either the latest or pivot method for your transform; you cannot use both in a single transform. If\nyou choose to use the pivot method for your transform, the entities are defined by the set of `group_by` fields in\nthe pivot object. If you choose to use the latest method, the entities are defined by the `unique_key` field values\nin the latest object.\n\nYou must have `create_index`, `index`, and `read` privileges on the destination index and `read` and\n`view_index_metadata` privileges on the source indices. When Elasticsearch security features are enabled, the\ntransform remembers which roles the user that created it had at the time of creation and uses those same roles. If\nthose roles do not have the required privileges on the source and destination indices, the transform fails when it\nattempts unauthorized operations.\n\nNOTE: You must use Kibana or this API to create a transform. Do not add a transform directly into any\n`.transform-internal*` indices using the Elasticsearch index API. If Elasticsearch security features are enabled, do\nnot give users any privileges on `.transform-internal*` indices. If you used transforms prior to 7.5, also do not\ngive users any privileges on `.data-frame-internal*` indices.", "examples": { "PutTransformRequestExample1": { + "alternatives": [ + { + "code": "resp = client.transform.put_transform(\n transform_id=\"ecommerce_transform1\",\n source={\n \"index\": \"kibana_sample_data_ecommerce\",\n \"query\": {\n \"term\": {\n \"geoip.continent_name\": {\n \"value\": \"Asia\"\n }\n }\n }\n },\n pivot={\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": True\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n description=\"Maximum priced ecommerce data by customer_id in Asia\",\n dest={\n \"index\": \"kibana_sample_data_ecommerce_transform1\",\n \"pipeline\": \"add_timestamp_pipeline\"\n },\n frequency=\"5m\",\n sync={\n \"time\": {\n \"field\": \"order_date\",\n \"delay\": \"60s\"\n }\n },\n retention_policy={\n \"time\": {\n \"field\": \"order_date\",\n \"max_age\": \"30d\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.transform.putTransform({\n transform_id: \"ecommerce_transform1\",\n source: {\n index: \"kibana_sample_data_ecommerce\",\n query: {\n term: {\n \"geoip.continent_name\": {\n value: \"Asia\",\n },\n },\n },\n },\n pivot: {\n group_by: {\n customer_id: {\n terms: {\n field: \"customer_id\",\n missing_bucket: true,\n },\n },\n },\n aggregations: {\n max_price: {\n max: {\n field: \"taxful_total_price\",\n },\n },\n },\n },\n description: \"Maximum priced ecommerce data by customer_id in Asia\",\n dest: {\n index: \"kibana_sample_data_ecommerce_transform1\",\n pipeline: \"add_timestamp_pipeline\",\n },\n frequency: \"5m\",\n sync: {\n time: {\n field: \"order_date\",\n delay: \"60s\",\n },\n },\n retention_policy: {\n time: {\n field: \"order_date\",\n max_age: \"30d\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.transform.put_transform(\n transform_id: \"ecommerce_transform1\",\n body: {\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\",\n \"query\": {\n \"term\": {\n \"geoip.continent_name\": {\n \"value\": \"Asia\"\n }\n }\n }\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n \"description\": \"Maximum priced ecommerce data by customer_id in Asia\",\n \"dest\": {\n \"index\": \"kibana_sample_data_ecommerce_transform1\",\n \"pipeline\": \"add_timestamp_pipeline\"\n },\n \"frequency\": \"5m\",\n \"sync\": {\n \"time\": {\n \"field\": \"order_date\",\n \"delay\": \"60s\"\n }\n },\n \"retention_policy\": {\n \"time\": {\n \"field\": \"order_date\",\n \"max_age\": \"30d\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->transform()->putTransform([\n \"transform_id\" => \"ecommerce_transform1\",\n \"body\" => [\n \"source\" => [\n \"index\" => \"kibana_sample_data_ecommerce\",\n \"query\" => [\n \"term\" => [\n \"geoip.continent_name\" => [\n \"value\" => \"Asia\",\n ],\n ],\n ],\n ],\n \"pivot\" => [\n \"group_by\" => [\n \"customer_id\" => [\n \"terms\" => [\n \"field\" => \"customer_id\",\n \"missing_bucket\" => true,\n ],\n ],\n ],\n \"aggregations\" => [\n \"max_price\" => [\n \"max\" => [\n \"field\" => \"taxful_total_price\",\n ],\n ],\n ],\n ],\n \"description\" => \"Maximum priced ecommerce data by customer_id in Asia\",\n \"dest\" => [\n \"index\" => \"kibana_sample_data_ecommerce_transform1\",\n \"pipeline\" => \"add_timestamp_pipeline\",\n ],\n \"frequency\" => \"5m\",\n \"sync\" => [\n \"time\" => [\n \"field\" => \"order_date\",\n \"delay\" => \"60s\",\n ],\n ],\n \"retention_policy\" => [\n \"time\" => [\n \"field\" => \"order_date\",\n \"max_age\" => \"30d\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"kibana_sample_data_ecommerce\",\"query\":{\"term\":{\"geoip.continent_name\":{\"value\":\"Asia\"}}}},\"pivot\":{\"group_by\":{\"customer_id\":{\"terms\":{\"field\":\"customer_id\",\"missing_bucket\":true}}},\"aggregations\":{\"max_price\":{\"max\":{\"field\":\"taxful_total_price\"}}}},\"description\":\"Maximum priced ecommerce data by customer_id in Asia\",\"dest\":{\"index\":\"kibana_sample_data_ecommerce_transform1\",\"pipeline\":\"add_timestamp_pipeline\"},\"frequency\":\"5m\",\"sync\":{\"time\":{\"field\":\"order_date\",\"delay\":\"60s\"}},\"retention_policy\":{\"time\":{\"field\":\"order_date\",\"max_age\":\"30d\"}}}' \"$ELASTICSEARCH_URL/_transform/ecommerce_transform1\"", + "language": "curl" + } + ], "description": "Run `PUT _transform/ecommerce_transform1` to create a transform that uses the pivot method.", "method_request": "PUT _transform/ecommerce_transform1", "summary": "A pivot transform", "value": "{\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\",\n \"query\": {\n \"term\": {\n \"geoip.continent_name\": {\n \"value\": \"Asia\"\n }\n }\n }\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n \"description\": \"Maximum priced ecommerce data by customer_id in Asia\",\n \"dest\": {\n \"index\": \"kibana_sample_data_ecommerce_transform1\",\n \"pipeline\": \"add_timestamp_pipeline\"\n },\n \"frequency\": \"5m\",\n \"sync\": {\n \"time\": {\n \"field\": \"order_date\",\n \"delay\": \"60s\"\n }\n },\n \"retention_policy\": {\n \"time\": {\n \"field\": \"order_date\",\n \"max_age\": \"30d\"\n }\n }\n}" }, "PutTransformRequestExample2": { + "alternatives": [ + { + "code": "resp = client.transform.put_transform(\n transform_id=\"ecommerce_transform2\",\n source={\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n latest={\n \"unique_key\": [\n \"customer_id\"\n ],\n \"sort\": \"order_date\"\n },\n description=\"Latest order for each customer\",\n dest={\n \"index\": \"kibana_sample_data_ecommerce_transform2\"\n },\n frequency=\"5m\",\n sync={\n \"time\": {\n \"field\": \"order_date\",\n \"delay\": \"60s\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.transform.putTransform({\n transform_id: \"ecommerce_transform2\",\n source: {\n index: \"kibana_sample_data_ecommerce\",\n },\n latest: {\n unique_key: [\"customer_id\"],\n sort: \"order_date\",\n },\n description: \"Latest order for each customer\",\n dest: {\n index: \"kibana_sample_data_ecommerce_transform2\",\n },\n frequency: \"5m\",\n sync: {\n time: {\n field: \"order_date\",\n delay: \"60s\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.transform.put_transform(\n transform_id: \"ecommerce_transform2\",\n body: {\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\"\n },\n \"latest\": {\n \"unique_key\": [\n \"customer_id\"\n ],\n \"sort\": \"order_date\"\n },\n \"description\": \"Latest order for each customer\",\n \"dest\": {\n \"index\": \"kibana_sample_data_ecommerce_transform2\"\n },\n \"frequency\": \"5m\",\n \"sync\": {\n \"time\": {\n \"field\": \"order_date\",\n \"delay\": \"60s\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->transform()->putTransform([\n \"transform_id\" => \"ecommerce_transform2\",\n \"body\" => [\n \"source\" => [\n \"index\" => \"kibana_sample_data_ecommerce\",\n ],\n \"latest\" => [\n \"unique_key\" => array(\n \"customer_id\",\n ),\n \"sort\" => \"order_date\",\n ],\n \"description\" => \"Latest order for each customer\",\n \"dest\" => [\n \"index\" => \"kibana_sample_data_ecommerce_transform2\",\n ],\n \"frequency\" => \"5m\",\n \"sync\" => [\n \"time\" => [\n \"field\" => \"order_date\",\n \"delay\" => \"60s\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"kibana_sample_data_ecommerce\"},\"latest\":{\"unique_key\":[\"customer_id\"],\"sort\":\"order_date\"},\"description\":\"Latest order for each customer\",\"dest\":{\"index\":\"kibana_sample_data_ecommerce_transform2\"},\"frequency\":\"5m\",\"sync\":{\"time\":{\"field\":\"order_date\",\"delay\":\"60s\"}}}' \"$ELASTICSEARCH_URL/_transform/ecommerce_transform2\"", + "language": "curl" + } + ], "description": "Run `PUT _transform/ecommerce_transform2` to create a transform that uses the latest method.", "method_request": "PUT _transform/ecommerce_transform2", "summary": "A latest transform", @@ -237994,6 +251728,28 @@ "description": "Reset a transform.\n\nBefore you can reset it, you must stop it; alternatively, use the `force` query parameter.\nIf the destination index was created by the transform, it is deleted.", "examples": { "TransformResetTransformExample1": { + "alternatives": [ + { + "code": "resp = client.transform.reset_transform(\n transform_id=\"ecommerce_transform\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.transform.resetTransform({\n transform_id: \"ecommerce_transform\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.transform.reset_transform(\n transform_id: \"ecommerce_transform\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->transform()->resetTransform([\n \"transform_id\" => \"ecommerce_transform\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/ecommerce_transform/_reset\"", + "language": "curl" + } + ], "method_request": "POST _transform/ecommerce_transform/_reset" } }, @@ -238087,6 +251843,28 @@ "description": "Schedule a transform to start now.\n\nInstantly run a transform to process data.\nIf you run this API, the transform will process the new data instantly,\nwithout waiting for the configured frequency interval. After the API is called,\nthe transform will be processed again at `now + frequency` unless the API\nis called again in the meantime.", "examples": { "TransformScheduleNowTransformExample1": { + "alternatives": [ + { + "code": "resp = client.transform.schedule_now_transform(\n transform_id=\"ecommerce_transform\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.transform.scheduleNowTransform({\n transform_id: \"ecommerce_transform\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.transform.schedule_now_transform(\n transform_id: \"ecommerce_transform\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->transform()->scheduleNowTransform([\n \"transform_id\" => \"ecommerce_transform\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/ecommerce_transform/_schedule_now\"", + "language": "curl" + } + ], "method_request": "POST _transform/ecommerce_transform/_schedule_now" } }, @@ -238167,6 +251945,28 @@ "description": "Start a transform.\n\nWhen you start a transform, it creates the destination index if it does not already exist. The `number_of_shards` is\nset to `1` and the `auto_expand_replicas` is set to `0-1`. If it is a pivot transform, it deduces the mapping\ndefinitions for the destination index from the source indices and the transform aggregations. If fields in the\ndestination index are derived from scripts (as in the case of `scripted_metric` or `bucket_script` aggregations),\nthe transform uses dynamic mappings unless an index template exists. If it is a latest transform, it does not deduce\nmapping definitions; it uses dynamic mappings. To use explicit mappings, create the destination index before you\nstart the transform. Alternatively, you can create an index template, though it does not affect the deduced mappings\nin a pivot transform.\n\nWhen the transform starts, a series of validations occur to ensure its success. If you deferred validation when you\ncreated the transform, they occur when you start the transform—​with the exception of privilege checks. When\nElasticsearch security features are enabled, the transform remembers which roles the user that created it had at the\ntime of creation and uses those same roles. If those roles do not have the required privileges on the source and\ndestination indices, the transform fails when it attempts unauthorized operations.", "examples": { "TransformStartTransformExample1": { + "alternatives": [ + { + "code": "resp = client.transform.start_transform(\n transform_id=\"ecommerce-customer-transform\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.transform.startTransform({\n transform_id: \"ecommerce-customer-transform\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.transform.start_transform(\n transform_id: \"ecommerce-customer-transform\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->transform()->startTransform([\n \"transform_id\" => \"ecommerce-customer-transform\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/ecommerce-customer-transform/_start\"", + "language": "curl" + } + ], "method_request": "POST _transform/ecommerce-customer-transform/_start" } }, @@ -238259,6 +252059,28 @@ "description": "Stop transforms.\nStops one or more transforms.", "examples": { "TransformStopTransformExample1": { + "alternatives": [ + { + "code": "resp = client.transform.stop_transform(\n transform_id=\"ecommerce_transform\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.transform.stopTransform({\n transform_id: \"ecommerce_transform\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.transform.stop_transform(\n transform_id: \"ecommerce_transform\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->transform()->stopTransform([\n \"transform_id\" => \"ecommerce_transform\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/ecommerce_transform/_stop\"", + "language": "curl" + } + ], "method_request": "POST _transform/ecommerce_transform/_stop" } }, @@ -238502,6 +252324,28 @@ "description": "Update a transform.\nUpdates certain properties of a transform.\n\nAll updated properties except `description` do not take effect until after the transform starts the next checkpoint,\nthus there is data consistency in each checkpoint. To use this API, you must have `read` and `view_index_metadata`\nprivileges for the source indices. You must also have `index` and `read` privileges for the destination index. When\nElasticsearch security features are enabled, the transform remembers which roles the user who updated it had at the\ntime of update and runs with those privileges.", "examples": { "UpdateTransformRequestExample1": { + "alternatives": [ + { + "code": "resp = client.transform.update_transform(\n transform_id=\"simple-kibana-ecomm-pivot\",\n source={\n \"index\": \"kibana_sample_data_ecommerce\",\n \"query\": {\n \"term\": {\n \"geoip.continent_name\": {\n \"value\": \"Asia\"\n }\n }\n }\n },\n pivot={\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": True\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n description=\"Maximum priced ecommerce data by customer_id in Asia\",\n dest={\n \"index\": \"kibana_sample_data_ecommerce_transform1\",\n \"pipeline\": \"add_timestamp_pipeline\"\n },\n frequency=\"5m\",\n sync={\n \"time\": {\n \"field\": \"order_date\",\n \"delay\": \"60s\"\n }\n },\n retention_policy={\n \"time\": {\n \"field\": \"order_date\",\n \"max_age\": \"30d\"\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.transform.updateTransform({\n transform_id: \"simple-kibana-ecomm-pivot\",\n source: {\n index: \"kibana_sample_data_ecommerce\",\n query: {\n term: {\n \"geoip.continent_name\": {\n value: \"Asia\",\n },\n },\n },\n },\n pivot: {\n group_by: {\n customer_id: {\n terms: {\n field: \"customer_id\",\n missing_bucket: true,\n },\n },\n },\n aggregations: {\n max_price: {\n max: {\n field: \"taxful_total_price\",\n },\n },\n },\n },\n description: \"Maximum priced ecommerce data by customer_id in Asia\",\n dest: {\n index: \"kibana_sample_data_ecommerce_transform1\",\n pipeline: \"add_timestamp_pipeline\",\n },\n frequency: \"5m\",\n sync: {\n time: {\n field: \"order_date\",\n delay: \"60s\",\n },\n },\n retention_policy: {\n time: {\n field: \"order_date\",\n max_age: \"30d\",\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.transform.update_transform(\n transform_id: \"simple-kibana-ecomm-pivot\",\n body: {\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\",\n \"query\": {\n \"term\": {\n \"geoip.continent_name\": {\n \"value\": \"Asia\"\n }\n }\n }\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n \"description\": \"Maximum priced ecommerce data by customer_id in Asia\",\n \"dest\": {\n \"index\": \"kibana_sample_data_ecommerce_transform1\",\n \"pipeline\": \"add_timestamp_pipeline\"\n },\n \"frequency\": \"5m\",\n \"sync\": {\n \"time\": {\n \"field\": \"order_date\",\n \"delay\": \"60s\"\n }\n },\n \"retention_policy\": {\n \"time\": {\n \"field\": \"order_date\",\n \"max_age\": \"30d\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->transform()->updateTransform([\n \"transform_id\" => \"simple-kibana-ecomm-pivot\",\n \"body\" => [\n \"source\" => [\n \"index\" => \"kibana_sample_data_ecommerce\",\n \"query\" => [\n \"term\" => [\n \"geoip.continent_name\" => [\n \"value\" => \"Asia\",\n ],\n ],\n ],\n ],\n \"pivot\" => [\n \"group_by\" => [\n \"customer_id\" => [\n \"terms\" => [\n \"field\" => \"customer_id\",\n \"missing_bucket\" => true,\n ],\n ],\n ],\n \"aggregations\" => [\n \"max_price\" => [\n \"max\" => [\n \"field\" => \"taxful_total_price\",\n ],\n ],\n ],\n ],\n \"description\" => \"Maximum priced ecommerce data by customer_id in Asia\",\n \"dest\" => [\n \"index\" => \"kibana_sample_data_ecommerce_transform1\",\n \"pipeline\" => \"add_timestamp_pipeline\",\n ],\n \"frequency\" => \"5m\",\n \"sync\" => [\n \"time\" => [\n \"field\" => \"order_date\",\n \"delay\" => \"60s\",\n ],\n ],\n \"retention_policy\" => [\n \"time\" => [\n \"field\" => \"order_date\",\n \"max_age\" => \"30d\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":\"kibana_sample_data_ecommerce\",\"query\":{\"term\":{\"geoip.continent_name\":{\"value\":\"Asia\"}}}},\"pivot\":{\"group_by\":{\"customer_id\":{\"terms\":{\"field\":\"customer_id\",\"missing_bucket\":true}}},\"aggregations\":{\"max_price\":{\"max\":{\"field\":\"taxful_total_price\"}}}},\"description\":\"Maximum priced ecommerce data by customer_id in Asia\",\"dest\":{\"index\":\"kibana_sample_data_ecommerce_transform1\",\"pipeline\":\"add_timestamp_pipeline\"},\"frequency\":\"5m\",\"sync\":{\"time\":{\"field\":\"order_date\",\"delay\":\"60s\"}},\"retention_policy\":{\"time\":{\"field\":\"order_date\",\"max_age\":\"30d\"}}}' \"$ELASTICSEARCH_URL/_transform/simple-kibana-ecomm-pivot/_update\"", + "language": "curl" + } + ], "description": "Run `POST _transform/simple-kibana-ecomm-pivot/_update` to update a transform that uses the pivot method.", "method_request": "POST _transform/simple-kibana-ecomm-pivot/_update", "value": "{\n \"source\": {\n \"index\": \"kibana_sample_data_ecommerce\",\n \"query\": {\n \"term\": {\n \"geoip.continent_name\": {\n \"value\": \"Asia\"\n }\n }\n }\n },\n \"pivot\": {\n \"group_by\": {\n \"customer_id\": {\n \"terms\": {\n \"field\": \"customer_id\",\n \"missing_bucket\": true\n }\n }\n },\n \"aggregations\": {\n \"max_price\": {\n \"max\": {\n \"field\": \"taxful_total_price\"\n }\n }\n }\n },\n \"description\": \"Maximum priced ecommerce data by customer_id in Asia\",\n \"dest\": {\n \"index\": \"kibana_sample_data_ecommerce_transform1\",\n \"pipeline\": \"add_timestamp_pipeline\"\n },\n \"frequency\": \"5m\",\n \"sync\": {\n \"time\": {\n \"field\": \"order_date\",\n \"delay\": \"60s\"\n }\n },\n \"retention_policy\": {\n \"time\": {\n \"field\": \"order_date\",\n \"max_age\": \"30d\"\n }\n }\n}" @@ -238744,6 +252588,28 @@ "description": "Upgrade all transforms.\n\nTransforms are compatible across minor versions and between supported major versions.\nHowever, over time, the format of transform configuration information may change.\nThis API identifies transforms that have a legacy configuration format and upgrades them to the latest version.\nIt also cleans up the internal data structures that store the transform state and checkpoints.\nThe upgrade does not affect the source and destination indices.\nThe upgrade also does not affect the roles that transforms use when Elasticsearch security features are enabled; the role used to read source data and write to the destination index remains unchanged.\n\nIf a transform upgrade step fails, the upgrade stops and an error is returned about the underlying issue.\nResolve the issue then re-run the process again.\nA summary is returned when the upgrade is finished.\n\nTo ensure continuous transforms remain running during a major version upgrade of the cluster – for example, from 7.16 to 8.0 – it is recommended to upgrade transforms before upgrading the cluster.\nYou may want to perform a recent cluster backup prior to the upgrade.", "examples": { "TransformUpgradeTransformsExample1": { + "alternatives": [ + { + "code": "resp = client.transform.upgrade_transforms()", + "language": "Python" + }, + { + "code": "const response = await client.transform.upgradeTransforms();", + "language": "JavaScript" + }, + { + "code": "response = client.transform.upgrade_transforms", + "language": "Ruby" + }, + { + "code": "$resp = $client->transform()->upgradeTransforms();", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/_upgrade\"", + "language": "curl" + } + ], "method_request": "POST _transform/_upgrade" } }, @@ -243308,6 +257174,28 @@ "description": "Acknowledge a watch.\nAcknowledging a watch enables you to manually throttle the execution of the watch's actions.\n\nThe acknowledgement state of an action is stored in the `status.actions..ack.state` structure.\n\nIMPORTANT: If the specified watch is currently being executed, this API will return an error\nThe reason for this behavior is to prevent overwriting the watch status from a watch execution.\n\nAcknowledging an action throttles further executions of that action until its `ack.state` is reset to `awaits_successful_execution`.\nThis happens when the condition of the watch is not met (the condition evaluates to false).", "examples": { "WatcherAckWatchRequestExample1": { + "alternatives": [ + { + "code": "resp = client.watcher.ack_watch(\n watch_id=\"my_watch\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.watcher.ackWatch({\n watch_id: \"my_watch\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.watcher.ack_watch(\n watch_id: \"my_watch\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->watcher()->ackWatch([\n \"watch_id\" => \"my_watch\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/watch/my_watch/_ack\"", + "language": "curl" + } + ], "method_request": "POST _watcher/watch/my_watch/_ack" } }, @@ -243391,6 +257279,28 @@ "description": "Activate a watch.\nA watch can be either active or inactive.", "examples": { "WatcherActivateWatchExample1": { + "alternatives": [ + { + "code": "resp = client.watcher.activate_watch(\n watch_id=\"my_watch\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.watcher.activateWatch({\n watch_id: \"my_watch\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.watcher.activate_watch(\n watch_id: \"my_watch\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->watcher()->activateWatch([\n \"watch_id\" => \"my_watch\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/watch/my_watch/_activate\"", + "language": "curl" + } + ], "method_request": "PUT _watcher/watch/my_watch/_activate" } }, @@ -243456,6 +257366,28 @@ "description": "Deactivate a watch.\nA watch can be either active or inactive.", "examples": { "WatcherDeactivateWatchExample1": { + "alternatives": [ + { + "code": "resp = client.watcher.deactivate_watch(\n watch_id=\"my_watch\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.watcher.deactivateWatch({\n watch_id: \"my_watch\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.watcher.deactivate_watch(\n watch_id: \"my_watch\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->watcher()->deactivateWatch([\n \"watch_id\" => \"my_watch\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/watch/my_watch/_deactivate\"", + "language": "curl" + } + ], "method_request": "PUT _watcher/watch/my_watch/_deactivate" } }, @@ -243521,6 +257453,28 @@ "description": "Delete a watch.\nWhen the watch is removed, the document representing the watch in the `.watches` index is gone and it will never be run again.\n\nDeleting a watch does not delete any watch execution records related to this watch from the watch history.\n\nIMPORTANT: Deleting a watch must be done by using only this API.\nDo not delete the watch directly from the `.watches` index using the Elasticsearch delete document API\nWhen Elasticsearch security features are enabled, make sure no write privileges are granted to anyone for the `.watches` index.", "examples": { "DeleteWatchRequestExample1": { + "alternatives": [ + { + "code": "resp = client.watcher.delete_watch(\n id=\"my_watch\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.watcher.deleteWatch({\n id: \"my_watch\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.watcher.delete_watch(\n id: \"my_watch\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->watcher()->deleteWatch([\n \"id\" => \"my_watch\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/watch/my_watch\"", + "language": "curl" + } + ], "method_request": "DELETE _watcher/watch/my_watch" } }, @@ -243720,18 +257674,84 @@ "description": "Run a watch.\nThis API can be used to force execution of the watch outside of its triggering logic or to simulate the watch execution for debugging purposes.\n\nFor testing and debugging purposes, you also have fine-grained control on how the watch runs.\nYou can run the watch without running all of its actions or alternatively by simulating them.\nYou can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after it runs.\n\nYou can use the run watch API to run watches that are not yet registered by specifying the watch definition inline.\nThis serves as great tool for testing and debugging your watches prior to adding them to Watcher.\n\nWhen Elasticsearch security features are enabled on your cluster, watches are run with the privileges of the user that stored the watches.\nIf your user is allowed to read index `a`, but not index `b`, then the exact same set of rules will apply during execution of a watch.\n\nWhen using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch.", "examples": { "WatcherExecuteRequestExample1": { + "alternatives": [ + { + "code": "resp = client.watcher.execute_watch(\n id=\"my_watch\",\n trigger_data={\n \"triggered_time\": \"now\",\n \"scheduled_time\": \"now\"\n },\n alternative_input={\n \"foo\": \"bar\"\n },\n ignore_condition=True,\n action_modes={\n \"my-action\": \"force_simulate\"\n },\n record_execution=True,\n)", + "language": "Python" + }, + { + "code": "const response = await client.watcher.executeWatch({\n id: \"my_watch\",\n trigger_data: {\n triggered_time: \"now\",\n scheduled_time: \"now\",\n },\n alternative_input: {\n foo: \"bar\",\n },\n ignore_condition: true,\n action_modes: {\n \"my-action\": \"force_simulate\",\n },\n record_execution: true,\n});", + "language": "JavaScript" + }, + { + "code": "response = client.watcher.execute_watch(\n id: \"my_watch\",\n body: {\n \"trigger_data\": {\n \"triggered_time\": \"now\",\n \"scheduled_time\": \"now\"\n },\n \"alternative_input\": {\n \"foo\": \"bar\"\n },\n \"ignore_condition\": true,\n \"action_modes\": {\n \"my-action\": \"force_simulate\"\n },\n \"record_execution\": true\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->watcher()->executeWatch([\n \"id\" => \"my_watch\",\n \"body\" => [\n \"trigger_data\" => [\n \"triggered_time\" => \"now\",\n \"scheduled_time\" => \"now\",\n ],\n \"alternative_input\" => [\n \"foo\" => \"bar\",\n ],\n \"ignore_condition\" => true,\n \"action_modes\" => [\n \"my-action\" => \"force_simulate\",\n ],\n \"record_execution\" => true,\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"trigger_data\":{\"triggered_time\":\"now\",\"scheduled_time\":\"now\"},\"alternative_input\":{\"foo\":\"bar\"},\"ignore_condition\":true,\"action_modes\":{\"my-action\":\"force_simulate\"},\"record_execution\":true}' \"$ELASTICSEARCH_URL/_watcher/watch/my_watch/_execute\"", + "language": "curl" + } + ], "description": "Run `POST _watcher/watch/my_watch/_execute` to run a watch. The input defined in the watch is ignored and the `alternative_input` is used as the payload. The condition as defined by the watch is ignored and is assumed to evaluate to true. The `force_simulate` action forces the simulation of `my-action`. Forcing the simulation means that throttling is ignored and the watch is simulated by Watcher instead of being run normally.\n", "method_request": "POST _watcher/watch/my_watch/_execute", "summary": "Run a watch", "value": "{\n \"trigger_data\" : { \n \"triggered_time\" : \"now\",\n \"scheduled_time\" : \"now\"\n },\n \"alternative_input\" : { \n \"foo\" : \"bar\"\n },\n \"ignore_condition\" : true, \n \"action_modes\" : {\n \"my-action\" : \"force_simulate\" \n },\n \"record_execution\" : true \n}" }, "WatcherExecuteRequestExample2": { + "alternatives": [ + { + "code": "resp = client.watcher.execute_watch(\n id=\"my_watch\",\n action_modes={\n \"action1\": \"force_simulate\",\n \"action2\": \"skip\"\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.watcher.executeWatch({\n id: \"my_watch\",\n action_modes: {\n action1: \"force_simulate\",\n action2: \"skip\",\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.watcher.execute_watch(\n id: \"my_watch\",\n body: {\n \"action_modes\": {\n \"action1\": \"force_simulate\",\n \"action2\": \"skip\"\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->watcher()->executeWatch([\n \"id\" => \"my_watch\",\n \"body\" => [\n \"action_modes\" => [\n \"action1\" => \"force_simulate\",\n \"action2\" => \"skip\",\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"action_modes\":{\"action1\":\"force_simulate\",\"action2\":\"skip\"}}' \"$ELASTICSEARCH_URL/_watcher/watch/my_watch/_execute\"", + "language": "curl" + } + ], "description": "Run `POST _watcher/watch/my_watch/_execute` and set a different mode for each action.\n", "method_request": "POST _watcher/watch/my_watch/_execute", "summary": "Run a watch with multiple action modes", "value": "{\n \"action_modes\" : {\n \"action1\" : \"force_simulate\",\n \"action2\" : \"skip\"\n }\n}" }, "WatcherExecuteRequestExample3": { + "alternatives": [ + { + "code": "resp = client.watcher.execute_watch(\n watch={\n \"trigger\": {\n \"schedule\": {\n \"interval\": \"10s\"\n }\n },\n \"input\": {\n \"search\": {\n \"request\": {\n \"indices\": [\n \"logs\"\n ],\n \"body\": {\n \"query\": {\n \"match\": {\n \"message\": \"error\"\n }\n }\n }\n }\n }\n },\n \"condition\": {\n \"compare\": {\n \"ctx.payload.hits.total\": {\n \"gt\": 0\n }\n }\n },\n \"actions\": {\n \"log_error\": {\n \"logging\": {\n \"text\": \"Found {{ctx.payload.hits.total}} errors in the logs\"\n }\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.watcher.executeWatch({\n watch: {\n trigger: {\n schedule: {\n interval: \"10s\",\n },\n },\n input: {\n search: {\n request: {\n indices: [\"logs\"],\n body: {\n query: {\n match: {\n message: \"error\",\n },\n },\n },\n },\n },\n },\n condition: {\n compare: {\n \"ctx.payload.hits.total\": {\n gt: 0,\n },\n },\n },\n actions: {\n log_error: {\n logging: {\n text: \"Found {{ctx.payload.hits.total}} errors in the logs\",\n },\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.watcher.execute_watch(\n body: {\n \"watch\": {\n \"trigger\": {\n \"schedule\": {\n \"interval\": \"10s\"\n }\n },\n \"input\": {\n \"search\": {\n \"request\": {\n \"indices\": [\n \"logs\"\n ],\n \"body\": {\n \"query\": {\n \"match\": {\n \"message\": \"error\"\n }\n }\n }\n }\n }\n },\n \"condition\": {\n \"compare\": {\n \"ctx.payload.hits.total\": {\n \"gt\": 0\n }\n }\n },\n \"actions\": {\n \"log_error\": {\n \"logging\": {\n \"text\": \"Found {{ctx.payload.hits.total}} errors in the logs\"\n }\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->watcher()->executeWatch([\n \"body\" => [\n \"watch\" => [\n \"trigger\" => [\n \"schedule\" => [\n \"interval\" => \"10s\",\n ],\n ],\n \"input\" => [\n \"search\" => [\n \"request\" => [\n \"indices\" => array(\n \"logs\",\n ),\n \"body\" => [\n \"query\" => [\n \"match\" => [\n \"message\" => \"error\",\n ],\n ],\n ],\n ],\n ],\n ],\n \"condition\" => [\n \"compare\" => [\n \"ctx.payload.hits.total\" => [\n \"gt\" => 0,\n ],\n ],\n ],\n \"actions\" => [\n \"log_error\" => [\n \"logging\" => [\n \"text\" => \"Found {{ctx.payload.hits.total}} errors in the logs\",\n ],\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"watch\":{\"trigger\":{\"schedule\":{\"interval\":\"10s\"}},\"input\":{\"search\":{\"request\":{\"indices\":[\"logs\"],\"body\":{\"query\":{\"match\":{\"message\":\"error\"}}}}}},\"condition\":{\"compare\":{\"ctx.payload.hits.total\":{\"gt\":0}}},\"actions\":{\"log_error\":{\"logging\":{\"text\":\"Found {{ctx.payload.hits.total}} errors in the logs\"}}}}}' \"$ELASTICSEARCH_URL/_watcher/watch/_execute\"", + "language": "curl" + } + ], "description": "Run `POST _watcher/watch/_execute` to run a watch inline. All other settings for this API still apply when inlining a watch. In this example, while the inline watch defines a compare condition, during the execution this condition will be ignored.\n", "method_request": "POST _watcher/watch/_execute", "summary": "Run a watch inline", @@ -243967,6 +257987,28 @@ "description": "Get Watcher index settings.\nGet settings for the Watcher internal index (`.watches`).\nOnly a subset of settings are shown, for example `index.auto_expand_replicas` and `index.number_of_replicas`.", "examples": { "WatcherGetSettingsExample1": { + "alternatives": [ + { + "code": "resp = client.watcher.get_settings()", + "language": "Python" + }, + { + "code": "const response = await client.watcher.getSettings();", + "language": "JavaScript" + }, + { + "code": "response = client.watcher.get_settings", + "language": "Ruby" + }, + { + "code": "$resp = $client->watcher()->getSettings();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/settings\"", + "language": "curl" + } + ], "method_request": "GET /_watcher/settings" } }, @@ -244038,6 +258080,28 @@ "description": "Get a watch.", "examples": { "GetWatchRequestExample1": { + "alternatives": [ + { + "code": "resp = client.watcher.get_watch(\n id=\"my_watch\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.watcher.getWatch({\n id: \"my_watch\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.watcher.get_watch(\n id: \"my_watch\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->watcher()->getWatch([\n \"id\" => \"my_watch\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/watch/my_watch\"", + "language": "curl" + } + ], "method_request": "GET _watcher/watch/my_watch" } }, @@ -244293,6 +258357,28 @@ "description": "Create or update a watch.\nWhen a watch is registered, a new document that represents the watch is added to the `.watches` index and its trigger is immediately registered with the relevant trigger engine.\nTypically for the `schedule` trigger, the scheduler is the trigger engine.\n\nIMPORTANT: You must use Kibana or this API to create a watch.\nDo not add a watch directly to the `.watches` index by using the Elasticsearch index API.\nIf Elasticsearch security features are enabled, do not give users write privileges on the `.watches` index.\n\nWhen you add a watch you can also define its initial active state by setting the *active* parameter.\n\nWhen Elasticsearch security features are enabled, your watch can index or search only on indices for which the user that stored the watch has privileges.\nIf the user is able to read index `a`, but not index `b`, the same will apply when the watch runs.", "examples": { "WatcherPutWatchRequestExample1": { + "alternatives": [ + { + "code": "resp = client.watcher.put_watch(\n id=\"my-watch\",\n trigger={\n \"schedule\": {\n \"cron\": \"0 0/1 * * * ?\"\n }\n },\n input={\n \"search\": {\n \"request\": {\n \"indices\": [\n \"logstash*\"\n ],\n \"body\": {\n \"query\": {\n \"bool\": {\n \"must\": {\n \"match\": {\n \"response\": 404\n }\n },\n \"filter\": {\n \"range\": {\n \"@timestamp\": {\n \"from\": \"{{ctx.trigger.scheduled_time}}||-5m\",\n \"to\": \"{{ctx.trigger.triggered_time}}\"\n }\n }\n }\n }\n }\n }\n }\n }\n },\n condition={\n \"compare\": {\n \"ctx.payload.hits.total\": {\n \"gt\": 0\n }\n }\n },\n actions={\n \"email_admin\": {\n \"email\": {\n \"to\": \"admin@domain.host.com\",\n \"subject\": \"404 recently encountered\"\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.watcher.putWatch({\n id: \"my-watch\",\n trigger: {\n schedule: {\n cron: \"0 0/1 * * * ?\",\n },\n },\n input: {\n search: {\n request: {\n indices: [\"logstash*\"],\n body: {\n query: {\n bool: {\n must: {\n match: {\n response: 404,\n },\n },\n filter: {\n range: {\n \"@timestamp\": {\n from: \"{{ctx.trigger.scheduled_time}}||-5m\",\n to: \"{{ctx.trigger.triggered_time}}\",\n },\n },\n },\n },\n },\n },\n },\n },\n },\n condition: {\n compare: {\n \"ctx.payload.hits.total\": {\n gt: 0,\n },\n },\n },\n actions: {\n email_admin: {\n email: {\n to: \"admin@domain.host.com\",\n subject: \"404 recently encountered\",\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.watcher.put_watch(\n id: \"my-watch\",\n body: {\n \"trigger\": {\n \"schedule\": {\n \"cron\": \"0 0/1 * * * ?\"\n }\n },\n \"input\": {\n \"search\": {\n \"request\": {\n \"indices\": [\n \"logstash*\"\n ],\n \"body\": {\n \"query\": {\n \"bool\": {\n \"must\": {\n \"match\": {\n \"response\": 404\n }\n },\n \"filter\": {\n \"range\": {\n \"@timestamp\": {\n \"from\": \"{{ctx.trigger.scheduled_time}}||-5m\",\n \"to\": \"{{ctx.trigger.triggered_time}}\"\n }\n }\n }\n }\n }\n }\n }\n }\n },\n \"condition\": {\n \"compare\": {\n \"ctx.payload.hits.total\": {\n \"gt\": 0\n }\n }\n },\n \"actions\": {\n \"email_admin\": {\n \"email\": {\n \"to\": \"admin@domain.host.com\",\n \"subject\": \"404 recently encountered\"\n }\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->watcher()->putWatch([\n \"id\" => \"my-watch\",\n \"body\" => [\n \"trigger\" => [\n \"schedule\" => [\n \"cron\" => \"0 0/1 * * * ?\",\n ],\n ],\n \"input\" => [\n \"search\" => [\n \"request\" => [\n \"indices\" => array(\n \"logstash*\",\n ),\n \"body\" => [\n \"query\" => [\n \"bool\" => [\n \"must\" => [\n \"match\" => [\n \"response\" => 404,\n ],\n ],\n \"filter\" => [\n \"range\" => [\n \"@timestamp\" => [\n \"from\" => \"{{ctx.trigger.scheduled_time}}||-5m\",\n \"to\" => \"{{ctx.trigger.triggered_time}}\",\n ],\n ],\n ],\n ],\n ],\n ],\n ],\n ],\n ],\n \"condition\" => [\n \"compare\" => [\n \"ctx.payload.hits.total\" => [\n \"gt\" => 0,\n ],\n ],\n ],\n \"actions\" => [\n \"email_admin\" => [\n \"email\" => [\n \"to\" => \"admin@domain.host.com\",\n \"subject\" => \"404 recently encountered\",\n ],\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"trigger\":{\"schedule\":{\"cron\":\"0 0/1 * * * ?\"}},\"input\":{\"search\":{\"request\":{\"indices\":[\"logstash*\"],\"body\":{\"query\":{\"bool\":{\"must\":{\"match\":{\"response\":404}},\"filter\":{\"range\":{\"@timestamp\":{\"from\":\"{{ctx.trigger.scheduled_time}}||-5m\",\"to\":\"{{ctx.trigger.triggered_time}}\"}}}}}}}}},\"condition\":{\"compare\":{\"ctx.payload.hits.total\":{\"gt\":0}}},\"actions\":{\"email_admin\":{\"email\":{\"to\":\"admin@domain.host.com\",\"subject\":\"404 recently encountered\"}}}}' \"$ELASTICSEARCH_URL/_watcher/watch/my-watch\"", + "language": "curl" + } + ], "description": "Run `PUT _watcher/watch/my-watch` add a watch. The watch schedule triggers every minute. The watch search input looks for any 404 HTTP responses that occurred in the last five minutes. The watch condition checks if any search hits where found. When found, the watch action sends an email to an administrator.\n", "method_request": "PUT _watcher/watch/my-watch", "value": "{\n \"trigger\" : {\n \"schedule\" : { \"cron\" : \"0 0/1 * * * ?\" }\n },\n \"input\" : {\n \"search\" : {\n \"request\" : {\n \"indices\" : [\n \"logstash*\"\n ],\n \"body\" : {\n \"query\" : {\n \"bool\" : {\n \"must\" : {\n \"match\": {\n \"response\": 404\n }\n },\n \"filter\" : {\n \"range\": {\n \"@timestamp\": {\n \"from\": \"{{ctx.trigger.scheduled_time}}||-5m\",\n \"to\": \"{{ctx.trigger.triggered_time}}\"\n }\n }\n }\n }\n }\n }\n }\n }\n },\n \"condition\" : {\n \"compare\" : { \"ctx.payload.hits.total\" : { \"gt\" : 0 }}\n },\n \"actions\" : {\n \"email_admin\" : {\n \"email\" : {\n \"to\" : \"admin@domain.host.com\",\n \"subject\" : \"404 recently encountered\"\n }\n }\n }\n}" @@ -244522,6 +258608,28 @@ "description": "Query watches.\nGet all registered watches in a paginated manner and optionally filter watches by a query.\n\nNote that only the `_id` and `metadata.*` fields are queryable or sortable.", "examples": { "WatcherQueryWatchesRequestExample1": { + "alternatives": [ + { + "code": "resp = client.watcher.query_watches()", + "language": "Python" + }, + { + "code": "const response = await client.watcher.queryWatches();", + "language": "JavaScript" + }, + { + "code": "response = client.watcher.query_watches", + "language": "Ruby" + }, + { + "code": "$resp = $client->watcher()->queryWatches();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/_query/watches\"", + "language": "curl" + } + ], "method_request": "GET /_watcher/_query/watches" } }, @@ -244596,6 +258704,28 @@ "description": "Start the watch service.\nStart the Watcher service if it is not already running.", "examples": { "WatcherStartRequestExample1": { + "alternatives": [ + { + "code": "resp = client.watcher.start()", + "language": "Python" + }, + { + "code": "const response = await client.watcher.start();", + "language": "JavaScript" + }, + { + "code": "response = client.watcher.start", + "language": "Ruby" + }, + { + "code": "$resp = $client->watcher()->start();", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/_start\"", + "language": "curl" + } + ], "method_request": "POST _watcher/_start" } }, @@ -244663,6 +258793,28 @@ "description": "Get Watcher statistics.\nThis API always returns basic metrics.\nYou retrieve more metrics by using the metric parameter.", "examples": { "WatcherStatsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.watcher.stats()", + "language": "Python" + }, + { + "code": "const response = await client.watcher.stats();", + "language": "JavaScript" + }, + { + "code": "response = client.watcher.stats", + "language": "Ruby" + }, + { + "code": "$resp = $client->watcher()->stats();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/stats\"", + "language": "curl" + } + ], "method_request": "GET _watcher/stats" } }, @@ -245070,6 +259222,28 @@ "description": "Stop the watch service.\nStop the Watcher service if it is running.", "examples": { "WatcherStopRequestExample1": { + "alternatives": [ + { + "code": "resp = client.watcher.stop()", + "language": "Python" + }, + { + "code": "const response = await client.watcher.stop();", + "language": "JavaScript" + }, + { + "code": "response = client.watcher.stop", + "language": "Ruby" + }, + { + "code": "$resp = $client->watcher()->stop();", + "language": "PHP" + }, + { + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/_stop\"", + "language": "curl" + } + ], "method_request": "POST _watcher/_stop" } }, @@ -245161,6 +259335,28 @@ "description": "Update Watcher index settings.\nUpdate settings for the Watcher internal index (`.watches`).\nOnly a subset of settings can be modified.\nThis includes `index.auto_expand_replicas`, `index.number_of_replicas`, `index.routing.allocation.exclude.*`,\n`index.routing.allocation.include.*` and `index.routing.allocation.require.*`.\nModification of `index.routing.allocation.include._tier_preference` is an exception and is not allowed as the\nWatcher shards must always be in the `data_content` tier.", "examples": { "WatcherUpdateSettingsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.watcher.update_settings(\n index.auto_expand_replicas=\"0-4\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.watcher.updateSettings({\n \"index.auto_expand_replicas\": \"0-4\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.watcher.update_settings(\n body: {\n \"index.auto_expand_replicas\": \"0-4\"\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->watcher()->updateSettings([\n \"body\" => [\n \"index.auto_expand_replicas\" => \"0-4\",\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index.auto_expand_replicas\":\"0-4\"}' \"$ELASTICSEARCH_URL/_watcher/settings\"", + "language": "curl" + } + ], "method_request": "PUT /_watcher/settings", "value": "{\n \"index.auto_expand_replicas\": \"0-4\"\n}" } @@ -245758,6 +259954,28 @@ "description": "Get information.\nThe information provided by the API includes:\n\n* Build information including the build number and timestamp.\n* License information about the currently installed license.\n* Feature information for the features that are currently enabled and available under the current license.", "examples": { "XPackInfoRequestExample1": { + "alternatives": [ + { + "code": "resp = client.xpack.info()", + "language": "Python" + }, + { + "code": "const response = await client.xpack.info();", + "language": "JavaScript" + }, + { + "code": "response = client.xpack.info", + "language": "Ruby" + }, + { + "code": "$resp = $client->xpack()->info();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_xpack\"", + "language": "curl" + } + ], "method_request": "GET /_xpack" } }, @@ -248153,6 +262371,28 @@ "description": "Get usage information.\nGet information about the features that are currently enabled and available under the current license.\nThe API also provides some usage statistics.", "examples": { "XPackUsageRequestExample1": { + "alternatives": [ + { + "code": "resp = client.xpack.usage()", + "language": "Python" + }, + { + "code": "const response = await client.xpack.usage();", + "language": "JavaScript" + }, + { + "code": "response = client.xpack.usage", + "language": "Ruby" + }, + { + "code": "$resp = $client->xpack()->usage();", + "language": "PHP" + }, + { + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_xpack/usage\"", + "language": "curl" + } + ], "method_request": "GET /_xpack/usage" } }, diff --git a/specification/_global/bulk/examples/request/BulkRequestExample1.yaml b/specification/_global/bulk/examples/request/BulkRequestExample1.yaml index 9e7b8d46f4..47da76d1f9 100644 --- a/specification/_global/bulk/examples/request/BulkRequestExample1.yaml +++ b/specification/_global/bulk/examples/request/BulkRequestExample1.yaml @@ -15,3 +15,174 @@ value: '{ "index" : { "_index" : "test", "_id" : "1" } } { "update" : {"_id" : "1", "_index" : "test"} } { "doc" : {"field2" : "value2"} }' +alternatives: + - language: Python + code: |- + resp = client.bulk( + operations=[ + { + "index": { + "_index": "test", + "_id": "1" + } + }, + { + "field1": "value1" + }, + { + "delete": { + "_index": "test", + "_id": "2" + } + }, + { + "create": { + "_index": "test", + "_id": "3" + } + }, + { + "field1": "value3" + }, + { + "update": { + "_id": "1", + "_index": "test" + } + }, + { + "doc": { + "field2": "value2" + } + } + ], + ) + - language: JavaScript + code: |- + const response = await client.bulk({ + operations: [ + { + index: { + _index: "test", + _id: "1", + }, + }, + { + field1: "value1", + }, + { + delete: { + _index: "test", + _id: "2", + }, + }, + { + create: { + _index: "test", + _id: "3", + }, + }, + { + field1: "value3", + }, + { + update: { + _id: "1", + _index: "test", + }, + }, + { + doc: { + field2: "value2", + }, + }, + ], + }); + - language: Ruby + code: |- + response = client.bulk( + body: [ + { + "index": { + "_index": "test", + "_id": "1" + } + }, + { + "field1": "value1" + }, + { + "delete": { + "_index": "test", + "_id": "2" + } + }, + { + "create": { + "_index": "test", + "_id": "3" + } + }, + { + "field1": "value3" + }, + { + "update": { + "_id": "1", + "_index": "test" + } + }, + { + "doc": { + "field2": "value2" + } + } + ] + ) + - language: PHP + code: |- + $resp = $client->bulk([ + "body" => array( + [ + "index" => [ + "_index" => "test", + "_id" => "1", + ], + ], + [ + "field1" => "value1", + ], + [ + "delete" => [ + "_index" => "test", + "_id" => "2", + ], + ], + [ + "create" => [ + "_index" => "test", + "_id" => "3", + ], + ], + [ + "field1" => "value3", + ], + [ + "update" => [ + "_id" => "1", + "_index" => "test", + ], + ], + [ + "doc" => [ + "field2" => "value2", + ], + ], + ), + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '[{\"index\":{\"_index\":\"test\",\"_id\":\"1\"}},{\"field1\":\"value1\"},{\"delete\":{\"_index\":\"test\",\"_id\":\"2\"}},{\ + \"create\":{\"_index\":\"test\",\"_id\":\"3\"}},{\"field1\":\"value3\"},{\"update\":{\"_id\":\"1\",\"_index\":\"test\"}},{\"d\ + oc\":{\"field2\":\"value2\"}}]' \"$ELASTICSEARCH_URL/_bulk\"" diff --git a/specification/_global/bulk/examples/request/BulkRequestExample2.yaml b/specification/_global/bulk/examples/request/BulkRequestExample2.yaml index 201d194b39..804a7660ce 100644 --- a/specification/_global/bulk/examples/request/BulkRequestExample2.yaml +++ b/specification/_global/bulk/examples/request/BulkRequestExample2.yaml @@ -1,7 +1,8 @@ summary: Bulk updates method_request: POST _bulk description: > - When you run `POST _bulk` and use the `update` action, you can use `retry_on_conflict` as a field in the action itself (not in the extra payload line) to specify how many times an update should be retried in the case of a version conflict. + When you run `POST _bulk` and use the `update` action, you can use `retry_on_conflict` as a field in the action itself (not in the + extra payload line) to specify how many times an update should be retried in the case of a version conflict. # type: request value: '{ "update" : {"_id" : "1", "_index" : "index1", "retry_on_conflict" : 3} } @@ -10,8 +11,8 @@ value: { "update" : { "_id" : "0", "_index" : "index1", "retry_on_conflict" : 3} } - { "script" : { "source": "ctx._source.counter += params.param1", "lang" : "painless", - "params" : {"param1" : 1}}, "upsert" : {"counter" : 1}} + { "script" : { "source": "ctx._source.counter += params.param1", "lang" : "painless", "params" : {"param1" : 1}}, "upsert" : + {"counter" : 1}} { "update" : {"_id" : "2", "_index" : "index1", "retry_on_conflict" : 3} } @@ -24,3 +25,309 @@ value: { "update" : {"_id" : "4", "_index" : "index1"} } { "doc" : {"field" : "value"}, "_source": true}' +alternatives: + - language: Python + code: |- + resp = client.bulk( + operations=[ + { + "update": { + "_id": "1", + "_index": "index1", + "retry_on_conflict": 3 + } + }, + { + "doc": { + "field": "value" + } + }, + { + "update": { + "_id": "0", + "_index": "index1", + "retry_on_conflict": 3 + } + }, + { + "script": { + "source": "ctx._source.counter += params.param1", + "lang": "painless", + "params": { + "param1": 1 + } + }, + "upsert": { + "counter": 1 + } + }, + { + "update": { + "_id": "2", + "_index": "index1", + "retry_on_conflict": 3 + } + }, + { + "doc": { + "field": "value" + }, + "doc_as_upsert": True + }, + { + "update": { + "_id": "3", + "_index": "index1", + "_source": True + } + }, + { + "doc": { + "field": "value" + } + }, + { + "update": { + "_id": "4", + "_index": "index1" + } + }, + { + "doc": { + "field": "value" + }, + "_source": True + } + ], + ) + - language: JavaScript + code: |- + const response = await client.bulk({ + operations: [ + { + update: { + _id: "1", + _index: "index1", + retry_on_conflict: 3, + }, + }, + { + doc: { + field: "value", + }, + }, + { + update: { + _id: "0", + _index: "index1", + retry_on_conflict: 3, + }, + }, + { + script: { + source: "ctx._source.counter += params.param1", + lang: "painless", + params: { + param1: 1, + }, + }, + upsert: { + counter: 1, + }, + }, + { + update: { + _id: "2", + _index: "index1", + retry_on_conflict: 3, + }, + }, + { + doc: { + field: "value", + }, + doc_as_upsert: true, + }, + { + update: { + _id: "3", + _index: "index1", + _source: true, + }, + }, + { + doc: { + field: "value", + }, + }, + { + update: { + _id: "4", + _index: "index1", + }, + }, + { + doc: { + field: "value", + }, + _source: true, + }, + ], + }); + - language: Ruby + code: |- + response = client.bulk( + body: [ + { + "update": { + "_id": "1", + "_index": "index1", + "retry_on_conflict": 3 + } + }, + { + "doc": { + "field": "value" + } + }, + { + "update": { + "_id": "0", + "_index": "index1", + "retry_on_conflict": 3 + } + }, + { + "script": { + "source": "ctx._source.counter += params.param1", + "lang": "painless", + "params": { + "param1": 1 + } + }, + "upsert": { + "counter": 1 + } + }, + { + "update": { + "_id": "2", + "_index": "index1", + "retry_on_conflict": 3 + } + }, + { + "doc": { + "field": "value" + }, + "doc_as_upsert": true + }, + { + "update": { + "_id": "3", + "_index": "index1", + "_source": true + } + }, + { + "doc": { + "field": "value" + } + }, + { + "update": { + "_id": "4", + "_index": "index1" + } + }, + { + "doc": { + "field": "value" + }, + "_source": true + } + ] + ) + - language: PHP + code: |- + $resp = $client->bulk([ + "body" => array( + [ + "update" => [ + "_id" => "1", + "_index" => "index1", + "retry_on_conflict" => 3, + ], + ], + [ + "doc" => [ + "field" => "value", + ], + ], + [ + "update" => [ + "_id" => "0", + "_index" => "index1", + "retry_on_conflict" => 3, + ], + ], + [ + "script" => [ + "source" => "ctx._source.counter += params.param1", + "lang" => "painless", + "params" => [ + "param1" => 1, + ], + ], + "upsert" => [ + "counter" => 1, + ], + ], + [ + "update" => [ + "_id" => "2", + "_index" => "index1", + "retry_on_conflict" => 3, + ], + ], + [ + "doc" => [ + "field" => "value", + ], + "doc_as_upsert" => true, + ], + [ + "update" => [ + "_id" => "3", + "_index" => "index1", + "_source" => true, + ], + ], + [ + "doc" => [ + "field" => "value", + ], + ], + [ + "update" => [ + "_id" => "4", + "_index" => "index1", + ], + ], + [ + "doc" => [ + "field" => "value", + ], + "_source" => true, + ], + ), + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '[{\"update\":{\"_id\":\"1\",\"_index\":\"index1\",\"retry_on_conflict\":3}},{\"doc\":{\"field\":\"value\"}},{\"update\":{\"_\ + id\":\"0\",\"_index\":\"index1\",\"retry_on_conflict\":3}},{\"script\":{\"source\":\"ctx._source.counter += + params.param1\",\"lang\":\"painless\",\"params\":{\"param1\":1}},\"upsert\":{\"counter\":1}},{\"update\":{\"_id\":\"2\",\"_in\ + dex\":\"index1\",\"retry_on_conflict\":3}},{\"doc\":{\"field\":\"value\"},\"doc_as_upsert\":true},{\"update\":{\"_id\":\"3\",\ + \"_index\":\"index1\",\"_source\":true}},{\"doc\":{\"field\":\"value\"}},{\"update\":{\"_id\":\"4\",\"_index\":\"index1\"}},{\ + \"doc\":{\"field\":\"value\"},\"_source\":true}]' \"$ELASTICSEARCH_URL/_bulk\"" diff --git a/specification/_global/bulk/examples/request/BulkRequestExample3.yaml b/specification/_global/bulk/examples/request/BulkRequestExample3.yaml index bd9961f252..f8bbcb0027 100644 --- a/specification/_global/bulk/examples/request/BulkRequestExample3.yaml +++ b/specification/_global/bulk/examples/request/BulkRequestExample3.yaml @@ -14,3 +14,158 @@ value: '{ "update": {"_id": "5", "_index": "index1"} } { "create": {"_id": "7", "_index": "index1"} } { "my_field": "foo" }' +alternatives: + - language: Python + code: |- + resp = client.bulk( + operations=[ + { + "update": { + "_id": "5", + "_index": "index1" + } + }, + { + "doc": { + "my_field": "foo" + } + }, + { + "update": { + "_id": "6", + "_index": "index1" + } + }, + { + "doc": { + "my_field": "foo" + } + }, + { + "create": { + "_id": "7", + "_index": "index1" + } + }, + { + "my_field": "foo" + } + ], + ) + - language: JavaScript + code: |- + const response = await client.bulk({ + operations: [ + { + update: { + _id: "5", + _index: "index1", + }, + }, + { + doc: { + my_field: "foo", + }, + }, + { + update: { + _id: "6", + _index: "index1", + }, + }, + { + doc: { + my_field: "foo", + }, + }, + { + create: { + _id: "7", + _index: "index1", + }, + }, + { + my_field: "foo", + }, + ], + }); + - language: Ruby + code: |- + response = client.bulk( + body: [ + { + "update": { + "_id": "5", + "_index": "index1" + } + }, + { + "doc": { + "my_field": "foo" + } + }, + { + "update": { + "_id": "6", + "_index": "index1" + } + }, + { + "doc": { + "my_field": "foo" + } + }, + { + "create": { + "_id": "7", + "_index": "index1" + } + }, + { + "my_field": "foo" + } + ] + ) + - language: PHP + code: |- + $resp = $client->bulk([ + "body" => array( + [ + "update" => [ + "_id" => "5", + "_index" => "index1", + ], + ], + [ + "doc" => [ + "my_field" => "foo", + ], + ], + [ + "update" => [ + "_id" => "6", + "_index" => "index1", + ], + ], + [ + "doc" => [ + "my_field" => "foo", + ], + ], + [ + "create" => [ + "_id" => "7", + "_index" => "index1", + ], + ], + [ + "my_field" => "foo", + ], + ), + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '[{\"update\":{\"_id\":\"5\",\"_index\":\"index1\"}},{\"doc\":{\"my_field\":\"foo\"}},{\"update\":{\"_id\":\"6\",\"_index\":\ + \"index1\"}},{\"doc\":{\"my_field\":\"foo\"}},{\"create\":{\"_id\":\"7\",\"_index\":\"index1\"}},{\"my_field\":\"foo\"}]' + \"$ELASTICSEARCH_URL/_bulk\"" diff --git a/specification/_global/bulk/examples/request/BulkRequestExample4.yaml b/specification/_global/bulk/examples/request/BulkRequestExample4.yaml index 32bc99d57a..c48b2791ab 100644 --- a/specification/_global/bulk/examples/request/BulkRequestExample4.yaml +++ b/specification/_global/bulk/examples/request/BulkRequestExample4.yaml @@ -1,13 +1,156 @@ summary: Dynamic templates method_request: POST /_bulk description: > - Run `POST /_bulk` to perform a bulk request that consists of index and create actions with the `dynamic_templates` parameter. - The bulk request creates two new fields `work_location` and `home_location` with type `geo_point` according to the `dynamic_templates` parameter. - However, the `raw_location` field is created using default dynamic mapping rules, as a text field in that case since it is supplied as a string in the JSON document. + Run `POST /_bulk` to perform a bulk request that consists of index and create actions with the `dynamic_templates` parameter. The + bulk request creates two new fields `work_location` and `home_location` with type `geo_point` according to the `dynamic_templates` + parameter. However, the `raw_location` field is created using default dynamic mapping rules, as a text field in that case since it + is supplied as a string in the JSON document. # type: request -value: "{ \"index\" : {\ - \ \"_index\" : \"my_index\", \"_id\" : \"1\", \"dynamic_templates\": {\"work_location\"\ - : \"geo_point\"}} }\n{ \"field\" : \"value1\", \"work_location\": \"41.12,-71.34\"\ - , \"raw_location\": \"41.12,-71.34\"}\n{ \"create\" : { \"_index\" : \"my_index\"\ - , \"_id\" : \"2\", \"dynamic_templates\": {\"home_location\": \"geo_point\"}} }\n\ - { \"field\" : \"value2\", \"home_location\": \"41.12,-71.34\"}" +value: + '{ "index" : { "_index" : "my_index", "_id" : "1", "dynamic_templates": {"work_location": "geo_point"}} } + + { "field" : "value1", "work_location": "41.12,-71.34", "raw_location": "41.12,-71.34"} + + { "create" : { "_index" : "my_index", "_id" : "2", "dynamic_templates": {"home_location": "geo_point"}} } + + { "field" : "value2", "home_location": "41.12,-71.34"}' +alternatives: + - language: Python + code: |- + resp = client.bulk( + operations=[ + { + "index": { + "_index": "my_index", + "_id": "1", + "dynamic_templates": { + "work_location": "geo_point" + } + } + }, + { + "field": "value1", + "work_location": "41.12,-71.34", + "raw_location": "41.12,-71.34" + }, + { + "create": { + "_index": "my_index", + "_id": "2", + "dynamic_templates": { + "home_location": "geo_point" + } + } + }, + { + "field": "value2", + "home_location": "41.12,-71.34" + } + ], + ) + - language: JavaScript + code: |- + const response = await client.bulk({ + operations: [ + { + index: { + _index: "my_index", + _id: "1", + dynamic_templates: { + work_location: "geo_point", + }, + }, + }, + { + field: "value1", + work_location: "41.12,-71.34", + raw_location: "41.12,-71.34", + }, + { + create: { + _index: "my_index", + _id: "2", + dynamic_templates: { + home_location: "geo_point", + }, + }, + }, + { + field: "value2", + home_location: "41.12,-71.34", + }, + ], + }); + - language: Ruby + code: |- + response = client.bulk( + body: [ + { + "index": { + "_index": "my_index", + "_id": "1", + "dynamic_templates": { + "work_location": "geo_point" + } + } + }, + { + "field": "value1", + "work_location": "41.12,-71.34", + "raw_location": "41.12,-71.34" + }, + { + "create": { + "_index": "my_index", + "_id": "2", + "dynamic_templates": { + "home_location": "geo_point" + } + } + }, + { + "field": "value2", + "home_location": "41.12,-71.34" + } + ] + ) + - language: PHP + code: |- + $resp = $client->bulk([ + "body" => array( + [ + "index" => [ + "_index" => "my_index", + "_id" => "1", + "dynamic_templates" => [ + "work_location" => "geo_point", + ], + ], + ], + [ + "field" => "value1", + "work_location" => "41.12,-71.34", + "raw_location" => "41.12,-71.34", + ], + [ + "create" => [ + "_index" => "my_index", + "_id" => "2", + "dynamic_templates" => [ + "home_location" => "geo_point", + ], + ], + ], + [ + "field" => "value2", + "home_location" => "41.12,-71.34", + ], + ), + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '[{\"index\":{\"_index\":\"my_index\",\"_id\":\"1\",\"dynamic_templates\":{\"work_location\":\"geo_point\"}}},{\"field\":\"va\ + lue1\",\"work_location\":\"41.12,-71.34\",\"raw_location\":\"41.12,-71.34\"},{\"create\":{\"_index\":\"my_index\",\"_id\":\"2\ + \",\"dynamic_templates\":{\"home_location\":\"geo_point\"}}},{\"field\":\"value2\",\"home_location\":\"41.12,-71.34\"}]' + \"$ELASTICSEARCH_URL/_bulk\"" diff --git a/specification/_global/clear_scroll/examples/request/ClearScrollRequestExample1.yaml b/specification/_global/clear_scroll/examples/request/ClearScrollRequestExample1.yaml index 7991e9565d..3a0185aaab 100644 --- a/specification/_global/clear_scroll/examples/request/ClearScrollRequestExample1.yaml +++ b/specification/_global/clear_scroll/examples/request/ClearScrollRequestExample1.yaml @@ -6,3 +6,32 @@ value: |- { "scroll_id": "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==" } +alternatives: + - language: Python + code: |- + resp = client.clear_scroll( + scroll_id="DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==", + ) + - language: JavaScript + code: |- + const response = await client.clearScroll({ + scroll_id: "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==", + }); + - language: Ruby + code: |- + response = client.clear_scroll( + body: { + "scroll_id": "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==" + } + ) + - language: PHP + code: |- + $resp = $client->clearScroll([ + "body" => [ + "scroll_id" => "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==", + ], + ]); + - language: curl + code: + 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"scroll_id":"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ=="}'' "$ELASTICSEARCH_URL/_search/scroll"' diff --git a/specification/_global/close_point_in_time/examples/request/ClosePointInTimeRequestExample1.yaml b/specification/_global/close_point_in_time/examples/request/ClosePointInTimeRequestExample1.yaml index 0ecd43ce36..069fb85b2d 100644 --- a/specification/_global/close_point_in_time/examples/request/ClosePointInTimeRequestExample1.yaml +++ b/specification/_global/close_point_in_time/examples/request/ClosePointInTimeRequestExample1.yaml @@ -6,3 +6,33 @@ value: |- { "id": "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==" } +alternatives: + - language: Python + code: >- + resp = client.close_point_in_time( + id="46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==", + ) + - language: JavaScript + code: >- + const response = await client.closePointInTime({ + id: "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==", + }); + - language: Ruby + code: >- + response = client.close_point_in_time( + body: { + "id": "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==" + } + ) + - language: PHP + code: >- + $resp = $client->closePointInTime([ + "body" => [ + "id" => "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==", + ], + ]); + - language: curl + code: + "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"id\":\"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAA\ + AAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\"}' \"$ELASTICSEARCH_URL/_pit\"" diff --git a/specification/_global/count/examples/request/CountRequestExample1.yaml b/specification/_global/count/examples/request/CountRequestExample1.yaml index 9b984404b0..c8465931be 100644 --- a/specification/_global/count/examples/request/CountRequestExample1.yaml +++ b/specification/_global/count/examples/request/CountRequestExample1.yaml @@ -1,9 +1,8 @@ # summary: method_request: GET /my-index-000001/_count description: > - Run `GET /my-index-000001/_count?q=user:kimchy`. - Alternatively, run `GET /my-index-000001/_count` with the same query in the request body. - Both requests count the number of documents in `my-index-000001` with a `user.id` of `kimchy`. + Run `GET /my-index-000001/_count?q=user:kimchy`. Alternatively, run `GET /my-index-000001/_count` with the same query in the + request body. Both requests count the number of documents in `my-index-000001` with a `user.id` of `kimchy`. # type: request value: |- { @@ -11,3 +10,52 @@ value: |- "term" : { "user.id" : "kimchy" } } } +alternatives: + - language: Python + code: |- + resp = client.count( + index="my-index-000001", + query={ + "term": { + "user.id": "kimchy" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.count({ + index: "my-index-000001", + query: { + term: { + "user.id": "kimchy", + }, + }, + }); + - language: Ruby + code: |- + response = client.count( + index: "my-index-000001", + body: { + "query": { + "term": { + "user.id": "kimchy" + } + } + } + ) + - language: PHP + code: |- + $resp = $client->count([ + "index" => "my-index-000001", + "body" => [ + "query" => [ + "term" => [ + "user.id" => "kimchy", + ], + ], + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"query":{"term":{"user.id":"kimchy"}}}'' "$ELASTICSEARCH_URL/my-index-000001/_count"' diff --git a/specification/_global/create/examples/request/CreateRequestExample1.yaml b/specification/_global/create/examples/request/CreateRequestExample1.yaml index ea371cb4ba..12df45ce7c 100644 --- a/specification/_global/create/examples/request/CreateRequestExample1.yaml +++ b/specification/_global/create/examples/request/CreateRequestExample1.yaml @@ -11,3 +11,61 @@ value: |- "id": "kimchy" } } +alternatives: + - language: Python + code: |- + resp = client.create( + index="my-index-000001", + id="1", + document={ + "@timestamp": "2099-11-15T13:12:00", + "message": "GET /search HTTP/1.1 200 1070000", + "user": { + "id": "kimchy" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.create({ + index: "my-index-000001", + id: 1, + document: { + "@timestamp": "2099-11-15T13:12:00", + message: "GET /search HTTP/1.1 200 1070000", + user: { + id: "kimchy", + }, + }, + }); + - language: Ruby + code: |- + response = client.create( + index: "my-index-000001", + id: "1", + body: { + "@timestamp": "2099-11-15T13:12:00", + "message": "GET /search HTTP/1.1 200 1070000", + "user": { + "id": "kimchy" + } + } + ) + - language: PHP + code: |- + $resp = $client->create([ + "index" => "my-index-000001", + "id" => "1", + "body" => [ + "@timestamp" => "2099-11-15T13:12:00", + "message" => "GET /search HTTP/1.1 200 1070000", + "user" => [ + "id" => "kimchy", + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"@timestamp":"2099-11-15T13:12:00","message":"GET /search HTTP/1.1 200 1070000","user":{"id":"kimchy"}}'' + "$ELASTICSEARCH_URL/my-index-000001/_create/1"' diff --git a/specification/_global/delete/examples/request/DeleteRequestExample1.yaml b/specification/_global/delete/examples/request/DeleteRequestExample1.yaml index 2b4da466ae..f63f899496 100644 --- a/specification/_global/delete/examples/request/DeleteRequestExample1.yaml +++ b/specification/_global/delete/examples/request/DeleteRequestExample1.yaml @@ -1 +1,28 @@ method_request: DELETE /my-index-000001/_doc/1 +alternatives: + - language: Python + code: |- + resp = client.delete( + index="my-index-000001", + id="1", + ) + - language: JavaScript + code: |- + const response = await client.delete({ + index: "my-index-000001", + id: 1, + }); + - language: Ruby + code: |- + response = client.delete( + index: "my-index-000001", + id: "1" + ) + - language: PHP + code: |- + $resp = $client->delete([ + "index" => "my-index-000001", + "id" => "1", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index-000001/_doc/1"' diff --git a/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample1.yaml b/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample1.yaml index 24be0c7559..150a70f8fa 100644 --- a/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample1.yaml +++ b/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample1.yaml @@ -8,3 +8,44 @@ value: |- "match_all": {} } } +alternatives: + - language: Python + code: |- + resp = client.delete_by_query( + index="my-index-000001,my-index-000002", + query={ + "match_all": {} + }, + ) + - language: JavaScript + code: |- + const response = await client.deleteByQuery({ + index: "my-index-000001,my-index-000002", + query: { + match_all: {}, + }, + }); + - language: Ruby + code: |- + response = client.delete_by_query( + index: "my-index-000001,my-index-000002", + body: { + "query": { + "match_all": {} + } + } + ) + - language: PHP + code: |- + $resp = $client->deleteByQuery([ + "index" => "my-index-000001,my-index-000002", + "body" => [ + "query" => [ + "match_all" => new ArrayObject([]), + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"query":{"match_all":{}}}'' "$ELASTICSEARCH_URL/my-index-000001,my-index-000002/_delete_by_query"' diff --git a/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample2.yaml b/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample2.yaml index 8a90734e19..3b619c8d51 100644 --- a/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample2.yaml +++ b/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample2.yaml @@ -11,3 +11,56 @@ value: |- }, "max_docs": 1 } +alternatives: + - language: Python + code: |- + resp = client.delete_by_query( + index="my-index-000001", + query={ + "term": { + "user.id": "kimchy" + } + }, + max_docs=1, + ) + - language: JavaScript + code: |- + const response = await client.deleteByQuery({ + index: "my-index-000001", + query: { + term: { + "user.id": "kimchy", + }, + }, + max_docs: 1, + }); + - language: Ruby + code: |- + response = client.delete_by_query( + index: "my-index-000001", + body: { + "query": { + "term": { + "user.id": "kimchy" + } + }, + "max_docs": 1 + } + ) + - language: PHP + code: |- + $resp = $client->deleteByQuery([ + "index" => "my-index-000001", + "body" => [ + "query" => [ + "term" => [ + "user.id" => "kimchy", + ], + ], + "max_docs" => 1, + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"query":{"term":{"user.id":"kimchy"}},"max_docs":1}'' "$ELASTICSEARCH_URL/my-index-000001/_delete_by_query"' diff --git a/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample3.yaml b/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample3.yaml index f1b1f48a55..462153d038 100644 --- a/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample3.yaml +++ b/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample3.yaml @@ -17,3 +17,77 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.delete_by_query( + index="my-index-000001", + slice={ + "id": 0, + "max": 2 + }, + query={ + "range": { + "http.response.bytes": { + "lt": 2000000 + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.deleteByQuery({ + index: "my-index-000001", + slice: { + id: 0, + max: 2, + }, + query: { + range: { + "http.response.bytes": { + lt: 2000000, + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.delete_by_query( + index: "my-index-000001", + body: { + "slice": { + "id": 0, + "max": 2 + }, + "query": { + "range": { + "http.response.bytes": { + "lt": 2000000 + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->deleteByQuery([ + "index" => "my-index-000001", + "body" => [ + "slice" => [ + "id" => 0, + "max" => 2, + ], + "query" => [ + "range" => [ + "http.response.bytes" => [ + "lt" => 2000000, + ], + ], + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"slice":{"id":0,"max":2},"query":{"range":{"http.response.bytes":{"lt":2000000}}}}'' + "$ELASTICSEARCH_URL/my-index-000001/_delete_by_query"' diff --git a/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample4.yaml b/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample4.yaml index 5a52b56159..81d72cad60 100644 --- a/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample4.yaml +++ b/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample4.yaml @@ -1,8 +1,8 @@ summary: Automatic slicing method_request: POST my-index-000001/_delete_by_query?refresh&slices=5 description: > - Run `POST my-index-000001/_delete_by_query?refresh&slices=5` to let delete by query automatically parallelize using sliced scroll to slice on `_id`. - The `slices` query parameter value specifies the number of slices to use. + Run `POST my-index-000001/_delete_by_query?refresh&slices=5` to let delete by query automatically parallelize using sliced scroll + to slice on `_id`. The `slices` query parameter value specifies the number of slices to use. # type: request value: |- { @@ -14,3 +14,69 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.delete_by_query( + index="my-index-000001", + refresh=True, + slices="5", + query={ + "range": { + "http.response.bytes": { + "lt": 2000000 + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.deleteByQuery({ + index: "my-index-000001", + refresh: "true", + slices: 5, + query: { + range: { + "http.response.bytes": { + lt: 2000000, + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.delete_by_query( + index: "my-index-000001", + refresh: "true", + slices: "5", + body: { + "query": { + "range": { + "http.response.bytes": { + "lt": 2000000 + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->deleteByQuery([ + "index" => "my-index-000001", + "refresh" => "true", + "slices" => "5", + "body" => [ + "query" => [ + "range" => [ + "http.response.bytes" => [ + "lt" => 2000000, + ], + ], + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"query":{"range":{"http.response.bytes":{"lt":2000000}}}}'' + "$ELASTICSEARCH_URL/my-index-000001/_delete_by_query?refresh&slices=5"' diff --git a/specification/_global/delete_by_query_rethrottle/examples/request/DeleteByQueryRethrottleRequestExample1.yaml b/specification/_global/delete_by_query_rethrottle/examples/request/DeleteByQueryRethrottleRequestExample1.yaml index 8de0dd841e..79647771e8 100644 --- a/specification/_global/delete_by_query_rethrottle/examples/request/DeleteByQueryRethrottleRequestExample1.yaml +++ b/specification/_global/delete_by_query_rethrottle/examples/request/DeleteByQueryRethrottleRequestExample1.yaml @@ -1 +1,29 @@ method_request: POST _delete_by_query/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1 +alternatives: + - language: Python + code: |- + resp = client.delete_by_query_rethrottle( + task_id="r1A2WoRbTwKZ516z6NEs5A:36619", + requests_per_second="-1", + ) + - language: JavaScript + code: |- + const response = await client.deleteByQueryRethrottle({ + task_id: "r1A2WoRbTwKZ516z6NEs5A:36619", + requests_per_second: "-1", + }); + - language: Ruby + code: |- + response = client.delete_by_query_rethrottle( + task_id: "r1A2WoRbTwKZ516z6NEs5A:36619", + requests_per_second: "-1" + ) + - language: PHP + code: |- + $resp = $client->deleteByQueryRethrottle([ + "task_id" => "r1A2WoRbTwKZ516z6NEs5A:36619", + "requests_per_second" => "-1", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_delete_by_query/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1"' diff --git a/specification/_global/delete_script/examples/request/DeleteScriptRequestExample1.yaml b/specification/_global/delete_script/examples/request/DeleteScriptRequestExample1.yaml index ac34bada0e..a65d29fd24 100644 --- a/specification/_global/delete_script/examples/request/DeleteScriptRequestExample1.yaml +++ b/specification/_global/delete_script/examples/request/DeleteScriptRequestExample1.yaml @@ -1 +1,24 @@ method_request: DELETE _scripts/my-search-template +alternatives: + - language: Python + code: |- + resp = client.delete_script( + id="my-search-template", + ) + - language: JavaScript + code: |- + const response = await client.deleteScript({ + id: "my-search-template", + }); + - language: Ruby + code: |- + response = client.delete_script( + id: "my-search-template" + ) + - language: PHP + code: |- + $resp = $client->deleteScript([ + "id" => "my-search-template", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_scripts/my-search-template"' diff --git a/specification/_global/exists/examples/request/DocumentExistsRequestExample1.yaml b/specification/_global/exists/examples/request/DocumentExistsRequestExample1.yaml index 78295be42a..9d2a905460 100644 --- a/specification/_global/exists/examples/request/DocumentExistsRequestExample1.yaml +++ b/specification/_global/exists/examples/request/DocumentExistsRequestExample1.yaml @@ -1 +1,28 @@ method_request: HEAD my-index-000001/_doc/0 +alternatives: + - language: Python + code: |- + resp = client.exists( + index="my-index-000001", + id="0", + ) + - language: JavaScript + code: |- + const response = await client.exists({ + index: "my-index-000001", + id: 0, + }); + - language: Ruby + code: |- + response = client.exists( + index: "my-index-000001", + id: "0" + ) + - language: PHP + code: |- + $resp = $client->exists([ + "index" => "my-index-000001", + "id" => "0", + ]); + - language: curl + code: 'curl --head -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index-000001/_doc/0"' diff --git a/specification/_global/exists_source/examples/request/ExistsSourceRequestExample1.yaml b/specification/_global/exists_source/examples/request/ExistsSourceRequestExample1.yaml index 3a5a843b8c..1e5cb53f47 100644 --- a/specification/_global/exists_source/examples/request/ExistsSourceRequestExample1.yaml +++ b/specification/_global/exists_source/examples/request/ExistsSourceRequestExample1.yaml @@ -1 +1,28 @@ method_request: HEAD my-index-000001/_source/1 +alternatives: + - language: Python + code: |- + resp = client.exists_source( + index="my-index-000001", + id="1", + ) + - language: JavaScript + code: |- + const response = await client.existsSource({ + index: "my-index-000001", + id: 1, + }); + - language: Ruby + code: |- + response = client.exists_source( + index: "my-index-000001", + id: "1" + ) + - language: PHP + code: |- + $resp = $client->existsSource([ + "index" => "my-index-000001", + "id" => "1", + ]); + - language: curl + code: 'curl --head -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index-000001/_source/1"' diff --git a/specification/_global/explain/examples/request/ExplainRequestExample1.yaml b/specification/_global/explain/examples/request/ExplainRequestExample1.yaml index 8689c7b2c9..f96f1ff26b 100644 --- a/specification/_global/explain/examples/request/ExplainRequestExample1.yaml +++ b/specification/_global/explain/examples/request/ExplainRequestExample1.yaml @@ -1,8 +1,8 @@ # summary: method_request: GET /my-index-000001/_explain/0 description: > - Run `GET /my-index-000001/_explain/0` with the request body. - Alternatively, run `GET /my-index-000001/_explain/0?q=message:elasticsearch` + Run `GET /my-index-000001/_explain/0` with the request body. Alternatively, run `GET + /my-index-000001/_explain/0?q=message:elasticsearch` # type: request value: |- { @@ -10,3 +10,56 @@ value: |- "match" : { "message" : "elasticsearch" } } } +alternatives: + - language: Python + code: |- + resp = client.explain( + index="my-index-000001", + id="0", + query={ + "match": { + "message": "elasticsearch" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.explain({ + index: "my-index-000001", + id: 0, + query: { + match: { + message: "elasticsearch", + }, + }, + }); + - language: Ruby + code: |- + response = client.explain( + index: "my-index-000001", + id: "0", + body: { + "query": { + "match": { + "message": "elasticsearch" + } + } + } + ) + - language: PHP + code: |- + $resp = $client->explain([ + "index" => "my-index-000001", + "id" => "0", + "body" => [ + "query" => [ + "match" => [ + "message" => "elasticsearch", + ], + ], + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"query":{"match":{"message":"elasticsearch"}}}'' "$ELASTICSEARCH_URL/my-index-000001/_explain/0"' diff --git a/specification/_global/field_caps/examples/request/FieldCapabilitiesRequestExample1.yaml b/specification/_global/field_caps/examples/request/FieldCapabilitiesRequestExample1.yaml index 4322d0d189..af2097ff7e 100644 --- a/specification/_global/field_caps/examples/request/FieldCapabilitiesRequestExample1.yaml +++ b/specification/_global/field_caps/examples/request/FieldCapabilitiesRequestExample1.yaml @@ -1,8 +1,8 @@ # summary: method_request: 'POST my-index-*/_field_caps?fields=rating' description: > - Run `POST my-index-*/_field_caps?fields=rating` to get field capabilities and filter indices with a query. - Indices that rewrite the provided filter to `match_none` on every shard will be filtered from the response. + Run `POST my-index-*/_field_caps?fields=rating` to get field capabilities and filter indices with a query. Indices that rewrite + the provided filter to `match_none` on every shard will be filtered from the response. # type: "request" value: |- { @@ -14,3 +14,65 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.field_caps( + index="my-index-*", + fields="rating", + index_filter={ + "range": { + "@timestamp": { + "gte": "2018" + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.fieldCaps({ + index: "my-index-*", + fields: "rating", + index_filter: { + range: { + "@timestamp": { + gte: "2018", + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.field_caps( + index: "my-index-*", + fields: "rating", + body: { + "index_filter": { + "range": { + "@timestamp": { + "gte": "2018" + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->fieldCaps([ + "index" => "my-index-*", + "fields" => "rating", + "body" => [ + "index_filter" => [ + "range" => [ + "@timestamp" => [ + "gte" => "2018", + ], + ], + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"index_filter":{"range":{"@timestamp":{"gte":"2018"}}}}'' + "$ELASTICSEARCH_URL/my-index-*/_field_caps?fields=rating"' diff --git a/specification/_global/get/examples/request/GetRequestExample2.yaml b/specification/_global/get/examples/request/GetRequestExample2.yaml index 22ed571367..fe75965b61 100644 --- a/specification/_global/get/examples/request/GetRequestExample2.yaml +++ b/specification/_global/get/examples/request/GetRequestExample2.yaml @@ -1 +1,33 @@ method_request: GET my-index-000001/_doc/1?stored_fields=tags,counter +alternatives: + - language: Python + code: |- + resp = client.get( + index="my-index-000001", + id="1", + stored_fields="tags,counter", + ) + - language: JavaScript + code: |- + const response = await client.get({ + index: "my-index-000001", + id: 1, + stored_fields: "tags,counter", + }); + - language: Ruby + code: |- + response = client.get( + index: "my-index-000001", + id: "1", + stored_fields: "tags,counter" + ) + - language: PHP + code: |- + $resp = $client->get([ + "index" => "my-index-000001", + "id" => "1", + "stored_fields" => "tags,counter", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/my-index-000001/_doc/1?stored_fields=tags,counter"' diff --git a/specification/_global/get_script/examples/request/GetScriptRequestExample1.yaml b/specification/_global/get_script/examples/request/GetScriptRequestExample1.yaml index 60d3bb295d..019c999121 100644 --- a/specification/_global/get_script/examples/request/GetScriptRequestExample1.yaml +++ b/specification/_global/get_script/examples/request/GetScriptRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET _scripts/my-search-template +alternatives: + - language: Python + code: |- + resp = client.get_script( + id="my-search-template", + ) + - language: JavaScript + code: |- + const response = await client.getScript({ + id: "my-search-template", + }); + - language: Ruby + code: |- + response = client.get_script( + id: "my-search-template" + ) + - language: PHP + code: |- + $resp = $client->getScript([ + "id" => "my-search-template", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_scripts/my-search-template"' diff --git a/specification/_global/get_script_context/examples/request/GetScriptContextRequestExample1.yaml b/specification/_global/get_script_context/examples/request/GetScriptContextRequestExample1.yaml index a0715429dd..0fd94dcf49 100644 --- a/specification/_global/get_script_context/examples/request/GetScriptContextRequestExample1.yaml +++ b/specification/_global/get_script_context/examples/request/GetScriptContextRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET _script_context +alternatives: + - language: Python + code: resp = client.get_script_context() + - language: JavaScript + code: const response = await client.getScriptContext(); + - language: Ruby + code: response = client.get_script_context + - language: PHP + code: $resp = $client->getScriptContext(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_script_context"' diff --git a/specification/_global/get_script_languages/examples/request/GetScriptLanguagesRequestExample1.yaml b/specification/_global/get_script_languages/examples/request/GetScriptLanguagesRequestExample1.yaml index 3db7b33d30..11d9f091e1 100644 --- a/specification/_global/get_script_languages/examples/request/GetScriptLanguagesRequestExample1.yaml +++ b/specification/_global/get_script_languages/examples/request/GetScriptLanguagesRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET _script_language +alternatives: + - language: Python + code: resp = client.get_script_languages() + - language: JavaScript + code: const response = await client.getScriptLanguages(); + - language: Ruby + code: response = client.get_script_languages + - language: PHP + code: $resp = $client->getScriptLanguages(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_script_language"' diff --git a/specification/_global/get_source/examples/request/GetSourceRequestExample1.yaml b/specification/_global/get_source/examples/request/GetSourceRequestExample1.yaml index dca7123365..78bb88e8bb 100644 --- a/specification/_global/get_source/examples/request/GetSourceRequestExample1.yaml +++ b/specification/_global/get_source/examples/request/GetSourceRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET my-index-000001/_source/1 +alternatives: + - language: Python + code: |- + resp = client.get_source( + index="my-index-000001", + id="1", + ) + - language: JavaScript + code: |- + const response = await client.getSource({ + index: "my-index-000001", + id: 1, + }); + - language: Ruby + code: |- + response = client.get_source( + index: "my-index-000001", + id: "1" + ) + - language: PHP + code: |- + $resp = $client->getSource([ + "index" => "my-index-000001", + "id" => "1", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index-000001/_source/1"' diff --git a/specification/_global/health_report/examples/request/HealthReportRequestExample1.yaml b/specification/_global/health_report/examples/request/HealthReportRequestExample1.yaml index a64e53a03b..2f62818227 100644 --- a/specification/_global/health_report/examples/request/HealthReportRequestExample1.yaml +++ b/specification/_global/health_report/examples/request/HealthReportRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET _health_report +alternatives: + - language: Python + code: resp = client.health_report() + - language: JavaScript + code: const response = await client.healthReport(); + - language: Ruby + code: response = client.health_report + - language: PHP + code: $resp = $client->healthReport(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_health_report"' diff --git a/specification/_global/index/examples/request/IndexRequestExample1.yaml b/specification/_global/index/examples/request/IndexRequestExample1.yaml index 832634f9ee..2ccf8a72aa 100644 --- a/specification/_global/index/examples/request/IndexRequestExample1.yaml +++ b/specification/_global/index/examples/request/IndexRequestExample1.yaml @@ -1,8 +1,8 @@ summary: Automate document IDs method_request: POST my-index-000001/_doc/ description: > - Run `POST my-index-000001/_doc/` to index a document. - When you use the `POST //_doc/` request format, the `op_type` is automatically set to `create` and the index operation generates a unique ID for the document. + Run `POST my-index-000001/_doc/` to index a document. When you use the `POST //_doc/` request format, the `op_type` is + automatically set to `create` and the index operation generates a unique ID for the document. # type: request value: |- { @@ -12,3 +12,57 @@ value: |- "id": "kimchy" } } +alternatives: + - language: Python + code: |- + resp = client.index( + index="my-index-000001", + document={ + "@timestamp": "2099-11-15T13:12:00", + "message": "GET /search HTTP/1.1 200 1070000", + "user": { + "id": "kimchy" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.index({ + index: "my-index-000001", + document: { + "@timestamp": "2099-11-15T13:12:00", + message: "GET /search HTTP/1.1 200 1070000", + user: { + id: "kimchy", + }, + }, + }); + - language: Ruby + code: |- + response = client.index( + index: "my-index-000001", + body: { + "@timestamp": "2099-11-15T13:12:00", + "message": "GET /search HTTP/1.1 200 1070000", + "user": { + "id": "kimchy" + } + } + ) + - language: PHP + code: |- + $resp = $client->index([ + "index" => "my-index-000001", + "body" => [ + "@timestamp" => "2099-11-15T13:12:00", + "message" => "GET /search HTTP/1.1 200 1070000", + "user" => [ + "id" => "kimchy", + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"@timestamp":"2099-11-15T13:12:00","message":"GET /search HTTP/1.1 200 1070000","user":{"id":"kimchy"}}'' + "$ELASTICSEARCH_URL/my-index-000001/_doc/"' diff --git a/specification/_global/index/examples/request/IndexRequestExample2.yaml b/specification/_global/index/examples/request/IndexRequestExample2.yaml index a3a5c9aea9..9a3635e0fe 100644 --- a/specification/_global/index/examples/request/IndexRequestExample2.yaml +++ b/specification/_global/index/examples/request/IndexRequestExample2.yaml @@ -11,3 +11,61 @@ value: |- "id": "kimchy" } } +alternatives: + - language: Python + code: |- + resp = client.index( + index="my-index-000001", + id="1", + document={ + "@timestamp": "2099-11-15T13:12:00", + "message": "GET /search HTTP/1.1 200 1070000", + "user": { + "id": "kimchy" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.index({ + index: "my-index-000001", + id: 1, + document: { + "@timestamp": "2099-11-15T13:12:00", + message: "GET /search HTTP/1.1 200 1070000", + user: { + id: "kimchy", + }, + }, + }); + - language: Ruby + code: |- + response = client.index( + index: "my-index-000001", + id: "1", + body: { + "@timestamp": "2099-11-15T13:12:00", + "message": "GET /search HTTP/1.1 200 1070000", + "user": { + "id": "kimchy" + } + } + ) + - language: PHP + code: |- + $resp = $client->index([ + "index" => "my-index-000001", + "id" => "1", + "body" => [ + "@timestamp" => "2099-11-15T13:12:00", + "message" => "GET /search HTTP/1.1 200 1070000", + "user" => [ + "id" => "kimchy", + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"@timestamp":"2099-11-15T13:12:00","message":"GET /search HTTP/1.1 200 1070000","user":{"id":"kimchy"}}'' + "$ELASTICSEARCH_URL/my-index-000001/_doc/1"' diff --git a/specification/_global/info/examples/request/RootNodeInfoRequestExample1.yaml b/specification/_global/info/examples/request/RootNodeInfoRequestExample1.yaml index 54a75d703d..6082d4d7cc 100644 --- a/specification/_global/info/examples/request/RootNodeInfoRequestExample1.yaml +++ b/specification/_global/info/examples/request/RootNodeInfoRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET / +alternatives: + - language: Python + code: resp = client.info() + - language: JavaScript + code: const response = await client.info(); + - language: Ruby + code: response = client.info + - language: PHP + code: $resp = $client->info(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/"' diff --git a/specification/_global/mget/examples/request/MultiGetRequestExample1.yaml b/specification/_global/mget/examples/request/MultiGetRequestExample1.yaml index 5673b93991..4c607cc96f 100644 --- a/specification/_global/mget/examples/request/MultiGetRequestExample1.yaml +++ b/specification/_global/mget/examples/request/MultiGetRequestExample1.yaml @@ -1,8 +1,8 @@ summary: Get documents by ID method_request: 'GET /my-index-000001/_mget' description: > - Run `GET /my-index-000001/_mget`. - When you specify an index in the request URI, only the document IDs are required in the request body. + Run `GET /my-index-000001/_mget`. When you specify an index in the request URI, only the document IDs are required in the request + body. # type: "request" value: |- { @@ -15,3 +15,64 @@ value: |- } ] } +alternatives: + - language: Python + code: |- + resp = client.mget( + index="my-index-000001", + docs=[ + { + "_id": "1" + }, + { + "_id": "2" + } + ], + ) + - language: JavaScript + code: |- + const response = await client.mget({ + index: "my-index-000001", + docs: [ + { + _id: "1", + }, + { + _id: "2", + }, + ], + }); + - language: Ruby + code: |- + response = client.mget( + index: "my-index-000001", + body: { + "docs": [ + { + "_id": "1" + }, + { + "_id": "2" + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->mget([ + "index" => "my-index-000001", + "body" => [ + "docs" => array( + [ + "_id" => "1", + ], + [ + "_id" => "2", + ], + ), + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"docs":[{"_id":"1"},{"_id":"2"}]}'' "$ELASTICSEARCH_URL/my-index-000001/_mget"' diff --git a/specification/_global/mget/examples/request/MultiGetRequestExample2.yaml b/specification/_global/mget/examples/request/MultiGetRequestExample2.yaml index 9392634ad8..f269d68104 100644 --- a/specification/_global/mget/examples/request/MultiGetRequestExample2.yaml +++ b/specification/_global/mget/examples/request/MultiGetRequestExample2.yaml @@ -1,10 +1,8 @@ summary: Filter source fields method_request: 'GET /_mget' description: > - Run `GET /_mget`. - This request sets `_source` to `false` for document 1 to exclude the source entirely. - It retrieves `field3` and `field4` from document 2. - It retrieves the `user` field from document 3 but filters out the `user.location` field. + Run `GET /_mget`. This request sets `_source` to `false` for document 1 to exclude the source entirely. It retrieves `field3` and + `field4` from document 2. It retrieves the `user` field from document 3 but filters out the `user.location` field. # type: "request" value: |- { @@ -29,3 +27,131 @@ value: |- } ] } +alternatives: + - language: Python + code: |- + resp = client.mget( + docs=[ + { + "_index": "test", + "_id": "1", + "_source": False + }, + { + "_index": "test", + "_id": "2", + "_source": [ + "field3", + "field4" + ] + }, + { + "_index": "test", + "_id": "3", + "_source": { + "include": [ + "user" + ], + "exclude": [ + "user.location" + ] + } + } + ], + ) + - language: JavaScript + code: |- + const response = await client.mget({ + docs: [ + { + _index: "test", + _id: "1", + _source: false, + }, + { + _index: "test", + _id: "2", + _source: ["field3", "field4"], + }, + { + _index: "test", + _id: "3", + _source: { + include: ["user"], + exclude: ["user.location"], + }, + }, + ], + }); + - language: Ruby + code: |- + response = client.mget( + body: { + "docs": [ + { + "_index": "test", + "_id": "1", + "_source": false + }, + { + "_index": "test", + "_id": "2", + "_source": [ + "field3", + "field4" + ] + }, + { + "_index": "test", + "_id": "3", + "_source": { + "include": [ + "user" + ], + "exclude": [ + "user.location" + ] + } + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->mget([ + "body" => [ + "docs" => array( + [ + "_index" => "test", + "_id" => "1", + "_source" => false, + ], + [ + "_index" => "test", + "_id" => "2", + "_source" => array( + "field3", + "field4", + ), + ], + [ + "_index" => "test", + "_id" => "3", + "_source" => [ + "include" => array( + "user", + ), + "exclude" => array( + "user.location", + ), + ], + ], + ), + ], + ]); + - language: curl + code: + "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"docs\":[{\"_index\":\"test\",\"_id\":\"1\",\"_source\":false},{\"_index\":\"test\",\"_id\":\"2\",\"_source\":[\"field3\",\ + \"field4\"]},{\"_index\":\"test\",\"_id\":\"3\",\"_source\":{\"include\":[\"user\"],\"exclude\":[\"user.location\"]}}]}' + \"$ELASTICSEARCH_URL/_mget\"" diff --git a/specification/_global/mget/examples/request/MultiGetRequestExample3.yaml b/specification/_global/mget/examples/request/MultiGetRequestExample3.yaml index 4c03d28018..9a9a7535ec 100644 --- a/specification/_global/mget/examples/request/MultiGetRequestExample3.yaml +++ b/specification/_global/mget/examples/request/MultiGetRequestExample3.yaml @@ -1,8 +1,7 @@ summary: Get stored fields method_request: 'GET /_mget' description: > - Run `GET /_mget`. - This request retrieves `field1` and `field2` from document 1 and `field3` and `field4` from document 2. + Run `GET /_mget`. This request retrieves `field1` and `field2` from document 1 and `field3` and `field4` from document 2. # type: "request" value: |- { @@ -19,3 +18,95 @@ value: |- } ] } +alternatives: + - language: Python + code: |- + resp = client.mget( + docs=[ + { + "_index": "test", + "_id": "1", + "stored_fields": [ + "field1", + "field2" + ] + }, + { + "_index": "test", + "_id": "2", + "stored_fields": [ + "field3", + "field4" + ] + } + ], + ) + - language: JavaScript + code: |- + const response = await client.mget({ + docs: [ + { + _index: "test", + _id: "1", + stored_fields: ["field1", "field2"], + }, + { + _index: "test", + _id: "2", + stored_fields: ["field3", "field4"], + }, + ], + }); + - language: Ruby + code: |- + response = client.mget( + body: { + "docs": [ + { + "_index": "test", + "_id": "1", + "stored_fields": [ + "field1", + "field2" + ] + }, + { + "_index": "test", + "_id": "2", + "stored_fields": [ + "field3", + "field4" + ] + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->mget([ + "body" => [ + "docs" => array( + [ + "_index" => "test", + "_id" => "1", + "stored_fields" => array( + "field1", + "field2", + ), + ], + [ + "_index" => "test", + "_id" => "2", + "stored_fields" => array( + "field3", + "field4", + ), + ], + ), + ], + ]); + - language: curl + code: + "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"docs\":[{\"_index\":\"test\",\"_id\":\"1\",\"stored_fields\":[\"field1\",\"field2\"]},{\"_index\":\"test\",\"_id\":\"2\",\ + \"stored_fields\":[\"field3\",\"field4\"]}]}' \"$ELASTICSEARCH_URL/_mget\"" diff --git a/specification/_global/mget/examples/request/MultiGetRequestExample4.yaml b/specification/_global/mget/examples/request/MultiGetRequestExample4.yaml index 144146c2d3..291aa37342 100644 --- a/specification/_global/mget/examples/request/MultiGetRequestExample4.yaml +++ b/specification/_global/mget/examples/request/MultiGetRequestExample4.yaml @@ -1,10 +1,9 @@ summary: Document routing method_request: 'GET /_mget?routing=key1' description: > - Run `GET /_mget?routing=key1`. - If routing is used during indexing, you need to specify the routing value to retrieve documents. - This request fetches `test/_doc/2` from the shard corresponding to routing key `key1`. - It fetches `test/_doc/1` from the shard corresponding to routing key `key2`. + Run `GET /_mget?routing=key1`. If routing is used during indexing, you need to specify the routing value to retrieve documents. + This request fetches `test/_doc/2` from the shard corresponding to routing key `key1`. It fetches `test/_doc/1` from the shard + corresponding to routing key `key2`. # type: "request" value: |- { @@ -20,3 +19,77 @@ value: |- } ] } +alternatives: + - language: Python + code: |- + resp = client.mget( + routing="key1", + docs=[ + { + "_index": "test", + "_id": "1", + "routing": "key2" + }, + { + "_index": "test", + "_id": "2" + } + ], + ) + - language: JavaScript + code: |- + const response = await client.mget({ + routing: "key1", + docs: [ + { + _index: "test", + _id: "1", + routing: "key2", + }, + { + _index: "test", + _id: "2", + }, + ], + }); + - language: Ruby + code: |- + response = client.mget( + routing: "key1", + body: { + "docs": [ + { + "_index": "test", + "_id": "1", + "routing": "key2" + }, + { + "_index": "test", + "_id": "2" + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->mget([ + "routing" => "key1", + "body" => [ + "docs" => array( + [ + "_index" => "test", + "_id" => "1", + "routing" => "key2", + ], + [ + "_index" => "test", + "_id" => "2", + ], + ), + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"docs":[{"_index":"test","_id":"1","routing":"key2"},{"_index":"test","_id":"2"}]}'' + "$ELASTICSEARCH_URL/_mget?routing=key1"' diff --git a/specification/_global/msearch/examples/request/MsearchRequestExample1.yaml b/specification/_global/msearch/examples/request/MsearchRequestExample1.yaml index 076400983b..60711ea29d 100644 --- a/specification/_global/msearch/examples/request/MsearchRequestExample1.yaml +++ b/specification/_global/msearch/examples/request/MsearchRequestExample1.yaml @@ -5,3 +5,101 @@ value: |- {"query" : {"match" : { "message": "this is a test"}}} {"index": "my-index-000002"} {"query" : {"match_all" : {}}} +alternatives: + - language: Python + code: |- + resp = client.msearch( + index="my-index-000001", + searches=[ + {}, + { + "query": { + "match": { + "message": "this is a test" + } + } + }, + { + "index": "my-index-000002" + }, + { + "query": { + "match_all": {} + } + } + ], + ) + - language: JavaScript + code: |- + const response = await client.msearch({ + index: "my-index-000001", + searches: [ + {}, + { + query: { + match: { + message: "this is a test", + }, + }, + }, + { + index: "my-index-000002", + }, + { + query: { + match_all: {}, + }, + }, + ], + }); + - language: Ruby + code: |- + response = client.msearch( + index: "my-index-000001", + body: [ + {}, + { + "query": { + "match": { + "message": "this is a test" + } + } + }, + { + "index": "my-index-000002" + }, + { + "query": { + "match_all": {} + } + } + ] + ) + - language: PHP + code: |- + $resp = $client->msearch([ + "index" => "my-index-000001", + "body" => array( + new ArrayObject([]), + [ + "query" => [ + "match" => [ + "message" => "this is a test", + ], + ], + ], + [ + "index" => "my-index-000002", + ], + [ + "query" => [ + "match_all" => new ArrayObject([]), + ], + ], + ), + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''[{},{"query":{"match":{"message":"this is a test"}}},{"index":"my-index-000002"},{"query":{"match_all":{}}}]'' + "$ELASTICSEARCH_URL/my-index-000001/_msearch"' diff --git a/specification/_global/msearch_template/examples/request/MultiSearchTemplateRequestExample1.yaml b/specification/_global/msearch_template/examples/request/MultiSearchTemplateRequestExample1.yaml index c033a2f7e3..ef7f6d6b3a 100644 --- a/specification/_global/msearch_template/examples/request/MultiSearchTemplateRequestExample1.yaml +++ b/specification/_global/msearch_template/examples/request/MultiSearchTemplateRequestExample1.yaml @@ -7,3 +7,102 @@ value: |- { "id": "my-search-template", "params": { "query_string": "hello world", "from": 0, "size": 10 }} { } { "id": "my-other-search-template", "params": { "query_type": "match_all" }} +alternatives: + - language: Python + code: |- + resp = client.msearch_template( + index="my-index", + search_templates=[ + {}, + { + "id": "my-search-template", + "params": { + "query_string": "hello world", + "from": 0, + "size": 10 + } + }, + {}, + { + "id": "my-other-search-template", + "params": { + "query_type": "match_all" + } + } + ], + ) + - language: JavaScript + code: |- + const response = await client.msearchTemplate({ + index: "my-index", + search_templates: [ + {}, + { + id: "my-search-template", + params: { + query_string: "hello world", + from: 0, + size: 10, + }, + }, + {}, + { + id: "my-other-search-template", + params: { + query_type: "match_all", + }, + }, + ], + }); + - language: Ruby + code: |- + response = client.msearch_template( + index: "my-index", + body: [ + {}, + { + "id": "my-search-template", + "params": { + "query_string": "hello world", + "from": 0, + "size": 10 + } + }, + {}, + { + "id": "my-other-search-template", + "params": { + "query_type": "match_all" + } + } + ] + ) + - language: PHP + code: |- + $resp = $client->msearchTemplate([ + "index" => "my-index", + "body" => array( + new ArrayObject([]), + [ + "id" => "my-search-template", + "params" => [ + "query_string" => "hello world", + "from" => 0, + "size" => 10, + ], + ], + new ArrayObject([]), + [ + "id" => "my-other-search-template", + "params" => [ + "query_type" => "match_all", + ], + ], + ), + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''[{},{"id":"my-search-template","params":{"query_string":"hello + world","from":0,"size":10}},{},{"id":"my-other-search-template","params":{"query_type":"match_all"}}]'' + "$ELASTICSEARCH_URL/my-index/_msearch/template"' diff --git a/specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample1.yaml b/specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample1.yaml index 9e28f0d22e..2486307f7a 100644 --- a/specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample1.yaml +++ b/specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample1.yaml @@ -1,8 +1,8 @@ summary: Get multiple term vectors method_request: 'POST /my-index-000001/_mtermvectors' description: > - Run `POST /my-index-000001/_mtermvectors`. - When you specify an index in the request URI, the index does not need to be specified for each documents in the request body. + Run `POST /my-index-000001/_mtermvectors`. When you specify an index in the request URI, the index does not need to be specified + for each documents in the request body. # type: "request" value: |- { @@ -19,3 +19,79 @@ value: |- } ] } +alternatives: + - language: Python + code: |- + resp = client.mtermvectors( + index="my-index-000001", + docs=[ + { + "_id": "2", + "fields": [ + "message" + ], + "term_statistics": True + }, + { + "_id": "1" + } + ], + ) + - language: JavaScript + code: |- + const response = await client.mtermvectors({ + index: "my-index-000001", + docs: [ + { + _id: "2", + fields: ["message"], + term_statistics: true, + }, + { + _id: "1", + }, + ], + }); + - language: Ruby + code: |- + response = client.mtermvectors( + index: "my-index-000001", + body: { + "docs": [ + { + "_id": "2", + "fields": [ + "message" + ], + "term_statistics": true + }, + { + "_id": "1" + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->mtermvectors([ + "index" => "my-index-000001", + "body" => [ + "docs" => array( + [ + "_id" => "2", + "fields" => array( + "message", + ), + "term_statistics" => true, + ], + [ + "_id" => "1", + ], + ), + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"docs":[{"_id":"2","fields":["message"],"term_statistics":true},{"_id":"1"}]}'' + "$ELASTICSEARCH_URL/my-index-000001/_mtermvectors"' diff --git a/specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample2.yaml b/specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample2.yaml index 931a93e9cb..853ed225f4 100644 --- a/specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample2.yaml +++ b/specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample2.yaml @@ -1,8 +1,8 @@ summary: Simplified syntax method_request: POST /my-index-000001/_mtermvectors description: > - Run `POST /my-index-000001/_mtermvectors`. - If all requested documents are in same index and the parameters are the same, you can use a simplified syntax. + Run `POST /my-index-000001/_mtermvectors`. If all requested documents are in same index and the parameters are the same, you can + use a simplified syntax. # type: request value: |- { @@ -12,3 +12,60 @@ value: |- ], "term_statistics": true } +alternatives: + - language: Python + code: |- + resp = client.mtermvectors( + index="my-index-000001", + ids=[ + "1", + "2" + ], + fields=[ + "message" + ], + term_statistics=True, + ) + - language: JavaScript + code: |- + const response = await client.mtermvectors({ + index: "my-index-000001", + ids: ["1", "2"], + fields: ["message"], + term_statistics: true, + }); + - language: Ruby + code: |- + response = client.mtermvectors( + index: "my-index-000001", + body: { + "ids": [ + "1", + "2" + ], + "fields": [ + "message" + ], + "term_statistics": true + } + ) + - language: PHP + code: |- + $resp = $client->mtermvectors([ + "index" => "my-index-000001", + "body" => [ + "ids" => array( + "1", + "2", + ), + "fields" => array( + "message", + ), + "term_statistics" => true, + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"ids":["1","2"],"fields":["message"],"term_statistics":true}'' + "$ELASTICSEARCH_URL/my-index-000001/_mtermvectors"' diff --git a/specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample3.yaml b/specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample3.yaml index 157ea026c1..33a46d9ed1 100644 --- a/specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample3.yaml +++ b/specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample3.yaml @@ -1,8 +1,8 @@ summary: Artificial documents method_request: POST /_mtermvectors description: > - Run `POST /_mtermvectors` to generate term vectors for artificial documents provided in the body of the request. - The mapping used is determined by the specified `_index`. + Run `POST /_mtermvectors` to generate term vectors for artificial documents provided in the body of the request. The mapping used + is determined by the specified `_index`. # type: request value: |- { @@ -21,3 +21,85 @@ value: |- } ] } +alternatives: + - language: Python + code: |- + resp = client.mtermvectors( + docs=[ + { + "_index": "my-index-000001", + "doc": { + "message": "test test test" + } + }, + { + "_index": "my-index-000001", + "doc": { + "message": "Another test ..." + } + } + ], + ) + - language: JavaScript + code: |- + const response = await client.mtermvectors({ + docs: [ + { + _index: "my-index-000001", + doc: { + message: "test test test", + }, + }, + { + _index: "my-index-000001", + doc: { + message: "Another test ...", + }, + }, + ], + }); + - language: Ruby + code: |- + response = client.mtermvectors( + body: { + "docs": [ + { + "_index": "my-index-000001", + "doc": { + "message": "test test test" + } + }, + { + "_index": "my-index-000001", + "doc": { + "message": "Another test ..." + } + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->mtermvectors([ + "body" => [ + "docs" => array( + [ + "_index" => "my-index-000001", + "doc" => [ + "message" => "test test test", + ], + ], + [ + "_index" => "my-index-000001", + "doc" => [ + "message" => "Another test ...", + ], + ], + ), + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"docs":[{"_index":"my-index-000001","doc":{"message":"test test + test"}},{"_index":"my-index-000001","doc":{"message":"Another test ..."}}]}'' "$ELASTICSEARCH_URL/_mtermvectors"' diff --git a/specification/_global/open_point_in_time/examples/request/OpenPointInTimeRequestExample1.yaml b/specification/_global/open_point_in_time/examples/request/OpenPointInTimeRequestExample1.yaml index 63fef57765..c3802c1f77 100644 --- a/specification/_global/open_point_in_time/examples/request/OpenPointInTimeRequestExample1.yaml +++ b/specification/_global/open_point_in_time/examples/request/OpenPointInTimeRequestExample1.yaml @@ -1 +1,33 @@ method_request: POST /my-index-000001/_pit?keep_alive=1m&allow_partial_search_results=true +alternatives: + - language: Python + code: |- + resp = client.open_point_in_time( + index="my-index-000001", + keep_alive="1m", + allow_partial_search_results=True, + ) + - language: JavaScript + code: |- + const response = await client.openPointInTime({ + index: "my-index-000001", + keep_alive: "1m", + allow_partial_search_results: "true", + }); + - language: Ruby + code: |- + response = client.open_point_in_time( + index: "my-index-000001", + keep_alive: "1m", + allow_partial_search_results: "true" + ) + - language: PHP + code: |- + $resp = $client->openPointInTime([ + "index" => "my-index-000001", + "keep_alive" => "1m", + "allow_partial_search_results" => "true", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/my-index-000001/_pit?keep_alive=1m&allow_partial_search_results=true"' diff --git a/specification/_global/put_script/examples/request/PutScriptRequestExample1.yaml b/specification/_global/put_script/examples/request/PutScriptRequestExample1.yaml index 7594d7b27a..3d59b1b3c9 100644 --- a/specification/_global/put_script/examples/request/PutScriptRequestExample1.yaml +++ b/specification/_global/put_script/examples/request/PutScriptRequestExample1.yaml @@ -18,3 +18,81 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.put_script( + id="my-search-template", + script={ + "lang": "mustache", + "source": { + "query": { + "match": { + "message": "{{query_string}}" + } + }, + "from": "{{from}}", + "size": "{{size}}" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.putScript({ + id: "my-search-template", + script: { + lang: "mustache", + source: { + query: { + match: { + message: "{{query_string}}", + }, + }, + from: "{{from}}", + size: "{{size}}", + }, + }, + }); + - language: Ruby + code: |- + response = client.put_script( + id: "my-search-template", + body: { + "script": { + "lang": "mustache", + "source": { + "query": { + "match": { + "message": "{{query_string}}" + } + }, + "from": "{{from}}", + "size": "{{size}}" + } + } + } + ) + - language: PHP + code: |- + $resp = $client->putScript([ + "id" => "my-search-template", + "body" => [ + "script" => [ + "lang" => "mustache", + "source" => [ + "query" => [ + "match" => [ + "message" => "{{query_string}}", + ], + ], + "from" => "{{from}}", + "size" => "{{size}}", + ], + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"script\":{\"lang\":\"mustache\",\"source\":{\"query\":{\"match\":{\"message\":\"{{query_string}}\"}},\"from\":\"{{from}}\ + \",\"size\":\"{{size}}\"}}}' \"$ELASTICSEARCH_URL/_scripts/my-search-template\"" diff --git a/specification/_global/put_script/examples/request/PutScriptRequestExample2.yaml b/specification/_global/put_script/examples/request/PutScriptRequestExample2.yaml index 9f80712c88..f22efacfc1 100644 --- a/specification/_global/put_script/examples/request/PutScriptRequestExample2.yaml +++ b/specification/_global/put_script/examples/request/PutScriptRequestExample2.yaml @@ -10,3 +10,49 @@ value: |- "source": "Math.log(_score * 2) + params['my_modifier']" } } +alternatives: + - language: Python + code: |- + resp = client.put_script( + id="my-stored-script", + script={ + "lang": "painless", + "source": "Math.log(_score * 2) + params['my_modifier']" + }, + ) + - language: JavaScript + code: |- + const response = await client.putScript({ + id: "my-stored-script", + script: { + lang: "painless", + source: "Math.log(_score * 2) + params['my_modifier']", + }, + }); + - language: Ruby + code: |- + response = client.put_script( + id: "my-stored-script", + body: { + "script": { + "lang": "painless", + "source": "Math.log(_score * 2) + params['my_modifier']" + } + } + ) + - language: PHP + code: |- + $resp = $client->putScript([ + "id" => "my-stored-script", + "body" => [ + "script" => [ + "lang" => "painless", + "source" => "Math.log(_score * 2) + params['my_modifier']", + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"script":{"lang":"painless","source":"Math.log(_score * 2) + params[''"''"''my_modifier''"''"'']"}}'' + "$ELASTICSEARCH_URL/_scripts/my-stored-script"' diff --git a/specification/_global/rank_eval/examples/request/RankEvalRequestExample1.yaml b/specification/_global/rank_eval/examples/request/RankEvalRequestExample1.yaml index cf30d4a6fa..b369152906 100644 --- a/specification/_global/rank_eval/examples/request/RankEvalRequestExample1.yaml +++ b/specification/_global/rank_eval/examples/request/RankEvalRequestExample1.yaml @@ -16,3 +16,107 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.rank_eval( + index="my-index-000001", + requests=[ + { + "id": "JFK query", + "request": { + "query": { + "match_all": {} + } + }, + "ratings": [] + } + ], + metric={ + "precision": { + "k": 20, + "relevant_rating_threshold": 1, + "ignore_unlabeled": False + } + }, + ) + - language: JavaScript + code: |- + const response = await client.rankEval({ + index: "my-index-000001", + requests: [ + { + id: "JFK query", + request: { + query: { + match_all: {}, + }, + }, + ratings: [], + }, + ], + metric: { + precision: { + k: 20, + relevant_rating_threshold: 1, + ignore_unlabeled: false, + }, + }, + }); + - language: Ruby + code: |- + response = client.rank_eval( + index: "my-index-000001", + body: { + "requests": [ + { + "id": "JFK query", + "request": { + "query": { + "match_all": {} + } + }, + "ratings": [] + } + ], + "metric": { + "precision": { + "k": 20, + "relevant_rating_threshold": 1, + "ignore_unlabeled": false + } + } + } + ) + - language: PHP + code: |- + $resp = $client->rankEval([ + "index" => "my-index-000001", + "body" => [ + "requests" => array( + [ + "id" => "JFK query", + "request" => [ + "query" => [ + "match_all" => new ArrayObject([]), + ], + ], + "ratings" => array( + ), + ], + ), + "metric" => [ + "precision" => [ + "k" => 20, + "relevant_rating_threshold" => 1, + "ignore_unlabeled" => false, + ], + ], + ], + ]); + - language: curl + code: + "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"requests\":[{\"id\":\"JFK + query\",\"request\":{\"query\":{\"match_all\":{}}},\"ratings\":[]}],\"metric\":{\"precision\":{\"k\":20,\"relevant_rating_thr\ + eshold\":1,\"ignore_unlabeled\":false}}}' \"$ELASTICSEARCH_URL/my-index-000001/_rank_eval\"" diff --git a/specification/_global/reindex/examples/request/ReindexRequestExample1.yaml b/specification/_global/reindex/examples/request/ReindexRequestExample1.yaml index 429eabfdd6..3786fc34d6 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample1.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample1.yaml @@ -1,9 +1,8 @@ summary: Reindex multiple sources method_request: POST _reindex description: > - Run `POST _reindex` to reindex from multiple sources. - The `index` attribute in source can be a list, which enables you to copy from lots of sources in one request. - This example copies documents from the `my-index-000001` and `my-index-000002` indices. + Run `POST _reindex` to reindex from multiple sources. The `index` attribute in source can be a list, which enables you to copy + from lots of sources in one request. This example copies documents from the `my-index-000001` and `my-index-000002` indices. # type: request value: |- { @@ -14,3 +13,62 @@ value: |- "index": "my-new-index-000002" } } +alternatives: + - language: Python + code: |- + resp = client.reindex( + source={ + "index": [ + "my-index-000001", + "my-index-000002" + ] + }, + dest={ + "index": "my-new-index-000002" + }, + ) + - language: JavaScript + code: |- + const response = await client.reindex({ + source: { + index: ["my-index-000001", "my-index-000002"], + }, + dest: { + index: "my-new-index-000002", + }, + }); + - language: Ruby + code: |- + response = client.reindex( + body: { + "source": { + "index": [ + "my-index-000001", + "my-index-000002" + ] + }, + "dest": { + "index": "my-new-index-000002" + } + } + ) + - language: PHP + code: |- + $resp = $client->reindex([ + "body" => [ + "source" => [ + "index" => array( + "my-index-000001", + "my-index-000002", + ), + ], + "dest" => [ + "index" => "my-new-index-000002", + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"source":{"index":["my-index-000001","my-index-000002"]},"dest":{"index":"my-new-index-000002"}}'' + "$ELASTICSEARCH_URL/_reindex"' diff --git a/specification/_global/reindex/examples/request/ReindexRequestExample10.yaml b/specification/_global/reindex/examples/request/ReindexRequestExample10.yaml index 2d63eed30a..dbeaea2d47 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample10.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample10.yaml @@ -1,12 +1,98 @@ summary: Reindex with Painless method_request: POST _reindex description: > - You can use Painless to reindex daily indices to apply a new template to the existing documents. - The script extracts the date from the index name and creates a new index with `-1` appended. - For example, all data from `metricbeat-2016.05.31` will be reindexed into `metricbeat-2016.05.31-1`. + You can use Painless to reindex daily indices to apply a new template to the existing documents. The script extracts the date from + the index name and creates a new index with `-1` appended. For example, all data from `metricbeat-2016.05.31` will be reindexed + into `metricbeat-2016.05.31-1`. # type: request -value: - "{\n \"source\": {\n \"index\": \"metricbeat-*\"\n },\n \"dest\": {\n\ - \ \"index\": \"metricbeat\"\n },\n \"script\": {\n \"lang\": \"painless\"\ - ,\n \"source\": \"ctx._index = 'metricbeat-' + (ctx._index.substring('metricbeat-'.length(),\ - \ ctx._index.length())) + '-1'\"\n }\n}" +value: "{ + + \ \"source\": { + + \ \"index\": \"metricbeat-*\" + + \ }, + + \ \"dest\": { + + \ \"index\": \"metricbeat\" + + \ }, + + \ \"script\": { + + \ \"lang\": \"painless\", + + \ \"source\": \"ctx._index = 'metricbeat-' + (ctx._index.substring('metricbeat-'.length(), ctx._index.length())) + '-1'\" + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.reindex( + source={ + "index": "metricbeat-*" + }, + dest={ + "index": "metricbeat" + }, + script={ + "lang": "painless", + "source": "ctx._index = 'metricbeat-' + (ctx._index.substring('metricbeat-'.length(), ctx._index.length())) + '-1'" + }, + ) + - language: JavaScript + code: |- + const response = await client.reindex({ + source: { + index: "metricbeat-*", + }, + dest: { + index: "metricbeat", + }, + script: { + lang: "painless", + source: + "ctx._index = 'metricbeat-' + (ctx._index.substring('metricbeat-'.length(), ctx._index.length())) + '-1'", + }, + }); + - language: Ruby + code: |- + response = client.reindex( + body: { + "source": { + "index": "metricbeat-*" + }, + "dest": { + "index": "metricbeat" + }, + "script": { + "lang": "painless", + "source": "ctx._index = 'metricbeat-' + (ctx._index.substring('metricbeat-'.length(), ctx._index.length())) + '-1'" + } + } + ) + - language: PHP + code: >- + $resp = $client->reindex([ + "body" => [ + "source" => [ + "index" => "metricbeat-*", + ], + "dest" => [ + "index" => "metricbeat", + ], + "script" => [ + "lang" => "painless", + "source" => "ctx._index = 'metricbeat-' + (ctx._index.substring('metricbeat-'.length(), ctx._index.length())) + '-1'", + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"source\":{\"index\":\"metricbeat-*\"},\"dest\":{\"index\":\"metricbeat\"},\"script\":{\"lang\":\"painless\",\"source\":\"\ + ctx._index = '\"'\"'metricbeat-'\"'\"' + (ctx._index.substring('\"'\"'metricbeat-'\"'\"'.length(), ctx._index.length())) + + '\"'\"'-1'\"'\"'\"}}' \"$ELASTICSEARCH_URL/_reindex\"" diff --git a/specification/_global/reindex/examples/request/ReindexRequestExample11.yaml b/specification/_global/reindex/examples/request/ReindexRequestExample11.yaml index b50d44b16c..d0f57bd8e8 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample11.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample11.yaml @@ -1,11 +1,113 @@ summary: Reindex a random subset method_request: POST _reindex description: > - Run `POST _reindex` to extract a random subset of the source for testing. - You might need to adjust the `min_score` value depending on the relative amount of data extracted from source. + Run `POST _reindex` to extract a random subset of the source for testing. You might need to adjust the `min_score` value depending + on the relative amount of data extracted from source. # type: request -value: - "{\n \"max_docs\": 10,\n \"source\": {\n \"index\": \"my-index-000001\"\ - ,\n \"query\": {\n \"function_score\" : {\n \"random_score\" : {},\n\ - \ \"min_score\" : 0.9\n }\n }\n },\n \"dest\": {\n \"index\"\ - : \"my-new-index-000001\"\n }\n}" +value: "{ + + \ \"max_docs\": 10, + + \ \"source\": { + + \ \"index\": \"my-index-000001\", + + \ \"query\": { + + \ \"function_score\" : { + + \ \"random_score\" : {}, + + \ \"min_score\" : 0.9 + + \ } + + \ } + + \ }, + + \ \"dest\": { + + \ \"index\": \"my-new-index-000001\" + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.reindex( + max_docs=10, + source={ + "index": "my-index-000001", + "query": { + "function_score": { + "random_score": {}, + "min_score": 0.9 + } + } + }, + dest={ + "index": "my-new-index-000001" + }, + ) + - language: JavaScript + code: |- + const response = await client.reindex({ + max_docs: 10, + source: { + index: "my-index-000001", + query: { + function_score: { + random_score: {}, + min_score: 0.9, + }, + }, + }, + dest: { + index: "my-new-index-000001", + }, + }); + - language: Ruby + code: |- + response = client.reindex( + body: { + "max_docs": 10, + "source": { + "index": "my-index-000001", + "query": { + "function_score": { + "random_score": {}, + "min_score": 0.9 + } + } + }, + "dest": { + "index": "my-new-index-000001" + } + } + ) + - language: PHP + code: |- + $resp = $client->reindex([ + "body" => [ + "max_docs" => 10, + "source" => [ + "index" => "my-index-000001", + "query" => [ + "function_score" => [ + "random_score" => new ArrayObject([]), + "min_score" => 0.9, + ], + ], + ], + "dest" => [ + "index" => "my-new-index-000001", + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"max_docs\":10,\"source\":{\"index\":\"my-index-000001\",\"query\":{\"function_score\":{\"random_score\":{},\"min_score\":\ + 0.9}}},\"dest\":{\"index\":\"my-new-index-000001\"}}' \"$ELASTICSEARCH_URL/_reindex\"" diff --git a/specification/_global/reindex/examples/request/ReindexRequestExample12.yaml b/specification/_global/reindex/examples/request/ReindexRequestExample12.yaml index 0fed8bea97..66e980472b 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample12.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample12.yaml @@ -1,11 +1,102 @@ summary: Reindex modified documents method_request: POST _reindex description: > - Run `POST _reindex` to modify documents during reindexing. - This example bumps the version of the source document. + Run `POST _reindex` to modify documents during reindexing. This example bumps the version of the source document. # type: request -value: - "{\n \"source\": {\n \"index\": \"my-index-000001\"\n },\n \"dest\":\ - \ {\n \"index\": \"my-new-index-000001\",\n \"version_type\": \"external\"\ - \n },\n \"script\": {\n \"source\": \"if (ctx._source.foo == 'bar') {ctx._version++;\ - \ ctx._source.remove('foo')}\",\n \"lang\": \"painless\"\n }\n}" +value: "{ + + \ \"source\": { + + \ \"index\": \"my-index-000001\" + + \ }, + + \ \"dest\": { + + \ \"index\": \"my-new-index-000001\", + + \ \"version_type\": \"external\" + + \ }, + + \ \"script\": { + + \ \"source\": \"if (ctx._source.foo == 'bar') {ctx._version++; ctx._source.remove('foo')}\", + + \ \"lang\": \"painless\" + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.reindex( + source={ + "index": "my-index-000001" + }, + dest={ + "index": "my-new-index-000001", + "version_type": "external" + }, + script={ + "source": "if (ctx._source.foo == 'bar') {ctx._version++; ctx._source.remove('foo')}", + "lang": "painless" + }, + ) + - language: JavaScript + code: |- + const response = await client.reindex({ + source: { + index: "my-index-000001", + }, + dest: { + index: "my-new-index-000001", + version_type: "external", + }, + script: { + source: + "if (ctx._source.foo == 'bar') {ctx._version++; ctx._source.remove('foo')}", + lang: "painless", + }, + }); + - language: Ruby + code: |- + response = client.reindex( + body: { + "source": { + "index": "my-index-000001" + }, + "dest": { + "index": "my-new-index-000001", + "version_type": "external" + }, + "script": { + "source": "if (ctx._source.foo == 'bar') {ctx._version++; ctx._source.remove('foo')}", + "lang": "painless" + } + } + ) + - language: PHP + code: |- + $resp = $client->reindex([ + "body" => [ + "source" => [ + "index" => "my-index-000001", + ], + "dest" => [ + "index" => "my-new-index-000001", + "version_type" => "external", + ], + "script" => [ + "source" => "if (ctx._source.foo == 'bar') {ctx._version++; ctx._source.remove('foo')}", + "lang" => "painless", + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"source\":{\"index\":\"my-index-000001\"},\"dest\":{\"index\":\"my-new-index-000001\",\"version_type\":\"external\"},\"scr\ + ipt\":{\"source\":\"if (ctx._source.foo == '\"'\"'bar'\"'\"') {ctx._version++; + ctx._source.remove('\"'\"'foo'\"'\"')}\",\"lang\":\"painless\"}}' \"$ELASTICSEARCH_URL/_reindex\"" diff --git a/specification/_global/reindex/examples/request/ReindexRequestExample13.yaml b/specification/_global/reindex/examples/request/ReindexRequestExample13.yaml index a38a2056ea..d0bd227d8d 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample13.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample13.yaml @@ -3,9 +3,129 @@ method_request: POST _reindex description: > When using Elastic Cloud, you can run `POST _reindex` and authenticate against a remote cluster with an API key. # type: request -value: - "{\n \"source\": {\n \"remote\": {\n \"host\": \"http://otherhost:9200\"\ - ,\n \"username\": \"user\",\n \"password\": \"pass\"\n },\n \"index\"\ - : \"my-index-000001\",\n \"query\": {\n \"match\": {\n \"test\":\ - \ \"data\"\n }\n }\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\ - \n }\n}" +value: "{ + + \ \"source\": { + + \ \"remote\": { + + \ \"host\": \"http://otherhost:9200\", + + \ \"username\": \"user\", + + \ \"password\": \"pass\" + + \ }, + + \ \"index\": \"my-index-000001\", + + \ \"query\": { + + \ \"match\": { + + \ \"test\": \"data\" + + \ } + + \ } + + \ }, + + \ \"dest\": { + + \ \"index\": \"my-new-index-000001\" + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.reindex( + source={ + "remote": { + "host": "http://otherhost:9200", + "username": "user", + "password": "pass" + }, + "index": "my-index-000001", + "query": { + "match": { + "test": "data" + } + } + }, + dest={ + "index": "my-new-index-000001" + }, + ) + - language: JavaScript + code: |- + const response = await client.reindex({ + source: { + remote: { + host: "http://otherhost:9200", + username: "user", + password: "pass", + }, + index: "my-index-000001", + query: { + match: { + test: "data", + }, + }, + }, + dest: { + index: "my-new-index-000001", + }, + }); + - language: Ruby + code: |- + response = client.reindex( + body: { + "source": { + "remote": { + "host": "http://otherhost:9200", + "username": "user", + "password": "pass" + }, + "index": "my-index-000001", + "query": { + "match": { + "test": "data" + } + } + }, + "dest": { + "index": "my-new-index-000001" + } + } + ) + - language: PHP + code: |- + $resp = $client->reindex([ + "body" => [ + "source" => [ + "remote" => [ + "host" => "http://otherhost:9200", + "username" => "user", + "password" => "pass", + ], + "index" => "my-index-000001", + "query" => [ + "match" => [ + "test" => "data", + ], + ], + ], + "dest" => [ + "index" => "my-new-index-000001", + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"source\":{\"remote\":{\"host\":\"http://otherhost:9200\",\"username\":\"user\",\"password\":\"pass\"},\"index\":\"my-inde\ + x-000001\",\"query\":{\"match\":{\"test\":\"data\"}}},\"dest\":{\"index\":\"my-new-index-000001\"}}' + \"$ELASTICSEARCH_URL/_reindex\"" diff --git a/specification/_global/reindex/examples/request/ReindexRequestExample2.yaml b/specification/_global/reindex/examples/request/ReindexRequestExample2.yaml index 9c66388f56..4287b24477 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample2.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample2.yaml @@ -1,8 +1,7 @@ summary: Manual slicing method_request: POST _reindex description: > - Run `POST _reindex` to slice a reindex request manually. - Provide a slice ID and total number of slices to each request. + Run `POST _reindex` to slice a reindex request manually. Provide a slice ID and total number of slices to each request. # type: request value: |- { @@ -17,3 +16,69 @@ value: |- "index": "my-new-index-000001" } } +alternatives: + - language: Python + code: |- + resp = client.reindex( + source={ + "index": "my-index-000001", + "slice": { + "id": 0, + "max": 2 + } + }, + dest={ + "index": "my-new-index-000001" + }, + ) + - language: JavaScript + code: |- + const response = await client.reindex({ + source: { + index: "my-index-000001", + slice: { + id: 0, + max: 2, + }, + }, + dest: { + index: "my-new-index-000001", + }, + }); + - language: Ruby + code: |- + response = client.reindex( + body: { + "source": { + "index": "my-index-000001", + "slice": { + "id": 0, + "max": 2 + } + }, + "dest": { + "index": "my-new-index-000001" + } + } + ) + - language: PHP + code: |- + $resp = $client->reindex([ + "body" => [ + "source" => [ + "index" => "my-index-000001", + "slice" => [ + "id" => 0, + "max" => 2, + ], + ], + "dest" => [ + "index" => "my-new-index-000001", + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"source":{"index":"my-index-000001","slice":{"id":0,"max":2}},"dest":{"index":"my-new-index-000001"}}'' + "$ELASTICSEARCH_URL/_reindex"' diff --git a/specification/_global/reindex/examples/request/ReindexRequestExample3.yaml b/specification/_global/reindex/examples/request/ReindexRequestExample3.yaml index 4aa3f18b11..9d7d697f53 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample3.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample3.yaml @@ -1,9 +1,79 @@ summary: Automatic slicing method_request: POST _reindex?slices=5&refresh description: > - Run `POST _reindex?slices=5&refresh` to automatically parallelize using sliced scroll to slice on `_id`. - The `slices` parameter specifies the number of slices to use. + Run `POST _reindex?slices=5&refresh` to automatically parallelize using sliced scroll to slice on `_id`. The `slices` parameter + specifies the number of slices to use. # type: request -value: - "{\n \"source\": {\n \"index\": \"my-index-000001\"\n },\n \"dest\":\ - \ {\n \"index\": \"my-new-index-000001\"\n }\n}" +value: "{ + + \ \"source\": { + + \ \"index\": \"my-index-000001\" + + \ }, + + \ \"dest\": { + + \ \"index\": \"my-new-index-000001\" + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.reindex( + slices="5", + refresh=True, + source={ + "index": "my-index-000001" + }, + dest={ + "index": "my-new-index-000001" + }, + ) + - language: JavaScript + code: |- + const response = await client.reindex({ + slices: 5, + refresh: "true", + source: { + index: "my-index-000001", + }, + dest: { + index: "my-new-index-000001", + }, + }); + - language: Ruby + code: |- + response = client.reindex( + slices: "5", + refresh: "true", + body: { + "source": { + "index": "my-index-000001" + }, + "dest": { + "index": "my-new-index-000001" + } + } + ) + - language: PHP + code: |- + $resp = $client->reindex([ + "slices" => "5", + "refresh" => "true", + "body" => [ + "source" => [ + "index" => "my-index-000001", + ], + "dest" => [ + "index" => "my-new-index-000001", + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"source":{"index":"my-index-000001"},"dest":{"index":"my-new-index-000001"}}'' + "$ELASTICSEARCH_URL/_reindex?slices=5&refresh"' diff --git a/specification/_global/reindex/examples/request/ReindexRequestExample4.yaml b/specification/_global/reindex/examples/request/ReindexRequestExample4.yaml index 7943055f36..cf9ac7468e 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample4.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample4.yaml @@ -1,11 +1,108 @@ summary: Routing method_request: POST _reindex description: > - By default if reindex sees a document with routing then the routing is preserved unless it's changed by the script. - You can set `routing` on the `dest` request to change this behavior. - In this example, run `POST _reindex` to copy all documents from the `source` with the company name `cat` into the `dest` with routing set to `cat`. + By default if reindex sees a document with routing then the routing is preserved unless it's changed by the script. You can set + `routing` on the `dest` request to change this behavior. In this example, run `POST _reindex` to copy all documents from the + `source` with the company name `cat` into the `dest` with routing set to `cat`. # type: request -value: - "{\n \"source\": {\n \"index\": \"source\",\n \"query\": {\n \"\ - match\": {\n \"company\": \"cat\"\n }\n }\n },\n \"dest\": {\n\ - \ \"index\": \"dest\",\n \"routing\": \"=cat\"\n }\n}" +value: "{ + + \ \"source\": { + + \ \"index\": \"source\", + + \ \"query\": { + + \ \"match\": { + + \ \"company\": \"cat\" + + \ } + + \ } + + \ }, + + \ \"dest\": { + + \ \"index\": \"dest\", + + \ \"routing\": \"=cat\" + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.reindex( + source={ + "index": "source", + "query": { + "match": { + "company": "cat" + } + } + }, + dest={ + "index": "dest", + "routing": "=cat" + }, + ) + - language: JavaScript + code: |- + const response = await client.reindex({ + source: { + index: "source", + query: { + match: { + company: "cat", + }, + }, + }, + dest: { + index: "dest", + routing: "=cat", + }, + }); + - language: Ruby + code: |- + response = client.reindex( + body: { + "source": { + "index": "source", + "query": { + "match": { + "company": "cat" + } + } + }, + "dest": { + "index": "dest", + "routing": "=cat" + } + } + ) + - language: PHP + code: |- + $resp = $client->reindex([ + "body" => [ + "source" => [ + "index" => "source", + "query" => [ + "match" => [ + "company" => "cat", + ], + ], + ], + "dest" => [ + "index" => "dest", + "routing" => "=cat", + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"source\":{\"index\":\"source\",\"query\":{\"match\":{\"company\":\"cat\"}}},\"dest\":{\"index\":\"dest\",\"routing\":\"=c\ + at\"}}' \"$ELASTICSEARCH_URL/_reindex\"" diff --git a/specification/_global/reindex/examples/request/ReindexRequestExample5.yaml b/specification/_global/reindex/examples/request/ReindexRequestExample5.yaml index 46ad4380bf..4bf87ee51f 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample5.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample5.yaml @@ -2,6 +2,74 @@ summary: Ingest pipelines method_request: POST _reindex description: Run `POST _reindex` and use the ingest pipelines feature. # type: request -value: - "{\n \"source\": {\n \"index\": \"source\"\n },\n \"dest\": {\n \"\ - index\": \"dest\",\n \"pipeline\": \"some_ingest_pipeline\"\n }\n}" +value: "{ + + \ \"source\": { + + \ \"index\": \"source\" + + \ }, + + \ \"dest\": { + + \ \"index\": \"dest\", + + \ \"pipeline\": \"some_ingest_pipeline\" + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.reindex( + source={ + "index": "source" + }, + dest={ + "index": "dest", + "pipeline": "some_ingest_pipeline" + }, + ) + - language: JavaScript + code: |- + const response = await client.reindex({ + source: { + index: "source", + }, + dest: { + index: "dest", + pipeline: "some_ingest_pipeline", + }, + }); + - language: Ruby + code: |- + response = client.reindex( + body: { + "source": { + "index": "source" + }, + "dest": { + "index": "dest", + "pipeline": "some_ingest_pipeline" + } + } + ) + - language: PHP + code: |- + $resp = $client->reindex([ + "body" => [ + "source" => [ + "index" => "source", + ], + "dest" => [ + "index" => "dest", + "pipeline" => "some_ingest_pipeline", + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"source":{"index":"source"},"dest":{"index":"dest","pipeline":"some_ingest_pipeline"}}'' + "$ELASTICSEARCH_URL/_reindex"' diff --git a/specification/_global/reindex/examples/request/ReindexRequestExample6.yaml b/specification/_global/reindex/examples/request/ReindexRequestExample6.yaml index cb56a4573f..bffcabbf6b 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample6.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample6.yaml @@ -1,10 +1,101 @@ summary: Reindex with a query method_request: POST _reindex description: > - Run `POST _reindex` and add a query to the `source` to limit the documents to reindex. - For example, this request copies documents into `my-new-index-000001` only if they have a `user.id` of `kimchy`. + Run `POST _reindex` and add a query to the `source` to limit the documents to reindex. For example, this request copies documents + into `my-new-index-000001` only if they have a `user.id` of `kimchy`. # type: request -value: - "{\n \"source\": {\n \"index\": \"my-index-000001\",\n \"query\": {\n\ - \ \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n },\n \"\ - dest\": {\n \"index\": \"my-new-index-000001\"\n }\n}" +value: "{ + + \ \"source\": { + + \ \"index\": \"my-index-000001\", + + \ \"query\": { + + \ \"term\": { + + \ \"user.id\": \"kimchy\" + + \ } + + \ } + + \ }, + + \ \"dest\": { + + \ \"index\": \"my-new-index-000001\" + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.reindex( + source={ + "index": "my-index-000001", + "query": { + "term": { + "user.id": "kimchy" + } + } + }, + dest={ + "index": "my-new-index-000001" + }, + ) + - language: JavaScript + code: |- + const response = await client.reindex({ + source: { + index: "my-index-000001", + query: { + term: { + "user.id": "kimchy", + }, + }, + }, + dest: { + index: "my-new-index-000001", + }, + }); + - language: Ruby + code: |- + response = client.reindex( + body: { + "source": { + "index": "my-index-000001", + "query": { + "term": { + "user.id": "kimchy" + } + } + }, + "dest": { + "index": "my-new-index-000001" + } + } + ) + - language: PHP + code: |- + $resp = $client->reindex([ + "body" => [ + "source" => [ + "index" => "my-index-000001", + "query" => [ + "term" => [ + "user.id" => "kimchy", + ], + ], + ], + "dest" => [ + "index" => "my-new-index-000001", + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"source\":{\"index\":\"my-index-000001\",\"query\":{\"term\":{\"user.id\":\"kimchy\"}}},\"dest\":{\"index\":\"my-new-index\ + -000001\"}}' \"$ELASTICSEARCH_URL/_reindex\"" diff --git a/specification/_global/reindex/examples/request/ReindexRequestExample7.yaml b/specification/_global/reindex/examples/request/ReindexRequestExample7.yaml index 8bce8efb9c..bf5afbe09d 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample7.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample7.yaml @@ -1,9 +1,77 @@ summary: Reindex with max_docs method_request: POST _reindex description: > - You can limit the number of processed documents by setting `max_docs`. - For example, run `POST _reindex` to copy a single document from `my-index-000001` to `my-new-index-000001`. + You can limit the number of processed documents by setting `max_docs`. For example, run `POST _reindex` to copy a single document + from `my-index-000001` to `my-new-index-000001`. # type: request -value: - "{\n \"max_docs\": 1,\n \"source\": {\n \"index\": \"my-index-000001\"\ - \n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n }\n}" +value: "{ + + \ \"max_docs\": 1, + + \ \"source\": { + + \ \"index\": \"my-index-000001\" + + \ }, + + \ \"dest\": { + + \ \"index\": \"my-new-index-000001\" + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.reindex( + max_docs=1, + source={ + "index": "my-index-000001" + }, + dest={ + "index": "my-new-index-000001" + }, + ) + - language: JavaScript + code: |- + const response = await client.reindex({ + max_docs: 1, + source: { + index: "my-index-000001", + }, + dest: { + index: "my-new-index-000001", + }, + }); + - language: Ruby + code: |- + response = client.reindex( + body: { + "max_docs": 1, + "source": { + "index": "my-index-000001" + }, + "dest": { + "index": "my-new-index-000001" + } + } + ) + - language: PHP + code: |- + $resp = $client->reindex([ + "body" => [ + "max_docs" => 1, + "source" => [ + "index" => "my-index-000001", + ], + "dest" => [ + "index" => "my-new-index-000001", + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"max_docs":1,"source":{"index":"my-index-000001"},"dest":{"index":"my-new-index-000001"}}'' + "$ELASTICSEARCH_URL/_reindex"' diff --git a/specification/_global/reindex/examples/request/ReindexRequestExample8.yaml b/specification/_global/reindex/examples/request/ReindexRequestExample8.yaml index bfc65d8609..549eb679e0 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample8.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample8.yaml @@ -1,10 +1,86 @@ summary: Reindex selected fields method_request: POST _reindex description: > - You can use source filtering to reindex a subset of the fields in the original documents. - For example, run `POST _reindex` the reindex only the `user.id` and `_doc` fields of each document. + You can use source filtering to reindex a subset of the fields in the original documents. For example, run `POST _reindex` the + reindex only the `user.id` and `_doc` fields of each document. # type: request -value: - "{\n \"source\": {\n \"index\": \"my-index-000001\",\n \"_source\":\ - \ [\"user.id\", \"_doc\"]\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\ - \n }\n}" +value: "{ + + \ \"source\": { + + \ \"index\": \"my-index-000001\", + + \ \"_source\": [\"user.id\", \"_doc\"] + + \ }, + + \ \"dest\": { + + \ \"index\": \"my-new-index-000001\" + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.reindex( + source={ + "index": "my-index-000001", + "_source": [ + "user.id", + "_doc" + ] + }, + dest={ + "index": "my-new-index-000001" + }, + ) + - language: JavaScript + code: |- + const response = await client.reindex({ + source: { + index: "my-index-000001", + _source: ["user.id", "_doc"], + }, + dest: { + index: "my-new-index-000001", + }, + }); + - language: Ruby + code: |- + response = client.reindex( + body: { + "source": { + "index": "my-index-000001", + "_source": [ + "user.id", + "_doc" + ] + }, + "dest": { + "index": "my-new-index-000001" + } + } + ) + - language: PHP + code: |- + $resp = $client->reindex([ + "body" => [ + "source" => [ + "index" => "my-index-000001", + "_source" => array( + "user.id", + "_doc", + ), + ], + "dest" => [ + "index" => "my-new-index-000001", + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"source":{"index":"my-index-000001","_source":["user.id","_doc"]},"dest":{"index":"my-new-index-000001"}}'' + "$ELASTICSEARCH_URL/_reindex"' diff --git a/specification/_global/reindex/examples/request/ReindexRequestExample9.yaml b/specification/_global/reindex/examples/request/ReindexRequestExample9.yaml index d7b14ffcb2..a45b9f8dfc 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample9.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample9.yaml @@ -1,10 +1,89 @@ summary: Reindex new field names method_request: POST _reindex description: > - A reindex operation can build a copy of an index with renamed fields. - If your index has documents with `text` and `flag` fields, you can change the latter field name to `tag` during the reindex. + A reindex operation can build a copy of an index with renamed fields. If your index has documents with `text` and `flag` fields, + you can change the latter field name to `tag` during the reindex. # type: request -value: - "{\n \"source\": {\n \"index\": \"my-index-000001\"\n },\n \"dest\":\ - \ {\n \"index\": \"my-new-index-000001\"\n },\n \"script\": {\n \"source\"\ - : \"ctx._source.tag = ctx._source.remove(\\\"flag\\\")\"\n }\n}" +value: "{ + + \ \"source\": { + + \ \"index\": \"my-index-000001\" + + \ }, + + \ \"dest\": { + + \ \"index\": \"my-new-index-000001\" + + \ }, + + \ \"script\": { + + \ \"source\": \"ctx._source.tag = ctx._source.remove(\\\"flag\\\")\" + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.reindex( + source={ + "index": "my-index-000001" + }, + dest={ + "index": "my-new-index-000001" + }, + script={ + "source": "ctx._source.tag = ctx._source.remove(\"flag\")" + }, + ) + - language: JavaScript + code: |- + const response = await client.reindex({ + source: { + index: "my-index-000001", + }, + dest: { + index: "my-new-index-000001", + }, + script: { + source: 'ctx._source.tag = ctx._source.remove("flag")', + }, + }); + - language: Ruby + code: |- + response = client.reindex( + body: { + "source": { + "index": "my-index-000001" + }, + "dest": { + "index": "my-new-index-000001" + }, + "script": { + "source": "ctx._source.tag = ctx._source.remove(\"flag\")" + } + } + ) + - language: PHP + code: |- + $resp = $client->reindex([ + "body" => [ + "source" => [ + "index" => "my-index-000001", + ], + "dest" => [ + "index" => "my-new-index-000001", + ], + "script" => [ + "source" => "ctx._source.tag = ctx._source.remove(\"flag\")", + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"source\":{\"index\":\"my-index-000001\"},\"dest\":{\"index\":\"my-new-index-000001\"},\"script\":{\"source\":\"ctx._sourc\ + e.tag = ctx._source.remove(\\\"flag\\\")\"}}' \"$ELASTICSEARCH_URL/_reindex\"" diff --git a/specification/_global/reindex_rethrottle/examples/request/ReindexRethrottleRequestExample1.yaml b/specification/_global/reindex_rethrottle/examples/request/ReindexRethrottleRequestExample1.yaml index c4361e9be7..f69b4fe1a4 100644 --- a/specification/_global/reindex_rethrottle/examples/request/ReindexRethrottleRequestExample1.yaml +++ b/specification/_global/reindex_rethrottle/examples/request/ReindexRethrottleRequestExample1.yaml @@ -1 +1,29 @@ method_request: POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1 +alternatives: + - language: Python + code: |- + resp = client.reindex_rethrottle( + task_id="r1A2WoRbTwKZ516z6NEs5A:36619", + requests_per_second="-1", + ) + - language: JavaScript + code: |- + const response = await client.reindexRethrottle({ + task_id: "r1A2WoRbTwKZ516z6NEs5A:36619", + requests_per_second: "-1", + }); + - language: Ruby + code: |- + response = client.reindex_rethrottle( + task_id: "r1A2WoRbTwKZ516z6NEs5A:36619", + requests_per_second: "-1" + ) + - language: PHP + code: |- + $resp = $client->reindexRethrottle([ + "task_id" => "r1A2WoRbTwKZ516z6NEs5A:36619", + "requests_per_second" => "-1", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1"' diff --git a/specification/_global/render_search_template/examples/request/RenderSearchTemplateRequestExample1.yaml b/specification/_global/render_search_template/examples/request/RenderSearchTemplateRequestExample1.yaml index 7c3e4bee47..523d01b91a 100644 --- a/specification/_global/render_search_template/examples/request/RenderSearchTemplateRequestExample1.yaml +++ b/specification/_global/render_search_template/examples/request/RenderSearchTemplateRequestExample1.yaml @@ -11,3 +11,53 @@ value: |- "size": 10 } } +alternatives: + - language: Python + code: |- + resp = client.render_search_template( + id="my-search-template", + params={ + "query_string": "hello world", + "from": 20, + "size": 10 + }, + ) + - language: JavaScript + code: |- + const response = await client.renderSearchTemplate({ + id: "my-search-template", + params: { + query_string: "hello world", + from: 20, + size: 10, + }, + }); + - language: Ruby + code: |- + response = client.render_search_template( + body: { + "id": "my-search-template", + "params": { + "query_string": "hello world", + "from": 20, + "size": 10 + } + } + ) + - language: PHP + code: |- + $resp = $client->renderSearchTemplate([ + "body" => [ + "id" => "my-search-template", + "params" => [ + "query_string" => "hello world", + "from" => 20, + "size" => 10, + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"id":"my-search-template","params":{"query_string":"hello world","from":20,"size":10}}'' + "$ELASTICSEARCH_URL/_render/template"' diff --git a/specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample1.yaml b/specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample1.yaml index 8fbcb96bd9..357732595a 100644 --- a/specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample1.yaml +++ b/specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample1.yaml @@ -1,11 +1,9 @@ summary: Test context method_request: POST /_scripts/painless/_execute description: > - Run `POST /_scripts/painless/_execute`. - The `painless_test` context is the default context. - It runs scripts without additional parameters. - The only variable that is available is `params`, which can be used to access user defined values. - The result of the script is always converted to a string. + Run `POST /_scripts/painless/_execute`. The `painless_test` context is the default context. It runs scripts without additional + parameters. The only variable that is available is `params`, which can be used to access user defined values. The result of the + script is always converted to a string. # type: request value: |- { @@ -17,3 +15,57 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.scripts_painless_execute( + script={ + "source": "params.count / params.total", + "params": { + "count": 100, + "total": 1000 + } + }, + ) + - language: JavaScript + code: |- + const response = await client.scriptsPainlessExecute({ + script: { + source: "params.count / params.total", + params: { + count: 100, + total: 1000, + }, + }, + }); + - language: Ruby + code: |- + response = client.scripts_painless_execute( + body: { + "script": { + "source": "params.count / params.total", + "params": { + "count": 100, + "total": 1000 + } + } + } + ) + - language: PHP + code: |- + $resp = $client->scriptsPainlessExecute([ + "body" => [ + "script" => [ + "source" => "params.count / params.total", + "params" => [ + "count" => 100, + "total" => 1000, + ], + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"script":{"source":"params.count / params.total","params":{"count":100,"total":1000}}}'' + "$ELASTICSEARCH_URL/_scripts/painless/_execute"' diff --git a/specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample2.yaml b/specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample2.yaml index 404566416d..6f273adc63 100644 --- a/specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample2.yaml +++ b/specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample2.yaml @@ -1,9 +1,8 @@ summary: Filter context method_request: POST /_scripts/painless/_execute description: > - Run `POST /_scripts/painless/_execute` with a `filter` context. - It treats scripts as if they were run inside a script query. - For testing purposes, a document must be provided so that it will be temporarily indexed in-memory and is accessible from the script. + Run `POST /_scripts/painless/_execute` with a `filter` context. It treats scripts as if they were run inside a script query. For + testing purposes, a document must be provided so that it will be temporarily indexed in-memory and is accessible from the script. More precisely, the `_source`, stored fields, and doc values of such a document are available to the script being tested. # type: request value: |- @@ -22,3 +21,82 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.scripts_painless_execute( + script={ + "source": "doc['field'].value.length() <= params.max_length", + "params": { + "max_length": 4 + } + }, + context="filter", + context_setup={ + "index": "my-index-000001", + "document": { + "field": "four" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.scriptsPainlessExecute({ + script: { + source: "doc['field'].value.length() <= params.max_length", + params: { + max_length: 4, + }, + }, + context: "filter", + context_setup: { + index: "my-index-000001", + document: { + field: "four", + }, + }, + }); + - language: Ruby + code: |- + response = client.scripts_painless_execute( + body: { + "script": { + "source": "doc['field'].value.length() <= params.max_length", + "params": { + "max_length": 4 + } + }, + "context": "filter", + "context_setup": { + "index": "my-index-000001", + "document": { + "field": "four" + } + } + } + ) + - language: PHP + code: |- + $resp = $client->scriptsPainlessExecute([ + "body" => [ + "script" => [ + "source" => "doc['field'].value.length() <= params.max_length", + "params" => [ + "max_length" => 4, + ], + ], + "context" => "filter", + "context_setup" => [ + "index" => "my-index-000001", + "document" => [ + "field" => "four", + ], + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"script\":{\"source\":\"doc['\"'\"'field'\"'\"'].value.length() <= + params.max_length\",\"params\":{\"max_length\":4}},\"context\":\"filter\",\"context_setup\":{\"index\":\"my-index-000001\",\"\ + document\":{\"field\":\"four\"}}}' \"$ELASTICSEARCH_URL/_scripts/painless/_execute\"" diff --git a/specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample3.yaml b/specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample3.yaml index e200f02b5d..3f4f823904 100644 --- a/specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample3.yaml +++ b/specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample3.yaml @@ -1,8 +1,8 @@ summary: Score context method_request: POST /_scripts/painless/_execute description: > - Run `POST /_scripts/painless/_execute` with a `score` context. - It treats scripts as if they were run inside a `script_score` function in a `function_score` query. + Run `POST /_scripts/painless/_execute` with a `score` context. It treats scripts as if they were run inside a `script_score` + function in a `function_score` query. # type: request value: |- { @@ -20,3 +20,82 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.scripts_painless_execute( + script={ + "source": "doc['rank'].value / params.max_rank", + "params": { + "max_rank": 5 + } + }, + context="score", + context_setup={ + "index": "my-index-000001", + "document": { + "rank": 4 + } + }, + ) + - language: JavaScript + code: |- + const response = await client.scriptsPainlessExecute({ + script: { + source: "doc['rank'].value / params.max_rank", + params: { + max_rank: 5, + }, + }, + context: "score", + context_setup: { + index: "my-index-000001", + document: { + rank: 4, + }, + }, + }); + - language: Ruby + code: |- + response = client.scripts_painless_execute( + body: { + "script": { + "source": "doc['rank'].value / params.max_rank", + "params": { + "max_rank": 5 + } + }, + "context": "score", + "context_setup": { + "index": "my-index-000001", + "document": { + "rank": 4 + } + } + } + ) + - language: PHP + code: |- + $resp = $client->scriptsPainlessExecute([ + "body" => [ + "script" => [ + "source" => "doc['rank'].value / params.max_rank", + "params" => [ + "max_rank" => 5, + ], + ], + "context" => "score", + "context_setup" => [ + "index" => "my-index-000001", + "document" => [ + "rank" => 4, + ], + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"script\":{\"source\":\"doc['\"'\"'rank'\"'\"'].value / + params.max_rank\",\"params\":{\"max_rank\":5}},\"context\":\"score\",\"context_setup\":{\"index\":\"my-index-000001\",\"docum\ + ent\":{\"rank\":4}}}' \"$ELASTICSEARCH_URL/_scripts/painless/_execute\"" diff --git a/specification/_global/scroll/examples/request/ScrollRequestExample1.yaml b/specification/_global/scroll/examples/request/ScrollRequestExample1.yaml index 04f3ff98b3..4c19167c6b 100644 --- a/specification/_global/scroll/examples/request/ScrollRequestExample1.yaml +++ b/specification/_global/scroll/examples/request/ScrollRequestExample1.yaml @@ -6,3 +6,32 @@ value: |- { "scroll_id" : "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==" } +alternatives: + - language: Python + code: |- + resp = client.scroll( + scroll_id="DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==", + ) + - language: JavaScript + code: |- + const response = await client.scroll({ + scroll_id: "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==", + }); + - language: Ruby + code: |- + response = client.scroll( + body: { + "scroll_id": "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==" + } + ) + - language: PHP + code: |- + $resp = $client->scroll([ + "body" => [ + "scroll_id" => "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==", + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"scroll_id":"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ=="}'' "$ELASTICSEARCH_URL/_search/scroll"' diff --git a/specification/_global/search/examples/request/SearchRequestExample1.yaml b/specification/_global/search/examples/request/SearchRequestExample1.yaml index f3867f117d..eb56c23097 100644 --- a/specification/_global/search/examples/request/SearchRequestExample1.yaml +++ b/specification/_global/search/examples/request/SearchRequestExample1.yaml @@ -11,3 +11,60 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.search( + index="my-index-000001", + from="40", + size="20", + query={ + "term": { + "user.id": "kimchy" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.search({ + index: "my-index-000001", + from: 40, + size: 20, + query: { + term: { + "user.id": "kimchy", + }, + }, + }); + - language: Ruby + code: |- + response = client.search( + index: "my-index-000001", + from: "40", + size: "20", + body: { + "query": { + "term": { + "user.id": "kimchy" + } + } + } + ) + - language: PHP + code: |- + $resp = $client->search([ + "index" => "my-index-000001", + "from" => "40", + "size" => "20", + "body" => [ + "query" => [ + "term" => [ + "user.id" => "kimchy", + ], + ], + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"query":{"term":{"user.id":"kimchy"}}}'' "$ELASTICSEARCH_URL/my-index-000001/_search?from=40&size=20"' diff --git a/specification/_global/search/examples/request/SearchRequestExample2.yaml b/specification/_global/search/examples/request/SearchRequestExample2.yaml index 111c2eae0f..9e81e593bc 100644 --- a/specification/_global/search/examples/request/SearchRequestExample2.yaml +++ b/specification/_global/search/examples/request/SearchRequestExample2.yaml @@ -1,9 +1,9 @@ summary: A point in time search method_request: POST /_search description: > - Run `POST /_search` to run a point in time search. - The `id` parameter tells Elasticsearch to run the request using contexts from this open point in time. - The `keep_alive` parameter tells Elasticsearch how long it should extend the time to live of the point in time. + Run `POST /_search` to run a point in time search. The `id` parameter tells Elasticsearch to run the request using contexts from + this open point in time. The `keep_alive` parameter tells Elasticsearch how long it should extend the time to live of the point in + time. # type: request value: |- { @@ -18,3 +18,70 @@ value: |- "keep_alive": "1m" } } +alternatives: + - language: Python + code: >- + resp = client.search( + size=100, + query={ + "match": { + "title": "elasticsearch" + } + }, + pit={ + "id": "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==", + "keep_alive": "1m" + }, + ) + - language: JavaScript + code: >- + const response = await client.search({ + size: 100, + query: { + match: { + title: "elasticsearch", + }, + }, + pit: { + id: "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==", + keep_alive: "1m", + }, + }); + - language: Ruby + code: >- + response = client.search( + body: { + "size": 100, + "query": { + "match": { + "title": "elasticsearch" + } + }, + "pit": { + "id": "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==", + "keep_alive": "1m" + } + } + ) + - language: PHP + code: >- + $resp = $client->search([ + "body" => [ + "size" => 100, + "query" => [ + "match" => [ + "title" => "elasticsearch", + ], + ], + "pit" => [ + "id" => "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==", + "keep_alive" => "1m", + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"size\":100,\"query\":{\"match\":{\"title\":\"elasticsearch\"}},\"pit\":{\"id\":\"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAA\ + ACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_g\ + AAAAA==\",\"keep_alive\":\"1m\"}}' \"$ELASTICSEARCH_URL/_search\"" diff --git a/specification/_global/search/examples/request/SearchRequestExample3.yaml b/specification/_global/search/examples/request/SearchRequestExample3.yaml index 3cf5ca695f..1fda26daa2 100644 --- a/specification/_global/search/examples/request/SearchRequestExample3.yaml +++ b/specification/_global/search/examples/request/SearchRequestExample3.yaml @@ -1,10 +1,10 @@ summary: Search slicing method_request: GET /_search description: > - When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently. - The result from running the first `GET /_search` request returns documents belonging to the first slice (`id: 0`). - If you run a second request with `id` set to `1', it returns documents in the second slice. - Since the maximum number of slices is set to `2`, the union of the results is equivalent to the results of a point-in-time search without slicing. + When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them + independently. The result from running the first `GET /_search` request returns documents belonging to the first slice (`id: 0`). + If you run a second request with `id` set to `1', it returns documents in the second slice. Since the maximum number of slices is + set to `2`, the union of the results is equivalent to the results of a point-in-time search without slicing. # type: request value: |- { @@ -21,3 +21,78 @@ value: |- "id": "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==" } } +alternatives: + - language: Python + code: >- + resp = client.search( + slice={ + "id": 0, + "max": 2 + }, + query={ + "match": { + "message": "foo" + } + }, + pit={ + "id": "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==" + }, + ) + - language: JavaScript + code: >- + const response = await client.search({ + slice: { + id: 0, + max: 2, + }, + query: { + match: { + message: "foo", + }, + }, + pit: { + id: "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==", + }, + }); + - language: Ruby + code: >- + response = client.search( + body: { + "slice": { + "id": 0, + "max": 2 + }, + "query": { + "match": { + "message": "foo" + } + }, + "pit": { + "id": "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==" + } + } + ) + - language: PHP + code: >- + $resp = $client->search([ + "body" => [ + "slice" => [ + "id" => 0, + "max" => 2, + ], + "query" => [ + "match" => [ + "message" => "foo", + ], + ], + "pit" => [ + "id" => "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==", + ], + ], + ]); + - language: curl + code: + "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"slice\":{\"id\":0,\"max\":2},\"query\":{\"match\":{\"message\":\"foo\"}},\"pit\":{\"id\":\"46ToAwMDaWR5BXV1aWQyKwZub2RlXz\ + MAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXR\ + jaF9hbGw_gAAAAA==\"}}' \"$ELASTICSEARCH_URL/_search\"" diff --git a/specification/_global/search_mvt/examples/request/SearchMvtRequestExample1.yaml b/specification/_global/search_mvt/examples/request/SearchMvtRequestExample1.yaml index b750a37e70..394cd80465 100644 --- a/specification/_global/search_mvt/examples/request/SearchMvtRequestExample1.yaml +++ b/specification/_global/search_mvt/examples/request/SearchMvtRequestExample1.yaml @@ -1,7 +1,8 @@ # summary: method_request: 'GET museums/_mvt/location/13/4207/2692' description: > - Run `GET museums/_mvt/location/13/4207/2692` to search an index for `location` values that intersect the `13/4207/2692` vector tile. + Run `GET museums/_mvt/location/13/4207/2692` to search an index for `location` values that intersect the `13/4207/2692` vector + tile. # type: "request" value: |- { @@ -34,3 +35,159 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.search_mvt( + index="museums", + field="location", + zoom="13", + x="4207", + y="2692", + grid_agg="geotile", + grid_precision=2, + fields=[ + "name", + "price" + ], + query={ + "term": { + "included": True + } + }, + aggs={ + "min_price": { + "min": { + "field": "price" + } + }, + "max_price": { + "max": { + "field": "price" + } + }, + "avg_price": { + "avg": { + "field": "price" + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.searchMvt({ + index: "museums", + field: "location", + zoom: 13, + x: 4207, + y: 2692, + grid_agg: "geotile", + grid_precision: 2, + fields: ["name", "price"], + query: { + term: { + included: true, + }, + }, + aggs: { + min_price: { + min: { + field: "price", + }, + }, + max_price: { + max: { + field: "price", + }, + }, + avg_price: { + avg: { + field: "price", + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.search_mvt( + index: "museums", + field: "location", + zoom: "13", + x: "4207", + y: "2692", + body: { + "grid_agg": "geotile", + "grid_precision": 2, + "fields": [ + "name", + "price" + ], + "query": { + "term": { + "included": true + } + }, + "aggs": { + "min_price": { + "min": { + "field": "price" + } + }, + "max_price": { + "max": { + "field": "price" + } + }, + "avg_price": { + "avg": { + "field": "price" + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->searchMvt([ + "index" => "museums", + "field" => "location", + "zoom" => "13", + "x" => "4207", + "y" => "2692", + "body" => [ + "grid_agg" => "geotile", + "grid_precision" => 2, + "fields" => array( + "name", + "price", + ), + "query" => [ + "term" => [ + "included" => true, + ], + ], + "aggs" => [ + "min_price" => [ + "min" => [ + "field" => "price", + ], + ], + "max_price" => [ + "max" => [ + "field" => "price", + ], + ], + "avg_price" => [ + "avg" => [ + "field" => "price", + ], + ], + ], + ], + ]); + - language: curl + code: + "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"grid_agg\":\"geotile\",\"grid_precision\":2,\"fields\":[\"name\",\"price\"],\"query\":{\"term\":{\"included\":true}},\"ag\ + gs\":{\"min_price\":{\"min\":{\"field\":\"price\"}},\"max_price\":{\"max\":{\"field\":\"price\"}},\"avg_price\":{\"avg\":{\"f\ + ield\":\"price\"}}}}' \"$ELASTICSEARCH_URL/museums/_mvt/location/13/4207/2692\"" diff --git a/specification/_global/search_shards/examples/request/SearchShardsRequestExample1.yaml b/specification/_global/search_shards/examples/request/SearchShardsRequestExample1.yaml index efa6600543..2ffc8c6e25 100644 --- a/specification/_global/search_shards/examples/request/SearchShardsRequestExample1.yaml +++ b/specification/_global/search_shards/examples/request/SearchShardsRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET /my-index-000001/_search_shards +alternatives: + - language: Python + code: |- + resp = client.search_shards( + index="my-index-000001", + ) + - language: JavaScript + code: |- + const response = await client.searchShards({ + index: "my-index-000001", + }); + - language: Ruby + code: |- + response = client.search_shards( + index: "my-index-000001" + ) + - language: PHP + code: |- + $resp = $client->searchShards([ + "index" => "my-index-000001", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index-000001/_search_shards"' diff --git a/specification/_global/search_template/examples/request/SearchTemplateRequestExample1.yaml b/specification/_global/search_template/examples/request/SearchTemplateRequestExample1.yaml index 000c63b523..a1b4cf18b9 100644 --- a/specification/_global/search_template/examples/request/SearchTemplateRequestExample1.yaml +++ b/specification/_global/search_template/examples/request/SearchTemplateRequestExample1.yaml @@ -12,3 +12,57 @@ value: |- "size": 10 } } +alternatives: + - language: Python + code: |- + resp = client.search_template( + index="my-index", + id="my-search-template", + params={ + "query_string": "hello world", + "from": 0, + "size": 10 + }, + ) + - language: JavaScript + code: |- + const response = await client.searchTemplate({ + index: "my-index", + id: "my-search-template", + params: { + query_string: "hello world", + from: 0, + size: 10, + }, + }); + - language: Ruby + code: |- + response = client.search_template( + index: "my-index", + body: { + "id": "my-search-template", + "params": { + "query_string": "hello world", + "from": 0, + "size": 10 + } + } + ) + - language: PHP + code: |- + $resp = $client->searchTemplate([ + "index" => "my-index", + "body" => [ + "id" => "my-search-template", + "params" => [ + "query_string" => "hello world", + "from" => 0, + "size" => 10, + ], + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"id":"my-search-template","params":{"query_string":"hello world","from":0,"size":10}}'' + "$ELASTICSEARCH_URL/my-index/_search/template"' diff --git a/specification/_global/terms_enum/examples/request/TermsEnumRequestExample1.yaml b/specification/_global/terms_enum/examples/request/TermsEnumRequestExample1.yaml index 9c854e9b29..73ec007784 100644 --- a/specification/_global/terms_enum/examples/request/TermsEnumRequestExample1.yaml +++ b/specification/_global/terms_enum/examples/request/TermsEnumRequestExample1.yaml @@ -7,3 +7,40 @@ value: |- "field" : "tags", "string" : "kiba" } +alternatives: + - language: Python + code: |- + resp = client.terms_enum( + index="stackoverflow", + field="tags", + string="kiba", + ) + - language: JavaScript + code: |- + const response = await client.termsEnum({ + index: "stackoverflow", + field: "tags", + string: "kiba", + }); + - language: Ruby + code: |- + response = client.terms_enum( + index: "stackoverflow", + body: { + "field": "tags", + "string": "kiba" + } + ) + - language: PHP + code: |- + $resp = $client->termsEnum([ + "index" => "stackoverflow", + "body" => [ + "field" => "tags", + "string" => "kiba", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"field":"tags","string":"kiba"}'' "$ELASTICSEARCH_URL/stackoverflow/_terms_enum"' diff --git a/specification/_global/termvectors/examples/request/TermVectorsRequestExample1.yaml b/specification/_global/termvectors/examples/request/TermVectorsRequestExample1.yaml index e5a266c352..84c0660195 100644 --- a/specification/_global/termvectors/examples/request/TermVectorsRequestExample1.yaml +++ b/specification/_global/termvectors/examples/request/TermVectorsRequestExample1.yaml @@ -12,3 +12,67 @@ value: |- "term_statistics" : true, "field_statistics" : true } +alternatives: + - language: Python + code: |- + resp = client.termvectors( + index="my-index-000001", + id="1", + fields=[ + "text" + ], + offsets=True, + payloads=True, + positions=True, + term_statistics=True, + field_statistics=True, + ) + - language: JavaScript + code: |- + const response = await client.termvectors({ + index: "my-index-000001", + id: 1, + fields: ["text"], + offsets: true, + payloads: true, + positions: true, + term_statistics: true, + field_statistics: true, + }); + - language: Ruby + code: |- + response = client.termvectors( + index: "my-index-000001", + id: "1", + body: { + "fields": [ + "text" + ], + "offsets": true, + "payloads": true, + "positions": true, + "term_statistics": true, + "field_statistics": true + } + ) + - language: PHP + code: |- + $resp = $client->termvectors([ + "index" => "my-index-000001", + "id" => "1", + "body" => [ + "fields" => array( + "text", + ), + "offsets" => true, + "payloads" => true, + "positions" => true, + "term_statistics" => true, + "field_statistics" => true, + ], + ]); + - language: curl + code: + "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"fields\":[\"text\"],\"offsets\":true,\"payloads\":true,\"positions\":true,\"term_statistics\":true,\"field_statistics\":t\ + rue}' \"$ELASTICSEARCH_URL/my-index-000001/_termvectors/1\"" diff --git a/specification/_global/termvectors/examples/request/TermVectorsRequestExample2.yaml b/specification/_global/termvectors/examples/request/TermVectorsRequestExample2.yaml index 60079eaaa7..460f8f9c29 100644 --- a/specification/_global/termvectors/examples/request/TermVectorsRequestExample2.yaml +++ b/specification/_global/termvectors/examples/request/TermVectorsRequestExample2.yaml @@ -1,8 +1,8 @@ summary: Per-field analyzer method_request: GET /my-index-000001/_termvectors description: > - Run `GET /my-index-000001/_termvectors/1` to set per-field analyzers. - A different analyzer than the one at the field may be provided by using the `per_field_analyzer` parameter. + Run `GET /my-index-000001/_termvectors/1` to set per-field analyzers. A different analyzer than the one at the field may be + provided by using the `per_field_analyzer` parameter. # type: request value: |- { @@ -15,3 +15,72 @@ value: |- "fullname": "keyword" } } +alternatives: + - language: Python + code: |- + resp = client.termvectors( + index="my-index-000001", + doc={ + "fullname": "John Doe", + "text": "test test test" + }, + fields=[ + "fullname" + ], + per_field_analyzer={ + "fullname": "keyword" + }, + ) + - language: JavaScript + code: |- + const response = await client.termvectors({ + index: "my-index-000001", + doc: { + fullname: "John Doe", + text: "test test test", + }, + fields: ["fullname"], + per_field_analyzer: { + fullname: "keyword", + }, + }); + - language: Ruby + code: |- + response = client.termvectors( + index: "my-index-000001", + body: { + "doc": { + "fullname": "John Doe", + "text": "test test test" + }, + "fields": [ + "fullname" + ], + "per_field_analyzer": { + "fullname": "keyword" + } + } + ) + - language: PHP + code: |- + $resp = $client->termvectors([ + "index" => "my-index-000001", + "body" => [ + "doc" => [ + "fullname" => "John Doe", + "text" => "test test test", + ], + "fields" => array( + "fullname", + ), + "per_field_analyzer" => [ + "fullname" => "keyword", + ], + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"doc":{"fullname":"John Doe","text":"test test + test"},"fields":["fullname"],"per_field_analyzer":{"fullname":"keyword"}}'' + "$ELASTICSEARCH_URL/my-index-000001/_termvectors"' diff --git a/specification/_global/termvectors/examples/request/TermVectorsRequestExample3.yaml b/specification/_global/termvectors/examples/request/TermVectorsRequestExample3.yaml index 663bf436f3..cb1a96d3e3 100644 --- a/specification/_global/termvectors/examples/request/TermVectorsRequestExample3.yaml +++ b/specification/_global/termvectors/examples/request/TermVectorsRequestExample3.yaml @@ -1,9 +1,9 @@ summary: Terms filtering -method_request: GET /imdb/_termvectorss +method_request: GET /imdb/_termvectors description: > - Run `GET /imdb/_termvectors` to filter the terms returned based on their tf-idf scores. - It returns the three most "interesting" keywords from the artificial document having the given "plot" field value. - Notice that the keyword "Tony" or any stop words are not part of the response, as their tf-idf must be too low. + Run `GET /imdb/_termvectors` to filter the terms returned based on their tf-idf scores. It returns the three most "interesting" + keywords from the artificial document having the given "plot" field value. Notice that the keyword "Tony" or any stop words are + not part of the response, as their tf-idf must be too low. # type: request value: |- { @@ -20,3 +20,83 @@ value: |- "min_doc_freq": 1 } } +alternatives: + - language: Python + code: >- + resp = client.termvectors( + index="imdb", + doc={ + "plot": "When wealthy industrialist Tony Stark is forced to build an armored suit after a life-threatening incident, he ultimately decides to use its technology to fight against evil." + }, + term_statistics=True, + field_statistics=True, + positions=False, + offsets=False, + filter={ + "max_num_terms": 3, + "min_term_freq": 1, + "min_doc_freq": 1 + }, + ) + - language: JavaScript + code: >- + const response = await client.termvectors({ + index: "imdb", + doc: { + plot: "When wealthy industrialist Tony Stark is forced to build an armored suit after a life-threatening incident, he ultimately decides to use its technology to fight against evil.", + }, + term_statistics: true, + field_statistics: true, + positions: false, + offsets: false, + filter: { + max_num_terms: 3, + min_term_freq: 1, + min_doc_freq: 1, + }, + }); + - language: Ruby + code: >- + response = client.termvectors( + index: "imdb", + body: { + "doc": { + "plot": "When wealthy industrialist Tony Stark is forced to build an armored suit after a life-threatening incident, he ultimately decides to use its technology to fight against evil." + }, + "term_statistics": true, + "field_statistics": true, + "positions": false, + "offsets": false, + "filter": { + "max_num_terms": 3, + "min_term_freq": 1, + "min_doc_freq": 1 + } + } + ) + - language: PHP + code: >- + $resp = $client->termvectors([ + "index" => "imdb", + "body" => [ + "doc" => [ + "plot" => "When wealthy industrialist Tony Stark is forced to build an armored suit after a life-threatening incident, he ultimately decides to use its technology to fight against evil.", + ], + "term_statistics" => true, + "field_statistics" => true, + "positions" => false, + "offsets" => false, + "filter" => [ + "max_num_terms" => 3, + "min_term_freq" => 1, + "min_doc_freq" => 1, + ], + ], + ]); + - language: curl + code: + "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"doc\":{\"plot\":\"When + wealthy industrialist Tony Stark is forced to build an armored suit after a life-threatening incident, he ultimately decides + to use its technology to fight against + evil.\"},\"term_statistics\":true,\"field_statistics\":true,\"positions\":false,\"offsets\":false,\"filter\":{\"max_num_terms\ + \":3,\"min_term_freq\":1,\"min_doc_freq\":1}}' \"$ELASTICSEARCH_URL/imdb/_termvectors\"" diff --git a/specification/_global/termvectors/examples/request/TermVectorsRequestExample4.yaml b/specification/_global/termvectors/examples/request/TermVectorsRequestExample4.yaml index 341d3c0890..c0a46533e2 100644 --- a/specification/_global/termvectors/examples/request/TermVectorsRequestExample4.yaml +++ b/specification/_global/termvectors/examples/request/TermVectorsRequestExample4.yaml @@ -1,10 +1,9 @@ summary: Generate term vectors on the fly method_request: GET /my-index-000001/_termvectors/1 description: > - Run `GET /my-index-000001/_termvectors/1`. - Term vectors which are not explicitly stored in the index are automatically computed on the fly. - This request returns all information and statistics for the fields in document 1, even though the terms haven't been explicitly stored in the index. - Note that for the field text, the terms are not regenerated. + Run `GET /my-index-000001/_termvectors/1`. Term vectors which are not explicitly stored in the index are automatically computed on + the fly. This request returns all information and statistics for the fields in document 1, even though the terms haven't been + explicitly stored in the index. Note that for the field text, the terms are not regenerated. # type: request value: |- { @@ -14,3 +13,66 @@ value: |- "term_statistics" : true, "field_statistics" : true } +alternatives: + - language: Python + code: |- + resp = client.termvectors( + index="my-index-000001", + id="1", + fields=[ + "text", + "some_field_without_term_vectors" + ], + offsets=True, + positions=True, + term_statistics=True, + field_statistics=True, + ) + - language: JavaScript + code: |- + const response = await client.termvectors({ + index: "my-index-000001", + id: 1, + fields: ["text", "some_field_without_term_vectors"], + offsets: true, + positions: true, + term_statistics: true, + field_statistics: true, + }); + - language: Ruby + code: |- + response = client.termvectors( + index: "my-index-000001", + id: "1", + body: { + "fields": [ + "text", + "some_field_without_term_vectors" + ], + "offsets": true, + "positions": true, + "term_statistics": true, + "field_statistics": true + } + ) + - language: PHP + code: |- + $resp = $client->termvectors([ + "index" => "my-index-000001", + "id" => "1", + "body" => [ + "fields" => array( + "text", + "some_field_without_term_vectors", + ), + "offsets" => true, + "positions" => true, + "term_statistics" => true, + "field_statistics" => true, + ], + ]); + - language: curl + code: + "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"fields\":[\"text\",\"some_field_without_term_vectors\"],\"offsets\":true,\"positions\":true,\"term_statistics\":true,\"fi\ + eld_statistics\":true}' \"$ELASTICSEARCH_URL/my-index-000001/_termvectors/1\"" diff --git a/specification/_global/termvectors/examples/request/TermVectorsRequestExample5.yaml b/specification/_global/termvectors/examples/request/TermVectorsRequestExample5.yaml index 8723904fed..4af72f71ae 100644 --- a/specification/_global/termvectors/examples/request/TermVectorsRequestExample5.yaml +++ b/specification/_global/termvectors/examples/request/TermVectorsRequestExample5.yaml @@ -1,8 +1,9 @@ summary: Artificial documents method_request: GET /my-index-000001/_termvectors description: > - Run `GET /my-index-000001/_termvectors`. - Term vectors can be generated for artificial documents, that is for documents not present in the index. If dynamic mapping is turned on (default), the document fields not in the original mapping will be dynamically created. + Run `GET /my-index-000001/_termvectors`. Term vectors can be generated for artificial documents, that is for documents not present + in the index. If dynamic mapping is turned on (default), the document fields not in the original mapping will be dynamically + created. # type: request value: |- { @@ -11,3 +12,48 @@ value: |- "text" : "test test test" } } +alternatives: + - language: Python + code: |- + resp = client.termvectors( + index="my-index-000001", + doc={ + "fullname": "John Doe", + "text": "test test test" + }, + ) + - language: JavaScript + code: |- + const response = await client.termvectors({ + index: "my-index-000001", + doc: { + fullname: "John Doe", + text: "test test test", + }, + }); + - language: Ruby + code: |- + response = client.termvectors( + index: "my-index-000001", + body: { + "doc": { + "fullname": "John Doe", + "text": "test test test" + } + } + ) + - language: PHP + code: |- + $resp = $client->termvectors([ + "index" => "my-index-000001", + "body" => [ + "doc" => [ + "fullname" => "John Doe", + "text" => "test test test", + ], + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"doc":{"fullname":"John Doe","text":"test test test"}}'' "$ELASTICSEARCH_URL/my-index-000001/_termvectors"' diff --git a/specification/_global/update/examples/request/UpdateRequestExample1.yaml b/specification/_global/update/examples/request/UpdateRequestExample1.yaml index a4f41bf57b..1064fea9e4 100644 --- a/specification/_global/update/examples/request/UpdateRequestExample1.yaml +++ b/specification/_global/update/examples/request/UpdateRequestExample1.yaml @@ -2,7 +2,82 @@ summary: Update a counter with a script method_request: POST test/_update/1 description: Run `POST test/_update/1` to increment a counter by using a script. # type: request -value: - "{\n \"script\" : {\n \"source\": \"ctx._source.counter += params.count\"\ - ,\n \"lang\": \"painless\",\n \"params\" : {\n \"count\" : 4\n }\n\ - \ }\n}" +value: "{ + + \ \"script\" : { + + \ \"source\": \"ctx._source.counter += params.count\", + + \ \"lang\": \"painless\", + + \ \"params\" : { + + \ \"count\" : 4 + + \ } + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.update( + index="test", + id="1", + script={ + "source": "ctx._source.counter += params.count", + "lang": "painless", + "params": { + "count": 4 + } + }, + ) + - language: JavaScript + code: |- + const response = await client.update({ + index: "test", + id: 1, + script: { + source: "ctx._source.counter += params.count", + lang: "painless", + params: { + count: 4, + }, + }, + }); + - language: Ruby + code: |- + response = client.update( + index: "test", + id: "1", + body: { + "script": { + "source": "ctx._source.counter += params.count", + "lang": "painless", + "params": { + "count": 4 + } + } + } + ) + - language: PHP + code: |- + $resp = $client->update([ + "index" => "test", + "id" => "1", + "body" => [ + "script" => [ + "source" => "ctx._source.counter += params.count", + "lang" => "painless", + "params" => [ + "count" => 4, + ], + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"script":{"source":"ctx._source.counter += params.count","lang":"painless","params":{"count":4}}}'' + "$ELASTICSEARCH_URL/test/_update/1"' diff --git a/specification/_global/update/examples/request/UpdateRequestExample10.yaml b/specification/_global/update/examples/request/UpdateRequestExample10.yaml index a05ae55115..baedb16d8f 100644 --- a/specification/_global/update/examples/request/UpdateRequestExample10.yaml +++ b/specification/_global/update/examples/request/UpdateRequestExample10.yaml @@ -1,11 +1,105 @@ summary: Scripted upsert method_request: POST test/_update/1 description: > - Run `POST test/_update/1` to perform a scripted upsert. - When `scripted_upsert` is `true`, the script runs whether or not the document exists. + Run `POST test/_update/1` to perform a scripted upsert. When `scripted_upsert` is `true`, the script runs whether or not the + document exists. # type: request -value: - "{\n \"scripted_upsert\": true,\n \"script\": {\n \"source\": \"\"\"\n\ - \ if ( ctx.op == 'create' ) {\n ctx._source.counter = params.count\n\ - \ } else {\n ctx._source.counter += params.count\n }\n \"\"\"\ - ,\n \"params\": {\n \"count\": 4\n }\n },\n \"upsert\": {}\n}" +value: "{ + + \ \"scripted_upsert\": true, + + \ \"script\": { + + \ \"source\": \"\"\" + + \ if ( ctx.op == 'create' ) { + + \ ctx._source.counter = params.count + + \ } else { + + \ ctx._source.counter += params.count + + \ } + + \ \"\"\", + + \ \"params\": { + + \ \"count\": 4 + + \ } + + \ }, + + \ \"upsert\": {} + + }" +alternatives: + - language: Python + code: >- + resp = client.update( + index="test", + id="1", + scripted_upsert=True, + script={ + "source": "\n if ( ctx.op == 'create' ) {\n ctx._source.counter = params.count\n } else {\n ctx._source.counter += params.count\n }\n ", + "params": { + "count": 4 + } + }, + upsert={}, + ) + - language: JavaScript + code: >- + const response = await client.update({ + index: "test", + id: 1, + scripted_upsert: true, + script: { + source: + "\n if ( ctx.op == 'create' ) {\n ctx._source.counter = params.count\n } else {\n ctx._source.counter += params.count\n }\n ", + params: { + count: 4, + }, + }, + upsert: {}, + }); + - language: Ruby + code: >- + response = client.update( + index: "test", + id: "1", + body: { + "scripted_upsert": true, + "script": { + "source": "\n if ( ctx.op == 'create' ) {\n ctx._source.counter = params.count\n } else {\n ctx._source.counter += params.count\n }\n ", + "params": { + "count": 4 + } + }, + "upsert": {} + } + ) + - language: PHP + code: >- + $resp = $client->update([ + "index" => "test", + "id" => "1", + "body" => [ + "scripted_upsert" => true, + "script" => [ + "source" => "\n if ( ctx.op == 'create' ) {\n ctx._source.counter = params.count\n } else {\n ctx._source.counter += params.count\n }\n ", + "params" => [ + "count" => 4, + ], + ], + "upsert" => new ArrayObject([]), + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"scripted_upsert\":true,\"script\":{\"source\":\"\\n if ( ctx.op == '\"'\"'create'\"'\"' ) + {\\n ctx._source.counter = params.count\\n } else {\\n ctx._source.counter += + params.count\\n }\\n \",\"params\":{\"count\":4}},\"upsert\":{}}' \"$ELASTICSEARCH_URL/test/_update/1\"" diff --git a/specification/_global/update/examples/request/UpdateRequestExample11.yaml b/specification/_global/update/examples/request/UpdateRequestExample11.yaml index 6f062c3118..8610e081d8 100644 --- a/specification/_global/update/examples/request/UpdateRequestExample11.yaml +++ b/specification/_global/update/examples/request/UpdateRequestExample11.yaml @@ -1,9 +1,66 @@ summary: Doc as upsert method_request: POST test/_update/1 description: > - Run `POST test/_update/1` to perform a doc as upsert. - Instead of sending a partial `doc` plus an `upsert` doc, you can set `doc_as_upsert` to `true` to use the contents of `doc` as the `upsert` value. + Run `POST test/_update/1` to perform a doc as upsert. Instead of sending a partial `doc` plus an `upsert` doc, you can set + `doc_as_upsert` to `true` to use the contents of `doc` as the `upsert` value. # type: request -value: - "{\n \"doc\": {\n \"name\": \"new_name\"\n },\n \"doc_as_upsert\": true\n\ +value: "{ + + \ \"doc\": { + + \ \"name\": \"new_name\" + + \ }, + + \ \"doc_as_upsert\": true + }" +alternatives: + - language: Python + code: |- + resp = client.update( + index="test", + id="1", + doc={ + "name": "new_name" + }, + doc_as_upsert=True, + ) + - language: JavaScript + code: |- + const response = await client.update({ + index: "test", + id: 1, + doc: { + name: "new_name", + }, + doc_as_upsert: true, + }); + - language: Ruby + code: |- + response = client.update( + index: "test", + id: "1", + body: { + "doc": { + "name": "new_name" + }, + "doc_as_upsert": true + } + ) + - language: PHP + code: |- + $resp = $client->update([ + "index" => "test", + "id" => "1", + "body" => [ + "doc" => [ + "name" => "new_name", + ], + "doc_as_upsert" => true, + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"doc":{"name":"new_name"},"doc_as_upsert":true}'' "$ELASTICSEARCH_URL/test/_update/1"' diff --git a/specification/_global/update/examples/request/UpdateRequestExample2.yaml b/specification/_global/update/examples/request/UpdateRequestExample2.yaml index 3978e4755f..3b7019a878 100644 --- a/specification/_global/update/examples/request/UpdateRequestExample2.yaml +++ b/specification/_global/update/examples/request/UpdateRequestExample2.yaml @@ -1,10 +1,85 @@ summary: Add a tag with a script method_request: POST test/_update/1 description: > - Run `POST test/_update/1` to use a script to add a tag to a list of tags. - In this example, it is just a list, so the tag is added even it exists. + Run `POST test/_update/1` to use a script to add a tag to a list of tags. In this example, it is just a list, so the tag is added + even it exists. # type: request -value: - "{\n \"script\": {\n \"source\": \"ctx._source.tags.add(params.tag)\",\n\ - \ \"lang\": \"painless\",\n \"params\": {\n \"tag\": \"blue\"\n }\n\ - \ }\n}" +value: "{ + + \ \"script\": { + + \ \"source\": \"ctx._source.tags.add(params.tag)\", + + \ \"lang\": \"painless\", + + \ \"params\": { + + \ \"tag\": \"blue\" + + \ } + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.update( + index="test", + id="1", + script={ + "source": "ctx._source.tags.add(params.tag)", + "lang": "painless", + "params": { + "tag": "blue" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.update({ + index: "test", + id: 1, + script: { + source: "ctx._source.tags.add(params.tag)", + lang: "painless", + params: { + tag: "blue", + }, + }, + }); + - language: Ruby + code: |- + response = client.update( + index: "test", + id: "1", + body: { + "script": { + "source": "ctx._source.tags.add(params.tag)", + "lang": "painless", + "params": { + "tag": "blue" + } + } + } + ) + - language: PHP + code: |- + $resp = $client->update([ + "index" => "test", + "id" => "1", + "body" => [ + "script" => [ + "source" => "ctx._source.tags.add(params.tag)", + "lang" => "painless", + "params" => [ + "tag" => "blue", + ], + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"script":{"source":"ctx._source.tags.add(params.tag)","lang":"painless","params":{"tag":"blue"}}}'' + "$ELASTICSEARCH_URL/test/_update/1"' diff --git a/specification/_global/update/examples/request/UpdateRequestExample3.yaml b/specification/_global/update/examples/request/UpdateRequestExample3.yaml index 2ada10909e..4eea8078f0 100644 --- a/specification/_global/update/examples/request/UpdateRequestExample3.yaml +++ b/specification/_global/update/examples/request/UpdateRequestExample3.yaml @@ -1,12 +1,88 @@ summary: Remove a tag with a script method_request: POST test/_update/1 description: > - Run `POST test/_update/1` to use a script to remove a tag from a list of tags. - The Painless function to remove a tag takes the array index of the element you want to remove. - To avoid a possible runtime error, you first need to make sure the tag exists. - If the list contains duplicates of the tag, this script just removes one occurrence. + Run `POST test/_update/1` to use a script to remove a tag from a list of tags. The Painless function to remove a tag takes the + array index of the element you want to remove. To avoid a possible runtime error, you first need to make sure the tag exists. If + the list contains duplicates of the tag, this script just removes one occurrence. # type: request -value: - "{\n \"script\": {\n \"source\": \"if (ctx._source.tags.contains(params.tag))\ - \ { ctx._source.tags.remove(ctx._source.tags.indexOf(params.tag)) }\",\n \"lang\"\ - : \"painless\",\n \"params\": {\n \"tag\": \"blue\"\n }\n }\n}" +value: "{ + + \ \"script\": { + + \ \"source\": \"if (ctx._source.tags.contains(params.tag)) { ctx._source.tags.remove(ctx._source.tags.indexOf(params.tag)) }\", + + \ \"lang\": \"painless\", + + \ \"params\": { + + \ \"tag\": \"blue\" + + \ } + + \ } + + }" +alternatives: + - language: Python + code: >- + resp = client.update( + index="test", + id="1", + script={ + "source": "if (ctx._source.tags.contains(params.tag)) { ctx._source.tags.remove(ctx._source.tags.indexOf(params.tag)) }", + "lang": "painless", + "params": { + "tag": "blue" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.update({ + index: "test", + id: 1, + script: { + source: + "if (ctx._source.tags.contains(params.tag)) { ctx._source.tags.remove(ctx._source.tags.indexOf(params.tag)) }", + lang: "painless", + params: { + tag: "blue", + }, + }, + }); + - language: Ruby + code: >- + response = client.update( + index: "test", + id: "1", + body: { + "script": { + "source": "if (ctx._source.tags.contains(params.tag)) { ctx._source.tags.remove(ctx._source.tags.indexOf(params.tag)) }", + "lang": "painless", + "params": { + "tag": "blue" + } + } + } + ) + - language: PHP + code: >- + $resp = $client->update([ + "index" => "test", + "id" => "1", + "body" => [ + "script" => [ + "source" => "if (ctx._source.tags.contains(params.tag)) { ctx._source.tags.remove(ctx._source.tags.indexOf(params.tag)) }", + "lang" => "painless", + "params" => [ + "tag" => "blue", + ], + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"script":{"source":"if (ctx._source.tags.contains(params.tag)) { + ctx._source.tags.remove(ctx._source.tags.indexOf(params.tag)) }","lang":"painless","params":{"tag":"blue"}}}'' + "$ELASTICSEARCH_URL/test/_update/1"' diff --git a/specification/_global/update/examples/request/UpdateRequestExample4.yaml b/specification/_global/update/examples/request/UpdateRequestExample4.yaml index bf6b6bea57..8d59cf69ac 100644 --- a/specification/_global/update/examples/request/UpdateRequestExample4.yaml +++ b/specification/_global/update/examples/request/UpdateRequestExample4.yaml @@ -3,4 +3,45 @@ method_request: POST test/_update/1 description: > Run `POST test/_update/1` to use a script to add a field `new_field` to the document. # type: request -value: "{\n \"script\" : \"ctx._source.new_field = 'value_of_new_field'\"\n}" +value: "{ + + \ \"script\" : \"ctx._source.new_field = 'value_of_new_field'\" + + }" +alternatives: + - language: Python + code: |- + resp = client.update( + index="test", + id="1", + script="ctx._source.new_field = 'value_of_new_field'", + ) + - language: JavaScript + code: |- + const response = await client.update({ + index: "test", + id: 1, + script: "ctx._source.new_field = 'value_of_new_field'", + }); + - language: Ruby + code: |- + response = client.update( + index: "test", + id: "1", + body: { + "script": "ctx._source.new_field = 'value_of_new_field'" + } + ) + - language: PHP + code: |- + $resp = $client->update([ + "index" => "test", + "id" => "1", + "body" => [ + "script" => "ctx._source.new_field = 'value_of_new_field'", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"script":"ctx._source.new_field = ''"''"''value_of_new_field''"''"''"}'' "$ELASTICSEARCH_URL/test/_update/1"' diff --git a/specification/_global/update/examples/request/UpdateRequestExample5.yaml b/specification/_global/update/examples/request/UpdateRequestExample5.yaml index 81d2038207..5bec9b1c66 100644 --- a/specification/_global/update/examples/request/UpdateRequestExample5.yaml +++ b/specification/_global/update/examples/request/UpdateRequestExample5.yaml @@ -3,4 +3,45 @@ method_request: POST test/_update/1 description: > Run `POST test/_update/1` to use a script to remove a field `new_field` from the document. # type: request -value: "{\n \"script\" : \"ctx._source.remove('new_field')\"\n}" +value: "{ + + \ \"script\" : \"ctx._source.remove('new_field')\" + + }" +alternatives: + - language: Python + code: |- + resp = client.update( + index="test", + id="1", + script="ctx._source.remove('new_field')", + ) + - language: JavaScript + code: |- + const response = await client.update({ + index: "test", + id: 1, + script: "ctx._source.remove('new_field')", + }); + - language: Ruby + code: |- + response = client.update( + index: "test", + id: "1", + body: { + "script": "ctx._source.remove('new_field')" + } + ) + - language: PHP + code: |- + $resp = $client->update([ + "index" => "test", + "id" => "1", + "body" => [ + "script" => "ctx._source.remove('new_field')", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"script":"ctx._source.remove(''"''"''new_field''"''"'')"}'' "$ELASTICSEARCH_URL/test/_update/1"' diff --git a/specification/_global/update/examples/request/UpdateRequestExample6.yaml b/specification/_global/update/examples/request/UpdateRequestExample6.yaml index 14d7eda1b1..ac90332e44 100644 --- a/specification/_global/update/examples/request/UpdateRequestExample6.yaml +++ b/specification/_global/update/examples/request/UpdateRequestExample6.yaml @@ -3,4 +3,46 @@ method_request: POST test/_update/1 description: > Run `POST test/_update/1` to use a script to remove a subfield from an object field. # type: request -value: "{\n \"script\": \"ctx._source['my-object'].remove('my-subfield')\"\n}" +value: "{ + + \ \"script\": \"ctx._source['my-object'].remove('my-subfield')\" + + }" +alternatives: + - language: Python + code: |- + resp = client.update( + index="test", + id="1", + script="ctx._source['my-object'].remove('my-subfield')", + ) + - language: JavaScript + code: |- + const response = await client.update({ + index: "test", + id: 1, + script: "ctx._source['my-object'].remove('my-subfield')", + }); + - language: Ruby + code: |- + response = client.update( + index: "test", + id: "1", + body: { + "script": "ctx._source['my-object'].remove('my-subfield')" + } + ) + - language: PHP + code: |- + $resp = $client->update([ + "index" => "test", + "id" => "1", + "body" => [ + "script" => "ctx._source['my-object'].remove('my-subfield')", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"script":"ctx._source[''"''"''my-object''"''"''].remove(''"''"''my-subfield''"''"'')"}'' + "$ELASTICSEARCH_URL/test/_update/1"' diff --git a/specification/_global/update/examples/request/UpdateRequestExample7.yaml b/specification/_global/update/examples/request/UpdateRequestExample7.yaml index 823fdccf84..4d66ae5ff8 100644 --- a/specification/_global/update/examples/request/UpdateRequestExample7.yaml +++ b/specification/_global/update/examples/request/UpdateRequestExample7.yaml @@ -1,10 +1,86 @@ summary: Change the operation with a script method_request: POST test/_update/1 description: > - Run `POST test/_update/1` to change the operation that runs from within the script. - For example, this request deletes the document if the `tags` field contains `green`, otherwise it does nothing (`noop`). + Run `POST test/_update/1` to change the operation that runs from within the script. For example, this request deletes the document + if the `tags` field contains `green`, otherwise it does nothing (`noop`). # type: request -value: - "{\n \"script\": {\n \"source\": \"if (ctx._source.tags.contains(params.tag))\ - \ { ctx.op = 'delete' } else { ctx.op = 'noop' }\",\n \"lang\": \"painless\"\ - ,\n \"params\": {\n \"tag\": \"green\"\n }\n }\n}" +value: "{ + + \ \"script\": { + + \ \"source\": \"if (ctx._source.tags.contains(params.tag)) { ctx.op = 'delete' } else { ctx.op = 'noop' }\", + + \ \"lang\": \"painless\", + + \ \"params\": { + + \ \"tag\": \"green\" + + \ } + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.update( + index="test", + id="1", + script={ + "source": "if (ctx._source.tags.contains(params.tag)) { ctx.op = 'delete' } else { ctx.op = 'noop' }", + "lang": "painless", + "params": { + "tag": "green" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.update({ + index: "test", + id: 1, + script: { + source: + "if (ctx._source.tags.contains(params.tag)) { ctx.op = 'delete' } else { ctx.op = 'noop' }", + lang: "painless", + params: { + tag: "green", + }, + }, + }); + - language: Ruby + code: |- + response = client.update( + index: "test", + id: "1", + body: { + "script": { + "source": "if (ctx._source.tags.contains(params.tag)) { ctx.op = 'delete' } else { ctx.op = 'noop' }", + "lang": "painless", + "params": { + "tag": "green" + } + } + } + ) + - language: PHP + code: |- + $resp = $client->update([ + "index" => "test", + "id" => "1", + "body" => [ + "script" => [ + "source" => "if (ctx._source.tags.contains(params.tag)) { ctx.op = 'delete' } else { ctx.op = 'noop' }", + "lang" => "painless", + "params" => [ + "tag" => "green", + ], + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"script":{"source":"if (ctx._source.tags.contains(params.tag)) { ctx.op = ''"''"''delete''"''"'' } else { ctx.op = + ''"''"''noop''"''"'' }","lang":"painless","params":{"tag":"green"}}}'' "$ELASTICSEARCH_URL/test/_update/1"' diff --git a/specification/_global/update/examples/request/UpdateRequestExample8.yaml b/specification/_global/update/examples/request/UpdateRequestExample8.yaml index 01e3a83fef..7258b8c23d 100644 --- a/specification/_global/update/examples/request/UpdateRequestExample8.yaml +++ b/specification/_global/update/examples/request/UpdateRequestExample8.yaml @@ -3,4 +3,57 @@ method_request: POST test/_update/1 description: > Run `POST test/_update/1` to do a partial update that adds a new field to the existing document. # type: request -value: "{\n \"doc\": {\n \"name\": \"new_name\"\n }\n}" +value: "{ + + \ \"doc\": { + + \ \"name\": \"new_name\" + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.update( + index="test", + id="1", + doc={ + "name": "new_name" + }, + ) + - language: JavaScript + code: |- + const response = await client.update({ + index: "test", + id: 1, + doc: { + name: "new_name", + }, + }); + - language: Ruby + code: |- + response = client.update( + index: "test", + id: "1", + body: { + "doc": { + "name": "new_name" + } + } + ) + - language: PHP + code: |- + $resp = $client->update([ + "index" => "test", + "id" => "1", + "body" => [ + "doc" => [ + "name" => "new_name", + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"doc":{"name":"new_name"}}'' "$ELASTICSEARCH_URL/test/_update/1"' diff --git a/specification/_global/update/examples/request/UpdateRequestExample9.yaml b/specification/_global/update/examples/request/UpdateRequestExample9.yaml index 59347bf353..872171dbed 100644 --- a/specification/_global/update/examples/request/UpdateRequestExample9.yaml +++ b/specification/_global/update/examples/request/UpdateRequestExample9.yaml @@ -1,10 +1,104 @@ summary: Upsert method_request: POST test/_update/1 description: > - Run `POST test/_update/1` to perfom an upsert. - If the document does not already exist, the contents of the upsert element are inserted as a new document. If the document exists, the script is run. + Run `POST test/_update/1` to perfom an upsert. If the document does not already exist, the contents of the upsert element are + inserted as a new document. If the document exists, the script is run. # type: request -value: - "{\n \"script\": {\n \"source\": \"ctx._source.counter += params.count\"\ - ,\n \"lang\": \"painless\",\n \"params\": {\n \"count\": 4\n }\n \ - \ },\n \"upsert\": {\n \"counter\": 1\n }\n}" +value: "{ + + \ \"script\": { + + \ \"source\": \"ctx._source.counter += params.count\", + + \ \"lang\": \"painless\", + + \ \"params\": { + + \ \"count\": 4 + + \ } + + \ }, + + \ \"upsert\": { + + \ \"counter\": 1 + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.update( + index="test", + id="1", + script={ + "source": "ctx._source.counter += params.count", + "lang": "painless", + "params": { + "count": 4 + } + }, + upsert={ + "counter": 1 + }, + ) + - language: JavaScript + code: |- + const response = await client.update({ + index: "test", + id: 1, + script: { + source: "ctx._source.counter += params.count", + lang: "painless", + params: { + count: 4, + }, + }, + upsert: { + counter: 1, + }, + }); + - language: Ruby + code: |- + response = client.update( + index: "test", + id: "1", + body: { + "script": { + "source": "ctx._source.counter += params.count", + "lang": "painless", + "params": { + "count": 4 + } + }, + "upsert": { + "counter": 1 + } + } + ) + - language: PHP + code: |- + $resp = $client->update([ + "index" => "test", + "id" => "1", + "body" => [ + "script" => [ + "source" => "ctx._source.counter += params.count", + "lang" => "painless", + "params" => [ + "count" => 4, + ], + ], + "upsert" => [ + "counter" => 1, + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"script":{"source":"ctx._source.counter += + params.count","lang":"painless","params":{"count":4}},"upsert":{"counter":1}}'' + "$ELASTICSEARCH_URL/test/_update/1"' diff --git a/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample1.yaml b/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample1.yaml index 3d864d1006..8095e6f18b 100644 --- a/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample1.yaml +++ b/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample1.yaml @@ -11,3 +11,56 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.update_by_query( + index="my-index-000001", + conflicts="proceed", + query={ + "term": { + "user.id": "kimchy" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.updateByQuery({ + index: "my-index-000001", + conflicts: "proceed", + query: { + term: { + "user.id": "kimchy", + }, + }, + }); + - language: Ruby + code: |- + response = client.update_by_query( + index: "my-index-000001", + conflicts: "proceed", + body: { + "query": { + "term": { + "user.id": "kimchy" + } + } + } + ) + - language: PHP + code: |- + $resp = $client->updateByQuery([ + "index" => "my-index-000001", + "conflicts" => "proceed", + "body" => [ + "query" => [ + "term" => [ + "user.id" => "kimchy", + ], + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"query":{"term":{"user.id":"kimchy"}}}'' "$ELASTICSEARCH_URL/my-index-000001/_update_by_query?conflicts=proceed"' diff --git a/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample2.yaml b/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample2.yaml index f5e9e4c0af..005409f1f6 100644 --- a/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample2.yaml +++ b/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample2.yaml @@ -1,8 +1,8 @@ summary: Update the document source method_request: POST my-index-000001/_update_by_query description: > - Run `POST my-index-000001/_update_by_query` with a script to update the document source. - It increments the `count` field for all documents with a `user.id` of `kimchy` in `my-index-000001`. + Run `POST my-index-000001/_update_by_query` with a script to update the document source. It increments the `count` field for all + documents with a `user.id` of `kimchy` in `my-index-000001`. # type: "request" value: |- { @@ -16,3 +16,69 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.update_by_query( + index="my-index-000001", + script={ + "source": "ctx._source.count++", + "lang": "painless" + }, + query={ + "term": { + "user.id": "kimchy" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.updateByQuery({ + index: "my-index-000001", + script: { + source: "ctx._source.count++", + lang: "painless", + }, + query: { + term: { + "user.id": "kimchy", + }, + }, + }); + - language: Ruby + code: |- + response = client.update_by_query( + index: "my-index-000001", + body: { + "script": { + "source": "ctx._source.count++", + "lang": "painless" + }, + "query": { + "term": { + "user.id": "kimchy" + } + } + } + ) + - language: PHP + code: |- + $resp = $client->updateByQuery([ + "index" => "my-index-000001", + "body" => [ + "script" => [ + "source" => "ctx._source.count++", + "lang" => "painless", + ], + "query" => [ + "term" => [ + "user.id" => "kimchy", + ], + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"script":{"source":"ctx._source.count++","lang":"painless"},"query":{"term":{"user.id":"kimchy"}}}'' + "$ELASTICSEARCH_URL/my-index-000001/_update_by_query"' diff --git a/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample3.yaml b/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample3.yaml index 308ae14556..976e4af383 100644 --- a/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample3.yaml +++ b/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample3.yaml @@ -1,8 +1,8 @@ summary: Slice manually method_request: POST my-index-000001/_update_by_query description: > - Run `POST my-index-000001/_update_by_query` to slice an update by query manually. - Provide a slice ID and total number of slices to each request. + Run `POST my-index-000001/_update_by_query` to slice an update by query manually. Provide a slice ID and total number of slices to + each request. # type: "request" value: |- { @@ -14,3 +14,61 @@ value: |- "source": "ctx._source['extra'] = 'test'" } } +alternatives: + - language: Python + code: |- + resp = client.update_by_query( + index="my-index-000001", + slice={ + "id": 0, + "max": 2 + }, + script={ + "source": "ctx._source['extra'] = 'test'" + }, + ) + - language: JavaScript + code: |- + const response = await client.updateByQuery({ + index: "my-index-000001", + slice: { + id: 0, + max: 2, + }, + script: { + source: "ctx._source['extra'] = 'test'", + }, + }); + - language: Ruby + code: |- + response = client.update_by_query( + index: "my-index-000001", + body: { + "slice": { + "id": 0, + "max": 2 + }, + "script": { + "source": "ctx._source['extra'] = 'test'" + } + } + ) + - language: PHP + code: |- + $resp = $client->updateByQuery([ + "index" => "my-index-000001", + "body" => [ + "slice" => [ + "id" => 0, + "max" => 2, + ], + "script" => [ + "source" => "ctx._source['extra'] = 'test'", + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"slice":{"id":0,"max":2},"script":{"source":"ctx._source[''"''"''extra''"''"''] = ''"''"''test''"''"''"}}'' + "$ELASTICSEARCH_URL/my-index-000001/_update_by_query"' diff --git a/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample4.yaml b/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample4.yaml index 4a2632eef0..f34b5a4b8e 100644 --- a/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample4.yaml +++ b/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample4.yaml @@ -1,8 +1,8 @@ summary: Slice automatically method_request: POST my-index-000001/_update_by_query?refresh&slices=5 description: > - Run `POST my-index-000001/_update_by_query?refresh&slices=5` to use automatic slicing. - It automatically parallelizes using sliced scroll to slice on `_id`. + Run `POST my-index-000001/_update_by_query?refresh&slices=5` to use automatic slicing. It automatically parallelizes using sliced + scroll to slice on `_id`. # type: "request" value: |- { @@ -10,3 +10,53 @@ value: |- "source": "ctx._source['extra'] = 'test'" } } +alternatives: + - language: Python + code: |- + resp = client.update_by_query( + index="my-index-000001", + refresh=True, + slices="5", + script={ + "source": "ctx._source['extra'] = 'test'" + }, + ) + - language: JavaScript + code: |- + const response = await client.updateByQuery({ + index: "my-index-000001", + refresh: "true", + slices: 5, + script: { + source: "ctx._source['extra'] = 'test'", + }, + }); + - language: Ruby + code: |- + response = client.update_by_query( + index: "my-index-000001", + refresh: "true", + slices: "5", + body: { + "script": { + "source": "ctx._source['extra'] = 'test'" + } + } + ) + - language: PHP + code: |- + $resp = $client->updateByQuery([ + "index" => "my-index-000001", + "refresh" => "true", + "slices" => "5", + "body" => [ + "script" => [ + "source" => "ctx._source['extra'] = 'test'", + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"script":{"source":"ctx._source[''"''"''extra''"''"''] = ''"''"''test''"''"''"}}'' + "$ELASTICSEARCH_URL/my-index-000001/_update_by_query?refresh&slices=5"' diff --git a/specification/_global/update_by_query_rethrottle/examples/request/UpdateByQueryRethrottleRequestExample1.yaml b/specification/_global/update_by_query_rethrottle/examples/request/UpdateByQueryRethrottleRequestExample1.yaml index aaddc459f9..cf38b7f56d 100644 --- a/specification/_global/update_by_query_rethrottle/examples/request/UpdateByQueryRethrottleRequestExample1.yaml +++ b/specification/_global/update_by_query_rethrottle/examples/request/UpdateByQueryRethrottleRequestExample1.yaml @@ -1 +1,29 @@ method_request: POST _update_by_query/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1 +alternatives: + - language: Python + code: |- + resp = client.update_by_query_rethrottle( + task_id="r1A2WoRbTwKZ516z6NEs5A:36619", + requests_per_second="-1", + ) + - language: JavaScript + code: |- + const response = await client.updateByQueryRethrottle({ + task_id: "r1A2WoRbTwKZ516z6NEs5A:36619", + requests_per_second: "-1", + }); + - language: Ruby + code: |- + response = client.update_by_query_rethrottle( + task_id: "r1A2WoRbTwKZ516z6NEs5A:36619", + requests_per_second: "-1" + ) + - language: PHP + code: |- + $resp = $client->updateByQueryRethrottle([ + "task_id" => "r1A2WoRbTwKZ516z6NEs5A:36619", + "requests_per_second" => "-1", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_update_by_query/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1"' diff --git a/specification/async_search/delete/examples/request/AsyncSearchDeleteExample1.yaml b/specification/async_search/delete/examples/request/AsyncSearchDeleteExample1.yaml index 3ff283d560..f5113a9b90 100644 --- a/specification/async_search/delete/examples/request/AsyncSearchDeleteExample1.yaml +++ b/specification/async_search/delete/examples/request/AsyncSearchDeleteExample1.yaml @@ -1 +1,25 @@ method_request: DELETE /_async_search/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc= +alternatives: + - language: Python + code: |- + resp = client.async_search.delete( + id="FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=", + ) + - language: JavaScript + code: |- + const response = await client.asyncSearch.delete({ + id: "FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=", + }); + - language: Ruby + code: |- + response = client.async_search.delete( + id: "FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=" + ) + - language: PHP + code: |- + $resp = $client->asyncSearch()->delete([ + "id" => "FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_async_search/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc="' diff --git a/specification/async_search/get/examples/request/AsyncSearchGetRequestExample1.yaml b/specification/async_search/get/examples/request/AsyncSearchGetRequestExample1.yaml index 89b9287b68..25c7785451 100644 --- a/specification/async_search/get/examples/request/AsyncSearchGetRequestExample1.yaml +++ b/specification/async_search/get/examples/request/AsyncSearchGetRequestExample1.yaml @@ -1 +1,25 @@ method_request: GET /_async_search/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc= +alternatives: + - language: Python + code: |- + resp = client.async_search.get( + id="FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=", + ) + - language: JavaScript + code: |- + const response = await client.asyncSearch.get({ + id: "FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=", + }); + - language: Ruby + code: |- + response = client.async_search.get( + id: "FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=" + ) + - language: PHP + code: |- + $resp = $client->asyncSearch()->get([ + "id" => "FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_async_search/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc="' diff --git a/specification/async_search/status/examples/request/AsyncSearchStatusRequestExample1.yaml b/specification/async_search/status/examples/request/AsyncSearchStatusRequestExample1.yaml index d62c737ab6..978acd804a 100644 --- a/specification/async_search/status/examples/request/AsyncSearchStatusRequestExample1.yaml +++ b/specification/async_search/status/examples/request/AsyncSearchStatusRequestExample1.yaml @@ -1 +1,25 @@ method_request: GET /_async_search/status/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc= +alternatives: + - language: Python + code: |- + resp = client.async_search.status( + id="FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=", + ) + - language: JavaScript + code: |- + const response = await client.asyncSearch.status({ + id: "FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=", + }); + - language: Ruby + code: |- + response = client.async_search.status( + id: "FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=" + ) + - language: PHP + code: |- + $resp = $client->asyncSearch()->status([ + "id" => "FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_async_search/status/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc="' diff --git a/specification/async_search/submit/examples/request/AsyncSearchSubmitRequestExample1.yaml b/specification/async_search/submit/examples/request/AsyncSearchSubmitRequestExample1.yaml index cc599db2da..c4b9c643d3 100644 --- a/specification/async_search/submit/examples/request/AsyncSearchSubmitRequestExample1.yaml +++ b/specification/async_search/submit/examples/request/AsyncSearchSubmitRequestExample1.yaml @@ -1,7 +1,125 @@ # summary: "Performs a search request asynchronously." method_request: 'POST /sales*/_async_search?size=0' description: > - Perform a search request asynchronously with `POST /sales*/_async_search?size=0`. - It accepts the same parameters and request body as the search API. + Perform a search request asynchronously with `POST /sales*/_async_search?size=0`. It accepts the same parameters and request body + as the search API. # type: "request", -value: "{\n \"sort\": [\n { \"date\": { \"order\": \"asc\" } }\n ],\n \"aggs\": {\n \"sale_date\": {\n \"date_histogram\": {\n \"field\": \"date\",\n \"calendar_interval\": \"1d\"\n }\n }\n }\n}" +value: "{ + + \ \"sort\": [ + + \ { \"date\": { \"order\": \"asc\" } } + + \ ], + + \ \"aggs\": { + + \ \"sale_date\": { + + \ \"date_histogram\": { + + \ \"field\": \"date\", + + \ \"calendar_interval\": \"1d\" + + \ } + + \ } + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.async_search.submit( + index="sales*", + size="0", + sort=[ + { + "date": { + "order": "asc" + } + } + ], + aggs={ + "sale_date": { + "date_histogram": { + "field": "date", + "calendar_interval": "1d" + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.asyncSearch.submit({ + index: "sales*", + size: 0, + sort: [ + { + date: { + order: "asc", + }, + }, + ], + aggs: { + sale_date: { + date_histogram: { + field: "date", + calendar_interval: "1d", + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.async_search.submit( + index: "sales*", + size: "0", + body: { + "sort": [ + { + "date": { + "order": "asc" + } + } + ], + "aggs": { + "sale_date": { + "date_histogram": { + "field": "date", + "calendar_interval": "1d" + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->asyncSearch()->submit([ + "index" => "sales*", + "size" => "0", + "body" => [ + "sort" => array( + [ + "date" => [ + "order" => "asc", + ], + ], + ), + "aggs" => [ + "sale_date" => [ + "date_histogram" => [ + "field" => "date", + "calendar_interval" => "1d", + ], + ], + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"sort\":[{\"date\":{\"order\":\"asc\"}}],\"aggs\":{\"sale_date\":{\"date_histogram\":{\"field\":\"date\",\"calendar_interv\ + al\":\"1d\"}}}}' \"$ELASTICSEARCH_URL/sales*/_async_search?size=0\"" diff --git a/specification/autoscaling/delete_autoscaling_policy/examples/request/DeleteAutoscalingPolicyRequestExample1.yaml b/specification/autoscaling/delete_autoscaling_policy/examples/request/DeleteAutoscalingPolicyRequestExample1.yaml index ad73243750..9908ccd1a3 100644 --- a/specification/autoscaling/delete_autoscaling_policy/examples/request/DeleteAutoscalingPolicyRequestExample1.yaml +++ b/specification/autoscaling/delete_autoscaling_policy/examples/request/DeleteAutoscalingPolicyRequestExample1.yaml @@ -1 +1,24 @@ method_request: DELETE /_autoscaling/policy/* +alternatives: + - language: Python + code: |- + resp = client.autoscaling.delete_autoscaling_policy( + name="*", + ) + - language: JavaScript + code: |- + const response = await client.autoscaling.deleteAutoscalingPolicy({ + name: "*", + }); + - language: Ruby + code: |- + response = client.autoscaling.delete_autoscaling_policy( + name: "*" + ) + - language: PHP + code: |- + $resp = $client->autoscaling()->deleteAutoscalingPolicy([ + "name" => "*", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_autoscaling/policy/*"' diff --git a/specification/autoscaling/get_autoscaling_capacity/examples/request/GetAutoscalingCapacityRequestExample1.yaml b/specification/autoscaling/get_autoscaling_capacity/examples/request/GetAutoscalingCapacityRequestExample1.yaml index 3abcc14ffe..19ff87dd19 100644 --- a/specification/autoscaling/get_autoscaling_capacity/examples/request/GetAutoscalingCapacityRequestExample1.yaml +++ b/specification/autoscaling/get_autoscaling_capacity/examples/request/GetAutoscalingCapacityRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET /_autoscaling/capacity +alternatives: + - language: Python + code: resp = client.autoscaling.get_autoscaling_capacity() + - language: JavaScript + code: const response = await client.autoscaling.getAutoscalingCapacity(); + - language: Ruby + code: response = client.autoscaling.get_autoscaling_capacity + - language: PHP + code: $resp = $client->autoscaling()->getAutoscalingCapacity(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_autoscaling/capacity"' diff --git a/specification/autoscaling/get_autoscaling_policy/examples/request/GetAutoscalingPolicyRequestExample1.yaml b/specification/autoscaling/get_autoscaling_policy/examples/request/GetAutoscalingPolicyRequestExample1.yaml index 83b137b46d..e5c60ca81d 100644 --- a/specification/autoscaling/get_autoscaling_policy/examples/request/GetAutoscalingPolicyRequestExample1.yaml +++ b/specification/autoscaling/get_autoscaling_policy/examples/request/GetAutoscalingPolicyRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET /_autoscaling/policy/my_autoscaling_policy +alternatives: + - language: Python + code: |- + resp = client.autoscaling.get_autoscaling_policy( + name="my_autoscaling_policy", + ) + - language: JavaScript + code: |- + const response = await client.autoscaling.getAutoscalingPolicy({ + name: "my_autoscaling_policy", + }); + - language: Ruby + code: |- + response = client.autoscaling.get_autoscaling_policy( + name: "my_autoscaling_policy" + ) + - language: PHP + code: |- + $resp = $client->autoscaling()->getAutoscalingPolicy([ + "name" => "my_autoscaling_policy", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_autoscaling/policy/my_autoscaling_policy"' diff --git a/specification/autoscaling/put_autoscaling_policy/examples/request/PutAutoscalingPolicyRequestExample1.yaml b/specification/autoscaling/put_autoscaling_policy/examples/request/PutAutoscalingPolicyRequestExample1.yaml index d4c289b821..fab9cefae2 100644 --- a/specification/autoscaling/put_autoscaling_policy/examples/request/PutAutoscalingPolicyRequestExample1.yaml +++ b/specification/autoscaling/put_autoscaling_policy/examples/request/PutAutoscalingPolicyRequestExample1.yaml @@ -2,4 +2,66 @@ summary: 'Creates or updates an autoscaling policy.' method_request: 'PUT /_autoscaling/policy/' # description: "" # type: "request" -value: "{\n \"roles\": [],\n \"deciders\": {\n \"fixed\": {\n }\n }\n}" +value: "{ + + \ \"roles\": [], + + \ \"deciders\": { + + \ \"fixed\": { + + \ } + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.autoscaling.put_autoscaling_policy( + name="", + policy={ + "roles": [], + "deciders": { + "fixed": {} + } + }, + ) + - language: JavaScript + code: |- + const response = await client.autoscaling.putAutoscalingPolicy({ + name: "", + policy: { + roles: [], + deciders: { + fixed: {}, + }, + }, + }); + - language: Ruby + code: |- + response = client.autoscaling.put_autoscaling_policy( + name: "", + body: { + "roles": [], + "deciders": { + "fixed": {} + } + } + ) + - language: PHP + code: |- + $resp = $client->autoscaling()->putAutoscalingPolicy([ + "name" => "", + "body" => [ + "roles" => array( + ), + "deciders" => [ + "fixed" => new ArrayObject([]), + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"roles":[],"deciders":{"fixed":{}}}'' "$ELASTICSEARCH_URL/_autoscaling/policy/"' diff --git a/specification/autoscaling/put_autoscaling_policy/examples/request/PutAutoscalingPolicyRequestExample2.yaml b/specification/autoscaling/put_autoscaling_policy/examples/request/PutAutoscalingPolicyRequestExample2.yaml index 25f9558ebd..56aff02cde 100644 --- a/specification/autoscaling/put_autoscaling_policy/examples/request/PutAutoscalingPolicyRequestExample2.yaml +++ b/specification/autoscaling/put_autoscaling_policy/examples/request/PutAutoscalingPolicyRequestExample2.yaml @@ -1,5 +1,74 @@ summary: 'Creates an autoscaling policy.' method_request: 'PUT /_autoscaling/policy/my_autoscaling_policy' -description: 'The API method and path for this request: `PUT /_autoscaling/policy/my_autoscaling_policy`. It creates `my_autoscaling_policy` using the fixed autoscaling decider, applying to the set of nodes having (only) the `data_hot` role.' +description: + 'The API method and path for this request: `PUT /_autoscaling/policy/my_autoscaling_policy`. It creates + `my_autoscaling_policy` using the fixed autoscaling decider, applying to the set of nodes having (only) the `data_hot` role.' # type: "request" -value: "{\n \"roles\" : [ \"data_hot\" ],\n \"deciders\": {\n \"fixed\": {\n }\n }\n}" +value: "{ + + \ \"roles\" : [ \"data_hot\" ], + + \ \"deciders\": { + + \ \"fixed\": { + + \ } + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.autoscaling.put_autoscaling_policy( + name="my_autoscaling_policy", + policy={ + "roles": [ + "data_hot" + ], + "deciders": { + "fixed": {} + } + }, + ) + - language: JavaScript + code: |- + const response = await client.autoscaling.putAutoscalingPolicy({ + name: "my_autoscaling_policy", + policy: { + roles: ["data_hot"], + deciders: { + fixed: {}, + }, + }, + }); + - language: Ruby + code: |- + response = client.autoscaling.put_autoscaling_policy( + name: "my_autoscaling_policy", + body: { + "roles": [ + "data_hot" + ], + "deciders": { + "fixed": {} + } + } + ) + - language: PHP + code: |- + $resp = $client->autoscaling()->putAutoscalingPolicy([ + "name" => "my_autoscaling_policy", + "body" => [ + "roles" => array( + "data_hot", + ), + "deciders" => [ + "fixed" => new ArrayObject([]), + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"roles":["data_hot"],"deciders":{"fixed":{}}}'' "$ELASTICSEARCH_URL/_autoscaling/policy/my_autoscaling_policy"' diff --git a/specification/cat/aliases/examples/request/CatAliasesRequestExample1.yaml b/specification/cat/aliases/examples/request/CatAliasesRequestExample1.yaml index e74bd1e9f8..04b09291c5 100644 --- a/specification/cat/aliases/examples/request/CatAliasesRequestExample1.yaml +++ b/specification/cat/aliases/examples/request/CatAliasesRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET _cat/aliases?format=json&v=true +alternatives: + - language: Python + code: |- + resp = client.cat.aliases( + format="json", + v=True, + ) + - language: JavaScript + code: |- + const response = await client.cat.aliases({ + format: "json", + v: "true", + }); + - language: Ruby + code: |- + response = client.cat.aliases( + format: "json", + v: "true" + ) + - language: PHP + code: |- + $resp = $client->cat()->aliases([ + "format" => "json", + "v" => "true", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_cat/aliases?format=json&v=true"' diff --git a/specification/cat/allocation/examples/request/CatAllocationRequestExample1.yaml b/specification/cat/allocation/examples/request/CatAllocationRequestExample1.yaml index aaa367a7da..cd2d8c8dfb 100644 --- a/specification/cat/allocation/examples/request/CatAllocationRequestExample1.yaml +++ b/specification/cat/allocation/examples/request/CatAllocationRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET /_cat/allocation?v=true&format=json +alternatives: + - language: Python + code: |- + resp = client.cat.allocation( + v=True, + format="json", + ) + - language: JavaScript + code: |- + const response = await client.cat.allocation({ + v: "true", + format: "json", + }); + - language: Ruby + code: |- + response = client.cat.allocation( + v: "true", + format: "json" + ) + - language: PHP + code: |- + $resp = $client->cat()->allocation([ + "v" => "true", + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_cat/allocation?v=true&format=json"' diff --git a/specification/cat/component_templates/examples/request/CatComponentTemplatesRequestExample1.yaml b/specification/cat/component_templates/examples/request/CatComponentTemplatesRequestExample1.yaml index 495d410df0..ea2a1441fe 100644 --- a/specification/cat/component_templates/examples/request/CatComponentTemplatesRequestExample1.yaml +++ b/specification/cat/component_templates/examples/request/CatComponentTemplatesRequestExample1.yaml @@ -1 +1,37 @@ method_request: GET _cat/component_templates/my-template-*?v=true&s=name&format=json +alternatives: + - language: Python + code: |- + resp = client.cat.component_templates( + name="my-template-*", + v=True, + s="name", + format="json", + ) + - language: JavaScript + code: |- + const response = await client.cat.componentTemplates({ + name: "my-template-*", + v: "true", + s: "name", + format: "json", + }); + - language: Ruby + code: |- + response = client.cat.component_templates( + name: "my-template-*", + v: "true", + s: "name", + format: "json" + ) + - language: PHP + code: |- + $resp = $client->cat()->componentTemplates([ + "name" => "my-template-*", + "v" => "true", + "s" => "name", + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_cat/component_templates/my-template-*?v=true&s=name&format=json"' diff --git a/specification/cat/count/examples/request/CatCountRequestExample1.yaml b/specification/cat/count/examples/request/CatCountRequestExample1.yaml index 60f5075a99..4954463002 100644 --- a/specification/cat/count/examples/request/CatCountRequestExample1.yaml +++ b/specification/cat/count/examples/request/CatCountRequestExample1.yaml @@ -1 +1,32 @@ method_request: GET /_cat/count/my-index-000001?v=true&format=json +alternatives: + - language: Python + code: |- + resp = client.cat.count( + index="my-index-000001", + v=True, + format="json", + ) + - language: JavaScript + code: |- + const response = await client.cat.count({ + index: "my-index-000001", + v: "true", + format: "json", + }); + - language: Ruby + code: |- + response = client.cat.count( + index: "my-index-000001", + v: "true", + format: "json" + ) + - language: PHP + code: |- + $resp = $client->cat()->count([ + "index" => "my-index-000001", + "v" => "true", + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_cat/count/my-index-000001?v=true&format=json"' diff --git a/specification/cat/fielddata/examples/request/CatFielddataRequestExample1.yaml b/specification/cat/fielddata/examples/request/CatFielddataRequestExample1.yaml index 5394203473..03358be484 100644 --- a/specification/cat/fielddata/examples/request/CatFielddataRequestExample1.yaml +++ b/specification/cat/fielddata/examples/request/CatFielddataRequestExample1.yaml @@ -1 +1,32 @@ method_request: GET /_cat/fielddata?v=true&fields=body&format=json +alternatives: + - language: Python + code: |- + resp = client.cat.fielddata( + v=True, + fields="body", + format="json", + ) + - language: JavaScript + code: |- + const response = await client.cat.fielddata({ + v: "true", + fields: "body", + format: "json", + }); + - language: Ruby + code: |- + response = client.cat.fielddata( + v: "true", + fields: "body", + format: "json" + ) + - language: PHP + code: |- + $resp = $client->cat()->fielddata([ + "v" => "true", + "fields" => "body", + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_cat/fielddata?v=true&fields=body&format=json"' diff --git a/specification/cat/health/examples/request/CatHealthRequestExample1.yaml b/specification/cat/health/examples/request/CatHealthRequestExample1.yaml index 2c6c0610a6..8609d149fc 100644 --- a/specification/cat/health/examples/request/CatHealthRequestExample1.yaml +++ b/specification/cat/health/examples/request/CatHealthRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET /_cat/health?v=true&format=json +alternatives: + - language: Python + code: |- + resp = client.cat.health( + v=True, + format="json", + ) + - language: JavaScript + code: |- + const response = await client.cat.health({ + v: "true", + format: "json", + }); + - language: Ruby + code: |- + response = client.cat.health( + v: "true", + format: "json" + ) + - language: PHP + code: |- + $resp = $client->cat()->health([ + "v" => "true", + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_cat/health?v=true&format=json"' diff --git a/specification/cat/indices/examples/request/CatIndicesRequestExample1.yaml b/specification/cat/indices/examples/request/CatIndicesRequestExample1.yaml index 523656aac9..2d6cc4456a 100644 --- a/specification/cat/indices/examples/request/CatIndicesRequestExample1.yaml +++ b/specification/cat/indices/examples/request/CatIndicesRequestExample1.yaml @@ -1 +1,37 @@ method_request: GET /_cat/indices/my-index-*?v=true&s=index&format=json +alternatives: + - language: Python + code: |- + resp = client.cat.indices( + index="my-index-*", + v=True, + s="index", + format="json", + ) + - language: JavaScript + code: |- + const response = await client.cat.indices({ + index: "my-index-*", + v: "true", + s: "index", + format: "json", + }); + - language: Ruby + code: |- + response = client.cat.indices( + index: "my-index-*", + v: "true", + s: "index", + format: "json" + ) + - language: PHP + code: |- + $resp = $client->cat()->indices([ + "index" => "my-index-*", + "v" => "true", + "s" => "index", + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_cat/indices/my-index-*?v=true&s=index&format=json"' diff --git a/specification/cat/master/examples/request/CatMasterRequestExample1.yaml b/specification/cat/master/examples/request/CatMasterRequestExample1.yaml index acbdcbf9b2..612fb342a3 100644 --- a/specification/cat/master/examples/request/CatMasterRequestExample1.yaml +++ b/specification/cat/master/examples/request/CatMasterRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET /_cat/master?v=true&format=json +alternatives: + - language: Python + code: |- + resp = client.cat.master( + v=True, + format="json", + ) + - language: JavaScript + code: |- + const response = await client.cat.master({ + v: "true", + format: "json", + }); + - language: Ruby + code: |- + response = client.cat.master( + v: "true", + format: "json" + ) + - language: PHP + code: |- + $resp = $client->cat()->master([ + "v" => "true", + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_cat/master?v=true&format=json"' diff --git a/specification/cat/ml_data_frame_analytics/examples/request/CatDataframeanalyticsRequestExample1.yaml b/specification/cat/ml_data_frame_analytics/examples/request/CatDataframeanalyticsRequestExample1.yaml index 9ea5e61f8b..459d616794 100644 --- a/specification/cat/ml_data_frame_analytics/examples/request/CatDataframeanalyticsRequestExample1.yaml +++ b/specification/cat/ml_data_frame_analytics/examples/request/CatDataframeanalyticsRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET _cat/ml/data_frame/analytics?v=true&format=json +alternatives: + - language: Python + code: |- + resp = client.cat.ml_data_frame_analytics( + v=True, + format="json", + ) + - language: JavaScript + code: |- + const response = await client.cat.mlDataFrameAnalytics({ + v: "true", + format: "json", + }); + - language: Ruby + code: |- + response = client.cat.ml_data_frame_analytics( + v: "true", + format: "json" + ) + - language: PHP + code: |- + $resp = $client->cat()->mlDataFrameAnalytics([ + "v" => "true", + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_cat/ml/data_frame/analytics?v=true&format=json"' diff --git a/specification/cat/ml_datafeeds/examples/request/CatDatafeedsRequestExample1.yaml b/specification/cat/ml_datafeeds/examples/request/CatDatafeedsRequestExample1.yaml index 33cc34fb9f..8697017409 100644 --- a/specification/cat/ml_datafeeds/examples/request/CatDatafeedsRequestExample1.yaml +++ b/specification/cat/ml_datafeeds/examples/request/CatDatafeedsRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET _cat/ml/datafeeds?v=true&format=json +alternatives: + - language: Python + code: |- + resp = client.cat.ml_datafeeds( + v=True, + format="json", + ) + - language: JavaScript + code: |- + const response = await client.cat.mlDatafeeds({ + v: "true", + format: "json", + }); + - language: Ruby + code: |- + response = client.cat.ml_datafeeds( + v: "true", + format: "json" + ) + - language: PHP + code: |- + $resp = $client->cat()->mlDatafeeds([ + "v" => "true", + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_cat/ml/datafeeds?v=true&format=json"' diff --git a/specification/cat/ml_jobs/examples/request/CatJobsRequestExample1.yaml b/specification/cat/ml_jobs/examples/request/CatJobsRequestExample1.yaml index 3b72c00db8..9e1b5d63e8 100644 --- a/specification/cat/ml_jobs/examples/request/CatJobsRequestExample1.yaml +++ b/specification/cat/ml_jobs/examples/request/CatJobsRequestExample1.yaml @@ -1 +1,33 @@ method_request: GET _cat/ml/anomaly_detectors?h=id,s,dpr,mb&v=true&format=json +alternatives: + - language: Python + code: |- + resp = client.cat.ml_jobs( + h="id,s,dpr,mb", + v=True, + format="json", + ) + - language: JavaScript + code: |- + const response = await client.cat.mlJobs({ + h: "id,s,dpr,mb", + v: "true", + format: "json", + }); + - language: Ruby + code: |- + response = client.cat.ml_jobs( + h: "id,s,dpr,mb", + v: "true", + format: "json" + ) + - language: PHP + code: |- + $resp = $client->cat()->mlJobs([ + "h" => "id,s,dpr,mb", + "v" => "true", + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_cat/ml/anomaly_detectors?h=id,s,dpr,mb&v=true&format=json"' diff --git a/specification/cat/ml_trained_models/examples/request/CatTrainedModelsRequestExample1.yaml b/specification/cat/ml_trained_models/examples/request/CatTrainedModelsRequestExample1.yaml index 8c8e3cd670..f0089c9498 100644 --- a/specification/cat/ml_trained_models/examples/request/CatTrainedModelsRequestExample1.yaml +++ b/specification/cat/ml_trained_models/examples/request/CatTrainedModelsRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET _cat/ml/trained_models?v=true&format=json +alternatives: + - language: Python + code: |- + resp = client.cat.ml_trained_models( + v=True, + format="json", + ) + - language: JavaScript + code: |- + const response = await client.cat.mlTrainedModels({ + v: "true", + format: "json", + }); + - language: Ruby + code: |- + response = client.cat.ml_trained_models( + v: "true", + format: "json" + ) + - language: PHP + code: |- + $resp = $client->cat()->mlTrainedModels([ + "v" => "true", + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_cat/ml/trained_models?v=true&format=json"' diff --git a/specification/cat/nodeattrs/examples/request/CatNodeAttributesRequestExample1.yaml b/specification/cat/nodeattrs/examples/request/CatNodeAttributesRequestExample1.yaml index 2b5cf70c7a..00e1df538a 100644 --- a/specification/cat/nodeattrs/examples/request/CatNodeAttributesRequestExample1.yaml +++ b/specification/cat/nodeattrs/examples/request/CatNodeAttributesRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET /_cat/nodeattrs?v=true&format=json +alternatives: + - language: Python + code: |- + resp = client.cat.nodeattrs( + v=True, + format="json", + ) + - language: JavaScript + code: |- + const response = await client.cat.nodeattrs({ + v: "true", + format: "json", + }); + - language: Ruby + code: |- + response = client.cat.nodeattrs( + v: "true", + format: "json" + ) + - language: PHP + code: |- + $resp = $client->cat()->nodeattrs([ + "v" => "true", + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_cat/nodeattrs?v=true&format=json"' diff --git a/specification/cat/nodes/examples/request/CatNodesRequestExample2.yaml b/specification/cat/nodes/examples/request/CatNodesRequestExample2.yaml index d3f9a54521..d77df0042d 100644 --- a/specification/cat/nodes/examples/request/CatNodesRequestExample2.yaml +++ b/specification/cat/nodes/examples/request/CatNodesRequestExample2.yaml @@ -1 +1,32 @@ method_request: GET /_cat/nodes?v=true&h=id,ip,port,v,m&format=json +alternatives: + - language: Python + code: |- + resp = client.cat.nodes( + v=True, + h="id,ip,port,v,m", + format="json", + ) + - language: JavaScript + code: |- + const response = await client.cat.nodes({ + v: "true", + h: "id,ip,port,v,m", + format: "json", + }); + - language: Ruby + code: |- + response = client.cat.nodes( + v: "true", + h: "id,ip,port,v,m", + format: "json" + ) + - language: PHP + code: |- + $resp = $client->cat()->nodes([ + "v" => "true", + "h" => "id,ip,port,v,m", + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_cat/nodes?v=true&h=id,ip,port,v,m&format=json"' diff --git a/specification/cat/pending_tasks/examples/request/CatPendingTasksRequestExample1.yaml b/specification/cat/pending_tasks/examples/request/CatPendingTasksRequestExample1.yaml index 74c11769eb..6bfbf53644 100644 --- a/specification/cat/pending_tasks/examples/request/CatPendingTasksRequestExample1.yaml +++ b/specification/cat/pending_tasks/examples/request/CatPendingTasksRequestExample1.yaml @@ -1 +1,29 @@ method_request: GET /_cat/pending_tasks?v=trueh=insertOrder,timeInQueue,priority,source&format=json +alternatives: + - language: Python + code: |- + resp = client.cat.pending_tasks( + v="trueh=insertOrder,timeInQueue,priority,source", + format="json", + ) + - language: JavaScript + code: |- + const response = await client.cat.pendingTasks({ + v: "trueh=insertOrder,timeInQueue,priority,source", + format: "json", + }); + - language: Ruby + code: |- + response = client.cat.pending_tasks( + v: "trueh=insertOrder,timeInQueue,priority,source", + format: "json" + ) + - language: PHP + code: |- + $resp = $client->cat()->pendingTasks([ + "v" => "trueh=insertOrder,timeInQueue,priority,source", + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_cat/pending_tasks?v=trueh=insertOrder,timeInQueue,priority,source&format=json"' diff --git a/specification/cat/plugins/examples/request/CatPluginsRequestExample1.yaml b/specification/cat/plugins/examples/request/CatPluginsRequestExample1.yaml index 92f220096b..58b74c25e2 100644 --- a/specification/cat/plugins/examples/request/CatPluginsRequestExample1.yaml +++ b/specification/cat/plugins/examples/request/CatPluginsRequestExample1.yaml @@ -1 +1,37 @@ method_request: GET /_cat/plugins?v=true&s=component&h=name,component,version,description&format=json +alternatives: + - language: Python + code: |- + resp = client.cat.plugins( + v=True, + s="component", + h="name,component,version,description", + format="json", + ) + - language: JavaScript + code: |- + const response = await client.cat.plugins({ + v: "true", + s: "component", + h: "name,component,version,description", + format: "json", + }); + - language: Ruby + code: |- + response = client.cat.plugins( + v: "true", + s: "component", + h: "name,component,version,description", + format: "json" + ) + - language: PHP + code: |- + $resp = $client->cat()->plugins([ + "v" => "true", + "s" => "component", + "h" => "name,component,version,description", + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_cat/plugins?v=true&s=component&h=name,component,version,description&format=json"' diff --git a/specification/cat/recovery/examples/request/CatRecoveryRequestExample1.yaml b/specification/cat/recovery/examples/request/CatRecoveryRequestExample1.yaml index f2294cb1bd..dfd76ae6cd 100644 --- a/specification/cat/recovery/examples/request/CatRecoveryRequestExample1.yaml +++ b/specification/cat/recovery/examples/request/CatRecoveryRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET _cat/recovery?v=true&format=json +alternatives: + - language: Python + code: |- + resp = client.cat.recovery( + v=True, + format="json", + ) + - language: JavaScript + code: |- + const response = await client.cat.recovery({ + v: "true", + format: "json", + }); + - language: Ruby + code: |- + response = client.cat.recovery( + v: "true", + format: "json" + ) + - language: PHP + code: |- + $resp = $client->cat()->recovery([ + "v" => "true", + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_cat/recovery?v=true&format=json"' diff --git a/specification/cat/repositories/examples/request/CatRepositoriesRequestExample1.yaml b/specification/cat/repositories/examples/request/CatRepositoriesRequestExample1.yaml index 7ed353b671..babf73dff8 100644 --- a/specification/cat/repositories/examples/request/CatRepositoriesRequestExample1.yaml +++ b/specification/cat/repositories/examples/request/CatRepositoriesRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET /_cat/repositories?v=true&format=json +alternatives: + - language: Python + code: |- + resp = client.cat.repositories( + v=True, + format="json", + ) + - language: JavaScript + code: |- + const response = await client.cat.repositories({ + v: "true", + format: "json", + }); + - language: Ruby + code: |- + response = client.cat.repositories( + v: "true", + format: "json" + ) + - language: PHP + code: |- + $resp = $client->cat()->repositories([ + "v" => "true", + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_cat/repositories?v=true&format=json"' diff --git a/specification/cat/segments/examples/request/CatSegmentsRequestExample1.yaml b/specification/cat/segments/examples/request/CatSegmentsRequestExample1.yaml index 36610bf7fe..e1fdd8817f 100644 --- a/specification/cat/segments/examples/request/CatSegmentsRequestExample1.yaml +++ b/specification/cat/segments/examples/request/CatSegmentsRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET /_cat/segments?v=true&format=json +alternatives: + - language: Python + code: |- + resp = client.cat.segments( + v=True, + format="json", + ) + - language: JavaScript + code: |- + const response = await client.cat.segments({ + v: "true", + format: "json", + }); + - language: Ruby + code: |- + response = client.cat.segments( + v: "true", + format: "json" + ) + - language: PHP + code: |- + $resp = $client->cat()->segments([ + "v" => "true", + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_cat/segments?v=true&format=json"' diff --git a/specification/cat/shards/examples/request/CatShardsRequestExample1.yaml b/specification/cat/shards/examples/request/CatShardsRequestExample1.yaml index a4c20ed991..c33a466695 100644 --- a/specification/cat/shards/examples/request/CatShardsRequestExample1.yaml +++ b/specification/cat/shards/examples/request/CatShardsRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET _cat/shards?format=json +alternatives: + - language: Python + code: |- + resp = client.cat.shards( + format="json", + ) + - language: JavaScript + code: |- + const response = await client.cat.shards({ + format: "json", + }); + - language: Ruby + code: |- + response = client.cat.shards( + format: "json" + ) + - language: PHP + code: |- + $resp = $client->cat()->shards([ + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_cat/shards?format=json"' diff --git a/specification/cat/snapshots/examples/request/CatSnapshotsRequestExample1.yaml b/specification/cat/snapshots/examples/request/CatSnapshotsRequestExample1.yaml index 94228f6cc8..d6c034d480 100644 --- a/specification/cat/snapshots/examples/request/CatSnapshotsRequestExample1.yaml +++ b/specification/cat/snapshots/examples/request/CatSnapshotsRequestExample1.yaml @@ -1 +1,36 @@ method_request: GET /_cat/snapshots/repo1?v=true&s=id&format=json +alternatives: + - language: Python + code: |- + resp = client.cat.snapshots( + repository="repo1", + v=True, + s="id", + format="json", + ) + - language: JavaScript + code: |- + const response = await client.cat.snapshots({ + repository: "repo1", + v: "true", + s: "id", + format: "json", + }); + - language: Ruby + code: |- + response = client.cat.snapshots( + repository: "repo1", + v: "true", + s: "id", + format: "json" + ) + - language: PHP + code: |- + $resp = $client->cat()->snapshots([ + "repository" => "repo1", + "v" => "true", + "s" => "id", + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_cat/snapshots/repo1?v=true&s=id&format=json"' diff --git a/specification/cat/tasks/examples/request/CatTasksRequestExample1.yaml b/specification/cat/tasks/examples/request/CatTasksRequestExample1.yaml index 83f20212f5..2325878f10 100644 --- a/specification/cat/tasks/examples/request/CatTasksRequestExample1.yaml +++ b/specification/cat/tasks/examples/request/CatTasksRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET _cat/tasks?v=true&format=json +alternatives: + - language: Python + code: |- + resp = client.cat.tasks( + v=True, + format="json", + ) + - language: JavaScript + code: |- + const response = await client.cat.tasks({ + v: "true", + format: "json", + }); + - language: Ruby + code: |- + response = client.cat.tasks( + v: "true", + format: "json" + ) + - language: PHP + code: |- + $resp = $client->cat()->tasks([ + "v" => "true", + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_cat/tasks?v=true&format=json"' diff --git a/specification/cat/templates/examples/request/CatTemplatesRequestExample1.yaml b/specification/cat/templates/examples/request/CatTemplatesRequestExample1.yaml index 3a7fdc9a20..868bd34967 100644 --- a/specification/cat/templates/examples/request/CatTemplatesRequestExample1.yaml +++ b/specification/cat/templates/examples/request/CatTemplatesRequestExample1.yaml @@ -1 +1,37 @@ method_request: GET _cat/templates/my-template-*?v=true&s=name&format=json +alternatives: + - language: Python + code: |- + resp = client.cat.templates( + name="my-template-*", + v=True, + s="name", + format="json", + ) + - language: JavaScript + code: |- + const response = await client.cat.templates({ + name: "my-template-*", + v: "true", + s: "name", + format: "json", + }); + - language: Ruby + code: |- + response = client.cat.templates( + name: "my-template-*", + v: "true", + s: "name", + format: "json" + ) + - language: PHP + code: |- + $resp = $client->cat()->templates([ + "name" => "my-template-*", + "v" => "true", + "s" => "name", + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_cat/templates/my-template-*?v=true&s=name&format=json"' diff --git a/specification/cat/thread_pool/examples/request/CatThreadPoolRequestExample1.yaml b/specification/cat/thread_pool/examples/request/CatThreadPoolRequestExample1.yaml index 385f4f68ac..6332cc079f 100644 --- a/specification/cat/thread_pool/examples/request/CatThreadPoolRequestExample1.yaml +++ b/specification/cat/thread_pool/examples/request/CatThreadPoolRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET /_cat/thread_pool?format=json +alternatives: + - language: Python + code: |- + resp = client.cat.thread_pool( + format="json", + ) + - language: JavaScript + code: |- + const response = await client.cat.threadPool({ + format: "json", + }); + - language: Ruby + code: |- + response = client.cat.thread_pool( + format: "json" + ) + - language: PHP + code: |- + $resp = $client->cat()->threadPool([ + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_cat/thread_pool?format=json"' diff --git a/specification/cat/transforms/examples/request/CatTransformsRequestExample1.yaml b/specification/cat/transforms/examples/request/CatTransformsRequestExample1.yaml index f71dc917dd..bc408d2c37 100644 --- a/specification/cat/transforms/examples/request/CatTransformsRequestExample1.yaml +++ b/specification/cat/transforms/examples/request/CatTransformsRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET /_cat/transforms?v=true&format=json +alternatives: + - language: Python + code: |- + resp = client.cat.transforms( + v=True, + format="json", + ) + - language: JavaScript + code: |- + const response = await client.cat.transforms({ + v: "true", + format: "json", + }); + - language: Ruby + code: |- + response = client.cat.transforms( + v: "true", + format: "json" + ) + - language: PHP + code: |- + $resp = $client->cat()->transforms([ + "v" => "true", + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_cat/transforms?v=true&format=json"' diff --git a/specification/ccr/delete_auto_follow_pattern/examples/request/DeleteAutoFollowPatternRequestExample1.yaml b/specification/ccr/delete_auto_follow_pattern/examples/request/DeleteAutoFollowPatternRequestExample1.yaml index 186e1b5ebb..fd86a4d683 100644 --- a/specification/ccr/delete_auto_follow_pattern/examples/request/DeleteAutoFollowPatternRequestExample1.yaml +++ b/specification/ccr/delete_auto_follow_pattern/examples/request/DeleteAutoFollowPatternRequestExample1.yaml @@ -1 +1,24 @@ method_request: DELETE /_ccr/auto_follow/my_auto_follow_pattern +alternatives: + - language: Python + code: |- + resp = client.ccr.delete_auto_follow_pattern( + name="my_auto_follow_pattern", + ) + - language: JavaScript + code: |- + const response = await client.ccr.deleteAutoFollowPattern({ + name: "my_auto_follow_pattern", + }); + - language: Ruby + code: |- + response = client.ccr.delete_auto_follow_pattern( + name: "my_auto_follow_pattern" + ) + - language: PHP + code: |- + $resp = $client->ccr()->deleteAutoFollowPattern([ + "name" => "my_auto_follow_pattern", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ccr/auto_follow/my_auto_follow_pattern"' diff --git a/specification/ccr/follow/examples/request/CreateFollowIndexRequestExample1.yaml b/specification/ccr/follow/examples/request/CreateFollowIndexRequestExample1.yaml index a1ff270865..9e4401db29 100644 --- a/specification/ccr/follow/examples/request/CreateFollowIndexRequestExample1.yaml +++ b/specification/ccr/follow/examples/request/CreateFollowIndexRequestExample1.yaml @@ -20,3 +20,100 @@ value: |- "max_retry_delay" : "10s", "read_poll_timeout" : "30s" } +alternatives: + - language: Python + code: |- + resp = client.ccr.follow( + index="follower_index", + wait_for_active_shards="1", + remote_cluster="remote_cluster", + leader_index="leader_index", + settings={ + "index.number_of_replicas": 0 + }, + max_read_request_operation_count=1024, + max_outstanding_read_requests=16, + max_read_request_size="1024k", + max_write_request_operation_count=32768, + max_write_request_size="16k", + max_outstanding_write_requests=8, + max_write_buffer_count=512, + max_write_buffer_size="512k", + max_retry_delay="10s", + read_poll_timeout="30s", + ) + - language: JavaScript + code: |- + const response = await client.ccr.follow({ + index: "follower_index", + wait_for_active_shards: 1, + remote_cluster: "remote_cluster", + leader_index: "leader_index", + settings: { + "index.number_of_replicas": 0, + }, + max_read_request_operation_count: 1024, + max_outstanding_read_requests: 16, + max_read_request_size: "1024k", + max_write_request_operation_count: 32768, + max_write_request_size: "16k", + max_outstanding_write_requests: 8, + max_write_buffer_count: 512, + max_write_buffer_size: "512k", + max_retry_delay: "10s", + read_poll_timeout: "30s", + }); + - language: Ruby + code: |- + response = client.ccr.follow( + index: "follower_index", + wait_for_active_shards: "1", + body: { + "remote_cluster": "remote_cluster", + "leader_index": "leader_index", + "settings": { + "index.number_of_replicas": 0 + }, + "max_read_request_operation_count": 1024, + "max_outstanding_read_requests": 16, + "max_read_request_size": "1024k", + "max_write_request_operation_count": 32768, + "max_write_request_size": "16k", + "max_outstanding_write_requests": 8, + "max_write_buffer_count": 512, + "max_write_buffer_size": "512k", + "max_retry_delay": "10s", + "read_poll_timeout": "30s" + } + ) + - language: PHP + code: |- + $resp = $client->ccr()->follow([ + "index" => "follower_index", + "wait_for_active_shards" => "1", + "body" => [ + "remote_cluster" => "remote_cluster", + "leader_index" => "leader_index", + "settings" => [ + "index.number_of_replicas" => 0, + ], + "max_read_request_operation_count" => 1024, + "max_outstanding_read_requests" => 16, + "max_read_request_size" => "1024k", + "max_write_request_operation_count" => 32768, + "max_write_request_size" => "16k", + "max_outstanding_write_requests" => 8, + "max_write_buffer_count" => 512, + "max_write_buffer_size" => "512k", + "max_retry_delay" => "10s", + "read_poll_timeout" => "30s", + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"remote_cluster\":\"remote_cluster\",\"leader_index\":\"leader_index\",\"settings\":{\"index.number_of_replicas\":0},\"max\ + _read_request_operation_count\":1024,\"max_outstanding_read_requests\":16,\"max_read_request_size\":\"1024k\",\"max_write_req\ + uest_operation_count\":32768,\"max_write_request_size\":\"16k\",\"max_outstanding_write_requests\":8,\"max_write_buffer_count\ + \":512,\"max_write_buffer_size\":\"512k\",\"max_retry_delay\":\"10s\",\"read_poll_timeout\":\"30s\"}' + \"$ELASTICSEARCH_URL/follower_index/_ccr/follow?wait_for_active_shards=1\"" diff --git a/specification/ccr/follow_info/examples/request/FollowInfoRequestExample1.yaml b/specification/ccr/follow_info/examples/request/FollowInfoRequestExample1.yaml index 6df3adb0f3..520f4d9861 100644 --- a/specification/ccr/follow_info/examples/request/FollowInfoRequestExample1.yaml +++ b/specification/ccr/follow_info/examples/request/FollowInfoRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET /follower_index/_ccr/info +alternatives: + - language: Python + code: |- + resp = client.ccr.follow_info( + index="follower_index", + ) + - language: JavaScript + code: |- + const response = await client.ccr.followInfo({ + index: "follower_index", + }); + - language: Ruby + code: |- + response = client.ccr.follow_info( + index: "follower_index" + ) + - language: PHP + code: |- + $resp = $client->ccr()->followInfo([ + "index" => "follower_index", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/follower_index/_ccr/info"' diff --git a/specification/ccr/follow_stats/examples/request/FollowIndexStatsRequestExample1.yaml b/specification/ccr/follow_stats/examples/request/FollowIndexStatsRequestExample1.yaml index adb3832fb4..b1db055a71 100644 --- a/specification/ccr/follow_stats/examples/request/FollowIndexStatsRequestExample1.yaml +++ b/specification/ccr/follow_stats/examples/request/FollowIndexStatsRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET /follower_index/_ccr/stats +alternatives: + - language: Python + code: |- + resp = client.ccr.follow_stats( + index="follower_index", + ) + - language: JavaScript + code: |- + const response = await client.ccr.followStats({ + index: "follower_index", + }); + - language: Ruby + code: |- + response = client.ccr.follow_stats( + index: "follower_index" + ) + - language: PHP + code: |- + $resp = $client->ccr()->followStats([ + "index" => "follower_index", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/follower_index/_ccr/stats"' diff --git a/specification/ccr/forget_follower/examples/request/ForgetFollowerIndexRequestExample1.yaml b/specification/ccr/forget_follower/examples/request/ForgetFollowerIndexRequestExample1.yaml index cf547d3d5c..dc5558b8d0 100644 --- a/specification/ccr/forget_follower/examples/request/ForgetFollowerIndexRequestExample1.yaml +++ b/specification/ccr/forget_follower/examples/request/ForgetFollowerIndexRequestExample1.yaml @@ -2,4 +2,60 @@ method_request: 'POST //_ccr/forget_follower' description: Run `POST //_ccr/forget_follower`. # type: "request" -value: "{\n \"follower_cluster\" : \"\",\n \"follower_index\" : \"\",\n \"follower_index_uuid\" : \"\",\n \"leader_remote_cluster\" : \"\"\n}" +value: "{ + + \ \"follower_cluster\" : \"\", + + \ \"follower_index\" : \"\", + + \ \"follower_index_uuid\" : \"\", + + \ \"leader_remote_cluster\" : \"\" + + }" +alternatives: + - language: Python + code: |- + resp = client.ccr.forget_follower( + index="", + follower_cluster="", + follower_index="", + follower_index_uuid="", + leader_remote_cluster="", + ) + - language: JavaScript + code: |- + const response = await client.ccr.forgetFollower({ + index: "", + follower_cluster: "", + follower_index: "", + follower_index_uuid: "", + leader_remote_cluster: "", + }); + - language: Ruby + code: |- + response = client.ccr.forget_follower( + index: "", + body: { + "follower_cluster": "", + "follower_index": "", + "follower_index_uuid": "", + "leader_remote_cluster": "" + } + ) + - language: PHP + code: |- + $resp = $client->ccr()->forgetFollower([ + "index" => "", + "body" => [ + "follower_cluster" => "", + "follower_index" => "", + "follower_index_uuid" => "", + "leader_remote_cluster" => "", + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"follower_cluster\":\"\",\"follower_index\":\"\",\"follower_index_uuid\":\"\",\"leader_remote_cluster\":\"\"}' \"$ELASTICSEARCH_URL//_ccr/forget_follower\"" diff --git a/specification/ccr/get_auto_follow_pattern/examples/request/GetAutoFollowPatternRequestExample1.yaml b/specification/ccr/get_auto_follow_pattern/examples/request/GetAutoFollowPatternRequestExample1.yaml index caaaa7c13d..b75891fb3f 100644 --- a/specification/ccr/get_auto_follow_pattern/examples/request/GetAutoFollowPatternRequestExample1.yaml +++ b/specification/ccr/get_auto_follow_pattern/examples/request/GetAutoFollowPatternRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET /_ccr/auto_follow/my_auto_follow_pattern +alternatives: + - language: Python + code: |- + resp = client.ccr.get_auto_follow_pattern( + name="my_auto_follow_pattern", + ) + - language: JavaScript + code: |- + const response = await client.ccr.getAutoFollowPattern({ + name: "my_auto_follow_pattern", + }); + - language: Ruby + code: |- + response = client.ccr.get_auto_follow_pattern( + name: "my_auto_follow_pattern" + ) + - language: PHP + code: |- + $resp = $client->ccr()->getAutoFollowPattern([ + "name" => "my_auto_follow_pattern", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ccr/auto_follow/my_auto_follow_pattern"' diff --git a/specification/ccr/pause_auto_follow_pattern/examples/request/PauseAutoFollowPatternRequestExample1.yaml b/specification/ccr/pause_auto_follow_pattern/examples/request/PauseAutoFollowPatternRequestExample1.yaml index b820410932..dad3cd8753 100644 --- a/specification/ccr/pause_auto_follow_pattern/examples/request/PauseAutoFollowPatternRequestExample1.yaml +++ b/specification/ccr/pause_auto_follow_pattern/examples/request/PauseAutoFollowPatternRequestExample1.yaml @@ -1 +1,24 @@ method_request: POST /_ccr/auto_follow/my_auto_follow_pattern/pause +alternatives: + - language: Python + code: |- + resp = client.ccr.pause_auto_follow_pattern( + name="my_auto_follow_pattern", + ) + - language: JavaScript + code: |- + const response = await client.ccr.pauseAutoFollowPattern({ + name: "my_auto_follow_pattern", + }); + - language: Ruby + code: |- + response = client.ccr.pause_auto_follow_pattern( + name: "my_auto_follow_pattern" + ) + - language: PHP + code: |- + $resp = $client->ccr()->pauseAutoFollowPattern([ + "name" => "my_auto_follow_pattern", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ccr/auto_follow/my_auto_follow_pattern/pause"' diff --git a/specification/ccr/pause_follow/examples/request/PauseFollowIndexRequestExample1.yaml b/specification/ccr/pause_follow/examples/request/PauseFollowIndexRequestExample1.yaml index b072e5ee6a..c93d2106cd 100644 --- a/specification/ccr/pause_follow/examples/request/PauseFollowIndexRequestExample1.yaml +++ b/specification/ccr/pause_follow/examples/request/PauseFollowIndexRequestExample1.yaml @@ -1 +1,24 @@ method_request: POST /follower_index/_ccr/pause_follow +alternatives: + - language: Python + code: |- + resp = client.ccr.pause_follow( + index="follower_index", + ) + - language: JavaScript + code: |- + const response = await client.ccr.pauseFollow({ + index: "follower_index", + }); + - language: Ruby + code: |- + response = client.ccr.pause_follow( + index: "follower_index" + ) + - language: PHP + code: |- + $resp = $client->ccr()->pauseFollow([ + "index" => "follower_index", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/follower_index/_ccr/pause_follow"' diff --git a/specification/ccr/put_auto_follow_pattern/examples/request/PutAutoFollowPatternRequestExample1.yaml b/specification/ccr/put_auto_follow_pattern/examples/request/PutAutoFollowPatternRequestExample1.yaml index 16e1e041ff..168203ff2d 100644 --- a/specification/ccr/put_auto_follow_pattern/examples/request/PutAutoFollowPatternRequestExample1.yaml +++ b/specification/ccr/put_auto_follow_pattern/examples/request/PutAutoFollowPatternRequestExample1.yaml @@ -3,4 +3,147 @@ method_request: 'PUT /_ccr/auto_follow/my_auto_follow_pattern' description: > Run `PUT /_ccr/auto_follow/my_auto_follow_pattern` to creates an auto-follow pattern. # type: "request" -value: "{\n \"remote_cluster\" : \"remote_cluster\",\n \"leader_index_patterns\" :\n [\n \"leader_index*\"\n ],\n \"follow_index_pattern\" : \"{{leader_index}}-follower\",\n \"settings\": {\n \"index.number_of_replicas\": 0\n },\n \"max_read_request_operation_count\" : 1024,\n \"max_outstanding_read_requests\" : 16,\n \"max_read_request_size\" : \"1024k\",\n \"max_write_request_operation_count\" : 32768,\n \"max_write_request_size\" : \"16k\",\n \"max_outstanding_write_requests\" : 8,\n \"max_write_buffer_count\" : 512,\n \"max_write_buffer_size\" : \"512k\",\n \"max_retry_delay\" : \"10s\",\n \"read_poll_timeout\" : \"30s\"\n}" +value: "{ + + \ \"remote_cluster\" : \"remote_cluster\", + + \ \"leader_index_patterns\" : + + \ [ + + \ \"leader_index*\" + + \ ], + + \ \"follow_index_pattern\" : \"{{leader_index}}-follower\", + + \ \"settings\": { + + \ \"index.number_of_replicas\": 0 + + \ }, + + \ \"max_read_request_operation_count\" : 1024, + + \ \"max_outstanding_read_requests\" : 16, + + \ \"max_read_request_size\" : \"1024k\", + + \ \"max_write_request_operation_count\" : 32768, + + \ \"max_write_request_size\" : \"16k\", + + \ \"max_outstanding_write_requests\" : 8, + + \ \"max_write_buffer_count\" : 512, + + \ \"max_write_buffer_size\" : \"512k\", + + \ \"max_retry_delay\" : \"10s\", + + \ \"read_poll_timeout\" : \"30s\" + + }" +alternatives: + - language: Python + code: |- + resp = client.ccr.put_auto_follow_pattern( + name="my_auto_follow_pattern", + remote_cluster="remote_cluster", + leader_index_patterns=[ + "leader_index*" + ], + follow_index_pattern="{{leader_index}}-follower", + settings={ + "index.number_of_replicas": 0 + }, + max_read_request_operation_count=1024, + max_outstanding_read_requests=16, + max_read_request_size="1024k", + max_write_request_operation_count=32768, + max_write_request_size="16k", + max_outstanding_write_requests=8, + max_write_buffer_count=512, + max_write_buffer_size="512k", + max_retry_delay="10s", + read_poll_timeout="30s", + ) + - language: JavaScript + code: |- + const response = await client.ccr.putAutoFollowPattern({ + name: "my_auto_follow_pattern", + remote_cluster: "remote_cluster", + leader_index_patterns: ["leader_index*"], + follow_index_pattern: "{{leader_index}}-follower", + settings: { + "index.number_of_replicas": 0, + }, + max_read_request_operation_count: 1024, + max_outstanding_read_requests: 16, + max_read_request_size: "1024k", + max_write_request_operation_count: 32768, + max_write_request_size: "16k", + max_outstanding_write_requests: 8, + max_write_buffer_count: 512, + max_write_buffer_size: "512k", + max_retry_delay: "10s", + read_poll_timeout: "30s", + }); + - language: Ruby + code: |- + response = client.ccr.put_auto_follow_pattern( + name: "my_auto_follow_pattern", + body: { + "remote_cluster": "remote_cluster", + "leader_index_patterns": [ + "leader_index*" + ], + "follow_index_pattern": "{{leader_index}}-follower", + "settings": { + "index.number_of_replicas": 0 + }, + "max_read_request_operation_count": 1024, + "max_outstanding_read_requests": 16, + "max_read_request_size": "1024k", + "max_write_request_operation_count": 32768, + "max_write_request_size": "16k", + "max_outstanding_write_requests": 8, + "max_write_buffer_count": 512, + "max_write_buffer_size": "512k", + "max_retry_delay": "10s", + "read_poll_timeout": "30s" + } + ) + - language: PHP + code: |- + $resp = $client->ccr()->putAutoFollowPattern([ + "name" => "my_auto_follow_pattern", + "body" => [ + "remote_cluster" => "remote_cluster", + "leader_index_patterns" => array( + "leader_index*", + ), + "follow_index_pattern" => "{{leader_index}}-follower", + "settings" => [ + "index.number_of_replicas" => 0, + ], + "max_read_request_operation_count" => 1024, + "max_outstanding_read_requests" => 16, + "max_read_request_size" => "1024k", + "max_write_request_operation_count" => 32768, + "max_write_request_size" => "16k", + "max_outstanding_write_requests" => 8, + "max_write_buffer_count" => 512, + "max_write_buffer_size" => "512k", + "max_retry_delay" => "10s", + "read_poll_timeout" => "30s", + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"remote_cluster\":\"remote_cluster\",\"leader_index_patterns\":[\"leader_index*\"],\"follow_index_pattern\":\"{{leader_ind\ + ex}}-follower\",\"settings\":{\"index.number_of_replicas\":0},\"max_read_request_operation_count\":1024,\"max_outstanding_rea\ + d_requests\":16,\"max_read_request_size\":\"1024k\",\"max_write_request_operation_count\":32768,\"max_write_request_size\":\"\ + 16k\",\"max_outstanding_write_requests\":8,\"max_write_buffer_count\":512,\"max_write_buffer_size\":\"512k\",\"max_retry_delay\ + \":\"10s\",\"read_poll_timeout\":\"30s\"}' \"$ELASTICSEARCH_URL/_ccr/auto_follow/my_auto_follow_pattern\"" diff --git a/specification/ccr/resume_auto_follow_pattern/examples/request/ResumeAutoFollowPatternRequestExample1.yaml b/specification/ccr/resume_auto_follow_pattern/examples/request/ResumeAutoFollowPatternRequestExample1.yaml index 9a06b480ab..b21568c755 100644 --- a/specification/ccr/resume_auto_follow_pattern/examples/request/ResumeAutoFollowPatternRequestExample1.yaml +++ b/specification/ccr/resume_auto_follow_pattern/examples/request/ResumeAutoFollowPatternRequestExample1.yaml @@ -1 +1,24 @@ method_request: POST /_ccr/auto_follow/my_auto_follow_pattern/resume +alternatives: + - language: Python + code: |- + resp = client.ccr.resume_auto_follow_pattern( + name="my_auto_follow_pattern", + ) + - language: JavaScript + code: |- + const response = await client.ccr.resumeAutoFollowPattern({ + name: "my_auto_follow_pattern", + }); + - language: Ruby + code: |- + response = client.ccr.resume_auto_follow_pattern( + name: "my_auto_follow_pattern" + ) + - language: PHP + code: |- + $resp = $client->ccr()->resumeAutoFollowPattern([ + "name" => "my_auto_follow_pattern", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ccr/auto_follow/my_auto_follow_pattern/resume"' diff --git a/specification/ccr/resume_follow/examples/request/ResumeFollowIndexRequestExample1.yaml b/specification/ccr/resume_follow/examples/request/ResumeFollowIndexRequestExample1.yaml index 2af6e225b5..820f6d0543 100644 --- a/specification/ccr/resume_follow/examples/request/ResumeFollowIndexRequestExample1.yaml +++ b/specification/ccr/resume_follow/examples/request/ResumeFollowIndexRequestExample1.yaml @@ -15,3 +15,75 @@ value: |- "max_retry_delay" : "10s", "read_poll_timeout" : "30s" } +alternatives: + - language: Python + code: |- + resp = client.ccr.resume_follow( + index="follower_index", + max_read_request_operation_count=1024, + max_outstanding_read_requests=16, + max_read_request_size="1024k", + max_write_request_operation_count=32768, + max_write_request_size="16k", + max_outstanding_write_requests=8, + max_write_buffer_count=512, + max_write_buffer_size="512k", + max_retry_delay="10s", + read_poll_timeout="30s", + ) + - language: JavaScript + code: |- + const response = await client.ccr.resumeFollow({ + index: "follower_index", + max_read_request_operation_count: 1024, + max_outstanding_read_requests: 16, + max_read_request_size: "1024k", + max_write_request_operation_count: 32768, + max_write_request_size: "16k", + max_outstanding_write_requests: 8, + max_write_buffer_count: 512, + max_write_buffer_size: "512k", + max_retry_delay: "10s", + read_poll_timeout: "30s", + }); + - language: Ruby + code: |- + response = client.ccr.resume_follow( + index: "follower_index", + body: { + "max_read_request_operation_count": 1024, + "max_outstanding_read_requests": 16, + "max_read_request_size": "1024k", + "max_write_request_operation_count": 32768, + "max_write_request_size": "16k", + "max_outstanding_write_requests": 8, + "max_write_buffer_count": 512, + "max_write_buffer_size": "512k", + "max_retry_delay": "10s", + "read_poll_timeout": "30s" + } + ) + - language: PHP + code: |- + $resp = $client->ccr()->resumeFollow([ + "index" => "follower_index", + "body" => [ + "max_read_request_operation_count" => 1024, + "max_outstanding_read_requests" => 16, + "max_read_request_size" => "1024k", + "max_write_request_operation_count" => 32768, + "max_write_request_size" => "16k", + "max_outstanding_write_requests" => 8, + "max_write_buffer_count" => 512, + "max_write_buffer_size" => "512k", + "max_retry_delay" => "10s", + "read_poll_timeout" => "30s", + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"max_read_request_operation_count\":1024,\"max_outstanding_read_requests\":16,\"max_read_request_size\":\"1024k\",\"max_wr\ + ite_request_operation_count\":32768,\"max_write_request_size\":\"16k\",\"max_outstanding_write_requests\":8,\"max_write_buffe\ + r_count\":512,\"max_write_buffer_size\":\"512k\",\"max_retry_delay\":\"10s\",\"read_poll_timeout\":\"30s\"}' + \"$ELASTICSEARCH_URL/follower_index/_ccr/resume_follow\"" diff --git a/specification/ccr/stats/examples/request/CcrStatsRequestExample1.yaml b/specification/ccr/stats/examples/request/CcrStatsRequestExample1.yaml index b046eaf51b..5742b395b3 100644 --- a/specification/ccr/stats/examples/request/CcrStatsRequestExample1.yaml +++ b/specification/ccr/stats/examples/request/CcrStatsRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET /_ccr/stats +alternatives: + - language: Python + code: resp = client.ccr.stats() + - language: JavaScript + code: const response = await client.ccr.stats(); + - language: Ruby + code: response = client.ccr.stats + - language: PHP + code: $resp = $client->ccr()->stats(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ccr/stats"' diff --git a/specification/ccr/unfollow/examples/request/UnfollowIndexRequestExample1.yaml b/specification/ccr/unfollow/examples/request/UnfollowIndexRequestExample1.yaml index 6258df4485..69e8e90a27 100644 --- a/specification/ccr/unfollow/examples/request/UnfollowIndexRequestExample1.yaml +++ b/specification/ccr/unfollow/examples/request/UnfollowIndexRequestExample1.yaml @@ -1 +1,24 @@ method_request: POST /follower_index/_ccr/unfollow +alternatives: + - language: Python + code: |- + resp = client.ccr.unfollow( + index="follower_index", + ) + - language: JavaScript + code: |- + const response = await client.ccr.unfollow({ + index: "follower_index", + }); + - language: Ruby + code: |- + response = client.ccr.unfollow( + index: "follower_index" + ) + - language: PHP + code: |- + $resp = $client->ccr()->unfollow([ + "index" => "follower_index", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/follower_index/_ccr/unfollow"' diff --git a/specification/cluster/allocation_explain/examples/request/ClusterAllocationExplainRequestExample1.yaml b/specification/cluster/allocation_explain/examples/request/ClusterAllocationExplainRequestExample1.yaml index c3ef492eb9..9efb788997 100644 --- a/specification/cluster/allocation_explain/examples/request/ClusterAllocationExplainRequestExample1.yaml +++ b/specification/cluster/allocation_explain/examples/request/ClusterAllocationExplainRequestExample1.yaml @@ -9,3 +9,45 @@ value: |- "primary": false, "current_node": "my-node" } +alternatives: + - language: Python + code: |- + resp = client.cluster.allocation_explain( + index="my-index-000001", + shard=0, + primary=False, + current_node="my-node", + ) + - language: JavaScript + code: |- + const response = await client.cluster.allocationExplain({ + index: "my-index-000001", + shard: 0, + primary: false, + current_node: "my-node", + }); + - language: Ruby + code: |- + response = client.cluster.allocation_explain( + body: { + "index": "my-index-000001", + "shard": 0, + "primary": false, + "current_node": "my-node" + } + ) + - language: PHP + code: |- + $resp = $client->cluster()->allocationExplain([ + "body" => [ + "index" => "my-index-000001", + "shard" => 0, + "primary" => false, + "current_node" => "my-node", + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"index":"my-index-000001","shard":0,"primary":false,"current_node":"my-node"}'' + "$ELASTICSEARCH_URL/_cluster/allocation/explain"' diff --git a/specification/cluster/delete_component_template/examples/request/ClusterDeleteComponentTemplateExample1.yaml b/specification/cluster/delete_component_template/examples/request/ClusterDeleteComponentTemplateExample1.yaml index c8910cf9f2..a28d273f76 100644 --- a/specification/cluster/delete_component_template/examples/request/ClusterDeleteComponentTemplateExample1.yaml +++ b/specification/cluster/delete_component_template/examples/request/ClusterDeleteComponentTemplateExample1.yaml @@ -1 +1,24 @@ method_request: DELETE _component_template/template_1 +alternatives: + - language: Python + code: |- + resp = client.cluster.delete_component_template( + name="template_1", + ) + - language: JavaScript + code: |- + const response = await client.cluster.deleteComponentTemplate({ + name: "template_1", + }); + - language: Ruby + code: |- + response = client.cluster.delete_component_template( + name: "template_1" + ) + - language: PHP + code: |- + $resp = $client->cluster()->deleteComponentTemplate([ + "name" => "template_1", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_component_template/template_1"' diff --git a/specification/cluster/get_component_template/examples/request/ClusterGetComponentTemplateExample1.yaml b/specification/cluster/get_component_template/examples/request/ClusterGetComponentTemplateExample1.yaml index e02a3625a8..cf0077db27 100644 --- a/specification/cluster/get_component_template/examples/request/ClusterGetComponentTemplateExample1.yaml +++ b/specification/cluster/get_component_template/examples/request/ClusterGetComponentTemplateExample1.yaml @@ -1 +1,24 @@ method_request: GET /_component_template/template_1 +alternatives: + - language: Python + code: |- + resp = client.cluster.get_component_template( + name="template_1", + ) + - language: JavaScript + code: |- + const response = await client.cluster.getComponentTemplate({ + name: "template_1", + }); + - language: Ruby + code: |- + response = client.cluster.get_component_template( + name: "template_1" + ) + - language: PHP + code: |- + $resp = $client->cluster()->getComponentTemplate([ + "name" => "template_1", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_component_template/template_1"' diff --git a/specification/cluster/get_settings/examples/request/ClusterGetSettingsExample1.yaml b/specification/cluster/get_settings/examples/request/ClusterGetSettingsExample1.yaml index 8b8cd59ecc..1ca9210db2 100644 --- a/specification/cluster/get_settings/examples/request/ClusterGetSettingsExample1.yaml +++ b/specification/cluster/get_settings/examples/request/ClusterGetSettingsExample1.yaml @@ -1 +1,25 @@ method_request: GET /_cluster/settings?filter_path=persistent.cluster.remote +alternatives: + - language: Python + code: |- + resp = client.cluster.get_settings( + filter_path="persistent.cluster.remote", + ) + - language: JavaScript + code: |- + const response = await client.cluster.getSettings({ + filter_path: "persistent.cluster.remote", + }); + - language: Ruby + code: |- + response = client.cluster.get_settings( + filter_path: "persistent.cluster.remote" + ) + - language: PHP + code: |- + $resp = $client->cluster()->getSettings([ + "filter_path" => "persistent.cluster.remote", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_cluster/settings?filter_path=persistent.cluster.remote"' diff --git a/specification/cluster/health/examples/request/ClusterHealthRequestExample1.yaml b/specification/cluster/health/examples/request/ClusterHealthRequestExample1.yaml index 4852a044ab..22839770e7 100644 --- a/specification/cluster/health/examples/request/ClusterHealthRequestExample1.yaml +++ b/specification/cluster/health/examples/request/ClusterHealthRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET _cluster/health +alternatives: + - language: Python + code: resp = client.cluster.health() + - language: JavaScript + code: const response = await client.cluster.health(); + - language: Ruby + code: response = client.cluster.health + - language: PHP + code: $resp = $client->cluster()->health(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_cluster/health"' diff --git a/specification/cluster/info/examples/request/ClusterInfoExample1.yaml b/specification/cluster/info/examples/request/ClusterInfoExample1.yaml index c2742b05e4..40d1c505f5 100644 --- a/specification/cluster/info/examples/request/ClusterInfoExample1.yaml +++ b/specification/cluster/info/examples/request/ClusterInfoExample1.yaml @@ -1 +1,24 @@ method_request: GET /_info/_all +alternatives: + - language: Python + code: |- + resp = client.cluster.info( + target="_all", + ) + - language: JavaScript + code: |- + const response = await client.cluster.info({ + target: "_all", + }); + - language: Ruby + code: |- + response = client.cluster.info( + target: "_all" + ) + - language: PHP + code: |- + $resp = $client->cluster()->info([ + "target" => "_all", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_info/_all"' diff --git a/specification/cluster/pending_tasks/examples/request/ClusterPendingTasksExample1.yaml b/specification/cluster/pending_tasks/examples/request/ClusterPendingTasksExample1.yaml index 1217dc2640..c02d6fe93d 100644 --- a/specification/cluster/pending_tasks/examples/request/ClusterPendingTasksExample1.yaml +++ b/specification/cluster/pending_tasks/examples/request/ClusterPendingTasksExample1.yaml @@ -1 +1,12 @@ method_request: GET /_cluster/pending_tasks +alternatives: + - language: Python + code: resp = client.cluster.pending_tasks() + - language: JavaScript + code: const response = await client.cluster.pendingTasks(); + - language: Ruby + code: response = client.cluster.pending_tasks + - language: PHP + code: $resp = $client->cluster()->pendingTasks(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_cluster/pending_tasks"' diff --git a/specification/cluster/put_component_template/examples/request/ClusterPutComponentTemplateRequestExample1.yaml b/specification/cluster/put_component_template/examples/request/ClusterPutComponentTemplateRequestExample1.yaml index 1e8407935b..99b8ee65d7 100644 --- a/specification/cluster/put_component_template/examples/request/ClusterPutComponentTemplateRequestExample1.yaml +++ b/specification/cluster/put_component_template/examples/request/ClusterPutComponentTemplateRequestExample1.yaml @@ -15,3 +15,106 @@ value: created_at: type: date format: 'EEE MMM dd HH:mm:ss Z yyyy' +alternatives: + - language: Python + code: |- + resp = client.cluster.put_component_template( + name="template_1", + template=None, + settings={ + "number_of_shards": 1 + }, + mappings={ + "_source": { + "enabled": False + }, + "properties": { + "host_name": { + "type": "keyword" + }, + "created_at": { + "type": "date", + "format": "EEE MMM dd HH:mm:ss Z yyyy" + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.cluster.putComponentTemplate({ + name: "template_1", + template: null, + settings: { + number_of_shards: 1, + }, + mappings: { + _source: { + enabled: false, + }, + properties: { + host_name: { + type: "keyword", + }, + created_at: { + type: "date", + format: "EEE MMM dd HH:mm:ss Z yyyy", + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.cluster.put_component_template( + name: "template_1", + body: { + "template": nil, + "settings": { + "number_of_shards": 1 + }, + "mappings": { + "_source": { + "enabled": false + }, + "properties": { + "host_name": { + "type": "keyword" + }, + "created_at": { + "type": "date", + "format": "EEE MMM dd HH:mm:ss Z yyyy" + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->cluster()->putComponentTemplate([ + "name" => "template_1", + "body" => [ + "template" => null, + "settings" => [ + "number_of_shards" => 1, + ], + "mappings" => [ + "_source" => [ + "enabled" => false, + ], + "properties" => [ + "host_name" => [ + "type" => "keyword", + ], + "created_at" => [ + "type" => "date", + "format" => "EEE MMM dd HH:mm:ss Z yyyy", + ], + ], + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"template\":null,\"settings\":{\"number_of_shards\":1},\"mappings\":{\"_source\":{\"enabled\":false},\"properties\":{\"hos\ + t_name\":{\"type\":\"keyword\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z yyyy\"}}}}' + \"$ELASTICSEARCH_URL/_component_template/template_1\"" diff --git a/specification/cluster/put_component_template/examples/request/ClusterPutComponentTemplateRequestExample2.yaml b/specification/cluster/put_component_template/examples/request/ClusterPutComponentTemplateRequestExample2.yaml index c60eb8ae08..e7371f5c64 100644 --- a/specification/cluster/put_component_template/examples/request/ClusterPutComponentTemplateRequestExample2.yaml +++ b/specification/cluster/put_component_template/examples/request/ClusterPutComponentTemplateRequestExample2.yaml @@ -1,8 +1,8 @@ summary: Create a template with aliases method_request: PUT _component_template/template_1 description: > - You can include index aliases in a component template. - During index creation, the `{index}` placeholder in the alias name will be replaced with the actual index name that the template gets applied to. + You can include index aliases in a component template. During index creation, the `{index}` placeholder in the alias name will be + replaced with the actual index name that the template gets applied to. # type: request value: template: @@ -16,3 +16,97 @@ value: user.id: kimchy routing: shard-1 '{index}-alias': {} +alternatives: + - language: Python + code: |- + resp = client.cluster.put_component_template( + name="template_1", + template=None, + settings={ + "number_of_shards": 1 + }, + aliases={ + "alias1": {}, + "alias2": { + "filter": { + "term": { + "user.id": "kimchy" + } + }, + "routing": "shard-1" + }, + "{index}-alias": {} + }, + ) + - language: JavaScript + code: |- + const response = await client.cluster.putComponentTemplate({ + name: "template_1", + template: null, + settings: { + number_of_shards: 1, + }, + aliases: { + alias1: {}, + alias2: { + filter: { + term: { + "user.id": "kimchy", + }, + }, + routing: "shard-1", + }, + "{index}-alias": {}, + }, + }); + - language: Ruby + code: |- + response = client.cluster.put_component_template( + name: "template_1", + body: { + "template": nil, + "settings": { + "number_of_shards": 1 + }, + "aliases": { + "alias1": {}, + "alias2": { + "filter": { + "term": { + "user.id": "kimchy" + } + }, + "routing": "shard-1" + }, + "{index}-alias": {} + } + } + ) + - language: PHP + code: |- + $resp = $client->cluster()->putComponentTemplate([ + "name" => "template_1", + "body" => [ + "template" => null, + "settings" => [ + "number_of_shards" => 1, + ], + "aliases" => [ + "alias1" => new ArrayObject([]), + "alias2" => [ + "filter" => [ + "term" => [ + "user.id" => "kimchy", + ], + ], + "routing" => "shard-1", + ], + "{index}-alias" => new ArrayObject([]), + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"template\":null,\"settings\":{\"number_of_shards\":1},\"aliases\":{\"alias1\":{},\"alias2\":{\"filter\":{\"term\":{\"user\ + .id\":\"kimchy\"}},\"routing\":\"shard-1\"},\"{index}-alias\":{}}}' \"$ELASTICSEARCH_URL/_component_template/template_1\"" diff --git a/specification/cluster/put_settings/examples/request/ClusterPutSettingsRequestExample1.yaml b/specification/cluster/put_settings/examples/request/ClusterPutSettingsRequestExample1.yaml index fe855ff11d..146a7ca5ce 100644 --- a/specification/cluster/put_settings/examples/request/ClusterPutSettingsRequestExample1.yaml +++ b/specification/cluster/put_settings/examples/request/ClusterPutSettingsRequestExample1.yaml @@ -8,3 +8,40 @@ value: |- "indices.recovery.max_bytes_per_sec" : "50mb" } } +alternatives: + - language: Python + code: |- + resp = client.cluster.put_settings( + persistent={ + "indices.recovery.max_bytes_per_sec": "50mb" + }, + ) + - language: JavaScript + code: |- + const response = await client.cluster.putSettings({ + persistent: { + "indices.recovery.max_bytes_per_sec": "50mb", + }, + }); + - language: Ruby + code: |- + response = client.cluster.put_settings( + body: { + "persistent": { + "indices.recovery.max_bytes_per_sec": "50mb" + } + } + ) + - language: PHP + code: |- + $resp = $client->cluster()->putSettings([ + "body" => [ + "persistent" => [ + "indices.recovery.max_bytes_per_sec" => "50mb", + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"persistent":{"indices.recovery.max_bytes_per_sec":"50mb"}}'' "$ELASTICSEARCH_URL/_cluster/settings"' diff --git a/specification/cluster/put_settings/examples/request/ClusterPutSettingsRequestExample2.yaml b/specification/cluster/put_settings/examples/request/ClusterPutSettingsRequestExample2.yaml index cdcf902e6e..9ceaa8c89a 100644 --- a/specification/cluster/put_settings/examples/request/ClusterPutSettingsRequestExample2.yaml +++ b/specification/cluster/put_settings/examples/request/ClusterPutSettingsRequestExample2.yaml @@ -1,10 +1,11 @@ summary: A setting with multiple patterns method_request: PUT /_cluster/settings description: > - PUT `/_cluster/settings` to update the `action.auto_create_index` setting. - The setting accepts a comma-separated list of patterns that you want to allow or you can prefix each pattern with `+` or `-` to indicate whether it should be allowed or blocked. - In this example, the auto-creation of indices called `my-index-000001` or `index10` is allowed, the creation of indices that match the pattern `index1*` is blocked, and the creation of any other indices that match the `ind*` pattern is allowed. - Patterns are matched in the order specified. + PUT `/_cluster/settings` to update the `action.auto_create_index` setting. The setting accepts a comma-separated list of patterns + that you want to allow or you can prefix each pattern with `+` or `-` to indicate whether it should be allowed or blocked. In this + example, the auto-creation of indices called `my-index-000001` or `index10` is allowed, the creation of indices that match the + pattern `index1*` is blocked, and the creation of any other indices that match the `ind*` pattern is allowed. Patterns are matched + in the order specified. # type: request value: |- { @@ -12,3 +13,41 @@ value: |- "action.auto_create_index": "my-index-000001,index10,-index1*,+ind*" } } +alternatives: + - language: Python + code: |- + resp = client.cluster.put_settings( + persistent={ + "action.auto_create_index": "my-index-000001,index10,-index1*,+ind*" + }, + ) + - language: JavaScript + code: |- + const response = await client.cluster.putSettings({ + persistent: { + "action.auto_create_index": "my-index-000001,index10,-index1*,+ind*", + }, + }); + - language: Ruby + code: |- + response = client.cluster.put_settings( + body: { + "persistent": { + "action.auto_create_index": "my-index-000001,index10,-index1*,+ind*" + } + } + ) + - language: PHP + code: |- + $resp = $client->cluster()->putSettings([ + "body" => [ + "persistent" => [ + "action.auto_create_index" => "my-index-000001,index10,-index1*,+ind*", + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"persistent":{"action.auto_create_index":"my-index-000001,index10,-index1*,+ind*"}}'' + "$ELASTICSEARCH_URL/_cluster/settings"' diff --git a/specification/cluster/remote_info/examples/request/ClusterRemoteInfoExample1.yaml b/specification/cluster/remote_info/examples/request/ClusterRemoteInfoExample1.yaml index 989596ba8f..905c30e9ef 100644 --- a/specification/cluster/remote_info/examples/request/ClusterRemoteInfoExample1.yaml +++ b/specification/cluster/remote_info/examples/request/ClusterRemoteInfoExample1.yaml @@ -1 +1,12 @@ method_request: GET /_remote/info +alternatives: + - language: Python + code: resp = client.cluster.remote_info() + - language: JavaScript + code: const response = await client.cluster.remoteInfo(); + - language: Ruby + code: response = client.cluster.remote_info + - language: PHP + code: $resp = $client->cluster()->remoteInfo(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_remote/info"' diff --git a/specification/cluster/reroute/examples/request/ClusterRerouteRequestExample1.yaml b/specification/cluster/reroute/examples/request/ClusterRerouteRequestExample1.yaml index 1d9b402115..fcbc8a511d 100644 --- a/specification/cluster/reroute/examples/request/ClusterRerouteRequestExample1.yaml +++ b/specification/cluster/reroute/examples/request/ClusterRerouteRequestExample1.yaml @@ -19,3 +19,101 @@ value: |- } ] } +alternatives: + - language: Python + code: |- + resp = client.cluster.reroute( + metric="none", + commands=[ + { + "move": { + "index": "test", + "shard": 0, + "from_node": "node1", + "to_node": "node2" + } + }, + { + "allocate_replica": { + "index": "test", + "shard": 1, + "node": "node3" + } + } + ], + ) + - language: JavaScript + code: |- + const response = await client.cluster.reroute({ + metric: "none", + commands: [ + { + move: { + index: "test", + shard: 0, + from_node: "node1", + to_node: "node2", + }, + }, + { + allocate_replica: { + index: "test", + shard: 1, + node: "node3", + }, + }, + ], + }); + - language: Ruby + code: |- + response = client.cluster.reroute( + metric: "none", + body: { + "commands": [ + { + "move": { + "index": "test", + "shard": 0, + "from_node": "node1", + "to_node": "node2" + } + }, + { + "allocate_replica": { + "index": "test", + "shard": 1, + "node": "node3" + } + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->cluster()->reroute([ + "metric" => "none", + "body" => [ + "commands" => array( + [ + "move" => [ + "index" => "test", + "shard" => 0, + "from_node" => "node1", + "to_node" => "node2", + ], + ], + [ + "allocate_replica" => [ + "index" => "test", + "shard" => 1, + "node" => "node3", + ], + ], + ), + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"commands\":[{\"move\":{\"index\":\"test\",\"shard\":0,\"from_node\":\"node1\",\"to_node\":\"node2\"}},{\"allocate_replica\ + \":{\"index\":\"test\",\"shard\":1,\"node\":\"node3\"}}]}' \"$ELASTICSEARCH_URL/_cluster/reroute?metric=none\"" diff --git a/specification/cluster/state/examples/request/ClusterStateExample1.yaml b/specification/cluster/state/examples/request/ClusterStateExample1.yaml index 51c4ecac5f..62c322836f 100644 --- a/specification/cluster/state/examples/request/ClusterStateExample1.yaml +++ b/specification/cluster/state/examples/request/ClusterStateExample1.yaml @@ -1 +1,25 @@ method_request: GET /_cluster/state?filter_path=metadata.cluster_coordination.last_committed_config +alternatives: + - language: Python + code: |- + resp = client.cluster.state( + filter_path="metadata.cluster_coordination.last_committed_config", + ) + - language: JavaScript + code: |- + const response = await client.cluster.state({ + filter_path: "metadata.cluster_coordination.last_committed_config", + }); + - language: Ruby + code: |- + response = client.cluster.state( + filter_path: "metadata.cluster_coordination.last_committed_config" + ) + - language: PHP + code: |- + $resp = $client->cluster()->state([ + "filter_path" => "metadata.cluster_coordination.last_committed_config", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_cluster/state?filter_path=metadata.cluster_coordination.last_committed_config"' diff --git a/specification/cluster/stats/examples/request/ClusterStatsExample1.yaml b/specification/cluster/stats/examples/request/ClusterStatsExample1.yaml index 94af04f32c..67630b86b0 100644 --- a/specification/cluster/stats/examples/request/ClusterStatsExample1.yaml +++ b/specification/cluster/stats/examples/request/ClusterStatsExample1.yaml @@ -1 +1,29 @@ method_request: GET _cluster/stats?human&filter_path=indices.mappings.total_deduplicated_mapping_size* +alternatives: + - language: Python + code: |- + resp = client.cluster.stats( + human=True, + filter_path="indices.mappings.total_deduplicated_mapping_size*", + ) + - language: JavaScript + code: |- + const response = await client.cluster.stats({ + human: "true", + filter_path: "indices.mappings.total_deduplicated_mapping_size*", + }); + - language: Ruby + code: |- + response = client.cluster.stats( + human: "true", + filter_path: "indices.mappings.total_deduplicated_mapping_size*" + ) + - language: PHP + code: |- + $resp = $client->cluster()->stats([ + "human" => "true", + "filter_path" => "indices.mappings.total_deduplicated_mapping_size*", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_cluster/stats?human&filter_path=indices.mappings.total_deduplicated_mapping_size*"' diff --git a/specification/connector/check_in/examples/request/ConnectorCheckInExample1.yaml b/specification/connector/check_in/examples/request/ConnectorCheckInExample1.yaml index 2f97b859fb..bb73b7db78 100644 --- a/specification/connector/check_in/examples/request/ConnectorCheckInExample1.yaml +++ b/specification/connector/check_in/examples/request/ConnectorCheckInExample1.yaml @@ -1 +1,24 @@ method_request: PUT _connector/my-connector/_check_in +alternatives: + - language: Python + code: |- + resp = client.connector.check_in( + connector_id="my-connector", + ) + - language: JavaScript + code: |- + const response = await client.connector.checkIn({ + connector_id: "my-connector", + }); + - language: Ruby + code: |- + response = client.connector.check_in( + connector_id: "my-connector" + ) + - language: PHP + code: |- + $resp = $client->connector()->checkIn([ + "connector_id" => "my-connector", + ]); + - language: curl + code: 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_connector/my-connector/_check_in"' diff --git a/specification/connector/delete/examples/request/ConnectorDeleteExample1.yaml b/specification/connector/delete/examples/request/ConnectorDeleteExample1.yaml index bc8099b358..ce02411841 100644 --- a/specification/connector/delete/examples/request/ConnectorDeleteExample1.yaml +++ b/specification/connector/delete/examples/request/ConnectorDeleteExample1.yaml @@ -1 +1,25 @@ method_request: DELETE _connector/my-connector-id&delete_sync_jobs=true +alternatives: + - language: Python + code: |- + resp = client.connector.delete( + connector_id="my-connector-id&delete_sync_jobs=true", + ) + - language: JavaScript + code: |- + const response = await client.connector.delete({ + connector_id: "my-connector-id&delete_sync_jobs=true", + }); + - language: Ruby + code: |- + response = client.connector.delete( + connector_id: "my-connector-id&delete_sync_jobs=true" + ) + - language: PHP + code: |- + $resp = $client->connector()->delete([ + "connector_id" => "my-connector-id&delete_sync_jobs=true", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_connector/my-connector-id&delete_sync_jobs=true"' diff --git a/specification/connector/get/examples/request/ConnectorGetExample1.yaml b/specification/connector/get/examples/request/ConnectorGetExample1.yaml index 74c3c41c26..55771cbbec 100644 --- a/specification/connector/get/examples/request/ConnectorGetExample1.yaml +++ b/specification/connector/get/examples/request/ConnectorGetExample1.yaml @@ -1 +1,24 @@ method_request: GET _connector/my-connector-id +alternatives: + - language: Python + code: |- + resp = client.connector.get( + connector_id="my-connector-id", + ) + - language: JavaScript + code: |- + const response = await client.connector.get({ + connector_id: "my-connector-id", + }); + - language: Ruby + code: |- + response = client.connector.get( + connector_id: "my-connector-id" + ) + - language: PHP + code: |- + $resp = $client->connector()->get([ + "connector_id" => "my-connector-id", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_connector/my-connector-id"' diff --git a/specification/connector/last_sync/examples/request/ConnectorUpdateLastSyncRequestExample1.yaml b/specification/connector/last_sync/examples/request/ConnectorUpdateLastSyncRequestExample1.yaml index 495c0425fc..611f461feb 100644 --- a/specification/connector/last_sync/examples/request/ConnectorUpdateLastSyncRequestExample1.yaml +++ b/specification/connector/last_sync/examples/request/ConnectorUpdateLastSyncRequestExample1.yaml @@ -2,12 +2,117 @@ method_request: PUT _connector/my-connector/_last_sync # description: '' # type: request -value: - "{\n \"last_access_control_sync_error\": \"Houston, we have a problem!\"\ - ,\n \"last_access_control_sync_scheduled_at\": \"2023-11-09T15:13:08.231Z\",\n\ - \ \"last_access_control_sync_status\": \"pending\",\n \"last_deleted_document_count\"\ - : 42,\n \"last_incremental_sync_scheduled_at\": \"2023-11-09T15:13:08.231Z\"\ - ,\n \"last_indexed_document_count\": 42,\n \"last_sync_error\": \"Houston,\ - \ we have a problem!\",\n \"last_sync_scheduled_at\": \"2024-11-09T15:13:08.231Z\"\ - ,\n \"last_sync_status\": \"completed\",\n \"last_synced\": \"2024-11-09T15:13:08.231Z\"\ - \n}" +value: "{ + + \ \"last_access_control_sync_error\": \"Houston, we have a problem!\", + + \ \"last_access_control_sync_scheduled_at\": \"2023-11-09T15:13:08.231Z\", + + \ \"last_access_control_sync_status\": \"pending\", + + \ \"last_deleted_document_count\": 42, + + \ \"last_incremental_sync_scheduled_at\": \"2023-11-09T15:13:08.231Z\", + + \ \"last_indexed_document_count\": 42, + + \ \"last_sync_error\": \"Houston, we have a problem!\", + + \ \"last_sync_scheduled_at\": \"2024-11-09T15:13:08.231Z\", + + \ \"last_sync_status\": \"completed\", + + \ \"last_synced\": \"2024-11-09T15:13:08.231Z\" + + }" +alternatives: + - language: Python + code: |- + resp = client.perform_request( + "PUT", + "/_connector/my-connector/_last_sync", + headers={"Content-Type": "application/json"}, + body={ + "last_access_control_sync_error": "Houston, we have a problem!", + "last_access_control_sync_scheduled_at": "2023-11-09T15:13:08.231Z", + "last_access_control_sync_status": "pending", + "last_deleted_document_count": 42, + "last_incremental_sync_scheduled_at": "2023-11-09T15:13:08.231Z", + "last_indexed_document_count": 42, + "last_sync_error": "Houston, we have a problem!", + "last_sync_scheduled_at": "2024-11-09T15:13:08.231Z", + "last_sync_status": "completed", + "last_synced": "2024-11-09T15:13:08.231Z" + }, + ) + - language: JavaScript + code: |- + const response = await client.transport.request({ + method: "PUT", + path: "/_connector/my-connector/_last_sync", + body: { + last_access_control_sync_error: "Houston, we have a problem!", + last_access_control_sync_scheduled_at: "2023-11-09T15:13:08.231Z", + last_access_control_sync_status: "pending", + last_deleted_document_count: 42, + last_incremental_sync_scheduled_at: "2023-11-09T15:13:08.231Z", + last_indexed_document_count: 42, + last_sync_error: "Houston, we have a problem!", + last_sync_scheduled_at: "2024-11-09T15:13:08.231Z", + last_sync_status: "completed", + last_synced: "2024-11-09T15:13:08.231Z", + }, + }); + - language: Ruby + code: |- + response = client.perform_request( + "PUT", + "/_connector/my-connector/_last_sync", + {}, + { + "last_access_control_sync_error": "Houston, we have a problem!", + "last_access_control_sync_scheduled_at": "2023-11-09T15:13:08.231Z", + "last_access_control_sync_status": "pending", + "last_deleted_document_count": 42, + "last_incremental_sync_scheduled_at": "2023-11-09T15:13:08.231Z", + "last_indexed_document_count": 42, + "last_sync_error": "Houston, we have a problem!", + "last_sync_scheduled_at": "2024-11-09T15:13:08.231Z", + "last_sync_status": "completed", + "last_synced": "2024-11-09T15:13:08.231Z" + }, + { "Content-Type": "application/json" }, + ) + - language: PHP + code: |- + $requestFactory = Psr17FactoryDiscovery::findRequestFactory(); + $streamFactory = Psr17FactoryDiscovery::findStreamFactory(); + $request = $requestFactory->createRequest( + "PUT", + "/_connector/my-connector/_last_sync", + ); + $request = $request->withHeader("Content-Type", "application/json"); + $request = $request->withBody($streamFactory->createStream( + json_encode([ + "last_access_control_sync_error" => "Houston, we have a problem!", + "last_access_control_sync_scheduled_at" => "2023-11-09T15:13:08.231Z", + "last_access_control_sync_status" => "pending", + "last_deleted_document_count" => 42, + "last_incremental_sync_scheduled_at" => "2023-11-09T15:13:08.231Z", + "last_indexed_document_count" => 42, + "last_sync_error" => "Houston, we have a problem!", + "last_sync_scheduled_at" => "2024-11-09T15:13:08.231Z", + "last_sync_status" => "completed", + "last_synced" => "2024-11-09T15:13:08.231Z", + ]), + )); + $resp = $client->sendRequest($request); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"last_access_control_sync_error\":\"Houston, we have a + problem!\",\"last_access_control_sync_scheduled_at\":\"2023-11-09T15:13:08.231Z\",\"last_access_control_sync_status\":\"pendi\ + ng\",\"last_deleted_document_count\":42,\"last_incremental_sync_scheduled_at\":\"2023-11-09T15:13:08.231Z\",\"last_indexed_do\ + cument_count\":42,\"last_sync_error\":\"Houston, we have a + problem!\",\"last_sync_scheduled_at\":\"2024-11-09T15:13:08.231Z\",\"last_sync_status\":\"completed\",\"last_synced\":\"2024-\ + 11-09T15:13:08.231Z\"}' \"$ELASTICSEARCH_URL/_connector/my-connector/_last_sync\"" diff --git a/specification/connector/list/examples/request/ConnectorListExample1.yaml b/specification/connector/list/examples/request/ConnectorListExample1.yaml index 322ca96846..2c4e374b6d 100644 --- a/specification/connector/list/examples/request/ConnectorListExample1.yaml +++ b/specification/connector/list/examples/request/ConnectorListExample1.yaml @@ -1 +1,12 @@ method_request: GET _connector +alternatives: + - language: Python + code: resp = client.connector.list() + - language: JavaScript + code: const response = await client.connector.list(); + - language: Ruby + code: response = client.connector.list + - language: PHP + code: $resp = $client->connector()->list(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_connector"' diff --git a/specification/connector/put/examples/request/ConnectorPutRequestExample1.yaml b/specification/connector/put/examples/request/ConnectorPutRequestExample1.yaml index 6e1fdbbf55..02f32ca775 100644 --- a/specification/connector/put/examples/request/ConnectorPutRequestExample1.yaml +++ b/specification/connector/put/examples/request/ConnectorPutRequestExample1.yaml @@ -2,6 +2,54 @@ method_request: PUT _connector/my-connector # description: '' # type: request -value: - "{\n \"index_name\": \"search-google-drive\",\n \"name\": \"My Connector\"\ - ,\n \"service_type\": \"google_drive\"\n}" +value: "{ + + \ \"index_name\": \"search-google-drive\", + + \ \"name\": \"My Connector\", + + \ \"service_type\": \"google_drive\" + + }" +alternatives: + - language: Python + code: |- + resp = client.connector.put( + connector_id="my-connector", + index_name="search-google-drive", + name="My Connector", + service_type="google_drive", + ) + - language: JavaScript + code: |- + const response = await client.connector.put({ + connector_id: "my-connector", + index_name: "search-google-drive", + name: "My Connector", + service_type: "google_drive", + }); + - language: Ruby + code: |- + response = client.connector.put( + connector_id: "my-connector", + body: { + "index_name": "search-google-drive", + "name": "My Connector", + "service_type": "google_drive" + } + ) + - language: PHP + code: |- + $resp = $client->connector()->put([ + "connector_id" => "my-connector", + "body" => [ + "index_name" => "search-google-drive", + "name" => "My Connector", + "service_type" => "google_drive", + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"index_name":"search-google-drive","name":"My Connector","service_type":"google_drive"}'' + "$ELASTICSEARCH_URL/_connector/my-connector"' diff --git a/specification/connector/put/examples/request/ConnectorPutRequestExample2.yaml b/specification/connector/put/examples/request/ConnectorPutRequestExample2.yaml index 16eba71ce2..c6ab53ffa1 100644 --- a/specification/connector/put/examples/request/ConnectorPutRequestExample2.yaml +++ b/specification/connector/put/examples/request/ConnectorPutRequestExample2.yaml @@ -2,7 +2,67 @@ method_request: PUT _connector/my-connector # description: '' # type: request -value: - "{\n \"index_name\": \"search-google-drive\",\n \"name\": \"My Connector\"\ - ,\n \"description\": \"My Connector to sync data to Elastic index from Google Drive\"\ - ,\n \"service_type\": \"google_drive\",\n \"language\": \"english\"\n}" +value: "{ + + \ \"index_name\": \"search-google-drive\", + + \ \"name\": \"My Connector\", + + \ \"description\": \"My Connector to sync data to Elastic index from Google Drive\", + + \ \"service_type\": \"google_drive\", + + \ \"language\": \"english\" + + }" +alternatives: + - language: Python + code: |- + resp = client.connector.put( + connector_id="my-connector", + index_name="search-google-drive", + name="My Connector", + description="My Connector to sync data to Elastic index from Google Drive", + service_type="google_drive", + language="english", + ) + - language: JavaScript + code: |- + const response = await client.connector.put({ + connector_id: "my-connector", + index_name: "search-google-drive", + name: "My Connector", + description: "My Connector to sync data to Elastic index from Google Drive", + service_type: "google_drive", + language: "english", + }); + - language: Ruby + code: |- + response = client.connector.put( + connector_id: "my-connector", + body: { + "index_name": "search-google-drive", + "name": "My Connector", + "description": "My Connector to sync data to Elastic index from Google Drive", + "service_type": "google_drive", + "language": "english" + } + ) + - language: PHP + code: |- + $resp = $client->connector()->put([ + "connector_id" => "my-connector", + "body" => [ + "index_name" => "search-google-drive", + "name" => "My Connector", + "description" => "My Connector to sync data to Elastic index from Google Drive", + "service_type" => "google_drive", + "language" => "english", + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"index_name":"search-google-drive","name":"My Connector","description":"My Connector to sync data to Elastic + index from Google Drive","service_type":"google_drive","language":"english"}'' + "$ELASTICSEARCH_URL/_connector/my-connector"' diff --git a/specification/connector/sync_job_cancel/examples/request/ConnectorSyncJobCancelExample1.yaml b/specification/connector/sync_job_cancel/examples/request/ConnectorSyncJobCancelExample1.yaml index 37099d856b..639ce1ff0a 100644 --- a/specification/connector/sync_job_cancel/examples/request/ConnectorSyncJobCancelExample1.yaml +++ b/specification/connector/sync_job_cancel/examples/request/ConnectorSyncJobCancelExample1.yaml @@ -1 +1,25 @@ method_request: PUT _connector/_sync_job/my-connector-sync-job-id/_cancel +alternatives: + - language: Python + code: |- + resp = client.connector.sync_job_cancel( + connector_sync_job_id="my-connector-sync-job-id", + ) + - language: JavaScript + code: |- + const response = await client.connector.syncJobCancel({ + connector_sync_job_id: "my-connector-sync-job-id", + }); + - language: Ruby + code: |- + response = client.connector.sync_job_cancel( + connector_sync_job_id: "my-connector-sync-job-id" + ) + - language: PHP + code: |- + $resp = $client->connector()->syncJobCancel([ + "connector_sync_job_id" => "my-connector-sync-job-id", + ]); + - language: curl + code: 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job-id/_cancel"' diff --git a/specification/connector/sync_job_check_in/examples/request/ConnectorSyncJobCheckInExample1.yaml b/specification/connector/sync_job_check_in/examples/request/ConnectorSyncJobCheckInExample1.yaml index 7400453c39..2ab10a1706 100644 --- a/specification/connector/sync_job_check_in/examples/request/ConnectorSyncJobCheckInExample1.yaml +++ b/specification/connector/sync_job_check_in/examples/request/ConnectorSyncJobCheckInExample1.yaml @@ -1 +1,25 @@ method_request: PUT _connector/_sync_job/my-connector-sync-job/_check_in +alternatives: + - language: Python + code: |- + resp = client.connector.sync_job_check_in( + connector_sync_job_id="my-connector-sync-job", + ) + - language: JavaScript + code: |- + const response = await client.connector.syncJobCheckIn({ + connector_sync_job_id: "my-connector-sync-job", + }); + - language: Ruby + code: |- + response = client.connector.sync_job_check_in( + connector_sync_job_id: "my-connector-sync-job" + ) + - language: PHP + code: |- + $resp = $client->connector()->syncJobCheckIn([ + "connector_sync_job_id" => "my-connector-sync-job", + ]); + - language: curl + code: 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job/_check_in"' diff --git a/specification/connector/sync_job_claim/examples/request/ConnectorSyncJobClaimExample1.yaml b/specification/connector/sync_job_claim/examples/request/ConnectorSyncJobClaimExample1.yaml index f5d51efb6d..616117ece3 100644 --- a/specification/connector/sync_job_claim/examples/request/ConnectorSyncJobClaimExample1.yaml +++ b/specification/connector/sync_job_claim/examples/request/ConnectorSyncJobClaimExample1.yaml @@ -4,3 +4,36 @@ value: |- { "worker_hostname": "some-machine" } +alternatives: + - language: Python + code: |- + resp = client.connector.sync_job_claim( + connector_sync_job_id="my-connector-sync-job-id", + worker_hostname="some-machine", + ) + - language: JavaScript + code: |- + const response = await client.connector.syncJobClaim({ + connector_sync_job_id: "my-connector-sync-job-id", + worker_hostname: "some-machine", + }); + - language: Ruby + code: |- + response = client.connector.sync_job_claim( + connector_sync_job_id: "my-connector-sync-job-id", + body: { + "worker_hostname": "some-machine" + } + ) + - language: PHP + code: |- + $resp = $client->connector()->syncJobClaim([ + "connector_sync_job_id" => "my-connector-sync-job-id", + "body" => [ + "worker_hostname" => "some-machine", + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"worker_hostname":"some-machine"}'' "$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job-id/_claim"' diff --git a/specification/connector/sync_job_delete/examples/request/ConnectorSyncJobDeleteExample1.yaml b/specification/connector/sync_job_delete/examples/request/ConnectorSyncJobDeleteExample1.yaml index f4e670b918..ed442364fc 100644 --- a/specification/connector/sync_job_delete/examples/request/ConnectorSyncJobDeleteExample1.yaml +++ b/specification/connector/sync_job_delete/examples/request/ConnectorSyncJobDeleteExample1.yaml @@ -1 +1,24 @@ method_request: DELETE _connector/_sync_job/my-connector-sync-job-id +alternatives: + - language: Python + code: |- + resp = client.connector.sync_job_delete( + connector_sync_job_id="my-connector-sync-job-id", + ) + - language: JavaScript + code: |- + const response = await client.connector.syncJobDelete({ + connector_sync_job_id: "my-connector-sync-job-id", + }); + - language: Ruby + code: |- + response = client.connector.sync_job_delete( + connector_sync_job_id: "my-connector-sync-job-id" + ) + - language: PHP + code: |- + $resp = $client->connector()->syncJobDelete([ + "connector_sync_job_id" => "my-connector-sync-job-id", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job-id"' diff --git a/specification/connector/sync_job_error/examples/request/SyncJobErrorRequestExample1.yaml b/specification/connector/sync_job_error/examples/request/SyncJobErrorRequestExample1.yaml index 6af2adb0c0..a379929e32 100644 --- a/specification/connector/sync_job_error/examples/request/SyncJobErrorRequestExample1.yaml +++ b/specification/connector/sync_job_error/examples/request/SyncJobErrorRequestExample1.yaml @@ -3,3 +3,36 @@ method_request: PUT _connector/_sync_job/my-connector-sync-job/_error # description: '' # type: request value: "{\n \"error\": \"some-error\"\n}" +alternatives: + - language: Python + code: |- + resp = client.connector.sync_job_error( + connector_sync_job_id="my-connector-sync-job", + error="some-error", + ) + - language: JavaScript + code: |- + const response = await client.connector.syncJobError({ + connector_sync_job_id: "my-connector-sync-job", + error: "some-error", + }); + - language: Ruby + code: |- + response = client.connector.sync_job_error( + connector_sync_job_id: "my-connector-sync-job", + body: { + "error": "some-error" + } + ) + - language: PHP + code: |- + $resp = $client->connector()->syncJobError([ + "connector_sync_job_id" => "my-connector-sync-job", + "body" => [ + "error" => "some-error", + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"error":"some-error"}'' "$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job/_error"' diff --git a/specification/connector/sync_job_get/examples/request/ConnectorSyncJobGetExample1.yaml b/specification/connector/sync_job_get/examples/request/ConnectorSyncJobGetExample1.yaml index f6a2b86568..c58ffc613c 100644 --- a/specification/connector/sync_job_get/examples/request/ConnectorSyncJobGetExample1.yaml +++ b/specification/connector/sync_job_get/examples/request/ConnectorSyncJobGetExample1.yaml @@ -1 +1,24 @@ method_request: GET _connector/_sync_job/my-connector-sync-job +alternatives: + - language: Python + code: |- + resp = client.connector.sync_job_get( + connector_sync_job_id="my-connector-sync-job", + ) + - language: JavaScript + code: |- + const response = await client.connector.syncJobGet({ + connector_sync_job_id: "my-connector-sync-job", + }); + - language: Ruby + code: |- + response = client.connector.sync_job_get( + connector_sync_job_id: "my-connector-sync-job" + ) + - language: PHP + code: |- + $resp = $client->connector()->syncJobGet([ + "connector_sync_job_id" => "my-connector-sync-job", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job"' diff --git a/specification/connector/sync_job_list/examples/request/ConnectorSyncJobListExample1.yaml b/specification/connector/sync_job_list/examples/request/ConnectorSyncJobListExample1.yaml index 6be6de9fff..9ba177e1aa 100644 --- a/specification/connector/sync_job_list/examples/request/ConnectorSyncJobListExample1.yaml +++ b/specification/connector/sync_job_list/examples/request/ConnectorSyncJobListExample1.yaml @@ -1 +1,29 @@ method_request: GET _connector/_sync_job?connector_id=my-connector-id&size=1 +alternatives: + - language: Python + code: |- + resp = client.connector.sync_job_list( + connector_id="my-connector-id", + size="1", + ) + - language: JavaScript + code: |- + const response = await client.connector.syncJobList({ + connector_id: "my-connector-id", + size: 1, + }); + - language: Ruby + code: |- + response = client.connector.sync_job_list( + connector_id: "my-connector-id", + size: "1" + ) + - language: PHP + code: |- + $resp = $client->connector()->syncJobList([ + "connector_id" => "my-connector-id", + "size" => "1", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_connector/_sync_job?connector_id=my-connector-id&size=1"' diff --git a/specification/connector/sync_job_post/examples/request/SyncJobPostRequestExample1.yaml b/specification/connector/sync_job_post/examples/request/SyncJobPostRequestExample1.yaml index 5dd171a2f2..f326c44e98 100644 --- a/specification/connector/sync_job_post/examples/request/SyncJobPostRequestExample1.yaml +++ b/specification/connector/sync_job_post/examples/request/SyncJobPostRequestExample1.yaml @@ -2,6 +2,50 @@ method_request: POST _connector/_sync_job # description: '' # type: request -value: - "{\n \"id\": \"connector-id\",\n \"job_type\": \"full\",\n \"trigger_method\"\ - : \"on_demand\"\n}" +value: "{ + + \ \"id\": \"connector-id\", + + \ \"job_type\": \"full\", + + \ \"trigger_method\": \"on_demand\" + + }" +alternatives: + - language: Python + code: |- + resp = client.connector.sync_job_post( + id="connector-id", + job_type="full", + trigger_method="on_demand", + ) + - language: JavaScript + code: |- + const response = await client.connector.syncJobPost({ + id: "connector-id", + job_type: "full", + trigger_method: "on_demand", + }); + - language: Ruby + code: |- + response = client.connector.sync_job_post( + body: { + "id": "connector-id", + "job_type": "full", + "trigger_method": "on_demand" + } + ) + - language: PHP + code: |- + $resp = $client->connector()->syncJobPost([ + "body" => [ + "id" => "connector-id", + "job_type" => "full", + "trigger_method" => "on_demand", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"id":"connector-id","job_type":"full","trigger_method":"on_demand"}'' + "$ELASTICSEARCH_URL/_connector/_sync_job"' diff --git a/specification/connector/sync_job_update_stats/examples/request/ConnectorSyncJobUpdateStatsExample1.yaml b/specification/connector/sync_job_update_stats/examples/request/ConnectorSyncJobUpdateStatsExample1.yaml index f7b467b6fc..1efd4b5bba 100644 --- a/specification/connector/sync_job_update_stats/examples/request/ConnectorSyncJobUpdateStatsExample1.yaml +++ b/specification/connector/sync_job_update_stats/examples/request/ConnectorSyncJobUpdateStatsExample1.yaml @@ -8,3 +8,53 @@ value: |- "total_document_count": 2000, "last_seen": "2023-01-02T10:00:00Z" } +alternatives: + - language: Python + code: |- + resp = client.connector.sync_job_update_stats( + connector_sync_job_id="my-connector-sync-job", + deleted_document_count=10, + indexed_document_count=20, + indexed_document_volume=1000, + total_document_count=2000, + last_seen="2023-01-02T10:00:00Z", + ) + - language: JavaScript + code: |- + const response = await client.connector.syncJobUpdateStats({ + connector_sync_job_id: "my-connector-sync-job", + deleted_document_count: 10, + indexed_document_count: 20, + indexed_document_volume: 1000, + total_document_count: 2000, + last_seen: "2023-01-02T10:00:00Z", + }); + - language: Ruby + code: |- + response = client.connector.sync_job_update_stats( + connector_sync_job_id: "my-connector-sync-job", + body: { + "deleted_document_count": 10, + "indexed_document_count": 20, + "indexed_document_volume": 1000, + "total_document_count": 2000, + "last_seen": "2023-01-02T10:00:00Z" + } + ) + - language: PHP + code: |- + $resp = $client->connector()->syncJobUpdateStats([ + "connector_sync_job_id" => "my-connector-sync-job", + "body" => [ + "deleted_document_count" => 10, + "indexed_document_count" => 20, + "indexed_document_volume" => 1000, + "total_document_count" => 2000, + "last_seen" => "2023-01-02T10:00:00Z", + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"deleted_document_count\":10,\"indexed_document_count\":20,\"indexed_document_volume\":1000,\"total_document_count\":2000,\ + \"last_seen\":\"2023-01-02T10:00:00Z\"}' \"$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job/_stats\"" diff --git a/specification/connector/update_api_key_id/examples/request/ConnectorUpdateApiKeyIDRequestExample1.yaml b/specification/connector/update_api_key_id/examples/request/ConnectorUpdateApiKeyIDRequestExample1.yaml index 337827d126..ab34678fb0 100644 --- a/specification/connector/update_api_key_id/examples/request/ConnectorUpdateApiKeyIDRequestExample1.yaml +++ b/specification/connector/update_api_key_id/examples/request/ConnectorUpdateApiKeyIDRequestExample1.yaml @@ -2,6 +2,48 @@ method_request: PUT _connector/my-connector/_api_key_id # description: '' # type: request -value: - "{\n \"api_key_id\": \"my-api-key-id\",\n \"api_key_secret_id\": \"my-connector-secret-id\"\ - \n}" +value: "{ + + \ \"api_key_id\": \"my-api-key-id\", + + \ \"api_key_secret_id\": \"my-connector-secret-id\" + + }" +alternatives: + - language: Python + code: |- + resp = client.connector.update_api_key_id( + connector_id="my-connector", + api_key_id="my-api-key-id", + api_key_secret_id="my-connector-secret-id", + ) + - language: JavaScript + code: |- + const response = await client.connector.updateApiKeyId({ + connector_id: "my-connector", + api_key_id: "my-api-key-id", + api_key_secret_id: "my-connector-secret-id", + }); + - language: Ruby + code: |- + response = client.connector.update_api_key_id( + connector_id: "my-connector", + body: { + "api_key_id": "my-api-key-id", + "api_key_secret_id": "my-connector-secret-id" + } + ) + - language: PHP + code: |- + $resp = $client->connector()->updateApiKeyId([ + "connector_id" => "my-connector", + "body" => [ + "api_key_id" => "my-api-key-id", + "api_key_secret_id" => "my-connector-secret-id", + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"api_key_id":"my-api-key-id","api_key_secret_id":"my-connector-secret-id"}'' + "$ELASTICSEARCH_URL/_connector/my-connector/_api_key_id"' diff --git a/specification/connector/update_configuration/examples/request/ConnectorUpdateConfigurationRequestExample1.yaml b/specification/connector/update_configuration/examples/request/ConnectorUpdateConfigurationRequestExample1.yaml index ee831af99b..af5e77a775 100644 --- a/specification/connector/update_configuration/examples/request/ConnectorUpdateConfigurationRequestExample1.yaml +++ b/specification/connector/update_configuration/examples/request/ConnectorUpdateConfigurationRequestExample1.yaml @@ -2,7 +2,78 @@ method_request: PUT _connector/my-spo-connector/_configuration # description: '' # type: request -value: - "{\n \"values\": {\n \"tenant_id\": \"my-tenant-id\",\n \"\ - tenant_name\": \"my-sharepoint-site\",\n \"client_id\": \"foo\",\n \ - \ \"secret_value\": \"bar\",\n \"site_collections\": \"*\"\n }\n}" +value: "{ + + \ \"values\": { + + \ \"tenant_id\": \"my-tenant-id\", + + \ \"tenant_name\": \"my-sharepoint-site\", + + \ \"client_id\": \"foo\", + + \ \"secret_value\": \"bar\", + + \ \"site_collections\": \"*\" + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.connector.update_configuration( + connector_id="my-spo-connector", + values={ + "tenant_id": "my-tenant-id", + "tenant_name": "my-sharepoint-site", + "client_id": "foo", + "secret_value": "bar", + "site_collections": "*" + }, + ) + - language: JavaScript + code: |- + const response = await client.connector.updateConfiguration({ + connector_id: "my-spo-connector", + values: { + tenant_id: "my-tenant-id", + tenant_name: "my-sharepoint-site", + client_id: "foo", + secret_value: "bar", + site_collections: "*", + }, + }); + - language: Ruby + code: |- + response = client.connector.update_configuration( + connector_id: "my-spo-connector", + body: { + "values": { + "tenant_id": "my-tenant-id", + "tenant_name": "my-sharepoint-site", + "client_id": "foo", + "secret_value": "bar", + "site_collections": "*" + } + } + ) + - language: PHP + code: |- + $resp = $client->connector()->updateConfiguration([ + "connector_id" => "my-spo-connector", + "body" => [ + "values" => [ + "tenant_id" => "my-tenant-id", + "tenant_name" => "my-sharepoint-site", + "client_id" => "foo", + "secret_value" => "bar", + "site_collections" => "*", + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"values\":{\"tenant_id\":\"my-tenant-id\",\"tenant_name\":\"my-sharepoint-site\",\"client_id\":\"foo\",\"secret_value\":\"\ + bar\",\"site_collections\":\"*\"}}' \"$ELASTICSEARCH_URL/_connector/my-spo-connector/_configuration\"" diff --git a/specification/connector/update_configuration/examples/request/ConnectorUpdateConfigurationRequestExample2.yaml b/specification/connector/update_configuration/examples/request/ConnectorUpdateConfigurationRequestExample2.yaml index c305a72dcd..4dcd0fb697 100644 --- a/specification/connector/update_configuration/examples/request/ConnectorUpdateConfigurationRequestExample2.yaml +++ b/specification/connector/update_configuration/examples/request/ConnectorUpdateConfigurationRequestExample2.yaml @@ -2,4 +2,53 @@ method_request: PUT _connector/my-spo-connector/_configuration # description: '' # type: request -value: "{\n \"values\": {\n \"secret_value\": \"foo-bar\"\n }\n}" +value: "{ + + \ \"values\": { + + \ \"secret_value\": \"foo-bar\" + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.connector.update_configuration( + connector_id="my-spo-connector", + values={ + "secret_value": "foo-bar" + }, + ) + - language: JavaScript + code: |- + const response = await client.connector.updateConfiguration({ + connector_id: "my-spo-connector", + values: { + secret_value: "foo-bar", + }, + }); + - language: Ruby + code: |- + response = client.connector.update_configuration( + connector_id: "my-spo-connector", + body: { + "values": { + "secret_value": "foo-bar" + } + } + ) + - language: PHP + code: |- + $resp = $client->connector()->updateConfiguration([ + "connector_id" => "my-spo-connector", + "body" => [ + "values" => [ + "secret_value" => "foo-bar", + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"values":{"secret_value":"foo-bar"}}'' "$ELASTICSEARCH_URL/_connector/my-spo-connector/_configuration"' diff --git a/specification/connector/update_error/examples/request/ConnectorUpdateErrorRequestExample1.yaml b/specification/connector/update_error/examples/request/ConnectorUpdateErrorRequestExample1.yaml index 3935f4bac1..dadee189b6 100644 --- a/specification/connector/update_error/examples/request/ConnectorUpdateErrorRequestExample1.yaml +++ b/specification/connector/update_error/examples/request/ConnectorUpdateErrorRequestExample1.yaml @@ -2,4 +2,41 @@ method_request: PUT _connector/my-connector/_error # description: '' # type: request -value: "{\n \"error\": \"Houston, we have a problem!\"\n}" +value: "{ + + \ \"error\": \"Houston, we have a problem!\" + + }" +alternatives: + - language: Python + code: |- + resp = client.connector.update_error( + connector_id="my-connector", + error="Houston, we have a problem!", + ) + - language: JavaScript + code: |- + const response = await client.connector.updateError({ + connector_id: "my-connector", + error: "Houston, we have a problem!", + }); + - language: Ruby + code: |- + response = client.connector.update_error( + connector_id: "my-connector", + body: { + "error": "Houston, we have a problem!" + } + ) + - language: PHP + code: |- + $resp = $client->connector()->updateError([ + "connector_id" => "my-connector", + "body" => [ + "error" => "Houston, we have a problem!", + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"error":"Houston, we + have a problem!"}'' "$ELASTICSEARCH_URL/_connector/my-connector/_error"' diff --git a/specification/connector/update_features/examples/request/ConnectorUpdateFeaturesRequestExample1.yaml b/specification/connector/update_features/examples/request/ConnectorUpdateFeaturesRequestExample1.yaml index d2e7d1094b..481ce69646 100644 --- a/specification/connector/update_features/examples/request/ConnectorUpdateFeaturesRequestExample1.yaml +++ b/specification/connector/update_features/examples/request/ConnectorUpdateFeaturesRequestExample1.yaml @@ -2,8 +2,132 @@ method_request: PUT _connector/my-connector/_features # description: '' # type: request -value: - "{\n \"features\": {\n \"document_level_security\": {\n \"enabled\"\ - : true\n },\n \"incremental_sync\": {\n \"enabled\": true\n },\n \ - \ \"sync_rules\": {\n \"advanced\": {\n \"enabled\": false\n \ - \ },\n \"basic\": {\n \"enabled\": true\n }\n }\n }\n}" +value: "{ + + \ \"features\": { + + \ \"document_level_security\": { + + \ \"enabled\": true + + \ }, + + \ \"incremental_sync\": { + + \ \"enabled\": true + + \ }, + + \ \"sync_rules\": { + + \ \"advanced\": { + + \ \"enabled\": false + + \ }, + + \ \"basic\": { + + \ \"enabled\": true + + \ } + + \ } + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.connector.update_features( + connector_id="my-connector", + features={ + "document_level_security": { + "enabled": True + }, + "incremental_sync": { + "enabled": True + }, + "sync_rules": { + "advanced": { + "enabled": False + }, + "basic": { + "enabled": True + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.connector.updateFeatures({ + connector_id: "my-connector", + features: { + document_level_security: { + enabled: true, + }, + incremental_sync: { + enabled: true, + }, + sync_rules: { + advanced: { + enabled: false, + }, + basic: { + enabled: true, + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.connector.update_features( + connector_id: "my-connector", + body: { + "features": { + "document_level_security": { + "enabled": true + }, + "incremental_sync": { + "enabled": true + }, + "sync_rules": { + "advanced": { + "enabled": false + }, + "basic": { + "enabled": true + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->connector()->updateFeatures([ + "connector_id" => "my-connector", + "body" => [ + "features" => [ + "document_level_security" => [ + "enabled" => true, + ], + "incremental_sync" => [ + "enabled" => true, + ], + "sync_rules" => [ + "advanced" => [ + "enabled" => false, + ], + "basic" => [ + "enabled" => true, + ], + ], + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"features\":{\"document_level_security\":{\"enabled\":true},\"incremental_sync\":{\"enabled\":true},\"sync_rules\":{\"adva\ + nced\":{\"enabled\":false},\"basic\":{\"enabled\":true}}}}' \"$ELASTICSEARCH_URL/_connector/my-connector/_features\"" diff --git a/specification/connector/update_features/examples/request/ConnectorUpdateFeaturesRequestExample2.yaml b/specification/connector/update_features/examples/request/ConnectorUpdateFeaturesRequestExample2.yaml index 7f1f61268b..c9d28d333b 100644 --- a/specification/connector/update_features/examples/request/ConnectorUpdateFeaturesRequestExample2.yaml +++ b/specification/connector/update_features/examples/request/ConnectorUpdateFeaturesRequestExample2.yaml @@ -2,6 +2,65 @@ method_request: PUT _connector/my-connector/_features # description: '' # type: request -value: - "{\n \"features\": {\n \"document_level_security\": {\n \"enabled\"\ - : true\n }\n }\n}" +value: "{ + + \ \"features\": { + + \ \"document_level_security\": { + + \ \"enabled\": true + + \ } + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.connector.update_features( + connector_id="my-connector", + features={ + "document_level_security": { + "enabled": True + } + }, + ) + - language: JavaScript + code: |- + const response = await client.connector.updateFeatures({ + connector_id: "my-connector", + features: { + document_level_security: { + enabled: true, + }, + }, + }); + - language: Ruby + code: |- + response = client.connector.update_features( + connector_id: "my-connector", + body: { + "features": { + "document_level_security": { + "enabled": true + } + } + } + ) + - language: PHP + code: |- + $resp = $client->connector()->updateFeatures([ + "connector_id" => "my-connector", + "body" => [ + "features" => [ + "document_level_security" => [ + "enabled" => true, + ], + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"features":{"document_level_security":{"enabled":true}}}'' "$ELASTICSEARCH_URL/_connector/my-connector/_features"' diff --git a/specification/connector/update_filtering/examples/request/ConnectorUpdateFilteringRequestExample1.yaml b/specification/connector/update_filtering/examples/request/ConnectorUpdateFilteringRequestExample1.yaml index 6a33ad21ce..66bd8e2a29 100644 --- a/specification/connector/update_filtering/examples/request/ConnectorUpdateFilteringRequestExample1.yaml +++ b/specification/connector/update_filtering/examples/request/ConnectorUpdateFilteringRequestExample1.yaml @@ -2,11 +2,145 @@ method_request: PUT _connector/my-g-drive-connector/_filtering # description: '' # type: request -value: - "{\n \"rules\": [\n {\n \"field\": \"file_extension\"\ - ,\n \"id\": \"exclude-txt-files\",\n \"order\": 0,\n \ - \ \"policy\": \"exclude\",\n \"rule\": \"equals\",\n \ - \ \"value\": \"txt\"\n },\n {\n \"field\": \"_\",\n \ - \ \"id\": \"DEFAULT\",\n \"order\": 1,\n \"policy\"\ - : \"include\",\n \"rule\": \"regex\",\n \"value\": \".*\"\n\ - \ }\n ]\n}" +value: "{ + + \ \"rules\": [ + + \ { + + \ \"field\": \"file_extension\", + + \ \"id\": \"exclude-txt-files\", + + \ \"order\": 0, + + \ \"policy\": \"exclude\", + + \ \"rule\": \"equals\", + + \ \"value\": \"txt\" + + \ }, + + \ { + + \ \"field\": \"_\", + + \ \"id\": \"DEFAULT\", + + \ \"order\": 1, + + \ \"policy\": \"include\", + + \ \"rule\": \"regex\", + + \ \"value\": \".*\" + + \ } + + \ ] + + }" +alternatives: + - language: Python + code: |- + resp = client.connector.update_filtering( + connector_id="my-g-drive-connector", + rules=[ + { + "field": "file_extension", + "id": "exclude-txt-files", + "order": 0, + "policy": "exclude", + "rule": "equals", + "value": "txt" + }, + { + "field": "_", + "id": "DEFAULT", + "order": 1, + "policy": "include", + "rule": "regex", + "value": ".*" + } + ], + ) + - language: JavaScript + code: |- + const response = await client.connector.updateFiltering({ + connector_id: "my-g-drive-connector", + rules: [ + { + field: "file_extension", + id: "exclude-txt-files", + order: 0, + policy: "exclude", + rule: "equals", + value: "txt", + }, + { + field: "_", + id: "DEFAULT", + order: 1, + policy: "include", + rule: "regex", + value: ".*", + }, + ], + }); + - language: Ruby + code: |- + response = client.connector.update_filtering( + connector_id: "my-g-drive-connector", + body: { + "rules": [ + { + "field": "file_extension", + "id": "exclude-txt-files", + "order": 0, + "policy": "exclude", + "rule": "equals", + "value": "txt" + }, + { + "field": "_", + "id": "DEFAULT", + "order": 1, + "policy": "include", + "rule": "regex", + "value": ".*" + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->connector()->updateFiltering([ + "connector_id" => "my-g-drive-connector", + "body" => [ + "rules" => array( + [ + "field" => "file_extension", + "id" => "exclude-txt-files", + "order" => 0, + "policy" => "exclude", + "rule" => "equals", + "value" => "txt", + ], + [ + "field" => "_", + "id" => "DEFAULT", + "order" => 1, + "policy" => "include", + "rule" => "regex", + "value" => ".*", + ], + ), + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"rules\":[{\"field\":\"file_extension\",\"id\":\"exclude-txt-files\",\"order\":0,\"policy\":\"exclude\",\"rule\":\"equals\ + \",\"value\":\"txt\"},{\"field\":\"_\",\"id\":\"DEFAULT\",\"order\":1,\"policy\":\"include\",\"rule\":\"regex\",\"value\":\".*\ + \"}]}' \"$ELASTICSEARCH_URL/_connector/my-g-drive-connector/_filtering\"" diff --git a/specification/connector/update_filtering/examples/request/ConnectorUpdateFilteringRequestExample2.yaml b/specification/connector/update_filtering/examples/request/ConnectorUpdateFilteringRequestExample2.yaml index 2f2c652fa4..f8ed9d2b2b 100644 --- a/specification/connector/update_filtering/examples/request/ConnectorUpdateFilteringRequestExample2.yaml +++ b/specification/connector/update_filtering/examples/request/ConnectorUpdateFilteringRequestExample2.yaml @@ -2,8 +2,97 @@ method_request: PUT _connector/my-sql-connector/_filtering # description: '' # type: request -value: - "{\n \"advanced_snippet\": {\n \"value\": [{\n \"tables\"\ - : [\n \"users\",\n \"orders\"\n ],\n \ - \ \"query\": \"SELECT users.id AS id, orders.order_id AS order_id FROM\ - \ users JOIN orders ON users.id = orders.user_id\"\n }]\n }\n}" +value: "{ + + \ \"advanced_snippet\": { + + \ \"value\": [{ + + \ \"tables\": [ + + \ \"users\", + + \ \"orders\" + + \ ], + + \ \"query\": \"SELECT users.id AS id, orders.order_id AS order_id FROM users JOIN orders ON users.id = orders.user_id\" + + \ }] + + \ } + + }" +alternatives: + - language: Python + code: >- + resp = client.connector.update_filtering( + connector_id="my-sql-connector", + advanced_snippet={ + "value": [ + { + "tables": [ + "users", + "orders" + ], + "query": "SELECT users.id AS id, orders.order_id AS order_id FROM users JOIN orders ON users.id = orders.user_id" + } + ] + }, + ) + - language: JavaScript + code: |- + const response = await client.connector.updateFiltering({ + connector_id: "my-sql-connector", + advanced_snippet: { + value: [ + { + tables: ["users", "orders"], + query: + "SELECT users.id AS id, orders.order_id AS order_id FROM users JOIN orders ON users.id = orders.user_id", + }, + ], + }, + }); + - language: Ruby + code: |- + response = client.connector.update_filtering( + connector_id: "my-sql-connector", + body: { + "advanced_snippet": { + "value": [ + { + "tables": [ + "users", + "orders" + ], + "query": "SELECT users.id AS id, orders.order_id AS order_id FROM users JOIN orders ON users.id = orders.user_id" + } + ] + } + } + ) + - language: PHP + code: >- + $resp = $client->connector()->updateFiltering([ + "connector_id" => "my-sql-connector", + "body" => [ + "advanced_snippet" => [ + "value" => array( + [ + "tables" => array( + "users", + "orders", + ), + "query" => "SELECT users.id AS id, orders.order_id AS order_id FROM users JOIN orders ON users.id = orders.user_id", + ], + ), + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"advanced_snippet":{"value":[{"tables":["users","orders"],"query":"SELECT users.id AS id, orders.order_id AS + order_id FROM users JOIN orders ON users.id = orders.user_id"}]}}'' + "$ELASTICSEARCH_URL/_connector/my-sql-connector/_filtering"' diff --git a/specification/connector/update_index_name/examples/request/ConnectorUpdateIndexNameRequestExample1.yaml b/specification/connector/update_index_name/examples/request/ConnectorUpdateIndexNameRequestExample1.yaml index 9e7f3cb73b..34a289ea08 100644 --- a/specification/connector/update_index_name/examples/request/ConnectorUpdateIndexNameRequestExample1.yaml +++ b/specification/connector/update_index_name/examples/request/ConnectorUpdateIndexNameRequestExample1.yaml @@ -2,4 +2,41 @@ method_request: PUT _connector/my-connector/_index_name # description: '' # type: request -value: "{\n \"index_name\": \"data-from-my-google-drive\"\n}" +value: "{ + + \ \"index_name\": \"data-from-my-google-drive\" + + }" +alternatives: + - language: Python + code: |- + resp = client.connector.update_index_name( + connector_id="my-connector", + index_name="data-from-my-google-drive", + ) + - language: JavaScript + code: |- + const response = await client.connector.updateIndexName({ + connector_id: "my-connector", + index_name: "data-from-my-google-drive", + }); + - language: Ruby + code: |- + response = client.connector.update_index_name( + connector_id: "my-connector", + body: { + "index_name": "data-from-my-google-drive" + } + ) + - language: PHP + code: |- + $resp = $client->connector()->updateIndexName([ + "connector_id" => "my-connector", + "body" => [ + "index_name" => "data-from-my-google-drive", + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"index_name":"data-from-my-google-drive"}'' "$ELASTICSEARCH_URL/_connector/my-connector/_index_name"' diff --git a/specification/connector/update_name/examples/request/ConnectorUpdateNameRequestExample1.yaml b/specification/connector/update_name/examples/request/ConnectorUpdateNameRequestExample1.yaml index 381afec1b8..ac95f6896e 100644 --- a/specification/connector/update_name/examples/request/ConnectorUpdateNameRequestExample1.yaml +++ b/specification/connector/update_name/examples/request/ConnectorUpdateNameRequestExample1.yaml @@ -2,6 +2,47 @@ method_request: PUT _connector/my-connector/_name # description: '' # type: request -value: - "{\n \"name\": \"Custom connector\",\n \"description\": \"This is my\ - \ customized connector\"\n}" +value: "{ + + \ \"name\": \"Custom connector\", + + \ \"description\": \"This is my customized connector\" + + }" +alternatives: + - language: Python + code: |- + resp = client.connector.update_name( + connector_id="my-connector", + name="Custom connector", + description="This is my customized connector", + ) + - language: JavaScript + code: |- + const response = await client.connector.updateName({ + connector_id: "my-connector", + name: "Custom connector", + description: "This is my customized connector", + }); + - language: Ruby + code: |- + response = client.connector.update_name( + connector_id: "my-connector", + body: { + "name": "Custom connector", + "description": "This is my customized connector" + } + ) + - language: PHP + code: |- + $resp = $client->connector()->updateName([ + "connector_id" => "my-connector", + "body" => [ + "name" => "Custom connector", + "description" => "This is my customized connector", + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"name":"Custom + connector","description":"This is my customized connector"}'' "$ELASTICSEARCH_URL/_connector/my-connector/_name"' diff --git a/specification/connector/update_pipeline/examples/request/ConnectorUpdatePipelineRequestExample1.yaml b/specification/connector/update_pipeline/examples/request/ConnectorUpdatePipelineRequestExample1.yaml index 2f4f46f2ce..d89f52e879 100644 --- a/specification/connector/update_pipeline/examples/request/ConnectorUpdatePipelineRequestExample1.yaml +++ b/specification/connector/update_pipeline/examples/request/ConnectorUpdatePipelineRequestExample1.yaml @@ -2,7 +2,72 @@ method_request: PUT _connector/my-connector/_pipeline # description: '' # type: request -value: - "{\n \"pipeline\": {\n \"extract_binary_content\": true,\n \ - \ \"name\": \"my-connector-pipeline\",\n \"reduce_whitespace\": true,\n\ - \ \"run_ml_inference\": true\n }\n}" +value: "{ + + \ \"pipeline\": { + + \ \"extract_binary_content\": true, + + \ \"name\": \"my-connector-pipeline\", + + \ \"reduce_whitespace\": true, + + \ \"run_ml_inference\": true + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.connector.update_pipeline( + connector_id="my-connector", + pipeline={ + "extract_binary_content": True, + "name": "my-connector-pipeline", + "reduce_whitespace": True, + "run_ml_inference": True + }, + ) + - language: JavaScript + code: |- + const response = await client.connector.updatePipeline({ + connector_id: "my-connector", + pipeline: { + extract_binary_content: true, + name: "my-connector-pipeline", + reduce_whitespace: true, + run_ml_inference: true, + }, + }); + - language: Ruby + code: |- + response = client.connector.update_pipeline( + connector_id: "my-connector", + body: { + "pipeline": { + "extract_binary_content": true, + "name": "my-connector-pipeline", + "reduce_whitespace": true, + "run_ml_inference": true + } + } + ) + - language: PHP + code: |- + $resp = $client->connector()->updatePipeline([ + "connector_id" => "my-connector", + "body" => [ + "pipeline" => [ + "extract_binary_content" => true, + "name" => "my-connector-pipeline", + "reduce_whitespace" => true, + "run_ml_inference" => true, + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"pipeline\":{\"extract_binary_content\":true,\"name\":\"my-connector-pipeline\",\"reduce_whitespace\":true,\"run_ml_infere\ + nce\":true}}' \"$ELASTICSEARCH_URL/_connector/my-connector/_pipeline\"" diff --git a/specification/connector/update_scheduling/examples/request/ConnectorUpdateSchedulingRequestExample1.yaml b/specification/connector/update_scheduling/examples/request/ConnectorUpdateSchedulingRequestExample1.yaml index 58d6f6318c..6351c8f321 100644 --- a/specification/connector/update_scheduling/examples/request/ConnectorUpdateSchedulingRequestExample1.yaml +++ b/specification/connector/update_scheduling/examples/request/ConnectorUpdateSchedulingRequestExample1.yaml @@ -2,9 +2,121 @@ method_request: PUT _connector/my-connector/_scheduling # description: '' # type: request -value: - "{\n \"scheduling\": {\n \"access_control\": {\n \"enabled\"\ - : true,\n \"interval\": \"0 10 0 * * ?\"\n },\n \"full\"\ - : {\n \"enabled\": true,\n \"interval\": \"0 20 0 * * ?\"\n\ - \ },\n \"incremental\": {\n \"enabled\": false,\n \ - \ \"interval\": \"0 30 0 * * ?\"\n }\n }\n}" +value: "{ + + \ \"scheduling\": { + + \ \"access_control\": { + + \ \"enabled\": true, + + \ \"interval\": \"0 10 0 * * ?\" + + \ }, + + \ \"full\": { + + \ \"enabled\": true, + + \ \"interval\": \"0 20 0 * * ?\" + + \ }, + + \ \"incremental\": { + + \ \"enabled\": false, + + \ \"interval\": \"0 30 0 * * ?\" + + \ } + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.connector.update_scheduling( + connector_id="my-connector", + scheduling={ + "access_control": { + "enabled": True, + "interval": "0 10 0 * * ?" + }, + "full": { + "enabled": True, + "interval": "0 20 0 * * ?" + }, + "incremental": { + "enabled": False, + "interval": "0 30 0 * * ?" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.connector.updateScheduling({ + connector_id: "my-connector", + scheduling: { + access_control: { + enabled: true, + interval: "0 10 0 * * ?", + }, + full: { + enabled: true, + interval: "0 20 0 * * ?", + }, + incremental: { + enabled: false, + interval: "0 30 0 * * ?", + }, + }, + }); + - language: Ruby + code: |- + response = client.connector.update_scheduling( + connector_id: "my-connector", + body: { + "scheduling": { + "access_control": { + "enabled": true, + "interval": "0 10 0 * * ?" + }, + "full": { + "enabled": true, + "interval": "0 20 0 * * ?" + }, + "incremental": { + "enabled": false, + "interval": "0 30 0 * * ?" + } + } + } + ) + - language: PHP + code: |- + $resp = $client->connector()->updateScheduling([ + "connector_id" => "my-connector", + "body" => [ + "scheduling" => [ + "access_control" => [ + "enabled" => true, + "interval" => "0 10 0 * * ?", + ], + "full" => [ + "enabled" => true, + "interval" => "0 20 0 * * ?", + ], + "incremental" => [ + "enabled" => false, + "interval" => "0 30 0 * * ?", + ], + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"scheduling":{"access_control":{"enabled":true,"interval":"0 10 0 * * + ?"},"full":{"enabled":true,"interval":"0 20 0 * * ?"},"incremental":{"enabled":false,"interval":"0 30 0 * * + ?"}}}'' "$ELASTICSEARCH_URL/_connector/my-connector/_scheduling"' diff --git a/specification/connector/update_scheduling/examples/request/ConnectorUpdateSchedulingRequestExample2.yaml b/specification/connector/update_scheduling/examples/request/ConnectorUpdateSchedulingRequestExample2.yaml index 98a61b619b..52860696e6 100644 --- a/specification/connector/update_scheduling/examples/request/ConnectorUpdateSchedulingRequestExample2.yaml +++ b/specification/connector/update_scheduling/examples/request/ConnectorUpdateSchedulingRequestExample2.yaml @@ -2,6 +2,72 @@ method_request: PUT _connector/my-connector/_scheduling # description: '' # type: request -value: - "{\n \"scheduling\": {\n \"full\": {\n \"enabled\": true,\n\ - \ \"interval\": \"0 10 0 * * ?\"\n }\n }\n}" +value: "{ + + \ \"scheduling\": { + + \ \"full\": { + + \ \"enabled\": true, + + \ \"interval\": \"0 10 0 * * ?\" + + \ } + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.connector.update_scheduling( + connector_id="my-connector", + scheduling={ + "full": { + "enabled": True, + "interval": "0 10 0 * * ?" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.connector.updateScheduling({ + connector_id: "my-connector", + scheduling: { + full: { + enabled: true, + interval: "0 10 0 * * ?", + }, + }, + }); + - language: Ruby + code: |- + response = client.connector.update_scheduling( + connector_id: "my-connector", + body: { + "scheduling": { + "full": { + "enabled": true, + "interval": "0 10 0 * * ?" + } + } + } + ) + - language: PHP + code: |- + $resp = $client->connector()->updateScheduling([ + "connector_id" => "my-connector", + "body" => [ + "scheduling" => [ + "full" => [ + "enabled" => true, + "interval" => "0 10 0 * * ?", + ], + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"scheduling":{"full":{"enabled":true,"interval":"0 10 0 * * ?"}}}'' + "$ELASTICSEARCH_URL/_connector/my-connector/_scheduling"' diff --git a/specification/connector/update_service_type/examples/request/ConnectorUpdateServiceTypeRequestExample1.yaml b/specification/connector/update_service_type/examples/request/ConnectorUpdateServiceTypeRequestExample1.yaml index f47d9687d1..40978ebf3e 100644 --- a/specification/connector/update_service_type/examples/request/ConnectorUpdateServiceTypeRequestExample1.yaml +++ b/specification/connector/update_service_type/examples/request/ConnectorUpdateServiceTypeRequestExample1.yaml @@ -2,4 +2,41 @@ method_request: PUT _connector/my-connector/_service_type # description: '' # type: request -value: "{\n \"service_type\": \"sharepoint_online\"\n}" +value: "{ + + \ \"service_type\": \"sharepoint_online\" + + }" +alternatives: + - language: Python + code: |- + resp = client.connector.update_service_type( + connector_id="my-connector", + service_type="sharepoint_online", + ) + - language: JavaScript + code: |- + const response = await client.connector.updateServiceType({ + connector_id: "my-connector", + service_type: "sharepoint_online", + }); + - language: Ruby + code: |- + response = client.connector.update_service_type( + connector_id: "my-connector", + body: { + "service_type": "sharepoint_online" + } + ) + - language: PHP + code: |- + $resp = $client->connector()->updateServiceType([ + "connector_id" => "my-connector", + "body" => [ + "service_type" => "sharepoint_online", + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"service_type":"sharepoint_online"}'' "$ELASTICSEARCH_URL/_connector/my-connector/_service_type"' diff --git a/specification/connector/update_status/examples/request/ConnectorUpdateStatusRequestExample1.yaml b/specification/connector/update_status/examples/request/ConnectorUpdateStatusRequestExample1.yaml index 872f9795ed..b0f9f169fe 100644 --- a/specification/connector/update_status/examples/request/ConnectorUpdateStatusRequestExample1.yaml +++ b/specification/connector/update_status/examples/request/ConnectorUpdateStatusRequestExample1.yaml @@ -2,4 +2,41 @@ method_request: PUT _connector/my-connector/_status # description: '' # type: request -value: "{\n \"status\": \"needs_configuration\"\n}" +value: "{ + + \ \"status\": \"needs_configuration\" + + }" +alternatives: + - language: Python + code: |- + resp = client.connector.update_status( + connector_id="my-connector", + status="needs_configuration", + ) + - language: JavaScript + code: |- + const response = await client.connector.updateStatus({ + connector_id: "my-connector", + status: "needs_configuration", + }); + - language: Ruby + code: |- + response = client.connector.update_status( + connector_id: "my-connector", + body: { + "status": "needs_configuration" + } + ) + - language: PHP + code: |- + $resp = $client->connector()->updateStatus([ + "connector_id" => "my-connector", + "body" => [ + "status" => "needs_configuration", + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"status":"needs_configuration"}'' "$ELASTICSEARCH_URL/_connector/my-connector/_status"' diff --git a/specification/dangling_indices/delete_dangling_index/examples/request/DanglingIndicesDeleteDanglingIndexExample1.yaml b/specification/dangling_indices/delete_dangling_index/examples/request/DanglingIndicesDeleteDanglingIndexExample1.yaml index 5458a595a5..0115c77a22 100644 --- a/specification/dangling_indices/delete_dangling_index/examples/request/DanglingIndicesDeleteDanglingIndexExample1.yaml +++ b/specification/dangling_indices/delete_dangling_index/examples/request/DanglingIndicesDeleteDanglingIndexExample1.yaml @@ -1 +1,28 @@ method_request: DELETE /_dangling/?accept_data_loss=true +alternatives: + - language: Python + code: |- + resp = client.dangling_indices.delete_dangling_index( + index_uuid="", + accept_data_loss=True, + ) + - language: JavaScript + code: |- + const response = await client.danglingIndices.deleteDanglingIndex({ + index_uuid: "", + accept_data_loss: "true", + }); + - language: Ruby + code: |- + response = client.dangling_indices.delete_dangling_index( + index_uuid: "", + accept_data_loss: "true" + ) + - language: PHP + code: |- + $resp = $client->danglingIndices()->deleteDanglingIndex([ + "index_uuid" => "", + "accept_data_loss" => "true", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_dangling/?accept_data_loss=true"' diff --git a/specification/dangling_indices/import_dangling_index/examples/request/ImportDanglingIndexRequestExample1.yaml b/specification/dangling_indices/import_dangling_index/examples/request/ImportDanglingIndexRequestExample1.yaml index 51333864c2..e0ed43ba60 100644 --- a/specification/dangling_indices/import_dangling_index/examples/request/ImportDanglingIndexRequestExample1.yaml +++ b/specification/dangling_indices/import_dangling_index/examples/request/ImportDanglingIndexRequestExample1.yaml @@ -1 +1,29 @@ method_request: POST /_dangling/zmM4e0JtBkeUjiHD-MihPQ?accept_data_loss=true +alternatives: + - language: Python + code: |- + resp = client.dangling_indices.import_dangling_index( + index_uuid="zmM4e0JtBkeUjiHD-MihPQ", + accept_data_loss=True, + ) + - language: JavaScript + code: |- + const response = await client.danglingIndices.importDanglingIndex({ + index_uuid: "zmM4e0JtBkeUjiHD-MihPQ", + accept_data_loss: "true", + }); + - language: Ruby + code: |- + response = client.dangling_indices.import_dangling_index( + index_uuid: "zmM4e0JtBkeUjiHD-MihPQ", + accept_data_loss: "true" + ) + - language: PHP + code: |- + $resp = $client->danglingIndices()->importDanglingIndex([ + "index_uuid" => "zmM4e0JtBkeUjiHD-MihPQ", + "accept_data_loss" => "true", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_dangling/zmM4e0JtBkeUjiHD-MihPQ?accept_data_loss=true"' diff --git a/specification/dangling_indices/list_dangling_indices/examples/request/DanglingIndicesListDanglingIndicesExample1.yaml b/specification/dangling_indices/list_dangling_indices/examples/request/DanglingIndicesListDanglingIndicesExample1.yaml index ec6b553ed9..2a6013b642 100644 --- a/specification/dangling_indices/list_dangling_indices/examples/request/DanglingIndicesListDanglingIndicesExample1.yaml +++ b/specification/dangling_indices/list_dangling_indices/examples/request/DanglingIndicesListDanglingIndicesExample1.yaml @@ -1 +1,12 @@ method_request: GET /_dangling +alternatives: + - language: Python + code: resp = client.dangling_indices.list_dangling_indices() + - language: JavaScript + code: const response = await client.danglingIndices.listDanglingIndices(); + - language: Ruby + code: response = client.dangling_indices.list_dangling_indices + - language: PHP + code: $resp = $client->danglingIndices()->listDanglingIndices(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_dangling"' diff --git a/specification/enrich/delete_policy/examples/request/EnrichDeletePolicyExample1.yaml b/specification/enrich/delete_policy/examples/request/EnrichDeletePolicyExample1.yaml index f34d633b31..70a5f98a04 100644 --- a/specification/enrich/delete_policy/examples/request/EnrichDeletePolicyExample1.yaml +++ b/specification/enrich/delete_policy/examples/request/EnrichDeletePolicyExample1.yaml @@ -1 +1,24 @@ method_request: DELETE /_enrich/policy/my-policy +alternatives: + - language: Python + code: |- + resp = client.enrich.delete_policy( + name="my-policy", + ) + - language: JavaScript + code: |- + const response = await client.enrich.deletePolicy({ + name: "my-policy", + }); + - language: Ruby + code: |- + response = client.enrich.delete_policy( + name: "my-policy" + ) + - language: PHP + code: |- + $resp = $client->enrich()->deletePolicy([ + "name" => "my-policy", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_enrich/policy/my-policy"' diff --git a/specification/enrich/execute_policy/examples/request/EnrichExecutePolicyExample1.yaml b/specification/enrich/execute_policy/examples/request/EnrichExecutePolicyExample1.yaml index f811b235f4..0bc44deee6 100644 --- a/specification/enrich/execute_policy/examples/request/EnrichExecutePolicyExample1.yaml +++ b/specification/enrich/execute_policy/examples/request/EnrichExecutePolicyExample1.yaml @@ -1 +1,29 @@ method_request: PUT /_enrich/policy/my-policy/_execute?wait_for_completion=false +alternatives: + - language: Python + code: |- + resp = client.enrich.execute_policy( + name="my-policy", + wait_for_completion=False, + ) + - language: JavaScript + code: |- + const response = await client.enrich.executePolicy({ + name: "my-policy", + wait_for_completion: "false", + }); + - language: Ruby + code: |- + response = client.enrich.execute_policy( + name: "my-policy", + wait_for_completion: "false" + ) + - language: PHP + code: |- + $resp = $client->enrich()->executePolicy([ + "name" => "my-policy", + "wait_for_completion" => "false", + ]); + - language: curl + code: 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_enrich/policy/my-policy/_execute?wait_for_completion=false"' diff --git a/specification/enrich/get_policy/examples/request/EnrichGetPolicyExample1.yaml b/specification/enrich/get_policy/examples/request/EnrichGetPolicyExample1.yaml index 7ecb3d3281..6f646dbb1e 100644 --- a/specification/enrich/get_policy/examples/request/EnrichGetPolicyExample1.yaml +++ b/specification/enrich/get_policy/examples/request/EnrichGetPolicyExample1.yaml @@ -1 +1,24 @@ method_request: GET /_enrich/policy/my-policy +alternatives: + - language: Python + code: |- + resp = client.enrich.get_policy( + name="my-policy", + ) + - language: JavaScript + code: |- + const response = await client.enrich.getPolicy({ + name: "my-policy", + }); + - language: Ruby + code: |- + response = client.enrich.get_policy( + name: "my-policy" + ) + - language: PHP + code: |- + $resp = $client->enrich()->getPolicy([ + "name" => "my-policy", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_enrich/policy/my-policy"' diff --git a/specification/enrich/put_policy/examples/request/EnrichPutPolicyExample1.yaml b/specification/enrich/put_policy/examples/request/EnrichPutPolicyExample1.yaml index fc117616b3..2cc6b4c080 100644 --- a/specification/enrich/put_policy/examples/request/EnrichPutPolicyExample1.yaml +++ b/specification/enrich/put_policy/examples/request/EnrichPutPolicyExample1.yaml @@ -8,3 +8,62 @@ value: |- "enrich_fields": [ "location", "postal_code" ] } } +alternatives: + - language: Python + code: |- + resp = client.enrich.put_policy( + name="postal_policy", + geo_match={ + "indices": "postal_codes", + "match_field": "location", + "enrich_fields": [ + "location", + "postal_code" + ] + }, + ) + - language: JavaScript + code: |- + const response = await client.enrich.putPolicy({ + name: "postal_policy", + geo_match: { + indices: "postal_codes", + match_field: "location", + enrich_fields: ["location", "postal_code"], + }, + }); + - language: Ruby + code: |- + response = client.enrich.put_policy( + name: "postal_policy", + body: { + "geo_match": { + "indices": "postal_codes", + "match_field": "location", + "enrich_fields": [ + "location", + "postal_code" + ] + } + } + ) + - language: PHP + code: |- + $resp = $client->enrich()->putPolicy([ + "name" => "postal_policy", + "body" => [ + "geo_match" => [ + "indices" => "postal_codes", + "match_field" => "location", + "enrich_fields" => array( + "location", + "postal_code", + ), + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"geo_match":{"indices":"postal_codes","match_field":"location","enrich_fields":["location","postal_code"]}}'' + "$ELASTICSEARCH_URL/_enrich/policy/postal_policy"' diff --git a/specification/enrich/stats/examples/request/EnrichStatsExample1.yaml b/specification/enrich/stats/examples/request/EnrichStatsExample1.yaml index a6b11becca..14e6dc80c4 100644 --- a/specification/enrich/stats/examples/request/EnrichStatsExample1.yaml +++ b/specification/enrich/stats/examples/request/EnrichStatsExample1.yaml @@ -1 +1,12 @@ method_request: GET /_enrich/_stats +alternatives: + - language: Python + code: resp = client.enrich.stats() + - language: JavaScript + code: const response = await client.enrich.stats(); + - language: Ruby + code: response = client.enrich.stats + - language: PHP + code: $resp = $client->enrich()->stats(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_enrich/_stats"' diff --git a/specification/eql/delete/examples/request/EqlDeleteExample1.yaml b/specification/eql/delete/examples/request/EqlDeleteExample1.yaml index 6e3e4941c1..ff790cd876 100644 --- a/specification/eql/delete/examples/request/EqlDeleteExample1.yaml +++ b/specification/eql/delete/examples/request/EqlDeleteExample1.yaml @@ -1 +1,25 @@ method_request: DELETE /_eql/search/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE= +alternatives: + - language: Python + code: |- + resp = client.eql.delete( + id="FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=", + ) + - language: JavaScript + code: |- + const response = await client.eql.delete({ + id: "FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=", + }); + - language: Ruby + code: |- + response = client.eql.delete( + id: "FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=" + ) + - language: PHP + code: |- + $resp = $client->eql()->delete([ + "id" => "FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_eql/search/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE="' diff --git a/specification/eql/get/examples/request/EqlGetExample1.yaml b/specification/eql/get/examples/request/EqlGetExample1.yaml index 64c2684d90..0b57defa83 100644 --- a/specification/eql/get/examples/request/EqlGetExample1.yaml +++ b/specification/eql/get/examples/request/EqlGetExample1.yaml @@ -1 +1,29 @@ method_request: GET /_eql/search/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=?wait_for_completion_timeout=2s +alternatives: + - language: Python + code: |- + resp = client.eql.get( + id="FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=", + wait_for_completion_timeout="2s", + ) + - language: JavaScript + code: |- + const response = await client.eql.get({ + id: "FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=", + wait_for_completion_timeout: "2s", + }); + - language: Ruby + code: |- + response = client.eql.get( + id: "FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=", + wait_for_completion_timeout: "2s" + ) + - language: PHP + code: |- + $resp = $client->eql()->get([ + "id" => "FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=", + "wait_for_completion_timeout" => "2s", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_eql/search/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=?wait_for_completion_timeout=2s"' diff --git a/specification/eql/get_status/examples/request/EqlGetStatusExample1.yaml b/specification/eql/get_status/examples/request/EqlGetStatusExample1.yaml index 05d571aa8c..3f3f49ccfb 100644 --- a/specification/eql/get_status/examples/request/EqlGetStatusExample1.yaml +++ b/specification/eql/get_status/examples/request/EqlGetStatusExample1.yaml @@ -1 +1,25 @@ method_request: GET /_eql/search/status/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE= +alternatives: + - language: Python + code: |- + resp = client.eql.get_status( + id="FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=", + ) + - language: JavaScript + code: |- + const response = await client.eql.getStatus({ + id: "FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=", + }); + - language: Ruby + code: |- + response = client.eql.get_status( + id: "FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=" + ) + - language: PHP + code: |- + $resp = $client->eql()->getStatus([ + "id" => "FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_eql/search/status/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE="' diff --git a/specification/eql/search/examples/request/EqlSearchRequestExample1.yaml b/specification/eql/search/examples/request/EqlSearchRequestExample1.yaml index 57632c87a4..ac94c9ecaa 100644 --- a/specification/eql/search/examples/request/EqlSearchRequestExample1.yaml +++ b/specification/eql/search/examples/request/EqlSearchRequestExample1.yaml @@ -1,7 +1,8 @@ summary: Basic query method_request: GET /my-data-stream/_eql/search description: > - Run `GET /my-data-stream/_eql/search` to search for events that have a `process.name` of `cmd.exe` and a `process.pid` other than `2013`. + Run `GET /my-data-stream/_eql/search` to search for events that have a `process.name` of `cmd.exe` and a `process.pid` other than + `2013`. # type: request value: |- { @@ -9,3 +10,38 @@ value: |- process where (process.name == "cmd.exe" and process.pid != 2013) """ } +alternatives: + - language: Python + code: |- + resp = client.eql.search( + index="my-data-stream", + query="\n process where (process.name == \"cmd.exe\" and process.pid != 2013)\n ", + ) + - language: JavaScript + code: |- + const response = await client.eql.search({ + index: "my-data-stream", + query: + '\n process where (process.name == "cmd.exe" and process.pid != 2013)\n ', + }); + - language: Ruby + code: |- + response = client.eql.search( + index: "my-data-stream", + body: { + "query": "\n process where (process.name == \"cmd.exe\" and process.pid != 2013)\n " + } + ) + - language: PHP + code: |- + $resp = $client->eql()->search([ + "index" => "my-data-stream", + "body" => [ + "query" => "\n process where (process.name == \"cmd.exe\" and process.pid != 2013)\n ", + ], + ]); + - language: curl + code: + "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"query\":\"\\n process where (process.name == \\\"cmd.exe\\\" and process.pid != 2013)\\n \"}' + \"$ELASTICSEARCH_URL/my-data-stream/_eql/search\"" diff --git a/specification/eql/search/examples/request/EqlSearchRequestExample2.yaml b/specification/eql/search/examples/request/EqlSearchRequestExample2.yaml index 004e704a7b..b8c8d9886d 100644 --- a/specification/eql/search/examples/request/EqlSearchRequestExample2.yaml +++ b/specification/eql/search/examples/request/EqlSearchRequestExample2.yaml @@ -1,10 +1,10 @@ summary: Sequence query method_request: GET /my-data-stream/_eql/search description: > - Run `GET /my-data-stream/_eql/search` to search for a sequence of events. - The sequence starts with an event with an `event.category` of `file`, a `file.name` of `cmd.exe`, and a `process.pid` other than `2013`. - It is followed by an event with an `event.category` of `process` and a `process.executable` that contains the substring `regsvr32`. - These events must also share the same `process.pid` value. + Run `GET /my-data-stream/_eql/search` to search for a sequence of events. The sequence starts with an event with an + `event.category` of `file`, a `file.name` of `cmd.exe`, and a `process.pid` other than `2013`. It is followed by an event with an + `event.category` of `process` and a `process.executable` that contains the substring `regsvr32`. These events must also share the + same `process.pid` value. # type: request value: |- { @@ -14,3 +14,39 @@ value: |- [ process where stringContains(process.executable, "regsvr32") ] """ } +alternatives: + - language: Python + code: >- + resp = client.eql.search( + index="my-data-stream", + query="\n sequence by process.pid\n [ file where file.name == \"cmd.exe\" and process.pid != 2013 ]\n [ process where stringContains(process.executable, \"regsvr32\") ]\n ", + ) + - language: JavaScript + code: >- + const response = await client.eql.search({ + index: "my-data-stream", + query: + '\n sequence by process.pid\n [ file where file.name == "cmd.exe" and process.pid != 2013 ]\n [ process where stringContains(process.executable, "regsvr32") ]\n ', + }); + - language: Ruby + code: >- + response = client.eql.search( + index: "my-data-stream", + body: { + "query": "\n sequence by process.pid\n [ file where file.name == \"cmd.exe\" and process.pid != 2013 ]\n [ process where stringContains(process.executable, \"regsvr32\") ]\n " + } + ) + - language: PHP + code: >- + $resp = $client->eql()->search([ + "index" => "my-data-stream", + "body" => [ + "query" => "\n sequence by process.pid\n [ file where file.name == \"cmd.exe\" and process.pid != 2013 ]\n [ process where stringContains(process.executable, \"regsvr32\") ]\n ", + ], + ]); + - language: curl + code: + "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"query\":\"\\n sequence by process.pid\\n [ file where file.name == \\\"cmd.exe\\\" and process.pid != 2013 + ]\\n [ process where stringContains(process.executable, \\\"regsvr32\\\") ]\\n \"}' + \"$ELASTICSEARCH_URL/my-data-stream/_eql/search\"" diff --git a/specification/esql/async_query/examples/request/AsyncQueryRequestExample1.yaml b/specification/esql/async_query/examples/request/AsyncQueryRequestExample1.yaml index 263114a0b4..c36096a74a 100644 --- a/specification/esql/async_query/examples/request/AsyncQueryRequestExample1.yaml +++ b/specification/esql/async_query/examples/request/AsyncQueryRequestExample1.yaml @@ -14,3 +14,43 @@ value: |- "wait_for_completion_timeout": "2s", "include_ccs_metadata": true } +alternatives: + - language: Python + code: >- + resp = client.esql.async_query( + query="\n FROM library,remote-*:library\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n | STATS MAX(page_count) BY year\n | SORT year\n | LIMIT 5\n ", + wait_for_completion_timeout="2s", + include_ccs_metadata=True, + ) + - language: JavaScript + code: >- + const response = await client.esql.asyncQuery({ + query: + "\n FROM library,remote-*:library\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n | STATS MAX(page_count) BY year\n | SORT year\n | LIMIT 5\n ", + wait_for_completion_timeout: "2s", + include_ccs_metadata: true, + }); + - language: Ruby + code: >- + response = client.esql.async_query( + body: { + "query": "\n FROM library,remote-*:library\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n | STATS MAX(page_count) BY year\n | SORT year\n | LIMIT 5\n ", + "wait_for_completion_timeout": "2s", + "include_ccs_metadata": true + } + ) + - language: PHP + code: >- + $resp = $client->esql()->asyncQuery([ + "body" => [ + "query" => "\n FROM library,remote-*:library\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n | STATS MAX(page_count) BY year\n | SORT year\n | LIMIT 5\n ", + "wait_for_completion_timeout" => "2s", + "include_ccs_metadata" => true, + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":\"\\n FROM + library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | + SORT year\\n | LIMIT 5\\n \",\"wait_for_completion_timeout\":\"2s\",\"include_ccs_metadata\":true}' + \"$ELASTICSEARCH_URL/_query/async\"" diff --git a/specification/esql/async_query_delete/examples/request/EsqlAsyncQueryDeleteExample1.yaml b/specification/esql/async_query_delete/examples/request/EsqlAsyncQueryDeleteExample1.yaml index 0c630eee05..45f05b8bdd 100644 --- a/specification/esql/async_query_delete/examples/request/EsqlAsyncQueryDeleteExample1.yaml +++ b/specification/esql/async_query_delete/examples/request/EsqlAsyncQueryDeleteExample1.yaml @@ -1 +1,25 @@ method_request: DELETE /_query/async/FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI= +alternatives: + - language: Python + code: |- + resp = client.esql.async_query_delete( + id="FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=", + ) + - language: JavaScript + code: |- + const response = await client.esql.asyncQueryDelete({ + id: "FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=", + }); + - language: Ruby + code: |- + response = client.esql.async_query_delete( + id: "FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=" + ) + - language: PHP + code: |- + $resp = $client->esql()->asyncQueryDelete([ + "id" => "FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_query/async/FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI="' diff --git a/specification/esql/async_query_get/examples/request/EsqlAsyncQueryGetExample1.yaml b/specification/esql/async_query_get/examples/request/EsqlAsyncQueryGetExample1.yaml index 7a69a2399a..85b1c99547 100644 --- a/specification/esql/async_query_get/examples/request/EsqlAsyncQueryGetExample1.yaml +++ b/specification/esql/async_query_get/examples/request/EsqlAsyncQueryGetExample1.yaml @@ -1 +1,29 @@ method_request: GET /_query/async/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=?wait_for_completion_timeout=30s +alternatives: + - language: Python + code: |- + resp = client.esql.async_query_get( + id="FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=", + wait_for_completion_timeout="30s", + ) + - language: JavaScript + code: |- + const response = await client.esql.asyncQueryGet({ + id: "FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=", + wait_for_completion_timeout: "30s", + }); + - language: Ruby + code: |- + response = client.esql.async_query_get( + id: "FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=", + wait_for_completion_timeout: "30s" + ) + - language: PHP + code: |- + $resp = $client->esql()->asyncQueryGet([ + "id" => "FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=", + "wait_for_completion_timeout" => "30s", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_query/async/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=?wait_for_completion_timeout=30s"' diff --git a/specification/esql/async_query_stop/examples/request/EsqlAsyncQueryStopExample1.yaml b/specification/esql/async_query_stop/examples/request/EsqlAsyncQueryStopExample1.yaml index 775da781ae..ee66b7e73b 100644 --- a/specification/esql/async_query_stop/examples/request/EsqlAsyncQueryStopExample1.yaml +++ b/specification/esql/async_query_stop/examples/request/EsqlAsyncQueryStopExample1.yaml @@ -1 +1,25 @@ method_request: POST /_query/async/FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=/stop +alternatives: + - language: Python + code: |- + resp = client.esql.async_query_stop( + id="FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=", + ) + - language: JavaScript + code: |- + const response = await client.esql.asyncQueryStop({ + id: "FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=", + }); + - language: Ruby + code: |- + response = client.esql.async_query_stop( + id: "FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=" + ) + - language: PHP + code: |- + $resp = $client->esql()->asyncQueryStop([ + "id" => "FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_query/async/FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=/stop"' diff --git a/specification/esql/query/examples/request/QueryRequestExample1.yaml b/specification/esql/query/examples/request/QueryRequestExample1.yaml index be5b71f199..9408ea0d50 100644 --- a/specification/esql/query/examples/request/QueryRequestExample1.yaml +++ b/specification/esql/query/examples/request/QueryRequestExample1.yaml @@ -13,3 +13,38 @@ value: |- """, "include_ccs_metadata": true } +alternatives: + - language: Python + code: >- + resp = client.esql.query( + query="\n FROM library,remote-*:library\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n | STATS MAX(page_count) BY year\n | SORT year\n | LIMIT 5\n ", + include_ccs_metadata=True, + ) + - language: JavaScript + code: >- + const response = await client.esql.query({ + query: + "\n FROM library,remote-*:library\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n | STATS MAX(page_count) BY year\n | SORT year\n | LIMIT 5\n ", + include_ccs_metadata: true, + }); + - language: Ruby + code: >- + response = client.esql.query( + body: { + "query": "\n FROM library,remote-*:library\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n | STATS MAX(page_count) BY year\n | SORT year\n | LIMIT 5\n ", + "include_ccs_metadata": true + } + ) + - language: PHP + code: >- + $resp = $client->esql()->query([ + "body" => [ + "query" => "\n FROM library,remote-*:library\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n | STATS MAX(page_count) BY year\n | SORT year\n | LIMIT 5\n ", + "include_ccs_metadata" => true, + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":\"\\n FROM + library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n | + SORT year\\n | LIMIT 5\\n \",\"include_ccs_metadata\":true}' \"$ELASTICSEARCH_URL/_query\"" diff --git a/specification/features/get_features/examples/request/FeaturesGetFeaturesExample1.yaml b/specification/features/get_features/examples/request/FeaturesGetFeaturesExample1.yaml index 509f354389..8ecfcd3ac2 100644 --- a/specification/features/get_features/examples/request/FeaturesGetFeaturesExample1.yaml +++ b/specification/features/get_features/examples/request/FeaturesGetFeaturesExample1.yaml @@ -1 +1,12 @@ method_request: GET _features +alternatives: + - language: Python + code: resp = client.features.get_features() + - language: JavaScript + code: const response = await client.features.getFeatures(); + - language: Ruby + code: response = client.features.get_features + - language: PHP + code: $resp = $client->features()->getFeatures(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_features"' diff --git a/specification/features/reset_features/examples/request/FeaturesResetFeaturesExample1.yaml b/specification/features/reset_features/examples/request/FeaturesResetFeaturesExample1.yaml index 0d7baa04ab..f34d9b2fd4 100644 --- a/specification/features/reset_features/examples/request/FeaturesResetFeaturesExample1.yaml +++ b/specification/features/reset_features/examples/request/FeaturesResetFeaturesExample1.yaml @@ -1 +1,12 @@ method_request: POST /_features/_reset +alternatives: + - language: Python + code: resp = client.features.reset_features() + - language: JavaScript + code: const response = await client.features.resetFeatures(); + - language: Ruby + code: response = client.features.reset_features + - language: PHP + code: $resp = $client->features()->resetFeatures(); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_features/_reset"' diff --git a/specification/graph/explore/examples/request/GraphExploreRequestExample1.yaml b/specification/graph/explore/examples/request/GraphExploreRequestExample1.yaml index 277f6ab0fd..b02c0d7560 100644 --- a/specification/graph/explore/examples/request/GraphExploreRequestExample1.yaml +++ b/specification/graph/explore/examples/request/GraphExploreRequestExample1.yaml @@ -1,10 +1,11 @@ # summary: method_request: POST clicklogs/_graph/explore description: > - Run `POST clicklogs/_graph/explore` for a basic exploration - An initial graph explore query typically begins with a query to identify strongly related terms. - Seed the exploration with a query. This example is searching `clicklogs` for people who searched for the term `midi`.Identify the vertices to include in the graph. This example is looking for product codes that are significantly associated with searches for `midi`. - Find the connections. This example is looking for other search terms that led people to click on the products that are associated with searches for `midi`. + Run `POST clicklogs/_graph/explore` for a basic exploration An initial graph explore query typically begins with a query to + identify strongly related terms. Seed the exploration with a query. This example is searching `clicklogs` for people who searched + for the term `midi`.Identify the vertices to include in the graph. This example is looking for product codes that are + significantly associated with searches for `midi`. Find the connections. This example is looking for other search terms that led + people to click on the products that are associated with searches for `midi`. # type: request value: |- { @@ -26,3 +27,101 @@ value: |- ] } } +alternatives: + - language: Python + code: |- + resp = client.graph.explore( + index="clicklogs", + query={ + "match": { + "query.raw": "midi" + } + }, + vertices=[ + { + "field": "product" + } + ], + connections={ + "vertices": [ + { + "field": "query.raw" + } + ] + }, + ) + - language: JavaScript + code: |- + const response = await client.graph.explore({ + index: "clicklogs", + query: { + match: { + "query.raw": "midi", + }, + }, + vertices: [ + { + field: "product", + }, + ], + connections: { + vertices: [ + { + field: "query.raw", + }, + ], + }, + }); + - language: Ruby + code: |- + response = client.graph.explore( + index: "clicklogs", + body: { + "query": { + "match": { + "query.raw": "midi" + } + }, + "vertices": [ + { + "field": "product" + } + ], + "connections": { + "vertices": [ + { + "field": "query.raw" + } + ] + } + } + ) + - language: PHP + code: |- + $resp = $client->graph()->explore([ + "index" => "clicklogs", + "body" => [ + "query" => [ + "match" => [ + "query.raw" => "midi", + ], + ], + "vertices" => array( + [ + "field" => "product", + ], + ), + "connections" => [ + "vertices" => array( + [ + "field" => "query.raw", + ], + ), + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"query\":{\"match\":{\"query.raw\":\"midi\"}},\"vertices\":[{\"field\":\"product\"}],\"connections\":{\"vertices\":[{\"fie\ + ld\":\"query.raw\"}]}}' \"$ELASTICSEARCH_URL/clicklogs/_graph/explore\"" diff --git a/specification/ilm/delete_lifecycle/examples/request/IlmDeleteLifecycleExample1.yaml b/specification/ilm/delete_lifecycle/examples/request/IlmDeleteLifecycleExample1.yaml index 2e2a308346..e2ae7caa99 100644 --- a/specification/ilm/delete_lifecycle/examples/request/IlmDeleteLifecycleExample1.yaml +++ b/specification/ilm/delete_lifecycle/examples/request/IlmDeleteLifecycleExample1.yaml @@ -1 +1,24 @@ method_request: DELETE _ilm/policy/my_policy +alternatives: + - language: Python + code: |- + resp = client.ilm.delete_lifecycle( + name="my_policy", + ) + - language: JavaScript + code: |- + const response = await client.ilm.deleteLifecycle({ + name: "my_policy", + }); + - language: Ruby + code: |- + response = client.ilm.delete_lifecycle( + policy: "my_policy" + ) + - language: PHP + code: |- + $resp = $client->ilm()->deleteLifecycle([ + "policy" => "my_policy", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ilm/policy/my_policy"' diff --git a/specification/ilm/explain_lifecycle/examples/request/IlmExplainLifecycleExample1.yaml b/specification/ilm/explain_lifecycle/examples/request/IlmExplainLifecycleExample1.yaml index e695acaecd..e3aca7ca86 100644 --- a/specification/ilm/explain_lifecycle/examples/request/IlmExplainLifecycleExample1.yaml +++ b/specification/ilm/explain_lifecycle/examples/request/IlmExplainLifecycleExample1.yaml @@ -1 +1,24 @@ method_request: GET .ds-timeseries-*/_ilm/explain +alternatives: + - language: Python + code: |- + resp = client.ilm.explain_lifecycle( + index=".ds-timeseries-*", + ) + - language: JavaScript + code: |- + const response = await client.ilm.explainLifecycle({ + index: ".ds-timeseries-*", + }); + - language: Ruby + code: |- + response = client.ilm.explain_lifecycle( + index: ".ds-timeseries-*" + ) + - language: PHP + code: |- + $resp = $client->ilm()->explainLifecycle([ + "index" => ".ds-timeseries-*", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/.ds-timeseries-*/_ilm/explain"' diff --git a/specification/ilm/get_lifecycle/examples/request/IlmGetLifecycleExample1.yaml b/specification/ilm/get_lifecycle/examples/request/IlmGetLifecycleExample1.yaml index cebf89a7ab..8692b0b198 100644 --- a/specification/ilm/get_lifecycle/examples/request/IlmGetLifecycleExample1.yaml +++ b/specification/ilm/get_lifecycle/examples/request/IlmGetLifecycleExample1.yaml @@ -1 +1,24 @@ method_request: GET _ilm/policy/my_policy +alternatives: + - language: Python + code: |- + resp = client.ilm.get_lifecycle( + name="my_policy", + ) + - language: JavaScript + code: |- + const response = await client.ilm.getLifecycle({ + name: "my_policy", + }); + - language: Ruby + code: |- + response = client.ilm.get_lifecycle( + policy: "my_policy" + ) + - language: PHP + code: |- + $resp = $client->ilm()->getLifecycle([ + "policy" => "my_policy", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ilm/policy/my_policy"' diff --git a/specification/ilm/get_status/examples/request/IlmGetStatusExample1.yaml b/specification/ilm/get_status/examples/request/IlmGetStatusExample1.yaml index 04047c6804..bf754beaed 100644 --- a/specification/ilm/get_status/examples/request/IlmGetStatusExample1.yaml +++ b/specification/ilm/get_status/examples/request/IlmGetStatusExample1.yaml @@ -1 +1,12 @@ method_request: GET _ilm/status +alternatives: + - language: Python + code: resp = client.ilm.get_status() + - language: JavaScript + code: const response = await client.ilm.getStatus(); + - language: Ruby + code: response = client.ilm.get_status + - language: PHP + code: $resp = $client->ilm()->getStatus(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ilm/status"' diff --git a/specification/ilm/migrate_to_data_tiers/examples/request/MigrateToDataTiersRequestExample1.yaml b/specification/ilm/migrate_to_data_tiers/examples/request/MigrateToDataTiersRequestExample1.yaml index 901a6c378a..b57edd30e1 100644 --- a/specification/ilm/migrate_to_data_tiers/examples/request/MigrateToDataTiersRequestExample1.yaml +++ b/specification/ilm/migrate_to_data_tiers/examples/request/MigrateToDataTiersRequestExample1.yaml @@ -1,11 +1,46 @@ # summary: 'Migrates indices, ILM policies, and templates from using custom node attributes to using data tiers.' method_request: POST /_ilm/migrate_to_data_tiers description: > - Run `POST /_ilm/migrate_to_data_tiers` to migrate the indices, ILM policies, legacy templates, composable, and component templates away from defining custom allocation filtering using the `custom_attribute_name` node attribute. - It also deletes the legacy template with name `global-template` if it exists in the system. + Run `POST /_ilm/migrate_to_data_tiers` to migrate the indices, ILM policies, legacy templates, composable, and component templates + away from defining custom allocation filtering using the `custom_attribute_name` node attribute. It also deletes the legacy + template with name `global-template` if it exists in the system. # type: request value: |- { "legacy_template_to_delete": "global-template", "node_attribute": "custom_attribute_name" } +alternatives: + - language: Python + code: |- + resp = client.ilm.migrate_to_data_tiers( + legacy_template_to_delete="global-template", + node_attribute="custom_attribute_name", + ) + - language: JavaScript + code: |- + const response = await client.ilm.migrateToDataTiers({ + legacy_template_to_delete: "global-template", + node_attribute: "custom_attribute_name", + }); + - language: Ruby + code: |- + response = client.ilm.migrate_to_data_tiers( + body: { + "legacy_template_to_delete": "global-template", + "node_attribute": "custom_attribute_name" + } + ) + - language: PHP + code: |- + $resp = $client->ilm()->migrateToDataTiers([ + "body" => [ + "legacy_template_to_delete" => "global-template", + "node_attribute" => "custom_attribute_name", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"legacy_template_to_delete":"global-template","node_attribute":"custom_attribute_name"}'' + "$ELASTICSEARCH_URL/_ilm/migrate_to_data_tiers"' diff --git a/specification/ilm/move_to_step/examples/request/MoveToStepRequestExample1.yaml b/specification/ilm/move_to_step/examples/request/MoveToStepRequestExample1.yaml index b45cfd721e..9cf7edb98c 100644 --- a/specification/ilm/move_to_step/examples/request/MoveToStepRequestExample1.yaml +++ b/specification/ilm/move_to_step/examples/request/MoveToStepRequestExample1.yaml @@ -16,3 +16,73 @@ value: |- "name": "forcemerge" } } +alternatives: + - language: Python + code: |- + resp = client.ilm.move_to_step( + index="my-index-000001", + current_step={ + "phase": "new", + "action": "complete", + "name": "complete" + }, + next_step={ + "phase": "warm", + "action": "forcemerge", + "name": "forcemerge" + }, + ) + - language: JavaScript + code: |- + const response = await client.ilm.moveToStep({ + index: "my-index-000001", + current_step: { + phase: "new", + action: "complete", + name: "complete", + }, + next_step: { + phase: "warm", + action: "forcemerge", + name: "forcemerge", + }, + }); + - language: Ruby + code: |- + response = client.ilm.move_to_step( + index: "my-index-000001", + body: { + "current_step": { + "phase": "new", + "action": "complete", + "name": "complete" + }, + "next_step": { + "phase": "warm", + "action": "forcemerge", + "name": "forcemerge" + } + } + ) + - language: PHP + code: |- + $resp = $client->ilm()->moveToStep([ + "index" => "my-index-000001", + "body" => [ + "current_step" => [ + "phase" => "new", + "action" => "complete", + "name" => "complete", + ], + "next_step" => [ + "phase" => "warm", + "action" => "forcemerge", + "name" => "forcemerge", + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"current_step\":{\"phase\":\"new\",\"action\":\"complete\",\"name\":\"complete\"},\"next_step\":{\"phase\":\"warm\",\"acti\ + on\":\"forcemerge\",\"name\":\"forcemerge\"}}' \"$ELASTICSEARCH_URL/_ilm/move/my-index-000001\"" diff --git a/specification/ilm/move_to_step/examples/request/MoveToStepRequestExample2.yaml b/specification/ilm/move_to_step/examples/request/MoveToStepRequestExample2.yaml index a2f6b5c1ab..84c3eb1579 100644 --- a/specification/ilm/move_to_step/examples/request/MoveToStepRequestExample2.yaml +++ b/specification/ilm/move_to_step/examples/request/MoveToStepRequestExample2.yaml @@ -14,3 +14,65 @@ value: |- "phase": "warm" } } +alternatives: + - language: Python + code: |- + resp = client.ilm.move_to_step( + index="my-index-000001", + current_step={ + "phase": "hot", + "action": "complete", + "name": "complete" + }, + next_step={ + "phase": "warm" + }, + ) + - language: JavaScript + code: |- + const response = await client.ilm.moveToStep({ + index: "my-index-000001", + current_step: { + phase: "hot", + action: "complete", + name: "complete", + }, + next_step: { + phase: "warm", + }, + }); + - language: Ruby + code: |- + response = client.ilm.move_to_step( + index: "my-index-000001", + body: { + "current_step": { + "phase": "hot", + "action": "complete", + "name": "complete" + }, + "next_step": { + "phase": "warm" + } + } + ) + - language: PHP + code: |- + $resp = $client->ilm()->moveToStep([ + "index" => "my-index-000001", + "body" => [ + "current_step" => [ + "phase" => "hot", + "action" => "complete", + "name" => "complete", + ], + "next_step" => [ + "phase" => "warm", + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"current_step":{"phase":"hot","action":"complete","name":"complete"},"next_step":{"phase":"warm"}}'' + "$ELASTICSEARCH_URL/_ilm/move/my-index-000001"' diff --git a/specification/ilm/put_lifecycle/examples/request/PutLifecycleRequestExample1.yaml b/specification/ilm/put_lifecycle/examples/request/PutLifecycleRequestExample1.yaml index b703c86d37..d8ede106f0 100644 --- a/specification/ilm/put_lifecycle/examples/request/PutLifecycleRequestExample1.yaml +++ b/specification/ilm/put_lifecycle/examples/request/PutLifecycleRequestExample1.yaml @@ -31,3 +31,135 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.ilm.put_lifecycle( + name="my_policy", + policy={ + "_meta": { + "description": "used for nginx log", + "project": { + "name": "myProject", + "department": "myDepartment" + } + }, + "phases": { + "warm": { + "min_age": "10d", + "actions": { + "forcemerge": { + "max_num_segments": 1 + } + } + }, + "delete": { + "min_age": "30d", + "actions": { + "delete": {} + } + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.ilm.putLifecycle({ + name: "my_policy", + policy: { + _meta: { + description: "used for nginx log", + project: { + name: "myProject", + department: "myDepartment", + }, + }, + phases: { + warm: { + min_age: "10d", + actions: { + forcemerge: { + max_num_segments: 1, + }, + }, + }, + delete: { + min_age: "30d", + actions: { + delete: {}, + }, + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.ilm.put_lifecycle( + policy: "my_policy", + body: { + "policy": { + "_meta": { + "description": "used for nginx log", + "project": { + "name": "myProject", + "department": "myDepartment" + } + }, + "phases": { + "warm": { + "min_age": "10d", + "actions": { + "forcemerge": { + "max_num_segments": 1 + } + } + }, + "delete": { + "min_age": "30d", + "actions": { + "delete": {} + } + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->ilm()->putLifecycle([ + "policy" => "my_policy", + "body" => [ + "policy" => [ + "_meta" => [ + "description" => "used for nginx log", + "project" => [ + "name" => "myProject", + "department" => "myDepartment", + ], + ], + "phases" => [ + "warm" => [ + "min_age" => "10d", + "actions" => [ + "forcemerge" => [ + "max_num_segments" => 1, + ], + ], + ], + "delete" => [ + "min_age" => "30d", + "actions" => [ + "delete" => new ArrayObject([]), + ], + ], + ], + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"policy\":{\"_meta\":{\"description\":\"used for nginx + log\",\"project\":{\"name\":\"myProject\",\"department\":\"myDepartment\"}},\"phases\":{\"warm\":{\"min_age\":\"10d\",\"actio\ + ns\":{\"forcemerge\":{\"max_num_segments\":1}}},\"delete\":{\"min_age\":\"30d\",\"actions\":{\"delete\":{}}}}}}' + \"$ELASTICSEARCH_URL/_ilm/policy/my_policy\"" diff --git a/specification/ilm/remove_policy/examples/request/IlmRemovePolicyExample1.yaml b/specification/ilm/remove_policy/examples/request/IlmRemovePolicyExample1.yaml index 360fb2c26e..3631b25f43 100644 --- a/specification/ilm/remove_policy/examples/request/IlmRemovePolicyExample1.yaml +++ b/specification/ilm/remove_policy/examples/request/IlmRemovePolicyExample1.yaml @@ -1 +1,24 @@ method_request: POST logs-my_app-default/_ilm/remove +alternatives: + - language: Python + code: |- + resp = client.ilm.remove_policy( + index="logs-my_app-default", + ) + - language: JavaScript + code: |- + const response = await client.ilm.removePolicy({ + index: "logs-my_app-default", + }); + - language: Ruby + code: |- + response = client.ilm.remove_policy( + index: "logs-my_app-default" + ) + - language: PHP + code: |- + $resp = $client->ilm()->removePolicy([ + "index" => "logs-my_app-default", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/logs-my_app-default/_ilm/remove"' diff --git a/specification/ilm/retry/examples/request/IlmRetryExample1.yaml b/specification/ilm/retry/examples/request/IlmRetryExample1.yaml index 103ab9f387..d79c781951 100644 --- a/specification/ilm/retry/examples/request/IlmRetryExample1.yaml +++ b/specification/ilm/retry/examples/request/IlmRetryExample1.yaml @@ -1 +1,24 @@ method_request: POST /my-index-000001/_ilm/retry +alternatives: + - language: Python + code: |- + resp = client.ilm.retry( + index="my-index-000001", + ) + - language: JavaScript + code: |- + const response = await client.ilm.retry({ + index: "my-index-000001", + }); + - language: Ruby + code: |- + response = client.ilm.retry( + index: "my-index-000001" + ) + - language: PHP + code: |- + $resp = $client->ilm()->retry([ + "index" => "my-index-000001", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index-000001/_ilm/retry"' diff --git a/specification/ilm/start/examples/request/IlmStartExample1.yaml b/specification/ilm/start/examples/request/IlmStartExample1.yaml index 2a48463c8a..ace35b513b 100644 --- a/specification/ilm/start/examples/request/IlmStartExample1.yaml +++ b/specification/ilm/start/examples/request/IlmStartExample1.yaml @@ -1 +1,12 @@ method_request: POST _ilm/start +alternatives: + - language: Python + code: resp = client.ilm.start() + - language: JavaScript + code: const response = await client.ilm.start(); + - language: Ruby + code: response = client.ilm.start + - language: PHP + code: $resp = $client->ilm()->start(); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ilm/start"' diff --git a/specification/ilm/stop/examples/request/IlmStopExample1.yaml b/specification/ilm/stop/examples/request/IlmStopExample1.yaml index b3476798bb..f86f73a637 100644 --- a/specification/ilm/stop/examples/request/IlmStopExample1.yaml +++ b/specification/ilm/stop/examples/request/IlmStopExample1.yaml @@ -1 +1,12 @@ method_request: POST _ilm/stop +alternatives: + - language: Python + code: resp = client.ilm.stop() + - language: JavaScript + code: const response = await client.ilm.stop(); + - language: Ruby + code: response = client.ilm.stop + - language: PHP + code: $resp = $client->ilm()->stop(); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ilm/stop"' diff --git a/specification/indices/add_block/examples/request/IndicesAddBlockRequestExample1.yaml b/specification/indices/add_block/examples/request/IndicesAddBlockRequestExample1.yaml index 7cda8f1073..b937155de0 100644 --- a/specification/indices/add_block/examples/request/IndicesAddBlockRequestExample1.yaml +++ b/specification/indices/add_block/examples/request/IndicesAddBlockRequestExample1.yaml @@ -1 +1,28 @@ method_request: PUT /my-index-000001/_block/write +alternatives: + - language: Python + code: |- + resp = client.indices.add_block( + index="my-index-000001", + block="write", + ) + - language: JavaScript + code: |- + const response = await client.indices.addBlock({ + index: "my-index-000001", + block: "write", + }); + - language: Ruby + code: |- + response = client.indices.add_block( + index: "my-index-000001", + block: "write" + ) + - language: PHP + code: |- + $resp = $client->indices()->addBlock([ + "index" => "my-index-000001", + "block" => "write", + ]); + - language: curl + code: 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index-000001/_block/write"' diff --git a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample1.yaml b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample1.yaml index c2fca2f8db..05e856ddd4 100644 --- a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample1.yaml +++ b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample1.yaml @@ -5,3 +5,36 @@ description: You can apply any of the built-in analyzers to the text string with value: analyzer: standard text: this is a test +alternatives: + - language: Python + code: |- + resp = client.indices.analyze( + analyzer="standard", + text="this is a test", + ) + - language: JavaScript + code: |- + const response = await client.indices.analyze({ + analyzer: "standard", + text: "this is a test", + }); + - language: Ruby + code: |- + response = client.indices.analyze( + body: { + "analyzer": "standard", + "text": "this is a test" + } + ) + - language: PHP + code: |- + $resp = $client->indices()->analyze([ + "body" => [ + "analyzer" => "standard", + "text" => "this is a test", + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"analyzer":"standard","text":"this is a test"}'' "$ELASTICSEARCH_URL/_analyze"' diff --git a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample2.yaml b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample2.yaml index 06a2afc3a7..5887878533 100644 --- a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample2.yaml +++ b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample2.yaml @@ -7,3 +7,45 @@ value: text: - this is a test - the second text +alternatives: + - language: Python + code: |- + resp = client.indices.analyze( + analyzer="standard", + text=[ + "this is a test", + "the second text" + ], + ) + - language: JavaScript + code: |- + const response = await client.indices.analyze({ + analyzer: "standard", + text: ["this is a test", "the second text"], + }); + - language: Ruby + code: |- + response = client.indices.analyze( + body: { + "analyzer": "standard", + "text": [ + "this is a test", + "the second text" + ] + } + ) + - language: PHP + code: |- + $resp = $client->indices()->analyze([ + "body" => [ + "analyzer" => "standard", + "text" => array( + "this is a test", + "the second text", + ), + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"analyzer":"standard","text":["this is a test","the second text"]}'' "$ELASTICSEARCH_URL/_analyze"' diff --git a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample3.yaml b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample3.yaml index e4eb829069..b3adae0e32 100644 --- a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample3.yaml +++ b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample3.yaml @@ -1,6 +1,8 @@ summary: Custom analyzer example 1 method_request: GET /_analyze -description: You can test a custom transient analyzer built from tokenizers, token filters, and char filters. Token filters use the filter parameter. +description: + You can test a custom transient analyzer built from tokenizers, token filters, and char filters. Token filters use the + filter parameter. # type: request value: tokenizer: keyword @@ -9,3 +11,57 @@ value: char_filter: - html_strip text: 'this is a test' +alternatives: + - language: Python + code: |- + resp = client.indices.analyze( + tokenizer="keyword", + filter=[ + "lowercase" + ], + char_filter=[ + "html_strip" + ], + text="this is a test", + ) + - language: JavaScript + code: |- + const response = await client.indices.analyze({ + tokenizer: "keyword", + filter: ["lowercase"], + char_filter: ["html_strip"], + text: "this is a test", + }); + - language: Ruby + code: |- + response = client.indices.analyze( + body: { + "tokenizer": "keyword", + "filter": [ + "lowercase" + ], + "char_filter": [ + "html_strip" + ], + "text": "this is a test" + } + ) + - language: PHP + code: |- + $resp = $client->indices()->analyze([ + "body" => [ + "tokenizer" => "keyword", + "filter" => array( + "lowercase", + ), + "char_filter" => array( + "html_strip", + ), + "text" => "this is a test", + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"tokenizer":"keyword","filter":["lowercase"],"char_filter":["html_strip"],"text":"this is a test"}'' + "$ELASTICSEARCH_URL/_analyze"' diff --git a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample4.yaml b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample4.yaml index ecbe8c8886..541f41c14e 100644 --- a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample4.yaml +++ b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample4.yaml @@ -12,3 +12,77 @@ value: - is - this text: this is a test +alternatives: + - language: Python + code: |- + resp = client.indices.analyze( + tokenizer="whitespace", + filter=[ + "lowercase", + { + "type": "stop", + "stopwords": [ + "a", + "is", + "this" + ] + } + ], + text="this is a test", + ) + - language: JavaScript + code: |- + const response = await client.indices.analyze({ + tokenizer: "whitespace", + filter: [ + "lowercase", + { + type: "stop", + stopwords: ["a", "is", "this"], + }, + ], + text: "this is a test", + }); + - language: Ruby + code: |- + response = client.indices.analyze( + body: { + "tokenizer": "whitespace", + "filter": [ + "lowercase", + { + "type": "stop", + "stopwords": [ + "a", + "is", + "this" + ] + } + ], + "text": "this is a test" + } + ) + - language: PHP + code: |- + $resp = $client->indices()->analyze([ + "body" => [ + "tokenizer" => "whitespace", + "filter" => array( + "lowercase", + [ + "type" => "stop", + "stopwords" => array( + "a", + "is", + "this", + ), + ], + ), + "text" => "this is a test", + ], + ]); + - language: curl + code: + "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"tokenizer\":\"whitespace\",\"filter\":[\"lowercase\",{\"type\":\"stop\",\"stopwords\":[\"a\",\"is\",\"this\"]}],\"text\":\ + \"this is a test\"}' \"$ELASTICSEARCH_URL/_analyze\"" diff --git a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample5.yaml b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample5.yaml index 2fe625ed8e..a13db789ff 100644 --- a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample5.yaml +++ b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample5.yaml @@ -1,7 +1,46 @@ summary: Derive analyzer from field mapping method_request: GET /analyze_sample/_analyze -description: Run `GET /analyze_sample/_analyze` to run an analysis on the text using the default index analyzer associated with the `analyze_sample` index. Alternatively, the analyzer can be derived based on a field mapping. +description: + Run `GET /analyze_sample/_analyze` to run an analysis on the text using the default index analyzer associated with the + `analyze_sample` index. Alternatively, the analyzer can be derived based on a field mapping. # type: request value: field: obj1.field1 text: this is a test +alternatives: + - language: Python + code: |- + resp = client.indices.analyze( + index="analyze_sample", + field="obj1.field1", + text="this is a test", + ) + - language: JavaScript + code: |- + const response = await client.indices.analyze({ + index: "analyze_sample", + field: "obj1.field1", + text: "this is a test", + }); + - language: Ruby + code: |- + response = client.indices.analyze( + index: "analyze_sample", + body: { + "field": "obj1.field1", + "text": "this is a test" + } + ) + - language: PHP + code: |- + $resp = $client->indices()->analyze([ + "index" => "analyze_sample", + "body" => [ + "field" => "obj1.field1", + "text" => "this is a test", + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"field":"obj1.field1","text":"this is a test"}'' "$ELASTICSEARCH_URL/analyze_sample/_analyze"' diff --git a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample6.yaml b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample6.yaml index d0916d432e..ab6b43d19e 100644 --- a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample6.yaml +++ b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample6.yaml @@ -1,7 +1,46 @@ summary: Normalizer method_request: GET /analyze_sample/_analyze -description: Run `GET /analyze_sample/_analyze` and supply a normalizer for a keyword field if there is a normalizer associated with the specified index. +description: + Run `GET /analyze_sample/_analyze` and supply a normalizer for a keyword field if there is a normalizer associated with + the specified index. # type: request value: normalizer: my_normalizer text: BaR +alternatives: + - language: Python + code: |- + resp = client.indices.analyze( + index="analyze_sample", + normalizer="my_normalizer", + text="BaR", + ) + - language: JavaScript + code: |- + const response = await client.indices.analyze({ + index: "analyze_sample", + normalizer: "my_normalizer", + text: "BaR", + }); + - language: Ruby + code: |- + response = client.indices.analyze( + index: "analyze_sample", + body: { + "normalizer": "my_normalizer", + "text": "BaR" + } + ) + - language: PHP + code: |- + $resp = $client->indices()->analyze([ + "index" => "analyze_sample", + "body" => [ + "normalizer" => "my_normalizer", + "text" => "BaR", + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"normalizer":"my_normalizer","text":"BaR"}'' "$ELASTICSEARCH_URL/analyze_sample/_analyze"' diff --git a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample7.yaml b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample7.yaml index a026686374..9fbb43aca9 100644 --- a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample7.yaml +++ b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample7.yaml @@ -1,7 +1,9 @@ summary: Explain analysis method_request: GET /_analyze description: > - If you want to get more advanced details, set `explain` to `true`. It will output all token attributes for each token. You can filter token attributes you want to output by setting the `attributes` option. NOTE: The format of the additional detail information is labelled as experimental in Lucene and it may change in the future. + If you want to get more advanced details, set `explain` to `true`. It will output all token attributes for each token. You can + filter token attributes you want to output by setting the `attributes` option. NOTE: The format of the additional detail + information is labelled as experimental in Lucene and it may change in the future. # type: request value: tokenizer: standard @@ -11,3 +13,61 @@ value: explain: true attributes: - keyword +alternatives: + - language: Python + code: |- + resp = client.indices.analyze( + tokenizer="standard", + filter=[ + "snowball" + ], + text="detailed output", + explain=True, + attributes=[ + "keyword" + ], + ) + - language: JavaScript + code: |- + const response = await client.indices.analyze({ + tokenizer: "standard", + filter: ["snowball"], + text: "detailed output", + explain: true, + attributes: ["keyword"], + }); + - language: Ruby + code: |- + response = client.indices.analyze( + body: { + "tokenizer": "standard", + "filter": [ + "snowball" + ], + "text": "detailed output", + "explain": true, + "attributes": [ + "keyword" + ] + } + ) + - language: PHP + code: |- + $resp = $client->indices()->analyze([ + "body" => [ + "tokenizer" => "standard", + "filter" => array( + "snowball", + ), + "text" => "detailed output", + "explain" => true, + "attributes" => array( + "keyword", + ), + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"tokenizer":"standard","filter":["snowball"],"text":"detailed + output","explain":true,"attributes":["keyword"]}'' "$ELASTICSEARCH_URL/_analyze"' diff --git a/specification/indices/cancel_migrate_reindex/examples/request/IndicesCancelMigrateReindexExample1.yaml b/specification/indices/cancel_migrate_reindex/examples/request/IndicesCancelMigrateReindexExample1.yaml index fa90c32d41..adf1934ca2 100644 --- a/specification/indices/cancel_migrate_reindex/examples/request/IndicesCancelMigrateReindexExample1.yaml +++ b/specification/indices/cancel_migrate_reindex/examples/request/IndicesCancelMigrateReindexExample1.yaml @@ -1 +1,31 @@ method_request: POST /_migration/reindex/my-data-stream/_cancel +alternatives: + - language: Python + code: |- + resp = client.perform_request( + "POST", + "/_migration/reindex/my-data-stream/_cancel", + ) + - language: JavaScript + code: |- + const response = await client.transport.request({ + method: "POST", + path: "/_migration/reindex/my-data-stream/_cancel", + }); + - language: Ruby + code: |- + response = client.perform_request( + "POST", + "/_migration/reindex/my-data-stream/_cancel", + {}, + ) + - language: PHP + code: |- + $requestFactory = Psr17FactoryDiscovery::findRequestFactory(); + $request = $requestFactory->createRequest( + "POST", + "/_migration/reindex/my-data-stream/_cancel", + ); + $resp = $client->sendRequest($request); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_migration/reindex/my-data-stream/_cancel"' diff --git a/specification/indices/clear_cache/examples/request/IndicesClearCacheExample1.yaml b/specification/indices/clear_cache/examples/request/IndicesClearCacheExample1.yaml index 6248e9eaea..12de120f11 100644 --- a/specification/indices/clear_cache/examples/request/IndicesClearCacheExample1.yaml +++ b/specification/indices/clear_cache/examples/request/IndicesClearCacheExample1.yaml @@ -1 +1,29 @@ method_request: POST /my-index-000001,my-index-000002/_cache/clear?request=true +alternatives: + - language: Python + code: |- + resp = client.indices.clear_cache( + index="my-index-000001,my-index-000002", + request=True, + ) + - language: JavaScript + code: |- + const response = await client.indices.clearCache({ + index: "my-index-000001,my-index-000002", + request: "true", + }); + - language: Ruby + code: |- + response = client.indices.clear_cache( + index: "my-index-000001,my-index-000002", + request: "true" + ) + - language: PHP + code: |- + $resp = $client->indices()->clearCache([ + "index" => "my-index-000001,my-index-000002", + "request" => "true", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/my-index-000001,my-index-000002/_cache/clear?request=true"' diff --git a/specification/indices/clone/examples/request/indicesCloneRequestExample1.yaml b/specification/indices/clone/examples/request/indicesCloneRequestExample1.yaml index d8b4427019..4281c464bc 100644 --- a/specification/indices/clone/examples/request/indicesCloneRequestExample1.yaml +++ b/specification/indices/clone/examples/request/indicesCloneRequestExample1.yaml @@ -1,8 +1,79 @@ summary: Clone an existing index. method_request: POST /my_source_index/_clone/my_target_index description: > - Clone `my_source_index` into a new index called `my_target_index` with `POST /my_source_index/_clone/my_target_index`. The API accepts `settings` and `aliases` parameters for the target index. + Clone `my_source_index` into a new index called `my_target_index` with `POST /my_source_index/_clone/my_target_index`. The API + accepts `settings` and `aliases` parameters for the target index. # type: request -value: - "{\n \"settings\": {\n \"index.number_of_shards\": 5\n },\n \"aliases\"\ - : {\n \"my_search_indices\": {}\n }\n}" +value: "{ + + \ \"settings\": { + + \ \"index.number_of_shards\": 5 + + \ }, + + \ \"aliases\": { + + \ \"my_search_indices\": {} + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.indices.clone( + index="my_source_index", + target="my_target_index", + settings={ + "index.number_of_shards": 5 + }, + aliases={ + "my_search_indices": {} + }, + ) + - language: JavaScript + code: |- + const response = await client.indices.clone({ + index: "my_source_index", + target: "my_target_index", + settings: { + "index.number_of_shards": 5, + }, + aliases: { + my_search_indices: {}, + }, + }); + - language: Ruby + code: |- + response = client.indices.clone( + index: "my_source_index", + target: "my_target_index", + body: { + "settings": { + "index.number_of_shards": 5 + }, + "aliases": { + "my_search_indices": {} + } + } + ) + - language: PHP + code: |- + $resp = $client->indices()->clone([ + "index" => "my_source_index", + "target" => "my_target_index", + "body" => [ + "settings" => [ + "index.number_of_shards" => 5, + ], + "aliases" => [ + "my_search_indices" => new ArrayObject([]), + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"settings":{"index.number_of_shards":5},"aliases":{"my_search_indices":{}}}'' + "$ELASTICSEARCH_URL/my_source_index/_clone/my_target_index"' diff --git a/specification/indices/close/examples/request/CloseIndexRequestExample1.yaml b/specification/indices/close/examples/request/CloseIndexRequestExample1.yaml index aad5f50445..7f59d1dcb4 100644 --- a/specification/indices/close/examples/request/CloseIndexRequestExample1.yaml +++ b/specification/indices/close/examples/request/CloseIndexRequestExample1.yaml @@ -1 +1,24 @@ method_request: POST /my-index-00001/_close +alternatives: + - language: Python + code: |- + resp = client.indices.close( + index="my-index-00001", + ) + - language: JavaScript + code: |- + const response = await client.indices.close({ + index: "my-index-00001", + }); + - language: Ruby + code: |- + response = client.indices.close( + index: "my-index-00001" + ) + - language: PHP + code: |- + $resp = $client->indices()->close([ + "index" => "my-index-00001", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index-00001/_close"' diff --git a/specification/indices/create/examples/request/indicesCreateRequestExample1.yaml b/specification/indices/create/examples/request/indicesCreateRequestExample1.yaml index d795cf3c44..f86012fc85 100644 --- a/specification/indices/create/examples/request/indicesCreateRequestExample1.yaml +++ b/specification/indices/create/examples/request/indicesCreateRequestExample1.yaml @@ -2,6 +2,59 @@ summary: Create an index. method_request: PUT /my-index-000001 description: This request specifies the `number_of_shards` and `number_of_replicas`. # type: request -value: - "{\n \"settings\": {\n \"number_of_shards\": 3,\n \"number_of_replicas\"\ - : 2\n }\n}" +value: "{ + + \ \"settings\": { + + \ \"number_of_shards\": 3, + + \ \"number_of_replicas\": 2 + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.indices.create( + index="my-index-000001", + settings={ + "number_of_shards": 3, + "number_of_replicas": 2 + }, + ) + - language: JavaScript + code: |- + const response = await client.indices.create({ + index: "my-index-000001", + settings: { + number_of_shards: 3, + number_of_replicas: 2, + }, + }); + - language: Ruby + code: |- + response = client.indices.create( + index: "my-index-000001", + body: { + "settings": { + "number_of_shards": 3, + "number_of_replicas": 2 + } + } + ) + - language: PHP + code: |- + $resp = $client->indices()->create([ + "index" => "my-index-000001", + "body" => [ + "settings" => [ + "number_of_shards" => 3, + "number_of_replicas" => 2, + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"settings":{"number_of_shards":3,"number_of_replicas":2}}'' "$ELASTICSEARCH_URL/my-index-000001"' diff --git a/specification/indices/create/examples/request/indicesCreateRequestExample2.yaml b/specification/indices/create/examples/request/indicesCreateRequestExample2.yaml index 170549138a..38cdf60024 100644 --- a/specification/indices/create/examples/request/indicesCreateRequestExample2.yaml +++ b/specification/indices/create/examples/request/indicesCreateRequestExample2.yaml @@ -2,6 +2,92 @@ summary: Create an index with mappings. method_request: PUT /test description: You can provide mapping definitions in the create index API requests. # type: request -value: - "{\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"mappings\": {\n\ - \ \"properties\": {\n \"field1\": { \"type\": \"text\" }\n }\n }\n}" +value: "{ + + \ \"settings\": { + + \ \"number_of_shards\": 1 + + \ }, + + \ \"mappings\": { + + \ \"properties\": { + + \ \"field1\": { \"type\": \"text\" } + + \ } + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.indices.create( + index="test", + settings={ + "number_of_shards": 1 + }, + mappings={ + "properties": { + "field1": { + "type": "text" + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.indices.create({ + index: "test", + settings: { + number_of_shards: 1, + }, + mappings: { + properties: { + field1: { + type: "text", + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.indices.create( + index: "test", + body: { + "settings": { + "number_of_shards": 1 + }, + "mappings": { + "properties": { + "field1": { + "type": "text" + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->indices()->create([ + "index" => "test", + "body" => [ + "settings" => [ + "number_of_shards" => 1, + ], + "mappings" => [ + "properties" => [ + "field1" => [ + "type" => "text", + ], + ], + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"settings":{"number_of_shards":1},"mappings":{"properties":{"field1":{"type":"text"}}}}'' + "$ELASTICSEARCH_URL/test"' diff --git a/specification/indices/create/examples/request/indicesCreateRequestExample3.yaml b/specification/indices/create/examples/request/indicesCreateRequestExample3.yaml index 0031b478ab..ed98b5c0ea 100644 --- a/specification/indices/create/examples/request/indicesCreateRequestExample3.yaml +++ b/specification/indices/create/examples/request/indicesCreateRequestExample3.yaml @@ -1,8 +1,7 @@ summary: Create an index with aliases. method_request: PUT /test description: > - You can provide mapping definitions in the create index API requests. - Index alias names also support date math. + You can provide mapping definitions in the create index API requests. Index alias names also support date math. # type: request value: aliases: @@ -12,3 +11,77 @@ value: term: 'user.id': 'kimchy' routing: shard-1 +alternatives: + - language: Python + code: |- + resp = client.indices.create( + index="test", + aliases={ + "alias_1": {}, + "alias_2": { + "filter": { + "term": { + "user.id": "kimchy" + } + }, + "routing": "shard-1" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.indices.create({ + index: "test", + aliases: { + alias_1: {}, + alias_2: { + filter: { + term: { + "user.id": "kimchy", + }, + }, + routing: "shard-1", + }, + }, + }); + - language: Ruby + code: |- + response = client.indices.create( + index: "test", + body: { + "aliases": { + "alias_1": {}, + "alias_2": { + "filter": { + "term": { + "user.id": "kimchy" + } + }, + "routing": "shard-1" + } + } + } + ) + - language: PHP + code: |- + $resp = $client->indices()->create([ + "index" => "test", + "body" => [ + "aliases" => [ + "alias_1" => new ArrayObject([]), + "alias_2" => [ + "filter" => [ + "term" => [ + "user.id" => "kimchy", + ], + ], + "routing" => "shard-1", + ], + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"aliases":{"alias_1":{},"alias_2":{"filter":{"term":{"user.id":"kimchy"}},"routing":"shard-1"}}}'' + "$ELASTICSEARCH_URL/test"' diff --git a/specification/indices/create_data_stream/examples/request/IndicesCreateDataStreamExample1.yaml b/specification/indices/create_data_stream/examples/request/IndicesCreateDataStreamExample1.yaml index 581ceabf98..381f6c9204 100644 --- a/specification/indices/create_data_stream/examples/request/IndicesCreateDataStreamExample1.yaml +++ b/specification/indices/create_data_stream/examples/request/IndicesCreateDataStreamExample1.yaml @@ -1 +1,24 @@ method_request: PUT _data_stream/logs-foo-bar +alternatives: + - language: Python + code: |- + resp = client.indices.create_data_stream( + name="logs-foo-bar", + ) + - language: JavaScript + code: |- + const response = await client.indices.createDataStream({ + name: "logs-foo-bar", + }); + - language: Ruby + code: |- + response = client.indices.create_data_stream( + name: "logs-foo-bar" + ) + - language: PHP + code: |- + $resp = $client->indices()->createDataStream([ + "name" => "logs-foo-bar", + ]); + - language: curl + code: 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_data_stream/logs-foo-bar"' diff --git a/specification/indices/create_from/examples/request/IndicesCreateFromExample1.yaml b/specification/indices/create_from/examples/request/IndicesCreateFromExample1.yaml index b8785032b0..88f0ce964d 100644 --- a/specification/indices/create_from/examples/request/IndicesCreateFromExample1.yaml +++ b/specification/indices/create_from/examples/request/IndicesCreateFromExample1.yaml @@ -1 +1,31 @@ method_request: POST _create_from/my-index/my-new-index +alternatives: + - language: Python + code: |- + resp = client.perform_request( + "POST", + "/_create_from/my-index/my-new-index", + ) + - language: JavaScript + code: |- + const response = await client.transport.request({ + method: "POST", + path: "/_create_from/my-index/my-new-index", + }); + - language: Ruby + code: |- + response = client.perform_request( + "POST", + "/_create_from/my-index/my-new-index", + {}, + ) + - language: PHP + code: |- + $requestFactory = Psr17FactoryDiscovery::findRequestFactory(); + $request = $requestFactory->createRequest( + "POST", + "/_create_from/my-index/my-new-index", + ); + $resp = $client->sendRequest($request); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_create_from/my-index/my-new-index"' diff --git a/specification/indices/data_streams_stats/examples/request/indicesDataStreamStatsExampleRequest1.yaml b/specification/indices/data_streams_stats/examples/request/indicesDataStreamStatsExampleRequest1.yaml index 70600dc850..afe624c950 100644 --- a/specification/indices/data_streams_stats/examples/request/indicesDataStreamStatsExampleRequest1.yaml +++ b/specification/indices/data_streams_stats/examples/request/indicesDataStreamStatsExampleRequest1.yaml @@ -1 +1,24 @@ method_request: GET /_data_stream/my-index-000001/_stats +alternatives: + - language: Python + code: |- + resp = client.indices.data_streams_stats( + name="my-index-000001", + ) + - language: JavaScript + code: |- + const response = await client.indices.dataStreamsStats({ + name: "my-index-000001", + }); + - language: Ruby + code: |- + response = client.indices.data_streams_stats( + name: "my-index-000001" + ) + - language: PHP + code: |- + $resp = $client->indices()->dataStreamsStats([ + "name" => "my-index-000001", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_data_stream/my-index-000001/_stats"' diff --git a/specification/indices/delete/examples/request/IndicesDeleteExample1.yaml b/specification/indices/delete/examples/request/IndicesDeleteExample1.yaml index 10949f3df6..dbd2f4209f 100644 --- a/specification/indices/delete/examples/request/IndicesDeleteExample1.yaml +++ b/specification/indices/delete/examples/request/IndicesDeleteExample1.yaml @@ -1 +1,24 @@ method_request: DELETE /books +alternatives: + - language: Python + code: |- + resp = client.indices.delete( + index="books", + ) + - language: JavaScript + code: |- + const response = await client.indices.delete({ + index: "books", + }); + - language: Ruby + code: |- + response = client.indices.delete( + index: "books" + ) + - language: PHP + code: |- + $resp = $client->indices()->delete([ + "index" => "books", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/books"' diff --git a/specification/indices/delete_alias/examples/request/IndicesDeleteAliasExample1.yaml b/specification/indices/delete_alias/examples/request/IndicesDeleteAliasExample1.yaml index 09bcefe59f..715ab402c6 100644 --- a/specification/indices/delete_alias/examples/request/IndicesDeleteAliasExample1.yaml +++ b/specification/indices/delete_alias/examples/request/IndicesDeleteAliasExample1.yaml @@ -1 +1,28 @@ method_request: DELETE my-data-stream/_alias/my-alias +alternatives: + - language: Python + code: |- + resp = client.indices.delete_alias( + index="my-data-stream", + name="my-alias", + ) + - language: JavaScript + code: |- + const response = await client.indices.deleteAlias({ + index: "my-data-stream", + name: "my-alias", + }); + - language: Ruby + code: |- + response = client.indices.delete_alias( + index: "my-data-stream", + name: "my-alias" + ) + - language: PHP + code: |- + $resp = $client->indices()->deleteAlias([ + "index" => "my-data-stream", + "name" => "my-alias", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-data-stream/_alias/my-alias"' diff --git a/specification/indices/delete_data_lifecycle/examples/request/IndicesDeleteDataLifecycleExample1.yaml b/specification/indices/delete_data_lifecycle/examples/request/IndicesDeleteDataLifecycleExample1.yaml index 8674ec5b56..541c77fd45 100644 --- a/specification/indices/delete_data_lifecycle/examples/request/IndicesDeleteDataLifecycleExample1.yaml +++ b/specification/indices/delete_data_lifecycle/examples/request/IndicesDeleteDataLifecycleExample1.yaml @@ -1 +1,24 @@ method_request: DELETE _data_stream/my-data-stream/_lifecycle +alternatives: + - language: Python + code: |- + resp = client.indices.delete_data_lifecycle( + name="my-data-stream", + ) + - language: JavaScript + code: |- + const response = await client.indices.deleteDataLifecycle({ + name: "my-data-stream", + }); + - language: Ruby + code: |- + response = client.indices.delete_data_lifecycle( + name: "my-data-stream" + ) + - language: PHP + code: |- + $resp = $client->indices()->deleteDataLifecycle([ + "name" => "my-data-stream", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_data_stream/my-data-stream/_lifecycle"' diff --git a/specification/indices/delete_data_stream/examples/request/IndicesDeleteDataStreamExample1.yaml b/specification/indices/delete_data_stream/examples/request/IndicesDeleteDataStreamExample1.yaml index 67ee24ecc2..5244a60926 100644 --- a/specification/indices/delete_data_stream/examples/request/IndicesDeleteDataStreamExample1.yaml +++ b/specification/indices/delete_data_stream/examples/request/IndicesDeleteDataStreamExample1.yaml @@ -1 +1,24 @@ method_request: DELETE _data_stream/my-data-stream +alternatives: + - language: Python + code: |- + resp = client.indices.delete_data_stream( + name="my-data-stream", + ) + - language: JavaScript + code: |- + const response = await client.indices.deleteDataStream({ + name: "my-data-stream", + }); + - language: Ruby + code: |- + response = client.indices.delete_data_stream( + name: "my-data-stream" + ) + - language: PHP + code: |- + $resp = $client->indices()->deleteDataStream([ + "name" => "my-data-stream", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_data_stream/my-data-stream"' diff --git a/specification/indices/delete_index_template/examples/request/IndicesDeleteIndexTemplateExample1.yaml b/specification/indices/delete_index_template/examples/request/IndicesDeleteIndexTemplateExample1.yaml index 06c8075f21..8d1801cfc3 100644 --- a/specification/indices/delete_index_template/examples/request/IndicesDeleteIndexTemplateExample1.yaml +++ b/specification/indices/delete_index_template/examples/request/IndicesDeleteIndexTemplateExample1.yaml @@ -1 +1,24 @@ method_request: DELETE /_index_template/my-index-template +alternatives: + - language: Python + code: |- + resp = client.indices.delete_index_template( + name="my-index-template", + ) + - language: JavaScript + code: |- + const response = await client.indices.deleteIndexTemplate({ + name: "my-index-template", + }); + - language: Ruby + code: |- + response = client.indices.delete_index_template( + name: "my-index-template" + ) + - language: PHP + code: |- + $resp = $client->indices()->deleteIndexTemplate([ + "name" => "my-index-template", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_index_template/my-index-template"' diff --git a/specification/indices/delete_template/examples/request/IndicesDeleteTemplateExample1.yaml b/specification/indices/delete_template/examples/request/IndicesDeleteTemplateExample1.yaml index 70d02b2038..774ae1a650 100644 --- a/specification/indices/delete_template/examples/request/IndicesDeleteTemplateExample1.yaml +++ b/specification/indices/delete_template/examples/request/IndicesDeleteTemplateExample1.yaml @@ -1 +1,24 @@ method_request: DELETE _template/.cloud-hot-warm-allocation-0 +alternatives: + - language: Python + code: |- + resp = client.indices.delete_template( + name=".cloud-hot-warm-allocation-0", + ) + - language: JavaScript + code: |- + const response = await client.indices.deleteTemplate({ + name: ".cloud-hot-warm-allocation-0", + }); + - language: Ruby + code: |- + response = client.indices.delete_template( + name: ".cloud-hot-warm-allocation-0" + ) + - language: PHP + code: |- + $resp = $client->indices()->deleteTemplate([ + "name" => ".cloud-hot-warm-allocation-0", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_template/.cloud-hot-warm-allocation-0"' diff --git a/specification/indices/disk_usage/examples/request/IndicesDiskUsageExample1.yaml b/specification/indices/disk_usage/examples/request/IndicesDiskUsageExample1.yaml index acfe6b7fc1..4eb8dcd3ae 100644 --- a/specification/indices/disk_usage/examples/request/IndicesDiskUsageExample1.yaml +++ b/specification/indices/disk_usage/examples/request/IndicesDiskUsageExample1.yaml @@ -1 +1,29 @@ method_request: POST /my-index-000001/_disk_usage?run_expensive_tasks=true +alternatives: + - language: Python + code: |- + resp = client.indices.disk_usage( + index="my-index-000001", + run_expensive_tasks=True, + ) + - language: JavaScript + code: |- + const response = await client.indices.diskUsage({ + index: "my-index-000001", + run_expensive_tasks: "true", + }); + - language: Ruby + code: |- + response = client.indices.disk_usage( + index: "my-index-000001", + run_expensive_tasks: "true" + ) + - language: PHP + code: |- + $resp = $client->indices()->diskUsage([ + "index" => "my-index-000001", + "run_expensive_tasks" => "true", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/my-index-000001/_disk_usage?run_expensive_tasks=true"' diff --git a/specification/indices/downsample/examples/request/DownsampleRequestExample1.yaml b/specification/indices/downsample/examples/request/DownsampleRequestExample1.yaml index dd2031ab8d..b5731c40fe 100644 --- a/specification/indices/downsample/examples/request/DownsampleRequestExample1.yaml +++ b/specification/indices/downsample/examples/request/DownsampleRequestExample1.yaml @@ -4,3 +4,44 @@ method_request: POST /my-time-series-index/_downsample/my-downsampled-time-serie # type: request value: fixed_interval: 1d +alternatives: + - language: Python + code: |- + resp = client.indices.downsample( + index="my-time-series-index", + target_index="my-downsampled-time-series-index", + config={ + "fixed_interval": "1d" + }, + ) + - language: JavaScript + code: |- + const response = await client.indices.downsample({ + index: "my-time-series-index", + target_index: "my-downsampled-time-series-index", + config: { + fixed_interval: "1d", + }, + }); + - language: Ruby + code: |- + response = client.indices.downsample( + index: "my-time-series-index", + target_index: "my-downsampled-time-series-index", + body: { + "fixed_interval": "1d" + } + ) + - language: PHP + code: |- + $resp = $client->indices()->downsample([ + "index" => "my-time-series-index", + "target_index" => "my-downsampled-time-series-index", + "body" => [ + "fixed_interval" => "1d", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"fixed_interval":"1d"}'' "$ELASTICSEARCH_URL/my-time-series-index/_downsample/my-downsampled-time-series-index"' diff --git a/specification/indices/exists/examples/request/IndicesExistsExample1.yaml b/specification/indices/exists/examples/request/IndicesExistsExample1.yaml index 9e86eecb0d..9c3c4c6d6b 100644 --- a/specification/indices/exists/examples/request/IndicesExistsExample1.yaml +++ b/specification/indices/exists/examples/request/IndicesExistsExample1.yaml @@ -1 +1,24 @@ method_request: HEAD my-data-stream +alternatives: + - language: Python + code: |- + resp = client.indices.exists( + index="my-data-stream", + ) + - language: JavaScript + code: |- + const response = await client.indices.exists({ + index: "my-data-stream", + }); + - language: Ruby + code: |- + response = client.indices.exists( + index: "my-data-stream" + ) + - language: PHP + code: |- + $resp = $client->indices()->exists([ + "index" => "my-data-stream", + ]); + - language: curl + code: 'curl --head -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-data-stream"' diff --git a/specification/indices/exists_alias/examples/request/IndicesExistsAliasExample1.yaml b/specification/indices/exists_alias/examples/request/IndicesExistsAliasExample1.yaml index f12774b2bc..55c2255191 100644 --- a/specification/indices/exists_alias/examples/request/IndicesExistsAliasExample1.yaml +++ b/specification/indices/exists_alias/examples/request/IndicesExistsAliasExample1.yaml @@ -1 +1,24 @@ method_request: HEAD _alias/my-alias +alternatives: + - language: Python + code: |- + resp = client.indices.exists_alias( + name="my-alias", + ) + - language: JavaScript + code: |- + const response = await client.indices.existsAlias({ + name: "my-alias", + }); + - language: Ruby + code: |- + response = client.indices.exists_alias( + name: "my-alias" + ) + - language: PHP + code: |- + $resp = $client->indices()->existsAlias([ + "name" => "my-alias", + ]); + - language: curl + code: 'curl --head -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_alias/my-alias"' diff --git a/specification/indices/exists_template/examples/request/IndicesExistsTemplateExample1.yaml b/specification/indices/exists_template/examples/request/IndicesExistsTemplateExample1.yaml index 43c13cd1f2..c732d65f0c 100644 --- a/specification/indices/exists_template/examples/request/IndicesExistsTemplateExample1.yaml +++ b/specification/indices/exists_template/examples/request/IndicesExistsTemplateExample1.yaml @@ -1 +1,24 @@ method_request: HEAD /_template/template_1 +alternatives: + - language: Python + code: |- + resp = client.indices.exists_template( + name="template_1", + ) + - language: JavaScript + code: |- + const response = await client.indices.existsTemplate({ + name: "template_1", + }); + - language: Ruby + code: |- + response = client.indices.exists_template( + name: "template_1" + ) + - language: PHP + code: |- + $resp = $client->indices()->existsTemplate([ + "name" => "template_1", + ]); + - language: curl + code: 'curl --head -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_template/template_1"' diff --git a/specification/indices/explain_data_lifecycle/examples/request/IndicesExplainDataLifecycleRequestExample1.yaml b/specification/indices/explain_data_lifecycle/examples/request/IndicesExplainDataLifecycleRequestExample1.yaml index 06607d1df9..62595ee606 100644 --- a/specification/indices/explain_data_lifecycle/examples/request/IndicesExplainDataLifecycleRequestExample1.yaml +++ b/specification/indices/explain_data_lifecycle/examples/request/IndicesExplainDataLifecycleRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET .ds-metrics-2023.03.22-000001/_lifecycle/explain +alternatives: + - language: Python + code: |- + resp = client.indices.explain_data_lifecycle( + index=".ds-metrics-2023.03.22-000001", + ) + - language: JavaScript + code: |- + const response = await client.indices.explainDataLifecycle({ + index: ".ds-metrics-2023.03.22-000001", + }); + - language: Ruby + code: |- + response = client.indices.explain_data_lifecycle( + index: ".ds-metrics-2023.03.22-000001" + ) + - language: PHP + code: |- + $resp = $client->indices()->explainDataLifecycle([ + "index" => ".ds-metrics-2023.03.22-000001", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/.ds-metrics-2023.03.22-000001/_lifecycle/explain"' diff --git a/specification/indices/field_usage_stats/examples/request/indicesFieldUsageStatsRequestExample1.yaml b/specification/indices/field_usage_stats/examples/request/indicesFieldUsageStatsRequestExample1.yaml index d12dd51252..cb139183ec 100644 --- a/specification/indices/field_usage_stats/examples/request/indicesFieldUsageStatsRequestExample1.yaml +++ b/specification/indices/field_usage_stats/examples/request/indicesFieldUsageStatsRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET /my-index-000001/_field_usage_stats +alternatives: + - language: Python + code: |- + resp = client.indices.field_usage_stats( + index="my-index-000001", + ) + - language: JavaScript + code: |- + const response = await client.indices.fieldUsageStats({ + index: "my-index-000001", + }); + - language: Ruby + code: |- + response = client.indices.field_usage_stats( + index: "my-index-000001" + ) + - language: PHP + code: |- + $resp = $client->indices()->fieldUsageStats([ + "index" => "my-index-000001", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index-000001/_field_usage_stats"' diff --git a/specification/indices/flush/examples/request/IndicesFlushExample1.yaml b/specification/indices/flush/examples/request/IndicesFlushExample1.yaml index b468f6de6a..3cbf78227f 100644 --- a/specification/indices/flush/examples/request/IndicesFlushExample1.yaml +++ b/specification/indices/flush/examples/request/IndicesFlushExample1.yaml @@ -1 +1,12 @@ method_request: POST /_flush +alternatives: + - language: Python + code: resp = client.indices.flush() + - language: JavaScript + code: const response = await client.indices.flush(); + - language: Ruby + code: response = client.indices.flush + - language: PHP + code: $resp = $client->indices()->flush(); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_flush"' diff --git a/specification/indices/forcemerge/examples/request/IndicesForcemergeExample1.yaml b/specification/indices/forcemerge/examples/request/IndicesForcemergeExample1.yaml index e98db0f9f9..f02c9c6773 100644 --- a/specification/indices/forcemerge/examples/request/IndicesForcemergeExample1.yaml +++ b/specification/indices/forcemerge/examples/request/IndicesForcemergeExample1.yaml @@ -1 +1,24 @@ method_request: POST my-index-000001/_forcemerge +alternatives: + - language: Python + code: |- + resp = client.indices.forcemerge( + index="my-index-000001", + ) + - language: JavaScript + code: |- + const response = await client.indices.forcemerge({ + index: "my-index-000001", + }); + - language: Ruby + code: |- + response = client.indices.forcemerge( + index: "my-index-000001" + ) + - language: PHP + code: |- + $resp = $client->indices()->forcemerge([ + "index" => "my-index-000001", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index-000001/_forcemerge"' diff --git a/specification/indices/get/examples/request/IndicesGetExample1.yaml b/specification/indices/get/examples/request/IndicesGetExample1.yaml index c39e42ebae..820e8fe128 100644 --- a/specification/indices/get/examples/request/IndicesGetExample1.yaml +++ b/specification/indices/get/examples/request/IndicesGetExample1.yaml @@ -1 +1,24 @@ method_request: GET /my-index-000001 +alternatives: + - language: Python + code: |- + resp = client.indices.get( + index="my-index-000001", + ) + - language: JavaScript + code: |- + const response = await client.indices.get({ + index: "my-index-000001", + }); + - language: Ruby + code: |- + response = client.indices.get( + index: "my-index-000001" + ) + - language: PHP + code: |- + $resp = $client->indices()->get([ + "index" => "my-index-000001", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index-000001"' diff --git a/specification/indices/get_alias/examples/request/IndicesGetAliasExample1.yaml b/specification/indices/get_alias/examples/request/IndicesGetAliasExample1.yaml index b66ab2688d..aefb2d2847 100644 --- a/specification/indices/get_alias/examples/request/IndicesGetAliasExample1.yaml +++ b/specification/indices/get_alias/examples/request/IndicesGetAliasExample1.yaml @@ -1 +1,12 @@ method_request: GET _alias +alternatives: + - language: Python + code: resp = client.indices.get_alias() + - language: JavaScript + code: const response = await client.indices.getAlias(); + - language: Ruby + code: response = client.indices.get_alias + - language: PHP + code: $resp = $client->indices()->getAlias(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_alias"' diff --git a/specification/indices/get_data_lifecycle/examples/request/IndicesGetDataLifecycleRequestExample1.yaml b/specification/indices/get_data_lifecycle/examples/request/IndicesGetDataLifecycleRequestExample1.yaml index 042401e844..a98c1dda9d 100644 --- a/specification/indices/get_data_lifecycle/examples/request/IndicesGetDataLifecycleRequestExample1.yaml +++ b/specification/indices/get_data_lifecycle/examples/request/IndicesGetDataLifecycleRequestExample1.yaml @@ -1 +1,32 @@ method_request: GET /_data_stream/{name}/_lifecycle?human&pretty +alternatives: + - language: Python + code: |- + resp = client.indices.get_data_lifecycle( + name="{name}", + human=True, + pretty=True, + ) + - language: JavaScript + code: |- + const response = await client.indices.getDataLifecycle({ + name: "{name}", + human: "true", + pretty: "true", + }); + - language: Ruby + code: |- + response = client.indices.get_data_lifecycle( + name: "{name}", + human: "true", + pretty: "true" + ) + - language: PHP + code: |- + $resp = $client->indices()->getDataLifecycle([ + "name" => "{name}", + "human" => "true", + "pretty" => "true", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_data_stream/%7Bname%7D/_lifecycle?human&pretty"' diff --git a/specification/indices/get_data_lifecycle_stats/examples/request/IndicesGetDataLifecycleStatsRequestExample1.yaml b/specification/indices/get_data_lifecycle_stats/examples/request/IndicesGetDataLifecycleStatsRequestExample1.yaml index b88c7221f5..07d4ee3860 100644 --- a/specification/indices/get_data_lifecycle_stats/examples/request/IndicesGetDataLifecycleStatsRequestExample1.yaml +++ b/specification/indices/get_data_lifecycle_stats/examples/request/IndicesGetDataLifecycleStatsRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET _lifecycle/stats?human&pretty +alternatives: + - language: Python + code: |- + resp = client.indices.get_data_lifecycle_stats( + human=True, + pretty=True, + ) + - language: JavaScript + code: |- + const response = await client.indices.getDataLifecycleStats({ + human: "true", + pretty: "true", + }); + - language: Ruby + code: |- + response = client.indices.get_data_lifecycle_stats( + human: "true", + pretty: "true" + ) + - language: PHP + code: |- + $resp = $client->indices()->getDataLifecycleStats([ + "human" => "true", + "pretty" => "true", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_lifecycle/stats?human&pretty"' diff --git a/specification/indices/get_data_stream/examples/request/IndicesGetDataStreamExample1.yaml b/specification/indices/get_data_stream/examples/request/IndicesGetDataStreamExample1.yaml index 495dc0a360..9696c5af3d 100644 --- a/specification/indices/get_data_stream/examples/request/IndicesGetDataStreamExample1.yaml +++ b/specification/indices/get_data_stream/examples/request/IndicesGetDataStreamExample1.yaml @@ -1 +1,24 @@ method_request: GET _data_stream/my-data-stream +alternatives: + - language: Python + code: |- + resp = client.indices.get_data_stream( + name="my-data-stream", + ) + - language: JavaScript + code: |- + const response = await client.indices.getDataStream({ + name: "my-data-stream", + }); + - language: Ruby + code: |- + response = client.indices.get_data_stream( + name: "my-data-stream" + ) + - language: PHP + code: |- + $resp = $client->indices()->getDataStream([ + "name" => "my-data-stream", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_data_stream/my-data-stream"' diff --git a/specification/indices/get_field_mapping/examples/request/indicesGetFieldMappingRequestExample1.yaml b/specification/indices/get_field_mapping/examples/request/indicesGetFieldMappingRequestExample1.yaml index 0b53a8f71e..179c887e6c 100644 --- a/specification/indices/get_field_mapping/examples/request/indicesGetFieldMappingRequestExample1.yaml +++ b/specification/indices/get_field_mapping/examples/request/indicesGetFieldMappingRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET publications/_mapping/field/title +alternatives: + - language: Python + code: |- + resp = client.indices.get_field_mapping( + index="publications", + fields="title", + ) + - language: JavaScript + code: |- + const response = await client.indices.getFieldMapping({ + index: "publications", + fields: "title", + }); + - language: Ruby + code: |- + response = client.indices.get_field_mapping( + index: "publications", + fields: "title" + ) + - language: PHP + code: |- + $resp = $client->indices()->getFieldMapping([ + "index" => "publications", + "fields" => "title", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/publications/_mapping/field/title"' diff --git a/specification/indices/get_index_template/examples/request/IndicesGetIndexTemplateExample1.yaml b/specification/indices/get_index_template/examples/request/IndicesGetIndexTemplateExample1.yaml index 14d0b3a1e7..ce06a3cf76 100644 --- a/specification/indices/get_index_template/examples/request/IndicesGetIndexTemplateExample1.yaml +++ b/specification/indices/get_index_template/examples/request/IndicesGetIndexTemplateExample1.yaml @@ -1 +1,31 @@ -method_request: GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream +method_request: GET + _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream +alternatives: + - language: Python + code: >- + resp = client.indices.get_index_template( + name="*", + filter_path="index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream", + ) + - language: JavaScript + code: |- + const response = await client.indices.getIndexTemplate({ + name: "*", + filter_path: + "index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream", + }); + - language: Ruby + code: |- + response = client.indices.get_index_template( + name: "*", + filter_path: "index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream" + ) + - language: PHP + code: >- + $resp = $client->indices()->getIndexTemplate([ + "name" => "*", + "filter_path" => "index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream"' diff --git a/specification/indices/get_mapping/examples/request/IndicesGetMappingExample1.yaml b/specification/indices/get_mapping/examples/request/IndicesGetMappingExample1.yaml index 11e3f68060..cc9fa61863 100644 --- a/specification/indices/get_mapping/examples/request/IndicesGetMappingExample1.yaml +++ b/specification/indices/get_mapping/examples/request/IndicesGetMappingExample1.yaml @@ -1 +1,24 @@ method_request: GET /books/_mapping +alternatives: + - language: Python + code: |- + resp = client.indices.get_mapping( + index="books", + ) + - language: JavaScript + code: |- + const response = await client.indices.getMapping({ + index: "books", + }); + - language: Ruby + code: |- + response = client.indices.get_mapping( + index: "books" + ) + - language: PHP + code: |- + $resp = $client->indices()->getMapping([ + "index" => "books", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/books/_mapping"' diff --git a/specification/indices/get_migrate_reindex_status/examples/request/IndicesGetMigrateReindexStatusExample1.yaml b/specification/indices/get_migrate_reindex_status/examples/request/IndicesGetMigrateReindexStatusExample1.yaml index 49dec01b92..cadf516fe8 100644 --- a/specification/indices/get_migrate_reindex_status/examples/request/IndicesGetMigrateReindexStatusExample1.yaml +++ b/specification/indices/get_migrate_reindex_status/examples/request/IndicesGetMigrateReindexStatusExample1.yaml @@ -1 +1,31 @@ method_request: GET /_migration/reindex/my-data-stream/_status +alternatives: + - language: Python + code: |- + resp = client.perform_request( + "GET", + "/_migration/reindex/my-data-stream/_status", + ) + - language: JavaScript + code: |- + const response = await client.transport.request({ + method: "GET", + path: "/_migration/reindex/my-data-stream/_status", + }); + - language: Ruby + code: |- + response = client.perform_request( + "GET", + "/_migration/reindex/my-data-stream/_status", + {}, + ) + - language: PHP + code: |- + $requestFactory = Psr17FactoryDiscovery::findRequestFactory(); + $request = $requestFactory->createRequest( + "GET", + "/_migration/reindex/my-data-stream/_status", + ); + $resp = $client->sendRequest($request); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_migration/reindex/my-data-stream/_status"' diff --git a/specification/indices/get_settings/examples/request/IndicesGetSettingsExample1.yaml b/specification/indices/get_settings/examples/request/IndicesGetSettingsExample1.yaml index 758c778a74..3dcc2c10fd 100644 --- a/specification/indices/get_settings/examples/request/IndicesGetSettingsExample1.yaml +++ b/specification/indices/get_settings/examples/request/IndicesGetSettingsExample1.yaml @@ -1 +1,33 @@ method_request: GET _all/_settings?expand_wildcards=all&filter_path=*.settings.index.*.slowlog +alternatives: + - language: Python + code: |- + resp = client.indices.get_settings( + index="_all", + expand_wildcards="all", + filter_path="*.settings.index.*.slowlog", + ) + - language: JavaScript + code: |- + const response = await client.indices.getSettings({ + index: "_all", + expand_wildcards: "all", + filter_path: "*.settings.index.*.slowlog", + }); + - language: Ruby + code: |- + response = client.indices.get_settings( + index: "_all", + expand_wildcards: "all", + filter_path: "*.settings.index.*.slowlog" + ) + - language: PHP + code: |- + $resp = $client->indices()->getSettings([ + "index" => "_all", + "expand_wildcards" => "all", + "filter_path" => "*.settings.index.*.slowlog", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_all/_settings?expand_wildcards=all&filter_path=*.settings.index.*.slowlog"' diff --git a/specification/indices/get_template/examples/request/IndicesGetTemplateExample1.yaml b/specification/indices/get_template/examples/request/IndicesGetTemplateExample1.yaml index 56ea37d583..b9c1920c34 100644 --- a/specification/indices/get_template/examples/request/IndicesGetTemplateExample1.yaml +++ b/specification/indices/get_template/examples/request/IndicesGetTemplateExample1.yaml @@ -1 +1,24 @@ method_request: GET /_template/.monitoring-* +alternatives: + - language: Python + code: |- + resp = client.indices.get_template( + name=".monitoring-*", + ) + - language: JavaScript + code: |- + const response = await client.indices.getTemplate({ + name: ".monitoring-*", + }); + - language: Ruby + code: |- + response = client.indices.get_template( + name: ".monitoring-*" + ) + - language: PHP + code: |- + $resp = $client->indices()->getTemplate([ + "name" => ".monitoring-*", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_template/.monitoring-*"' diff --git a/specification/indices/migrate_reindex/examples/request/IndicesMigrateReindexExample1.yaml b/specification/indices/migrate_reindex/examples/request/IndicesMigrateReindexExample1.yaml index 348eb287e2..3c1cc5b31f 100644 --- a/specification/indices/migrate_reindex/examples/request/IndicesMigrateReindexExample1.yaml +++ b/specification/indices/migrate_reindex/examples/request/IndicesMigrateReindexExample1.yaml @@ -7,3 +7,65 @@ value: |- }, "mode": "upgrade" } +alternatives: + - language: Python + code: |- + resp = client.perform_request( + "POST", + "/_migration/reindex", + headers={"Content-Type": "application/json"}, + body={ + "source": { + "index": "my-data-stream" + }, + "mode": "upgrade" + }, + ) + - language: JavaScript + code: |- + const response = await client.transport.request({ + method: "POST", + path: "/_migration/reindex", + body: { + source: { + index: "my-data-stream", + }, + mode: "upgrade", + }, + }); + - language: Ruby + code: |- + response = client.perform_request( + "POST", + "/_migration/reindex", + {}, + { + "source": { + "index": "my-data-stream" + }, + "mode": "upgrade" + }, + { "Content-Type": "application/json" }, + ) + - language: PHP + code: |- + $requestFactory = Psr17FactoryDiscovery::findRequestFactory(); + $streamFactory = Psr17FactoryDiscovery::findStreamFactory(); + $request = $requestFactory->createRequest( + "POST", + "/_migration/reindex", + ); + $request = $request->withHeader("Content-Type", "application/json"); + $request = $request->withBody($streamFactory->createStream( + json_encode([ + "source" => [ + "index" => "my-data-stream", + ], + "mode" => "upgrade", + ]), + )); + $resp = $client->sendRequest($request); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"source":{"index":"my-data-stream"},"mode":"upgrade"}'' "$ELASTICSEARCH_URL/_migration/reindex"' diff --git a/specification/indices/migrate_to_data_stream/examples/request/IndicesMigrateToDataStreamExample1.yaml b/specification/indices/migrate_to_data_stream/examples/request/IndicesMigrateToDataStreamExample1.yaml index 27260c12a3..4d4d4ac6b5 100644 --- a/specification/indices/migrate_to_data_stream/examples/request/IndicesMigrateToDataStreamExample1.yaml +++ b/specification/indices/migrate_to_data_stream/examples/request/IndicesMigrateToDataStreamExample1.yaml @@ -1 +1,24 @@ method_request: POST _data_stream/_migrate/my-time-series-data +alternatives: + - language: Python + code: |- + resp = client.indices.migrate_to_data_stream( + name="my-time-series-data", + ) + - language: JavaScript + code: |- + const response = await client.indices.migrateToDataStream({ + name: "my-time-series-data", + }); + - language: Ruby + code: |- + response = client.indices.migrate_to_data_stream( + name: "my-time-series-data" + ) + - language: PHP + code: |- + $resp = $client->indices()->migrateToDataStream([ + "name" => "my-time-series-data", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_data_stream/_migrate/my-time-series-data"' diff --git a/specification/indices/modify_data_stream/examples/request/IndicesModifyDataStreamExample1.yaml b/specification/indices/modify_data_stream/examples/request/IndicesModifyDataStreamExample1.yaml index d8778d8f14..2566738368 100644 --- a/specification/indices/modify_data_stream/examples/request/IndicesModifyDataStreamExample1.yaml +++ b/specification/indices/modify_data_stream/examples/request/IndicesModifyDataStreamExample1.yaml @@ -17,3 +17,86 @@ value: |- } ] } +alternatives: + - language: Python + code: |- + resp = client.indices.modify_data_stream( + actions=[ + { + "remove_backing_index": { + "data_stream": "my-data-stream", + "index": ".ds-my-data-stream-2023.07.26-000001" + } + }, + { + "add_backing_index": { + "data_stream": "my-data-stream", + "index": ".ds-my-data-stream-2023.07.26-000001-downsample" + } + } + ], + ) + - language: JavaScript + code: |- + const response = await client.indices.modifyDataStream({ + actions: [ + { + remove_backing_index: { + data_stream: "my-data-stream", + index: ".ds-my-data-stream-2023.07.26-000001", + }, + }, + { + add_backing_index: { + data_stream: "my-data-stream", + index: ".ds-my-data-stream-2023.07.26-000001-downsample", + }, + }, + ], + }); + - language: Ruby + code: |- + response = client.indices.modify_data_stream( + body: { + "actions": [ + { + "remove_backing_index": { + "data_stream": "my-data-stream", + "index": ".ds-my-data-stream-2023.07.26-000001" + } + }, + { + "add_backing_index": { + "data_stream": "my-data-stream", + "index": ".ds-my-data-stream-2023.07.26-000001-downsample" + } + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->indices()->modifyDataStream([ + "body" => [ + "actions" => array( + [ + "remove_backing_index" => [ + "data_stream" => "my-data-stream", + "index" => ".ds-my-data-stream-2023.07.26-000001", + ], + ], + [ + "add_backing_index" => [ + "data_stream" => "my-data-stream", + "index" => ".ds-my-data-stream-2023.07.26-000001-downsample", + ], + ], + ), + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"actions\":[{\"remove_backing_index\":{\"data_stream\":\"my-data-stream\",\"index\":\".ds-my-data-stream-2023.07.26-000001\ + \"}},{\"add_backing_index\":{\"data_stream\":\"my-data-stream\",\"index\":\".ds-my-data-stream-2023.07.26-000001-downsample\"\ + }}]}' \"$ELASTICSEARCH_URL/_data_stream/_modify\"" diff --git a/specification/indices/open/examples/request/IndicesOpenExample1.yaml b/specification/indices/open/examples/request/IndicesOpenExample1.yaml index d201e97a27..2f29a478b3 100644 --- a/specification/indices/open/examples/request/IndicesOpenExample1.yaml +++ b/specification/indices/open/examples/request/IndicesOpenExample1.yaml @@ -1 +1,24 @@ method_request: POST /.ds-my-data-stream-2099.03.07-000001/_open/ +alternatives: + - language: Python + code: |- + resp = client.indices.open( + index=".ds-my-data-stream-2099.03.07-000001", + ) + - language: JavaScript + code: |- + const response = await client.indices.open({ + index: ".ds-my-data-stream-2099.03.07-000001", + }); + - language: Ruby + code: |- + response = client.indices.open( + index: ".ds-my-data-stream-2099.03.07-000001" + ) + - language: PHP + code: |- + $resp = $client->indices()->open([ + "index" => ".ds-my-data-stream-2099.03.07-000001", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/.ds-my-data-stream-2099.03.07-000001/_open/"' diff --git a/specification/indices/promote_data_stream/examples/request/IndicesPromoteDataStreamExample1.yaml b/specification/indices/promote_data_stream/examples/request/IndicesPromoteDataStreamExample1.yaml index dc8d38ea6c..7bf69c90f5 100644 --- a/specification/indices/promote_data_stream/examples/request/IndicesPromoteDataStreamExample1.yaml +++ b/specification/indices/promote_data_stream/examples/request/IndicesPromoteDataStreamExample1.yaml @@ -1 +1,24 @@ method_request: POST /_data_stream/_promote/my-data-stream +alternatives: + - language: Python + code: |- + resp = client.indices.promote_data_stream( + name="my-data-stream", + ) + - language: JavaScript + code: |- + const response = await client.indices.promoteDataStream({ + name: "my-data-stream", + }); + - language: Ruby + code: |- + response = client.indices.promote_data_stream( + name: "my-data-stream" + ) + - language: PHP + code: |- + $resp = $client->indices()->promoteDataStream([ + "name" => "my-data-stream", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_data_stream/_promote/my-data-stream"' diff --git a/specification/indices/put_alias/examples/request/indicesPutAliasRequestExample1.yaml b/specification/indices/put_alias/examples/request/indicesPutAliasRequestExample1.yaml index 260eab43f7..a6d98e3587 100644 --- a/specification/indices/put_alias/examples/request/indicesPutAliasRequestExample1.yaml +++ b/specification/indices/put_alias/examples/request/indicesPutAliasRequestExample1.yaml @@ -2,4 +2,79 @@ method_request: POST _aliases # description: '' # type: request -value: "{\n \"actions\": [\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ]\n}" +value: "{ + + \ \"actions\": [ + + \ { + + \ \"add\": { + + \ \"index\": \"my-data-stream\", + + \ \"alias\": \"my-alias\" + + \ } + + \ } + + \ ] + + }" +alternatives: + - language: Python + code: |- + resp = client.indices.update_aliases( + actions=[ + { + "add": { + "index": "my-data-stream", + "alias": "my-alias" + } + } + ], + ) + - language: JavaScript + code: |- + const response = await client.indices.updateAliases({ + actions: [ + { + add: { + index: "my-data-stream", + alias: "my-alias", + }, + }, + ], + }); + - language: Ruby + code: |- + response = client.indices.update_aliases( + body: { + "actions": [ + { + "add": { + "index": "my-data-stream", + "alias": "my-alias" + } + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->indices()->updateAliases([ + "body" => [ + "actions" => array( + [ + "add" => [ + "index" => "my-data-stream", + "alias" => "my-alias", + ], + ], + ), + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"actions":[{"add":{"index":"my-data-stream","alias":"my-alias"}}]}'' "$ELASTICSEARCH_URL/_aliases"' diff --git a/specification/indices/put_data_lifecycle/examples/request/IndicesPutDataLifecycleRequestExample1.yaml b/specification/indices/put_data_lifecycle/examples/request/IndicesPutDataLifecycleRequestExample1.yaml index 19c498df7d..896e3f58bf 100644 --- a/specification/indices/put_data_lifecycle/examples/request/IndicesPutDataLifecycleRequestExample1.yaml +++ b/specification/indices/put_data_lifecycle/examples/request/IndicesPutDataLifecycleRequestExample1.yaml @@ -3,3 +3,36 @@ method_request: PUT _data_stream/my-data-stream/_lifecycle # description: Sets the lifecycle of a data stream. # type: request value: "{\n \"data_retention\": \"7d\"\n}" +alternatives: + - language: Python + code: |- + resp = client.indices.put_data_lifecycle( + name="my-data-stream", + data_retention="7d", + ) + - language: JavaScript + code: |- + const response = await client.indices.putDataLifecycle({ + name: "my-data-stream", + data_retention: "7d", + }); + - language: Ruby + code: |- + response = client.indices.put_data_lifecycle( + name: "my-data-stream", + body: { + "data_retention": "7d" + } + ) + - language: PHP + code: |- + $resp = $client->indices()->putDataLifecycle([ + "name" => "my-data-stream", + "body" => [ + "data_retention" => "7d", + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"data_retention":"7d"}'' "$ELASTICSEARCH_URL/_data_stream/my-data-stream/_lifecycle"' diff --git a/specification/indices/put_data_lifecycle/examples/request/IndicesPutDataLifecycleRequestExample2.yaml b/specification/indices/put_data_lifecycle/examples/request/IndicesPutDataLifecycleRequestExample2.yaml index 9c2a97f498..c3b5d682de 100644 --- a/specification/indices/put_data_lifecycle/examples/request/IndicesPutDataLifecycleRequestExample2.yaml +++ b/specification/indices/put_data_lifecycle/examples/request/IndicesPutDataLifecycleRequestExample2.yaml @@ -2,7 +2,96 @@ summary: Set the data stream lifecycle downsampling method_request: PUT _data_stream/my-weather-sensor-data-stream/_lifecycle description: This example configures two downsampling rounds. # type: request -value: - "{\n \"downsampling\": [\n {\n \"after\": \"1d\",\n \"\ - fixed_interval\": \"10m\"\n },\n {\n \"after\": \"7d\",\n \ - \ \"fixed_interval\": \"1d\"\n }\n ]\n}" +value: "{ + + \ \"downsampling\": [ + + \ { + + \ \"after\": \"1d\", + + \ \"fixed_interval\": \"10m\" + + \ }, + + \ { + + \ \"after\": \"7d\", + + \ \"fixed_interval\": \"1d\" + + \ } + + \ ] + + }" +alternatives: + - language: Python + code: |- + resp = client.indices.put_data_lifecycle( + name="my-weather-sensor-data-stream", + downsampling=[ + { + "after": "1d", + "fixed_interval": "10m" + }, + { + "after": "7d", + "fixed_interval": "1d" + } + ], + ) + - language: JavaScript + code: |- + const response = await client.indices.putDataLifecycle({ + name: "my-weather-sensor-data-stream", + downsampling: [ + { + after: "1d", + fixed_interval: "10m", + }, + { + after: "7d", + fixed_interval: "1d", + }, + ], + }); + - language: Ruby + code: |- + response = client.indices.put_data_lifecycle( + name: "my-weather-sensor-data-stream", + body: { + "downsampling": [ + { + "after": "1d", + "fixed_interval": "10m" + }, + { + "after": "7d", + "fixed_interval": "1d" + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->indices()->putDataLifecycle([ + "name" => "my-weather-sensor-data-stream", + "body" => [ + "downsampling" => array( + [ + "after" => "1d", + "fixed_interval" => "10m", + ], + [ + "after" => "7d", + "fixed_interval" => "1d", + ], + ), + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"downsampling":[{"after":"1d","fixed_interval":"10m"},{"after":"7d","fixed_interval":"1d"}]}'' + "$ELASTICSEARCH_URL/_data_stream/my-weather-sensor-data-stream/_lifecycle"' diff --git a/specification/indices/put_index_template/examples/request/IndicesPutIndexTemplateRequestExample1.yaml b/specification/indices/put_index_template/examples/request/IndicesPutIndexTemplateRequestExample1.yaml index 157b33b4b6..a76b5039f3 100644 --- a/specification/indices/put_index_template/examples/request/IndicesPutIndexTemplateRequestExample1.yaml +++ b/specification/indices/put_index_template/examples/request/IndicesPutIndexTemplateRequestExample1.yaml @@ -2,6 +2,84 @@ summary: Create a template method_request: PUT /_index_template/template_1 # description: '' # type: request -value: - "{\n \"index_patterns\" : [\"template*\"],\n \"priority\" : 1,\n \"template\"\ - : {\n \"settings\" : {\n \"number_of_shards\" : 2\n }\n }\n}" +value: "{ + + \ \"index_patterns\" : [\"template*\"], + + \ \"priority\" : 1, + + \ \"template\": { + + \ \"settings\" : { + + \ \"number_of_shards\" : 2 + + \ } + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.indices.put_index_template( + name="template_1", + index_patterns=[ + "template*" + ], + priority=1, + template={ + "settings": { + "number_of_shards": 2 + } + }, + ) + - language: JavaScript + code: |- + const response = await client.indices.putIndexTemplate({ + name: "template_1", + index_patterns: ["template*"], + priority: 1, + template: { + settings: { + number_of_shards: 2, + }, + }, + }); + - language: Ruby + code: |- + response = client.indices.put_index_template( + name: "template_1", + body: { + "index_patterns": [ + "template*" + ], + "priority": 1, + "template": { + "settings": { + "number_of_shards": 2 + } + } + } + ) + - language: PHP + code: |- + $resp = $client->indices()->putIndexTemplate([ + "name" => "template_1", + "body" => [ + "index_patterns" => array( + "template*", + ), + "priority" => 1, + "template" => [ + "settings" => [ + "number_of_shards" => 2, + ], + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"index_patterns":["template*"],"priority":1,"template":{"settings":{"number_of_shards":2}}}'' + "$ELASTICSEARCH_URL/_index_template/template_1"' diff --git a/specification/indices/put_index_template/examples/request/IndicesPutIndexTemplateRequestExample2.yaml b/specification/indices/put_index_template/examples/request/IndicesPutIndexTemplateRequestExample2.yaml index 74589b4026..6f747f2034 100644 --- a/specification/indices/put_index_template/examples/request/IndicesPutIndexTemplateRequestExample2.yaml +++ b/specification/indices/put_index_template/examples/request/IndicesPutIndexTemplateRequestExample2.yaml @@ -18,3 +18,112 @@ value: user.id: kimchy routing: shard-1 '{index}-alias': {} +alternatives: + - language: Python + code: |- + resp = client.indices.put_index_template( + name="template_1", + index_patterns=[ + "template*" + ], + template={ + "settings": { + "number_of_shards": 1 + }, + "aliases": { + "alias1": {}, + "alias2": { + "filter": { + "term": { + "user.id": "kimchy" + } + }, + "routing": "shard-1" + }, + "{index}-alias": {} + } + }, + ) + - language: JavaScript + code: |- + const response = await client.indices.putIndexTemplate({ + name: "template_1", + index_patterns: ["template*"], + template: { + settings: { + number_of_shards: 1, + }, + aliases: { + alias1: {}, + alias2: { + filter: { + term: { + "user.id": "kimchy", + }, + }, + routing: "shard-1", + }, + "{index}-alias": {}, + }, + }, + }); + - language: Ruby + code: |- + response = client.indices.put_index_template( + name: "template_1", + body: { + "index_patterns": [ + "template*" + ], + "template": { + "settings": { + "number_of_shards": 1 + }, + "aliases": { + "alias1": {}, + "alias2": { + "filter": { + "term": { + "user.id": "kimchy" + } + }, + "routing": "shard-1" + }, + "{index}-alias": {} + } + } + } + ) + - language: PHP + code: |- + $resp = $client->indices()->putIndexTemplate([ + "name" => "template_1", + "body" => [ + "index_patterns" => array( + "template*", + ), + "template" => [ + "settings" => [ + "number_of_shards" => 1, + ], + "aliases" => [ + "alias1" => new ArrayObject([]), + "alias2" => [ + "filter" => [ + "term" => [ + "user.id" => "kimchy", + ], + ], + "routing" => "shard-1", + ], + "{index}-alias" => new ArrayObject([]), + ], + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"index_patterns\":[\"template*\"],\"template\":{\"settings\":{\"number_of_shards\":1},\"aliases\":{\"alias1\":{},\"alias2\ + \":{\"filter\":{\"term\":{\"user.id\":\"kimchy\"}},\"routing\":\"shard-1\"},\"{index}-alias\":{}}}}' + \"$ELASTICSEARCH_URL/_index_template/template_1\"" diff --git a/specification/indices/put_mapping/examples/request/indicesPutMappingRequestExample1.yaml b/specification/indices/put_mapping/examples/request/indicesPutMappingRequestExample1.yaml index ae403dc9b7..dc969bbce8 100644 --- a/specification/indices/put_mapping/examples/request/indicesPutMappingRequestExample1.yaml +++ b/specification/indices/put_mapping/examples/request/indicesPutMappingRequestExample1.yaml @@ -1,8 +1,9 @@ summary: Update multiple targets method_request: PUT /my-index-000001/_mapping description: > - The update mapping API can be applied to multiple data streams or indices with a single request. - For example, run `PUT /my-index-000001,my-index-000002/_mapping` to update mappings for the `my-index-000001` and `my-index-000002` indices at the same time. + The update mapping API can be applied to multiple data streams or indices with a single request. For example, run `PUT + /my-index-000001,my-index-000002/_mapping` to update mappings for the `my-index-000001` and `my-index-000002` indices at the same + time. # type: request value: properties: @@ -10,3 +11,69 @@ value: properties: name: type: keyword +alternatives: + - language: Python + code: |- + resp = client.indices.put_mapping( + index="my-index-000001", + properties={ + "user": { + "properties": { + "name": { + "type": "keyword" + } + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.indices.putMapping({ + index: "my-index-000001", + properties: { + user: { + properties: { + name: { + type: "keyword", + }, + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.indices.put_mapping( + index: "my-index-000001", + body: { + "properties": { + "user": { + "properties": { + "name": { + "type": "keyword" + } + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->indices()->putMapping([ + "index" => "my-index-000001", + "body" => [ + "properties" => [ + "user" => [ + "properties" => [ + "name" => [ + "type" => "keyword", + ], + ], + ], + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"properties":{"user":{"properties":{"name":{"type":"keyword"}}}}}'' + "$ELASTICSEARCH_URL/my-index-000001/_mapping"' diff --git a/specification/indices/put_settings/examples/request/IndicesPutSettingsRequestExample1.yaml b/specification/indices/put_settings/examples/request/IndicesPutSettingsRequestExample1.yaml index 3c1342cc8b..2c8a451c4d 100644 --- a/specification/indices/put_settings/examples/request/IndicesPutSettingsRequestExample1.yaml +++ b/specification/indices/put_settings/examples/request/IndicesPutSettingsRequestExample1.yaml @@ -2,4 +2,57 @@ summary: Change a dynamic index setting method_request: PUT /my-index-000001/_settings # description: '' # type: request -value: "{\n \"index\" : {\n \"number_of_replicas\" : 2\n }\n}" +value: "{ + + \ \"index\" : { + + \ \"number_of_replicas\" : 2 + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.indices.put_settings( + index="my-index-000001", + settings={ + "index": { + "number_of_replicas": 2 + } + }, + ) + - language: JavaScript + code: |- + const response = await client.indices.putSettings({ + index: "my-index-000001", + settings: { + index: { + number_of_replicas: 2, + }, + }, + }); + - language: Ruby + code: |- + response = client.indices.put_settings( + index: "my-index-000001", + body: { + "index": { + "number_of_replicas": 2 + } + } + ) + - language: PHP + code: |- + $resp = $client->indices()->putSettings([ + "index" => "my-index-000001", + "body" => [ + "index" => [ + "number_of_replicas" => 2, + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"index":{"number_of_replicas":2}}'' "$ELASTICSEARCH_URL/my-index-000001/_settings"' diff --git a/specification/indices/put_settings/examples/request/indicesPutSettingsRequestExample2.yaml b/specification/indices/put_settings/examples/request/indicesPutSettingsRequestExample2.yaml index 43f12cef5e..d97da57d14 100644 --- a/specification/indices/put_settings/examples/request/indicesPutSettingsRequestExample2.yaml +++ b/specification/indices/put_settings/examples/request/indicesPutSettingsRequestExample2.yaml @@ -2,4 +2,57 @@ summary: Reset an index setting method_request: PUT /my-index-000001/_settings description: To revert a setting to the default value, use `null`. # type: request -value: "{\n \"index\" : {\n \"refresh_interval\" : null\n }\n}" +value: "{ + + \ \"index\" : { + + \ \"refresh_interval\" : null + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.indices.put_settings( + index="my-index-000001", + settings={ + "index": { + "refresh_interval": None + } + }, + ) + - language: JavaScript + code: |- + const response = await client.indices.putSettings({ + index: "my-index-000001", + settings: { + index: { + refresh_interval: null, + }, + }, + }); + - language: Ruby + code: |- + response = client.indices.put_settings( + index: "my-index-000001", + body: { + "index": { + "refresh_interval": nil + } + } + ) + - language: PHP + code: |- + $resp = $client->indices()->putSettings([ + "index" => "my-index-000001", + "body" => [ + "index" => [ + "refresh_interval" => null, + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"index":{"refresh_interval":null}}'' "$ELASTICSEARCH_URL/my-index-000001/_settings"' diff --git a/specification/indices/put_settings/examples/request/indicesPutSettingsRequestExample3.yaml b/specification/indices/put_settings/examples/request/indicesPutSettingsRequestExample3.yaml index 2dc711a53b..a4b1c52b5e 100644 --- a/specification/indices/put_settings/examples/request/indicesPutSettingsRequestExample3.yaml +++ b/specification/indices/put_settings/examples/request/indicesPutSettingsRequestExample3.yaml @@ -2,7 +2,88 @@ summary: Update index analysis method_request: POST /my-index-000001/_close description: To add an analyzer, you must close the index, define the analyzer, then reopen the index. # type: request -value: - "{\n \"analysis\" : {\n \"analyzer\":{\n \"content\":{\n \"\ - type\":\"custom\",\n \"tokenizer\":\"whitespace\"\n }\n }\n }\n\ - }\n\nPOST /my-index-000001/_open" +value: "{ + + \ \"analysis\" : { + + \ \"analyzer\":{ + + \ \"content\":{ + + \ \"type\":\"custom\", + + \ \"tokenizer\":\"whitespace\" + + \ } + + \ } + + \ } + + } + + + POST /my-index-000001/_open" +alternatives: + - language: Python + code: |- + resp = client.indices.close( + index="my-index-000001", + ) + + resp1 = client.indices.open( + index="my-index-000001", + ) + - language: JavaScript + code: |- + const response = await client.indices.close({ + index: "my-index-000001", + }); + + const response1 = await client.indices.open({ + index: "my-index-000001", + }); + - language: Ruby + code: |- + response = client.indices.close( + index: "my-index-000001", + body: { + "analysis": { + "analyzer": { + "content": { + "type": "custom", + "tokenizer": "whitespace" + } + } + } + } + ) + + response1 = client.indices.open( + index: "my-index-000001" + ) + - language: PHP + code: |- + $resp = $client->indices()->close([ + "index" => "my-index-000001", + "body" => [ + "analysis" => [ + "analyzer" => [ + "content" => [ + "type" => "custom", + "tokenizer" => "whitespace", + ], + ], + ], + ], + ]); + + $resp1 = $client->indices()->open([ + "index" => "my-index-000001", + ]); + - language: curl + code: >- + curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + '{"analysis":{"analyzer":{"content":{"type":"custom","tokenizer":"whitespace"}}}}' "$ELASTICSEARCH_URL/my-index-000001/_close" + + curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index-000001/_open" diff --git a/specification/indices/put_template/examples/request/indicesPutTemplateRequestExample1.yaml b/specification/indices/put_template/examples/request/indicesPutTemplateRequestExample1.yaml index 48e9d7f7e0..524a442d4b 100644 --- a/specification/indices/put_template/examples/request/indicesPutTemplateRequestExample1.yaml +++ b/specification/indices/put_template/examples/request/indicesPutTemplateRequestExample1.yaml @@ -1,5 +1,5 @@ summary: Create an index template -# method_request: PUT _template/template_1 +method_request: PUT _template/template_1 # description: '' # type: request value: @@ -17,3 +17,115 @@ value: created_at: type: date format: 'EEE MMM dd HH:mm:ss Z yyyy' +alternatives: + - language: Python + code: |- + resp = client.indices.put_template( + name="template_1", + index_patterns=[ + "te*", + "bar*" + ], + settings={ + "number_of_shards": 1 + }, + mappings={ + "_source": { + "enabled": False + } + }, + properties={ + "host_name": { + "type": "keyword" + }, + "created_at": { + "type": "date", + "format": "EEE MMM dd HH:mm:ss Z yyyy" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.indices.putTemplate({ + name: "template_1", + index_patterns: ["te*", "bar*"], + settings: { + number_of_shards: 1, + }, + mappings: { + _source: { + enabled: false, + }, + }, + properties: { + host_name: { + type: "keyword", + }, + created_at: { + type: "date", + format: "EEE MMM dd HH:mm:ss Z yyyy", + }, + }, + }); + - language: Ruby + code: |- + response = client.indices.put_template( + name: "template_1", + body: { + "index_patterns": [ + "te*", + "bar*" + ], + "settings": { + "number_of_shards": 1 + }, + "mappings": { + "_source": { + "enabled": false + } + }, + "properties": { + "host_name": { + "type": "keyword" + }, + "created_at": { + "type": "date", + "format": "EEE MMM dd HH:mm:ss Z yyyy" + } + } + } + ) + - language: PHP + code: |- + $resp = $client->indices()->putTemplate([ + "name" => "template_1", + "body" => [ + "index_patterns" => array( + "te*", + "bar*", + ), + "settings" => [ + "number_of_shards" => 1, + ], + "mappings" => [ + "_source" => [ + "enabled" => false, + ], + ], + "properties" => [ + "host_name" => [ + "type" => "keyword", + ], + "created_at" => [ + "type" => "date", + "format" => "EEE MMM dd HH:mm:ss Z yyyy", + ], + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"index_patterns\":[\"te*\",\"bar*\"],\"settings\":{\"number_of_shards\":1},\"mappings\":{\"_source\":{\"enabled\":false}},\ + \"properties\":{\"host_name\":{\"type\":\"keyword\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z + yyyy\"}}}' \"$ELASTICSEARCH_URL/_template/template_1\"" diff --git a/specification/indices/put_template/examples/request/indicesPutTemplateRequestExample2.yaml b/specification/indices/put_template/examples/request/indicesPutTemplateRequestExample2.yaml index 0902682739..839a583f47 100644 --- a/specification/indices/put_template/examples/request/indicesPutTemplateRequestExample2.yaml +++ b/specification/indices/put_template/examples/request/indicesPutTemplateRequestExample2.yaml @@ -1,8 +1,8 @@ summary: Create an index template with aliases -# method_request: PUT _template/template_1 +method_request: PUT _template/template_1 description: > - You can include index aliases in an index template. - During index creation, the `{index}` placeholder in the alias name will be replaced with the actual index name that the template gets applied to. + You can include index aliases in an index template. During index creation, the `{index}` placeholder in the alias name will be + replaced with the actual index name that the template gets applied to. # type: request value: index_patterns: @@ -17,3 +17,103 @@ value: user.id: kimchy routing: shard-1 '{index}-alias': {} +alternatives: + - language: Python + code: |- + resp = client.indices.put_template( + name="template_1", + index_patterns=[ + "te*" + ], + settings={ + "number_of_shards": 1 + }, + aliases={ + "alias1": {}, + "alias2": { + "filter": { + "term": { + "user.id": "kimchy" + } + }, + "routing": "shard-1" + }, + "{index}-alias": {} + }, + ) + - language: JavaScript + code: |- + const response = await client.indices.putTemplate({ + name: "template_1", + index_patterns: ["te*"], + settings: { + number_of_shards: 1, + }, + aliases: { + alias1: {}, + alias2: { + filter: { + term: { + "user.id": "kimchy", + }, + }, + routing: "shard-1", + }, + "{index}-alias": {}, + }, + }); + - language: Ruby + code: |- + response = client.indices.put_template( + name: "template_1", + body: { + "index_patterns": [ + "te*" + ], + "settings": { + "number_of_shards": 1 + }, + "aliases": { + "alias1": {}, + "alias2": { + "filter": { + "term": { + "user.id": "kimchy" + } + }, + "routing": "shard-1" + }, + "{index}-alias": {} + } + } + ) + - language: PHP + code: |- + $resp = $client->indices()->putTemplate([ + "name" => "template_1", + "body" => [ + "index_patterns" => array( + "te*", + ), + "settings" => [ + "number_of_shards" => 1, + ], + "aliases" => [ + "alias1" => new ArrayObject([]), + "alias2" => [ + "filter" => [ + "term" => [ + "user.id" => "kimchy", + ], + ], + "routing" => "shard-1", + ], + "{index}-alias" => new ArrayObject([]), + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"index_patterns\":[\"te*\"],\"settings\":{\"number_of_shards\":1},\"aliases\":{\"alias1\":{},\"alias2\":{\"filter\":{\"term\ + \":{\"user.id\":\"kimchy\"}},\"routing\":\"shard-1\"},\"{index}-alias\":{}}}' \"$ELASTICSEARCH_URL/_template/template_1\"" diff --git a/specification/indices/recovery/examples/request/indicesRecoveryRequestExample1.yaml b/specification/indices/recovery/examples/request/indicesRecoveryRequestExample1.yaml index f615441005..8cbd19f794 100644 --- a/specification/indices/recovery/examples/request/indicesRecoveryRequestExample1.yaml +++ b/specification/indices/recovery/examples/request/indicesRecoveryRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET /_recovery?human +alternatives: + - language: Python + code: |- + resp = client.indices.recovery( + human=True, + ) + - language: JavaScript + code: |- + const response = await client.indices.recovery({ + human: "true", + }); + - language: Ruby + code: |- + response = client.indices.recovery( + human: "true" + ) + - language: PHP + code: |- + $resp = $client->indices()->recovery([ + "human" => "true", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_recovery?human"' diff --git a/specification/indices/refresh/examples/request/IndicesRefreshExample1.yaml b/specification/indices/refresh/examples/request/IndicesRefreshExample1.yaml index 6a13bc240a..b0284a5b50 100644 --- a/specification/indices/refresh/examples/request/IndicesRefreshExample1.yaml +++ b/specification/indices/refresh/examples/request/IndicesRefreshExample1.yaml @@ -1 +1,12 @@ method_request: GET _refresh +alternatives: + - language: Python + code: resp = client.indices.refresh() + - language: JavaScript + code: const response = await client.indices.refresh(); + - language: Ruby + code: response = client.indices.refresh + - language: PHP + code: $resp = $client->indices()->refresh(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_refresh"' diff --git a/specification/indices/reload_search_analyzers/examples/request/ReloadSearchAnalyzersRequestExample1.yaml b/specification/indices/reload_search_analyzers/examples/request/ReloadSearchAnalyzersRequestExample1.yaml index 0c9fb35bf3..5221f4b7de 100644 --- a/specification/indices/reload_search_analyzers/examples/request/ReloadSearchAnalyzersRequestExample1.yaml +++ b/specification/indices/reload_search_analyzers/examples/request/ReloadSearchAnalyzersRequestExample1.yaml @@ -13,3 +13,66 @@ value: - my_synonyms reloaded_node_ids: - mfdqTXn_T7SGr2Ho2KT8uw +alternatives: + - language: Python + code: |- + resp = client.indices.reload_search_analyzers( + index="my-index-000001", + ) + - language: JavaScript + code: |- + const response = await client.indices.reloadSearchAnalyzers({ + index: "my-index-000001", + }); + - language: Ruby + code: |- + response = client.indices.reload_search_analyzers( + index: "my-index-000001", + body: { + "_shards": { + "total": 2, + "successful": 2, + "failed": 0 + }, + "reload_details": [ + { + "index": "my-index-000001", + "reloaded_analyzers": [ + "my_synonyms" + ], + "reloaded_node_ids": [ + "mfdqTXn_T7SGr2Ho2KT8uw" + ] + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->indices()->reloadSearchAnalyzers([ + "index" => "my-index-000001", + "body" => [ + "_shards" => [ + "total" => 2, + "successful" => 2, + "failed" => 0, + ], + "reload_details" => array( + [ + "index" => "my-index-000001", + "reloaded_analyzers" => array( + "my_synonyms", + ), + "reloaded_node_ids" => array( + "mfdqTXn_T7SGr2Ho2KT8uw", + ), + ], + ), + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"_shards\":{\"total\":2,\"successful\":2,\"failed\":0},\"reload_details\":[{\"index\":\"my-index-000001\",\"reloaded_analy\ + zers\":[\"my_synonyms\"],\"reloaded_node_ids\":[\"mfdqTXn_T7SGr2Ho2KT8uw\"]}]}' + \"$ELASTICSEARCH_URL/my-index-000001/_reload_search_analyzers\"" diff --git a/specification/indices/resolve_cluster/examples/request/ResolveClusterRequestExample2.yaml b/specification/indices/resolve_cluster/examples/request/ResolveClusterRequestExample2.yaml index 510c17feda..48839e88f2 100644 --- a/specification/indices/resolve_cluster/examples/request/ResolveClusterRequestExample2.yaml +++ b/specification/indices/resolve_cluster/examples/request/ResolveClusterRequestExample2.yaml @@ -1 +1,33 @@ method_request: GET /_resolve/cluster/not-present,clust*:my-index*,oldcluster:*?ignore_unavailable=false&timeout=5s +alternatives: + - language: Python + code: |- + resp = client.indices.resolve_cluster( + name="not-present,clust*:my-index*,oldcluster:*", + ignore_unavailable=False, + timeout="5s", + ) + - language: JavaScript + code: |- + const response = await client.indices.resolveCluster({ + name: "not-present,clust*:my-index*,oldcluster:*", + ignore_unavailable: "false", + timeout: "5s", + }); + - language: Ruby + code: |- + response = client.indices.resolve_cluster( + name: "not-present,clust*:my-index*,oldcluster:*", + ignore_unavailable: "false", + timeout: "5s" + ) + - language: PHP + code: |- + $resp = $client->indices()->resolveCluster([ + "name" => "not-present,clust*:my-index*,oldcluster:*", + "ignore_unavailable" => "false", + "timeout" => "5s", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_resolve/cluster/not-present,clust*:my-index*,oldcluster:*?ignore_unavailable=false&timeout=5s"' diff --git a/specification/indices/resolve_index/examples/request/ResolveIndexRequestExample1.yaml b/specification/indices/resolve_index/examples/request/ResolveIndexRequestExample1.yaml index 1e0f7249b7..146550944a 100644 --- a/specification/indices/resolve_index/examples/request/ResolveIndexRequestExample1.yaml +++ b/specification/indices/resolve_index/examples/request/ResolveIndexRequestExample1.yaml @@ -1 +1,29 @@ method_request: GET /_resolve/index/f*,remoteCluster1:bar*?expand_wildcards=all +alternatives: + - language: Python + code: |- + resp = client.indices.resolve_index( + name="f*,remoteCluster1:bar*", + expand_wildcards="all", + ) + - language: JavaScript + code: |- + const response = await client.indices.resolveIndex({ + name: "f*,remoteCluster1:bar*", + expand_wildcards: "all", + }); + - language: Ruby + code: |- + response = client.indices.resolve_index( + name: "f*,remoteCluster1:bar*", + expand_wildcards: "all" + ) + - language: PHP + code: |- + $resp = $client->indices()->resolveIndex([ + "name" => "f*,remoteCluster1:bar*", + "expand_wildcards" => "all", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_resolve/index/f*,remoteCluster1:bar*?expand_wildcards=all"' diff --git a/specification/indices/rollover/examples/request/indicesRolloverRequestExample1.yaml b/specification/indices/rollover/examples/request/indicesRolloverRequestExample1.yaml index 9c34872e97..be12a63e38 100644 --- a/specification/indices/rollover/examples/request/indicesRolloverRequestExample1.yaml +++ b/specification/indices/rollover/examples/request/indicesRolloverRequestExample1.yaml @@ -2,7 +2,72 @@ summary: Create a new index for a data stream. method_request: POST my-data-stream/_rollover # description: '' # type: request -value: - "{\n \"conditions\": {\n \"max_age\": \"7d\",\n \"max_docs\": 1000,\n\ - \ \"max_primary_shard_size\": \"50gb\",\n \"max_primary_shard_docs\": \"2000\"\ - \n }\n}" +value: "{ + + \ \"conditions\": { + + \ \"max_age\": \"7d\", + + \ \"max_docs\": 1000, + + \ \"max_primary_shard_size\": \"50gb\", + + \ \"max_primary_shard_docs\": \"2000\" + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.indices.rollover( + alias="my-data-stream", + conditions={ + "max_age": "7d", + "max_docs": 1000, + "max_primary_shard_size": "50gb", + "max_primary_shard_docs": "2000" + }, + ) + - language: JavaScript + code: |- + const response = await client.indices.rollover({ + alias: "my-data-stream", + conditions: { + max_age: "7d", + max_docs: 1000, + max_primary_shard_size: "50gb", + max_primary_shard_docs: "2000", + }, + }); + - language: Ruby + code: |- + response = client.indices.rollover( + alias: "my-data-stream", + body: { + "conditions": { + "max_age": "7d", + "max_docs": 1000, + "max_primary_shard_size": "50gb", + "max_primary_shard_docs": "2000" + } + } + ) + - language: PHP + code: |- + $resp = $client->indices()->rollover([ + "alias" => "my-data-stream", + "body" => [ + "conditions" => [ + "max_age" => "7d", + "max_docs" => 1000, + "max_primary_shard_size" => "50gb", + "max_primary_shard_docs" => "2000", + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"conditions\":{\"max_age\":\"7d\",\"max_docs\":1000,\"max_primary_shard_size\":\"50gb\",\"max_primary_shard_docs\":\"2000\ + \"}}' \"$ELASTICSEARCH_URL/my-data-stream/_rollover\"" diff --git a/specification/indices/segments/examples/request/IndicesSegmentsExample1.yaml b/specification/indices/segments/examples/request/IndicesSegmentsExample1.yaml index 9e791d430d..61c8486e65 100644 --- a/specification/indices/segments/examples/request/IndicesSegmentsExample1.yaml +++ b/specification/indices/segments/examples/request/IndicesSegmentsExample1.yaml @@ -1 +1,24 @@ method_request: GET /my-index-000001/_segments +alternatives: + - language: Python + code: |- + resp = client.indices.segments( + index="my-index-000001", + ) + - language: JavaScript + code: |- + const response = await client.indices.segments({ + index: "my-index-000001", + }); + - language: Ruby + code: |- + response = client.indices.segments( + index: "my-index-000001" + ) + - language: PHP + code: |- + $resp = $client->indices()->segments([ + "index" => "my-index-000001", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index-000001/_segments"' diff --git a/specification/indices/shard_stores/examples/request/indicesShardStoresRequestExample1.yaml b/specification/indices/shard_stores/examples/request/indicesShardStoresRequestExample1.yaml index 7a44a1977f..700f9a8c25 100644 --- a/specification/indices/shard_stores/examples/request/indicesShardStoresRequestExample1.yaml +++ b/specification/indices/shard_stores/examples/request/indicesShardStoresRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET /_shard_stores?status=green +alternatives: + - language: Python + code: |- + resp = client.indices.shard_stores( + status="green", + ) + - language: JavaScript + code: |- + const response = await client.indices.shardStores({ + status: "green", + }); + - language: Ruby + code: |- + response = client.indices.shard_stores( + status: "green" + ) + - language: PHP + code: |- + $resp = $client->indices()->shardStores([ + "status" => "green", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_shard_stores?status=green"' diff --git a/specification/indices/shrink/examples/request/indicesShrinkRequestExample1.yaml b/specification/indices/shrink/examples/request/indicesShrinkRequestExample1.yaml index 962e47294b..a40491d77c 100644 --- a/specification/indices/shrink/examples/request/indicesShrinkRequestExample1.yaml +++ b/specification/indices/shrink/examples/request/indicesShrinkRequestExample1.yaml @@ -2,6 +2,64 @@ summary: Shrink an existing index into a new index with fewer primary shards. method_request: POST /my_source_index/_shrink/my_target_index # description: '' # type: request -value: - "{\n \"settings\": {\n \"index.routing.allocation.require._name\": null,\n\ - \ \"index.blocks.write\": null\n }\n}" +value: "{ + + \ \"settings\": { + + \ \"index.routing.allocation.require._name\": null, + + \ \"index.blocks.write\": null + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.indices.shrink( + index="my_source_index", + target="my_target_index", + settings={ + "index.routing.allocation.require._name": None, + "index.blocks.write": None + }, + ) + - language: JavaScript + code: |- + const response = await client.indices.shrink({ + index: "my_source_index", + target: "my_target_index", + settings: { + "index.routing.allocation.require._name": null, + "index.blocks.write": null, + }, + }); + - language: Ruby + code: |- + response = client.indices.shrink( + index: "my_source_index", + target: "my_target_index", + body: { + "settings": { + "index.routing.allocation.require._name": nil, + "index.blocks.write": nil + } + } + ) + - language: PHP + code: |- + $resp = $client->indices()->shrink([ + "index" => "my_source_index", + "target" => "my_target_index", + "body" => [ + "settings" => [ + "index.routing.allocation.require._name" => null, + "index.blocks.write" => null, + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"settings":{"index.routing.allocation.require._name":null,"index.blocks.write":null}}'' + "$ELASTICSEARCH_URL/my_source_index/_shrink/my_target_index"' diff --git a/specification/indices/simulate_index_template/examples/request/indicesSimulateIndexTemplateRequestExample1.yaml b/specification/indices/simulate_index_template/examples/request/indicesSimulateIndexTemplateRequestExample1.yaml index 4f244ee05b..b915b63de5 100644 --- a/specification/indices/simulate_index_template/examples/request/indicesSimulateIndexTemplateRequestExample1.yaml +++ b/specification/indices/simulate_index_template/examples/request/indicesSimulateIndexTemplateRequestExample1.yaml @@ -1 +1,24 @@ method_request: POST /_index_template/_simulate_index/my-index-000001 +alternatives: + - language: Python + code: |- + resp = client.indices.simulate_index_template( + name="my-index-000001", + ) + - language: JavaScript + code: |- + const response = await client.indices.simulateIndexTemplate({ + name: "my-index-000001", + }); + - language: Ruby + code: |- + response = client.indices.simulate_index_template( + name: "my-index-000001" + ) + - language: PHP + code: |- + $resp = $client->indices()->simulateIndexTemplate([ + "name" => "my-index-000001", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_index_template/_simulate_index/my-index-000001"' diff --git a/specification/indices/simulate_template/examples/request/indicesSimulateTemplateRequestExample1.yaml b/specification/indices/simulate_template/examples/request/indicesSimulateTemplateRequestExample1.yaml index 7e719be00d..bd7716942d 100644 --- a/specification/indices/simulate_template/examples/request/indicesSimulateTemplateRequestExample1.yaml +++ b/specification/indices/simulate_template/examples/request/indicesSimulateTemplateRequestExample1.yaml @@ -1,10 +1,95 @@ # summary: method_request: POST /_index_template/_simulate description: > - To see what settings will be applied by a template before you add it to the cluster, you can pass a template configuration in the request body. - The specified template is used for the simulation if it has a higher priority than existing templates. + To see what settings will be applied by a template before you add it to the cluster, you can pass a template configuration in the + request body. The specified template is used for the simulation if it has a higher priority than existing templates. # type: request -value: - "{\n \"index_patterns\": [\"my-index-*\"],\n \"composed_of\": [\"ct2\"],\n\ - \ \"priority\": 10,\n \"template\": {\n \"settings\": {\n \"index.number_of_replicas\"\ - : 1\n }\n }\n}" +value: "{ + + \ \"index_patterns\": [\"my-index-*\"], + + \ \"composed_of\": [\"ct2\"], + + \ \"priority\": 10, + + \ \"template\": { + + \ \"settings\": { + + \ \"index.number_of_replicas\": 1 + + \ } + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.indices.simulate_template( + index_patterns=[ + "my-index-*" + ], + composed_of=[ + "ct2" + ], + priority=10, + template={ + "settings": { + "index.number_of_replicas": 1 + } + }, + ) + - language: JavaScript + code: |- + const response = await client.indices.simulateTemplate({ + index_patterns: ["my-index-*"], + composed_of: ["ct2"], + priority: 10, + template: { + settings: { + "index.number_of_replicas": 1, + }, + }, + }); + - language: Ruby + code: |- + response = client.indices.simulate_template( + body: { + "index_patterns": [ + "my-index-*" + ], + "composed_of": [ + "ct2" + ], + "priority": 10, + "template": { + "settings": { + "index.number_of_replicas": 1 + } + } + } + ) + - language: PHP + code: |- + $resp = $client->indices()->simulateTemplate([ + "body" => [ + "index_patterns" => array( + "my-index-*", + ), + "composed_of" => array( + "ct2", + ), + "priority" => 10, + "template" => [ + "settings" => [ + "index.number_of_replicas" => 1, + ], + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"index_patterns\":[\"my-index-*\"],\"composed_of\":[\"ct2\"],\"priority\":10,\"template\":{\"settings\":{\"index.number_of\ + _replicas\":1}}}' \"$ELASTICSEARCH_URL/_index_template/_simulate\"" diff --git a/specification/indices/split/examples/request/indicesSplitRequestExample1.yaml b/specification/indices/split/examples/request/indicesSplitRequestExample1.yaml index 3ccadd187e..23d91da8e1 100644 --- a/specification/indices/split/examples/request/indicesSplitRequestExample1.yaml +++ b/specification/indices/split/examples/request/indicesSplitRequestExample1.yaml @@ -2,4 +2,57 @@ description: Split an existing index into a new index with more primary shards. method_request: POST /my-index-000001/_split/split-my-index-000001 # type: request -value: "{\n \"settings\": {\n \"index.number_of_shards\": 2\n }\n}" +value: "{ + + \ \"settings\": { + + \ \"index.number_of_shards\": 2 + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.indices.split( + index="my-index-000001", + target="split-my-index-000001", + settings={ + "index.number_of_shards": 2 + }, + ) + - language: JavaScript + code: |- + const response = await client.indices.split({ + index: "my-index-000001", + target: "split-my-index-000001", + settings: { + "index.number_of_shards": 2, + }, + }); + - language: Ruby + code: |- + response = client.indices.split( + index: "my-index-000001", + target: "split-my-index-000001", + body: { + "settings": { + "index.number_of_shards": 2 + } + } + ) + - language: PHP + code: |- + $resp = $client->indices()->split([ + "index" => "my-index-000001", + "target" => "split-my-index-000001", + "body" => [ + "settings" => [ + "index.number_of_shards" => 2, + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"settings":{"index.number_of_shards":2}}'' "$ELASTICSEARCH_URL/my-index-000001/_split/split-my-index-000001"' diff --git a/specification/indices/stats/examples/request/IndicesStatsExample1.yaml b/specification/indices/stats/examples/request/IndicesStatsExample1.yaml index da2206189b..d9fc8ca331 100644 --- a/specification/indices/stats/examples/request/IndicesStatsExample1.yaml +++ b/specification/indices/stats/examples/request/IndicesStatsExample1.yaml @@ -1 +1,33 @@ method_request: GET _stats/fielddata?human&fields=my_join_field#question +alternatives: + - language: Python + code: |- + resp = client.indices.stats( + metric="fielddata", + human=True, + fields="my_join_field", + ) + - language: JavaScript + code: |- + const response = await client.indices.stats({ + metric: "fielddata", + human: "true", + fields: "my_join_field", + }); + - language: Ruby + code: |- + response = client.indices.stats( + metric: "fielddata", + human: "true", + fields: "my_join_field" + ) + - language: PHP + code: |- + $resp = $client->indices()->stats([ + "metric" => "fielddata", + "human" => "true", + "fields" => "my_join_field", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_stats/fielddata?human&fields=my_join_field#question"' diff --git a/specification/indices/update_aliases/examples/request/IndicesUpdateAliasesExample1.yaml b/specification/indices/update_aliases/examples/request/IndicesUpdateAliasesExample1.yaml index 05f25dd467..b136c335ce 100644 --- a/specification/indices/update_aliases/examples/request/IndicesUpdateAliasesExample1.yaml +++ b/specification/indices/update_aliases/examples/request/IndicesUpdateAliasesExample1.yaml @@ -11,3 +11,60 @@ value: |- } ] } +alternatives: + - language: Python + code: |- + resp = client.indices.update_aliases( + actions=[ + { + "add": { + "index": "logs-nginx.access-prod", + "alias": "logs" + } + } + ], + ) + - language: JavaScript + code: |- + const response = await client.indices.updateAliases({ + actions: [ + { + add: { + index: "logs-nginx.access-prod", + alias: "logs", + }, + }, + ], + }); + - language: Ruby + code: |- + response = client.indices.update_aliases( + body: { + "actions": [ + { + "add": { + "index": "logs-nginx.access-prod", + "alias": "logs" + } + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->indices()->updateAliases([ + "body" => [ + "actions" => array( + [ + "add" => [ + "index" => "logs-nginx.access-prod", + "alias" => "logs", + ], + ], + ), + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"actions":[{"add":{"index":"logs-nginx.access-prod","alias":"logs"}}]}'' "$ELASTICSEARCH_URL/_aliases"' diff --git a/specification/indices/validate_query/examples/request/IndicesValidateQueryExample1.yaml b/specification/indices/validate_query/examples/request/IndicesValidateQueryExample1.yaml index 54accf2b70..dc3ee3b8ce 100644 --- a/specification/indices/validate_query/examples/request/IndicesValidateQueryExample1.yaml +++ b/specification/indices/validate_query/examples/request/IndicesValidateQueryExample1.yaml @@ -1 +1,28 @@ method_request: GET my-index-000001/_validate/query?q=user.id:kimchy +alternatives: + - language: Python + code: |- + resp = client.indices.validate_query( + index="my-index-000001", + q="user.id:kimchy", + ) + - language: JavaScript + code: |- + const response = await client.indices.validateQuery({ + index: "my-index-000001", + q: "user.id:kimchy", + }); + - language: Ruby + code: |- + response = client.indices.validate_query( + index: "my-index-000001", + q: "user.id:kimchy" + ) + - language: PHP + code: |- + $resp = $client->indices()->validateQuery([ + "index" => "my-index-000001", + "q" => "user.id:kimchy", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index-000001/_validate/query?q=user.id:kimchy"' diff --git a/specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample1.yaml b/specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample1.yaml index 14fe53170d..58629daa88 100644 --- a/specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample1.yaml +++ b/specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample1.yaml @@ -1,5 +1,7 @@ summary: A chat completion task -description: Run `POST _inference/chat_completion/openai-completion/_stream` to perform a chat completion on the example question with streaming. +description: + Run `POST _inference/chat_completion/openai-completion/_stream` to perform a chat completion on the example question + with streaming. method_request: 'POST _inference/chat_completion/openai-completion/_stream' # type: "request" value: |- @@ -12,3 +14,65 @@ value: |- } ] } +alternatives: + - language: Python + code: |- + resp = client.inference.chat_completion_unified( + inference_id="openai-completion", + chat_completion_request={ + "model": "gpt-4o", + "messages": [ + { + "role": "user", + "content": "What is Elastic?" + } + ] + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.chatCompletionUnified({ + inference_id: "openai-completion", + chat_completion_request: { + model: "gpt-4o", + messages: [ + { + role: "user", + content: "What is Elastic?", + }, + ], + }, + }); + - language: Ruby + code: |- + response = client.inference.chat_completion_unified( + inference_id: "openai-completion", + body: { + "model": "gpt-4o", + "messages": [ + { + "role": "user", + "content": "What is Elastic?" + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->inference()->chatCompletionUnified([ + "inference_id" => "openai-completion", + "body" => [ + "model" => "gpt-4o", + "messages" => array( + [ + "role" => "user", + "content" => "What is Elastic?", + ], + ), + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"model":"gpt-4o","messages":[{"role":"user","content":"What is Elastic?"}]}'' + "$ELASTICSEARCH_URL/_inference/chat_completion/openai-completion/_stream"' diff --git a/specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample2.yaml b/specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample2.yaml index 37b54591fc..2e73f07fb3 100644 --- a/specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample2.yaml +++ b/specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample2.yaml @@ -1,5 +1,7 @@ summary: A chat completion task with tool_calls -description: Run `POST POST _inference/chat_completion/openai-completion/_stream` to perform a chat completion using an Assistant message with `tool_calls`. +description: + Run `POST _inference/chat_completion/openai-completion/_stream` to perform a chat completion using an Assistant message + with `tool_calls`. method_request: 'POST _inference/chat_completion/openai-completion/_stream' # type: "request" value: |- @@ -26,3 +28,124 @@ value: |- } ] } +alternatives: + - language: Python + code: |- + resp = client.inference.chat_completion_unified( + inference_id="openai-completion", + chat_completion_request={ + "messages": [ + { + "role": "assistant", + "content": "Let's find out what the weather is", + "tool_calls": [ + { + "id": "call_KcAjWtAww20AihPHphUh46Gd", + "type": "function", + "function": { + "name": "get_current_weather", + "arguments": "{\"location\":\"Boston, MA\"}" + } + } + ] + }, + { + "role": "tool", + "content": "The weather is cold", + "tool_call_id": "call_KcAjWtAww20AihPHphUh46Gd" + } + ] + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.chatCompletionUnified({ + inference_id: "openai-completion", + chat_completion_request: { + messages: [ + { + role: "assistant", + content: "Let's find out what the weather is", + tool_calls: [ + { + id: "call_KcAjWtAww20AihPHphUh46Gd", + type: "function", + function: { + name: "get_current_weather", + arguments: '{"location":"Boston, MA"}', + }, + }, + ], + }, + { + role: "tool", + content: "The weather is cold", + tool_call_id: "call_KcAjWtAww20AihPHphUh46Gd", + }, + ], + }, + }); + - language: Ruby + code: |- + response = client.inference.chat_completion_unified( + inference_id: "openai-completion", + body: { + "messages": [ + { + "role": "assistant", + "content": "Let's find out what the weather is", + "tool_calls": [ + { + "id": "call_KcAjWtAww20AihPHphUh46Gd", + "type": "function", + "function": { + "name": "get_current_weather", + "arguments": "{\"location\":\"Boston, MA\"}" + } + } + ] + }, + { + "role": "tool", + "content": "The weather is cold", + "tool_call_id": "call_KcAjWtAww20AihPHphUh46Gd" + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->inference()->chatCompletionUnified([ + "inference_id" => "openai-completion", + "body" => [ + "messages" => array( + [ + "role" => "assistant", + "content" => "Let's find out what the weather is", + "tool_calls" => array( + [ + "id" => "call_KcAjWtAww20AihPHphUh46Gd", + "type" => "function", + "function" => [ + "name" => "get_current_weather", + "arguments" => "{\"location\":\"Boston, MA\"}", + ], + ], + ), + ], + [ + "role" => "tool", + "content" => "The weather is cold", + "tool_call_id" => "call_KcAjWtAww20AihPHphUh46Gd", + ], + ), + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"messages\":[{\"role\":\"assistant\",\"content\":\"Let'\"'\"'s find out what the weather + is\",\"tool_calls\":[{\"id\":\"call_KcAjWtAww20AihPHphUh46Gd\",\"type\":\"function\",\"function\":{\"name\":\"get_current_wea\ + ther\",\"arguments\":\"{\\\"location\\\":\\\"Boston, MA\\\"}\"}}]},{\"role\":\"tool\",\"content\":\"The weather is + cold\",\"tool_call_id\":\"call_KcAjWtAww20AihPHphUh46Gd\"}]}' + \"$ELASTICSEARCH_URL/_inference/chat_completion/openai-completion/_stream\"" diff --git a/specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample3.yaml b/specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample3.yaml index 1eec86dddf..633caa2138 100644 --- a/specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample3.yaml +++ b/specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample3.yaml @@ -1,5 +1,7 @@ summary: A chat completion task with tools and tool_calls -description: Run `POST POST _inference/chat_completion/openai-completion/_stream` to perform a chat completion using a User message with `tools` and `tool_choice`. +description: + Run `POST _inference/chat_completion/openai-completion/_stream` to perform a chat completion using a User message with + `tools` and `tool_choice`. method_request: 'POST _inference/chat_completion/openai-completion/_stream' # type: "request" value: |- @@ -39,3 +41,177 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.inference.chat_completion_unified( + inference_id="openai-completion", + chat_completion_request={ + "messages": [ + { + "role": "user", + "content": [ + { + "type": "text", + "text": "What's the price of a scarf?" + } + ] + } + ], + "tools": [ + { + "type": "function", + "function": { + "name": "get_current_price", + "description": "Get the current price of a item", + "parameters": { + "type": "object", + "properties": { + "item": { + "id": "123" + } + } + } + } + } + ], + "tool_choice": { + "type": "function", + "function": { + "name": "get_current_price" + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.chatCompletionUnified({ + inference_id: "openai-completion", + chat_completion_request: { + messages: [ + { + role: "user", + content: [ + { + type: "text", + text: "What's the price of a scarf?", + }, + ], + }, + ], + tools: [ + { + type: "function", + function: { + name: "get_current_price", + description: "Get the current price of a item", + parameters: { + type: "object", + properties: { + item: { + id: "123", + }, + }, + }, + }, + }, + ], + tool_choice: { + type: "function", + function: { + name: "get_current_price", + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.chat_completion_unified( + inference_id: "openai-completion", + body: { + "messages": [ + { + "role": "user", + "content": [ + { + "type": "text", + "text": "What's the price of a scarf?" + } + ] + } + ], + "tools": [ + { + "type": "function", + "function": { + "name": "get_current_price", + "description": "Get the current price of a item", + "parameters": { + "type": "object", + "properties": { + "item": { + "id": "123" + } + } + } + } + } + ], + "tool_choice": { + "type": "function", + "function": { + "name": "get_current_price" + } + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->chatCompletionUnified([ + "inference_id" => "openai-completion", + "body" => [ + "messages" => array( + [ + "role" => "user", + "content" => array( + [ + "type" => "text", + "text" => "What's the price of a scarf?", + ], + ), + ], + ), + "tools" => array( + [ + "type" => "function", + "function" => [ + "name" => "get_current_price", + "description" => "Get the current price of a item", + "parameters" => [ + "type" => "object", + "properties" => [ + "item" => [ + "id" => "123", + ], + ], + ], + ], + ], + ), + "tool_choice" => [ + "type" => "function", + "function" => [ + "name" => "get_current_price", + ], + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"messages\":[{\"role\":\"user\",\"content\":[{\"type\":\"text\",\"text\":\"What'\"'\"'s the price of a + scarf?\"}]}],\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_current_price\",\"description\":\"Get the current + price of a + item\",\"parameters\":{\"type\":\"object\",\"properties\":{\"item\":{\"id\":\"123\"}}}}}],\"tool_choice\":{\"type\":\"function\ + \",\"function\":{\"name\":\"get_current_price\"}}}' + \"$ELASTICSEARCH_URL/_inference/chat_completion/openai-completion/_stream\"" diff --git a/specification/inference/completion/examples/request/CompletionRequestExample1.yaml b/specification/inference/completion/examples/request/CompletionRequestExample1.yaml index ac5dd76499..4304febca6 100644 --- a/specification/inference/completion/examples/request/CompletionRequestExample1.yaml +++ b/specification/inference/completion/examples/request/CompletionRequestExample1.yaml @@ -6,3 +6,36 @@ value: |- { "input": "What is Elastic?" } +alternatives: + - language: Python + code: |- + resp = client.inference.completion( + inference_id="openai_chat_completions", + input="What is Elastic?", + ) + - language: JavaScript + code: |- + const response = await client.inference.completion({ + inference_id: "openai_chat_completions", + input: "What is Elastic?", + }); + - language: Ruby + code: |- + response = client.inference.completion( + inference_id: "openai_chat_completions", + body: { + "input": "What is Elastic?" + } + ) + - language: PHP + code: |- + $resp = $client->inference()->completion([ + "inference_id" => "openai_chat_completions", + "body" => [ + "input" => "What is Elastic?", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"input":"What is + Elastic?"}'' "$ELASTICSEARCH_URL/_inference/completion/openai_chat_completions"' diff --git a/specification/inference/delete/examples/request/InferenceDeleteExample1.yaml b/specification/inference/delete/examples/request/InferenceDeleteExample1.yaml index 862899b533..c018b74833 100644 --- a/specification/inference/delete/examples/request/InferenceDeleteExample1.yaml +++ b/specification/inference/delete/examples/request/InferenceDeleteExample1.yaml @@ -1 +1,28 @@ method_request: DELETE /_inference/sparse_embedding/my-elser-model +alternatives: + - language: Python + code: |- + resp = client.inference.delete( + task_type="sparse_embedding", + inference_id="my-elser-model", + ) + - language: JavaScript + code: |- + const response = await client.inference.delete({ + task_type: "sparse_embedding", + inference_id: "my-elser-model", + }); + - language: Ruby + code: |- + response = client.inference.delete( + task_type: "sparse_embedding", + inference_id: "my-elser-model" + ) + - language: PHP + code: |- + $resp = $client->inference()->delete([ + "task_type" => "sparse_embedding", + "inference_id" => "my-elser-model", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model"' diff --git a/specification/inference/get/examples/request/InferenceGetExample1.yaml b/specification/inference/get/examples/request/InferenceGetExample1.yaml index de31182d50..422256a532 100644 --- a/specification/inference/get/examples/request/InferenceGetExample1.yaml +++ b/specification/inference/get/examples/request/InferenceGetExample1.yaml @@ -1 +1,28 @@ method_request: GET _inference/sparse_embedding/my-elser-model +alternatives: + - language: Python + code: |- + resp = client.inference.get( + task_type="sparse_embedding", + inference_id="my-elser-model", + ) + - language: JavaScript + code: |- + const response = await client.inference.get({ + task_type: "sparse_embedding", + inference_id: "my-elser-model", + }); + - language: Ruby + code: |- + response = client.inference.get( + task_type: "sparse_embedding", + inference_id: "my-elser-model" + ) + - language: PHP + code: |- + $resp = $client->inference()->get([ + "task_type" => "sparse_embedding", + "inference_id" => "my-elser-model", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model"' diff --git a/specification/inference/put/examples/request/InferencePutExample1.yaml b/specification/inference/put/examples/request/InferencePutExample1.yaml index c83f09194e..5b818e6517 100644 --- a/specification/inference/put/examples/request/InferencePutExample1.yaml +++ b/specification/inference/put/examples/request/InferencePutExample1.yaml @@ -8,3 +8,61 @@ value: |- "api_key": "{{COHERE_API_KEY}}" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="rerank", + inference_id="my-rerank-model", + inference_config={ + "service": "cohere", + "service_settings": { + "model_id": "rerank-english-v3.0", + "api_key": "{{COHERE_API_KEY}}" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "rerank", + inference_id: "my-rerank-model", + inference_config: { + service: "cohere", + service_settings: { + model_id: "rerank-english-v3.0", + api_key: "{{COHERE_API_KEY}}", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "rerank", + inference_id: "my-rerank-model", + body: { + "service": "cohere", + "service_settings": { + "model_id": "rerank-english-v3.0", + "api_key": "{{COHERE_API_KEY}}" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "rerank", + "inference_id" => "my-rerank-model", + "body" => [ + "service" => "cohere", + "service_settings" => [ + "model_id" => "rerank-english-v3.0", + "api_key" => "{{COHERE_API_KEY}}", + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"service":"cohere","service_settings":{"model_id":"rerank-english-v3.0","api_key":"{{COHERE_API_KEY}}"}}'' + "$ELASTICSEARCH_URL/_inference/rerank/my-rerank-model"' diff --git a/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample1.yaml b/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample1.yaml index 4017d885b7..93ce05ce0a 100644 --- a/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample1.yaml +++ b/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample1.yaml @@ -12,3 +12,70 @@ value: |- "workspace" : "default" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="completion", + inference_id="alibabacloud_ai_search_completion", + inference_config={ + "service": "alibabacloud-ai-search", + "service_settings": { + "host": "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", + "api_key": "AlibabaCloud-API-Key", + "service_id": "ops-qwen-turbo", + "workspace": "default" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "completion", + inference_id: "alibabacloud_ai_search_completion", + inference_config: { + service: "alibabacloud-ai-search", + service_settings: { + host: "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", + api_key: "AlibabaCloud-API-Key", + service_id: "ops-qwen-turbo", + workspace: "default", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "completion", + inference_id: "alibabacloud_ai_search_completion", + body: { + "service": "alibabacloud-ai-search", + "service_settings": { + "host": "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", + "api_key": "AlibabaCloud-API-Key", + "service_id": "ops-qwen-turbo", + "workspace": "default" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "completion", + "inference_id" => "alibabacloud_ai_search_completion", + "body" => [ + "service" => "alibabacloud-ai-search", + "service_settings" => [ + "host" => "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", + "api_key" => "AlibabaCloud-API-Key", + "service_id" => "ops-qwen-turbo", + "workspace" => "default", + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"service\":\"alibabacloud-ai-search\",\"service_settings\":{\"host\":\"default-j01.platform-cn-shanghai.opensearch.aliyunc\ + s.com\",\"api_key\":\"AlibabaCloud-API-Key\",\"service_id\":\"ops-qwen-turbo\",\"workspace\":\"default\"}}' + \"$ELASTICSEARCH_URL/_inference/completion/alibabacloud_ai_search_completion\"" diff --git a/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample2.yaml b/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample2.yaml index d18f3f263c..63ed71cbf8 100644 --- a/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample2.yaml +++ b/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample2.yaml @@ -12,3 +12,70 @@ value: |- "workspace": "default" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="rerank", + inference_id="alibabacloud_ai_search_rerank", + inference_config={ + "service": "alibabacloud-ai-search", + "service_settings": { + "api_key": "AlibabaCloud-API-Key", + "service_id": "ops-bge-reranker-larger", + "host": "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", + "workspace": "default" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "rerank", + inference_id: "alibabacloud_ai_search_rerank", + inference_config: { + service: "alibabacloud-ai-search", + service_settings: { + api_key: "AlibabaCloud-API-Key", + service_id: "ops-bge-reranker-larger", + host: "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", + workspace: "default", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "rerank", + inference_id: "alibabacloud_ai_search_rerank", + body: { + "service": "alibabacloud-ai-search", + "service_settings": { + "api_key": "AlibabaCloud-API-Key", + "service_id": "ops-bge-reranker-larger", + "host": "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", + "workspace": "default" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "rerank", + "inference_id" => "alibabacloud_ai_search_rerank", + "body" => [ + "service" => "alibabacloud-ai-search", + "service_settings" => [ + "api_key" => "AlibabaCloud-API-Key", + "service_id" => "ops-bge-reranker-larger", + "host" => "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", + "workspace" => "default", + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"service\":\"alibabacloud-ai-search\",\"service_settings\":{\"api_key\":\"AlibabaCloud-API-Key\",\"service_id\":\"ops-bge-\ + reranker-larger\",\"host\":\"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\"workspace\":\"default\"}}' + \"$ELASTICSEARCH_URL/_inference/rerank/alibabacloud_ai_search_rerank\"" diff --git a/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample3.yaml b/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample3.yaml index ca603ba397..7e439d067f 100644 --- a/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample3.yaml +++ b/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample3.yaml @@ -1,5 +1,7 @@ summary: A sparse embedding task -description: Run `PUT _inference/sparse_embedding/alibabacloud_ai_search_sparse` to create an inference endpoint that performs perform a sparse embedding task. +description: + Run `PUT _inference/sparse_embedding/alibabacloud_ai_search_sparse` to create an inference endpoint that performs + perform a sparse embedding task. method_request: 'PUT _inference/sparse_embedding/alibabacloud_ai_search_sparse' # type: "request" value: |- @@ -12,3 +14,70 @@ value: |- "workspace": "default" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="sparse_embedding", + inference_id="alibabacloud_ai_search_sparse", + inference_config={ + "service": "alibabacloud-ai-search", + "service_settings": { + "api_key": "AlibabaCloud-API-Key", + "service_id": "ops-text-sparse-embedding-001", + "host": "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", + "workspace": "default" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "sparse_embedding", + inference_id: "alibabacloud_ai_search_sparse", + inference_config: { + service: "alibabacloud-ai-search", + service_settings: { + api_key: "AlibabaCloud-API-Key", + service_id: "ops-text-sparse-embedding-001", + host: "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", + workspace: "default", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "sparse_embedding", + inference_id: "alibabacloud_ai_search_sparse", + body: { + "service": "alibabacloud-ai-search", + "service_settings": { + "api_key": "AlibabaCloud-API-Key", + "service_id": "ops-text-sparse-embedding-001", + "host": "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", + "workspace": "default" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "sparse_embedding", + "inference_id" => "alibabacloud_ai_search_sparse", + "body" => [ + "service" => "alibabacloud-ai-search", + "service_settings" => [ + "api_key" => "AlibabaCloud-API-Key", + "service_id" => "ops-text-sparse-embedding-001", + "host" => "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", + "workspace" => "default", + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"service\":\"alibabacloud-ai-search\",\"service_settings\":{\"api_key\":\"AlibabaCloud-API-Key\",\"service_id\":\"ops-text\ + -sparse-embedding-001\",\"host\":\"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\"workspace\":\"default\"}}' + \"$ELASTICSEARCH_URL/_inference/sparse_embedding/alibabacloud_ai_search_sparse\"" diff --git a/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample4.yaml b/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample4.yaml index 6a2df159e0..07fa5493e7 100644 --- a/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample4.yaml +++ b/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample4.yaml @@ -1,5 +1,7 @@ summary: A text embedding task -description: Run `PUT _inference/text_embedding/alibabacloud_ai_search_embeddings` to create an inference endpoint that performs a text embedding task. +description: + Run `PUT _inference/text_embedding/alibabacloud_ai_search_embeddings` to create an inference endpoint that performs a + text embedding task. method_request: 'PUT _inference/text_embedding/alibabacloud_ai_search_embeddings' # type: "request" value: |- @@ -12,3 +14,70 @@ value: |- "workspace": "default" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="text_embedding", + inference_id="alibabacloud_ai_search_embeddings", + inference_config={ + "service": "alibabacloud-ai-search", + "service_settings": { + "api_key": "AlibabaCloud-API-Key", + "service_id": "ops-text-embedding-001", + "host": "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", + "workspace": "default" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "text_embedding", + inference_id: "alibabacloud_ai_search_embeddings", + inference_config: { + service: "alibabacloud-ai-search", + service_settings: { + api_key: "AlibabaCloud-API-Key", + service_id: "ops-text-embedding-001", + host: "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", + workspace: "default", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "text_embedding", + inference_id: "alibabacloud_ai_search_embeddings", + body: { + "service": "alibabacloud-ai-search", + "service_settings": { + "api_key": "AlibabaCloud-API-Key", + "service_id": "ops-text-embedding-001", + "host": "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", + "workspace": "default" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "text_embedding", + "inference_id" => "alibabacloud_ai_search_embeddings", + "body" => [ + "service" => "alibabacloud-ai-search", + "service_settings" => [ + "api_key" => "AlibabaCloud-API-Key", + "service_id" => "ops-text-embedding-001", + "host" => "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", + "workspace" => "default", + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"service\":\"alibabacloud-ai-search\",\"service_settings\":{\"api_key\":\"AlibabaCloud-API-Key\",\"service_id\":\"ops-text\ + -embedding-001\",\"host\":\"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\"workspace\":\"default\"}}' + \"$ELASTICSEARCH_URL/_inference/text_embedding/alibabacloud_ai_search_embeddings\"" diff --git a/specification/inference/put_amazonbedrock/examples/request/PutAmazonBedrockRequestExample1.yaml b/specification/inference/put_amazonbedrock/examples/request/PutAmazonBedrockRequestExample1.yaml index ee1b144b94..f18d206d4a 100644 --- a/specification/inference/put_amazonbedrock/examples/request/PutAmazonBedrockRequestExample1.yaml +++ b/specification/inference/put_amazonbedrock/examples/request/PutAmazonBedrockRequestExample1.yaml @@ -13,3 +13,74 @@ value: |- "model": "amazon.titan-embed-text-v2:0" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="text_embedding", + inference_id="amazon_bedrock_embeddings", + inference_config={ + "service": "amazonbedrock", + "service_settings": { + "access_key": "AWS-access-key", + "secret_key": "AWS-secret-key", + "region": "us-east-1", + "provider": "amazontitan", + "model": "amazon.titan-embed-text-v2:0" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "text_embedding", + inference_id: "amazon_bedrock_embeddings", + inference_config: { + service: "amazonbedrock", + service_settings: { + access_key: "AWS-access-key", + secret_key: "AWS-secret-key", + region: "us-east-1", + provider: "amazontitan", + model: "amazon.titan-embed-text-v2:0", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "text_embedding", + inference_id: "amazon_bedrock_embeddings", + body: { + "service": "amazonbedrock", + "service_settings": { + "access_key": "AWS-access-key", + "secret_key": "AWS-secret-key", + "region": "us-east-1", + "provider": "amazontitan", + "model": "amazon.titan-embed-text-v2:0" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "text_embedding", + "inference_id" => "amazon_bedrock_embeddings", + "body" => [ + "service" => "amazonbedrock", + "service_settings" => [ + "access_key" => "AWS-access-key", + "secret_key" => "AWS-secret-key", + "region" => "us-east-1", + "provider" => "amazontitan", + "model" => "amazon.titan-embed-text-v2:0", + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"service\":\"amazonbedrock\",\"service_settings\":{\"access_key\":\"AWS-access-key\",\"secret_key\":\"AWS-secret-key\",\"r\ + egion\":\"us-east-1\",\"provider\":\"amazontitan\",\"model\":\"amazon.titan-embed-text-v2:0\"}}' + \"$ELASTICSEARCH_URL/_inference/text_embedding/amazon_bedrock_embeddings\"" diff --git a/specification/inference/put_amazonbedrock/examples/request/PutAmazonBedrockRequestExample2.yaml b/specification/inference/put_amazonbedrock/examples/request/PutAmazonBedrockRequestExample2.yaml index 336aa336c4..99cdfbcb3d 100644 --- a/specification/inference/put_amazonbedrock/examples/request/PutAmazonBedrockRequestExample2.yaml +++ b/specification/inference/put_amazonbedrock/examples/request/PutAmazonBedrockRequestExample2.yaml @@ -10,3 +10,61 @@ value: |- "model_id": "gpt-3.5-turbo" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="completion", + inference_id="openai-completion", + inference_config={ + "service": "openai", + "service_settings": { + "api_key": "OpenAI-API-Key", + "model_id": "gpt-3.5-turbo" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "completion", + inference_id: "openai-completion", + inference_config: { + service: "openai", + service_settings: { + api_key: "OpenAI-API-Key", + model_id: "gpt-3.5-turbo", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "completion", + inference_id: "openai-completion", + body: { + "service": "openai", + "service_settings": { + "api_key": "OpenAI-API-Key", + "model_id": "gpt-3.5-turbo" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "completion", + "inference_id" => "openai-completion", + "body" => [ + "service" => "openai", + "service_settings" => [ + "api_key" => "OpenAI-API-Key", + "model_id" => "gpt-3.5-turbo", + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"service":"openai","service_settings":{"api_key":"OpenAI-API-Key","model_id":"gpt-3.5-turbo"}}'' + "$ELASTICSEARCH_URL/_inference/completion/openai-completion"' diff --git a/specification/inference/put_anthropic/examples/request/PutAnthropicRequestExample1.yaml b/specification/inference/put_anthropic/examples/request/PutAnthropicRequestExample1.yaml index a5dad49066..53346f1711 100644 --- a/specification/inference/put_anthropic/examples/request/PutAnthropicRequestExample1.yaml +++ b/specification/inference/put_anthropic/examples/request/PutAnthropicRequestExample1.yaml @@ -13,3 +13,73 @@ value: |- "max_tokens": 1024 } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="completion", + inference_id="anthropic_completion", + inference_config={ + "service": "anthropic", + "service_settings": { + "api_key": "Anthropic-Api-Key", + "model_id": "Model-ID" + }, + "task_settings": { + "max_tokens": 1024 + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "completion", + inference_id: "anthropic_completion", + inference_config: { + service: "anthropic", + service_settings: { + api_key: "Anthropic-Api-Key", + model_id: "Model-ID", + }, + task_settings: { + max_tokens: 1024, + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "completion", + inference_id: "anthropic_completion", + body: { + "service": "anthropic", + "service_settings": { + "api_key": "Anthropic-Api-Key", + "model_id": "Model-ID" + }, + "task_settings": { + "max_tokens": 1024 + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "completion", + "inference_id" => "anthropic_completion", + "body" => [ + "service" => "anthropic", + "service_settings" => [ + "api_key" => "Anthropic-Api-Key", + "model_id" => "Model-ID", + ], + "task_settings" => [ + "max_tokens" => 1024, + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"service\":\"anthropic\",\"service_settings\":{\"api_key\":\"Anthropic-Api-Key\",\"model_id\":\"Model-ID\"},\"task_settings\ + \":{\"max_tokens\":1024}}' \"$ELASTICSEARCH_URL/_inference/completion/anthropic_completion\"" diff --git a/specification/inference/put_azureaistudio/examples/request/PutAzureAiStudioRequestExample1.yaml b/specification/inference/put_azureaistudio/examples/request/PutAzureAiStudioRequestExample1.yaml index a1a2a220dd..be721776bb 100644 --- a/specification/inference/put_azureaistudio/examples/request/PutAzureAiStudioRequestExample1.yaml +++ b/specification/inference/put_azureaistudio/examples/request/PutAzureAiStudioRequestExample1.yaml @@ -1,5 +1,7 @@ summary: A text embedding task -description: Run `PUT _inference/text_embedding/azure_ai_studio_embeddings` to create an inference endpoint that performs a text_embedding task. Note that you do not specify a model here, as it is defined already in the Azure AI Studio deployment. +description: + Run `PUT _inference/text_embedding/azure_ai_studio_embeddings` to create an inference endpoint that performs a + text_embedding task. Note that you do not specify a model here, as it is defined already in the Azure AI Studio deployment. method_request: 'PUT _inference/text_embedding/azure_ai_studio_embeddings' # type: "request" value: |- @@ -12,3 +14,69 @@ value: |- "endpoint_type": "token" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="text_embedding", + inference_id="azure_ai_studio_embeddings", + inference_config={ + "service": "azureaistudio", + "service_settings": { + "api_key": "Azure-AI-Studio-API-key", + "target": "Target-Uri", + "provider": "openai", + "endpoint_type": "token" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "text_embedding", + inference_id: "azure_ai_studio_embeddings", + inference_config: { + service: "azureaistudio", + service_settings: { + api_key: "Azure-AI-Studio-API-key", + target: "Target-Uri", + provider: "openai", + endpoint_type: "token", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "text_embedding", + inference_id: "azure_ai_studio_embeddings", + body: { + "service": "azureaistudio", + "service_settings": { + "api_key": "Azure-AI-Studio-API-key", + "target": "Target-Uri", + "provider": "openai", + "endpoint_type": "token" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "text_embedding", + "inference_id" => "azure_ai_studio_embeddings", + "body" => [ + "service" => "azureaistudio", + "service_settings" => [ + "api_key" => "Azure-AI-Studio-API-key", + "target" => "Target-Uri", + "provider" => "openai", + "endpoint_type" => "token", + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"service\":\"azureaistudio\",\"service_settings\":{\"api_key\":\"Azure-AI-Studio-API-key\",\"target\":\"Target-Uri\",\"pro\ + vider\":\"openai\",\"endpoint_type\":\"token\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/azure_ai_studio_embeddings\"" diff --git a/specification/inference/put_azureaistudio/examples/request/PutAzureAiStudioRequestExample2.yaml b/specification/inference/put_azureaistudio/examples/request/PutAzureAiStudioRequestExample2.yaml index a76c643459..4594b35f0c 100644 --- a/specification/inference/put_azureaistudio/examples/request/PutAzureAiStudioRequestExample2.yaml +++ b/specification/inference/put_azureaistudio/examples/request/PutAzureAiStudioRequestExample2.yaml @@ -12,3 +12,70 @@ value: |- "endpoint_type": "realtime" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="completion", + inference_id="azure_ai_studio_completion", + inference_config={ + "service": "azureaistudio", + "service_settings": { + "api_key": "Azure-AI-Studio-API-key", + "target": "Target-URI", + "provider": "databricks", + "endpoint_type": "realtime" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "completion", + inference_id: "azure_ai_studio_completion", + inference_config: { + service: "azureaistudio", + service_settings: { + api_key: "Azure-AI-Studio-API-key", + target: "Target-URI", + provider: "databricks", + endpoint_type: "realtime", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "completion", + inference_id: "azure_ai_studio_completion", + body: { + "service": "azureaistudio", + "service_settings": { + "api_key": "Azure-AI-Studio-API-key", + "target": "Target-URI", + "provider": "databricks", + "endpoint_type": "realtime" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "completion", + "inference_id" => "azure_ai_studio_completion", + "body" => [ + "service" => "azureaistudio", + "service_settings" => [ + "api_key" => "Azure-AI-Studio-API-key", + "target" => "Target-URI", + "provider" => "databricks", + "endpoint_type" => "realtime", + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"service\":\"azureaistudio\",\"service_settings\":{\"api_key\":\"Azure-AI-Studio-API-key\",\"target\":\"Target-URI\",\"pro\ + vider\":\"databricks\",\"endpoint_type\":\"realtime\"}}' + \"$ELASTICSEARCH_URL/_inference/completion/azure_ai_studio_completion\"" diff --git a/specification/inference/put_azureopenai/examples/request/PutAzureOpenAiRequestExample1.yaml b/specification/inference/put_azureopenai/examples/request/PutAzureOpenAiRequestExample1.yaml index f27a5e06a5..b4b5c39234 100644 --- a/specification/inference/put_azureopenai/examples/request/PutAzureOpenAiRequestExample1.yaml +++ b/specification/inference/put_azureopenai/examples/request/PutAzureOpenAiRequestExample1.yaml @@ -1,5 +1,7 @@ summary: A text embedding task -description: Run `PUT _inference/text_embedding/azure_openai_embeddings` to create an inference endpoint that performs a `text_embedding` task. You do not specify a model, as it is defined already in the Azure OpenAI deployment. +description: + Run `PUT _inference/text_embedding/azure_openai_embeddings` to create an inference endpoint that performs a + `text_embedding` task. You do not specify a model, as it is defined already in the Azure OpenAI deployment. method_request: 'PUT _inference/text_embedding/azure_openai_embeddings' # type: "request" value: |- @@ -12,3 +14,70 @@ value: |- "api_version": "2024-02-01" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="text_embedding", + inference_id="azure_openai_embeddings", + inference_config={ + "service": "azureopenai", + "service_settings": { + "api_key": "Api-Key", + "resource_name": "Resource-name", + "deployment_id": "Deployment-id", + "api_version": "2024-02-01" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "text_embedding", + inference_id: "azure_openai_embeddings", + inference_config: { + service: "azureopenai", + service_settings: { + api_key: "Api-Key", + resource_name: "Resource-name", + deployment_id: "Deployment-id", + api_version: "2024-02-01", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "text_embedding", + inference_id: "azure_openai_embeddings", + body: { + "service": "azureopenai", + "service_settings": { + "api_key": "Api-Key", + "resource_name": "Resource-name", + "deployment_id": "Deployment-id", + "api_version": "2024-02-01" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "text_embedding", + "inference_id" => "azure_openai_embeddings", + "body" => [ + "service" => "azureopenai", + "service_settings" => [ + "api_key" => "Api-Key", + "resource_name" => "Resource-name", + "deployment_id" => "Deployment-id", + "api_version" => "2024-02-01", + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"service\":\"azureopenai\",\"service_settings\":{\"api_key\":\"Api-Key\",\"resource_name\":\"Resource-name\",\"deployment_\ + id\":\"Deployment-id\",\"api_version\":\"2024-02-01\"}}' + \"$ELASTICSEARCH_URL/_inference/text_embedding/azure_openai_embeddings\"" diff --git a/specification/inference/put_azureopenai/examples/request/PutAzureOpenAiRequestExample2.yaml b/specification/inference/put_azureopenai/examples/request/PutAzureOpenAiRequestExample2.yaml index 552769a778..e3fa91cf1e 100644 --- a/specification/inference/put_azureopenai/examples/request/PutAzureOpenAiRequestExample2.yaml +++ b/specification/inference/put_azureopenai/examples/request/PutAzureOpenAiRequestExample2.yaml @@ -12,3 +12,69 @@ value: |- "api_version": "2024-02-01" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="completion", + inference_id="azure_openai_completion", + inference_config={ + "service": "azureopenai", + "service_settings": { + "api_key": "Api-Key", + "resource_name": "Resource-name", + "deployment_id": "Deployment-id", + "api_version": "2024-02-01" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "completion", + inference_id: "azure_openai_completion", + inference_config: { + service: "azureopenai", + service_settings: { + api_key: "Api-Key", + resource_name: "Resource-name", + deployment_id: "Deployment-id", + api_version: "2024-02-01", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "completion", + inference_id: "azure_openai_completion", + body: { + "service": "azureopenai", + "service_settings": { + "api_key": "Api-Key", + "resource_name": "Resource-name", + "deployment_id": "Deployment-id", + "api_version": "2024-02-01" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "completion", + "inference_id" => "azure_openai_completion", + "body" => [ + "service" => "azureopenai", + "service_settings" => [ + "api_key" => "Api-Key", + "resource_name" => "Resource-name", + "deployment_id" => "Deployment-id", + "api_version" => "2024-02-01", + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"service\":\"azureopenai\",\"service_settings\":{\"api_key\":\"Api-Key\",\"resource_name\":\"Resource-name\",\"deployment_\ + id\":\"Deployment-id\",\"api_version\":\"2024-02-01\"}}' \"$ELASTICSEARCH_URL/_inference/completion/azure_openai_completion\"" diff --git a/specification/inference/put_cohere/examples/request/PutCohereRequestExample1.yaml b/specification/inference/put_cohere/examples/request/PutCohereRequestExample1.yaml index 354199916e..2990b43a93 100644 --- a/specification/inference/put_cohere/examples/request/PutCohereRequestExample1.yaml +++ b/specification/inference/put_cohere/examples/request/PutCohereRequestExample1.yaml @@ -11,3 +11,65 @@ value: |- "embedding_type": "byte" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="text_embedding", + inference_id="cohere-embeddings", + inference_config={ + "service": "cohere", + "service_settings": { + "api_key": "Cohere-Api-key", + "model_id": "embed-english-light-v3.0", + "embedding_type": "byte" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "text_embedding", + inference_id: "cohere-embeddings", + inference_config: { + service: "cohere", + service_settings: { + api_key: "Cohere-Api-key", + model_id: "embed-english-light-v3.0", + embedding_type: "byte", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "text_embedding", + inference_id: "cohere-embeddings", + body: { + "service": "cohere", + "service_settings": { + "api_key": "Cohere-Api-key", + "model_id": "embed-english-light-v3.0", + "embedding_type": "byte" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "text_embedding", + "inference_id" => "cohere-embeddings", + "body" => [ + "service" => "cohere", + "service_settings" => [ + "api_key" => "Cohere-Api-key", + "model_id" => "embed-english-light-v3.0", + "embedding_type" => "byte", + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"service\":\"cohere\",\"service_settings\":{\"api_key\":\"Cohere-Api-key\",\"model_id\":\"embed-english-light-v3.0\",\"emb\ + edding_type\":\"byte\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/cohere-embeddings\"" diff --git a/specification/inference/put_cohere/examples/request/PutCohereRequestExample2.yaml b/specification/inference/put_cohere/examples/request/PutCohereRequestExample2.yaml index 85d67c6525..3035c3b40a 100644 --- a/specification/inference/put_cohere/examples/request/PutCohereRequestExample2.yaml +++ b/specification/inference/put_cohere/examples/request/PutCohereRequestExample2.yaml @@ -14,3 +14,77 @@ value: |- "return_documents": true } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="rerank", + inference_id="cohere-rerank", + inference_config={ + "service": "cohere", + "service_settings": { + "api_key": "Cohere-API-key", + "model_id": "rerank-english-v3.0" + }, + "task_settings": { + "top_n": 10, + "return_documents": True + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "rerank", + inference_id: "cohere-rerank", + inference_config: { + service: "cohere", + service_settings: { + api_key: "Cohere-API-key", + model_id: "rerank-english-v3.0", + }, + task_settings: { + top_n: 10, + return_documents: true, + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "rerank", + inference_id: "cohere-rerank", + body: { + "service": "cohere", + "service_settings": { + "api_key": "Cohere-API-key", + "model_id": "rerank-english-v3.0" + }, + "task_settings": { + "top_n": 10, + "return_documents": true + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "rerank", + "inference_id" => "cohere-rerank", + "body" => [ + "service" => "cohere", + "service_settings" => [ + "api_key" => "Cohere-API-key", + "model_id" => "rerank-english-v3.0", + ], + "task_settings" => [ + "top_n" => 10, + "return_documents" => true, + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"service\":\"cohere\",\"service_settings\":{\"api_key\":\"Cohere-API-key\",\"model_id\":\"rerank-english-v3.0\"},\"task_se\ + ttings\":{\"top_n\":10,\"return_documents\":true}}' \"$ELASTICSEARCH_URL/_inference/rerank/cohere-rerank\"" diff --git a/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample1.yaml b/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample1.yaml index 30057af2f6..105fd418be 100644 --- a/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample1.yaml +++ b/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample1.yaml @@ -1,5 +1,8 @@ summary: ELSER sparse embedding task -description: Run `PUT _inference/sparse_embedding/my-elser-model` to create an inference endpoint that performs a `sparse_embedding` task. The `model_id` must be the ID of one of the built-in ELSER models. The API will automatically download the ELSER model if it isn't already downloaded and then deploy the model. +description: + Run `PUT _inference/sparse_embedding/my-elser-model` to create an inference endpoint that performs a `sparse_embedding` + task. The `model_id` must be the ID of one of the built-in ELSER models. The API will automatically download the ELSER model if it + isn't already downloaded and then deploy the model. method_request: 'PUT _inference/sparse_embedding/my-elser-model' # type: "request" value: |- @@ -15,3 +18,82 @@ value: |- "model_id": ".elser_model_2" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="sparse_embedding", + inference_id="my-elser-model", + inference_config={ + "service": "elasticsearch", + "service_settings": { + "adaptive_allocations": { + "enabled": True, + "min_number_of_allocations": 1, + "max_number_of_allocations": 4 + }, + "num_threads": 1, + "model_id": ".elser_model_2" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "sparse_embedding", + inference_id: "my-elser-model", + inference_config: { + service: "elasticsearch", + service_settings: { + adaptive_allocations: { + enabled: true, + min_number_of_allocations: 1, + max_number_of_allocations: 4, + }, + num_threads: 1, + model_id: ".elser_model_2", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "sparse_embedding", + inference_id: "my-elser-model", + body: { + "service": "elasticsearch", + "service_settings": { + "adaptive_allocations": { + "enabled": true, + "min_number_of_allocations": 1, + "max_number_of_allocations": 4 + }, + "num_threads": 1, + "model_id": ".elser_model_2" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "sparse_embedding", + "inference_id" => "my-elser-model", + "body" => [ + "service" => "elasticsearch", + "service_settings" => [ + "adaptive_allocations" => [ + "enabled" => true, + "min_number_of_allocations" => 1, + "max_number_of_allocations" => 4, + ], + "num_threads" => 1, + "model_id" => ".elser_model_2", + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"service\":\"elasticsearch\",\"service_settings\":{\"adaptive_allocations\":{\"enabled\":true,\"min_number_of_allocations\ + \":1,\"max_number_of_allocations\":4},\"num_threads\":1,\"model_id\":\".elser_model_2\"}}' + \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"" diff --git a/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample2.yaml b/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample2.yaml index 3875dbc60c..eec3d07a89 100644 --- a/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample2.yaml +++ b/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample2.yaml @@ -1,5 +1,9 @@ summary: Elastic rerank task -description: Run `PUT _inference/rerank/my-elastic-rerank` to create an inference endpoint that performs a rerank task using the built-in Elastic Rerank cross-encoder model. The `model_id` must be `.rerank-v1`, which is the ID of the built-in Elastic Rerank model. The API will automatically download the Elastic Rerank model if it isn't already downloaded and then deploy the model. Once deployed, the model can be used for semantic re-ranking with a `text_similarity_reranker` retriever. +description: + Run `PUT _inference/rerank/my-elastic-rerank` to create an inference endpoint that performs a rerank task using the + built-in Elastic Rerank cross-encoder model. The `model_id` must be `.rerank-v1`, which is the ID of the built-in Elastic Rerank + model. The API will automatically download the Elastic Rerank model if it isn't already downloaded and then deploy the model. Once + deployed, the model can be used for semantic re-ranking with a `text_similarity_reranker` retriever. method_request: 'PUT _inference/rerank/my-elastic-rerank' # type: "request" value: |- @@ -15,3 +19,82 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="rerank", + inference_id="my-elastic-rerank", + inference_config={ + "service": "elasticsearch", + "service_settings": { + "model_id": ".rerank-v1", + "num_threads": 1, + "adaptive_allocations": { + "enabled": True, + "min_number_of_allocations": 1, + "max_number_of_allocations": 4 + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "rerank", + inference_id: "my-elastic-rerank", + inference_config: { + service: "elasticsearch", + service_settings: { + model_id: ".rerank-v1", + num_threads: 1, + adaptive_allocations: { + enabled: true, + min_number_of_allocations: 1, + max_number_of_allocations: 4, + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "rerank", + inference_id: "my-elastic-rerank", + body: { + "service": "elasticsearch", + "service_settings": { + "model_id": ".rerank-v1", + "num_threads": 1, + "adaptive_allocations": { + "enabled": true, + "min_number_of_allocations": 1, + "max_number_of_allocations": 4 + } + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "rerank", + "inference_id" => "my-elastic-rerank", + "body" => [ + "service" => "elasticsearch", + "service_settings" => [ + "model_id" => ".rerank-v1", + "num_threads" => 1, + "adaptive_allocations" => [ + "enabled" => true, + "min_number_of_allocations" => 1, + "max_number_of_allocations" => 4, + ], + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"service\":\"elasticsearch\",\"service_settings\":{\"model_id\":\".rerank-v1\",\"num_threads\":1,\"adaptive_allocations\":{\ + \"enabled\":true,\"min_number_of_allocations\":1,\"max_number_of_allocations\":4}}}' + \"$ELASTICSEARCH_URL/_inference/rerank/my-elastic-rerank\"" diff --git a/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample3.yaml b/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample3.yaml index 18108df6dc..593d3cc393 100644 --- a/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample3.yaml +++ b/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample3.yaml @@ -1,5 +1,8 @@ summary: E5 text embedding task -description: Run `PUT _inference/text_embedding/my-e5-model` to create an inference endpoint that performs a `text_embedding` task. The `model_id` must be the ID of one of the built-in E5 models. The API will automatically download the E5 model if it isn't already downloaded and then deploy the model. +description: + Run `PUT _inference/text_embedding/my-e5-model` to create an inference endpoint that performs a `text_embedding` task. + The `model_id` must be the ID of one of the built-in E5 models. The API will automatically download the E5 model if it isn't + already downloaded and then deploy the model. method_request: 'PUT _inference/text_embedding/my-e5-model' # type: "request" value: |- @@ -11,3 +14,65 @@ value: |- "model_id": ".multilingual-e5-small" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="text_embedding", + inference_id="my-e5-model", + inference_config={ + "service": "elasticsearch", + "service_settings": { + "num_allocations": 1, + "num_threads": 1, + "model_id": ".multilingual-e5-small" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "text_embedding", + inference_id: "my-e5-model", + inference_config: { + service: "elasticsearch", + service_settings: { + num_allocations: 1, + num_threads: 1, + model_id: ".multilingual-e5-small", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "text_embedding", + inference_id: "my-e5-model", + body: { + "service": "elasticsearch", + "service_settings": { + "num_allocations": 1, + "num_threads": 1, + "model_id": ".multilingual-e5-small" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "text_embedding", + "inference_id" => "my-e5-model", + "body" => [ + "service" => "elasticsearch", + "service_settings" => [ + "num_allocations" => 1, + "num_threads" => 1, + "model_id" => ".multilingual-e5-small", + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"service\":\"elasticsearch\",\"service_settings\":{\"num_allocations\":1,\"num_threads\":1,\"model_id\":\".multilingual-e5\ + -small\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/my-e5-model\"" diff --git a/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample4.yaml b/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample4.yaml index 938fc8a903..d2213417ca 100644 --- a/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample4.yaml +++ b/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample4.yaml @@ -1,5 +1,7 @@ summary: Eland text embedding task -description: Run `PUT _inference/text_embedding/my-msmarco-minilm-model` to create an inference endpoint that performs a `text_embedding` task with a model that was uploaded by Eland. +description: + Run `PUT _inference/text_embedding/my-msmarco-minilm-model` to create an inference endpoint that performs a + `text_embedding` task with a model that was uploaded by Eland. method_request: 'PUT _inference/text_embedding/my-msmarco-minilm-model' # type: "request" value: |- @@ -11,3 +13,65 @@ value: |- "model_id": "msmarco-MiniLM-L12-cos-v5" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="text_embedding", + inference_id="my-msmarco-minilm-model", + inference_config={ + "service": "elasticsearch", + "service_settings": { + "num_allocations": 1, + "num_threads": 1, + "model_id": "msmarco-MiniLM-L12-cos-v5" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "text_embedding", + inference_id: "my-msmarco-minilm-model", + inference_config: { + service: "elasticsearch", + service_settings: { + num_allocations: 1, + num_threads: 1, + model_id: "msmarco-MiniLM-L12-cos-v5", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "text_embedding", + inference_id: "my-msmarco-minilm-model", + body: { + "service": "elasticsearch", + "service_settings": { + "num_allocations": 1, + "num_threads": 1, + "model_id": "msmarco-MiniLM-L12-cos-v5" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "text_embedding", + "inference_id" => "my-msmarco-minilm-model", + "body" => [ + "service" => "elasticsearch", + "service_settings" => [ + "num_allocations" => 1, + "num_threads" => 1, + "model_id" => "msmarco-MiniLM-L12-cos-v5", + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"service\":\"elasticsearch\",\"service_settings\":{\"num_allocations\":1,\"num_threads\":1,\"model_id\":\"msmarco-MiniLM-L\ + 12-cos-v5\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/my-msmarco-minilm-model\"" diff --git a/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample5.yaml b/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample5.yaml index 990cb17889..8fbfba7152 100644 --- a/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample5.yaml +++ b/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample5.yaml @@ -1,5 +1,8 @@ summary: Adaptive allocation -description: Run `PUT _inference/text_embedding/my-e5-model` to create an inference endpoint that performs a `text_embedding` task and to configure adaptive allocations. The API request will automatically download the E5 model if it isn't already downloaded and then deploy the model. +description: + Run `PUT _inference/text_embedding/my-e5-model` to create an inference endpoint that performs a `text_embedding` task + and to configure adaptive allocations. The API request will automatically download the E5 model if it isn't already downloaded and + then deploy the model. method_request: 'PUT _inference/text_embedding/my-e5-model' # type: "request" value: |- @@ -15,3 +18,82 @@ value: |- "model_id": ".multilingual-e5-small" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="text_embedding", + inference_id="my-e5-model", + inference_config={ + "service": "elasticsearch", + "service_settings": { + "adaptive_allocations": { + "enabled": True, + "min_number_of_allocations": 3, + "max_number_of_allocations": 10 + }, + "num_threads": 1, + "model_id": ".multilingual-e5-small" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "text_embedding", + inference_id: "my-e5-model", + inference_config: { + service: "elasticsearch", + service_settings: { + adaptive_allocations: { + enabled: true, + min_number_of_allocations: 3, + max_number_of_allocations: 10, + }, + num_threads: 1, + model_id: ".multilingual-e5-small", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "text_embedding", + inference_id: "my-e5-model", + body: { + "service": "elasticsearch", + "service_settings": { + "adaptive_allocations": { + "enabled": true, + "min_number_of_allocations": 3, + "max_number_of_allocations": 10 + }, + "num_threads": 1, + "model_id": ".multilingual-e5-small" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "text_embedding", + "inference_id" => "my-e5-model", + "body" => [ + "service" => "elasticsearch", + "service_settings" => [ + "adaptive_allocations" => [ + "enabled" => true, + "min_number_of_allocations" => 3, + "max_number_of_allocations" => 10, + ], + "num_threads" => 1, + "model_id" => ".multilingual-e5-small", + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"service\":\"elasticsearch\",\"service_settings\":{\"adaptive_allocations\":{\"enabled\":true,\"min_number_of_allocations\ + \":3,\"max_number_of_allocations\":10},\"num_threads\":1,\"model_id\":\".multilingual-e5-small\"}}' + \"$ELASTICSEARCH_URL/_inference/text_embedding/my-e5-model\"" diff --git a/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample6.yaml b/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample6.yaml index 5c21091543..398627a34d 100644 --- a/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample6.yaml +++ b/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample6.yaml @@ -1,5 +1,7 @@ summary: Existing model deployment -description: Run `PUT _inference/sparse_embedding/use_existing_deployment` to use an already existing model deployment when creating an inference endpoint. +description: + Run `PUT _inference/sparse_embedding/use_existing_deployment` to use an already existing model deployment when creating + an inference endpoint. method_request: 'PUT _inference/sparse_embedding/use_existing_deployment' # type: "request" value: |- @@ -9,3 +11,57 @@ value: |- "deployment_id": ".elser_model_2" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="sparse_embedding", + inference_id="use_existing_deployment", + inference_config={ + "service": "elasticsearch", + "service_settings": { + "deployment_id": ".elser_model_2" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "sparse_embedding", + inference_id: "use_existing_deployment", + inference_config: { + service: "elasticsearch", + service_settings: { + deployment_id: ".elser_model_2", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "sparse_embedding", + inference_id: "use_existing_deployment", + body: { + "service": "elasticsearch", + "service_settings": { + "deployment_id": ".elser_model_2" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "sparse_embedding", + "inference_id" => "use_existing_deployment", + "body" => [ + "service" => "elasticsearch", + "service_settings" => [ + "deployment_id" => ".elser_model_2", + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"service":"elasticsearch","service_settings":{"deployment_id":".elser_model_2"}}'' + "$ELASTICSEARCH_URL/_inference/sparse_embedding/use_existing_deployment"' diff --git a/specification/inference/put_elser/examples/request/PutElserRequestExample1.yaml b/specification/inference/put_elser/examples/request/PutElserRequestExample1.yaml index baa986c172..c8242a8ab8 100644 --- a/specification/inference/put_elser/examples/request/PutElserRequestExample1.yaml +++ b/specification/inference/put_elser/examples/request/PutElserRequestExample1.yaml @@ -1,5 +1,7 @@ summary: A sparse embedding task -description: Run `PUT _inference/sparse_embedding/my-elser-model` to create an inference endpoint that performs a `sparse_embedding` task. The request will automatically download the ELSER model if it isn't already downloaded and then deploy the model. +description: + Run `PUT _inference/sparse_embedding/my-elser-model` to create an inference endpoint that performs a `sparse_embedding` + task. The request will automatically download the ELSER model if it isn't already downloaded and then deploy the model. method_request: 'PUT _inference/sparse_embedding/my-elser-model' # type: "request" value: |- @@ -10,3 +12,61 @@ value: |- "num_threads": 1 } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="sparse_embedding", + inference_id="my-elser-model", + inference_config={ + "service": "elser", + "service_settings": { + "num_allocations": 1, + "num_threads": 1 + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "sparse_embedding", + inference_id: "my-elser-model", + inference_config: { + service: "elser", + service_settings: { + num_allocations: 1, + num_threads: 1, + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "sparse_embedding", + inference_id: "my-elser-model", + body: { + "service": "elser", + "service_settings": { + "num_allocations": 1, + "num_threads": 1 + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "sparse_embedding", + "inference_id" => "my-elser-model", + "body" => [ + "service" => "elser", + "service_settings" => [ + "num_allocations" => 1, + "num_threads" => 1, + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"service":"elser","service_settings":{"num_allocations":1,"num_threads":1}}'' + "$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model"' diff --git a/specification/inference/put_elser/examples/request/PutElserRequestExample2.yaml b/specification/inference/put_elser/examples/request/PutElserRequestExample2.yaml index 13d3813f64..f5063dd420 100644 --- a/specification/inference/put_elser/examples/request/PutElserRequestExample2.yaml +++ b/specification/inference/put_elser/examples/request/PutElserRequestExample2.yaml @@ -1,5 +1,8 @@ summary: Adaptive allocations -description: Run `PUT _inference/sparse_embedding/my-elser-model` to create an inference endpoint that performs a `sparse_embedding` task with adaptive allocations. When adaptive allocations are enabled, the number of allocations of the model is set automatically based on the current load. +description: + Run `PUT _inference/sparse_embedding/my-elser-model` to create an inference endpoint that performs a `sparse_embedding` + task with adaptive allocations. When adaptive allocations are enabled, the number of allocations of the model is set automatically + based on the current load. method_request: 'PUT _inference/sparse_embedding/my-elser-model' # type: "request" value: |- @@ -14,3 +17,77 @@ value: |- "num_threads": 1 } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="sparse_embedding", + inference_id="my-elser-model", + inference_config={ + "service": "elser", + "service_settings": { + "adaptive_allocations": { + "enabled": True, + "min_number_of_allocations": 3, + "max_number_of_allocations": 10 + }, + "num_threads": 1 + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "sparse_embedding", + inference_id: "my-elser-model", + inference_config: { + service: "elser", + service_settings: { + adaptive_allocations: { + enabled: true, + min_number_of_allocations: 3, + max_number_of_allocations: 10, + }, + num_threads: 1, + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "sparse_embedding", + inference_id: "my-elser-model", + body: { + "service": "elser", + "service_settings": { + "adaptive_allocations": { + "enabled": true, + "min_number_of_allocations": 3, + "max_number_of_allocations": 10 + }, + "num_threads": 1 + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "sparse_embedding", + "inference_id" => "my-elser-model", + "body" => [ + "service" => "elser", + "service_settings" => [ + "adaptive_allocations" => [ + "enabled" => true, + "min_number_of_allocations" => 3, + "max_number_of_allocations" => 10, + ], + "num_threads" => 1, + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"service\":\"elser\",\"service_settings\":{\"adaptive_allocations\":{\"enabled\":true,\"min_number_of_allocations\":3,\"ma\ + x_number_of_allocations\":10},\"num_threads\":1}}' \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"" diff --git a/specification/inference/put_googleaistudio/examples/request/PutGoogleAiStudioRequestExample1.yaml b/specification/inference/put_googleaistudio/examples/request/PutGoogleAiStudioRequestExample1.yaml index 3b5b79bb64..e31af536cf 100644 --- a/specification/inference/put_googleaistudio/examples/request/PutGoogleAiStudioRequestExample1.yaml +++ b/specification/inference/put_googleaistudio/examples/request/PutGoogleAiStudioRequestExample1.yaml @@ -10,3 +10,61 @@ value: |- "model_id": "model-id" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="completion", + inference_id="google_ai_studio_completion", + inference_config={ + "service": "googleaistudio", + "service_settings": { + "api_key": "api-key", + "model_id": "model-id" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "completion", + inference_id: "google_ai_studio_completion", + inference_config: { + service: "googleaistudio", + service_settings: { + api_key: "api-key", + model_id: "model-id", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "completion", + inference_id: "google_ai_studio_completion", + body: { + "service": "googleaistudio", + "service_settings": { + "api_key": "api-key", + "model_id": "model-id" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "completion", + "inference_id" => "google_ai_studio_completion", + "body" => [ + "service" => "googleaistudio", + "service_settings" => [ + "api_key" => "api-key", + "model_id" => "model-id", + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"service":"googleaistudio","service_settings":{"api_key":"api-key","model_id":"model-id"}}'' + "$ELASTICSEARCH_URL/_inference/completion/google_ai_studio_completion"' diff --git a/specification/inference/put_googlevertexai/examples/request/PutGoogleVertexAiRequestExample1.yaml b/specification/inference/put_googlevertexai/examples/request/PutGoogleVertexAiRequestExample1.yaml index 62e712c195..2a782d4de4 100644 --- a/specification/inference/put_googlevertexai/examples/request/PutGoogleVertexAiRequestExample1.yaml +++ b/specification/inference/put_googlevertexai/examples/request/PutGoogleVertexAiRequestExample1.yaml @@ -1,5 +1,7 @@ summary: A text embedding task -description: Run `PUT _inference/text_embedding/google_vertex_ai_embeddings` to create an inference endpoint to perform a `text_embedding` task type. +description: + Run `PUT _inference/text_embedding/google_vertex_ai_embeddings` to create an inference endpoint to perform a + `text_embedding` task type. method_request: 'PUT _inference/text_embedding/google_vertex_ai_embeddingss' # type: "request" value: |- @@ -12,3 +14,70 @@ value: |- "project_id": "project-id" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="text_embedding", + inference_id="google_vertex_ai_embeddingss", + inference_config={ + "service": "googlevertexai", + "service_settings": { + "service_account_json": "service-account-json", + "model_id": "model-id", + "location": "location", + "project_id": "project-id" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "text_embedding", + inference_id: "google_vertex_ai_embeddingss", + inference_config: { + service: "googlevertexai", + service_settings: { + service_account_json: "service-account-json", + model_id: "model-id", + location: "location", + project_id: "project-id", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "text_embedding", + inference_id: "google_vertex_ai_embeddingss", + body: { + "service": "googlevertexai", + "service_settings": { + "service_account_json": "service-account-json", + "model_id": "model-id", + "location": "location", + "project_id": "project-id" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "text_embedding", + "inference_id" => "google_vertex_ai_embeddingss", + "body" => [ + "service" => "googlevertexai", + "service_settings" => [ + "service_account_json" => "service-account-json", + "model_id" => "model-id", + "location" => "location", + "project_id" => "project-id", + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"service\":\"googlevertexai\",\"service_settings\":{\"service_account_json\":\"service-account-json\",\"model_id\":\"model\ + -id\",\"location\":\"location\",\"project_id\":\"project-id\"}}' + \"$ELASTICSEARCH_URL/_inference/text_embedding/google_vertex_ai_embeddingss\"" diff --git a/specification/inference/put_googlevertexai/examples/request/PutGoogleVertexAiRequestExample2.yaml b/specification/inference/put_googlevertexai/examples/request/PutGoogleVertexAiRequestExample2.yaml index a8d2ed5806..1211e7bbd2 100644 --- a/specification/inference/put_googlevertexai/examples/request/PutGoogleVertexAiRequestExample2.yaml +++ b/specification/inference/put_googlevertexai/examples/request/PutGoogleVertexAiRequestExample2.yaml @@ -10,3 +10,61 @@ value: |- "project_id": "project-id" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="rerank", + inference_id="google_vertex_ai_rerank", + inference_config={ + "service": "googlevertexai", + "service_settings": { + "service_account_json": "service-account-json", + "project_id": "project-id" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "rerank", + inference_id: "google_vertex_ai_rerank", + inference_config: { + service: "googlevertexai", + service_settings: { + service_account_json: "service-account-json", + project_id: "project-id", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "rerank", + inference_id: "google_vertex_ai_rerank", + body: { + "service": "googlevertexai", + "service_settings": { + "service_account_json": "service-account-json", + "project_id": "project-id" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "rerank", + "inference_id" => "google_vertex_ai_rerank", + "body" => [ + "service" => "googlevertexai", + "service_settings" => [ + "service_account_json" => "service-account-json", + "project_id" => "project-id", + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"service\":\"googlevertexai\",\"service_settings\":{\"service_account_json\":\"service-account-json\",\"project_id\":\"pro\ + ject-id\"}}' \"$ELASTICSEARCH_URL/_inference/rerank/google_vertex_ai_rerank\"" diff --git a/specification/inference/put_hugging_face/examples/request/PutHuggingFaceRequestExample1.yaml b/specification/inference/put_hugging_face/examples/request/PutHuggingFaceRequestExample1.yaml index 903369c661..02529ad83a 100644 --- a/specification/inference/put_hugging_face/examples/request/PutHuggingFaceRequestExample1.yaml +++ b/specification/inference/put_hugging_face/examples/request/PutHuggingFaceRequestExample1.yaml @@ -1,5 +1,7 @@ summary: A text embedding task -description: Run `PUT _inference/text_embedding/hugging-face-embeddings` to create an inference endpoint that performs a `text_embedding` task type. +description: + Run `PUT _inference/text_embedding/hugging-face-embeddings` to create an inference endpoint that performs a + `text_embedding` task type. method_request: 'PUT _inference/text_embedding/hugging-face-embeddings' # type: "request" value: |- @@ -10,3 +12,61 @@ value: |- "url": "url-endpoint" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="text_embedding", + inference_id="hugging-face-embeddings", + inference_config={ + "service": "hugging_face", + "service_settings": { + "api_key": "hugging-face-access-token", + "url": "url-endpoint" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "text_embedding", + inference_id: "hugging-face-embeddings", + inference_config: { + service: "hugging_face", + service_settings: { + api_key: "hugging-face-access-token", + url: "url-endpoint", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "text_embedding", + inference_id: "hugging-face-embeddings", + body: { + "service": "hugging_face", + "service_settings": { + "api_key": "hugging-face-access-token", + "url": "url-endpoint" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "text_embedding", + "inference_id" => "hugging-face-embeddings", + "body" => [ + "service" => "hugging_face", + "service_settings" => [ + "api_key" => "hugging-face-access-token", + "url" => "url-endpoint", + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"service":"hugging_face","service_settings":{"api_key":"hugging-face-access-token","url":"url-endpoint"}}'' + "$ELASTICSEARCH_URL/_inference/text_embedding/hugging-face-embeddings"' diff --git a/specification/inference/put_jinaai/examples/request/PutJinaAiRequestExample1.yaml b/specification/inference/put_jinaai/examples/request/PutJinaAiRequestExample1.yaml index 9f4515d638..82f6291b1a 100644 --- a/specification/inference/put_jinaai/examples/request/PutJinaAiRequestExample1.yaml +++ b/specification/inference/put_jinaai/examples/request/PutJinaAiRequestExample1.yaml @@ -1,5 +1,7 @@ summary: A text embedding task -description: Run `PUT _inference/text_embedding/jinaai-embeddings` to create an inference endpoint for text embedding tasks using the JinaAI service. +description: + Run `PUT _inference/text_embedding/jinaai-embeddings` to create an inference endpoint for text embedding tasks using + the JinaAI service. method_request: 'PUT _inference/text_embedding/jinaai-embeddings' # type: "request" value: |- @@ -10,3 +12,61 @@ value: |- "api_key": "JinaAi-Api-key" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="text_embedding", + inference_id="jinaai-embeddings", + inference_config={ + "service": "jinaai", + "service_settings": { + "model_id": "jina-embeddings-v3", + "api_key": "JinaAi-Api-key" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "text_embedding", + inference_id: "jinaai-embeddings", + inference_config: { + service: "jinaai", + service_settings: { + model_id: "jina-embeddings-v3", + api_key: "JinaAi-Api-key", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "text_embedding", + inference_id: "jinaai-embeddings", + body: { + "service": "jinaai", + "service_settings": { + "model_id": "jina-embeddings-v3", + "api_key": "JinaAi-Api-key" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "text_embedding", + "inference_id" => "jinaai-embeddings", + "body" => [ + "service" => "jinaai", + "service_settings" => [ + "model_id" => "jina-embeddings-v3", + "api_key" => "JinaAi-Api-key", + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"service":"jinaai","service_settings":{"model_id":"jina-embeddings-v3","api_key":"JinaAi-Api-key"}}'' + "$ELASTICSEARCH_URL/_inference/text_embedding/jinaai-embeddings"' diff --git a/specification/inference/put_jinaai/examples/request/PutJinaAiRequestExample2.yaml b/specification/inference/put_jinaai/examples/request/PutJinaAiRequestExample2.yaml index d48c6a76d2..f68cd18cb0 100644 --- a/specification/inference/put_jinaai/examples/request/PutJinaAiRequestExample2.yaml +++ b/specification/inference/put_jinaai/examples/request/PutJinaAiRequestExample2.yaml @@ -14,3 +14,77 @@ value: |- "return_documents": true } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="rerank", + inference_id="jinaai-rerank", + inference_config={ + "service": "jinaai", + "service_settings": { + "api_key": "JinaAI-Api-key", + "model_id": "jina-reranker-v2-base-multilingual" + }, + "task_settings": { + "top_n": 10, + "return_documents": True + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "rerank", + inference_id: "jinaai-rerank", + inference_config: { + service: "jinaai", + service_settings: { + api_key: "JinaAI-Api-key", + model_id: "jina-reranker-v2-base-multilingual", + }, + task_settings: { + top_n: 10, + return_documents: true, + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "rerank", + inference_id: "jinaai-rerank", + body: { + "service": "jinaai", + "service_settings": { + "api_key": "JinaAI-Api-key", + "model_id": "jina-reranker-v2-base-multilingual" + }, + "task_settings": { + "top_n": 10, + "return_documents": true + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "rerank", + "inference_id" => "jinaai-rerank", + "body" => [ + "service" => "jinaai", + "service_settings" => [ + "api_key" => "JinaAI-Api-key", + "model_id" => "jina-reranker-v2-base-multilingual", + ], + "task_settings" => [ + "top_n" => 10, + "return_documents" => true, + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"service\":\"jinaai\",\"service_settings\":{\"api_key\":\"JinaAI-Api-key\",\"model_id\":\"jina-reranker-v2-base-multilingu\ + al\"},\"task_settings\":{\"top_n\":10,\"return_documents\":true}}' \"$ELASTICSEARCH_URL/_inference/rerank/jinaai-rerank\"" diff --git a/specification/inference/put_mistral/examples/request/PutMistralRequestExample1.yaml b/specification/inference/put_mistral/examples/request/PutMistralRequestExample1.yaml index 6ffebd9d31..24752de5e7 100644 --- a/specification/inference/put_mistral/examples/request/PutMistralRequestExample1.yaml +++ b/specification/inference/put_mistral/examples/request/PutMistralRequestExample1.yaml @@ -1,5 +1,7 @@ # summary: -description: Run `PUT _inference/text_embedding/mistral-embeddings-test` to create a Mistral inference endpoint that performs a text embedding task. +description: + Run `PUT _inference/text_embedding/mistral-embeddings-test` to create a Mistral inference endpoint that performs a text + embedding task. method_request: 'PUT _inference/text_embedding/mistral-embeddings-test' # type: "request" value: |- @@ -10,3 +12,61 @@ value: |- "model": "mistral-embed" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="text_embedding", + inference_id="mistral-embeddings-test", + inference_config={ + "service": "mistral", + "service_settings": { + "api_key": "Mistral-API-Key", + "model": "mistral-embed" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "text_embedding", + inference_id: "mistral-embeddings-test", + inference_config: { + service: "mistral", + service_settings: { + api_key: "Mistral-API-Key", + model: "mistral-embed", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "text_embedding", + inference_id: "mistral-embeddings-test", + body: { + "service": "mistral", + "service_settings": { + "api_key": "Mistral-API-Key", + "model": "mistral-embed" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "text_embedding", + "inference_id" => "mistral-embeddings-test", + "body" => [ + "service" => "mistral", + "service_settings" => [ + "api_key" => "Mistral-API-Key", + "model" => "mistral-embed", + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"service":"mistral","service_settings":{"api_key":"Mistral-API-Key","model":"mistral-embed"}}'' + "$ELASTICSEARCH_URL/_inference/text_embedding/mistral-embeddings-test"' diff --git a/specification/inference/put_openai/examples/request/PutOpenAiRequestExample1.yaml b/specification/inference/put_openai/examples/request/PutOpenAiRequestExample1.yaml index c74f970519..3ab1bbd26e 100644 --- a/specification/inference/put_openai/examples/request/PutOpenAiRequestExample1.yaml +++ b/specification/inference/put_openai/examples/request/PutOpenAiRequestExample1.yaml @@ -1,5 +1,7 @@ summary: A text embedding task -description: Run `PUT _inference/text_embedding/openai-embeddings` to create an inference endpoint that performs a `text_embedding` task. The embeddings created by requests to this endpoint will have 128 dimensions. +description: + Run `PUT _inference/text_embedding/openai-embeddings` to create an inference endpoint that performs a `text_embedding` + task. The embeddings created by requests to this endpoint will have 128 dimensions. method_request: 'PUT _inference/text_embedding/openai-embeddings' # type: "request" value: |- @@ -11,3 +13,65 @@ value: |- "dimensions": 128 } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="text_embedding", + inference_id="openai-embeddings", + inference_config={ + "service": "openai", + "service_settings": { + "api_key": "OpenAI-API-Key", + "model_id": "text-embedding-3-small", + "dimensions": 128 + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "text_embedding", + inference_id: "openai-embeddings", + inference_config: { + service: "openai", + service_settings: { + api_key: "OpenAI-API-Key", + model_id: "text-embedding-3-small", + dimensions: 128, + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "text_embedding", + inference_id: "openai-embeddings", + body: { + "service": "openai", + "service_settings": { + "api_key": "OpenAI-API-Key", + "model_id": "text-embedding-3-small", + "dimensions": 128 + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "text_embedding", + "inference_id" => "openai-embeddings", + "body" => [ + "service" => "openai", + "service_settings" => [ + "api_key" => "OpenAI-API-Key", + "model_id" => "text-embedding-3-small", + "dimensions" => 128, + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"service\":\"openai\",\"service_settings\":{\"api_key\":\"OpenAI-API-Key\",\"model_id\":\"text-embedding-3-small\",\"dimen\ + sions\":128}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/openai-embeddings\"" diff --git a/specification/inference/put_openai/examples/request/PutOpenAiRequestExample2.yaml b/specification/inference/put_openai/examples/request/PutOpenAiRequestExample2.yaml index 81bbd193f7..33984233a1 100644 --- a/specification/inference/put_openai/examples/request/PutOpenAiRequestExample2.yaml +++ b/specification/inference/put_openai/examples/request/PutOpenAiRequestExample2.yaml @@ -13,3 +13,74 @@ value: |- "model": "amazon.titan-text-premier-v1:0" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="completion", + inference_id="amazon_bedrock_completion", + inference_config={ + "service": "amazonbedrock", + "service_settings": { + "access_key": "AWS-access-key", + "secret_key": "AWS-secret-key", + "region": "us-east-1", + "provider": "amazontitan", + "model": "amazon.titan-text-premier-v1:0" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "completion", + inference_id: "amazon_bedrock_completion", + inference_config: { + service: "amazonbedrock", + service_settings: { + access_key: "AWS-access-key", + secret_key: "AWS-secret-key", + region: "us-east-1", + provider: "amazontitan", + model: "amazon.titan-text-premier-v1:0", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "completion", + inference_id: "amazon_bedrock_completion", + body: { + "service": "amazonbedrock", + "service_settings": { + "access_key": "AWS-access-key", + "secret_key": "AWS-secret-key", + "region": "us-east-1", + "provider": "amazontitan", + "model": "amazon.titan-text-premier-v1:0" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "completion", + "inference_id" => "amazon_bedrock_completion", + "body" => [ + "service" => "amazonbedrock", + "service_settings" => [ + "access_key" => "AWS-access-key", + "secret_key" => "AWS-secret-key", + "region" => "us-east-1", + "provider" => "amazontitan", + "model" => "amazon.titan-text-premier-v1:0", + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"service\":\"amazonbedrock\",\"service_settings\":{\"access_key\":\"AWS-access-key\",\"secret_key\":\"AWS-secret-key\",\"r\ + egion\":\"us-east-1\",\"provider\":\"amazontitan\",\"model\":\"amazon.titan-text-premier-v1:0\"}}' + \"$ELASTICSEARCH_URL/_inference/completion/amazon_bedrock_completion\"" diff --git a/specification/inference/put_voyageai/examples/request/PutVoyageAIRequestExample1.yaml b/specification/inference/put_voyageai/examples/request/PutVoyageAIRequestExample1.yaml index d6690ebde7..acd9cd96ba 100644 --- a/specification/inference/put_voyageai/examples/request/PutVoyageAIRequestExample1.yaml +++ b/specification/inference/put_voyageai/examples/request/PutVoyageAIRequestExample1.yaml @@ -1,5 +1,7 @@ summary: A text embedding task -description: Run `PUT _inference/text_embedding/voyageai-embeddings` to create an inference endpoint that performs a `text_embedding` task. The embeddings created by requests to this endpoint will have 512 dimensions. +description: + Run `PUT _inference/text_embedding/voyageai-embeddings` to create an inference endpoint that performs a + `text_embedding` task. The embeddings created by requests to this endpoint will have 512 dimensions. method_request: 'PUT _inference/text_embedding/openai-embeddings' # type: "request" value: |- @@ -10,3 +12,61 @@ value: |- "dimensions": 512 } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="text_embedding", + inference_id="openai-embeddings", + inference_config={ + "service": "voyageai", + "service_settings": { + "model_id": "voyage-3-large", + "dimensions": 512 + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "text_embedding", + inference_id: "openai-embeddings", + inference_config: { + service: "voyageai", + service_settings: { + model_id: "voyage-3-large", + dimensions: 512, + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "text_embedding", + inference_id: "openai-embeddings", + body: { + "service": "voyageai", + "service_settings": { + "model_id": "voyage-3-large", + "dimensions": 512 + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "text_embedding", + "inference_id" => "openai-embeddings", + "body" => [ + "service" => "voyageai", + "service_settings" => [ + "model_id" => "voyage-3-large", + "dimensions" => 512, + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"service":"voyageai","service_settings":{"model_id":"voyage-3-large","dimensions":512}}'' + "$ELASTICSEARCH_URL/_inference/text_embedding/openai-embeddings"' diff --git a/specification/inference/put_voyageai/examples/request/PutVoyageAIRequestExample2.yaml b/specification/inference/put_voyageai/examples/request/PutVoyageAIRequestExample2.yaml index 976d13478f..563d80a35e 100644 --- a/specification/inference/put_voyageai/examples/request/PutVoyageAIRequestExample2.yaml +++ b/specification/inference/put_voyageai/examples/request/PutVoyageAIRequestExample2.yaml @@ -9,3 +9,57 @@ value: |- "model_id": "rerank-2" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="rerank", + inference_id="voyageai-rerank", + inference_config={ + "service": "voyageai", + "service_settings": { + "model_id": "rerank-2" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "rerank", + inference_id: "voyageai-rerank", + inference_config: { + service: "voyageai", + service_settings: { + model_id: "rerank-2", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "rerank", + inference_id: "voyageai-rerank", + body: { + "service": "voyageai", + "service_settings": { + "model_id": "rerank-2" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "rerank", + "inference_id" => "voyageai-rerank", + "body" => [ + "service" => "voyageai", + "service_settings" => [ + "model_id" => "rerank-2", + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"service":"voyageai","service_settings":{"model_id":"rerank-2"}}'' + "$ELASTICSEARCH_URL/_inference/rerank/voyageai-rerank"' diff --git a/specification/inference/put_watsonx/examples/request/PutWatsonxRequestExample1.yaml b/specification/inference/put_watsonx/examples/request/PutWatsonxRequestExample1.yaml index a488512a57..a9048b28c6 100644 --- a/specification/inference/put_watsonx/examples/request/PutWatsonxRequestExample1.yaml +++ b/specification/inference/put_watsonx/examples/request/PutWatsonxRequestExample1.yaml @@ -13,3 +13,74 @@ value: |- "api_version": "2024-03-14" } } +alternatives: + - language: Python + code: |- + resp = client.inference.put( + task_type="text_embedding", + inference_id="watsonx-embeddings", + inference_config={ + "service": "watsonxai", + "service_settings": { + "api_key": "Watsonx-API-Key", + "url": "Wastonx-URL", + "model_id": "ibm/slate-30m-english-rtrvr", + "project_id": "IBM-Cloud-ID", + "api_version": "2024-03-14" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.put({ + task_type: "text_embedding", + inference_id: "watsonx-embeddings", + inference_config: { + service: "watsonxai", + service_settings: { + api_key: "Watsonx-API-Key", + url: "Wastonx-URL", + model_id: "ibm/slate-30m-english-rtrvr", + project_id: "IBM-Cloud-ID", + api_version: "2024-03-14", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.put( + task_type: "text_embedding", + inference_id: "watsonx-embeddings", + body: { + "service": "watsonxai", + "service_settings": { + "api_key": "Watsonx-API-Key", + "url": "Wastonx-URL", + "model_id": "ibm/slate-30m-english-rtrvr", + "project_id": "IBM-Cloud-ID", + "api_version": "2024-03-14" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->put([ + "task_type" => "text_embedding", + "inference_id" => "watsonx-embeddings", + "body" => [ + "service" => "watsonxai", + "service_settings" => [ + "api_key" => "Watsonx-API-Key", + "url" => "Wastonx-URL", + "model_id" => "ibm/slate-30m-english-rtrvr", + "project_id" => "IBM-Cloud-ID", + "api_version" => "2024-03-14", + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"service\":\"watsonxai\",\"service_settings\":{\"api_key\":\"Watsonx-API-Key\",\"url\":\"Wastonx-URL\",\"model_id\":\"ibm/\ + slate-30m-english-rtrvr\",\"project_id\":\"IBM-Cloud-ID\",\"api_version\":\"2024-03-14\"}}' + \"$ELASTICSEARCH_URL/_inference/text_embedding/watsonx-embeddings\"" diff --git a/specification/inference/rerank/examples/request/RerankRequestExample1.yaml b/specification/inference/rerank/examples/request/RerankRequestExample1.yaml index 56c359a99f..0451903482 100644 --- a/specification/inference/rerank/examples/request/RerankRequestExample1.yaml +++ b/specification/inference/rerank/examples/request/RerankRequestExample1.yaml @@ -7,3 +7,65 @@ value: |- "input": ["luke", "like", "leia", "chewy","r2d2", "star", "wars"], "query": "star wars main character" } +alternatives: + - language: Python + code: |- + resp = client.inference.rerank( + inference_id="cohere_rerank", + input=[ + "luke", + "like", + "leia", + "chewy", + "r2d2", + "star", + "wars" + ], + query="star wars main character", + ) + - language: JavaScript + code: |- + const response = await client.inference.rerank({ + inference_id: "cohere_rerank", + input: ["luke", "like", "leia", "chewy", "r2d2", "star", "wars"], + query: "star wars main character", + }); + - language: Ruby + code: |- + response = client.inference.rerank( + inference_id: "cohere_rerank", + body: { + "input": [ + "luke", + "like", + "leia", + "chewy", + "r2d2", + "star", + "wars" + ], + "query": "star wars main character" + } + ) + - language: PHP + code: |- + $resp = $client->inference()->rerank([ + "inference_id" => "cohere_rerank", + "body" => [ + "input" => array( + "luke", + "like", + "leia", + "chewy", + "r2d2", + "star", + "wars", + ), + "query" => "star wars main character", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"input":["luke","like","leia","chewy","r2d2","star","wars"],"query":"star wars main character"}'' + "$ELASTICSEARCH_URL/_inference/rerank/cohere_rerank"' diff --git a/specification/inference/sparse_embedding/examples/request/SparseEmbeddingRequestExample1.yaml b/specification/inference/sparse_embedding/examples/request/SparseEmbeddingRequestExample1.yaml index 78b349a14e..9680c2c529 100644 --- a/specification/inference/sparse_embedding/examples/request/SparseEmbeddingRequestExample1.yaml +++ b/specification/inference/sparse_embedding/examples/request/SparseEmbeddingRequestExample1.yaml @@ -6,3 +6,38 @@ value: |- { "input": "The sky above the port was the color of television tuned to a dead channel." } +alternatives: + - language: Python + code: |- + resp = client.inference.sparse_embedding( + inference_id="my-elser-model", + input="The sky above the port was the color of television tuned to a dead channel.", + ) + - language: JavaScript + code: |- + const response = await client.inference.sparseEmbedding({ + inference_id: "my-elser-model", + input: + "The sky above the port was the color of television tuned to a dead channel.", + }); + - language: Ruby + code: |- + response = client.inference.sparse_embedding( + inference_id: "my-elser-model", + body: { + "input": "The sky above the port was the color of television tuned to a dead channel." + } + ) + - language: PHP + code: |- + $resp = $client->inference()->sparseEmbedding([ + "inference_id" => "my-elser-model", + "body" => [ + "input" => "The sky above the port was the color of television tuned to a dead channel.", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"input":"The sky + above the port was the color of television tuned to a dead channel."}'' + "$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model"' diff --git a/specification/inference/stream_completion/examples/request/StreamInferenceRequestExample1.yaml b/specification/inference/stream_completion/examples/request/StreamInferenceRequestExample1.yaml index 3066f6f95e..7e4d81acfd 100644 --- a/specification/inference/stream_completion/examples/request/StreamInferenceRequestExample1.yaml +++ b/specification/inference/stream_completion/examples/request/StreamInferenceRequestExample1.yaml @@ -4,3 +4,36 @@ method_request: 'POST _inference/completion/openai-completion/_stream' # type: "request" value: input: 'What is Elastic?' +alternatives: + - language: Python + code: |- + resp = client.inference.stream_completion( + inference_id="openai-completion", + input="What is Elastic?", + ) + - language: JavaScript + code: |- + const response = await client.inference.streamCompletion({ + inference_id: "openai-completion", + input: "What is Elastic?", + }); + - language: Ruby + code: |- + response = client.inference.stream_completion( + inference_id: "openai-completion", + body: { + "input": "What is Elastic?" + } + ) + - language: PHP + code: |- + $resp = $client->inference()->streamCompletion([ + "inference_id" => "openai-completion", + "body" => [ + "input" => "What is Elastic?", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"input":"What is + Elastic?"}'' "$ELASTICSEARCH_URL/_inference/completion/openai-completion/_stream"' diff --git a/specification/inference/text_embedding/examples/request/TextEmbeddingRequestExample1.yaml b/specification/inference/text_embedding/examples/request/TextEmbeddingRequestExample1.yaml index d462d54568..4275802128 100644 --- a/specification/inference/text_embedding/examples/request/TextEmbeddingRequestExample1.yaml +++ b/specification/inference/text_embedding/examples/request/TextEmbeddingRequestExample1.yaml @@ -1,5 +1,7 @@ summary: Text embedding task -description: Run `POST _inference/text_embedding/my-cohere-endpoint` to perform text embedding on the example sentence using the Cohere integration, +description: + Run `POST _inference/text_embedding/my-cohere-endpoint` to perform text embedding on the example sentence using the + Cohere integration, method_request: 'POST _inference/text_embedding/my-cohere-endpoint' # type: "request" value: |- @@ -9,3 +11,50 @@ value: |- "input_type": "ingest" } } +alternatives: + - language: Python + code: |- + resp = client.inference.text_embedding( + inference_id="my-cohere-endpoint", + input="The sky above the port was the color of television tuned to a dead channel.", + task_settings={ + "input_type": "ingest" + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.textEmbedding({ + inference_id: "my-cohere-endpoint", + input: + "The sky above the port was the color of television tuned to a dead channel.", + task_settings: { + input_type: "ingest", + }, + }); + - language: Ruby + code: |- + response = client.inference.text_embedding( + inference_id: "my-cohere-endpoint", + body: { + "input": "The sky above the port was the color of television tuned to a dead channel.", + "task_settings": { + "input_type": "ingest" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->textEmbedding([ + "inference_id" => "my-cohere-endpoint", + "body" => [ + "input" => "The sky above the port was the color of television tuned to a dead channel.", + "task_settings" => [ + "input_type" => "ingest", + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"input":"The sky + above the port was the color of television tuned to a dead channel.","task_settings":{"input_type":"ingest"}}'' + "$ELASTICSEARCH_URL/_inference/text_embedding/my-cohere-endpoint"' diff --git a/specification/inference/update/examples/request/InferenceUpdateExample1.yaml b/specification/inference/update/examples/request/InferenceUpdateExample1.yaml index f986bcb01d..a5c242ae29 100644 --- a/specification/inference/update/examples/request/InferenceUpdateExample1.yaml +++ b/specification/inference/update/examples/request/InferenceUpdateExample1.yaml @@ -6,3 +6,48 @@ value: |- "api_key": "" } } +alternatives: + - language: Python + code: |- + resp = client.inference.update( + inference_id="my-inference-endpoint", + inference_config={ + "service_settings": { + "api_key": "" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.inference.update({ + inference_id: "my-inference-endpoint", + inference_config: { + service_settings: { + api_key: "", + }, + }, + }); + - language: Ruby + code: |- + response = client.inference.update( + inference_id: "my-inference-endpoint", + body: { + "service_settings": { + "api_key": "" + } + } + ) + - language: PHP + code: |- + $resp = $client->inference()->update([ + "inference_id" => "my-inference-endpoint", + "body" => [ + "service_settings" => [ + "api_key" => "", + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"service_settings":{"api_key":""}}'' "$ELASTICSEARCH_URL/_inference/my-inference-endpoint/_update"' diff --git a/specification/ingest/delete_ip_location_database/examples/request/IngestDeleteIpLocationDatabaseExample1.yaml b/specification/ingest/delete_ip_location_database/examples/request/IngestDeleteIpLocationDatabaseExample1.yaml index fcf2258725..b6b9b5ac16 100644 --- a/specification/ingest/delete_ip_location_database/examples/request/IngestDeleteIpLocationDatabaseExample1.yaml +++ b/specification/ingest/delete_ip_location_database/examples/request/IngestDeleteIpLocationDatabaseExample1.yaml @@ -1 +1,24 @@ method_request: DELETE /_ingest/ip_location/database/my-database-id +alternatives: + - language: Python + code: |- + resp = client.ingest.delete_ip_location_database( + id="my-database-id", + ) + - language: JavaScript + code: |- + const response = await client.ingest.deleteIpLocationDatabase({ + id: "my-database-id", + }); + - language: Ruby + code: |- + response = client.ingest.delete_ip_location_database( + id: "my-database-id" + ) + - language: PHP + code: |- + $resp = $client->ingest()->deleteIpLocationDatabase([ + "id" => "my-database-id", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ingest/ip_location/database/my-database-id"' diff --git a/specification/ingest/delete_pipeline/examples/request/IngestDeletePipelineExample1.yaml b/specification/ingest/delete_pipeline/examples/request/IngestDeletePipelineExample1.yaml index 6474f66e49..f2486475f3 100644 --- a/specification/ingest/delete_pipeline/examples/request/IngestDeletePipelineExample1.yaml +++ b/specification/ingest/delete_pipeline/examples/request/IngestDeletePipelineExample1.yaml @@ -1 +1,24 @@ method_request: DELETE /_ingest/pipeline/my-pipeline-id +alternatives: + - language: Python + code: |- + resp = client.ingest.delete_pipeline( + id="my-pipeline-id", + ) + - language: JavaScript + code: |- + const response = await client.ingest.deletePipeline({ + id: "my-pipeline-id", + }); + - language: Ruby + code: |- + response = client.ingest.delete_pipeline( + id: "my-pipeline-id" + ) + - language: PHP + code: |- + $resp = $client->ingest()->deletePipeline([ + "id" => "my-pipeline-id", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ingest/pipeline/my-pipeline-id"' diff --git a/specification/ingest/geo_ip_stats/examples/request/IngestGeoIpStatsExample1.yaml b/specification/ingest/geo_ip_stats/examples/request/IngestGeoIpStatsExample1.yaml index 00e03c8138..e81e4e27f5 100644 --- a/specification/ingest/geo_ip_stats/examples/request/IngestGeoIpStatsExample1.yaml +++ b/specification/ingest/geo_ip_stats/examples/request/IngestGeoIpStatsExample1.yaml @@ -1 +1,12 @@ method_request: GET _ingest/geoip/stats +alternatives: + - language: Python + code: resp = client.ingest.geo_ip_stats() + - language: JavaScript + code: const response = await client.ingest.geoIpStats(); + - language: Ruby + code: response = client.ingest.geo_ip_stats + - language: PHP + code: $resp = $client->ingest()->geoIpStats(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ingest/geoip/stats"' diff --git a/specification/ingest/get_ip_location_database/examples/request/IngestGetIpLocationDatabaseExample1.yaml b/specification/ingest/get_ip_location_database/examples/request/IngestGetIpLocationDatabaseExample1.yaml index f266e00c60..8fad8e7b13 100644 --- a/specification/ingest/get_ip_location_database/examples/request/IngestGetIpLocationDatabaseExample1.yaml +++ b/specification/ingest/get_ip_location_database/examples/request/IngestGetIpLocationDatabaseExample1.yaml @@ -1 +1,24 @@ method_request: GET /_ingest/ip_location/database/my-database-id +alternatives: + - language: Python + code: |- + resp = client.ingest.get_ip_location_database( + id="my-database-id", + ) + - language: JavaScript + code: |- + const response = await client.ingest.getIpLocationDatabase({ + id: "my-database-id", + }); + - language: Ruby + code: |- + response = client.ingest.get_ip_location_database( + id: "my-database-id" + ) + - language: PHP + code: |- + $resp = $client->ingest()->getIpLocationDatabase([ + "id" => "my-database-id", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ingest/ip_location/database/my-database-id"' diff --git a/specification/ingest/get_pipeline/examples/request/IngestGetPipelineExample1.yaml b/specification/ingest/get_pipeline/examples/request/IngestGetPipelineExample1.yaml index 34a3eaeb9e..55cf1bbe3e 100644 --- a/specification/ingest/get_pipeline/examples/request/IngestGetPipelineExample1.yaml +++ b/specification/ingest/get_pipeline/examples/request/IngestGetPipelineExample1.yaml @@ -1 +1,24 @@ method_request: GET /_ingest/pipeline/my-pipeline-id +alternatives: + - language: Python + code: |- + resp = client.ingest.get_pipeline( + id="my-pipeline-id", + ) + - language: JavaScript + code: |- + const response = await client.ingest.getPipeline({ + id: "my-pipeline-id", + }); + - language: Ruby + code: |- + response = client.ingest.get_pipeline( + id: "my-pipeline-id" + ) + - language: PHP + code: |- + $resp = $client->ingest()->getPipeline([ + "id" => "my-pipeline-id", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ingest/pipeline/my-pipeline-id"' diff --git a/specification/ingest/processor_grok/examples/request/IngestProcessorGrokExample1.yaml b/specification/ingest/processor_grok/examples/request/IngestProcessorGrokExample1.yaml index 2ca8dd7a47..e5c8f5689a 100644 --- a/specification/ingest/processor_grok/examples/request/IngestProcessorGrokExample1.yaml +++ b/specification/ingest/processor_grok/examples/request/IngestProcessorGrokExample1.yaml @@ -1 +1,12 @@ method_request: GET _ingest/processor/grok +alternatives: + - language: Python + code: resp = client.ingest.processor_grok() + - language: JavaScript + code: const response = await client.ingest.processorGrok(); + - language: Ruby + code: response = client.ingest.processor_grok + - language: PHP + code: $resp = $client->ingest()->processorGrok(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ingest/processor/grok"' diff --git a/specification/ingest/put_ip_location_database/examples/request/IngestPutIpLocationDatabaseExample1.yaml b/specification/ingest/put_ip_location_database/examples/request/IngestPutIpLocationDatabaseExample1.yaml index 6656b88411..07ae27e7da 100644 --- a/specification/ingest/put_ip_location_database/examples/request/IngestPutIpLocationDatabaseExample1.yaml +++ b/specification/ingest/put_ip_location_database/examples/request/IngestPutIpLocationDatabaseExample1.yaml @@ -7,3 +7,53 @@ value: |- "account_id": "1234567" } } +alternatives: + - language: Python + code: |- + resp = client.ingest.put_ip_location_database( + id="my-database-1", + configuration={ + "name": "GeoIP2-Domain", + "maxmind": { + "account_id": "1234567" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.ingest.putIpLocationDatabase({ + id: "my-database-1", + configuration: { + name: "GeoIP2-Domain", + maxmind: { + account_id: "1234567", + }, + }, + }); + - language: Ruby + code: |- + response = client.ingest.put_ip_location_database( + id: "my-database-1", + body: { + "name": "GeoIP2-Domain", + "maxmind": { + "account_id": "1234567" + } + } + ) + - language: PHP + code: |- + $resp = $client->ingest()->putIpLocationDatabase([ + "id" => "my-database-1", + "body" => [ + "name" => "GeoIP2-Domain", + "maxmind" => [ + "account_id" => "1234567", + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"name":"GeoIP2-Domain","maxmind":{"account_id":"1234567"}}'' + "$ELASTICSEARCH_URL/_ingest/ip_location/database/my-database-1"' diff --git a/specification/ingest/put_pipeline/examples/request/PutPipelineRequestExample1.yaml b/specification/ingest/put_pipeline/examples/request/PutPipelineRequestExample1.yaml index 68f100485d..d70b9b1123 100644 --- a/specification/ingest/put_pipeline/examples/request/PutPipelineRequestExample1.yaml +++ b/specification/ingest/put_pipeline/examples/request/PutPipelineRequestExample1.yaml @@ -2,8 +2,96 @@ summary: Create an ingest pipeline. method_request: PUT _ingest/pipeline/my-pipeline-id # description: '' # type: request -value: - "{\n \"description\" : \"My optional pipeline description\",\n \"processors\"\ - \ : [\n {\n \"set\" : {\n \"description\" : \"My optional processor\ - \ description\",\n \"field\": \"my-keyword-field\",\n \"value\": \"\ - foo\"\n }\n }\n ]\n}" +value: "{ + + \ \"description\" : \"My optional pipeline description\", + + \ \"processors\" : [ + + \ { + + \ \"set\" : { + + \ \"description\" : \"My optional processor description\", + + \ \"field\": \"my-keyword-field\", + + \ \"value\": \"foo\" + + \ } + + \ } + + \ ] + + }" +alternatives: + - language: Python + code: |- + resp = client.ingest.put_pipeline( + id="my-pipeline-id", + description="My optional pipeline description", + processors=[ + { + "set": { + "description": "My optional processor description", + "field": "my-keyword-field", + "value": "foo" + } + } + ], + ) + - language: JavaScript + code: |- + const response = await client.ingest.putPipeline({ + id: "my-pipeline-id", + description: "My optional pipeline description", + processors: [ + { + set: { + description: "My optional processor description", + field: "my-keyword-field", + value: "foo", + }, + }, + ], + }); + - language: Ruby + code: |- + response = client.ingest.put_pipeline( + id: "my-pipeline-id", + body: { + "description": "My optional pipeline description", + "processors": [ + { + "set": { + "description": "My optional processor description", + "field": "my-keyword-field", + "value": "foo" + } + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->ingest()->putPipeline([ + "id" => "my-pipeline-id", + "body" => [ + "description" => "My optional pipeline description", + "processors" => array( + [ + "set" => [ + "description" => "My optional processor description", + "field" => "my-keyword-field", + "value" => "foo", + ], + ], + ), + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"description":"My + optional pipeline description","processors":[{"set":{"description":"My optional processor + description","field":"my-keyword-field","value":"foo"}}]}'' "$ELASTICSEARCH_URL/_ingest/pipeline/my-pipeline-id"' diff --git a/specification/ingest/put_pipeline/examples/request/PutPipelineRequestExample2.yaml b/specification/ingest/put_pipeline/examples/request/PutPipelineRequestExample2.yaml index c7c68c7142..5539ea104e 100644 --- a/specification/ingest/put_pipeline/examples/request/PutPipelineRequestExample2.yaml +++ b/specification/ingest/put_pipeline/examples/request/PutPipelineRequestExample2.yaml @@ -2,10 +2,139 @@ summary: Create an ingest pipeline with metadata. method_request: PUT /_ingest/pipeline/my-pipeline-id description: You can use the `_meta` parameter to add arbitrary metadata to a pipeline. # type: request -value: - "{\n \"description\" : \"My optional pipeline description\",\n \"processors\"\ - \ : [\n {\n \"set\" : {\n \"description\" : \"My optional processor\ - \ description\",\n \"field\": \"my-keyword-field\",\n \"value\": \"\ - foo\"\n }\n }\n ],\n \"_meta\": {\n \"reason\": \"set my-keyword-field\ - \ to foo\",\n \"serialization\": {\n \"class\": \"MyPipeline\",\n \"\ - id\": 10\n }\n }\n}" +value: "{ + + \ \"description\" : \"My optional pipeline description\", + + \ \"processors\" : [ + + \ { + + \ \"set\" : { + + \ \"description\" : \"My optional processor description\", + + \ \"field\": \"my-keyword-field\", + + \ \"value\": \"foo\" + + \ } + + \ } + + \ ], + + \ \"_meta\": { + + \ \"reason\": \"set my-keyword-field to foo\", + + \ \"serialization\": { + + \ \"class\": \"MyPipeline\", + + \ \"id\": 10 + + \ } + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.ingest.put_pipeline( + id="my-pipeline-id", + description="My optional pipeline description", + processors=[ + { + "set": { + "description": "My optional processor description", + "field": "my-keyword-field", + "value": "foo" + } + } + ], + meta={ + "reason": "set my-keyword-field to foo", + "serialization": { + "class": "MyPipeline", + "id": 10 + } + }, + ) + - language: JavaScript + code: |- + const response = await client.ingest.putPipeline({ + id: "my-pipeline-id", + description: "My optional pipeline description", + processors: [ + { + set: { + description: "My optional processor description", + field: "my-keyword-field", + value: "foo", + }, + }, + ], + meta: { + reason: "set my-keyword-field to foo", + serialization: { + class: "MyPipeline", + id: 10, + }, + }, + }); + - language: Ruby + code: |- + response = client.ingest.put_pipeline( + id: "my-pipeline-id", + body: { + "description": "My optional pipeline description", + "processors": [ + { + "set": { + "description": "My optional processor description", + "field": "my-keyword-field", + "value": "foo" + } + } + ], + "_meta": { + "reason": "set my-keyword-field to foo", + "serialization": { + "class": "MyPipeline", + "id": 10 + } + } + } + ) + - language: PHP + code: |- + $resp = $client->ingest()->putPipeline([ + "id" => "my-pipeline-id", + "body" => [ + "description" => "My optional pipeline description", + "processors" => array( + [ + "set" => [ + "description" => "My optional processor description", + "field" => "my-keyword-field", + "value" => "foo", + ], + ], + ), + "_meta" => [ + "reason" => "set my-keyword-field to foo", + "serialization" => [ + "class" => "MyPipeline", + "id" => 10, + ], + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"description":"My + optional pipeline description","processors":[{"set":{"description":"My optional processor + description","field":"my-keyword-field","value":"foo"}}],"_meta":{"reason":"set my-keyword-field to + foo","serialization":{"class":"MyPipeline","id":10}}}'' "$ELASTICSEARCH_URL/_ingest/pipeline/my-pipeline-id"' diff --git a/specification/ingest/simulate/examples/request/SimulatePipelineRequestExample1.yaml b/specification/ingest/simulate/examples/request/SimulatePipelineRequestExample1.yaml index fd83bba49e..992ddf78d4 100644 --- a/specification/ingest/simulate/examples/request/SimulatePipelineRequestExample1.yaml +++ b/specification/ingest/simulate/examples/request/SimulatePipelineRequestExample1.yaml @@ -2,11 +2,197 @@ summary: Run an ingest pipeline against a set of provided documents. method_request: POST /_ingest/pipeline/_simulate description: You can specify the used pipeline either in the request body or as a path parameter. # type: request -value: - "{\n \"pipeline\" :\n {\n \"description\": \"_description\",\n \"processors\"\ - : [\n {\n \"set\" : {\n \"field\" : \"field2\",\n \ - \ \"value\" : \"_value\"\n }\n }\n ]\n },\n \"docs\": [\n {\n\ - \ \"_index\": \"index\",\n \"_id\": \"id\",\n \"_source\": {\n \ - \ \"foo\": \"bar\"\n }\n },\n {\n \"_index\": \"index\",\n\ - \ \"_id\": \"id\",\n \"_source\": {\n \"foo\": \"rab\"\n }\n\ - \ }\n ]\n}" +value: "{ + + \ \"pipeline\" : + + \ { + + \ \"description\": \"_description\", + + \ \"processors\": [ + + \ { + + \ \"set\" : { + + \ \"field\" : \"field2\", + + \ \"value\" : \"_value\" + + \ } + + \ } + + \ ] + + \ }, + + \ \"docs\": [ + + \ { + + \ \"_index\": \"index\", + + \ \"_id\": \"id\", + + \ \"_source\": { + + \ \"foo\": \"bar\" + + \ } + + \ }, + + \ { + + \ \"_index\": \"index\", + + \ \"_id\": \"id\", + + \ \"_source\": { + + \ \"foo\": \"rab\" + + \ } + + \ } + + \ ] + + }" +alternatives: + - language: Python + code: |- + resp = client.ingest.simulate( + pipeline={ + "description": "_description", + "processors": [ + { + "set": { + "field": "field2", + "value": "_value" + } + } + ] + }, + docs=[ + { + "_index": "index", + "_id": "id", + "_source": { + "foo": "bar" + } + }, + { + "_index": "index", + "_id": "id", + "_source": { + "foo": "rab" + } + } + ], + ) + - language: JavaScript + code: |- + const response = await client.ingest.simulate({ + pipeline: { + description: "_description", + processors: [ + { + set: { + field: "field2", + value: "_value", + }, + }, + ], + }, + docs: [ + { + _index: "index", + _id: "id", + _source: { + foo: "bar", + }, + }, + { + _index: "index", + _id: "id", + _source: { + foo: "rab", + }, + }, + ], + }); + - language: Ruby + code: |- + response = client.ingest.simulate( + body: { + "pipeline": { + "description": "_description", + "processors": [ + { + "set": { + "field": "field2", + "value": "_value" + } + } + ] + }, + "docs": [ + { + "_index": "index", + "_id": "id", + "_source": { + "foo": "bar" + } + }, + { + "_index": "index", + "_id": "id", + "_source": { + "foo": "rab" + } + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->ingest()->simulate([ + "body" => [ + "pipeline" => [ + "description" => "_description", + "processors" => array( + [ + "set" => [ + "field" => "field2", + "value" => "_value", + ], + ], + ), + ], + "docs" => array( + [ + "_index" => "index", + "_id" => "id", + "_source" => [ + "foo" => "bar", + ], + ], + [ + "_index" => "index", + "_id" => "id", + "_source" => [ + "foo" => "rab", + ], + ], + ), + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"pipeline\":{\"description\":\"_description\",\"processors\":[{\"set\":{\"field\":\"field2\",\"value\":\"_value\"}}]},\"do\ + cs\":[{\"_index\":\"index\",\"_id\":\"id\",\"_source\":{\"foo\":\"bar\"}},{\"_index\":\"index\",\"_id\":\"id\",\"_source\":{\ + \"foo\":\"rab\"}}]}' \"$ELASTICSEARCH_URL/_ingest/pipeline/_simulate\"" diff --git a/specification/license/delete/examples/request/LicenseDeleteExample1.yaml b/specification/license/delete/examples/request/LicenseDeleteExample1.yaml index 9051d299cd..c1611f8255 100644 --- a/specification/license/delete/examples/request/LicenseDeleteExample1.yaml +++ b/specification/license/delete/examples/request/LicenseDeleteExample1.yaml @@ -1 +1,12 @@ method_request: DELETE /_license +alternatives: + - language: Python + code: resp = client.license.delete() + - language: JavaScript + code: const response = await client.license.delete(); + - language: Ruby + code: response = client.license.delete + - language: PHP + code: $resp = $client->license()->delete(); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_license"' diff --git a/specification/license/get/examples/request/GetLicenseRequestExample1.yaml b/specification/license/get/examples/request/GetLicenseRequestExample1.yaml index a05a5fbabe..53c3e2040e 100644 --- a/specification/license/get/examples/request/GetLicenseRequestExample1.yaml +++ b/specification/license/get/examples/request/GetLicenseRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET /_license +alternatives: + - language: Python + code: resp = client.license.get() + - language: JavaScript + code: const response = await client.license.get(); + - language: Ruby + code: response = client.license.get + - language: PHP + code: $resp = $client->license()->get(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_license"' diff --git a/specification/license/get_basic_status/examples/request/GetBasicLicenseStatusRequestExample1.yaml b/specification/license/get_basic_status/examples/request/GetBasicLicenseStatusRequestExample1.yaml index 5b13e6709d..b9bb57bff2 100644 --- a/specification/license/get_basic_status/examples/request/GetBasicLicenseStatusRequestExample1.yaml +++ b/specification/license/get_basic_status/examples/request/GetBasicLicenseStatusRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET /_license/basic_status +alternatives: + - language: Python + code: resp = client.license.get_basic_status() + - language: JavaScript + code: const response = await client.license.getBasicStatus(); + - language: Ruby + code: response = client.license.get_basic_status + - language: PHP + code: $resp = $client->license()->getBasicStatus(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_license/basic_status"' diff --git a/specification/license/get_trial_status/examples/request/GetTrialLicenseStatusRequestExample1.yaml b/specification/license/get_trial_status/examples/request/GetTrialLicenseStatusRequestExample1.yaml index b43a0b4c02..352f690ecf 100644 --- a/specification/license/get_trial_status/examples/request/GetTrialLicenseStatusRequestExample1.yaml +++ b/specification/license/get_trial_status/examples/request/GetTrialLicenseStatusRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET /_license/trial_status +alternatives: + - language: Python + code: resp = client.license.get_trial_status() + - language: JavaScript + code: const response = await client.license.getTrialStatus(); + - language: Ruby + code: response = client.license.get_trial_status + - language: PHP + code: $resp = $client->license()->getTrialStatus(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_license/trial_status"' diff --git a/specification/license/post/examples/request/PostLicenseRequestExample1.yaml b/specification/license/post/examples/request/PostLicenseRequestExample1.yaml index 87804a64ef..c024e31ac6 100644 --- a/specification/license/post/examples/request/PostLicenseRequestExample1.yaml +++ b/specification/license/post/examples/request/PostLicenseRequestExample1.yaml @@ -1,11 +1,108 @@ # summary: licensing/update-license.asciidoc:63 method_request: PUT _license description: > - Run `PUT _license` to update to a basic license. NOTE: These values are invalid; you must substitute the appropriate contents from your license file. + Run `PUT _license` to update to a basic license. NOTE: These values are invalid; you must substitute the appropriate contents from + your license file. # type: request -value: - "{\n \"licenses\": [\n {\n \"uid\":\"893361dc-9749-4997-93cb-802e3d7fa4xx\"\ - ,\n \"type\":\"basic\",\n \"issue_date_in_millis\":1411948800000,\n \ - \ \"expiry_date_in_millis\":1914278399999,\n \"max_nodes\":1,\n \"\ - issued_to\":\"issuedTo\",\n \"issuer\":\"issuer\",\n \"signature\":\"\ - xx\"\n }\n ]\n}" +value: "{ + + \ \"licenses\": [ + + \ { + + \ \"uid\":\"893361dc-9749-4997-93cb-802e3d7fa4xx\", + + \ \"type\":\"basic\", + + \ \"issue_date_in_millis\":1411948800000, + + \ \"expiry_date_in_millis\":1914278399999, + + \ \"max_nodes\":1, + + \ \"issued_to\":\"issuedTo\", + + \ \"issuer\":\"issuer\", + + \ \"signature\":\"xx\" + + \ } + + \ ] + + }" +alternatives: + - language: Python + code: |- + resp = client.license.post( + licenses=[ + { + "uid": "893361dc-9749-4997-93cb-802e3d7fa4xx", + "type": "basic", + "issue_date_in_millis": 1411948800000, + "expiry_date_in_millis": 1914278399999, + "max_nodes": 1, + "issued_to": "issuedTo", + "issuer": "issuer", + "signature": "xx" + } + ], + ) + - language: JavaScript + code: |- + const response = await client.license.post({ + licenses: [ + { + uid: "893361dc-9749-4997-93cb-802e3d7fa4xx", + type: "basic", + issue_date_in_millis: 1411948800000, + expiry_date_in_millis: 1914278399999, + max_nodes: 1, + issued_to: "issuedTo", + issuer: "issuer", + signature: "xx", + }, + ], + }); + - language: Ruby + code: |- + response = client.license.post( + body: { + "licenses": [ + { + "uid": "893361dc-9749-4997-93cb-802e3d7fa4xx", + "type": "basic", + "issue_date_in_millis": 1411948800000, + "expiry_date_in_millis": 1914278399999, + "max_nodes": 1, + "issued_to": "issuedTo", + "issuer": "issuer", + "signature": "xx" + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->license()->post([ + "body" => [ + "licenses" => array( + [ + "uid" => "893361dc-9749-4997-93cb-802e3d7fa4xx", + "type" => "basic", + "issue_date_in_millis" => 1411948800000, + "expiry_date_in_millis" => 1914278399999, + "max_nodes" => 1, + "issued_to" => "issuedTo", + "issuer" => "issuer", + "signature" => "xx", + ], + ), + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"licenses\":[{\"uid\":\"893361dc-9749-4997-93cb-802e3d7fa4xx\",\"type\":\"basic\",\"issue_date_in_millis\":1411948800000,\ + \"expiry_date_in_millis\":1914278399999,\"max_nodes\":1,\"issued_to\":\"issuedTo\",\"issuer\":\"issuer\",\"signature\":\"xx\"\ + }]}' \"$ELASTICSEARCH_URL/_license\"" diff --git a/specification/license/post_start_basic/examples/request/StartBasicLicenseRequestExample1.yaml b/specification/license/post_start_basic/examples/request/StartBasicLicenseRequestExample1.yaml index 1da320bc31..eb27707a91 100644 --- a/specification/license/post_start_basic/examples/request/StartBasicLicenseRequestExample1.yaml +++ b/specification/license/post_start_basic/examples/request/StartBasicLicenseRequestExample1.yaml @@ -1 +1,24 @@ method_request: POST /_license/start_basic?acknowledge=true +alternatives: + - language: Python + code: |- + resp = client.license.post_start_basic( + acknowledge=True, + ) + - language: JavaScript + code: |- + const response = await client.license.postStartBasic({ + acknowledge: "true", + }); + - language: Ruby + code: |- + response = client.license.post_start_basic( + acknowledge: "true" + ) + - language: PHP + code: |- + $resp = $client->license()->postStartBasic([ + "acknowledge" => "true", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_license/start_basic?acknowledge=true"' diff --git a/specification/license/post_start_trial/examples/request/StartTrialLicenseRequestExample1.yaml b/specification/license/post_start_trial/examples/request/StartTrialLicenseRequestExample1.yaml index 684e3ce68a..2411502283 100644 --- a/specification/license/post_start_trial/examples/request/StartTrialLicenseRequestExample1.yaml +++ b/specification/license/post_start_trial/examples/request/StartTrialLicenseRequestExample1.yaml @@ -1 +1,24 @@ method_request: POST /_license/start_trial?acknowledge=true +alternatives: + - language: Python + code: |- + resp = client.license.post_start_trial( + acknowledge=True, + ) + - language: JavaScript + code: |- + const response = await client.license.postStartTrial({ + acknowledge: "true", + }); + - language: Ruby + code: |- + response = client.license.post_start_trial( + acknowledge: "true" + ) + - language: PHP + code: |- + $resp = $client->license()->postStartTrial([ + "acknowledge" => "true", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_license/start_trial?acknowledge=true"' diff --git a/specification/logstash/delete_pipeline/examples/request/LogstashDeletePipelineExample1.yaml b/specification/logstash/delete_pipeline/examples/request/LogstashDeletePipelineExample1.yaml index f3bd2e9aa7..c793028c93 100644 --- a/specification/logstash/delete_pipeline/examples/request/LogstashDeletePipelineExample1.yaml +++ b/specification/logstash/delete_pipeline/examples/request/LogstashDeletePipelineExample1.yaml @@ -1 +1,24 @@ method_request: DELETE _logstash/pipeline/my_pipeline +alternatives: + - language: Python + code: |- + resp = client.logstash.delete_pipeline( + id="my_pipeline", + ) + - language: JavaScript + code: |- + const response = await client.logstash.deletePipeline({ + id: "my_pipeline", + }); + - language: Ruby + code: |- + response = client.logstash.delete_pipeline( + id: "my_pipeline" + ) + - language: PHP + code: |- + $resp = $client->logstash()->deletePipeline([ + "id" => "my_pipeline", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_logstash/pipeline/my_pipeline"' diff --git a/specification/logstash/get_pipeline/examples/request/LogstashGetPipelineRequestExample1.yaml b/specification/logstash/get_pipeline/examples/request/LogstashGetPipelineRequestExample1.yaml index 6e566ef39d..23ff9fd973 100644 --- a/specification/logstash/get_pipeline/examples/request/LogstashGetPipelineRequestExample1.yaml +++ b/specification/logstash/get_pipeline/examples/request/LogstashGetPipelineRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET _logstash/pipeline/my_pipeline +alternatives: + - language: Python + code: |- + resp = client.logstash.get_pipeline( + id="my_pipeline", + ) + - language: JavaScript + code: |- + const response = await client.logstash.getPipeline({ + id: "my_pipeline", + }); + - language: Ruby + code: |- + response = client.logstash.get_pipeline( + id: "my_pipeline" + ) + - language: PHP + code: |- + $resp = $client->logstash()->getPipeline([ + "id" => "my_pipeline", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_logstash/pipeline/my_pipeline"' diff --git a/specification/logstash/put_pipeline/examples/request/LogstashPutPipelineRequestExample1.yaml b/specification/logstash/put_pipeline/examples/request/LogstashPutPipelineRequestExample1.yaml index bebc71ab8f..5a75f75e97 100644 --- a/specification/logstash/put_pipeline/examples/request/LogstashPutPipelineRequestExample1.yaml +++ b/specification/logstash/put_pipeline/examples/request/LogstashPutPipelineRequestExample1.yaml @@ -17,3 +17,104 @@ value: queue.type: memory queue.max_bytes: 1gb queue.checkpoint.writes: 1024 +alternatives: + - language: Python + code: |- + resp = client.logstash.put_pipeline( + id="my_pipeline", + pipeline={ + "description": "Sample pipeline for illustration purposes", + "last_modified": "2021-01-02T02:50:51.250Z", + "pipeline_metadata": { + "type": "logstash_pipeline", + "version": 1 + }, + "username": "elastic", + "pipeline": "input {}\\n filter { grok {} }\\n output {}", + "pipeline_settings": { + "pipeline.workers": 1, + "pipeline.batch.size": 125, + "pipeline.batch.delay": 50, + "queue.type": "memory", + "queue.max_bytes": "1gb", + "queue.checkpoint.writes": 1024 + } + }, + ) + - language: JavaScript + code: |- + const response = await client.logstash.putPipeline({ + id: "my_pipeline", + pipeline: { + description: "Sample pipeline for illustration purposes", + last_modified: "2021-01-02T02:50:51.250Z", + pipeline_metadata: { + type: "logstash_pipeline", + version: 1, + }, + username: "elastic", + pipeline: "input {}\\n filter { grok {} }\\n output {}", + pipeline_settings: { + "pipeline.workers": 1, + "pipeline.batch.size": 125, + "pipeline.batch.delay": 50, + "queue.type": "memory", + "queue.max_bytes": "1gb", + "queue.checkpoint.writes": 1024, + }, + }, + }); + - language: Ruby + code: |- + response = client.logstash.put_pipeline( + id: "my_pipeline", + body: { + "description": "Sample pipeline for illustration purposes", + "last_modified": "2021-01-02T02:50:51.250Z", + "pipeline_metadata": { + "type": "logstash_pipeline", + "version": 1 + }, + "username": "elastic", + "pipeline": "input {}\\n filter { grok {} }\\n output {}", + "pipeline_settings": { + "pipeline.workers": 1, + "pipeline.batch.size": 125, + "pipeline.batch.delay": 50, + "queue.type": "memory", + "queue.max_bytes": "1gb", + "queue.checkpoint.writes": 1024 + } + } + ) + - language: PHP + code: |- + $resp = $client->logstash()->putPipeline([ + "id" => "my_pipeline", + "body" => [ + "description" => "Sample pipeline for illustration purposes", + "last_modified" => "2021-01-02T02:50:51.250Z", + "pipeline_metadata" => [ + "type" => "logstash_pipeline", + "version" => 1, + ], + "username" => "elastic", + "pipeline" => "input {}\\n filter { grok {} }\\n output {}", + "pipeline_settings" => [ + "pipeline.workers" => 1, + "pipeline.batch.size" => 125, + "pipeline.batch.delay" => 50, + "queue.type" => "memory", + "queue.max_bytes" => "1gb", + "queue.checkpoint.writes" => 1024, + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"Sample + pipeline for illustration + purposes\",\"last_modified\":\"2021-01-02T02:50:51.250Z\",\"pipeline_metadata\":{\"type\":\"logstash_pipeline\",\"version\":1\ + },\"username\":\"elastic\",\"pipeline\":\"input {}\\\\n filter { grok {} }\\\\n output + {}\",\"pipeline_settings\":{\"pipeline.workers\":1,\"pipeline.batch.size\":125,\"pipeline.batch.delay\":50,\"queue.type\":\"m\ + emory\",\"queue.max_bytes\":\"1gb\",\"queue.checkpoint.writes\":1024}}' \"$ELASTICSEARCH_URL/_logstash/pipeline/my_pipeline\"" diff --git a/specification/migration/deprecations/examples/request/DeprecationInfoRequestExample1.yaml b/specification/migration/deprecations/examples/request/DeprecationInfoRequestExample1.yaml index e096e74803..08f30c58e7 100644 --- a/specification/migration/deprecations/examples/request/DeprecationInfoRequestExample1.yaml +++ b/specification/migration/deprecations/examples/request/DeprecationInfoRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET /_migration/deprecations +alternatives: + - language: Python + code: resp = client.migration.deprecations() + - language: JavaScript + code: const response = await client.migration.deprecations(); + - language: Ruby + code: response = client.migration.deprecations + - language: PHP + code: $resp = $client->migration()->deprecations(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_migration/deprecations"' diff --git a/specification/migration/get_feature_upgrade_status/examples/request/GetFeatureUpgradeStatusRequestExample1.yaml b/specification/migration/get_feature_upgrade_status/examples/request/GetFeatureUpgradeStatusRequestExample1.yaml index 2bd680e656..c9732bf09c 100644 --- a/specification/migration/get_feature_upgrade_status/examples/request/GetFeatureUpgradeStatusRequestExample1.yaml +++ b/specification/migration/get_feature_upgrade_status/examples/request/GetFeatureUpgradeStatusRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET /_migration/system_features +alternatives: + - language: Python + code: resp = client.migration.get_feature_upgrade_status() + - language: JavaScript + code: const response = await client.migration.getFeatureUpgradeStatus(); + - language: Ruby + code: response = client.migration.get_feature_upgrade_status + - language: PHP + code: $resp = $client->migration()->getFeatureUpgradeStatus(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_migration/system_features"' diff --git a/specification/migration/post_feature_upgrade/examples/request/PostFeatureUpgradeRequestExample1.yaml b/specification/migration/post_feature_upgrade/examples/request/PostFeatureUpgradeRequestExample1.yaml index c77bc6e0ff..86419a6f54 100644 --- a/specification/migration/post_feature_upgrade/examples/request/PostFeatureUpgradeRequestExample1.yaml +++ b/specification/migration/post_feature_upgrade/examples/request/PostFeatureUpgradeRequestExample1.yaml @@ -1 +1,12 @@ method_request: POST /_migration/system_features +alternatives: + - language: Python + code: resp = client.migration.post_feature_upgrade() + - language: JavaScript + code: const response = await client.migration.postFeatureUpgrade(); + - language: Ruby + code: response = client.migration.post_feature_upgrade + - language: PHP + code: $resp = $client->migration()->postFeatureUpgrade(); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_migration/system_features"' diff --git a/specification/ml/clear_trained_model_deployment_cache/examples/request/MlClearTrainedModelDeploymentCacheExample1.yaml b/specification/ml/clear_trained_model_deployment_cache/examples/request/MlClearTrainedModelDeploymentCacheExample1.yaml index 0417377ba9..63aeff030e 100644 --- a/specification/ml/clear_trained_model_deployment_cache/examples/request/MlClearTrainedModelDeploymentCacheExample1.yaml +++ b/specification/ml/clear_trained_model_deployment_cache/examples/request/MlClearTrainedModelDeploymentCacheExample1.yaml @@ -1 +1,25 @@ method_request: POST _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/cache/_clear +alternatives: + - language: Python + code: |- + resp = client.ml.clear_trained_model_deployment_cache( + model_id="elastic__distilbert-base-uncased-finetuned-conll03-english", + ) + - language: JavaScript + code: |- + const response = await client.ml.clearTrainedModelDeploymentCache({ + model_id: "elastic__distilbert-base-uncased-finetuned-conll03-english", + }); + - language: Ruby + code: |- + response = client.ml.clear_trained_model_deployment_cache( + model_id: "elastic__distilbert-base-uncased-finetuned-conll03-english" + ) + - language: PHP + code: |- + $resp = $client->ml()->clearTrainedModelDeploymentCache([ + "model_id" => "elastic__distilbert-base-uncased-finetuned-conll03-english", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/cache/_clear"' diff --git a/specification/ml/close_job/examples/request/MlCloseJobExample1.yaml b/specification/ml/close_job/examples/request/MlCloseJobExample1.yaml index ff006ad930..17ae703b18 100644 --- a/specification/ml/close_job/examples/request/MlCloseJobExample1.yaml +++ b/specification/ml/close_job/examples/request/MlCloseJobExample1.yaml @@ -1 +1,24 @@ method_request: POST _ml/anomaly_detectors/low_request_rate/_close +alternatives: + - language: Python + code: |- + resp = client.ml.close_job( + job_id="low_request_rate", + ) + - language: JavaScript + code: |- + const response = await client.ml.closeJob({ + job_id: "low_request_rate", + }); + - language: Ruby + code: |- + response = client.ml.close_job( + job_id: "low_request_rate" + ) + - language: PHP + code: |- + $resp = $client->ml()->closeJob([ + "job_id" => "low_request_rate", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_close"' diff --git a/specification/ml/delete_calendar/examples/request/MlDeleteCalendarExample1.yaml b/specification/ml/delete_calendar/examples/request/MlDeleteCalendarExample1.yaml index cdd6642c4d..8a9ab8b4aa 100644 --- a/specification/ml/delete_calendar/examples/request/MlDeleteCalendarExample1.yaml +++ b/specification/ml/delete_calendar/examples/request/MlDeleteCalendarExample1.yaml @@ -1 +1,24 @@ method_request: DELETE _ml/calendars/planned-outages +alternatives: + - language: Python + code: |- + resp = client.ml.delete_calendar( + calendar_id="planned-outages", + ) + - language: JavaScript + code: |- + const response = await client.ml.deleteCalendar({ + calendar_id: "planned-outages", + }); + - language: Ruby + code: |- + response = client.ml.delete_calendar( + calendar_id: "planned-outages" + ) + - language: PHP + code: |- + $resp = $client->ml()->deleteCalendar([ + "calendar_id" => "planned-outages", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ml/calendars/planned-outages"' diff --git a/specification/ml/delete_calendar_event/examples/request/MlDeleteCalendarEventExample1.yaml b/specification/ml/delete_calendar_event/examples/request/MlDeleteCalendarEventExample1.yaml index 03e0bc1377..e50a61b676 100644 --- a/specification/ml/delete_calendar_event/examples/request/MlDeleteCalendarEventExample1.yaml +++ b/specification/ml/delete_calendar_event/examples/request/MlDeleteCalendarEventExample1.yaml @@ -1 +1,29 @@ method_request: DELETE _ml/calendars/planned-outages/events/LS8LJGEBMTCMA-qz49st +alternatives: + - language: Python + code: |- + resp = client.ml.delete_calendar_event( + calendar_id="planned-outages", + event_id="LS8LJGEBMTCMA-qz49st", + ) + - language: JavaScript + code: |- + const response = await client.ml.deleteCalendarEvent({ + calendar_id: "planned-outages", + event_id: "LS8LJGEBMTCMA-qz49st", + }); + - language: Ruby + code: |- + response = client.ml.delete_calendar_event( + calendar_id: "planned-outages", + event_id: "LS8LJGEBMTCMA-qz49st" + ) + - language: PHP + code: |- + $resp = $client->ml()->deleteCalendarEvent([ + "calendar_id" => "planned-outages", + "event_id" => "LS8LJGEBMTCMA-qz49st", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_ml/calendars/planned-outages/events/LS8LJGEBMTCMA-qz49st"' diff --git a/specification/ml/delete_calendar_job/examples/request/MlDeleteCalendarJobExample1.yaml b/specification/ml/delete_calendar_job/examples/request/MlDeleteCalendarJobExample1.yaml index f42515b459..8fe533bded 100644 --- a/specification/ml/delete_calendar_job/examples/request/MlDeleteCalendarJobExample1.yaml +++ b/specification/ml/delete_calendar_job/examples/request/MlDeleteCalendarJobExample1.yaml @@ -1 +1,29 @@ method_request: DELETE _ml/calendars/planned-outages/jobs/total-requests +alternatives: + - language: Python + code: |- + resp = client.ml.delete_calendar_job( + calendar_id="planned-outages", + job_id="total-requests", + ) + - language: JavaScript + code: |- + const response = await client.ml.deleteCalendarJob({ + calendar_id: "planned-outages", + job_id: "total-requests", + }); + - language: Ruby + code: |- + response = client.ml.delete_calendar_job( + calendar_id: "planned-outages", + job_id: "total-requests" + ) + - language: PHP + code: |- + $resp = $client->ml()->deleteCalendarJob([ + "calendar_id" => "planned-outages", + "job_id" => "total-requests", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_ml/calendars/planned-outages/jobs/total-requests"' diff --git a/specification/ml/delete_data_frame_analytics/examples/request/MlDeleteDataFrameAnalyticsExample1.yaml b/specification/ml/delete_data_frame_analytics/examples/request/MlDeleteDataFrameAnalyticsExample1.yaml index 1e7f8c41fb..a30a894358 100644 --- a/specification/ml/delete_data_frame_analytics/examples/request/MlDeleteDataFrameAnalyticsExample1.yaml +++ b/specification/ml/delete_data_frame_analytics/examples/request/MlDeleteDataFrameAnalyticsExample1.yaml @@ -1 +1,24 @@ method_request: DELETE _ml/data_frame/analytics/loganalytics +alternatives: + - language: Python + code: |- + resp = client.ml.delete_data_frame_analytics( + id="loganalytics", + ) + - language: JavaScript + code: |- + const response = await client.ml.deleteDataFrameAnalytics({ + id: "loganalytics", + }); + - language: Ruby + code: |- + response = client.ml.delete_data_frame_analytics( + id: "loganalytics" + ) + - language: PHP + code: |- + $resp = $client->ml()->deleteDataFrameAnalytics([ + "id" => "loganalytics", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics"' diff --git a/specification/ml/delete_datafeed/examples/request/MlDeleteDatafeedExample1.yaml b/specification/ml/delete_datafeed/examples/request/MlDeleteDatafeedExample1.yaml index 86cb00fa59..a3cc1d7bb4 100644 --- a/specification/ml/delete_datafeed/examples/request/MlDeleteDatafeedExample1.yaml +++ b/specification/ml/delete_datafeed/examples/request/MlDeleteDatafeedExample1.yaml @@ -1 +1,24 @@ method_request: DELETE _ml/datafeeds/datafeed-total-requests +alternatives: + - language: Python + code: |- + resp = client.ml.delete_datafeed( + datafeed_id="datafeed-total-requests", + ) + - language: JavaScript + code: |- + const response = await client.ml.deleteDatafeed({ + datafeed_id: "datafeed-total-requests", + }); + - language: Ruby + code: |- + response = client.ml.delete_datafeed( + datafeed_id: "datafeed-total-requests" + ) + - language: PHP + code: |- + $resp = $client->ml()->deleteDatafeed([ + "datafeed_id" => "datafeed-total-requests", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-total-requests"' diff --git a/specification/ml/delete_expired_data/examples/request/MlDeleteExpiredDataExample1.yaml b/specification/ml/delete_expired_data/examples/request/MlDeleteExpiredDataExample1.yaml index 2effc4042c..2764cc8caa 100644 --- a/specification/ml/delete_expired_data/examples/request/MlDeleteExpiredDataExample1.yaml +++ b/specification/ml/delete_expired_data/examples/request/MlDeleteExpiredDataExample1.yaml @@ -1 +1,24 @@ method_request: DELETE _ml/_delete_expired_data?timeout=1h +alternatives: + - language: Python + code: |- + resp = client.ml.delete_expired_data( + timeout="1h", + ) + - language: JavaScript + code: |- + const response = await client.ml.deleteExpiredData({ + timeout: "1h", + }); + - language: Ruby + code: |- + response = client.ml.delete_expired_data( + timeout: "1h" + ) + - language: PHP + code: |- + $resp = $client->ml()->deleteExpiredData([ + "timeout" => "1h", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ml/_delete_expired_data?timeout=1h"' diff --git a/specification/ml/delete_filter/examples/request/MlDeleteFilterExample1.yaml b/specification/ml/delete_filter/examples/request/MlDeleteFilterExample1.yaml index 8a61ae8bdd..1e9c7590f7 100644 --- a/specification/ml/delete_filter/examples/request/MlDeleteFilterExample1.yaml +++ b/specification/ml/delete_filter/examples/request/MlDeleteFilterExample1.yaml @@ -1 +1,24 @@ method_request: DELETE _ml/filters/safe_domains +alternatives: + - language: Python + code: |- + resp = client.ml.delete_filter( + filter_id="safe_domains", + ) + - language: JavaScript + code: |- + const response = await client.ml.deleteFilter({ + filter_id: "safe_domains", + }); + - language: Ruby + code: |- + response = client.ml.delete_filter( + filter_id: "safe_domains" + ) + - language: PHP + code: |- + $resp = $client->ml()->deleteFilter([ + "filter_id" => "safe_domains", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ml/filters/safe_domains"' diff --git a/specification/ml/delete_forecast/examples/request/MlDeleteForecastExample1.yaml b/specification/ml/delete_forecast/examples/request/MlDeleteForecastExample1.yaml index b8069fc90f..710fdc91bf 100644 --- a/specification/ml/delete_forecast/examples/request/MlDeleteForecastExample1.yaml +++ b/specification/ml/delete_forecast/examples/request/MlDeleteForecastExample1.yaml @@ -1 +1,29 @@ method_request: DELETE _ml/anomaly_detectors/total-requests/_forecast/_all +alternatives: + - language: Python + code: |- + resp = client.ml.delete_forecast( + job_id="total-requests", + forecast_id="_all", + ) + - language: JavaScript + code: |- + const response = await client.ml.deleteForecast({ + job_id: "total-requests", + forecast_id: "_all", + }); + - language: Ruby + code: |- + response = client.ml.delete_forecast( + job_id: "total-requests", + forecast_id: "_all" + ) + - language: PHP + code: |- + $resp = $client->ml()->deleteForecast([ + "job_id" => "total-requests", + "forecast_id" => "_all", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_ml/anomaly_detectors/total-requests/_forecast/_all"' diff --git a/specification/ml/delete_job/examples/request/MlDeleteJobExample1.yaml b/specification/ml/delete_job/examples/request/MlDeleteJobExample1.yaml index a996042090..55792ccb41 100644 --- a/specification/ml/delete_job/examples/request/MlDeleteJobExample1.yaml +++ b/specification/ml/delete_job/examples/request/MlDeleteJobExample1.yaml @@ -1 +1,24 @@ method_request: DELETE _ml/anomaly_detectors/total-requests +alternatives: + - language: Python + code: |- + resp = client.ml.delete_job( + job_id="total-requests", + ) + - language: JavaScript + code: |- + const response = await client.ml.deleteJob({ + job_id: "total-requests", + }); + - language: Ruby + code: |- + response = client.ml.delete_job( + job_id: "total-requests" + ) + - language: PHP + code: |- + $resp = $client->ml()->deleteJob([ + "job_id" => "total-requests", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ml/anomaly_detectors/total-requests"' diff --git a/specification/ml/delete_model_snapshot/examples/request/MlDeleteModelSnapshotExample1.yaml b/specification/ml/delete_model_snapshot/examples/request/MlDeleteModelSnapshotExample1.yaml index 36617a5bc6..b23fb94562 100644 --- a/specification/ml/delete_model_snapshot/examples/request/MlDeleteModelSnapshotExample1.yaml +++ b/specification/ml/delete_model_snapshot/examples/request/MlDeleteModelSnapshotExample1.yaml @@ -1 +1,29 @@ method_request: DELETE _ml/anomaly_detectors/farequote/model_snapshots/1491948163 +alternatives: + - language: Python + code: |- + resp = client.ml.delete_model_snapshot( + job_id="farequote", + snapshot_id="1491948163", + ) + - language: JavaScript + code: |- + const response = await client.ml.deleteModelSnapshot({ + job_id: "farequote", + snapshot_id: 1491948163, + }); + - language: Ruby + code: |- + response = client.ml.delete_model_snapshot( + job_id: "farequote", + snapshot_id: "1491948163" + ) + - language: PHP + code: |- + $resp = $client->ml()->deleteModelSnapshot([ + "job_id" => "farequote", + "snapshot_id" => "1491948163", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_ml/anomaly_detectors/farequote/model_snapshots/1491948163"' diff --git a/specification/ml/delete_trained_model/examples/request/MlDeleteTrainedModelExample1.yaml b/specification/ml/delete_trained_model/examples/request/MlDeleteTrainedModelExample1.yaml index 36f643b4da..b7479603c1 100644 --- a/specification/ml/delete_trained_model/examples/request/MlDeleteTrainedModelExample1.yaml +++ b/specification/ml/delete_trained_model/examples/request/MlDeleteTrainedModelExample1.yaml @@ -1 +1,25 @@ method_request: DELETE _ml/trained_models/regression-job-one-1574775307356 +alternatives: + - language: Python + code: |- + resp = client.ml.delete_trained_model( + model_id="regression-job-one-1574775307356", + ) + - language: JavaScript + code: |- + const response = await client.ml.deleteTrainedModel({ + model_id: "regression-job-one-1574775307356", + }); + - language: Ruby + code: |- + response = client.ml.delete_trained_model( + model_id: "regression-job-one-1574775307356" + ) + - language: PHP + code: |- + $resp = $client->ml()->deleteTrainedModel([ + "model_id" => "regression-job-one-1574775307356", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_ml/trained_models/regression-job-one-1574775307356"' diff --git a/specification/ml/delete_trained_model_alias/examples/request/MlDeleteTrainedModelAliasExample1.yaml b/specification/ml/delete_trained_model_alias/examples/request/MlDeleteTrainedModelAliasExample1.yaml index cfba1b00b5..f23c8c5feb 100644 --- a/specification/ml/delete_trained_model_alias/examples/request/MlDeleteTrainedModelAliasExample1.yaml +++ b/specification/ml/delete_trained_model_alias/examples/request/MlDeleteTrainedModelAliasExample1.yaml @@ -1 +1,29 @@ method_request: DELETE _ml/trained_models/flight-delay-prediction-1574775339910/model_aliases/flight_delay_model +alternatives: + - language: Python + code: |- + resp = client.ml.delete_trained_model_alias( + model_id="flight-delay-prediction-1574775339910", + model_alias="flight_delay_model", + ) + - language: JavaScript + code: |- + const response = await client.ml.deleteTrainedModelAlias({ + model_id: "flight-delay-prediction-1574775339910", + model_alias: "flight_delay_model", + }); + - language: Ruby + code: |- + response = client.ml.delete_trained_model_alias( + model_id: "flight-delay-prediction-1574775339910", + model_alias: "flight_delay_model" + ) + - language: PHP + code: |- + $resp = $client->ml()->deleteTrainedModelAlias([ + "model_id" => "flight-delay-prediction-1574775339910", + "model_alias" => "flight_delay_model", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_ml/trained_models/flight-delay-prediction-1574775339910/model_aliases/flight_delay_model"' diff --git a/specification/ml/estimate_model_memory/examples/request/MlEstimateModelMemoryRequestExample1.yaml b/specification/ml/estimate_model_memory/examples/request/MlEstimateModelMemoryRequestExample1.yaml index 54158dd70e..1a1386986c 100644 --- a/specification/ml/estimate_model_memory/examples/request/MlEstimateModelMemoryRequestExample1.yaml +++ b/specification/ml/estimate_model_memory/examples/request/MlEstimateModelMemoryRequestExample1.yaml @@ -1,6 +1,8 @@ # summary: method_request: POST _ml/anomaly_detectors/_estimate_model_memory -description: Run `POST _ml/anomaly_detectors/_estimate_model_memory` to estimate the model memory limit based on the analysis configuration details provided in the request body. +description: + Run `POST _ml/anomaly_detectors/_estimate_model_memory` to estimate the model memory limit based on the analysis + configuration details provided in the request body. # type: request value: analysis_config: @@ -19,3 +21,120 @@ value: max_bucket_cardinality: source_ip: 300 dest_ip: 30 +alternatives: + - language: Python + code: |- + resp = client.ml.estimate_model_memory( + analysis_config={ + "bucket_span": "5m", + "detectors": [ + { + "function": "sum", + "field_name": "bytes", + "by_field_name": "status", + "partition_field_name": "app" + } + ], + "influencers": [ + "source_ip", + "dest_ip" + ] + }, + overall_cardinality={ + "status": 10, + "app": 50 + }, + max_bucket_cardinality={ + "source_ip": 300, + "dest_ip": 30 + }, + ) + - language: JavaScript + code: |- + const response = await client.ml.estimateModelMemory({ + analysis_config: { + bucket_span: "5m", + detectors: [ + { + function: "sum", + field_name: "bytes", + by_field_name: "status", + partition_field_name: "app", + }, + ], + influencers: ["source_ip", "dest_ip"], + }, + overall_cardinality: { + status: 10, + app: 50, + }, + max_bucket_cardinality: { + source_ip: 300, + dest_ip: 30, + }, + }); + - language: Ruby + code: |- + response = client.ml.estimate_model_memory( + body: { + "analysis_config": { + "bucket_span": "5m", + "detectors": [ + { + "function": "sum", + "field_name": "bytes", + "by_field_name": "status", + "partition_field_name": "app" + } + ], + "influencers": [ + "source_ip", + "dest_ip" + ] + }, + "overall_cardinality": { + "status": 10, + "app": 50 + }, + "max_bucket_cardinality": { + "source_ip": 300, + "dest_ip": 30 + } + } + ) + - language: PHP + code: |- + $resp = $client->ml()->estimateModelMemory([ + "body" => [ + "analysis_config" => [ + "bucket_span" => "5m", + "detectors" => array( + [ + "function" => "sum", + "field_name" => "bytes", + "by_field_name" => "status", + "partition_field_name" => "app", + ], + ), + "influencers" => array( + "source_ip", + "dest_ip", + ), + ], + "overall_cardinality" => [ + "status" => 10, + "app" => 50, + ], + "max_bucket_cardinality" => [ + "source_ip" => 300, + "dest_ip" => 30, + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"analysis_config\":{\"bucket_span\":\"5m\",\"detectors\":[{\"function\":\"sum\",\"field_name\":\"bytes\",\"by_field_name\":\ + \"status\",\"partition_field_name\":\"app\"}],\"influencers\":[\"source_ip\",\"dest_ip\"]},\"overall_cardinality\":{\"status\ + \":10,\"app\":50},\"max_bucket_cardinality\":{\"source_ip\":300,\"dest_ip\":30}}' + \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/_estimate_model_memory\"" diff --git a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample1.yaml b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample1.yaml index eff3c6b849..5bd6fa6464 100644 --- a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample1.yaml +++ b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample1.yaml @@ -1,9 +1,8 @@ summary: Classification example 1 method_request: POST _ml/data_frame/_evaluate description: > - Run `POST _ml/data_frame/_evaluate` to evaluate a a classification job for an annotated index. - The `actual_field` contains the ground truth for classification. - The `predicted_field` contains the predicted value calculated by the classification analysis. + Run `POST _ml/data_frame/_evaluate` to evaluate a a classification job for an annotated index. The `actual_field` contains the + ground truth for classification. The `predicted_field` contains the predicted value calculated by the classification analysis. # type: request value: index: animal_classification @@ -13,3 +12,70 @@ value: predicted_field: ml.animal_class_prediction metrics: multiclass_confusion_matrix: {} +alternatives: + - language: Python + code: |- + resp = client.ml.evaluate_data_frame( + index="animal_classification", + evaluation={ + "classification": { + "actual_field": "animal_class", + "predicted_field": "ml.animal_class_prediction", + "metrics": { + "multiclass_confusion_matrix": {} + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.ml.evaluateDataFrame({ + index: "animal_classification", + evaluation: { + classification: { + actual_field: "animal_class", + predicted_field: "ml.animal_class_prediction", + metrics: { + multiclass_confusion_matrix: {}, + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.ml.evaluate_data_frame( + body: { + "index": "animal_classification", + "evaluation": { + "classification": { + "actual_field": "animal_class", + "predicted_field": "ml.animal_class_prediction", + "metrics": { + "multiclass_confusion_matrix": {} + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->ml()->evaluateDataFrame([ + "body" => [ + "index" => "animal_classification", + "evaluation" => [ + "classification" => [ + "actual_field" => "animal_class", + "predicted_field" => "ml.animal_class_prediction", + "metrics" => [ + "multiclass_confusion_matrix" => new ArrayObject([]), + ], + ], + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"index\":\"animal_classification\",\"evaluation\":{\"classification\":{\"actual_field\":\"animal_class\",\"predicted_field\ + \":\"ml.animal_class_prediction\",\"metrics\":{\"multiclass_confusion_matrix\":{}}}}}' + \"$ELASTICSEARCH_URL/_ml/data_frame/_evaluate\"" diff --git a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample2.yaml b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample2.yaml index cf61805fa4..7fa591558e 100644 --- a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample2.yaml +++ b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample2.yaml @@ -1,9 +1,10 @@ summary: Classification example 2 method_request: POST _ml/data_frame/_evaluate description: > - Run `POST _ml/data_frame/_evaluate` to evaluate a classification job with AUC ROC metrics for an annotated index. - The `actual_field` contains the ground truth value for the actual animal classification. This is required in order to evaluate results. - The `class_name` specifies the class name that is treated as positive during the evaluation, all the other classes are treated as negative. + Run `POST _ml/data_frame/_evaluate` to evaluate a classification job with AUC ROC metrics for an annotated index. The + `actual_field` contains the ground truth value for the actual animal classification. This is required in order to evaluate + results. The `class_name` specifies the class name that is treated as positive during the evaluation, all the other classes are + treated as negative. # type: request value: index: animal_classification @@ -13,3 +14,73 @@ value: metrics: auc_roc: class_name: dog +alternatives: + - language: Python + code: |- + resp = client.ml.evaluate_data_frame( + index="animal_classification", + evaluation={ + "classification": { + "actual_field": "animal_class", + "metrics": { + "auc_roc": { + "class_name": "dog" + } + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.ml.evaluateDataFrame({ + index: "animal_classification", + evaluation: { + classification: { + actual_field: "animal_class", + metrics: { + auc_roc: { + class_name: "dog", + }, + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.ml.evaluate_data_frame( + body: { + "index": "animal_classification", + "evaluation": { + "classification": { + "actual_field": "animal_class", + "metrics": { + "auc_roc": { + "class_name": "dog" + } + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->ml()->evaluateDataFrame([ + "body" => [ + "index" => "animal_classification", + "evaluation" => [ + "classification" => [ + "actual_field" => "animal_class", + "metrics" => [ + "auc_roc" => [ + "class_name" => "dog", + ], + ], + ], + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"index\":\"animal_classification\",\"evaluation\":{\"classification\":{\"actual_field\":\"animal_class\",\"metrics\":{\"au\ + c_roc\":{\"class_name\":\"dog\"}}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/_evaluate\"" diff --git a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample3.yaml b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample3.yaml index 4ff41e2545..96b6d605cd 100644 --- a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample3.yaml +++ b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample3.yaml @@ -9,3 +9,57 @@ value: outlier_detection: actual_field: is_outlier predicted_probability_field: ml.outlier_score +alternatives: + - language: Python + code: |- + resp = client.ml.evaluate_data_frame( + index="my_analytics_dest_index", + evaluation={ + "outlier_detection": { + "actual_field": "is_outlier", + "predicted_probability_field": "ml.outlier_score" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.ml.evaluateDataFrame({ + index: "my_analytics_dest_index", + evaluation: { + outlier_detection: { + actual_field: "is_outlier", + predicted_probability_field: "ml.outlier_score", + }, + }, + }); + - language: Ruby + code: |- + response = client.ml.evaluate_data_frame( + body: { + "index": "my_analytics_dest_index", + "evaluation": { + "outlier_detection": { + "actual_field": "is_outlier", + "predicted_probability_field": "ml.outlier_score" + } + } + } + ) + - language: PHP + code: |- + $resp = $client->ml()->evaluateDataFrame([ + "body" => [ + "index" => "my_analytics_dest_index", + "evaluation" => [ + "outlier_detection" => [ + "actual_field" => "is_outlier", + "predicted_probability_field" => "ml.outlier_score", + ], + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"index\":\"my_analytics_dest_index\",\"evaluation\":{\"outlier_detection\":{\"actual_field\":\"is_outlier\",\"predicted_pr\ + obability_field\":\"ml.outlier_score\"}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/_evaluate\"" diff --git a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample4.yaml b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample4.yaml index 3fe0b6316a..81818b4533 100644 --- a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample4.yaml +++ b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample4.yaml @@ -1,9 +1,8 @@ summary: Regression example 1 method_request: POST _ml/data_frame/_evaluate description: > - Run `POST _ml/data_frame/_evaluate` to evaluate the testing error of a regression job for an annotated index. - The term query in the body limits evaluation to be performed on the test split only. - The `actual_field` contains the ground truth for house prices. + Run `POST _ml/data_frame/_evaluate` to evaluate the testing error of a regression job for an annotated index. The term query in + the body limits evaluation to be performed on the test split only. The `actual_field` contains the ground truth for house prices. The `predicted_field` contains the house price calculated by the regression analysis. # type: request value: @@ -24,3 +23,142 @@ value: offset: 10 huber: delta: 1.5 +alternatives: + - language: Python + code: |- + resp = client.ml.evaluate_data_frame( + index="house_price_predictions", + query={ + "bool": { + "filter": [ + { + "term": { + "ml.is_training": False + } + } + ] + } + }, + evaluation={ + "regression": { + "actual_field": "price", + "predicted_field": "ml.price_prediction", + "metrics": { + "r_squared": {}, + "mse": {}, + "msle": { + "offset": 10 + }, + "huber": { + "delta": 1.5 + } + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.ml.evaluateDataFrame({ + index: "house_price_predictions", + query: { + bool: { + filter: [ + { + term: { + "ml.is_training": false, + }, + }, + ], + }, + }, + evaluation: { + regression: { + actual_field: "price", + predicted_field: "ml.price_prediction", + metrics: { + r_squared: {}, + mse: {}, + msle: { + offset: 10, + }, + huber: { + delta: 1.5, + }, + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.ml.evaluate_data_frame( + body: { + "index": "house_price_predictions", + "query": { + "bool": { + "filter": [ + { + "term": { + "ml.is_training": false + } + } + ] + } + }, + "evaluation": { + "regression": { + "actual_field": "price", + "predicted_field": "ml.price_prediction", + "metrics": { + "r_squared": {}, + "mse": {}, + "msle": { + "offset": 10 + }, + "huber": { + "delta": 1.5 + } + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->ml()->evaluateDataFrame([ + "body" => [ + "index" => "house_price_predictions", + "query" => [ + "bool" => [ + "filter" => array( + [ + "term" => [ + "ml.is_training" => false, + ], + ], + ), + ], + ], + "evaluation" => [ + "regression" => [ + "actual_field" => "price", + "predicted_field" => "ml.price_prediction", + "metrics" => [ + "r_squared" => new ArrayObject([]), + "mse" => new ArrayObject([]), + "msle" => [ + "offset" => 10, + ], + "huber" => [ + "delta" => 1.5, + ], + ], + ], + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"index\":\"house_price_predictions\",\"query\":{\"bool\":{\"filter\":[{\"term\":{\"ml.is_training\":false}}]}},\"evaluation\ + \":{\"regression\":{\"actual_field\":\"price\",\"predicted_field\":\"ml.price_prediction\",\"metrics\":{\"r_squared\":{},\"mse\ + \":{},\"msle\":{\"offset\":10},\"huber\":{\"delta\":1.5}}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/_evaluate\"" diff --git a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample5.yaml b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample5.yaml index 72aeca479f..186af53933 100644 --- a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample5.yaml +++ b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample5.yaml @@ -1,10 +1,9 @@ summary: Regression example 2 method_request: POST _ml/data_frame/_evaluate description: > - Run `POST _ml/data_frame/_evaluate` to evaluate the training error of a regression job for an annotated index. - The term query in the body limits evaluation to be performed on the training split only. - The `actual_field` contains the ground truth for house prices. - The `predicted_field` contains the house price calculated by the regression analysis. + Run `POST _ml/data_frame/_evaluate` to evaluate the training error of a regression job for an annotated index. The term query in + the body limits evaluation to be performed on the training split only. The `actual_field` contains the ground truth for house + prices. The `predicted_field` contains the house price calculated by the regression analysis. # type: request value: index: house_price_predictions @@ -21,3 +20,110 @@ value: mse: {} msle: {} huber: {} +alternatives: + - language: Python + code: |- + resp = client.ml.evaluate_data_frame( + index="house_price_predictions", + query={ + "term": { + "ml.is_training": { + "value": True + } + } + }, + evaluation={ + "regression": { + "actual_field": "price", + "predicted_field": "ml.price_prediction", + "metrics": { + "r_squared": {}, + "mse": {}, + "msle": {}, + "huber": {} + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.ml.evaluateDataFrame({ + index: "house_price_predictions", + query: { + term: { + "ml.is_training": { + value: true, + }, + }, + }, + evaluation: { + regression: { + actual_field: "price", + predicted_field: "ml.price_prediction", + metrics: { + r_squared: {}, + mse: {}, + msle: {}, + huber: {}, + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.ml.evaluate_data_frame( + body: { + "index": "house_price_predictions", + "query": { + "term": { + "ml.is_training": { + "value": true + } + } + }, + "evaluation": { + "regression": { + "actual_field": "price", + "predicted_field": "ml.price_prediction", + "metrics": { + "r_squared": {}, + "mse": {}, + "msle": {}, + "huber": {} + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->ml()->evaluateDataFrame([ + "body" => [ + "index" => "house_price_predictions", + "query" => [ + "term" => [ + "ml.is_training" => [ + "value" => true, + ], + ], + ], + "evaluation" => [ + "regression" => [ + "actual_field" => "price", + "predicted_field" => "ml.price_prediction", + "metrics" => [ + "r_squared" => new ArrayObject([]), + "mse" => new ArrayObject([]), + "msle" => new ArrayObject([]), + "huber" => new ArrayObject([]), + ], + ], + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"index\":\"house_price_predictions\",\"query\":{\"term\":{\"ml.is_training\":{\"value\":true}}},\"evaluation\":{\"regressi\ + on\":{\"actual_field\":\"price\",\"predicted_field\":\"ml.price_prediction\",\"metrics\":{\"r_squared\":{},\"mse\":{},\"msle\ + \":{},\"huber\":{}}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/_evaluate\"" diff --git a/specification/ml/explain_data_frame_analytics/examples/request/MlExplainDataFrameAnalyticsRequestExample1.yaml b/specification/ml/explain_data_frame_analytics/examples/request/MlExplainDataFrameAnalyticsRequestExample1.yaml index fb1f81f76e..b8ff10330c 100644 --- a/specification/ml/explain_data_frame_analytics/examples/request/MlExplainDataFrameAnalyticsRequestExample1.yaml +++ b/specification/ml/explain_data_frame_analytics/examples/request/MlExplainDataFrameAnalyticsRequestExample1.yaml @@ -8,3 +8,61 @@ value: analysis: regression: dependent_variable: price +alternatives: + - language: Python + code: |- + resp = client.ml.explain_data_frame_analytics( + source={ + "index": "houses_sold_last_10_yrs" + }, + analysis={ + "regression": { + "dependent_variable": "price" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.ml.explainDataFrameAnalytics({ + source: { + index: "houses_sold_last_10_yrs", + }, + analysis: { + regression: { + dependent_variable: "price", + }, + }, + }); + - language: Ruby + code: |- + response = client.ml.explain_data_frame_analytics( + body: { + "source": { + "index": "houses_sold_last_10_yrs" + }, + "analysis": { + "regression": { + "dependent_variable": "price" + } + } + } + ) + - language: PHP + code: |- + $resp = $client->ml()->explainDataFrameAnalytics([ + "body" => [ + "source" => [ + "index" => "houses_sold_last_10_yrs", + ], + "analysis" => [ + "regression" => [ + "dependent_variable" => "price", + ], + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"source":{"index":"houses_sold_last_10_yrs"},"analysis":{"regression":{"dependent_variable":"price"}}}'' + "$ELASTICSEARCH_URL/_ml/data_frame/analytics/_explain"' diff --git a/specification/ml/flush_job/examples/request/MlFlushJobExample1.yaml b/specification/ml/flush_job/examples/request/MlFlushJobExample1.yaml index 21e1dbd2b6..7a42c7c27e 100644 --- a/specification/ml/flush_job/examples/request/MlFlushJobExample1.yaml +++ b/specification/ml/flush_job/examples/request/MlFlushJobExample1.yaml @@ -4,3 +4,36 @@ value: |- { "calc_interim": true } +alternatives: + - language: Python + code: |- + resp = client.ml.flush_job( + job_id="low_request_rate", + calc_interim=True, + ) + - language: JavaScript + code: |- + const response = await client.ml.flushJob({ + job_id: "low_request_rate", + calc_interim: true, + }); + - language: Ruby + code: |- + response = client.ml.flush_job( + job_id: "low_request_rate", + body: { + "calc_interim": true + } + ) + - language: PHP + code: |- + $resp = $client->ml()->flushJob([ + "job_id" => "low_request_rate", + "body" => [ + "calc_interim" => true, + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"calc_interim":true}'' + "$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_flush"' diff --git a/specification/ml/forecast/examples/request/MlForecastExample1.yaml b/specification/ml/forecast/examples/request/MlForecastExample1.yaml index 2e2dc3dc63..3956e3c191 100644 --- a/specification/ml/forecast/examples/request/MlForecastExample1.yaml +++ b/specification/ml/forecast/examples/request/MlForecastExample1.yaml @@ -4,3 +4,36 @@ value: |- { "duration": "10d" } +alternatives: + - language: Python + code: |- + resp = client.ml.forecast( + job_id="low_request_rate", + duration="10d", + ) + - language: JavaScript + code: |- + const response = await client.ml.forecast({ + job_id: "low_request_rate", + duration: "10d", + }); + - language: Ruby + code: |- + response = client.ml.forecast( + job_id: "low_request_rate", + body: { + "duration": "10d" + } + ) + - language: PHP + code: |- + $resp = $client->ml()->forecast([ + "job_id" => "low_request_rate", + "body" => [ + "duration" => "10d", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"duration":"10d"}'' + "$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_forecast"' diff --git a/specification/ml/get_buckets/examples/request/MlGetBucketsExample1.yaml b/specification/ml/get_buckets/examples/request/MlGetBucketsExample1.yaml index 85002c44c3..b5a2633cde 100644 --- a/specification/ml/get_buckets/examples/request/MlGetBucketsExample1.yaml +++ b/specification/ml/get_buckets/examples/request/MlGetBucketsExample1.yaml @@ -5,3 +5,41 @@ value: |- "anomaly_score": 80, "start": "1454530200001" } +alternatives: + - language: Python + code: |- + resp = client.ml.get_buckets( + job_id="low_request_rate", + anomaly_score=80, + start="1454530200001", + ) + - language: JavaScript + code: |- + const response = await client.ml.getBuckets({ + job_id: "low_request_rate", + anomaly_score: 80, + start: 1454530200001, + }); + - language: Ruby + code: |- + response = client.ml.get_buckets( + job_id: "low_request_rate", + body: { + "anomaly_score": 80, + "start": "1454530200001" + } + ) + - language: PHP + code: |- + $resp = $client->ml()->getBuckets([ + "job_id" => "low_request_rate", + "body" => [ + "anomaly_score" => 80, + "start" => "1454530200001", + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"anomaly_score":80,"start":"1454530200001"}'' + "$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/results/buckets"' diff --git a/specification/ml/get_calendar_events/examples/request/MlGetCalendarEventsExample1.yaml b/specification/ml/get_calendar_events/examples/request/MlGetCalendarEventsExample1.yaml index 2271588bc5..5e367f2467 100644 --- a/specification/ml/get_calendar_events/examples/request/MlGetCalendarEventsExample1.yaml +++ b/specification/ml/get_calendar_events/examples/request/MlGetCalendarEventsExample1.yaml @@ -1 +1,24 @@ method_request: GET _ml/calendars/planned-outages/events +alternatives: + - language: Python + code: |- + resp = client.ml.get_calendar_events( + calendar_id="planned-outages", + ) + - language: JavaScript + code: |- + const response = await client.ml.getCalendarEvents({ + calendar_id: "planned-outages", + }); + - language: Ruby + code: |- + response = client.ml.get_calendar_events( + calendar_id: "planned-outages" + ) + - language: PHP + code: |- + $resp = $client->ml()->getCalendarEvents([ + "calendar_id" => "planned-outages", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ml/calendars/planned-outages/events"' diff --git a/specification/ml/get_calendars/examples/request/MlGetCalendarsExample1.yaml b/specification/ml/get_calendars/examples/request/MlGetCalendarsExample1.yaml index 7964e0844d..cb284b8c13 100644 --- a/specification/ml/get_calendars/examples/request/MlGetCalendarsExample1.yaml +++ b/specification/ml/get_calendars/examples/request/MlGetCalendarsExample1.yaml @@ -1 +1,24 @@ method_request: GET _ml/calendars/planned-outages +alternatives: + - language: Python + code: |- + resp = client.ml.get_calendars( + calendar_id="planned-outages", + ) + - language: JavaScript + code: |- + const response = await client.ml.getCalendars({ + calendar_id: "planned-outages", + }); + - language: Ruby + code: |- + response = client.ml.get_calendars( + calendar_id: "planned-outages" + ) + - language: PHP + code: |- + $resp = $client->ml()->getCalendars([ + "calendar_id" => "planned-outages", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ml/calendars/planned-outages"' diff --git a/specification/ml/get_categories/examples/request/MlGetCategoriesExample1.yaml b/specification/ml/get_categories/examples/request/MlGetCategoriesExample1.yaml index 31dd82d9fa..ea6841ca0b 100644 --- a/specification/ml/get_categories/examples/request/MlGetCategoriesExample1.yaml +++ b/specification/ml/get_categories/examples/request/MlGetCategoriesExample1.yaml @@ -6,3 +6,44 @@ value: |- "size": 1 } } +alternatives: + - language: Python + code: |- + resp = client.ml.get_categories( + job_id="esxi_log", + page={ + "size": 1 + }, + ) + - language: JavaScript + code: |- + const response = await client.ml.getCategories({ + job_id: "esxi_log", + page: { + size: 1, + }, + }); + - language: Ruby + code: |- + response = client.ml.get_categories( + job_id: "esxi_log", + body: { + "page": { + "size": 1 + } + } + ) + - language: PHP + code: |- + $resp = $client->ml()->getCategories([ + "job_id" => "esxi_log", + "body" => [ + "page" => [ + "size" => 1, + ], + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"page":{"size":1}}'' + "$ELASTICSEARCH_URL/_ml/anomaly_detectors/esxi_log/results/categories"' diff --git a/specification/ml/get_data_frame_analytics/examples/request/MlGetDataFrameAnalyticsExample1.yaml b/specification/ml/get_data_frame_analytics/examples/request/MlGetDataFrameAnalyticsExample1.yaml index d87c068be6..dcf4eaac3e 100644 --- a/specification/ml/get_data_frame_analytics/examples/request/MlGetDataFrameAnalyticsExample1.yaml +++ b/specification/ml/get_data_frame_analytics/examples/request/MlGetDataFrameAnalyticsExample1.yaml @@ -1 +1,24 @@ method_request: GET _ml/data_frame/analytics/loganalytics +alternatives: + - language: Python + code: |- + resp = client.ml.get_data_frame_analytics( + id="loganalytics", + ) + - language: JavaScript + code: |- + const response = await client.ml.getDataFrameAnalytics({ + id: "loganalytics", + }); + - language: Ruby + code: |- + response = client.ml.get_data_frame_analytics( + id: "loganalytics" + ) + - language: PHP + code: |- + $resp = $client->ml()->getDataFrameAnalytics([ + "id" => "loganalytics", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics"' diff --git a/specification/ml/get_data_frame_analytics_stats/examples/request/MlGetDataFrameAnalyticsStatsExample1.yaml b/specification/ml/get_data_frame_analytics_stats/examples/request/MlGetDataFrameAnalyticsStatsExample1.yaml index bfab4a796b..1e4a943d04 100644 --- a/specification/ml/get_data_frame_analytics_stats/examples/request/MlGetDataFrameAnalyticsStatsExample1.yaml +++ b/specification/ml/get_data_frame_analytics_stats/examples/request/MlGetDataFrameAnalyticsStatsExample1.yaml @@ -1 +1,24 @@ method_request: GET _ml/data_frame/analytics/weblog-outliers/_stats +alternatives: + - language: Python + code: |- + resp = client.ml.get_data_frame_analytics_stats( + id="weblog-outliers", + ) + - language: JavaScript + code: |- + const response = await client.ml.getDataFrameAnalyticsStats({ + id: "weblog-outliers", + }); + - language: Ruby + code: |- + response = client.ml.get_data_frame_analytics_stats( + id: "weblog-outliers" + ) + - language: PHP + code: |- + $resp = $client->ml()->getDataFrameAnalyticsStats([ + "id" => "weblog-outliers", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ml/data_frame/analytics/weblog-outliers/_stats"' diff --git a/specification/ml/get_datafeed_stats/examples/request/MlGetDatafeedStatsExample1.yaml b/specification/ml/get_datafeed_stats/examples/request/MlGetDatafeedStatsExample1.yaml index 4022e01353..c221d0cf63 100644 --- a/specification/ml/get_datafeed_stats/examples/request/MlGetDatafeedStatsExample1.yaml +++ b/specification/ml/get_datafeed_stats/examples/request/MlGetDatafeedStatsExample1.yaml @@ -1 +1,25 @@ method_request: GET _ml/datafeeds/datafeed-high_sum_total_sales/_stats +alternatives: + - language: Python + code: |- + resp = client.ml.get_datafeed_stats( + datafeed_id="datafeed-high_sum_total_sales", + ) + - language: JavaScript + code: |- + const response = await client.ml.getDatafeedStats({ + datafeed_id: "datafeed-high_sum_total_sales", + }); + - language: Ruby + code: |- + response = client.ml.get_datafeed_stats( + datafeed_id: "datafeed-high_sum_total_sales" + ) + - language: PHP + code: |- + $resp = $client->ml()->getDatafeedStats([ + "datafeed_id" => "datafeed-high_sum_total_sales", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales/_stats"' diff --git a/specification/ml/get_datafeeds/examples/request/MlGetDatafeedsExample1.yaml b/specification/ml/get_datafeeds/examples/request/MlGetDatafeedsExample1.yaml index bd31d72579..7a0134608c 100644 --- a/specification/ml/get_datafeeds/examples/request/MlGetDatafeedsExample1.yaml +++ b/specification/ml/get_datafeeds/examples/request/MlGetDatafeedsExample1.yaml @@ -1 +1,24 @@ method_request: GET _ml/datafeeds/datafeed-high_sum_total_sales +alternatives: + - language: Python + code: |- + resp = client.ml.get_datafeeds( + datafeed_id="datafeed-high_sum_total_sales", + ) + - language: JavaScript + code: |- + const response = await client.ml.getDatafeeds({ + datafeed_id: "datafeed-high_sum_total_sales", + }); + - language: Ruby + code: |- + response = client.ml.get_datafeeds( + datafeed_id: "datafeed-high_sum_total_sales" + ) + - language: PHP + code: |- + $resp = $client->ml()->getDatafeeds([ + "datafeed_id" => "datafeed-high_sum_total_sales", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales"' diff --git a/specification/ml/get_filters/examples/request/MlGetFiltersExample1.yaml b/specification/ml/get_filters/examples/request/MlGetFiltersExample1.yaml index 41c8454cc2..5fad1b11c3 100644 --- a/specification/ml/get_filters/examples/request/MlGetFiltersExample1.yaml +++ b/specification/ml/get_filters/examples/request/MlGetFiltersExample1.yaml @@ -1 +1,24 @@ method_request: GET _ml/filters/safe_domains +alternatives: + - language: Python + code: |- + resp = client.ml.get_filters( + filter_id="safe_domains", + ) + - language: JavaScript + code: |- + const response = await client.ml.getFilters({ + filter_id: "safe_domains", + }); + - language: Ruby + code: |- + response = client.ml.get_filters( + filter_id: "safe_domains" + ) + - language: PHP + code: |- + $resp = $client->ml()->getFilters([ + "filter_id" => "safe_domains", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ml/filters/safe_domains"' diff --git a/specification/ml/get_influencers/examples/request/MlGetInfluencersExample1.yaml b/specification/ml/get_influencers/examples/request/MlGetInfluencersExample1.yaml index 0bb4c9f2b1..0db8a4ae92 100644 --- a/specification/ml/get_influencers/examples/request/MlGetInfluencersExample1.yaml +++ b/specification/ml/get_influencers/examples/request/MlGetInfluencersExample1.yaml @@ -5,3 +5,41 @@ value: |- "sort": "influencer_score", "desc": true } +alternatives: + - language: Python + code: |- + resp = client.ml.get_influencers( + job_id="high_sum_total_sales", + sort="influencer_score", + desc=True, + ) + - language: JavaScript + code: |- + const response = await client.ml.getInfluencers({ + job_id: "high_sum_total_sales", + sort: "influencer_score", + desc: true, + }); + - language: Ruby + code: |- + response = client.ml.get_influencers( + job_id: "high_sum_total_sales", + body: { + "sort": "influencer_score", + "desc": true + } + ) + - language: PHP + code: |- + $resp = $client->ml()->getInfluencers([ + "job_id" => "high_sum_total_sales", + "body" => [ + "sort" => "influencer_score", + "desc" => true, + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"sort":"influencer_score","desc":true}'' + "$ELASTICSEARCH_URL/_ml/anomaly_detectors/high_sum_total_sales/results/influencers"' diff --git a/specification/ml/get_job_stats/examples/request/MlGetJobStatsExample1.yaml b/specification/ml/get_job_stats/examples/request/MlGetJobStatsExample1.yaml index 992d5eb383..1bef481d3d 100644 --- a/specification/ml/get_job_stats/examples/request/MlGetJobStatsExample1.yaml +++ b/specification/ml/get_job_stats/examples/request/MlGetJobStatsExample1.yaml @@ -1 +1,24 @@ method_request: GET _ml/anomaly_detectors/low_request_rate/_stats +alternatives: + - language: Python + code: |- + resp = client.ml.get_job_stats( + job_id="low_request_rate", + ) + - language: JavaScript + code: |- + const response = await client.ml.getJobStats({ + job_id: "low_request_rate", + }); + - language: Ruby + code: |- + response = client.ml.get_job_stats( + job_id: "low_request_rate" + ) + - language: PHP + code: |- + $resp = $client->ml()->getJobStats([ + "job_id" => "low_request_rate", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_stats"' diff --git a/specification/ml/get_jobs/examples/request/MlGetJobsExample1.yaml b/specification/ml/get_jobs/examples/request/MlGetJobsExample1.yaml index 5edb88e3ff..d1d45b4896 100644 --- a/specification/ml/get_jobs/examples/request/MlGetJobsExample1.yaml +++ b/specification/ml/get_jobs/examples/request/MlGetJobsExample1.yaml @@ -1 +1,24 @@ method_request: GET _ml/anomaly_detectors/high_sum_total_sales +alternatives: + - language: Python + code: |- + resp = client.ml.get_jobs( + job_id="high_sum_total_sales", + ) + - language: JavaScript + code: |- + const response = await client.ml.getJobs({ + job_id: "high_sum_total_sales", + }); + - language: Ruby + code: |- + response = client.ml.get_jobs( + job_id: "high_sum_total_sales" + ) + - language: PHP + code: |- + $resp = $client->ml()->getJobs([ + "job_id" => "high_sum_total_sales", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ml/anomaly_detectors/high_sum_total_sales"' diff --git a/specification/ml/get_memory_stats/examples/request/MlGetMemoryStatsExample1.yaml b/specification/ml/get_memory_stats/examples/request/MlGetMemoryStatsExample1.yaml index d96eea698e..f77ce9fb44 100644 --- a/specification/ml/get_memory_stats/examples/request/MlGetMemoryStatsExample1.yaml +++ b/specification/ml/get_memory_stats/examples/request/MlGetMemoryStatsExample1.yaml @@ -1 +1,24 @@ method_request: GET _ml/memory/_stats?human +alternatives: + - language: Python + code: |- + resp = client.ml.get_memory_stats( + human=True, + ) + - language: JavaScript + code: |- + const response = await client.ml.getMemoryStats({ + human: "true", + }); + - language: Ruby + code: |- + response = client.ml.get_memory_stats( + human: "true" + ) + - language: PHP + code: |- + $resp = $client->ml()->getMemoryStats([ + "human" => "true", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ml/memory/_stats?human"' diff --git a/specification/ml/get_model_snapshot_upgrade_stats/examples/request/MlGetModelSnapshotUpgradeStatsExample1.yaml b/specification/ml/get_model_snapshot_upgrade_stats/examples/request/MlGetModelSnapshotUpgradeStatsExample1.yaml index 42473e9e83..46b8019d7c 100644 --- a/specification/ml/get_model_snapshot_upgrade_stats/examples/request/MlGetModelSnapshotUpgradeStatsExample1.yaml +++ b/specification/ml/get_model_snapshot_upgrade_stats/examples/request/MlGetModelSnapshotUpgradeStatsExample1.yaml @@ -1 +1,29 @@ method_request: GET _ml/anomaly_detectors/low_request_rate/model_snapshots/_all/_upgrade/_stats +alternatives: + - language: Python + code: |- + resp = client.ml.get_model_snapshot_upgrade_stats( + job_id="low_request_rate", + snapshot_id="_all", + ) + - language: JavaScript + code: |- + const response = await client.ml.getModelSnapshotUpgradeStats({ + job_id: "low_request_rate", + snapshot_id: "_all", + }); + - language: Ruby + code: |- + response = client.ml.get_model_snapshot_upgrade_stats( + job_id: "low_request_rate", + snapshot_id: "_all" + ) + - language: PHP + code: |- + $resp = $client->ml()->getModelSnapshotUpgradeStats([ + "job_id" => "low_request_rate", + "snapshot_id" => "_all", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/model_snapshots/_all/_upgrade/_stats"' diff --git a/specification/ml/get_model_snapshots/examples/request/MlGetModelSnapshotsExample1.yaml b/specification/ml/get_model_snapshots/examples/request/MlGetModelSnapshotsExample1.yaml index 5d9f0959b4..0edf17ef47 100644 --- a/specification/ml/get_model_snapshots/examples/request/MlGetModelSnapshotsExample1.yaml +++ b/specification/ml/get_model_snapshots/examples/request/MlGetModelSnapshotsExample1.yaml @@ -4,3 +4,36 @@ value: |- { "start": "1575402236000" } +alternatives: + - language: Python + code: |- + resp = client.ml.get_model_snapshots( + job_id="high_sum_total_sales", + start="1575402236000", + ) + - language: JavaScript + code: |- + const response = await client.ml.getModelSnapshots({ + job_id: "high_sum_total_sales", + start: 1575402236000, + }); + - language: Ruby + code: |- + response = client.ml.get_model_snapshots( + job_id: "high_sum_total_sales", + body: { + "start": "1575402236000" + } + ) + - language: PHP + code: |- + $resp = $client->ml()->getModelSnapshots([ + "job_id" => "high_sum_total_sales", + "body" => [ + "start" => "1575402236000", + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"start":"1575402236000"}'' "$ELASTICSEARCH_URL/_ml/anomaly_detectors/high_sum_total_sales/model_snapshots"' diff --git a/specification/ml/get_overall_buckets/examples/request/MlGetOverallBucketsExample1.yaml b/specification/ml/get_overall_buckets/examples/request/MlGetOverallBucketsExample1.yaml index 3fd53f76b4..aa34212e8f 100644 --- a/specification/ml/get_overall_buckets/examples/request/MlGetOverallBucketsExample1.yaml +++ b/specification/ml/get_overall_buckets/examples/request/MlGetOverallBucketsExample1.yaml @@ -5,3 +5,41 @@ value: |- "overall_score": 80, "start": "1403532000000" } +alternatives: + - language: Python + code: |- + resp = client.ml.get_overall_buckets( + job_id="job-*", + overall_score=80, + start="1403532000000", + ) + - language: JavaScript + code: |- + const response = await client.ml.getOverallBuckets({ + job_id: "job-*", + overall_score: 80, + start: 1403532000000, + }); + - language: Ruby + code: |- + response = client.ml.get_overall_buckets( + job_id: "job-*", + body: { + "overall_score": 80, + "start": "1403532000000" + } + ) + - language: PHP + code: |- + $resp = $client->ml()->getOverallBuckets([ + "job_id" => "job-*", + "body" => [ + "overall_score" => 80, + "start" => "1403532000000", + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"overall_score":80,"start":"1403532000000"}'' + "$ELASTICSEARCH_URL/_ml/anomaly_detectors/job-*/results/overall_buckets"' diff --git a/specification/ml/get_records/examples/request/MlGetRecordsExample1.yaml b/specification/ml/get_records/examples/request/MlGetRecordsExample1.yaml index 78968584d7..56ce97b873 100644 --- a/specification/ml/get_records/examples/request/MlGetRecordsExample1.yaml +++ b/specification/ml/get_records/examples/request/MlGetRecordsExample1.yaml @@ -6,3 +6,45 @@ value: |- "desc": true, "start": "1454944100000" } +alternatives: + - language: Python + code: |- + resp = client.ml.get_records( + job_id="low_request_rate", + sort="record_score", + desc=True, + start="1454944100000", + ) + - language: JavaScript + code: |- + const response = await client.ml.getRecords({ + job_id: "low_request_rate", + sort: "record_score", + desc: true, + start: 1454944100000, + }); + - language: Ruby + code: |- + response = client.ml.get_records( + job_id: "low_request_rate", + body: { + "sort": "record_score", + "desc": true, + "start": "1454944100000" + } + ) + - language: PHP + code: |- + $resp = $client->ml()->getRecords([ + "job_id" => "low_request_rate", + "body" => [ + "sort" => "record_score", + "desc" => true, + "start" => "1454944100000", + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"sort":"record_score","desc":true,"start":"1454944100000"}'' + "$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/results/records"' diff --git a/specification/ml/get_trained_models/examples/request/MlGetTrainedModelsExample1.yaml b/specification/ml/get_trained_models/examples/request/MlGetTrainedModelsExample1.yaml index 6de7522ab6..0623a64daf 100644 --- a/specification/ml/get_trained_models/examples/request/MlGetTrainedModelsExample1.yaml +++ b/specification/ml/get_trained_models/examples/request/MlGetTrainedModelsExample1.yaml @@ -1 +1,12 @@ method_request: GET _ml/trained_models/ +alternatives: + - language: Python + code: resp = client.ml.get_trained_models() + - language: JavaScript + code: const response = await client.ml.getTrainedModels(); + - language: Ruby + code: response = client.ml.get_trained_models + - language: PHP + code: $resp = $client->ml()->getTrainedModels(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ml/trained_models/"' diff --git a/specification/ml/get_trained_models_stats/examples/request/MlGetTrainedModelsStatsExample1.yaml b/specification/ml/get_trained_models_stats/examples/request/MlGetTrainedModelsStatsExample1.yaml index f0367abf92..705a4b19c6 100644 --- a/specification/ml/get_trained_models_stats/examples/request/MlGetTrainedModelsStatsExample1.yaml +++ b/specification/ml/get_trained_models_stats/examples/request/MlGetTrainedModelsStatsExample1.yaml @@ -1 +1,12 @@ method_request: GET _ml/trained_models/_stats +alternatives: + - language: Python + code: resp = client.ml.get_trained_models_stats() + - language: JavaScript + code: const response = await client.ml.getTrainedModelsStats(); + - language: Ruby + code: response = client.ml.get_trained_models_stats + - language: PHP + code: $resp = $client->ml()->getTrainedModelsStats(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ml/trained_models/_stats"' diff --git a/specification/ml/infer_trained_model/examples/request/MlInferTrainedModelExample1.yaml b/specification/ml/infer_trained_model/examples/request/MlInferTrainedModelExample1.yaml index 1688659f03..bf09a45ecd 100644 --- a/specification/ml/infer_trained_model/examples/request/MlInferTrainedModelExample1.yaml +++ b/specification/ml/infer_trained_model/examples/request/MlInferTrainedModelExample1.yaml @@ -4,3 +4,53 @@ value: |- { "docs":[{"text": "The fool doth think he is wise, but the wise man knows himself to be a fool."}] } +alternatives: + - language: Python + code: |- + resp = client.ml.infer_trained_model( + model_id="lang_ident_model_1", + docs=[ + { + "text": "The fool doth think he is wise, but the wise man knows himself to be a fool." + } + ], + ) + - language: JavaScript + code: |- + const response = await client.ml.inferTrainedModel({ + model_id: "lang_ident_model_1", + docs: [ + { + text: "The fool doth think he is wise, but the wise man knows himself to be a fool.", + }, + ], + }); + - language: Ruby + code: |- + response = client.ml.infer_trained_model( + model_id: "lang_ident_model_1", + body: { + "docs": [ + { + "text": "The fool doth think he is wise, but the wise man knows himself to be a fool." + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->ml()->inferTrainedModel([ + "model_id" => "lang_ident_model_1", + "body" => [ + "docs" => array( + [ + "text" => "The fool doth think he is wise, but the wise man knows himself to be a fool.", + ], + ), + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"docs":[{"text":"The fool doth think he is wise, but the wise man knows himself to be a fool."}]}'' + "$ELASTICSEARCH_URL/_ml/trained_models/lang_ident_model_1/_infer"' diff --git a/specification/ml/info/examples/request/MlInfoExample1.yaml b/specification/ml/info/examples/request/MlInfoExample1.yaml index a32dec1f8d..ee8002d87b 100644 --- a/specification/ml/info/examples/request/MlInfoExample1.yaml +++ b/specification/ml/info/examples/request/MlInfoExample1.yaml @@ -1 +1,12 @@ method_request: GET _ml/info +alternatives: + - language: Python + code: resp = client.ml.info() + - language: JavaScript + code: const response = await client.ml.info(); + - language: Ruby + code: response = client.ml.info + - language: PHP + code: $resp = $client->ml()->info(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ml/info"' diff --git a/specification/ml/open_job/examples/request/MlOpenJobRequestExample1.yaml b/specification/ml/open_job/examples/request/MlOpenJobRequestExample1.yaml index b9643e9ca3..1235c16d12 100644 --- a/specification/ml/open_job/examples/request/MlOpenJobRequestExample1.yaml +++ b/specification/ml/open_job/examples/request/MlOpenJobRequestExample1.yaml @@ -1,6 +1,39 @@ # summary: +method_request: POST /_ml/anomaly_detectors/job-01/_open description: > - A request to open anomaly detection jobs. - The timeout specifies to wait 35 minutes for the job to open. + A request to open anomaly detection jobs. The timeout specifies to wait 35 minutes for the job to open. value: timeout: 35m +alternatives: + - language: Python + code: |- + resp = client.ml.open_job( + job_id="job-01", + timeout="35m", + ) + - language: JavaScript + code: |- + const response = await client.ml.openJob({ + job_id: "job-01", + timeout: "35m", + }); + - language: Ruby + code: |- + response = client.ml.open_job( + job_id: "job-01", + body: { + "timeout": "35m" + } + ) + - language: PHP + code: |- + $resp = $client->ml()->openJob([ + "job_id" => "job-01", + "body" => [ + "timeout" => "35m", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"timeout":"35m"}'' + "$ELASTICSEARCH_URL/_ml/anomaly_detectors/job-01/_open"' diff --git a/specification/ml/post_calendar_events/examples/request/MlPostCalendarEventsExample1.yaml b/specification/ml/post_calendar_events/examples/request/MlPostCalendarEventsExample1.yaml index 9235c4c7d8..0a6398f6b3 100644 --- a/specification/ml/post_calendar_events/examples/request/MlPostCalendarEventsExample1.yaml +++ b/specification/ml/post_calendar_events/examples/request/MlPostCalendarEventsExample1.yaml @@ -8,3 +8,102 @@ value: |- {"description": "event 3", "start_time": 1514160000000, "end_time": 1514246400000} ] } +alternatives: + - language: Python + code: |- + resp = client.ml.post_calendar_events( + calendar_id="planned-outages", + events=[ + { + "description": "event 1", + "start_time": 1513641600000, + "end_time": 1513728000000 + }, + { + "description": "event 2", + "start_time": 1513814400000, + "end_time": 1513900800000 + }, + { + "description": "event 3", + "start_time": 1514160000000, + "end_time": 1514246400000 + } + ], + ) + - language: JavaScript + code: |- + const response = await client.ml.postCalendarEvents({ + calendar_id: "planned-outages", + events: [ + { + description: "event 1", + start_time: 1513641600000, + end_time: 1513728000000, + }, + { + description: "event 2", + start_time: 1513814400000, + end_time: 1513900800000, + }, + { + description: "event 3", + start_time: 1514160000000, + end_time: 1514246400000, + }, + ], + }); + - language: Ruby + code: |- + response = client.ml.post_calendar_events( + calendar_id: "planned-outages", + body: { + "events": [ + { + "description": "event 1", + "start_time": 1513641600000, + "end_time": 1513728000000 + }, + { + "description": "event 2", + "start_time": 1513814400000, + "end_time": 1513900800000 + }, + { + "description": "event 3", + "start_time": 1514160000000, + "end_time": 1514246400000 + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->ml()->postCalendarEvents([ + "calendar_id" => "planned-outages", + "body" => [ + "events" => array( + [ + "description" => "event 1", + "start_time" => 1513641600000, + "end_time" => 1513728000000, + ], + [ + "description" => "event 2", + "start_time" => 1513814400000, + "end_time" => 1513900800000, + ], + [ + "description" => "event 3", + "start_time" => 1514160000000, + "end_time" => 1514246400000, + ], + ), + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"events":[{"description":"event 1","start_time":1513641600000,"end_time":1513728000000},{"description":"event + 2","start_time":1513814400000,"end_time":1513900800000},{"description":"event + 3","start_time":1514160000000,"end_time":1514246400000}]}'' "$ELASTICSEARCH_URL/_ml/calendars/planned-outages/events"' diff --git a/specification/ml/preview_data_frame_analytics/examples/request/MlPreviewDataFrameAnalyticsExample1.yaml b/specification/ml/preview_data_frame_analytics/examples/request/MlPreviewDataFrameAnalyticsExample1.yaml index cd481962f9..fb46ccdb06 100644 --- a/specification/ml/preview_data_frame_analytics/examples/request/MlPreviewDataFrameAnalyticsExample1.yaml +++ b/specification/ml/preview_data_frame_analytics/examples/request/MlPreviewDataFrameAnalyticsExample1.yaml @@ -13,3 +13,69 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.ml.preview_data_frame_analytics( + config={ + "source": { + "index": "houses_sold_last_10_yrs" + }, + "analysis": { + "regression": { + "dependent_variable": "price" + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.ml.previewDataFrameAnalytics({ + config: { + source: { + index: "houses_sold_last_10_yrs", + }, + analysis: { + regression: { + dependent_variable: "price", + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.ml.preview_data_frame_analytics( + body: { + "config": { + "source": { + "index": "houses_sold_last_10_yrs" + }, + "analysis": { + "regression": { + "dependent_variable": "price" + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->ml()->previewDataFrameAnalytics([ + "body" => [ + "config" => [ + "source" => [ + "index" => "houses_sold_last_10_yrs", + ], + "analysis" => [ + "regression" => [ + "dependent_variable" => "price", + ], + ], + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"config\":{\"source\":{\"index\":\"houses_sold_last_10_yrs\"},\"analysis\":{\"regression\":{\"dependent_variable\":\"price\ + \"}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/_preview\"" diff --git a/specification/ml/preview_datafeed/examples/request/MlPreviewDatafeedExample1.yaml b/specification/ml/preview_datafeed/examples/request/MlPreviewDatafeedExample1.yaml index 59b54791fa..7360494d2d 100644 --- a/specification/ml/preview_datafeed/examples/request/MlPreviewDatafeedExample1.yaml +++ b/specification/ml/preview_datafeed/examples/request/MlPreviewDatafeedExample1.yaml @@ -1 +1,25 @@ method_request: GET _ml/datafeeds/datafeed-high_sum_total_sales/_preview +alternatives: + - language: Python + code: |- + resp = client.ml.preview_datafeed( + datafeed_id="datafeed-high_sum_total_sales", + ) + - language: JavaScript + code: |- + const response = await client.ml.previewDatafeed({ + datafeed_id: "datafeed-high_sum_total_sales", + }); + - language: Ruby + code: |- + response = client.ml.preview_datafeed( + datafeed_id: "datafeed-high_sum_total_sales" + ) + - language: PHP + code: |- + $resp = $client->ml()->previewDatafeed([ + "datafeed_id" => "datafeed-high_sum_total_sales", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales/_preview"' diff --git a/specification/ml/put_calendar/examples/request/MlPutCalendarExample1.yaml b/specification/ml/put_calendar/examples/request/MlPutCalendarExample1.yaml index a566a5aaca..94a77bccd2 100644 --- a/specification/ml/put_calendar/examples/request/MlPutCalendarExample1.yaml +++ b/specification/ml/put_calendar/examples/request/MlPutCalendarExample1.yaml @@ -1 +1,24 @@ method_request: PUT _ml/calendars/planned-outages +alternatives: + - language: Python + code: |- + resp = client.ml.put_calendar( + calendar_id="planned-outages", + ) + - language: JavaScript + code: |- + const response = await client.ml.putCalendar({ + calendar_id: "planned-outages", + }); + - language: Ruby + code: |- + response = client.ml.put_calendar( + calendar_id: "planned-outages" + ) + - language: PHP + code: |- + $resp = $client->ml()->putCalendar([ + "calendar_id" => "planned-outages", + ]); + - language: curl + code: 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ml/calendars/planned-outages"' diff --git a/specification/ml/put_calendar_job/examples/request/MlPutCalendarJobExample1.yaml b/specification/ml/put_calendar_job/examples/request/MlPutCalendarJobExample1.yaml index d380156208..df6837e87b 100644 --- a/specification/ml/put_calendar_job/examples/request/MlPutCalendarJobExample1.yaml +++ b/specification/ml/put_calendar_job/examples/request/MlPutCalendarJobExample1.yaml @@ -1 +1,29 @@ method_request: PUT _ml/calendars/planned-outages/jobs/total-requests +alternatives: + - language: Python + code: |- + resp = client.ml.put_calendar_job( + calendar_id="planned-outages", + job_id="total-requests", + ) + - language: JavaScript + code: |- + const response = await client.ml.putCalendarJob({ + calendar_id: "planned-outages", + job_id: "total-requests", + }); + - language: Ruby + code: |- + response = client.ml.put_calendar_job( + calendar_id: "planned-outages", + job_id: "total-requests" + ) + - language: PHP + code: |- + $resp = $client->ml()->putCalendarJob([ + "calendar_id" => "planned-outages", + "job_id" => "total-requests", + ]); + - language: curl + code: 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_ml/calendars/planned-outages/jobs/total-requests"' diff --git a/specification/ml/put_data_frame_analytics/examples/request/MlPutDataFrameAnalyticsExample1.yaml b/specification/ml/put_data_frame_analytics/examples/request/MlPutDataFrameAnalyticsExample1.yaml index 266d059d4c..c6b4145f23 100644 --- a/specification/ml/put_data_frame_analytics/examples/request/MlPutDataFrameAnalyticsExample1.yaml +++ b/specification/ml/put_data_frame_analytics/examples/request/MlPutDataFrameAnalyticsExample1.yaml @@ -39,3 +39,175 @@ value: |- }, "model_memory_limit": "100mb" } +alternatives: + - language: Python + code: |- + resp = client.ml.put_data_frame_analytics( + id="model-flight-delays-pre", + source={ + "index": [ + "kibana_sample_data_flights" + ], + "query": { + "range": { + "DistanceKilometers": { + "gt": 0 + } + } + }, + "_source": { + "includes": [], + "excludes": [ + "FlightDelay", + "FlightDelayType" + ] + } + }, + dest={ + "index": "df-flight-delays", + "results_field": "ml-results" + }, + analysis={ + "regression": { + "dependent_variable": "FlightDelayMin", + "training_percent": 90 + } + }, + analyzed_fields={ + "includes": [], + "excludes": [ + "FlightNum" + ] + }, + model_memory_limit="100mb", + ) + - language: JavaScript + code: |- + const response = await client.ml.putDataFrameAnalytics({ + id: "model-flight-delays-pre", + source: { + index: ["kibana_sample_data_flights"], + query: { + range: { + DistanceKilometers: { + gt: 0, + }, + }, + }, + _source: { + includes: [], + excludes: ["FlightDelay", "FlightDelayType"], + }, + }, + dest: { + index: "df-flight-delays", + results_field: "ml-results", + }, + analysis: { + regression: { + dependent_variable: "FlightDelayMin", + training_percent: 90, + }, + }, + analyzed_fields: { + includes: [], + excludes: ["FlightNum"], + }, + model_memory_limit: "100mb", + }); + - language: Ruby + code: |- + response = client.ml.put_data_frame_analytics( + id: "model-flight-delays-pre", + body: { + "source": { + "index": [ + "kibana_sample_data_flights" + ], + "query": { + "range": { + "DistanceKilometers": { + "gt": 0 + } + } + }, + "_source": { + "includes": [], + "excludes": [ + "FlightDelay", + "FlightDelayType" + ] + } + }, + "dest": { + "index": "df-flight-delays", + "results_field": "ml-results" + }, + "analysis": { + "regression": { + "dependent_variable": "FlightDelayMin", + "training_percent": 90 + } + }, + "analyzed_fields": { + "includes": [], + "excludes": [ + "FlightNum" + ] + }, + "model_memory_limit": "100mb" + } + ) + - language: PHP + code: |- + $resp = $client->ml()->putDataFrameAnalytics([ + "id" => "model-flight-delays-pre", + "body" => [ + "source" => [ + "index" => array( + "kibana_sample_data_flights", + ), + "query" => [ + "range" => [ + "DistanceKilometers" => [ + "gt" => 0, + ], + ], + ], + "_source" => [ + "includes" => array( + ), + "excludes" => array( + "FlightDelay", + "FlightDelayType", + ), + ], + ], + "dest" => [ + "index" => "df-flight-delays", + "results_field" => "ml-results", + ], + "analysis" => [ + "regression" => [ + "dependent_variable" => "FlightDelayMin", + "training_percent" => 90, + ], + ], + "analyzed_fields" => [ + "includes" => array( + ), + "excludes" => array( + "FlightNum", + ), + ], + "model_memory_limit" => "100mb", + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"source\":{\"index\":[\"kibana_sample_data_flights\"],\"query\":{\"range\":{\"DistanceKilometers\":{\"gt\":0}}},\"_source\ + \":{\"includes\":[],\"excludes\":[\"FlightDelay\",\"FlightDelayType\"]}},\"dest\":{\"index\":\"df-flight-delays\",\"results_f\ + ield\":\"ml-results\"},\"analysis\":{\"regression\":{\"dependent_variable\":\"FlightDelayMin\",\"training_percent\":90}},\"an\ + alyzed_fields\":{\"includes\":[],\"excludes\":[\"FlightNum\"]},\"model_memory_limit\":\"100mb\"}' + \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/model-flight-delays-pre\"" diff --git a/specification/ml/put_datafeed/examples/request/MlPutDatafeedExample1.yaml b/specification/ml/put_datafeed/examples/request/MlPutDatafeedExample1.yaml index 8dcb37a8b2..db371b8bbd 100644 --- a/specification/ml/put_datafeed/examples/request/MlPutDatafeedExample1.yaml +++ b/specification/ml/put_datafeed/examples/request/MlPutDatafeedExample1.yaml @@ -16,3 +16,87 @@ value: |- }, "job_id": "test-job" } +alternatives: + - language: Python + code: |- + resp = client.ml.put_datafeed( + datafeed_id="datafeed-test-job", + pretty=True, + indices=[ + "kibana_sample_data_logs" + ], + query={ + "bool": { + "must": [ + { + "match_all": {} + } + ] + } + }, + job_id="test-job", + ) + - language: JavaScript + code: |- + const response = await client.ml.putDatafeed({ + datafeed_id: "datafeed-test-job", + pretty: "true", + indices: ["kibana_sample_data_logs"], + query: { + bool: { + must: [ + { + match_all: {}, + }, + ], + }, + }, + job_id: "test-job", + }); + - language: Ruby + code: |- + response = client.ml.put_datafeed( + datafeed_id: "datafeed-test-job", + pretty: "true", + body: { + "indices": [ + "kibana_sample_data_logs" + ], + "query": { + "bool": { + "must": [ + { + "match_all": {} + } + ] + } + }, + "job_id": "test-job" + } + ) + - language: PHP + code: |- + $resp = $client->ml()->putDatafeed([ + "datafeed_id" => "datafeed-test-job", + "pretty" => "true", + "body" => [ + "indices" => array( + "kibana_sample_data_logs", + ), + "query" => [ + "bool" => [ + "must" => array( + [ + "match_all" => new ArrayObject([]), + ], + ), + ], + ], + "job_id" => "test-job", + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"indices":["kibana_sample_data_logs"],"query":{"bool":{"must":[{"match_all":{}}]}},"job_id":"test-job"}'' + "$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-test-job?pretty"' diff --git a/specification/ml/put_filter/examples/request/MlPutFilterExample1.yaml b/specification/ml/put_filter/examples/request/MlPutFilterExample1.yaml index 36a56f9989..81aaa52d34 100644 --- a/specification/ml/put_filter/examples/request/MlPutFilterExample1.yaml +++ b/specification/ml/put_filter/examples/request/MlPutFilterExample1.yaml @@ -5,3 +5,49 @@ value: |- "description": "A list of safe domains", "items": ["*.google.com", "wikipedia.org"] } +alternatives: + - language: Python + code: |- + resp = client.ml.put_filter( + filter_id="safe_domains", + description="A list of safe domains", + items=[ + "*.google.com", + "wikipedia.org" + ], + ) + - language: JavaScript + code: |- + const response = await client.ml.putFilter({ + filter_id: "safe_domains", + description: "A list of safe domains", + items: ["*.google.com", "wikipedia.org"], + }); + - language: Ruby + code: |- + response = client.ml.put_filter( + filter_id: "safe_domains", + body: { + "description": "A list of safe domains", + "items": [ + "*.google.com", + "wikipedia.org" + ] + } + ) + - language: PHP + code: |- + $resp = $client->ml()->putFilter([ + "filter_id" => "safe_domains", + "body" => [ + "description" => "A list of safe domains", + "items" => array( + "*.google.com", + "wikipedia.org", + ), + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"description":"A list + of safe domains","items":["*.google.com","wikipedia.org"]}'' "$ELASTICSEARCH_URL/_ml/filters/safe_domains"' diff --git a/specification/ml/put_job/examples/request/MlPutJobRequestExample1.yaml b/specification/ml/put_job/examples/request/MlPutJobRequestExample1.yaml index a75536f622..479078c1d2 100644 --- a/specification/ml/put_job/examples/request/MlPutJobRequestExample1.yaml +++ b/specification/ml/put_job/examples/request/MlPutJobRequestExample1.yaml @@ -1,4 +1,5 @@ # summary: +method_request: PUT /_ml/anomaly_detectors/job-01 description: A request to create an anomaly detection job and datafeed. value: analysis_config: @@ -29,3 +30,216 @@ value: script: source: "emit(doc['timestamp'].value.getHour());" datafeed_id: datafeed-test-job1 +alternatives: + - language: Python + code: |- + resp = client.ml.put_job( + job_id="job-01", + analysis_config={ + "bucket_span": "15m", + "detectors": [ + { + "detector_description": "Sum of bytes", + "function": "sum", + "field_name": "bytes" + } + ] + }, + data_description={ + "time_field": "timestamp", + "time_format": "epoch_ms" + }, + analysis_limits={ + "model_memory_limit": "11MB" + }, + model_plot_config={ + "enabled": True, + "annotations_enabled": True + }, + results_index_name="test-job1", + datafeed_config={ + "indices": [ + "kibana_sample_data_logs" + ], + "query": { + "bool": { + "must": [ + { + "match_all": {} + } + ] + } + }, + "runtime_mappings": { + "hour_of_day": { + "type": "long", + "script": { + "source": "emit(doc['timestamp'].value.getHour());" + } + } + }, + "datafeed_id": "datafeed-test-job1" + }, + ) + - language: JavaScript + code: |- + const response = await client.ml.putJob({ + job_id: "job-01", + analysis_config: { + bucket_span: "15m", + detectors: [ + { + detector_description: "Sum of bytes", + function: "sum", + field_name: "bytes", + }, + ], + }, + data_description: { + time_field: "timestamp", + time_format: "epoch_ms", + }, + analysis_limits: { + model_memory_limit: "11MB", + }, + model_plot_config: { + enabled: true, + annotations_enabled: true, + }, + results_index_name: "test-job1", + datafeed_config: { + indices: ["kibana_sample_data_logs"], + query: { + bool: { + must: [ + { + match_all: {}, + }, + ], + }, + }, + runtime_mappings: { + hour_of_day: { + type: "long", + script: { + source: "emit(doc['timestamp'].value.getHour());", + }, + }, + }, + datafeed_id: "datafeed-test-job1", + }, + }); + - language: Ruby + code: |- + response = client.ml.put_job( + job_id: "job-01", + body: { + "analysis_config": { + "bucket_span": "15m", + "detectors": [ + { + "detector_description": "Sum of bytes", + "function": "sum", + "field_name": "bytes" + } + ] + }, + "data_description": { + "time_field": "timestamp", + "time_format": "epoch_ms" + }, + "analysis_limits": { + "model_memory_limit": "11MB" + }, + "model_plot_config": { + "enabled": true, + "annotations_enabled": true + }, + "results_index_name": "test-job1", + "datafeed_config": { + "indices": [ + "kibana_sample_data_logs" + ], + "query": { + "bool": { + "must": [ + { + "match_all": {} + } + ] + } + }, + "runtime_mappings": { + "hour_of_day": { + "type": "long", + "script": { + "source": "emit(doc['timestamp'].value.getHour());" + } + } + }, + "datafeed_id": "datafeed-test-job1" + } + } + ) + - language: PHP + code: |- + $resp = $client->ml()->putJob([ + "job_id" => "job-01", + "body" => [ + "analysis_config" => [ + "bucket_span" => "15m", + "detectors" => array( + [ + "detector_description" => "Sum of bytes", + "function" => "sum", + "field_name" => "bytes", + ], + ), + ], + "data_description" => [ + "time_field" => "timestamp", + "time_format" => "epoch_ms", + ], + "analysis_limits" => [ + "model_memory_limit" => "11MB", + ], + "model_plot_config" => [ + "enabled" => true, + "annotations_enabled" => true, + ], + "results_index_name" => "test-job1", + "datafeed_config" => [ + "indices" => array( + "kibana_sample_data_logs", + ), + "query" => [ + "bool" => [ + "must" => array( + [ + "match_all" => new ArrayObject([]), + ], + ), + ], + ], + "runtime_mappings" => [ + "hour_of_day" => [ + "type" => "long", + "script" => [ + "source" => "emit(doc['timestamp'].value.getHour());", + ], + ], + ], + "datafeed_id" => "datafeed-test-job1", + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"analysis_config\":{\"bucket_span\":\"15m\",\"detectors\":[{\"detector_description\":\"Sum of + bytes\",\"function\":\"sum\",\"field_name\":\"bytes\"}]},\"data_description\":{\"time_field\":\"timestamp\",\"time_format\":\ + \"epoch_ms\"},\"analysis_limits\":{\"model_memory_limit\":\"11MB\"},\"model_plot_config\":{\"enabled\":true,\"annotations_ena\ + bled\":true},\"results_index_name\":\"test-job1\",\"datafeed_config\":{\"indices\":[\"kibana_sample_data_logs\"],\"query\":{\ + \"bool\":{\"must\":[{\"match_all\":{}}]}},\"runtime_mappings\":{\"hour_of_day\":{\"type\":\"long\",\"script\":{\"source\":\"e\ + mit(doc['\"'\"'timestamp'\"'\"'].value.getHour());\"}}},\"datafeed_id\":\"datafeed-test-job1\"}}' + \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/job-01\"" diff --git a/specification/ml/put_trained_model_alias/examples/request/MlPutTrainedModelAliasExample1.yaml b/specification/ml/put_trained_model_alias/examples/request/MlPutTrainedModelAliasExample1.yaml index 50b8336929..99d7087472 100644 --- a/specification/ml/put_trained_model_alias/examples/request/MlPutTrainedModelAliasExample1.yaml +++ b/specification/ml/put_trained_model_alias/examples/request/MlPutTrainedModelAliasExample1.yaml @@ -1 +1,29 @@ method_request: PUT _ml/trained_models/flight-delay-prediction-1574775339910/model_aliases/flight_delay_model +alternatives: + - language: Python + code: |- + resp = client.ml.put_trained_model_alias( + model_id="flight-delay-prediction-1574775339910", + model_alias="flight_delay_model", + ) + - language: JavaScript + code: |- + const response = await client.ml.putTrainedModelAlias({ + model_id: "flight-delay-prediction-1574775339910", + model_alias: "flight_delay_model", + }); + - language: Ruby + code: |- + response = client.ml.put_trained_model_alias( + model_id: "flight-delay-prediction-1574775339910", + model_alias: "flight_delay_model" + ) + - language: PHP + code: |- + $resp = $client->ml()->putTrainedModelAlias([ + "model_id" => "flight-delay-prediction-1574775339910", + "model_alias" => "flight_delay_model", + ]); + - language: curl + code: 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_ml/trained_models/flight-delay-prediction-1574775339910/model_aliases/flight_delay_model"' diff --git a/specification/ml/put_trained_model_definition_part/examples/request/MlPutTrainedModelDefinitionPartExample1.yaml b/specification/ml/put_trained_model_definition_part/examples/request/MlPutTrainedModelDefinitionPartExample1.yaml index e3ee1da7db..d9868bc8d4 100644 --- a/specification/ml/put_trained_model_definition_part/examples/request/MlPutTrainedModelDefinitionPartExample1.yaml +++ b/specification/ml/put_trained_model_definition_part/examples/request/MlPutTrainedModelDefinitionPartExample1.yaml @@ -6,3 +6,49 @@ value: |- "total_definition_length": 265632637, "total_parts": 64 } +alternatives: + - language: Python + code: |- + resp = client.ml.put_trained_model_definition_part( + model_id="elastic__distilbert-base-uncased-finetuned-conll03-english", + part="0", + definition="...", + total_definition_length=265632637, + total_parts=64, + ) + - language: JavaScript + code: |- + const response = await client.ml.putTrainedModelDefinitionPart({ + model_id: "elastic__distilbert-base-uncased-finetuned-conll03-english", + part: 0, + definition: "...", + total_definition_length: 265632637, + total_parts: 64, + }); + - language: Ruby + code: |- + response = client.ml.put_trained_model_definition_part( + model_id: "elastic__distilbert-base-uncased-finetuned-conll03-english", + part: "0", + body: { + "definition": "...", + "total_definition_length": 265632637, + "total_parts": 64 + } + ) + - language: PHP + code: |- + $resp = $client->ml()->putTrainedModelDefinitionPart([ + "model_id" => "elastic__distilbert-base-uncased-finetuned-conll03-english", + "part" => "0", + "body" => [ + "definition" => "...", + "total_definition_length" => 265632637, + "total_parts" => 64, + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"definition":"...","total_definition_length":265632637,"total_parts":64}'' + "$ELASTICSEARCH_URL/_ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/definition/0"' diff --git a/specification/ml/put_trained_model_vocabulary/examples/request/MlPutTrainedModelVocabularyExample1.yaml b/specification/ml/put_trained_model_vocabulary/examples/request/MlPutTrainedModelVocabularyExample1.yaml index c1fd6ac8a6..a10dfa0386 100644 --- a/specification/ml/put_trained_model_vocabulary/examples/request/MlPutTrainedModelVocabularyExample1.yaml +++ b/specification/ml/put_trained_model_vocabulary/examples/request/MlPutTrainedModelVocabularyExample1.yaml @@ -5,6 +5,48 @@ value: |- "vocabulary": [ "[PAD]", "[unused0]", - ... ] } +alternatives: + - language: Python + code: |- + resp = client.ml.put_trained_model_vocabulary( + model_id="elastic__distilbert-base-uncased-finetuned-conll03-english", + vocabulary=[ + "[PAD]", + "[unused0]" + ], + ) + - language: JavaScript + code: |- + const response = await client.ml.putTrainedModelVocabulary({ + model_id: "elastic__distilbert-base-uncased-finetuned-conll03-english", + vocabulary: ["[PAD]", "[unused0]"], + }); + - language: Ruby + code: |- + response = client.ml.put_trained_model_vocabulary( + model_id: "elastic__distilbert-base-uncased-finetuned-conll03-english", + body: { + "vocabulary": [ + "[PAD]", + "[unused0]" + ] + } + ) + - language: PHP + code: |- + $resp = $client->ml()->putTrainedModelVocabulary([ + "model_id" => "elastic__distilbert-base-uncased-finetuned-conll03-english", + "body" => [ + "vocabulary" => array( + "[PAD]", + "[unused0]", + ), + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"vocabulary":["[PAD]","[unused0]"]}'' + "$ELASTICSEARCH_URL/_ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/vocabulary"' diff --git a/specification/ml/reset_job/examples/request/MlResetJobExample1.yaml b/specification/ml/reset_job/examples/request/MlResetJobExample1.yaml index 60909463d9..7e10fc9ddd 100644 --- a/specification/ml/reset_job/examples/request/MlResetJobExample1.yaml +++ b/specification/ml/reset_job/examples/request/MlResetJobExample1.yaml @@ -1 +1,24 @@ method_request: POST _ml/anomaly_detectors/total-requests/_reset +alternatives: + - language: Python + code: |- + resp = client.ml.reset_job( + job_id="total-requests", + ) + - language: JavaScript + code: |- + const response = await client.ml.resetJob({ + job_id: "total-requests", + }); + - language: Ruby + code: |- + response = client.ml.reset_job( + job_id: "total-requests" + ) + - language: PHP + code: |- + $resp = $client->ml()->resetJob([ + "job_id" => "total-requests", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ml/anomaly_detectors/total-requests/_reset"' diff --git a/specification/ml/revert_model_snapshot/examples/request/MlRevertModelSnapshotExample1.yaml b/specification/ml/revert_model_snapshot/examples/request/MlRevertModelSnapshotExample1.yaml index be5b441ba5..a1f7042288 100644 --- a/specification/ml/revert_model_snapshot/examples/request/MlRevertModelSnapshotExample1.yaml +++ b/specification/ml/revert_model_snapshot/examples/request/MlRevertModelSnapshotExample1.yaml @@ -4,3 +4,41 @@ value: |- { "delete_intervening_results": true } +alternatives: + - language: Python + code: |- + resp = client.ml.revert_model_snapshot( + job_id="low_request_rate", + snapshot_id="1637092688", + delete_intervening_results=True, + ) + - language: JavaScript + code: |- + const response = await client.ml.revertModelSnapshot({ + job_id: "low_request_rate", + snapshot_id: 1637092688, + delete_intervening_results: true, + }); + - language: Ruby + code: |- + response = client.ml.revert_model_snapshot( + job_id: "low_request_rate", + snapshot_id: "1637092688", + body: { + "delete_intervening_results": true + } + ) + - language: PHP + code: |- + $resp = $client->ml()->revertModelSnapshot([ + "job_id" => "low_request_rate", + "snapshot_id" => "1637092688", + "body" => [ + "delete_intervening_results" => true, + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"delete_intervening_results":true}'' + "$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/model_snapshots/1637092688/_revert"' diff --git a/specification/ml/set_upgrade_mode/examples/request/MlSetUpgradeModeExample1.yaml b/specification/ml/set_upgrade_mode/examples/request/MlSetUpgradeModeExample1.yaml index e17ca2f2a5..74f17e27f8 100644 --- a/specification/ml/set_upgrade_mode/examples/request/MlSetUpgradeModeExample1.yaml +++ b/specification/ml/set_upgrade_mode/examples/request/MlSetUpgradeModeExample1.yaml @@ -1 +1,24 @@ method_request: POST _ml/set_upgrade_mode?enabled=true +alternatives: + - language: Python + code: |- + resp = client.ml.set_upgrade_mode( + enabled=True, + ) + - language: JavaScript + code: |- + const response = await client.ml.setUpgradeMode({ + enabled: "true", + }); + - language: Ruby + code: |- + response = client.ml.set_upgrade_mode( + enabled: "true" + ) + - language: PHP + code: |- + $resp = $client->ml()->setUpgradeMode([ + "enabled" => "true", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ml/set_upgrade_mode?enabled=true"' diff --git a/specification/ml/start_data_frame_analytics/examples/request/MlStartDataFrameAnalyticsExample1.yaml b/specification/ml/start_data_frame_analytics/examples/request/MlStartDataFrameAnalyticsExample1.yaml index 74653e7a8b..afbd025c19 100644 --- a/specification/ml/start_data_frame_analytics/examples/request/MlStartDataFrameAnalyticsExample1.yaml +++ b/specification/ml/start_data_frame_analytics/examples/request/MlStartDataFrameAnalyticsExample1.yaml @@ -1 +1,24 @@ method_request: POST _ml/data_frame/analytics/loganalytics/_start +alternatives: + - language: Python + code: |- + resp = client.ml.start_data_frame_analytics( + id="loganalytics", + ) + - language: JavaScript + code: |- + const response = await client.ml.startDataFrameAnalytics({ + id: "loganalytics", + }); + - language: Ruby + code: |- + response = client.ml.start_data_frame_analytics( + id: "loganalytics" + ) + - language: PHP + code: |- + $resp = $client->ml()->startDataFrameAnalytics([ + "id" => "loganalytics", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics/_start"' diff --git a/specification/ml/start_datafeed/examples/request/MlStartDatafeedExample1.yaml b/specification/ml/start_datafeed/examples/request/MlStartDatafeedExample1.yaml index 561f5e64cc..6ea05f4fe7 100644 --- a/specification/ml/start_datafeed/examples/request/MlStartDatafeedExample1.yaml +++ b/specification/ml/start_datafeed/examples/request/MlStartDatafeedExample1.yaml @@ -4,3 +4,36 @@ value: |- { "start": "2019-04-07T18:22:16Z" } +alternatives: + - language: Python + code: |- + resp = client.ml.start_datafeed( + datafeed_id="datafeed-low_request_rate", + start="2019-04-07T18:22:16Z", + ) + - language: JavaScript + code: |- + const response = await client.ml.startDatafeed({ + datafeed_id: "datafeed-low_request_rate", + start: "2019-04-07T18:22:16Z", + }); + - language: Ruby + code: |- + response = client.ml.start_datafeed( + datafeed_id: "datafeed-low_request_rate", + body: { + "start": "2019-04-07T18:22:16Z" + } + ) + - language: PHP + code: |- + $resp = $client->ml()->startDatafeed([ + "datafeed_id" => "datafeed-low_request_rate", + "body" => [ + "start" => "2019-04-07T18:22:16Z", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"start":"2019-04-07T18:22:16Z"}'' "$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-low_request_rate/_start"' diff --git a/specification/ml/start_trained_model_deployment/examples/request/MlStartTrainedModelDeploymentExample1.yaml b/specification/ml/start_trained_model_deployment/examples/request/MlStartTrainedModelDeploymentExample1.yaml index bde8ed0c79..475c98591a 100644 --- a/specification/ml/start_trained_model_deployment/examples/request/MlStartTrainedModelDeploymentExample1.yaml +++ b/specification/ml/start_trained_model_deployment/examples/request/MlStartTrainedModelDeploymentExample1.yaml @@ -1 +1,33 @@ method_request: POST _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_start?wait_for=started&timeout=1m +alternatives: + - language: Python + code: |- + resp = client.ml.start_trained_model_deployment( + model_id="elastic__distilbert-base-uncased-finetuned-conll03-english", + wait_for="started", + timeout="1m", + ) + - language: JavaScript + code: |- + const response = await client.ml.startTrainedModelDeployment({ + model_id: "elastic__distilbert-base-uncased-finetuned-conll03-english", + wait_for: "started", + timeout: "1m", + }); + - language: Ruby + code: |- + response = client.ml.start_trained_model_deployment( + model_id: "elastic__distilbert-base-uncased-finetuned-conll03-english", + wait_for: "started", + timeout: "1m" + ) + - language: PHP + code: |- + $resp = $client->ml()->startTrainedModelDeployment([ + "model_id" => "elastic__distilbert-base-uncased-finetuned-conll03-english", + "wait_for" => "started", + "timeout" => "1m", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_start?wait_for=started&timeout=1m"' diff --git a/specification/ml/stop_data_frame_analytics/examples/request/MlStopDataFrameAnalyticsExample1.yaml b/specification/ml/stop_data_frame_analytics/examples/request/MlStopDataFrameAnalyticsExample1.yaml index 819d809f82..748bd41841 100644 --- a/specification/ml/stop_data_frame_analytics/examples/request/MlStopDataFrameAnalyticsExample1.yaml +++ b/specification/ml/stop_data_frame_analytics/examples/request/MlStopDataFrameAnalyticsExample1.yaml @@ -1 +1,24 @@ method_request: POST _ml/data_frame/analytics/loganalytics/_stop +alternatives: + - language: Python + code: |- + resp = client.ml.stop_data_frame_analytics( + id="loganalytics", + ) + - language: JavaScript + code: |- + const response = await client.ml.stopDataFrameAnalytics({ + id: "loganalytics", + }); + - language: Ruby + code: |- + response = client.ml.stop_data_frame_analytics( + id: "loganalytics" + ) + - language: PHP + code: |- + $resp = $client->ml()->stopDataFrameAnalytics([ + "id" => "loganalytics", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics/_stop"' diff --git a/specification/ml/stop_datafeed/examples/request/MlStopDatafeedExample1.yaml b/specification/ml/stop_datafeed/examples/request/MlStopDatafeedExample1.yaml index e13b090a8a..4ff7e1c273 100644 --- a/specification/ml/stop_datafeed/examples/request/MlStopDatafeedExample1.yaml +++ b/specification/ml/stop_datafeed/examples/request/MlStopDatafeedExample1.yaml @@ -4,3 +4,36 @@ value: |- { "timeout": "30s" } +alternatives: + - language: Python + code: |- + resp = client.ml.stop_datafeed( + datafeed_id="datafeed-low_request_rate", + timeout="30s", + ) + - language: JavaScript + code: |- + const response = await client.ml.stopDatafeed({ + datafeed_id: "datafeed-low_request_rate", + timeout: "30s", + }); + - language: Ruby + code: |- + response = client.ml.stop_datafeed( + datafeed_id: "datafeed-low_request_rate", + body: { + "timeout": "30s" + } + ) + - language: PHP + code: |- + $resp = $client->ml()->stopDatafeed([ + "datafeed_id" => "datafeed-low_request_rate", + "body" => [ + "timeout" => "30s", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"timeout":"30s"}'' + "$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-low_request_rate/_stop"' diff --git a/specification/ml/stop_trained_model_deployment/examples/request/MlStopTrainedModelDeploymentExample1.yaml b/specification/ml/stop_trained_model_deployment/examples/request/MlStopTrainedModelDeploymentExample1.yaml index 74d933d369..408a1989d6 100644 --- a/specification/ml/stop_trained_model_deployment/examples/request/MlStopTrainedModelDeploymentExample1.yaml +++ b/specification/ml/stop_trained_model_deployment/examples/request/MlStopTrainedModelDeploymentExample1.yaml @@ -1 +1,25 @@ method_request: POST _ml/trained_models/my_model_for_search/deployment/_stop +alternatives: + - language: Python + code: |- + resp = client.ml.stop_trained_model_deployment( + model_id="my_model_for_search", + ) + - language: JavaScript + code: |- + const response = await client.ml.stopTrainedModelDeployment({ + model_id: "my_model_for_search", + }); + - language: Ruby + code: |- + response = client.ml.stop_trained_model_deployment( + model_id: "my_model_for_search" + ) + - language: PHP + code: |- + $resp = $client->ml()->stopTrainedModelDeployment([ + "model_id" => "my_model_for_search", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_ml/trained_models/my_model_for_search/deployment/_stop"' diff --git a/specification/ml/update_data_frame_analytics/examples/request/MlUpdateDataFrameAnalyticsExample1.yaml b/specification/ml/update_data_frame_analytics/examples/request/MlUpdateDataFrameAnalyticsExample1.yaml index 9820aa0787..b482998906 100644 --- a/specification/ml/update_data_frame_analytics/examples/request/MlUpdateDataFrameAnalyticsExample1.yaml +++ b/specification/ml/update_data_frame_analytics/examples/request/MlUpdateDataFrameAnalyticsExample1.yaml @@ -4,3 +4,36 @@ value: |- { "model_memory_limit": "200mb" } +alternatives: + - language: Python + code: |- + resp = client.ml.update_data_frame_analytics( + id="loganalytics", + model_memory_limit="200mb", + ) + - language: JavaScript + code: |- + const response = await client.ml.updateDataFrameAnalytics({ + id: "loganalytics", + model_memory_limit: "200mb", + }); + - language: Ruby + code: |- + response = client.ml.update_data_frame_analytics( + id: "loganalytics", + body: { + "model_memory_limit": "200mb" + } + ) + - language: PHP + code: |- + $resp = $client->ml()->updateDataFrameAnalytics([ + "id" => "loganalytics", + "body" => [ + "model_memory_limit" => "200mb", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"model_memory_limit":"200mb"}'' "$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics/_update"' diff --git a/specification/ml/update_datafeed/examples/request/MlUpdateDatafeedExample1.yaml b/specification/ml/update_datafeed/examples/request/MlUpdateDatafeedExample1.yaml index 5d50e3fdba..25e0a4aa64 100644 --- a/specification/ml/update_datafeed/examples/request/MlUpdateDatafeedExample1.yaml +++ b/specification/ml/update_datafeed/examples/request/MlUpdateDatafeedExample1.yaml @@ -8,3 +8,52 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.ml.update_datafeed( + datafeed_id="datafeed-test-job", + query={ + "term": { + "geo.src": "US" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.ml.updateDatafeed({ + datafeed_id: "datafeed-test-job", + query: { + term: { + "geo.src": "US", + }, + }, + }); + - language: Ruby + code: |- + response = client.ml.update_datafeed( + datafeed_id: "datafeed-test-job", + body: { + "query": { + "term": { + "geo.src": "US" + } + } + } + ) + - language: PHP + code: |- + $resp = $client->ml()->updateDatafeed([ + "datafeed_id" => "datafeed-test-job", + "body" => [ + "query" => [ + "term" => [ + "geo.src" => "US", + ], + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"query":{"term":{"geo.src":"US"}}}'' "$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-test-job/_update"' diff --git a/specification/ml/update_filter/examples/request/MlUpdateFilterExample1.yaml b/specification/ml/update_filter/examples/request/MlUpdateFilterExample1.yaml index 1bb685211b..7b2ebb25e0 100644 --- a/specification/ml/update_filter/examples/request/MlUpdateFilterExample1.yaml +++ b/specification/ml/update_filter/examples/request/MlUpdateFilterExample1.yaml @@ -6,3 +6,57 @@ value: |- "add_items": ["*.myorg.com"], "remove_items": ["wikipedia.org"] } +alternatives: + - language: Python + code: |- + resp = client.ml.update_filter( + filter_id="safe_domains", + description="Updated list of domains", + add_items=[ + "*.myorg.com" + ], + remove_items=[ + "wikipedia.org" + ], + ) + - language: JavaScript + code: |- + const response = await client.ml.updateFilter({ + filter_id: "safe_domains", + description: "Updated list of domains", + add_items: ["*.myorg.com"], + remove_items: ["wikipedia.org"], + }); + - language: Ruby + code: |- + response = client.ml.update_filter( + filter_id: "safe_domains", + body: { + "description": "Updated list of domains", + "add_items": [ + "*.myorg.com" + ], + "remove_items": [ + "wikipedia.org" + ] + } + ) + - language: PHP + code: |- + $resp = $client->ml()->updateFilter([ + "filter_id" => "safe_domains", + "body" => [ + "description" => "Updated list of domains", + "add_items" => array( + "*.myorg.com", + ), + "remove_items" => array( + "wikipedia.org", + ), + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"description":"Updated list of domains","add_items":["*.myorg.com"],"remove_items":["wikipedia.org"]}'' + "$ELASTICSEARCH_URL/_ml/filters/safe_domains/_update"' diff --git a/specification/ml/update_job/examples/request/MlUpdateJobExample1.yaml b/specification/ml/update_job/examples/request/MlUpdateJobExample1.yaml index 8d8a616b0a..ec54074a6c 100644 --- a/specification/ml/update_job/examples/request/MlUpdateJobExample1.yaml +++ b/specification/ml/update_job/examples/request/MlUpdateJobExample1.yaml @@ -16,3 +16,96 @@ value: |- "model_snapshot_retention_days": 7, "results_retention_days": 60 } +alternatives: + - language: Python + code: |- + resp = client.ml.update_job( + job_id="low_request_rate", + description="An updated job", + detectors={ + "detector_index": 0, + "description": "An updated detector description" + }, + groups=[ + "kibana_sample_data", + "kibana_sample_web_logs" + ], + model_plot_config={ + "enabled": True + }, + renormalization_window_days=30, + background_persist_interval="2h", + model_snapshot_retention_days=7, + results_retention_days=60, + ) + - language: JavaScript + code: |- + const response = await client.ml.updateJob({ + job_id: "low_request_rate", + description: "An updated job", + detectors: { + detector_index: 0, + description: "An updated detector description", + }, + groups: ["kibana_sample_data", "kibana_sample_web_logs"], + model_plot_config: { + enabled: true, + }, + renormalization_window_days: 30, + background_persist_interval: "2h", + model_snapshot_retention_days: 7, + results_retention_days: 60, + }); + - language: Ruby + code: |- + response = client.ml.update_job( + job_id: "low_request_rate", + body: { + "description": "An updated job", + "detectors": { + "detector_index": 0, + "description": "An updated detector description" + }, + "groups": [ + "kibana_sample_data", + "kibana_sample_web_logs" + ], + "model_plot_config": { + "enabled": true + }, + "renormalization_window_days": 30, + "background_persist_interval": "2h", + "model_snapshot_retention_days": 7, + "results_retention_days": 60 + } + ) + - language: PHP + code: |- + $resp = $client->ml()->updateJob([ + "job_id" => "low_request_rate", + "body" => [ + "description" => "An updated job", + "detectors" => [ + "detector_index" => 0, + "description" => "An updated detector description", + ], + "groups" => array( + "kibana_sample_data", + "kibana_sample_web_logs", + ), + "model_plot_config" => [ + "enabled" => true, + ], + "renormalization_window_days" => 30, + "background_persist_interval" => "2h", + "model_snapshot_retention_days" => 7, + "results_retention_days" => 60, + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"An + updated job\",\"detectors\":{\"detector_index\":0,\"description\":\"An updated detector + description\"},\"groups\":[\"kibana_sample_data\",\"kibana_sample_web_logs\"],\"model_plot_config\":{\"enabled\":true},\"reno\ + rmalization_window_days\":30,\"background_persist_interval\":\"2h\",\"model_snapshot_retention_days\":7,\"results_retention_d\ + ays\":60}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_update\"" diff --git a/specification/ml/update_model_snapshot/examples/request/MlUpdateModelSnapshotExample1.yaml b/specification/ml/update_model_snapshot/examples/request/MlUpdateModelSnapshotExample1.yaml index 2659e93d4b..55b5318ca8 100644 --- a/specification/ml/update_model_snapshot/examples/request/MlUpdateModelSnapshotExample1.yaml +++ b/specification/ml/update_model_snapshot/examples/request/MlUpdateModelSnapshotExample1.yaml @@ -6,3 +6,45 @@ value: |- "description": "Snapshot 1", "retain": true } +alternatives: + - language: Python + code: |- + resp = client.ml.update_model_snapshot( + job_id="it_ops_new_logs", + snapshot_id="1491852978", + description="Snapshot 1", + retain=True, + ) + - language: JavaScript + code: |- + const response = await client.ml.updateModelSnapshot({ + job_id: "it_ops_new_logs", + snapshot_id: 1491852978, + description: "Snapshot 1", + retain: true, + }); + - language: Ruby + code: |- + response = client.ml.update_model_snapshot( + job_id: "it_ops_new_logs", + snapshot_id: "1491852978", + body: { + "description": "Snapshot 1", + "retain": true + } + ) + - language: PHP + code: |- + $resp = $client->ml()->updateModelSnapshot([ + "job_id" => "it_ops_new_logs", + "snapshot_id" => "1491852978", + "body" => [ + "description" => "Snapshot 1", + "retain" => true, + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"description":"Snapshot 1","retain":true}'' + "$ELASTICSEARCH_URL/_ml/anomaly_detectors/it_ops_new_logs/model_snapshots/1491852978/_update"' diff --git a/specification/ml/update_trained_model_deployment/examples/request/MlUpdateTrainedModelDeploymentExample1.yaml b/specification/ml/update_trained_model_deployment/examples/request/MlUpdateTrainedModelDeploymentExample1.yaml index 814bdba109..59f2791346 100644 --- a/specification/ml/update_trained_model_deployment/examples/request/MlUpdateTrainedModelDeploymentExample1.yaml +++ b/specification/ml/update_trained_model_deployment/examples/request/MlUpdateTrainedModelDeploymentExample1.yaml @@ -1,6 +1,41 @@ method_request: POST _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_update -description: An example body for a `POST _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_update` request. +description: An example body for a `POST + _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_update` request. value: |- { "number_of_allocations": 4 } +alternatives: + - language: Python + code: |- + resp = client.ml.update_trained_model_deployment( + model_id="elastic__distilbert-base-uncased-finetuned-conll03-english", + number_of_allocations=4, + ) + - language: JavaScript + code: |- + const response = await client.ml.updateTrainedModelDeployment({ + model_id: "elastic__distilbert-base-uncased-finetuned-conll03-english", + number_of_allocations: 4, + }); + - language: Ruby + code: |- + response = client.ml.update_trained_model_deployment( + model_id: "elastic__distilbert-base-uncased-finetuned-conll03-english", + body: { + "number_of_allocations": 4 + } + ) + - language: PHP + code: |- + $resp = $client->ml()->updateTrainedModelDeployment([ + "model_id" => "elastic__distilbert-base-uncased-finetuned-conll03-english", + "body" => [ + "number_of_allocations" => 4, + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"number_of_allocations":4}'' + "$ELASTICSEARCH_URL/_ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_update"' diff --git a/specification/ml/upgrade_job_snapshot/examples/request/MlUpgradeJobSnapshotExample1.yaml b/specification/ml/upgrade_job_snapshot/examples/request/MlUpgradeJobSnapshotExample1.yaml index e7d136c0c7..333d57d3de 100644 --- a/specification/ml/upgrade_job_snapshot/examples/request/MlUpgradeJobSnapshotExample1.yaml +++ b/specification/ml/upgrade_job_snapshot/examples/request/MlUpgradeJobSnapshotExample1.yaml @@ -1 +1,37 @@ method_request: POST _ml/anomaly_detectors/low_request_rate/model_snapshots/1828371/_upgrade?timeout=45m&wait_for_completion=true +alternatives: + - language: Python + code: |- + resp = client.ml.upgrade_job_snapshot( + job_id="low_request_rate", + snapshot_id="1828371", + timeout="45m", + wait_for_completion=True, + ) + - language: JavaScript + code: |- + const response = await client.ml.upgradeJobSnapshot({ + job_id: "low_request_rate", + snapshot_id: 1828371, + timeout: "45m", + wait_for_completion: "true", + }); + - language: Ruby + code: |- + response = client.ml.upgrade_job_snapshot( + job_id: "low_request_rate", + snapshot_id: "1828371", + timeout: "45m", + wait_for_completion: "true" + ) + - language: PHP + code: |- + $resp = $client->ml()->upgradeJobSnapshot([ + "job_id" => "low_request_rate", + "snapshot_id" => "1828371", + "timeout" => "45m", + "wait_for_completion" => "true", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/model_snapshots/1828371/_upgrade?timeout=45m&wait_for_completion=true"' diff --git a/specification/nodes/hot_threads/examples/request/NodesHotThreadsExample1.yaml b/specification/nodes/hot_threads/examples/request/NodesHotThreadsExample1.yaml index 376e42d32d..2a6a73962f 100644 --- a/specification/nodes/hot_threads/examples/request/NodesHotThreadsExample1.yaml +++ b/specification/nodes/hot_threads/examples/request/NodesHotThreadsExample1.yaml @@ -1 +1,12 @@ method_request: GET /_nodes/hot_threads +alternatives: + - language: Python + code: resp = client.nodes.hot_threads() + - language: JavaScript + code: const response = await client.nodes.hotThreads(); + - language: Ruby + code: response = client.nodes.hot_threads + - language: PHP + code: $resp = $client->nodes()->hotThreads(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_nodes/hot_threads"' diff --git a/specification/nodes/info/examples/request/NodesInfoExample1.yaml b/specification/nodes/info/examples/request/NodesInfoExample1.yaml index 9f78ea319c..c930ab7133 100644 --- a/specification/nodes/info/examples/request/NodesInfoExample1.yaml +++ b/specification/nodes/info/examples/request/NodesInfoExample1.yaml @@ -1 +1,28 @@ method_request: GET _nodes/_all/jvm +alternatives: + - language: Python + code: |- + resp = client.nodes.info( + node_id="_all", + metric="jvm", + ) + - language: JavaScript + code: |- + const response = await client.nodes.info({ + node_id: "_all", + metric: "jvm", + }); + - language: Ruby + code: |- + response = client.nodes.info( + node_id: "_all", + metric: "jvm" + ) + - language: PHP + code: |- + $resp = $client->nodes()->info([ + "node_id" => "_all", + "metric" => "jvm", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_nodes/_all/jvm"' diff --git a/specification/nodes/reload_secure_settings/examples/request/ReloadSecureSettingsRequestExample1.yaml b/specification/nodes/reload_secure_settings/examples/request/ReloadSecureSettingsRequestExample1.yaml index 17901ecfb4..ad4084983b 100644 --- a/specification/nodes/reload_secure_settings/examples/request/ReloadSecureSettingsRequestExample1.yaml +++ b/specification/nodes/reload_secure_settings/examples/request/ReloadSecureSettingsRequestExample1.yaml @@ -6,3 +6,32 @@ value: |- { "secure_settings_password": "keystore-password" } +alternatives: + - language: Python + code: |- + resp = client.nodes.reload_secure_settings( + secure_settings_password="keystore-password", + ) + - language: JavaScript + code: |- + const response = await client.nodes.reloadSecureSettings({ + secure_settings_password: "keystore-password", + }); + - language: Ruby + code: |- + response = client.nodes.reload_secure_settings( + body: { + "secure_settings_password": "keystore-password" + } + ) + - language: PHP + code: |- + $resp = $client->nodes()->reloadSecureSettings([ + "body" => [ + "secure_settings_password" => "keystore-password", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"secure_settings_password":"keystore-password"}'' "$ELASTICSEARCH_URL/_nodes/reload_secure_settings"' diff --git a/specification/nodes/stats/examples/request/NodesStatsExample1.yaml b/specification/nodes/stats/examples/request/NodesStatsExample1.yaml index 530ddd65ef..7591c512a8 100644 --- a/specification/nodes/stats/examples/request/NodesStatsExample1.yaml +++ b/specification/nodes/stats/examples/request/NodesStatsExample1.yaml @@ -1 +1,29 @@ method_request: GET _nodes/stats/process?filter_path=**.max_file_descriptors +alternatives: + - language: Python + code: |- + resp = client.nodes.stats( + metric="process", + filter_path="**.max_file_descriptors", + ) + - language: JavaScript + code: |- + const response = await client.nodes.stats({ + metric: "process", + filter_path: "**.max_file_descriptors", + }); + - language: Ruby + code: |- + response = client.nodes.stats( + metric: "process", + filter_path: "**.max_file_descriptors" + ) + - language: PHP + code: |- + $resp = $client->nodes()->stats([ + "metric" => "process", + "filter_path" => "**.max_file_descriptors", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_nodes/stats/process?filter_path=**.max_file_descriptors"' diff --git a/specification/nodes/usage/examples/request/NodesUsageExample1.yaml b/specification/nodes/usage/examples/request/NodesUsageExample1.yaml index 6c9b6fc2bc..fd43d2deb0 100644 --- a/specification/nodes/usage/examples/request/NodesUsageExample1.yaml +++ b/specification/nodes/usage/examples/request/NodesUsageExample1.yaml @@ -1 +1,12 @@ method_request: GET _nodes/usage +alternatives: + - language: Python + code: resp = client.nodes.usage() + - language: JavaScript + code: const response = await client.nodes.usage(); + - language: Ruby + code: response = client.nodes.usage + - language: PHP + code: $resp = $client->nodes()->usage(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_nodes/usage"' diff --git a/specification/query_rules/delete_rule/examples/request/QueryRulesDeleteRuleExample1.yaml b/specification/query_rules/delete_rule/examples/request/QueryRulesDeleteRuleExample1.yaml index 65711f5067..450e1f64de 100644 --- a/specification/query_rules/delete_rule/examples/request/QueryRulesDeleteRuleExample1.yaml +++ b/specification/query_rules/delete_rule/examples/request/QueryRulesDeleteRuleExample1.yaml @@ -1 +1,28 @@ method_request: DELETE _query_rules/my-ruleset/_rule/my-rule1 +alternatives: + - language: Python + code: |- + resp = client.query_rules.delete_rule( + ruleset_id="my-ruleset", + rule_id="my-rule1", + ) + - language: JavaScript + code: |- + const response = await client.queryRules.deleteRule({ + ruleset_id: "my-ruleset", + rule_id: "my-rule1", + }); + - language: Ruby + code: |- + response = client.query_rules.delete_rule( + ruleset_id: "my-ruleset", + rule_id: "my-rule1" + ) + - language: PHP + code: |- + $resp = $client->queryRules()->deleteRule([ + "ruleset_id" => "my-ruleset", + "rule_id" => "my-rule1", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_query_rules/my-ruleset/_rule/my-rule1"' diff --git a/specification/query_rules/delete_ruleset/examples/request/QueryRulesDeleteRulesetExample1.yaml b/specification/query_rules/delete_ruleset/examples/request/QueryRulesDeleteRulesetExample1.yaml index 60b70ddf05..bbdd1b4cf1 100644 --- a/specification/query_rules/delete_ruleset/examples/request/QueryRulesDeleteRulesetExample1.yaml +++ b/specification/query_rules/delete_ruleset/examples/request/QueryRulesDeleteRulesetExample1.yaml @@ -1 +1,24 @@ method_request: DELETE _query_rules/my-ruleset/ +alternatives: + - language: Python + code: |- + resp = client.query_rules.delete_ruleset( + ruleset_id="my-ruleset", + ) + - language: JavaScript + code: |- + const response = await client.queryRules.deleteRuleset({ + ruleset_id: "my-ruleset", + }); + - language: Ruby + code: |- + response = client.query_rules.delete_ruleset( + ruleset_id: "my-ruleset" + ) + - language: PHP + code: |- + $resp = $client->queryRules()->deleteRuleset([ + "ruleset_id" => "my-ruleset", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_query_rules/my-ruleset/"' diff --git a/specification/query_rules/get_rule/examples/request/QueryRuleGetRequestExample1.yaml b/specification/query_rules/get_rule/examples/request/QueryRuleGetRequestExample1.yaml index 3cf7b6f67a..8f96d662f5 100644 --- a/specification/query_rules/get_rule/examples/request/QueryRuleGetRequestExample1.yaml +++ b/specification/query_rules/get_rule/examples/request/QueryRuleGetRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET _query_rules/my-ruleset/_rule/my-rule1 +alternatives: + - language: Python + code: |- + resp = client.query_rules.get_rule( + ruleset_id="my-ruleset", + rule_id="my-rule1", + ) + - language: JavaScript + code: |- + const response = await client.queryRules.getRule({ + ruleset_id: "my-ruleset", + rule_id: "my-rule1", + }); + - language: Ruby + code: |- + response = client.query_rules.get_rule( + ruleset_id: "my-ruleset", + rule_id: "my-rule1" + ) + - language: PHP + code: |- + $resp = $client->queryRules()->getRule([ + "ruleset_id" => "my-ruleset", + "rule_id" => "my-rule1", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_query_rules/my-ruleset/_rule/my-rule1"' diff --git a/specification/query_rules/get_ruleset/examples/request/QueryRulesetGetRequestExample1.yaml b/specification/query_rules/get_ruleset/examples/request/QueryRulesetGetRequestExample1.yaml index f22fa12d34..3f28e55e90 100644 --- a/specification/query_rules/get_ruleset/examples/request/QueryRulesetGetRequestExample1.yaml +++ b/specification/query_rules/get_ruleset/examples/request/QueryRulesetGetRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET _query_rules/my-ruleset/ +alternatives: + - language: Python + code: |- + resp = client.query_rules.get_ruleset( + ruleset_id="my-ruleset", + ) + - language: JavaScript + code: |- + const response = await client.queryRules.getRuleset({ + ruleset_id: "my-ruleset", + }); + - language: Ruby + code: |- + response = client.query_rules.get_ruleset( + ruleset_id: "my-ruleset" + ) + - language: PHP + code: |- + $resp = $client->queryRules()->getRuleset([ + "ruleset_id" => "my-ruleset", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_query_rules/my-ruleset/"' diff --git a/specification/query_rules/list_rulesets/examples/request/QueryRulesetListRequestExample1.yaml b/specification/query_rules/list_rulesets/examples/request/QueryRulesetListRequestExample1.yaml index 46e42c3046..4461fd294a 100644 --- a/specification/query_rules/list_rulesets/examples/request/QueryRulesetListRequestExample1.yaml +++ b/specification/query_rules/list_rulesets/examples/request/QueryRulesetListRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET _query_rules/?from=0&size=3 +alternatives: + - language: Python + code: |- + resp = client.query_rules.list_rulesets( + from="0", + size="3", + ) + - language: JavaScript + code: |- + const response = await client.queryRules.listRulesets({ + from: 0, + size: 3, + }); + - language: Ruby + code: |- + response = client.query_rules.list_rulesets( + from: "0", + size: "3" + ) + - language: PHP + code: |- + $resp = $client->queryRules()->listRulesets([ + "from" => "0", + "size" => "3", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_query_rules/?from=0&size=3"' diff --git a/specification/query_rules/put_rule/examples/request/QueryRulePutRequestExample1.yaml b/specification/query_rules/put_rule/examples/request/QueryRulePutRequestExample1.yaml index b8c634022b..b5508d313a 100644 --- a/specification/query_rules/put_rule/examples/request/QueryRulePutRequestExample1.yaml +++ b/specification/query_rules/put_rule/examples/request/QueryRulePutRequestExample1.yaml @@ -1,9 +1,49 @@ # summary: method_request: POST _query_rules/my-ruleset/_test description: > - Run `POST _query_rules/my-ruleset/_test` to test a ruleset. - Provide the match criteria that you want to test against. + Run `POST _query_rules/my-ruleset/_test` to test a ruleset. Provide the match criteria that you want to test against. # type: request value: match_criteria: query_string: puggles +alternatives: + - language: Python + code: |- + resp = client.query_rules.test( + ruleset_id="my-ruleset", + match_criteria={ + "query_string": "puggles" + }, + ) + - language: JavaScript + code: |- + const response = await client.queryRules.test({ + ruleset_id: "my-ruleset", + match_criteria: { + query_string: "puggles", + }, + }); + - language: Ruby + code: |- + response = client.query_rules.test( + ruleset_id: "my-ruleset", + body: { + "match_criteria": { + "query_string": "puggles" + } + } + ) + - language: PHP + code: |- + $resp = $client->queryRules()->test([ + "ruleset_id" => "my-ruleset", + "body" => [ + "match_criteria" => [ + "query_string" => "puggles", + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"match_criteria":{"query_string":"puggles"}}'' "$ELASTICSEARCH_URL/_query_rules/my-ruleset/_test"' diff --git a/specification/query_rules/put_ruleset/examples/request/QueryRulesetPutRequestExample1.yaml b/specification/query_rules/put_ruleset/examples/request/QueryRulesetPutRequestExample1.yaml index 674f5c8d06..464b483c13 100644 --- a/specification/query_rules/put_ruleset/examples/request/QueryRulesetPutRequestExample1.yaml +++ b/specification/query_rules/put_ruleset/examples/request/QueryRulesetPutRequestExample1.yaml @@ -1,27 +1,345 @@ # summary: method_request: PUT _query_rules/my-ruleset description: > - Run `PUT _query_rules/my-ruleset` to create a new query ruleset. - Two rules are associated with `my-ruleset`. - `my-rule1` will pin documents with IDs `id1` and `id2` when `user_query` contains `pugs` or `puggles` and `user_country` exactly matches `us`. - `my-rule2` will exclude documents from different specified indices with IDs `id3` and `id4` when the `query_string` fuzzily matches `rescue dogs`. + Run `PUT _query_rules/my-ruleset` to create a new query ruleset. Two rules are associated with `my-ruleset`. `my-rule1` will pin + documents with IDs `id1` and `id2` when `user_query` contains `pugs` or `puggles` and `user_country` exactly matches `us`. + `my-rule2` will exclude documents from different specified indices with IDs `id3` and `id4` when the `query_string` fuzzily + matches `rescue dogs`. # type: request -value: - "{\n \"rules\": [\n {\n \"rule_id\": \"my-rule1\",\n \ - \ \"type\": \"pinned\",\n \"criteria\": [\n \ - \ {\n \"type\": \"contains\",\n \"metadata\"\ - : \"user_query\",\n \"values\": [ \"pugs\", \"puggles\" ]\n \ - \ },\n {\n \"type\": \"exact\",\n\ - \ \"metadata\": \"user_country\",\n \"values\"\ - : [ \"us\" ]\n }\n ],\n \"actions\": {\n \ - \ \"ids\": [\n \"id1\",\n \"\ - id2\"\n ]\n }\n },\n {\n \"rule_id\"\ - : \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n\ - \ {\n \"type\": \"fuzzy\",\n \ - \ \"metadata\": \"user_query\",\n \"values\": [ \"rescue dogs\"\ - \ ]\n }\n ],\n \"actions\": {\n \ - \ \"docs\": [\n {\n \"_index\": \"\ - index1\",\n \"_id\": \"id3\"\n },\n \ - \ {\n \"_index\": \"index2\",\n \ - \ \"_id\": \"id4\"\n }\n ]\n \ - \ }\n }\n ]\n}" +value: "{ + + \ \"rules\": [ + + \ { + + \ \"rule_id\": \"my-rule1\", + + \ \"type\": \"pinned\", + + \ \"criteria\": [ + + \ { + + \ \"type\": \"contains\", + + \ \"metadata\": \"user_query\", + + \ \"values\": [ \"pugs\", \"puggles\" ] + + \ }, + + \ { + + \ \"type\": \"exact\", + + \ \"metadata\": \"user_country\", + + \ \"values\": [ \"us\" ] + + \ } + + \ ], + + \ \"actions\": { + + \ \"ids\": [ + + \ \"id1\", + + \ \"id2\" + + \ ] + + \ } + + \ }, + + \ { + + \ \"rule_id\": \"my-rule2\", + + \ \"type\": \"pinned\", + + \ \"criteria\": [ + + \ { + + \ \"type\": \"fuzzy\", + + \ \"metadata\": \"user_query\", + + \ \"values\": [ \"rescue dogs\" ] + + \ } + + \ ], + + \ \"actions\": { + + \ \"docs\": [ + + \ { + + \ \"_index\": \"index1\", + + \ \"_id\": \"id3\" + + \ }, + + \ { + + \ \"_index\": \"index2\", + + \ \"_id\": \"id4\" + + \ } + + \ ] + + \ } + + \ } + + \ ] + + }" +alternatives: + - language: Python + code: |- + resp = client.query_rules.put_ruleset( + ruleset_id="my-ruleset", + rules=[ + { + "rule_id": "my-rule1", + "type": "pinned", + "criteria": [ + { + "type": "contains", + "metadata": "user_query", + "values": [ + "pugs", + "puggles" + ] + }, + { + "type": "exact", + "metadata": "user_country", + "values": [ + "us" + ] + } + ], + "actions": { + "ids": [ + "id1", + "id2" + ] + } + }, + { + "rule_id": "my-rule2", + "type": "pinned", + "criteria": [ + { + "type": "fuzzy", + "metadata": "user_query", + "values": [ + "rescue dogs" + ] + } + ], + "actions": { + "docs": [ + { + "_index": "index1", + "_id": "id3" + }, + { + "_index": "index2", + "_id": "id4" + } + ] + } + } + ], + ) + - language: JavaScript + code: |- + const response = await client.queryRules.putRuleset({ + ruleset_id: "my-ruleset", + rules: [ + { + rule_id: "my-rule1", + type: "pinned", + criteria: [ + { + type: "contains", + metadata: "user_query", + values: ["pugs", "puggles"], + }, + { + type: "exact", + metadata: "user_country", + values: ["us"], + }, + ], + actions: { + ids: ["id1", "id2"], + }, + }, + { + rule_id: "my-rule2", + type: "pinned", + criteria: [ + { + type: "fuzzy", + metadata: "user_query", + values: ["rescue dogs"], + }, + ], + actions: { + docs: [ + { + _index: "index1", + _id: "id3", + }, + { + _index: "index2", + _id: "id4", + }, + ], + }, + }, + ], + }); + - language: Ruby + code: |- + response = client.query_rules.put_ruleset( + ruleset_id: "my-ruleset", + body: { + "rules": [ + { + "rule_id": "my-rule1", + "type": "pinned", + "criteria": [ + { + "type": "contains", + "metadata": "user_query", + "values": [ + "pugs", + "puggles" + ] + }, + { + "type": "exact", + "metadata": "user_country", + "values": [ + "us" + ] + } + ], + "actions": { + "ids": [ + "id1", + "id2" + ] + } + }, + { + "rule_id": "my-rule2", + "type": "pinned", + "criteria": [ + { + "type": "fuzzy", + "metadata": "user_query", + "values": [ + "rescue dogs" + ] + } + ], + "actions": { + "docs": [ + { + "_index": "index1", + "_id": "id3" + }, + { + "_index": "index2", + "_id": "id4" + } + ] + } + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->queryRules()->putRuleset([ + "ruleset_id" => "my-ruleset", + "body" => [ + "rules" => array( + [ + "rule_id" => "my-rule1", + "type" => "pinned", + "criteria" => array( + [ + "type" => "contains", + "metadata" => "user_query", + "values" => array( + "pugs", + "puggles", + ), + ], + [ + "type" => "exact", + "metadata" => "user_country", + "values" => array( + "us", + ), + ], + ), + "actions" => [ + "ids" => array( + "id1", + "id2", + ), + ], + ], + [ + "rule_id" => "my-rule2", + "type" => "pinned", + "criteria" => array( + [ + "type" => "fuzzy", + "metadata" => "user_query", + "values" => array( + "rescue dogs", + ), + ], + ), + "actions" => [ + "docs" => array( + [ + "_index" => "index1", + "_id" => "id3", + ], + [ + "_index" => "index2", + "_id" => "id4", + ], + ), + ], + ], + ), + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"rules\":[{\"rule_id\":\"my-rule1\",\"type\":\"pinned\",\"criteria\":[{\"type\":\"contains\",\"metadata\":\"user_query\",\ + \"values\":[\"pugs\",\"puggles\"]},{\"type\":\"exact\",\"metadata\":\"user_country\",\"values\":[\"us\"]}],\"actions\":{\"ids\ + \":[\"id1\",\"id2\"]}},{\"rule_id\":\"my-rule2\",\"type\":\"pinned\",\"criteria\":[{\"type\":\"fuzzy\",\"metadata\":\"user_qu\ + ery\",\"values\":[\"rescue + dogs\"]}],\"actions\":{\"docs\":[{\"_index\":\"index1\",\"_id\":\"id3\"},{\"_index\":\"index2\",\"_id\":\"id4\"}]}}]}' + \"$ELASTICSEARCH_URL/_query_rules/my-ruleset\"" diff --git a/specification/query_rules/test/examples/request/QueryRulesetTestRequestExample1.yaml b/specification/query_rules/test/examples/request/QueryRulesetTestRequestExample1.yaml index 674f5c8d06..464b483c13 100644 --- a/specification/query_rules/test/examples/request/QueryRulesetTestRequestExample1.yaml +++ b/specification/query_rules/test/examples/request/QueryRulesetTestRequestExample1.yaml @@ -1,27 +1,345 @@ # summary: method_request: PUT _query_rules/my-ruleset description: > - Run `PUT _query_rules/my-ruleset` to create a new query ruleset. - Two rules are associated with `my-ruleset`. - `my-rule1` will pin documents with IDs `id1` and `id2` when `user_query` contains `pugs` or `puggles` and `user_country` exactly matches `us`. - `my-rule2` will exclude documents from different specified indices with IDs `id3` and `id4` when the `query_string` fuzzily matches `rescue dogs`. + Run `PUT _query_rules/my-ruleset` to create a new query ruleset. Two rules are associated with `my-ruleset`. `my-rule1` will pin + documents with IDs `id1` and `id2` when `user_query` contains `pugs` or `puggles` and `user_country` exactly matches `us`. + `my-rule2` will exclude documents from different specified indices with IDs `id3` and `id4` when the `query_string` fuzzily + matches `rescue dogs`. # type: request -value: - "{\n \"rules\": [\n {\n \"rule_id\": \"my-rule1\",\n \ - \ \"type\": \"pinned\",\n \"criteria\": [\n \ - \ {\n \"type\": \"contains\",\n \"metadata\"\ - : \"user_query\",\n \"values\": [ \"pugs\", \"puggles\" ]\n \ - \ },\n {\n \"type\": \"exact\",\n\ - \ \"metadata\": \"user_country\",\n \"values\"\ - : [ \"us\" ]\n }\n ],\n \"actions\": {\n \ - \ \"ids\": [\n \"id1\",\n \"\ - id2\"\n ]\n }\n },\n {\n \"rule_id\"\ - : \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n\ - \ {\n \"type\": \"fuzzy\",\n \ - \ \"metadata\": \"user_query\",\n \"values\": [ \"rescue dogs\"\ - \ ]\n }\n ],\n \"actions\": {\n \ - \ \"docs\": [\n {\n \"_index\": \"\ - index1\",\n \"_id\": \"id3\"\n },\n \ - \ {\n \"_index\": \"index2\",\n \ - \ \"_id\": \"id4\"\n }\n ]\n \ - \ }\n }\n ]\n}" +value: "{ + + \ \"rules\": [ + + \ { + + \ \"rule_id\": \"my-rule1\", + + \ \"type\": \"pinned\", + + \ \"criteria\": [ + + \ { + + \ \"type\": \"contains\", + + \ \"metadata\": \"user_query\", + + \ \"values\": [ \"pugs\", \"puggles\" ] + + \ }, + + \ { + + \ \"type\": \"exact\", + + \ \"metadata\": \"user_country\", + + \ \"values\": [ \"us\" ] + + \ } + + \ ], + + \ \"actions\": { + + \ \"ids\": [ + + \ \"id1\", + + \ \"id2\" + + \ ] + + \ } + + \ }, + + \ { + + \ \"rule_id\": \"my-rule2\", + + \ \"type\": \"pinned\", + + \ \"criteria\": [ + + \ { + + \ \"type\": \"fuzzy\", + + \ \"metadata\": \"user_query\", + + \ \"values\": [ \"rescue dogs\" ] + + \ } + + \ ], + + \ \"actions\": { + + \ \"docs\": [ + + \ { + + \ \"_index\": \"index1\", + + \ \"_id\": \"id3\" + + \ }, + + \ { + + \ \"_index\": \"index2\", + + \ \"_id\": \"id4\" + + \ } + + \ ] + + \ } + + \ } + + \ ] + + }" +alternatives: + - language: Python + code: |- + resp = client.query_rules.put_ruleset( + ruleset_id="my-ruleset", + rules=[ + { + "rule_id": "my-rule1", + "type": "pinned", + "criteria": [ + { + "type": "contains", + "metadata": "user_query", + "values": [ + "pugs", + "puggles" + ] + }, + { + "type": "exact", + "metadata": "user_country", + "values": [ + "us" + ] + } + ], + "actions": { + "ids": [ + "id1", + "id2" + ] + } + }, + { + "rule_id": "my-rule2", + "type": "pinned", + "criteria": [ + { + "type": "fuzzy", + "metadata": "user_query", + "values": [ + "rescue dogs" + ] + } + ], + "actions": { + "docs": [ + { + "_index": "index1", + "_id": "id3" + }, + { + "_index": "index2", + "_id": "id4" + } + ] + } + } + ], + ) + - language: JavaScript + code: |- + const response = await client.queryRules.putRuleset({ + ruleset_id: "my-ruleset", + rules: [ + { + rule_id: "my-rule1", + type: "pinned", + criteria: [ + { + type: "contains", + metadata: "user_query", + values: ["pugs", "puggles"], + }, + { + type: "exact", + metadata: "user_country", + values: ["us"], + }, + ], + actions: { + ids: ["id1", "id2"], + }, + }, + { + rule_id: "my-rule2", + type: "pinned", + criteria: [ + { + type: "fuzzy", + metadata: "user_query", + values: ["rescue dogs"], + }, + ], + actions: { + docs: [ + { + _index: "index1", + _id: "id3", + }, + { + _index: "index2", + _id: "id4", + }, + ], + }, + }, + ], + }); + - language: Ruby + code: |- + response = client.query_rules.put_ruleset( + ruleset_id: "my-ruleset", + body: { + "rules": [ + { + "rule_id": "my-rule1", + "type": "pinned", + "criteria": [ + { + "type": "contains", + "metadata": "user_query", + "values": [ + "pugs", + "puggles" + ] + }, + { + "type": "exact", + "metadata": "user_country", + "values": [ + "us" + ] + } + ], + "actions": { + "ids": [ + "id1", + "id2" + ] + } + }, + { + "rule_id": "my-rule2", + "type": "pinned", + "criteria": [ + { + "type": "fuzzy", + "metadata": "user_query", + "values": [ + "rescue dogs" + ] + } + ], + "actions": { + "docs": [ + { + "_index": "index1", + "_id": "id3" + }, + { + "_index": "index2", + "_id": "id4" + } + ] + } + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->queryRules()->putRuleset([ + "ruleset_id" => "my-ruleset", + "body" => [ + "rules" => array( + [ + "rule_id" => "my-rule1", + "type" => "pinned", + "criteria" => array( + [ + "type" => "contains", + "metadata" => "user_query", + "values" => array( + "pugs", + "puggles", + ), + ], + [ + "type" => "exact", + "metadata" => "user_country", + "values" => array( + "us", + ), + ], + ), + "actions" => [ + "ids" => array( + "id1", + "id2", + ), + ], + ], + [ + "rule_id" => "my-rule2", + "type" => "pinned", + "criteria" => array( + [ + "type" => "fuzzy", + "metadata" => "user_query", + "values" => array( + "rescue dogs", + ), + ], + ), + "actions" => [ + "docs" => array( + [ + "_index" => "index1", + "_id" => "id3", + ], + [ + "_index" => "index2", + "_id" => "id4", + ], + ), + ], + ], + ), + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"rules\":[{\"rule_id\":\"my-rule1\",\"type\":\"pinned\",\"criteria\":[{\"type\":\"contains\",\"metadata\":\"user_query\",\ + \"values\":[\"pugs\",\"puggles\"]},{\"type\":\"exact\",\"metadata\":\"user_country\",\"values\":[\"us\"]}],\"actions\":{\"ids\ + \":[\"id1\",\"id2\"]}},{\"rule_id\":\"my-rule2\",\"type\":\"pinned\",\"criteria\":[{\"type\":\"fuzzy\",\"metadata\":\"user_qu\ + ery\",\"values\":[\"rescue + dogs\"]}],\"actions\":{\"docs\":[{\"_index\":\"index1\",\"_id\":\"id3\"},{\"_index\":\"index2\",\"_id\":\"id4\"}]}}]}' + \"$ELASTICSEARCH_URL/_query_rules/my-ruleset\"" diff --git a/specification/rollup/delete_job/examples/request/DeleteRollupJobRequestExample1.yaml b/specification/rollup/delete_job/examples/request/DeleteRollupJobRequestExample1.yaml index 4e29cf1351..c3c51fd691 100644 --- a/specification/rollup/delete_job/examples/request/DeleteRollupJobRequestExample1.yaml +++ b/specification/rollup/delete_job/examples/request/DeleteRollupJobRequestExample1.yaml @@ -1 +1,24 @@ method_request: DELETE _rollup/job/sensor +alternatives: + - language: Python + code: |- + resp = client.rollup.delete_job( + id="sensor", + ) + - language: JavaScript + code: |- + const response = await client.rollup.deleteJob({ + id: "sensor", + }); + - language: Ruby + code: |- + response = client.rollup.delete_job( + id: "sensor" + ) + - language: PHP + code: |- + $resp = $client->rollup()->deleteJob([ + "id" => "sensor", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_rollup/job/sensor"' diff --git a/specification/rollup/get_jobs/examples/request/GetRollupJobRequestExample1.yaml b/specification/rollup/get_jobs/examples/request/GetRollupJobRequestExample1.yaml index fc03b7a60e..8f49e303d4 100644 --- a/specification/rollup/get_jobs/examples/request/GetRollupJobRequestExample1.yaml +++ b/specification/rollup/get_jobs/examples/request/GetRollupJobRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET _rollup/job/sensor +alternatives: + - language: Python + code: |- + resp = client.rollup.get_jobs( + id="sensor", + ) + - language: JavaScript + code: |- + const response = await client.rollup.getJobs({ + id: "sensor", + }); + - language: Ruby + code: |- + response = client.rollup.get_jobs( + id: "sensor" + ) + - language: PHP + code: |- + $resp = $client->rollup()->getJobs([ + "id" => "sensor", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_rollup/job/sensor"' diff --git a/specification/rollup/get_rollup_caps/examples/request/GetRollupCapabilitiesRequestExample1.yaml b/specification/rollup/get_rollup_caps/examples/request/GetRollupCapabilitiesRequestExample1.yaml index 2ddfc8ee9c..0e9466b59c 100644 --- a/specification/rollup/get_rollup_caps/examples/request/GetRollupCapabilitiesRequestExample1.yaml +++ b/specification/rollup/get_rollup_caps/examples/request/GetRollupCapabilitiesRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET _rollup/data/sensor-* +alternatives: + - language: Python + code: |- + resp = client.rollup.get_rollup_caps( + id="sensor-*", + ) + - language: JavaScript + code: |- + const response = await client.rollup.getRollupCaps({ + id: "sensor-*", + }); + - language: Ruby + code: |- + response = client.rollup.get_rollup_caps( + id: "sensor-*" + ) + - language: PHP + code: |- + $resp = $client->rollup()->getRollupCaps([ + "id" => "sensor-*", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_rollup/data/sensor-*"' diff --git a/specification/rollup/get_rollup_index_caps/examples/request/GetRollupIndexCapabilitiesRequestExample1.yaml b/specification/rollup/get_rollup_index_caps/examples/request/GetRollupIndexCapabilitiesRequestExample1.yaml index 01b9d8fe31..3e9b210456 100644 --- a/specification/rollup/get_rollup_index_caps/examples/request/GetRollupIndexCapabilitiesRequestExample1.yaml +++ b/specification/rollup/get_rollup_index_caps/examples/request/GetRollupIndexCapabilitiesRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET /sensor_rollup/_rollup/data +alternatives: + - language: Python + code: |- + resp = client.rollup.get_rollup_index_caps( + index="sensor_rollup", + ) + - language: JavaScript + code: |- + const response = await client.rollup.getRollupIndexCaps({ + index: "sensor_rollup", + }); + - language: Ruby + code: |- + response = client.rollup.get_rollup_index_caps( + index: "sensor_rollup" + ) + - language: PHP + code: |- + $resp = $client->rollup()->getRollupIndexCaps([ + "index" => "sensor_rollup", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/sensor_rollup/_rollup/data"' diff --git a/specification/rollup/put_job/examples/request/CreateRollupJobRequestExample1.yaml b/specification/rollup/put_job/examples/request/CreateRollupJobRequestExample1.yaml index 9060a90c21..3d68d621c4 100644 --- a/specification/rollup/put_job/examples/request/CreateRollupJobRequestExample1.yaml +++ b/specification/rollup/put_job/examples/request/CreateRollupJobRequestExample1.yaml @@ -1,17 +1,211 @@ # summary: method_request: PUT _rollup/job/sensor description: > - Run `PUT _rollup/job/sensor` to create a rollup job that targets the `sensor-*` index pattern. - This configuration enables date histograms to be used on the `timestamp` field and terms aggregations to be used on the `node` field. - This configuration defines metrics over two fields: `temperature` and `voltage`. - For the `temperature` field, it collects the `min`, `max`, and `sum` of the temperature. - For `voltage`, it collects the `average`. + Run `PUT _rollup/job/sensor` to create a rollup job that targets the `sensor-*` index pattern. This configuration enables date + histograms to be used on the `timestamp` field and terms aggregations to be used on the `node` field. This configuration defines + metrics over two fields: `temperature` and `voltage`. For the `temperature` field, it collects the `min`, `max`, and `sum` of the + temperature. For `voltage`, it collects the `average`. # type: request -value: - "{\n \"index_pattern\": \"sensor-*\",\n \"rollup_index\": \"sensor_rollup\"\ - ,\n \"cron\": \"*/30 * * * * ?\",\n \"page_size\": 1000,\n \"groups\": {\n \ - \ \"date_histogram\": {\n \"field\": \"timestamp\",\n \"fixed_interval\"\ - : \"1h\",\n \"delay\": \"7d\"\n },\n \"terms\": {\n \"fields\":\ - \ [ \"node\" ]\n }\n },\n \"metrics\": [\n {\n \"field\": \"temperature\"\ - ,\n \"metrics\": [ \"min\", \"max\", \"sum\" ]\n },\n {\n \"field\"\ - : \"voltage\",\n \"metrics\": [ \"avg\" ]\n }\n ]\n}" +value: "{ + + \ \"index_pattern\": \"sensor-*\", + + \ \"rollup_index\": \"sensor_rollup\", + + \ \"cron\": \"*/30 * * * * ?\", + + \ \"page_size\": 1000, + + \ \"groups\": { + + \ \"date_histogram\": { + + \ \"field\": \"timestamp\", + + \ \"fixed_interval\": \"1h\", + + \ \"delay\": \"7d\" + + \ }, + + \ \"terms\": { + + \ \"fields\": [ \"node\" ] + + \ } + + \ }, + + \ \"metrics\": [ + + \ { + + \ \"field\": \"temperature\", + + \ \"metrics\": [ \"min\", \"max\", \"sum\" ] + + \ }, + + \ { + + \ \"field\": \"voltage\", + + \ \"metrics\": [ \"avg\" ] + + \ } + + \ ] + + }" +alternatives: + - language: Python + code: |- + resp = client.rollup.put_job( + id="sensor", + index_pattern="sensor-*", + rollup_index="sensor_rollup", + cron="*/30 * * * * ?", + page_size=1000, + groups={ + "date_histogram": { + "field": "timestamp", + "fixed_interval": "1h", + "delay": "7d" + }, + "terms": { + "fields": [ + "node" + ] + } + }, + metrics=[ + { + "field": "temperature", + "metrics": [ + "min", + "max", + "sum" + ] + }, + { + "field": "voltage", + "metrics": [ + "avg" + ] + } + ], + ) + - language: JavaScript + code: |- + const response = await client.rollup.putJob({ + id: "sensor", + index_pattern: "sensor-*", + rollup_index: "sensor_rollup", + cron: "*/30 * * * * ?", + page_size: 1000, + groups: { + date_histogram: { + field: "timestamp", + fixed_interval: "1h", + delay: "7d", + }, + terms: { + fields: ["node"], + }, + }, + metrics: [ + { + field: "temperature", + metrics: ["min", "max", "sum"], + }, + { + field: "voltage", + metrics: ["avg"], + }, + ], + }); + - language: Ruby + code: |- + response = client.rollup.put_job( + id: "sensor", + body: { + "index_pattern": "sensor-*", + "rollup_index": "sensor_rollup", + "cron": "*/30 * * * * ?", + "page_size": 1000, + "groups": { + "date_histogram": { + "field": "timestamp", + "fixed_interval": "1h", + "delay": "7d" + }, + "terms": { + "fields": [ + "node" + ] + } + }, + "metrics": [ + { + "field": "temperature", + "metrics": [ + "min", + "max", + "sum" + ] + }, + { + "field": "voltage", + "metrics": [ + "avg" + ] + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->rollup()->putJob([ + "id" => "sensor", + "body" => [ + "index_pattern" => "sensor-*", + "rollup_index" => "sensor_rollup", + "cron" => "*/30 * * * * ?", + "page_size" => 1000, + "groups" => [ + "date_histogram" => [ + "field" => "timestamp", + "fixed_interval" => "1h", + "delay" => "7d", + ], + "terms" => [ + "fields" => array( + "node", + ), + ], + ], + "metrics" => array( + [ + "field" => "temperature", + "metrics" => array( + "min", + "max", + "sum", + ), + ], + [ + "field" => "voltage", + "metrics" => array( + "avg", + ), + ], + ), + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"index_pattern\":\"sensor-*\",\"rollup_index\":\"sensor_rollup\",\"cron\":\"*/30 * * * * + ?\",\"page_size\":1000,\"groups\":{\"date_histogram\":{\"field\":\"timestamp\",\"fixed_interval\":\"1h\",\"delay\":\"7d\"},\"\ + terms\":{\"fields\":[\"node\"]}},\"metrics\":[{\"field\":\"temperature\",\"metrics\":[\"min\",\"max\",\"sum\"]},{\"field\":\"\ + voltage\",\"metrics\":[\"avg\"]}]}' \"$ELASTICSEARCH_URL/_rollup/job/sensor\"" diff --git a/specification/rollup/rollup_search/examples/request/RollupSearchRequestExample1.yaml b/specification/rollup/rollup_search/examples/request/RollupSearchRequestExample1.yaml index 035254887f..05627d44ed 100644 --- a/specification/rollup/rollup_search/examples/request/RollupSearchRequestExample1.yaml +++ b/specification/rollup/rollup_search/examples/request/RollupSearchRequestExample1.yaml @@ -2,6 +2,84 @@ method_request: GET /sensor_rollup/_rollup_search description: Search rolled up data stored in `sensor_rollup` with `GET /sensor_rollup/_rollup_search` # type: request -value: - "{\n \"size\": 0,\n \"aggregations\": {\n \"max_temperature\": {\n \ - \ \"max\": {\n \"field\": \"temperature\"\n }\n }\n }\n}" +value: "{ + + \ \"size\": 0, + + \ \"aggregations\": { + + \ \"max_temperature\": { + + \ \"max\": { + + \ \"field\": \"temperature\" + + \ } + + \ } + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.rollup.rollup_search( + index="sensor_rollup", + size=0, + aggregations={ + "max_temperature": { + "max": { + "field": "temperature" + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.rollup.rollupSearch({ + index: "sensor_rollup", + size: 0, + aggregations: { + max_temperature: { + max: { + field: "temperature", + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.rollup.rollup_search( + index: "sensor_rollup", + body: { + "size": 0, + "aggregations": { + "max_temperature": { + "max": { + "field": "temperature" + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->rollup()->rollupSearch([ + "index" => "sensor_rollup", + "body" => [ + "size" => 0, + "aggregations" => [ + "max_temperature" => [ + "max" => [ + "field" => "temperature", + ], + ], + ], + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"size":0,"aggregations":{"max_temperature":{"max":{"field":"temperature"}}}}'' + "$ELASTICSEARCH_URL/sensor_rollup/_rollup_search"' diff --git a/specification/rollup/start_job/examples/request/StartRollupJobRequestExample1.yaml b/specification/rollup/start_job/examples/request/StartRollupJobRequestExample1.yaml index 8ddfdb7299..4b53d648c2 100644 --- a/specification/rollup/start_job/examples/request/StartRollupJobRequestExample1.yaml +++ b/specification/rollup/start_job/examples/request/StartRollupJobRequestExample1.yaml @@ -1 +1,24 @@ method_request: POST _rollup/job/sensor/_start +alternatives: + - language: Python + code: |- + resp = client.rollup.start_job( + id="sensor", + ) + - language: JavaScript + code: |- + const response = await client.rollup.startJob({ + id: "sensor", + }); + - language: Ruby + code: |- + response = client.rollup.start_job( + id: "sensor" + ) + - language: PHP + code: |- + $resp = $client->rollup()->startJob([ + "id" => "sensor", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_rollup/job/sensor/_start"' diff --git a/specification/rollup/stop_job/examples/request/RollupStopJobExample1.yaml b/specification/rollup/stop_job/examples/request/RollupStopJobExample1.yaml index 40619f2064..aeb2a18c81 100644 --- a/specification/rollup/stop_job/examples/request/RollupStopJobExample1.yaml +++ b/specification/rollup/stop_job/examples/request/RollupStopJobExample1.yaml @@ -1 +1,33 @@ method_request: POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s +alternatives: + - language: Python + code: |- + resp = client.rollup.stop_job( + id="sensor", + wait_for_completion=True, + timeout="10s", + ) + - language: JavaScript + code: |- + const response = await client.rollup.stopJob({ + id: "sensor", + wait_for_completion: "true", + timeout: "10s", + }); + - language: Ruby + code: |- + response = client.rollup.stop_job( + id: "sensor", + wait_for_completion: "true", + timeout: "10s" + ) + - language: PHP + code: |- + $resp = $client->rollup()->stopJob([ + "id" => "sensor", + "wait_for_completion" => "true", + "timeout" => "10s", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s"' diff --git a/specification/search_application/delete/examples/request/SearchApplicationDeleteExample1.yaml b/specification/search_application/delete/examples/request/SearchApplicationDeleteExample1.yaml index 7798b430d6..33cf3978f2 100644 --- a/specification/search_application/delete/examples/request/SearchApplicationDeleteExample1.yaml +++ b/specification/search_application/delete/examples/request/SearchApplicationDeleteExample1.yaml @@ -1 +1,24 @@ method_request: DELETE _application/search_application/my-app/ +alternatives: + - language: Python + code: |- + resp = client.search_application.delete( + name="my-app", + ) + - language: JavaScript + code: |- + const response = await client.searchApplication.delete({ + name: "my-app", + }); + - language: Ruby + code: |- + response = client.search_application.delete( + name: "my-app" + ) + - language: PHP + code: |- + $resp = $client->searchApplication()->delete([ + "name" => "my-app", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_application/search_application/my-app/"' diff --git a/specification/search_application/delete_behavioral_analytics/examples/request/SearchApplicationDeleteBehavioralAnalyticsExample1.yaml b/specification/search_application/delete_behavioral_analytics/examples/request/SearchApplicationDeleteBehavioralAnalyticsExample1.yaml index 4e5eda09a5..49063bc56f 100644 --- a/specification/search_application/delete_behavioral_analytics/examples/request/SearchApplicationDeleteBehavioralAnalyticsExample1.yaml +++ b/specification/search_application/delete_behavioral_analytics/examples/request/SearchApplicationDeleteBehavioralAnalyticsExample1.yaml @@ -1 +1,25 @@ method_request: DELETE _application/analytics/my_analytics_collection/ +alternatives: + - language: Python + code: |- + resp = client.search_application.delete_behavioral_analytics( + name="my_analytics_collection", + ) + - language: JavaScript + code: |- + const response = await client.searchApplication.deleteBehavioralAnalytics({ + name: "my_analytics_collection", + }); + - language: Ruby + code: |- + response = client.search_application.delete_behavioral_analytics( + name: "my_analytics_collection" + ) + - language: PHP + code: |- + $resp = $client->searchApplication()->deleteBehavioralAnalytics([ + "name" => "my_analytics_collection", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_application/analytics/my_analytics_collection/"' diff --git a/specification/search_application/get/examples/request/SearchApplicationGetRequestExample1.yaml b/specification/search_application/get/examples/request/SearchApplicationGetRequestExample1.yaml index 3e3bbd8ce3..2b370628c4 100644 --- a/specification/search_application/get/examples/request/SearchApplicationGetRequestExample1.yaml +++ b/specification/search_application/get/examples/request/SearchApplicationGetRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET _application/search_application/my-app/ +alternatives: + - language: Python + code: |- + resp = client.search_application.get( + name="my-app", + ) + - language: JavaScript + code: |- + const response = await client.searchApplication.get({ + name: "my-app", + }); + - language: Ruby + code: |- + response = client.search_application.get( + name: "my-app" + ) + - language: PHP + code: |- + $resp = $client->searchApplication()->get([ + "name" => "my-app", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_application/search_application/my-app/"' diff --git a/specification/search_application/get_behavioral_analytics/examples/request/BehavioralAnalyticsGetRequestExample1.yaml b/specification/search_application/get_behavioral_analytics/examples/request/BehavioralAnalyticsGetRequestExample1.yaml index 072e6eb801..20609d111a 100644 --- a/specification/search_application/get_behavioral_analytics/examples/request/BehavioralAnalyticsGetRequestExample1.yaml +++ b/specification/search_application/get_behavioral_analytics/examples/request/BehavioralAnalyticsGetRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET _application/analytics/my* +alternatives: + - language: Python + code: |- + resp = client.search_application.get_behavioral_analytics( + name="my*", + ) + - language: JavaScript + code: |- + const response = await client.searchApplication.getBehavioralAnalytics({ + name: "my*", + }); + - language: Ruby + code: |- + response = client.search_application.get_behavioral_analytics( + name: "my*" + ) + - language: PHP + code: |- + $resp = $client->searchApplication()->getBehavioralAnalytics([ + "name" => "my*", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_application/analytics/my*"' diff --git a/specification/search_application/list/examples/request/SearchApplicationsListRequestExample1.yaml b/specification/search_application/list/examples/request/SearchApplicationsListRequestExample1.yaml index 16096a75a2..1bb413e718 100644 --- a/specification/search_application/list/examples/request/SearchApplicationsListRequestExample1.yaml +++ b/specification/search_application/list/examples/request/SearchApplicationsListRequestExample1.yaml @@ -1 +1,33 @@ method_request: GET _application/search_application?from=0&size=3&q=app* +alternatives: + - language: Python + code: |- + resp = client.search_application.list( + from="0", + size="3", + q="app*", + ) + - language: JavaScript + code: |- + const response = await client.searchApplication.list({ + from: 0, + size: 3, + q: "app*", + }); + - language: Ruby + code: |- + response = client.search_application.list( + from: "0", + size: "3", + q: "app*" + ) + - language: PHP + code: |- + $resp = $client->searchApplication()->list([ + "from" => "0", + "size" => "3", + "q" => "app*", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_application/search_application?from=0&size=3&q=app*"' diff --git a/specification/search_application/post_behavioral_analytics_event/examples/request/BehavioralAnalyticsEventPostRequestExample1.yaml b/specification/search_application/post_behavioral_analytics_event/examples/request/BehavioralAnalyticsEventPostRequestExample1.yaml index 9012a3a7a4..44eab8d221 100644 --- a/specification/search_application/post_behavioral_analytics_event/examples/request/BehavioralAnalyticsEventPostRequestExample1.yaml +++ b/specification/search_application/post_behavioral_analytics_event/examples/request/BehavioralAnalyticsEventPostRequestExample1.yaml @@ -1,13 +1,218 @@ # summary: behavioral-analytics/apis/post-analytics-collection-event.asciidoc:69 method_request: POST _application/analytics/my_analytics_collection/event/search_click -description: Run `POST _application/analytics/my_analytics_collection/event/search_click` to send a `search_click` event to an analytics collection called `my_analytics_collection`. +description: + Run `POST _application/analytics/my_analytics_collection/event/search_click` to send a `search_click` event to an + analytics collection called `my_analytics_collection`. # type: request -value: - "{\n \"session\": {\n \"id\": \"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\"\n\ - \ },\n \"user\": {\n \"id\": \"5f26f01a-bbee-4202-9298-81261067abbd\"\n },\n\ - \ \"search\":{\n \"query\": \"search term\",\n \"results\": {\n \"items\"\ - : [\n {\n \"document\": {\n \"id\": \"123\",\n \ - \ \"index\": \"products\"\n }\n }\n ],\n \"total_results\"\ - : 10\n },\n \"sort\": {\n \"name\": \"relevance\"\n },\n \"search_application\"\ - : \"website\"\n },\n \"document\":{\n \"id\": \"123\",\n \"index\": \"products\"\ - \n }\n}" +value: "{ + + \ \"session\": { + + \ \"id\": \"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\" + + \ }, + + \ \"user\": { + + \ \"id\": \"5f26f01a-bbee-4202-9298-81261067abbd\" + + \ }, + + \ \"search\":{ + + \ \"query\": \"search term\", + + \ \"results\": { + + \ \"items\": [ + + \ { + + \ \"document\": { + + \ \"id\": \"123\", + + \ \"index\": \"products\" + + \ } + + \ } + + \ ], + + \ \"total_results\": 10 + + \ }, + + \ \"sort\": { + + \ \"name\": \"relevance\" + + \ }, + + \ \"search_application\": \"website\" + + \ }, + + \ \"document\":{ + + \ \"id\": \"123\", + + \ \"index\": \"products\" + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.search_application.post_behavioral_analytics_event( + collection_name="my_analytics_collection", + event_type="search_click", + payload={ + "session": { + "id": "1797ca95-91c9-4e2e-b1bd-9c38e6f386a9" + }, + "user": { + "id": "5f26f01a-bbee-4202-9298-81261067abbd" + }, + "search": { + "query": "search term", + "results": { + "items": [ + { + "document": { + "id": "123", + "index": "products" + } + } + ], + "total_results": 10 + }, + "sort": { + "name": "relevance" + }, + "search_application": "website" + }, + "document": { + "id": "123", + "index": "products" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.searchApplication.postBehavioralAnalyticsEvent({ + collection_name: "my_analytics_collection", + event_type: "search_click", + payload: { + session: { + id: "1797ca95-91c9-4e2e-b1bd-9c38e6f386a9", + }, + user: { + id: "5f26f01a-bbee-4202-9298-81261067abbd", + }, + search: { + query: "search term", + results: { + items: [ + { + document: { + id: "123", + index: "products", + }, + }, + ], + total_results: 10, + }, + sort: { + name: "relevance", + }, + search_application: "website", + }, + document: { + id: "123", + index: "products", + }, + }, + }); + - language: Ruby + code: |- + response = client.search_application.post_behavioral_analytics_event( + collection_name: "my_analytics_collection", + event_type: "search_click", + body: { + "session": { + "id": "1797ca95-91c9-4e2e-b1bd-9c38e6f386a9" + }, + "user": { + "id": "5f26f01a-bbee-4202-9298-81261067abbd" + }, + "search": { + "query": "search term", + "results": { + "items": [ + { + "document": { + "id": "123", + "index": "products" + } + } + ], + "total_results": 10 + }, + "sort": { + "name": "relevance" + }, + "search_application": "website" + }, + "document": { + "id": "123", + "index": "products" + } + } + ) + - language: PHP + code: |- + $resp = $client->searchApplication()->postBehavioralAnalyticsEvent([ + "collection_name" => "my_analytics_collection", + "event_type" => "search_click", + "body" => [ + "session" => [ + "id" => "1797ca95-91c9-4e2e-b1bd-9c38e6f386a9", + ], + "user" => [ + "id" => "5f26f01a-bbee-4202-9298-81261067abbd", + ], + "search" => [ + "query" => "search term", + "results" => [ + "items" => array( + [ + "document" => [ + "id" => "123", + "index" => "products", + ], + ], + ), + "total_results" => 10, + ], + "sort" => [ + "name" => "relevance", + ], + "search_application" => "website", + ], + "document" => [ + "id" => "123", + "index" => "products", + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"session\":{\"id\":\"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\"},\"user\":{\"id\":\"5f26f01a-bbee-4202-9298-81261067abbd\"},\"\ + search\":{\"query\":\"search + term\",\"results\":{\"items\":[{\"document\":{\"id\":\"123\",\"index\":\"products\"}}],\"total_results\":10},\"sort\":{\"name\ + \":\"relevance\"},\"search_application\":\"website\"},\"document\":{\"id\":\"123\",\"index\":\"products\"}}' + \"$ELASTICSEARCH_URL/_application/analytics/my_analytics_collection/event/search_click\"" diff --git a/specification/search_application/put/examples/request/SearchApplicationPutRequestExample1.yaml b/specification/search_application/put/examples/request/SearchApplicationPutRequestExample1.yaml index 4bca640534..15d798c253 100644 --- a/specification/search_application/put/examples/request/SearchApplicationPutRequestExample1.yaml +++ b/specification/search_application/put/examples/request/SearchApplicationPutRequestExample1.yaml @@ -1,17 +1,263 @@ # summary: search-application/apis/put-search-application.asciidoc:148 method_request: PUT _application/search_application/my-app description: > - Run `PUT _application/search_application/my-app` to create or update a search application called `my-app`. When the dictionary parameter is specified, the search application search API will perform the following parameter validation: it accepts only the `query_string` and `default_field` parameters; it verifies that `query_string` and `default_field` are both strings; it accepts `default_field` only if it takes the values title or description. If the parameters are not valid, the search application search API will return an error. + Run `PUT _application/search_application/my-app` to create or update a search application called `my-app`. When the dictionary + parameter is specified, the search application search API will perform the following parameter validation: it accepts only the + `query_string` and `default_field` parameters; it verifies that `query_string` and `default_field` are both strings; it accepts + `default_field` only if it takes the values title or description. If the parameters are not valid, the search application search + API will return an error. # type: request -value: - "{\n \"indices\": [ \"index1\", \"index2\" ],\n \"template\": {\n \"script\"\ - : {\n \"source\": {\n \"query\": {\n \"query_string\": {\n\ - \ \"query\": \"{{query_string}}\",\n \"default_field\": \"\ - {{default_field}}\"\n }\n }\n },\n \"params\": {\n \ - \ \"query_string\": \"*\",\n \"default_field\": \"*\"\n }\n },\n\ - \ \"dictionary\": {\n \"properties\": {\n \"query_string\": {\n \ - \ \"type\": \"string\"\n },\n \"default_field\": {\n \ - \ \"type\": \"string\",\n \"enum\": [\n \"title\",\n \ - \ \"description\"\n ]\n },\n \"additionalProperties\"\ - : false\n },\n \"required\": [\n \"query_string\"\n ]\n \ - \ }\n }\n}" +value: "{ + + \ \"indices\": [ \"index1\", \"index2\" ], + + \ \"template\": { + + \ \"script\": { + + \ \"source\": { + + \ \"query\": { + + \ \"query_string\": { + + \ \"query\": \"{{query_string}}\", + + \ \"default_field\": \"{{default_field}}\" + + \ } + + \ } + + \ }, + + \ \"params\": { + + \ \"query_string\": \"*\", + + \ \"default_field\": \"*\" + + \ } + + \ }, + + \ \"dictionary\": { + + \ \"properties\": { + + \ \"query_string\": { + + \ \"type\": \"string\" + + \ }, + + \ \"default_field\": { + + \ \"type\": \"string\", + + \ \"enum\": [ + + \ \"title\", + + \ \"description\" + + \ ] + + \ }, + + \ \"additionalProperties\": false + + \ }, + + \ \"required\": [ + + \ \"query_string\" + + \ ] + + \ } + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.search_application.put( + name="my-app", + search_application={ + "indices": [ + "index1", + "index2" + ], + "template": { + "script": { + "source": { + "query": { + "query_string": { + "query": "{{query_string}}", + "default_field": "{{default_field}}" + } + } + }, + "params": { + "query_string": "*", + "default_field": "*" + } + }, + "dictionary": { + "properties": { + "query_string": { + "type": "string" + }, + "default_field": { + "type": "string", + "enum": [ + "title", + "description" + ] + }, + "additionalProperties": False + }, + "required": [ + "query_string" + ] + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.searchApplication.put({ + name: "my-app", + search_application: { + indices: ["index1", "index2"], + template: { + script: { + source: { + query: { + query_string: { + query: "{{query_string}}", + default_field: "{{default_field}}", + }, + }, + }, + params: { + query_string: "*", + default_field: "*", + }, + }, + dictionary: { + properties: { + query_string: { + type: "string", + }, + default_field: { + type: "string", + enum: ["title", "description"], + }, + additionalProperties: false, + }, + required: ["query_string"], + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.search_application.put( + name: "my-app", + body: { + "indices": [ + "index1", + "index2" + ], + "template": { + "script": { + "source": { + "query": { + "query_string": { + "query": "{{query_string}}", + "default_field": "{{default_field}}" + } + } + }, + "params": { + "query_string": "*", + "default_field": "*" + } + }, + "dictionary": { + "properties": { + "query_string": { + "type": "string" + }, + "default_field": { + "type": "string", + "enum": [ + "title", + "description" + ] + }, + "additionalProperties": false + }, + "required": [ + "query_string" + ] + } + } + } + ) + - language: PHP + code: |- + $resp = $client->searchApplication()->put([ + "name" => "my-app", + "body" => [ + "indices" => array( + "index1", + "index2", + ), + "template" => [ + "script" => [ + "source" => [ + "query" => [ + "query_string" => [ + "query" => "{{query_string}}", + "default_field" => "{{default_field}}", + ], + ], + ], + "params" => [ + "query_string" => "*", + "default_field" => "*", + ], + ], + "dictionary" => [ + "properties" => [ + "query_string" => [ + "type" => "string", + ], + "default_field" => [ + "type" => "string", + "enum" => array( + "title", + "description", + ), + ], + "additionalProperties" => false, + ], + "required" => array( + "query_string", + ), + ], + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"indices\":[\"index1\",\"index2\"],\"template\":{\"script\":{\"source\":{\"query\":{\"query_string\":{\"query\":\"{{query_\ + string}}\",\"default_field\":\"{{default_field}}\"}}},\"params\":{\"query_string\":\"*\",\"default_field\":\"*\"}},\"dictiona\ + ry\":{\"properties\":{\"query_string\":{\"type\":\"string\"},\"default_field\":{\"type\":\"string\",\"enum\":[\"title\",\"des\ + cription\"]},\"additionalProperties\":false},\"required\":[\"query_string\"]}}}' + \"$ELASTICSEARCH_URL/_application/search_application/my-app\"" diff --git a/specification/search_application/put_behavioral_analytics/examples/request/SearchApplicationPutBehavioralAnalyticsExample1.yaml b/specification/search_application/put_behavioral_analytics/examples/request/SearchApplicationPutBehavioralAnalyticsExample1.yaml index 4aaf67d23a..af4efed6df 100644 --- a/specification/search_application/put_behavioral_analytics/examples/request/SearchApplicationPutBehavioralAnalyticsExample1.yaml +++ b/specification/search_application/put_behavioral_analytics/examples/request/SearchApplicationPutBehavioralAnalyticsExample1.yaml @@ -1 +1,24 @@ method_request: PUT _application/analytics/my_analytics_collection +alternatives: + - language: Python + code: |- + resp = client.search_application.put_behavioral_analytics( + name="my_analytics_collection", + ) + - language: JavaScript + code: |- + const response = await client.searchApplication.putBehavioralAnalytics({ + name: "my_analytics_collection", + }); + - language: Ruby + code: |- + response = client.search_application.put_behavioral_analytics( + name: "my_analytics_collection" + ) + - language: PHP + code: |- + $resp = $client->searchApplication()->putBehavioralAnalytics([ + "name" => "my_analytics_collection", + ]); + - language: curl + code: 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_application/analytics/my_analytics_collection"' diff --git a/specification/search_application/render_query/examples/request/SearchApplicationsRenderQueryRequestExample1.yaml b/specification/search_application/render_query/examples/request/SearchApplicationsRenderQueryRequestExample1.yaml index 4b5239de01..a2ae24efca 100644 --- a/specification/search_application/render_query/examples/request/SearchApplicationsRenderQueryRequestExample1.yaml +++ b/specification/search_application/render_query/examples/request/SearchApplicationsRenderQueryRequestExample1.yaml @@ -1,6 +1,8 @@ # summary: method_request: POST _application/search_application/my-app/_render_query -description: Run `POST _application/search_application/my-app/_render_query` to generate a query for a search application called `my-app` that uses the search template. +description: + Run `POST _application/search_application/my-app/_render_query` to generate a query for a search application called + `my-app` that uses the search template. # type: request value: params: @@ -10,3 +12,86 @@ value: boost: 5 - name: description boost: 1 +alternatives: + - language: Python + code: |- + resp = client.search_application.render_query( + name="my-app", + params={ + "query_string": "my first query", + "text_fields": [ + { + "name": "title", + "boost": 5 + }, + { + "name": "description", + "boost": 1 + } + ] + }, + ) + - language: JavaScript + code: |- + const response = await client.searchApplication.renderQuery({ + name: "my-app", + params: { + query_string: "my first query", + text_fields: [ + { + name: "title", + boost: 5, + }, + { + name: "description", + boost: 1, + }, + ], + }, + }); + - language: Ruby + code: |- + response = client.search_application.render_query( + name: "my-app", + body: { + "params": { + "query_string": "my first query", + "text_fields": [ + { + "name": "title", + "boost": 5 + }, + { + "name": "description", + "boost": 1 + } + ] + } + } + ) + - language: PHP + code: |- + $resp = $client->searchApplication()->renderQuery([ + "name" => "my-app", + "body" => [ + "params" => [ + "query_string" => "my first query", + "text_fields" => array( + [ + "name" => "title", + "boost" => 5, + ], + [ + "name" => "description", + "boost" => 1, + ], + ), + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"params":{"query_string":"my first + query","text_fields":[{"name":"title","boost":5},{"name":"description","boost":1}]}}'' + "$ELASTICSEARCH_URL/_application/search_application/my-app/_render_query"' diff --git a/specification/search_application/search/examples/request/SearchApplicationsSearchRequestExample1.yaml b/specification/search_application/search/examples/request/SearchApplicationsSearchRequestExample1.yaml index 39f7a40488..bd0d9c9ca1 100644 --- a/specification/search_application/search/examples/request/SearchApplicationsSearchRequestExample1.yaml +++ b/specification/search_application/search/examples/request/SearchApplicationsSearchRequestExample1.yaml @@ -1,8 +1,106 @@ # summary: search-application/apis/search-application-search.asciidoc:125 method_request: POST _application/search_application/my-app/_search -description: Use `POST _application/search_application/my-app/_search` to run a search against a search application called `my-app` that uses a search template. +description: + Use `POST _application/search_application/my-app/_search` to run a search against a search application called `my-app` + that uses a search template. # type: request -value: - "{\n \"params\": {\n \"query_string\": \"my first query\",\n \"text_fields\"\ - : [\n {\"name\": \"title\", \"boost\": 5},\n {\"name\": \"description\"\ - , \"boost\": 1}\n ]\n }\n}" +value: "{ + + \ \"params\": { + + \ \"query_string\": \"my first query\", + + \ \"text_fields\": [ + + \ {\"name\": \"title\", \"boost\": 5}, + + \ {\"name\": \"description\", \"boost\": 1} + + \ ] + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.search_application.search( + name="my-app", + params={ + "query_string": "my first query", + "text_fields": [ + { + "name": "title", + "boost": 5 + }, + { + "name": "description", + "boost": 1 + } + ] + }, + ) + - language: JavaScript + code: |- + const response = await client.searchApplication.search({ + name: "my-app", + params: { + query_string: "my first query", + text_fields: [ + { + name: "title", + boost: 5, + }, + { + name: "description", + boost: 1, + }, + ], + }, + }); + - language: Ruby + code: |- + response = client.search_application.search( + name: "my-app", + body: { + "params": { + "query_string": "my first query", + "text_fields": [ + { + "name": "title", + "boost": 5 + }, + { + "name": "description", + "boost": 1 + } + ] + } + } + ) + - language: PHP + code: |- + $resp = $client->searchApplication()->search([ + "name" => "my-app", + "body" => [ + "params" => [ + "query_string" => "my first query", + "text_fields" => array( + [ + "name" => "title", + "boost" => 5, + ], + [ + "name" => "description", + "boost" => 1, + ], + ), + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"params":{"query_string":"my first + query","text_fields":[{"name":"title","boost":5},{"name":"description","boost":1}]}}'' + "$ELASTICSEARCH_URL/_application/search_application/my-app/_search"' diff --git a/specification/searchable_snapshots/cache_stats/examples/request/CacheStatsRequestExample1.yaml b/specification/searchable_snapshots/cache_stats/examples/request/CacheStatsRequestExample1.yaml index f42d35458a..e2243dea5a 100644 --- a/specification/searchable_snapshots/cache_stats/examples/request/CacheStatsRequestExample1.yaml +++ b/specification/searchable_snapshots/cache_stats/examples/request/CacheStatsRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET /_searchable_snapshots/cache/stats +alternatives: + - language: Python + code: resp = client.searchable_snapshots.cache_stats() + - language: JavaScript + code: const response = await client.searchableSnapshots.cacheStats(); + - language: Ruby + code: response = client.searchable_snapshots.cache_stats + - language: PHP + code: $resp = $client->searchableSnapshots()->cacheStats(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_searchable_snapshots/cache/stats"' diff --git a/specification/searchable_snapshots/clear_cache/examples/request/SearchableSnapshotsClearCacheExample1.yaml b/specification/searchable_snapshots/clear_cache/examples/request/SearchableSnapshotsClearCacheExample1.yaml index 39b7c88abf..faee23272f 100644 --- a/specification/searchable_snapshots/clear_cache/examples/request/SearchableSnapshotsClearCacheExample1.yaml +++ b/specification/searchable_snapshots/clear_cache/examples/request/SearchableSnapshotsClearCacheExample1.yaml @@ -1 +1,24 @@ method_request: POST /my-index/_searchable_snapshots/cache/clear +alternatives: + - language: Python + code: |- + resp = client.searchable_snapshots.clear_cache( + index="my-index", + ) + - language: JavaScript + code: |- + const response = await client.searchableSnapshots.clearCache({ + index: "my-index", + }); + - language: Ruby + code: |- + response = client.searchable_snapshots.clear_cache( + index: "my-index" + ) + - language: PHP + code: |- + $resp = $client->searchableSnapshots()->clearCache([ + "index" => "my-index", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index/_searchable_snapshots/cache/clear"' diff --git a/specification/searchable_snapshots/mount/examples/request/SearchableSnapshotsMountSnapshotRequestExample1.yaml b/specification/searchable_snapshots/mount/examples/request/SearchableSnapshotsMountSnapshotRequestExample1.yaml index 3c034d289a..faf64ee70a 100644 --- a/specification/searchable_snapshots/mount/examples/request/SearchableSnapshotsMountSnapshotRequestExample1.yaml +++ b/specification/searchable_snapshots/mount/examples/request/SearchableSnapshotsMountSnapshotRequestExample1.yaml @@ -1,9 +1,89 @@ summary: method_request: POST /_snapshot/my_repository/my_snapshot/_mount?wait_for_completion=true description: > - Run `POST /_snapshot/my_repository/my_snapshot/_mount?wait_for_completion=true` to mount the index `my_docs` from an existing snapshot named `my_snapshot` stored in `my_repository` as a new index `docs`. + Run `POST /_snapshot/my_repository/my_snapshot/_mount?wait_for_completion=true` to mount the index `my_docs` from an existing + snapshot named `my_snapshot` stored in `my_repository` as a new index `docs`. # type: request -value: - "{\n \"index\": \"my_docs\",\n \"renamed_index\": \"docs\",\n \"index_settings\"\ - : {\n \"index.number_of_replicas\": 0\n },\n \"ignore_index_settings\": [ \"\ - index.refresh_interval\" ]\n}" +value: "{ + + \ \"index\": \"my_docs\", + + \ \"renamed_index\": \"docs\", + + \ \"index_settings\": { + + \ \"index.number_of_replicas\": 0 + + \ }, + + \ \"ignore_index_settings\": [ \"index.refresh_interval\" ] + + }" +alternatives: + - language: Python + code: |- + resp = client.searchable_snapshots.mount( + repository="my_repository", + snapshot="my_snapshot", + wait_for_completion=True, + index="my_docs", + renamed_index="docs", + index_settings={ + "index.number_of_replicas": 0 + }, + ignore_index_settings=[ + "index.refresh_interval" + ], + ) + - language: JavaScript + code: |- + const response = await client.searchableSnapshots.mount({ + repository: "my_repository", + snapshot: "my_snapshot", + wait_for_completion: "true", + index: "my_docs", + renamed_index: "docs", + index_settings: { + "index.number_of_replicas": 0, + }, + ignore_index_settings: ["index.refresh_interval"], + }); + - language: Ruby + code: |- + response = client.searchable_snapshots.mount( + repository: "my_repository", + snapshot: "my_snapshot", + wait_for_completion: "true", + body: { + "index": "my_docs", + "renamed_index": "docs", + "index_settings": { + "index.number_of_replicas": 0 + }, + "ignore_index_settings": [ + "index.refresh_interval" + ] + } + ) + - language: PHP + code: |- + $resp = $client->searchableSnapshots()->mount([ + "repository" => "my_repository", + "snapshot" => "my_snapshot", + "wait_for_completion" => "true", + "body" => [ + "index" => "my_docs", + "renamed_index" => "docs", + "index_settings" => [ + "index.number_of_replicas" => 0, + ], + "ignore_index_settings" => array( + "index.refresh_interval", + ), + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"index\":\"my_docs\",\"renamed_index\":\"docs\",\"index_settings\":{\"index.number_of_replicas\":0},\"ignore_index_settings\ + \":[\"index.refresh_interval\"]}' \"$ELASTICSEARCH_URL/_snapshot/my_repository/my_snapshot/_mount?wait_for_completion=true\"" diff --git a/specification/searchable_snapshots/stats/examples/request/SearchableSnapshotsStatsExample1.yaml b/specification/searchable_snapshots/stats/examples/request/SearchableSnapshotsStatsExample1.yaml index b87278903e..5393721cf6 100644 --- a/specification/searchable_snapshots/stats/examples/request/SearchableSnapshotsStatsExample1.yaml +++ b/specification/searchable_snapshots/stats/examples/request/SearchableSnapshotsStatsExample1.yaml @@ -1 +1,24 @@ method_request: GET /my-index/_searchable_snapshots/stats +alternatives: + - language: Python + code: |- + resp = client.searchable_snapshots.stats( + index="my-index", + ) + - language: JavaScript + code: |- + const response = await client.searchableSnapshots.stats({ + index: "my-index", + }); + - language: Ruby + code: |- + response = client.searchable_snapshots.stats( + index: "my-index" + ) + - language: PHP + code: |- + $resp = $client->searchableSnapshots()->stats([ + "index" => "my-index", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index/_searchable_snapshots/stats"' diff --git a/specification/security/activate_user_profile/examples/request/ActivateUserProfileRequestExample1.yaml b/specification/security/activate_user_profile/examples/request/ActivateUserProfileRequestExample1.yaml index 203118735a..558658b064 100644 --- a/specification/security/activate_user_profile/examples/request/ActivateUserProfileRequestExample1.yaml +++ b/specification/security/activate_user_profile/examples/request/ActivateUserProfileRequestExample1.yaml @@ -9,3 +9,41 @@ value: |- "username" : "jacknich", "password" : "l0ng-r4nd0m-p@ssw0rd" } +alternatives: + - language: Python + code: |- + resp = client.security.activate_user_profile( + grant_type="password", + username="jacknich", + password="l0ng-r4nd0m-p@ssw0rd", + ) + - language: JavaScript + code: |- + const response = await client.security.activateUserProfile({ + grant_type: "password", + username: "jacknich", + password: "l0ng-r4nd0m-p@ssw0rd", + }); + - language: Ruby + code: |- + response = client.security.activate_user_profile( + body: { + "grant_type": "password", + "username": "jacknich", + "password": "l0ng-r4nd0m-p@ssw0rd" + } + ) + - language: PHP + code: |- + $resp = $client->security()->activateUserProfile([ + "body" => [ + "grant_type" => "password", + "username" => "jacknich", + "password" => "l0ng-r4nd0m-p@ssw0rd", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"grant_type":"password","username":"jacknich","password":"l0ng-r4nd0m-p@ssw0rd"}'' + "$ELASTICSEARCH_URL/_security/profile/_activate"' diff --git a/specification/security/authenticate/examples/request/SecurityAuthenticateRequestExample1.yaml b/specification/security/authenticate/examples/request/SecurityAuthenticateRequestExample1.yaml index ac8802f5a3..6cf3ecee12 100644 --- a/specification/security/authenticate/examples/request/SecurityAuthenticateRequestExample1.yaml +++ b/specification/security/authenticate/examples/request/SecurityAuthenticateRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET /_security/_authenticate +alternatives: + - language: Python + code: resp = client.security.authenticate() + - language: JavaScript + code: const response = await client.security.authenticate(); + - language: Ruby + code: response = client.security.authenticate + - language: PHP + code: $resp = $client->security()->authenticate(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_security/_authenticate"' diff --git a/specification/security/bulk_delete_role/examples/request/SecurityBulkDeleteRoleRequestExample1.yaml b/specification/security/bulk_delete_role/examples/request/SecurityBulkDeleteRoleRequestExample1.yaml index be41eb1684..11c4558937 100644 --- a/specification/security/bulk_delete_role/examples/request/SecurityBulkDeleteRoleRequestExample1.yaml +++ b/specification/security/bulk_delete_role/examples/request/SecurityBulkDeleteRoleRequestExample1.yaml @@ -7,3 +7,41 @@ value: |- { "names": ["my_admin_role", "my_user_role"] } +alternatives: + - language: Python + code: |- + resp = client.security.bulk_delete_role( + names=[ + "my_admin_role", + "my_user_role" + ], + ) + - language: JavaScript + code: |- + const response = await client.security.bulkDeleteRole({ + names: ["my_admin_role", "my_user_role"], + }); + - language: Ruby + code: |- + response = client.security.bulk_delete_role( + body: { + "names": [ + "my_admin_role", + "my_user_role" + ] + } + ) + - language: PHP + code: |- + $resp = $client->security()->bulkDeleteRole([ + "body" => [ + "names" => array( + "my_admin_role", + "my_user_role", + ), + ], + ]); + - language: curl + code: + 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"names":["my_admin_role","my_user_role"]}'' "$ELASTICSEARCH_URL/_security/role"' diff --git a/specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample1.yaml b/specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample1.yaml index 3e72b3ad2a..ca4d99991a 100644 --- a/specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample1.yaml +++ b/specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample1.yaml @@ -89,3 +89,334 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.security.bulk_put_role( + roles={ + "my_admin_role": { + "cluster": [ + "all" + ], + "indices": [ + { + "names": [ + "index1", + "index2" + ], + "privileges": [ + "all" + ], + "field_security": { + "grant": [ + "title", + "body" + ] + }, + "query": "{\"match\": {\"title\": \"foo\"}}" + } + ], + "applications": [ + { + "application": "myapp", + "privileges": [ + "admin", + "read" + ], + "resources": [ + "*" + ] + } + ], + "run_as": [ + "other_user" + ], + "metadata": { + "version": 1 + } + }, + "my_user_role": { + "cluster": [ + "all" + ], + "indices": [ + { + "names": [ + "index1" + ], + "privileges": [ + "read" + ], + "field_security": { + "grant": [ + "title", + "body" + ] + }, + "query": "{\"match\": {\"title\": \"foo\"}}" + } + ], + "applications": [ + { + "application": "myapp", + "privileges": [ + "admin", + "read" + ], + "resources": [ + "*" + ] + } + ], + "run_as": [ + "other_user" + ], + "metadata": { + "version": 1 + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.security.bulkPutRole({ + roles: { + my_admin_role: { + cluster: ["all"], + indices: [ + { + names: ["index1", "index2"], + privileges: ["all"], + field_security: { + grant: ["title", "body"], + }, + query: '{"match": {"title": "foo"}}', + }, + ], + applications: [ + { + application: "myapp", + privileges: ["admin", "read"], + resources: ["*"], + }, + ], + run_as: ["other_user"], + metadata: { + version: 1, + }, + }, + my_user_role: { + cluster: ["all"], + indices: [ + { + names: ["index1"], + privileges: ["read"], + field_security: { + grant: ["title", "body"], + }, + query: '{"match": {"title": "foo"}}', + }, + ], + applications: [ + { + application: "myapp", + privileges: ["admin", "read"], + resources: ["*"], + }, + ], + run_as: ["other_user"], + metadata: { + version: 1, + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.security.bulk_put_role( + body: { + "roles": { + "my_admin_role": { + "cluster": [ + "all" + ], + "indices": [ + { + "names": [ + "index1", + "index2" + ], + "privileges": [ + "all" + ], + "field_security": { + "grant": [ + "title", + "body" + ] + }, + "query": "{\"match\": {\"title\": \"foo\"}}" + } + ], + "applications": [ + { + "application": "myapp", + "privileges": [ + "admin", + "read" + ], + "resources": [ + "*" + ] + } + ], + "run_as": [ + "other_user" + ], + "metadata": { + "version": 1 + } + }, + "my_user_role": { + "cluster": [ + "all" + ], + "indices": [ + { + "names": [ + "index1" + ], + "privileges": [ + "read" + ], + "field_security": { + "grant": [ + "title", + "body" + ] + }, + "query": "{\"match\": {\"title\": \"foo\"}}" + } + ], + "applications": [ + { + "application": "myapp", + "privileges": [ + "admin", + "read" + ], + "resources": [ + "*" + ] + } + ], + "run_as": [ + "other_user" + ], + "metadata": { + "version": 1 + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->bulkPutRole([ + "body" => [ + "roles" => [ + "my_admin_role" => [ + "cluster" => array( + "all", + ), + "indices" => array( + [ + "names" => array( + "index1", + "index2", + ), + "privileges" => array( + "all", + ), + "field_security" => [ + "grant" => array( + "title", + "body", + ), + ], + "query" => "{\"match\": {\"title\": \"foo\"}}", + ], + ), + "applications" => array( + [ + "application" => "myapp", + "privileges" => array( + "admin", + "read", + ), + "resources" => array( + "*", + ), + ], + ), + "run_as" => array( + "other_user", + ), + "metadata" => [ + "version" => 1, + ], + ], + "my_user_role" => [ + "cluster" => array( + "all", + ), + "indices" => array( + [ + "names" => array( + "index1", + ), + "privileges" => array( + "read", + ), + "field_security" => [ + "grant" => array( + "title", + "body", + ), + ], + "query" => "{\"match\": {\"title\": \"foo\"}}", + ], + ), + "applications" => array( + [ + "application" => "myapp", + "privileges" => array( + "admin", + "read", + ), + "resources" => array( + "*", + ), + ], + ), + "run_as" => array( + "other_user", + ), + "metadata" => [ + "version" => 1, + ], + ], + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"roles\":{\"my_admin_role\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index1\",\"index2\"],\"privileges\":[\"all\"\ + ],\"field_security\":{\"grant\":[\"title\",\"body\"]},\"query\":\"{\\\"match\\\": {\\\"title\\\": + \\\"foo\\\"}}\"}],\"applications\":[{\"application\":\"myapp\",\"privileges\":[\"admin\",\"read\"],\"resources\":[\"*\"]}],\"\ + run_as\":[\"other_user\"],\"metadata\":{\"version\":1}},\"my_user_role\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"in\ + dex1\"],\"privileges\":[\"read\"],\"field_security\":{\"grant\":[\"title\",\"body\"]},\"query\":\"{\\\"match\\\": + {\\\"title\\\": + \\\"foo\\\"}}\"}],\"applications\":[{\"application\":\"myapp\",\"privileges\":[\"admin\",\"read\"],\"resources\":[\"*\"]}],\"\ + run_as\":[\"other_user\"],\"metadata\":{\"version\":1}}}}' \"$ELASTICSEARCH_URL/_security/role\"" diff --git a/specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample2.yaml b/specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample2.yaml index eb2ebde23b..7c44276294 100644 --- a/specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample2.yaml +++ b/specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample2.yaml @@ -1,8 +1,9 @@ summary: Bulk role errors method_request: POST /_security/role description: > - Because errors are handled individually for each role create or update, the API allows partial success. - For example, `POST /_security/role` would throw an error for `my_admin_role` because the privilege `bad_cluster_privilege` doesn't exist, but would be successful for the `my_user_role`. + Because errors are handled individually for each role create or update, the API allows partial success. For example, `POST + /_security/role` would throw an error for `my_admin_role` because the privilege `bad_cluster_privilege` doesn't exist, but would + be successful for the `my_user_role`. # type: request value: |- { @@ -88,3 +89,334 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.security.bulk_put_role( + roles={ + "my_admin_role": { + "cluster": [ + "bad_cluster_privilege" + ], + "indices": [ + { + "names": [ + "index1", + "index2" + ], + "privileges": [ + "all" + ], + "field_security": { + "grant": [ + "title", + "body" + ] + }, + "query": "{\"match\": {\"title\": \"foo\"}}" + } + ], + "applications": [ + { + "application": "myapp", + "privileges": [ + "admin", + "read" + ], + "resources": [ + "*" + ] + } + ], + "run_as": [ + "other_user" + ], + "metadata": { + "version": 1 + } + }, + "my_user_role": { + "cluster": [ + "all" + ], + "indices": [ + { + "names": [ + "index1" + ], + "privileges": [ + "read" + ], + "field_security": { + "grant": [ + "title", + "body" + ] + }, + "query": "{\"match\": {\"title\": \"foo\"}}" + } + ], + "applications": [ + { + "application": "myapp", + "privileges": [ + "admin", + "read" + ], + "resources": [ + "*" + ] + } + ], + "run_as": [ + "other_user" + ], + "metadata": { + "version": 1 + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.security.bulkPutRole({ + roles: { + my_admin_role: { + cluster: ["bad_cluster_privilege"], + indices: [ + { + names: ["index1", "index2"], + privileges: ["all"], + field_security: { + grant: ["title", "body"], + }, + query: '{"match": {"title": "foo"}}', + }, + ], + applications: [ + { + application: "myapp", + privileges: ["admin", "read"], + resources: ["*"], + }, + ], + run_as: ["other_user"], + metadata: { + version: 1, + }, + }, + my_user_role: { + cluster: ["all"], + indices: [ + { + names: ["index1"], + privileges: ["read"], + field_security: { + grant: ["title", "body"], + }, + query: '{"match": {"title": "foo"}}', + }, + ], + applications: [ + { + application: "myapp", + privileges: ["admin", "read"], + resources: ["*"], + }, + ], + run_as: ["other_user"], + metadata: { + version: 1, + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.security.bulk_put_role( + body: { + "roles": { + "my_admin_role": { + "cluster": [ + "bad_cluster_privilege" + ], + "indices": [ + { + "names": [ + "index1", + "index2" + ], + "privileges": [ + "all" + ], + "field_security": { + "grant": [ + "title", + "body" + ] + }, + "query": "{\"match\": {\"title\": \"foo\"}}" + } + ], + "applications": [ + { + "application": "myapp", + "privileges": [ + "admin", + "read" + ], + "resources": [ + "*" + ] + } + ], + "run_as": [ + "other_user" + ], + "metadata": { + "version": 1 + } + }, + "my_user_role": { + "cluster": [ + "all" + ], + "indices": [ + { + "names": [ + "index1" + ], + "privileges": [ + "read" + ], + "field_security": { + "grant": [ + "title", + "body" + ] + }, + "query": "{\"match\": {\"title\": \"foo\"}}" + } + ], + "applications": [ + { + "application": "myapp", + "privileges": [ + "admin", + "read" + ], + "resources": [ + "*" + ] + } + ], + "run_as": [ + "other_user" + ], + "metadata": { + "version": 1 + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->bulkPutRole([ + "body" => [ + "roles" => [ + "my_admin_role" => [ + "cluster" => array( + "bad_cluster_privilege", + ), + "indices" => array( + [ + "names" => array( + "index1", + "index2", + ), + "privileges" => array( + "all", + ), + "field_security" => [ + "grant" => array( + "title", + "body", + ), + ], + "query" => "{\"match\": {\"title\": \"foo\"}}", + ], + ), + "applications" => array( + [ + "application" => "myapp", + "privileges" => array( + "admin", + "read", + ), + "resources" => array( + "*", + ), + ], + ), + "run_as" => array( + "other_user", + ), + "metadata" => [ + "version" => 1, + ], + ], + "my_user_role" => [ + "cluster" => array( + "all", + ), + "indices" => array( + [ + "names" => array( + "index1", + ), + "privileges" => array( + "read", + ), + "field_security" => [ + "grant" => array( + "title", + "body", + ), + ], + "query" => "{\"match\": {\"title\": \"foo\"}}", + ], + ), + "applications" => array( + [ + "application" => "myapp", + "privileges" => array( + "admin", + "read", + ), + "resources" => array( + "*", + ), + ], + ), + "run_as" => array( + "other_user", + ), + "metadata" => [ + "version" => 1, + ], + ], + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"roles\":{\"my_admin_role\":{\"cluster\":[\"bad_cluster_privilege\"],\"indices\":[{\"names\":[\"index1\",\"index2\"],\"pri\ + vileges\":[\"all\"],\"field_security\":{\"grant\":[\"title\",\"body\"]},\"query\":\"{\\\"match\\\": {\\\"title\\\": + \\\"foo\\\"}}\"}],\"applications\":[{\"application\":\"myapp\",\"privileges\":[\"admin\",\"read\"],\"resources\":[\"*\"]}],\"\ + run_as\":[\"other_user\"],\"metadata\":{\"version\":1}},\"my_user_role\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"in\ + dex1\"],\"privileges\":[\"read\"],\"field_security\":{\"grant\":[\"title\",\"body\"]},\"query\":\"{\\\"match\\\": + {\\\"title\\\": + \\\"foo\\\"}}\"}],\"applications\":[{\"application\":\"myapp\",\"privileges\":[\"admin\",\"read\"],\"resources\":[\"*\"]}],\"\ + run_as\":[\"other_user\"],\"metadata\":{\"version\":1}}}}' \"$ELASTICSEARCH_URL/_security/role\"" diff --git a/specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample3.yaml b/specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample3.yaml index 5d799044d0..d4d3100d2a 100644 --- a/specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample3.yaml +++ b/specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample3.yaml @@ -1,6 +1,8 @@ summary: Role example 3 method_request: POST /_security/role/only_remote_access_role -description: Run `POST /_security/role/only_remote_access_role` to configure a role with remote indices and remote cluster privileges for a remote cluster. +description: + Run `POST /_security/role/only_remote_access_role` to configure a role with remote indices and remote cluster + privileges for a remote cluster. # type: request value: |- { @@ -18,3 +20,122 @@ value: |- } ] } +alternatives: + - language: Python + code: |- + resp = client.security.put_role( + name="only_remote_access_role", + remote_indices=[ + { + "clusters": [ + "my_remote" + ], + "names": [ + "logs*" + ], + "privileges": [ + "read", + "read_cross_cluster", + "view_index_metadata" + ] + } + ], + remote_cluster=[ + { + "clusters": [ + "my_remote" + ], + "privileges": [ + "monitor_stats" + ] + } + ], + ) + - language: JavaScript + code: |- + const response = await client.security.putRole({ + name: "only_remote_access_role", + remote_indices: [ + { + clusters: ["my_remote"], + names: ["logs*"], + privileges: ["read", "read_cross_cluster", "view_index_metadata"], + }, + ], + remote_cluster: [ + { + clusters: ["my_remote"], + privileges: ["monitor_stats"], + }, + ], + }); + - language: Ruby + code: |- + response = client.security.put_role( + name: "only_remote_access_role", + body: { + "remote_indices": [ + { + "clusters": [ + "my_remote" + ], + "names": [ + "logs*" + ], + "privileges": [ + "read", + "read_cross_cluster", + "view_index_metadata" + ] + } + ], + "remote_cluster": [ + { + "clusters": [ + "my_remote" + ], + "privileges": [ + "monitor_stats" + ] + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->security()->putRole([ + "name" => "only_remote_access_role", + "body" => [ + "remote_indices" => array( + [ + "clusters" => array( + "my_remote", + ), + "names" => array( + "logs*", + ), + "privileges" => array( + "read", + "read_cross_cluster", + "view_index_metadata", + ), + ], + ), + "remote_cluster" => array( + [ + "clusters" => array( + "my_remote", + ), + "privileges" => array( + "monitor_stats", + ), + ], + ), + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"remote_indices\":[{\"clusters\":[\"my_remote\"],\"names\":[\"logs*\"],\"privileges\":[\"read\",\"read_cross_cluster\",\"v\ + iew_index_metadata\"]}],\"remote_cluster\":[{\"clusters\":[\"my_remote\"],\"privileges\":[\"monitor_stats\"]}]}' + \"$ELASTICSEARCH_URL/_security/role/only_remote_access_role\"" diff --git a/specification/security/bulk_update_api_keys/examples/request/SecurityBulkUpdateApiKeysRequestExample1.yaml b/specification/security/bulk_update_api_keys/examples/request/SecurityBulkUpdateApiKeysRequestExample1.yaml index 06a69f77a4..42f565b009 100644 --- a/specification/security/bulk_update_api_keys/examples/request/SecurityBulkUpdateApiKeysRequestExample1.yaml +++ b/specification/security/bulk_update_api_keys/examples/request/SecurityBulkUpdateApiKeysRequestExample1.yaml @@ -1,4 +1,5 @@ # summary: +method_request: POST /_security/api_key/_bulk_update description: Assign new role descriptors and metadata and update the expiration time for two API keys. # type": "response", # response_code": 200, @@ -20,3 +21,133 @@ value: tags: - production expiration: 30d +alternatives: + - language: Python + code: |- + resp = client.security.bulk_update_api_keys( + ids=[ + "VuaCfGcBCdbkQm-e5aOx", + "H3_AhoIBA9hmeQJdg7ij" + ], + role_descriptors={ + "role-a": { + "indices": [ + { + "names": [ + "*" + ], + "privileges": [ + "write" + ] + } + ] + } + }, + metadata={ + "environment": { + "level": 2, + "trusted": True, + "tags": [ + "production" + ] + } + }, + expiration="30d", + ) + - language: JavaScript + code: |- + const response = await client.security.bulkUpdateApiKeys({ + ids: ["VuaCfGcBCdbkQm-e5aOx", "H3_AhoIBA9hmeQJdg7ij"], + role_descriptors: { + "role-a": { + indices: [ + { + names: ["*"], + privileges: ["write"], + }, + ], + }, + }, + metadata: { + environment: { + level: 2, + trusted: true, + tags: ["production"], + }, + }, + expiration: "30d", + }); + - language: Ruby + code: |- + response = client.security.bulk_update_api_keys( + body: { + "ids": [ + "VuaCfGcBCdbkQm-e5aOx", + "H3_AhoIBA9hmeQJdg7ij" + ], + "role_descriptors": { + "role-a": { + "indices": [ + { + "names": [ + "*" + ], + "privileges": [ + "write" + ] + } + ] + } + }, + "metadata": { + "environment": { + "level": 2, + "trusted": true, + "tags": [ + "production" + ] + } + }, + "expiration": "30d" + } + ) + - language: PHP + code: |- + $resp = $client->security()->bulkUpdateApiKeys([ + "body" => [ + "ids" => array( + "VuaCfGcBCdbkQm-e5aOx", + "H3_AhoIBA9hmeQJdg7ij", + ), + "role_descriptors" => [ + "role-a" => [ + "indices" => array( + [ + "names" => array( + "*", + ), + "privileges" => array( + "write", + ), + ], + ), + ], + ], + "metadata" => [ + "environment" => [ + "level" => 2, + "trusted" => true, + "tags" => array( + "production", + ), + ], + ], + "expiration" => "30d", + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"ids\":[\"VuaCfGcBCdbkQm-e5aOx\",\"H3_AhoIBA9hmeQJdg7ij\"],\"role_descriptors\":{\"role-a\":{\"indices\":[{\"names\":[\"*\ + \"],\"privileges\":[\"write\"]}]}},\"metadata\":{\"environment\":{\"level\":2,\"trusted\":true,\"tags\":[\"production\"]}},\"\ + expiration\":\"30d\"}' \"$ELASTICSEARCH_URL/_security/api_key/_bulk_update\"" diff --git a/specification/security/bulk_update_api_keys/examples/request/SecurityBulkUpdateApiKeysRequestExample2.yaml b/specification/security/bulk_update_api_keys/examples/request/SecurityBulkUpdateApiKeysRequestExample2.yaml index 83a155083c..30285fde0b 100644 --- a/specification/security/bulk_update_api_keys/examples/request/SecurityBulkUpdateApiKeysRequestExample2.yaml +++ b/specification/security/bulk_update_api_keys/examples/request/SecurityBulkUpdateApiKeysRequestExample2.yaml @@ -1,4 +1,5 @@ # summary: +method_request: POST /_security/api_key/_bulk_update description: Remove the previously assigned permissions for two API keys, making them inherit the owner user's full permissions. # type": "response", # response_code": 200, @@ -7,3 +8,46 @@ value: - VuaCfGcBCdbkQm-e5aOx - H3_AhoIBA9hmeQJdg7ij role_descriptors: {} +alternatives: + - language: Python + code: |- + resp = client.security.bulk_update_api_keys( + ids=[ + "VuaCfGcBCdbkQm-e5aOx", + "H3_AhoIBA9hmeQJdg7ij" + ], + role_descriptors={}, + ) + - language: JavaScript + code: |- + const response = await client.security.bulkUpdateApiKeys({ + ids: ["VuaCfGcBCdbkQm-e5aOx", "H3_AhoIBA9hmeQJdg7ij"], + role_descriptors: {}, + }); + - language: Ruby + code: |- + response = client.security.bulk_update_api_keys( + body: { + "ids": [ + "VuaCfGcBCdbkQm-e5aOx", + "H3_AhoIBA9hmeQJdg7ij" + ], + "role_descriptors": {} + } + ) + - language: PHP + code: |- + $resp = $client->security()->bulkUpdateApiKeys([ + "body" => [ + "ids" => array( + "VuaCfGcBCdbkQm-e5aOx", + "H3_AhoIBA9hmeQJdg7ij", + ), + "role_descriptors" => new ArrayObject([]), + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"ids":["VuaCfGcBCdbkQm-e5aOx","H3_AhoIBA9hmeQJdg7ij"],"role_descriptors":{}}'' + "$ELASTICSEARCH_URL/_security/api_key/_bulk_update"' diff --git a/specification/security/change_password/examples/request/SecurityChangePasswordRequestExample1.yaml b/specification/security/change_password/examples/request/SecurityChangePasswordRequestExample1.yaml index 2d593453db..4a9a9c7259 100644 --- a/specification/security/change_password/examples/request/SecurityChangePasswordRequestExample1.yaml +++ b/specification/security/change_password/examples/request/SecurityChangePasswordRequestExample1.yaml @@ -7,3 +7,36 @@ value: |- { "password" : "new-test-password" } +alternatives: + - language: Python + code: |- + resp = client.security.change_password( + username="jacknich", + password="new-test-password", + ) + - language: JavaScript + code: |- + const response = await client.security.changePassword({ + username: "jacknich", + password: "new-test-password", + }); + - language: Ruby + code: |- + response = client.security.change_password( + username: "jacknich", + body: { + "password": "new-test-password" + } + ) + - language: PHP + code: |- + $resp = $client->security()->changePassword([ + "username" => "jacknich", + "body" => [ + "password" => "new-test-password", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"password":"new-test-password"}'' "$ELASTICSEARCH_URL/_security/user/jacknich/_password"' diff --git a/specification/security/clear_api_key_cache/examples/request/SecurityClearApiKeyCacheExample1.yaml b/specification/security/clear_api_key_cache/examples/request/SecurityClearApiKeyCacheExample1.yaml index 19ca296a6b..4438632938 100644 --- a/specification/security/clear_api_key_cache/examples/request/SecurityClearApiKeyCacheExample1.yaml +++ b/specification/security/clear_api_key_cache/examples/request/SecurityClearApiKeyCacheExample1.yaml @@ -1 +1,25 @@ method_request: POST /_security/api_key/yVGMr3QByxdh1MSaicYx/_clear_cache +alternatives: + - language: Python + code: |- + resp = client.security.clear_api_key_cache( + ids="yVGMr3QByxdh1MSaicYx", + ) + - language: JavaScript + code: |- + const response = await client.security.clearApiKeyCache({ + ids: "yVGMr3QByxdh1MSaicYx", + }); + - language: Ruby + code: |- + response = client.security.clear_api_key_cache( + ids: "yVGMr3QByxdh1MSaicYx" + ) + - language: PHP + code: |- + $resp = $client->security()->clearApiKeyCache([ + "ids" => "yVGMr3QByxdh1MSaicYx", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_security/api_key/yVGMr3QByxdh1MSaicYx/_clear_cache"' diff --git a/specification/security/clear_cached_privileges/examples/request/SecurityClearCachedPrivilegesExample1.yaml b/specification/security/clear_cached_privileges/examples/request/SecurityClearCachedPrivilegesExample1.yaml index b824f2eb42..b7fe2e3e79 100644 --- a/specification/security/clear_cached_privileges/examples/request/SecurityClearCachedPrivilegesExample1.yaml +++ b/specification/security/clear_cached_privileges/examples/request/SecurityClearCachedPrivilegesExample1.yaml @@ -1 +1,24 @@ method_request: POST /_security/privilege/myapp/_clear_cache +alternatives: + - language: Python + code: |- + resp = client.security.clear_cached_privileges( + application="myapp", + ) + - language: JavaScript + code: |- + const response = await client.security.clearCachedPrivileges({ + application: "myapp", + }); + - language: Ruby + code: |- + response = client.security.clear_cached_privileges( + application: "myapp" + ) + - language: PHP + code: |- + $resp = $client->security()->clearCachedPrivileges([ + "application" => "myapp", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_security/privilege/myapp/_clear_cache"' diff --git a/specification/security/clear_cached_realms/examples/request/SecurityClearCachedRealmsExample1.yaml b/specification/security/clear_cached_realms/examples/request/SecurityClearCachedRealmsExample1.yaml index d47612457f..54667d9fdc 100644 --- a/specification/security/clear_cached_realms/examples/request/SecurityClearCachedRealmsExample1.yaml +++ b/specification/security/clear_cached_realms/examples/request/SecurityClearCachedRealmsExample1.yaml @@ -1 +1,24 @@ method_request: POST /_security/realm/default_file/_clear_cache +alternatives: + - language: Python + code: |- + resp = client.security.clear_cached_realms( + realms="default_file", + ) + - language: JavaScript + code: |- + const response = await client.security.clearCachedRealms({ + realms: "default_file", + }); + - language: Ruby + code: |- + response = client.security.clear_cached_realms( + realms: "default_file" + ) + - language: PHP + code: |- + $resp = $client->security()->clearCachedRealms([ + "realms" => "default_file", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_security/realm/default_file/_clear_cache"' diff --git a/specification/security/clear_cached_roles/examples/request/SecurityClearCachedRolesExample1.yaml b/specification/security/clear_cached_roles/examples/request/SecurityClearCachedRolesExample1.yaml index d98c3ab756..4a4ee13875 100644 --- a/specification/security/clear_cached_roles/examples/request/SecurityClearCachedRolesExample1.yaml +++ b/specification/security/clear_cached_roles/examples/request/SecurityClearCachedRolesExample1.yaml @@ -1 +1,24 @@ method_request: POST /_security/role/my_admin_role/_clear_cache +alternatives: + - language: Python + code: |- + resp = client.security.clear_cached_roles( + name="my_admin_role", + ) + - language: JavaScript + code: |- + const response = await client.security.clearCachedRoles({ + name: "my_admin_role", + }); + - language: Ruby + code: |- + response = client.security.clear_cached_roles( + name: "my_admin_role" + ) + - language: PHP + code: |- + $resp = $client->security()->clearCachedRoles([ + "name" => "my_admin_role", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_security/role/my_admin_role/_clear_cache"' diff --git a/specification/security/clear_cached_service_tokens/examples/request/SecurityClearCachedServiceTokensExample1.yaml b/specification/security/clear_cached_service_tokens/examples/request/SecurityClearCachedServiceTokensExample1.yaml index 717478f44a..3dcebe8163 100644 --- a/specification/security/clear_cached_service_tokens/examples/request/SecurityClearCachedServiceTokensExample1.yaml +++ b/specification/security/clear_cached_service_tokens/examples/request/SecurityClearCachedServiceTokensExample1.yaml @@ -1 +1,33 @@ method_request: POST /_security/service/elastic/fleet-server/credential/token/token1/_clear_cache +alternatives: + - language: Python + code: |- + resp = client.security.clear_cached_service_tokens( + namespace="elastic", + service="fleet-server", + name="token1", + ) + - language: JavaScript + code: |- + const response = await client.security.clearCachedServiceTokens({ + namespace: "elastic", + service: "fleet-server", + name: "token1", + }); + - language: Ruby + code: |- + response = client.security.clear_cached_service_tokens( + namespace: "elastic", + service: "fleet-server", + name: "token1" + ) + - language: PHP + code: |- + $resp = $client->security()->clearCachedServiceTokens([ + "namespace" => "elastic", + "service" => "fleet-server", + "name" => "token1", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_security/service/elastic/fleet-server/credential/token/token1/_clear_cache"' diff --git a/specification/security/create_api_key/examples/request/SecurityCreateApiKeyRequestExample1.yaml b/specification/security/create_api_key/examples/request/SecurityCreateApiKeyRequestExample1.yaml index 0ba7574bf1..3c2fae4ea6 100644 --- a/specification/security/create_api_key/examples/request/SecurityCreateApiKeyRequestExample1.yaml +++ b/specification/security/create_api_key/examples/request/SecurityCreateApiKeyRequestExample1.yaml @@ -1,9 +1,8 @@ # summary: method_request: POST /_security/api_key description: > - Run `POST /_security/api_key` to create an API key. - If `expiration` is not provided, the API keys do not expire. - If `role_descriptors` is not provided, the permissions of the authenticated user are applied. + Run `POST /_security/api_key` to create an API key. If `expiration` is not provided, the API keys do not expire. If + `role_descriptors` is not provided, the permissions of the authenticated user are applied. # type: request value: |- { @@ -38,3 +37,196 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.security.create_api_key( + name="my-api-key", + expiration="1d", + role_descriptors={ + "role-a": { + "cluster": [ + "all" + ], + "indices": [ + { + "names": [ + "index-a*" + ], + "privileges": [ + "read" + ] + } + ] + }, + "role-b": { + "cluster": [ + "all" + ], + "indices": [ + { + "names": [ + "index-b*" + ], + "privileges": [ + "all" + ] + } + ] + } + }, + metadata={ + "application": "my-application", + "environment": { + "level": 1, + "trusted": True, + "tags": [ + "dev", + "staging" + ] + } + }, + ) + - language: JavaScript + code: |- + const response = await client.security.createApiKey({ + name: "my-api-key", + expiration: "1d", + role_descriptors: { + "role-a": { + cluster: ["all"], + indices: [ + { + names: ["index-a*"], + privileges: ["read"], + }, + ], + }, + "role-b": { + cluster: ["all"], + indices: [ + { + names: ["index-b*"], + privileges: ["all"], + }, + ], + }, + }, + metadata: { + application: "my-application", + environment: { + level: 1, + trusted: true, + tags: ["dev", "staging"], + }, + }, + }); + - language: Ruby + code: |- + response = client.security.create_api_key( + body: { + "name": "my-api-key", + "expiration": "1d", + "role_descriptors": { + "role-a": { + "cluster": [ + "all" + ], + "indices": [ + { + "names": [ + "index-a*" + ], + "privileges": [ + "read" + ] + } + ] + }, + "role-b": { + "cluster": [ + "all" + ], + "indices": [ + { + "names": [ + "index-b*" + ], + "privileges": [ + "all" + ] + } + ] + } + }, + "metadata": { + "application": "my-application", + "environment": { + "level": 1, + "trusted": true, + "tags": [ + "dev", + "staging" + ] + } + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->createApiKey([ + "body" => [ + "name" => "my-api-key", + "expiration" => "1d", + "role_descriptors" => [ + "role-a" => [ + "cluster" => array( + "all", + ), + "indices" => array( + [ + "names" => array( + "index-a*", + ), + "privileges" => array( + "read", + ), + ], + ), + ], + "role-b" => [ + "cluster" => array( + "all", + ), + "indices" => array( + [ + "names" => array( + "index-b*", + ), + "privileges" => array( + "all", + ), + ], + ), + ], + ], + "metadata" => [ + "application" => "my-application", + "environment" => [ + "level" => 1, + "trusted" => true, + "tags" => array( + "dev", + "staging", + ), + ], + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"name\":\"my-api-key\",\"expiration\":\"1d\",\"role_descriptors\":{\"role-a\":{\"cluster\":[\"all\"],\"indices\":[{\"names\ + \":[\"index-a*\"],\"privileges\":[\"read\"]}]},\"role-b\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index-b*\"],\"pri\ + vileges\":[\"all\"]}]}},\"metadata\":{\"application\":\"my-application\",\"environment\":{\"level\":1,\"trusted\":true,\"tags\ + \":[\"dev\",\"staging\"]}}}' \"$ELASTICSEARCH_URL/_security/api_key\"" diff --git a/specification/security/create_cross_cluster_api_key/examples/request/CreateCrossClusterApiKeyRequestExample1.yaml b/specification/security/create_cross_cluster_api_key/examples/request/CreateCrossClusterApiKeyRequestExample1.yaml index 49ca31a042..399b3e5c3c 100644 --- a/specification/security/create_cross_cluster_api_key/examples/request/CreateCrossClusterApiKeyRequestExample1.yaml +++ b/specification/security/create_cross_cluster_api_key/examples/request/CreateCrossClusterApiKeyRequestExample1.yaml @@ -28,3 +28,140 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.security.create_cross_cluster_api_key( + name="my-cross-cluster-api-key", + expiration="1d", + access={ + "search": [ + { + "names": [ + "logs*" + ] + } + ], + "replication": [ + { + "names": [ + "archive*" + ] + } + ] + }, + metadata={ + "description": "phase one", + "environment": { + "level": 1, + "trusted": True, + "tags": [ + "dev", + "staging" + ] + } + }, + ) + - language: JavaScript + code: |- + const response = await client.security.createCrossClusterApiKey({ + name: "my-cross-cluster-api-key", + expiration: "1d", + access: { + search: [ + { + names: ["logs*"], + }, + ], + replication: [ + { + names: ["archive*"], + }, + ], + }, + metadata: { + description: "phase one", + environment: { + level: 1, + trusted: true, + tags: ["dev", "staging"], + }, + }, + }); + - language: Ruby + code: |- + response = client.security.create_cross_cluster_api_key( + body: { + "name": "my-cross-cluster-api-key", + "expiration": "1d", + "access": { + "search": [ + { + "names": [ + "logs*" + ] + } + ], + "replication": [ + { + "names": [ + "archive*" + ] + } + ] + }, + "metadata": { + "description": "phase one", + "environment": { + "level": 1, + "trusted": true, + "tags": [ + "dev", + "staging" + ] + } + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->createCrossClusterApiKey([ + "body" => [ + "name" => "my-cross-cluster-api-key", + "expiration" => "1d", + "access" => [ + "search" => array( + [ + "names" => array( + "logs*", + ), + ], + ), + "replication" => array( + [ + "names" => array( + "archive*", + ), + ], + ), + ], + "metadata" => [ + "description" => "phase one", + "environment" => [ + "level" => 1, + "trusted" => true, + "tags" => array( + "dev", + "staging", + ), + ], + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"name\":\"my-cross-cluster-api-key\",\"expiration\":\"1d\",\"access\":{\"search\":[{\"names\":[\"logs*\"]}],\"replication\ + \":[{\"names\":[\"archive*\"]}]},\"metadata\":{\"description\":\"phase + one\",\"environment\":{\"level\":1,\"trusted\":true,\"tags\":[\"dev\",\"staging\"]}}}' + \"$ELASTICSEARCH_URL/_security/cross_cluster/api_key\"" diff --git a/specification/security/create_service_token/examples/request/CreateServiceTokenRequestExample1.yaml b/specification/security/create_service_token/examples/request/CreateServiceTokenRequestExample1.yaml index a7e9b60c85..1e139229ab 100644 --- a/specification/security/create_service_token/examples/request/CreateServiceTokenRequestExample1.yaml +++ b/specification/security/create_service_token/examples/request/CreateServiceTokenRequestExample1.yaml @@ -1 +1,33 @@ method_request: POST /_security/service/elastic/fleet-server/credential/token/token1 +alternatives: + - language: Python + code: |- + resp = client.security.create_service_token( + namespace="elastic", + service="fleet-server", + name="token1", + ) + - language: JavaScript + code: |- + const response = await client.security.createServiceToken({ + namespace: "elastic", + service: "fleet-server", + name: "token1", + }); + - language: Ruby + code: |- + response = client.security.create_service_token( + namespace: "elastic", + service: "fleet-server", + name: "token1" + ) + - language: PHP + code: |- + $resp = $client->security()->createServiceToken([ + "namespace" => "elastic", + "service" => "fleet-server", + "name" => "token1", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_security/service/elastic/fleet-server/credential/token/token1"' diff --git a/specification/security/delegate_pki/examples/request/SecurityDelegatePkiRequestExample1.yaml b/specification/security/delegate_pki/examples/request/SecurityDelegatePkiRequestExample1.yaml index f1f70c7a91..b9d64ec944 100644 --- a/specification/security/delegate_pki/examples/request/SecurityDelegatePkiRequestExample1.yaml +++ b/specification/security/delegate_pki/examples/request/SecurityDelegatePkiRequestExample1.yaml @@ -1,5 +1,93 @@ # summary: +method_request: POST /_security/delegate_pki description: Delegate a one element certificate chain. # type": "response", # response_code": 200, -value: "{\n\"x509_certificate_chain\": [\"MIIDeDCCAmCgAwIBAgIUBzj/nGGKxP2iXawsSquHmQjCJmMwDQYJKoZIhvcNAQELBQAwUzErMCkGA1UEAxMiRWxhc3RpY3NlYXJjaCBUZXN0IEludGVybWVkaWF0ZSBDQTEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMB4XDTIzMDcxODE5MjkwNloXDTQzMDcxMzE5MjkwNlowSjEiMCAGA1UEAxMZRWxhc3RpY3NlYXJjaCBUZXN0IENsaWVudDEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAllHL4pQkkfwAm/oLkxYYO+r950DEy1bjH+4viCHzNADLCTWO+lOZJVlNx7QEzJE3QGMdif9CCBBxQFMapA7oUFCLq84fPSQQu5AnvvbltVD9nwVtCs+9ZGDjMKsz98RhSLMFIkxdxi6HkQ3Lfa4ZSI4lvba4oo+T/GveazBDS+NgmKyq00EOXt3tWi1G9vEVItommzXWfv0agJWzVnLMldwkPqsw0W7zrpyT7FZS4iLbQADGceOW8fiauOGMkscu9zAnDR/SbWl/chYioQOdw6ndFLn1YIFPd37xL0WsdsldTpn0vH3YfzgLMffT/3P6YlwBegWzsx6FnM/93Ecb4wIDAQABo00wSzAJBgNVHRMEAjAAMB0GA1UdDgQWBBQKNRwjW+Ad/FN1Rpoqme/5+jrFWzAfBgNVHSMEGDAWgBRcya0c0x/PaI7MbmJVIylWgLqXNjANBgkqhkiG9w0BAQsFAAOCAQEACZ3PF7Uqu47lplXHP6YlzYL2jL0D28hpj5lGtdha4Muw1m/BjDb0Pu8l0NQ1z3AP6AVcvjNDkQq6Y5jeSz0bwQlealQpYfo7EMXjOidrft1GbqOMFmTBLpLA9SvwYGobSTXWTkJzonqVaTcf80HpMgM2uEhodwTcvz6v1WEfeT/HMjmdIsq4ImrOL9RNrcZG6nWfw0HR3JNOgrbfyEztEI471jHznZ336OEcyX7gQuvHE8tOv5+oD1d7s3Xg1yuFp+Ynh+FfOi3hPCuaHA+7F6fLmzMDLVUBAllugst1C3U+L/paD7tqIa4ka+KNPCbSfwazmJrt4XNiivPR4hwH5g==\"]\n}" +value: "{ + + \"x509_certificate_chain\": + [\"MIIDeDCCAmCgAwIBAgIUBzj/nGGKxP2iXawsSquHmQjCJmMwDQYJKoZIhvcNAQELBQAwUzErMCkGA1UEAxMiRWxhc3RpY3NlYXJjaCBUZXN0IEludGVybWVkaWF0ZS\ + BDQTEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMB4XDTIzMDcxODE5MjkwNloXDTQzMDcxMzE5MjkwNlowSjEiMCAGA1UEAxMZRWxhc3RpY3NlYXJ\ + jaCBUZXN0IENsaWVudDEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAllHL4pQkkfwAm/oL\ + kxYYO+r950DEy1bjH+4viCHzNADLCTWO+lOZJVlNx7QEzJE3QGMdif9CCBBxQFMapA7oUFCLq84fPSQQu5AnvvbltVD9nwVtCs+9ZGDjMKsz98RhSLMFIkxdxi6HkQ3Lf\ + a4ZSI4lvba4oo+T/GveazBDS+NgmKyq00EOXt3tWi1G9vEVItommzXWfv0agJWzVnLMldwkPqsw0W7zrpyT7FZS4iLbQADGceOW8fiauOGMkscu9zAnDR/SbWl/chYioQ\ + Odw6ndFLn1YIFPd37xL0WsdsldTpn0vH3YfzgLMffT/3P6YlwBegWzsx6FnM/93Ecb4wIDAQABo00wSzAJBgNVHRMEAjAAMB0GA1UdDgQWBBQKNRwjW+Ad/FN1Rpoqme/\ + 5+jrFWzAfBgNVHSMEGDAWgBRcya0c0x/PaI7MbmJVIylWgLqXNjANBgkqhkiG9w0BAQsFAAOCAQEACZ3PF7Uqu47lplXHP6YlzYL2jL0D28hpj5lGtdha4Muw1m/BjDb0\ + Pu8l0NQ1z3AP6AVcvjNDkQq6Y5jeSz0bwQlealQpYfo7EMXjOidrft1GbqOMFmTBLpLA9SvwYGobSTXWTkJzonqVaTcf80HpMgM2uEhodwTcvz6v1WEfeT/HMjmdIsq4I\ + mrOL9RNrcZG6nWfw0HR3JNOgrbfyEztEI471jHznZ336OEcyX7gQuvHE8tOv5+oD1d7s3Xg1yuFp+Ynh+FfOi3hPCuaHA+7F6fLmzMDLVUBAllugst1C3U+L/paD7tqIa\ + 4ka+KNPCbSfwazmJrt4XNiivPR4hwH5g==\"] + + }" +alternatives: + - language: Python + code: >- + resp = client.perform_request( + "POST", + "/_security/delegate_pki", + headers={"Content-Type": "application/json"}, + body={ + "x509_certificate_chain": [ + "MIIDeDCCAmCgAwIBAgIUBzj/nGGKxP2iXawsSquHmQjCJmMwDQYJKoZIhvcNAQELBQAwUzErMCkGA1UEAxMiRWxhc3RpY3NlYXJjaCBUZXN0IEludGVybWVkaWF0ZSBDQTEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMB4XDTIzMDcxODE5MjkwNloXDTQzMDcxMzE5MjkwNlowSjEiMCAGA1UEAxMZRWxhc3RpY3NlYXJjaCBUZXN0IENsaWVudDEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAllHL4pQkkfwAm/oLkxYYO+r950DEy1bjH+4viCHzNADLCTWO+lOZJVlNx7QEzJE3QGMdif9CCBBxQFMapA7oUFCLq84fPSQQu5AnvvbltVD9nwVtCs+9ZGDjMKsz98RhSLMFIkxdxi6HkQ3Lfa4ZSI4lvba4oo+T/GveazBDS+NgmKyq00EOXt3tWi1G9vEVItommzXWfv0agJWzVnLMldwkPqsw0W7zrpyT7FZS4iLbQADGceOW8fiauOGMkscu9zAnDR/SbWl/chYioQOdw6ndFLn1YIFPd37xL0WsdsldTpn0vH3YfzgLMffT/3P6YlwBegWzsx6FnM/93Ecb4wIDAQABo00wSzAJBgNVHRMEAjAAMB0GA1UdDgQWBBQKNRwjW+Ad/FN1Rpoqme/5+jrFWzAfBgNVHSMEGDAWgBRcya0c0x/PaI7MbmJVIylWgLqXNjANBgkqhkiG9w0BAQsFAAOCAQEACZ3PF7Uqu47lplXHP6YlzYL2jL0D28hpj5lGtdha4Muw1m/BjDb0Pu8l0NQ1z3AP6AVcvjNDkQq6Y5jeSz0bwQlealQpYfo7EMXjOidrft1GbqOMFmTBLpLA9SvwYGobSTXWTkJzonqVaTcf80HpMgM2uEhodwTcvz6v1WEfeT/HMjmdIsq4ImrOL9RNrcZG6nWfw0HR3JNOgrbfyEztEI471jHznZ336OEcyX7gQuvHE8tOv5+oD1d7s3Xg1yuFp+Ynh+FfOi3hPCuaHA+7F6fLmzMDLVUBAllugst1C3U+L/paD7tqIa4ka+KNPCbSfwazmJrt4XNiivPR4hwH5g==" + ] + }, + ) + - language: JavaScript + code: >- + const response = await client.transport.request({ + method: "POST", + path: "/_security/delegate_pki", + body: { + x509_certificate_chain: [ + "MIIDeDCCAmCgAwIBAgIUBzj/nGGKxP2iXawsSquHmQjCJmMwDQYJKoZIhvcNAQELBQAwUzErMCkGA1UEAxMiRWxhc3RpY3NlYXJjaCBUZXN0IEludGVybWVkaWF0ZSBDQTEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMB4XDTIzMDcxODE5MjkwNloXDTQzMDcxMzE5MjkwNlowSjEiMCAGA1UEAxMZRWxhc3RpY3NlYXJjaCBUZXN0IENsaWVudDEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAllHL4pQkkfwAm/oLkxYYO+r950DEy1bjH+4viCHzNADLCTWO+lOZJVlNx7QEzJE3QGMdif9CCBBxQFMapA7oUFCLq84fPSQQu5AnvvbltVD9nwVtCs+9ZGDjMKsz98RhSLMFIkxdxi6HkQ3Lfa4ZSI4lvba4oo+T/GveazBDS+NgmKyq00EOXt3tWi1G9vEVItommzXWfv0agJWzVnLMldwkPqsw0W7zrpyT7FZS4iLbQADGceOW8fiauOGMkscu9zAnDR/SbWl/chYioQOdw6ndFLn1YIFPd37xL0WsdsldTpn0vH3YfzgLMffT/3P6YlwBegWzsx6FnM/93Ecb4wIDAQABo00wSzAJBgNVHRMEAjAAMB0GA1UdDgQWBBQKNRwjW+Ad/FN1Rpoqme/5+jrFWzAfBgNVHSMEGDAWgBRcya0c0x/PaI7MbmJVIylWgLqXNjANBgkqhkiG9w0BAQsFAAOCAQEACZ3PF7Uqu47lplXHP6YlzYL2jL0D28hpj5lGtdha4Muw1m/BjDb0Pu8l0NQ1z3AP6AVcvjNDkQq6Y5jeSz0bwQlealQpYfo7EMXjOidrft1GbqOMFmTBLpLA9SvwYGobSTXWTkJzonqVaTcf80HpMgM2uEhodwTcvz6v1WEfeT/HMjmdIsq4ImrOL9RNrcZG6nWfw0HR3JNOgrbfyEztEI471jHznZ336OEcyX7gQuvHE8tOv5+oD1d7s3Xg1yuFp+Ynh+FfOi3hPCuaHA+7F6fLmzMDLVUBAllugst1C3U+L/paD7tqIa4ka+KNPCbSfwazmJrt4XNiivPR4hwH5g==", + ], + }, + }); + - language: Ruby + code: >- + response = client.perform_request( + "POST", + "/_security/delegate_pki", + {}, + { + "x509_certificate_chain": [ + "MIIDeDCCAmCgAwIBAgIUBzj/nGGKxP2iXawsSquHmQjCJmMwDQYJKoZIhvcNAQELBQAwUzErMCkGA1UEAxMiRWxhc3RpY3NlYXJjaCBUZXN0IEludGVybWVkaWF0ZSBDQTEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMB4XDTIzMDcxODE5MjkwNloXDTQzMDcxMzE5MjkwNlowSjEiMCAGA1UEAxMZRWxhc3RpY3NlYXJjaCBUZXN0IENsaWVudDEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAllHL4pQkkfwAm/oLkxYYO+r950DEy1bjH+4viCHzNADLCTWO+lOZJVlNx7QEzJE3QGMdif9CCBBxQFMapA7oUFCLq84fPSQQu5AnvvbltVD9nwVtCs+9ZGDjMKsz98RhSLMFIkxdxi6HkQ3Lfa4ZSI4lvba4oo+T/GveazBDS+NgmKyq00EOXt3tWi1G9vEVItommzXWfv0agJWzVnLMldwkPqsw0W7zrpyT7FZS4iLbQADGceOW8fiauOGMkscu9zAnDR/SbWl/chYioQOdw6ndFLn1YIFPd37xL0WsdsldTpn0vH3YfzgLMffT/3P6YlwBegWzsx6FnM/93Ecb4wIDAQABo00wSzAJBgNVHRMEAjAAMB0GA1UdDgQWBBQKNRwjW+Ad/FN1Rpoqme/5+jrFWzAfBgNVHSMEGDAWgBRcya0c0x/PaI7MbmJVIylWgLqXNjANBgkqhkiG9w0BAQsFAAOCAQEACZ3PF7Uqu47lplXHP6YlzYL2jL0D28hpj5lGtdha4Muw1m/BjDb0Pu8l0NQ1z3AP6AVcvjNDkQq6Y5jeSz0bwQlealQpYfo7EMXjOidrft1GbqOMFmTBLpLA9SvwYGobSTXWTkJzonqVaTcf80HpMgM2uEhodwTcvz6v1WEfeT/HMjmdIsq4ImrOL9RNrcZG6nWfw0HR3JNOgrbfyEztEI471jHznZ336OEcyX7gQuvHE8tOv5+oD1d7s3Xg1yuFp+Ynh+FfOi3hPCuaHA+7F6fLmzMDLVUBAllugst1C3U+L/paD7tqIa4ka+KNPCbSfwazmJrt4XNiivPR4hwH5g==" + ] + }, + { "Content-Type": "application/json" }, + ) + - language: PHP + code: >- + $requestFactory = Psr17FactoryDiscovery::findRequestFactory(); + + $streamFactory = Psr17FactoryDiscovery::findStreamFactory(); + + $request = $requestFactory->createRequest( + "POST", + "/_security/delegate_pki", + ); + + $request = $request->withHeader("Content-Type", "application/json"); + + $request = $request->withBody($streamFactory->createStream( + json_encode([ + "x509_certificate_chain" => array( + "MIIDeDCCAmCgAwIBAgIUBzj/nGGKxP2iXawsSquHmQjCJmMwDQYJKoZIhvcNAQELBQAwUzErMCkGA1UEAxMiRWxhc3RpY3NlYXJjaCBUZXN0IEludGVybWVkaWF0ZSBDQTEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMB4XDTIzMDcxODE5MjkwNloXDTQzMDcxMzE5MjkwNlowSjEiMCAGA1UEAxMZRWxhc3RpY3NlYXJjaCBUZXN0IENsaWVudDEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAllHL4pQkkfwAm/oLkxYYO+r950DEy1bjH+4viCHzNADLCTWO+lOZJVlNx7QEzJE3QGMdif9CCBBxQFMapA7oUFCLq84fPSQQu5AnvvbltVD9nwVtCs+9ZGDjMKsz98RhSLMFIkxdxi6HkQ3Lfa4ZSI4lvba4oo+T/GveazBDS+NgmKyq00EOXt3tWi1G9vEVItommzXWfv0agJWzVnLMldwkPqsw0W7zrpyT7FZS4iLbQADGceOW8fiauOGMkscu9zAnDR/SbWl/chYioQOdw6ndFLn1YIFPd37xL0WsdsldTpn0vH3YfzgLMffT/3P6YlwBegWzsx6FnM/93Ecb4wIDAQABo00wSzAJBgNVHRMEAjAAMB0GA1UdDgQWBBQKNRwjW+Ad/FN1Rpoqme/5+jrFWzAfBgNVHSMEGDAWgBRcya0c0x/PaI7MbmJVIylWgLqXNjANBgkqhkiG9w0BAQsFAAOCAQEACZ3PF7Uqu47lplXHP6YlzYL2jL0D28hpj5lGtdha4Muw1m/BjDb0Pu8l0NQ1z3AP6AVcvjNDkQq6Y5jeSz0bwQlealQpYfo7EMXjOidrft1GbqOMFmTBLpLA9SvwYGobSTXWTkJzonqVaTcf80HpMgM2uEhodwTcvz6v1WEfeT/HMjmdIsq4ImrOL9RNrcZG6nWfw0HR3JNOgrbfyEztEI471jHznZ336OEcyX7gQuvHE8tOv5+oD1d7s3Xg1yuFp+Ynh+FfOi3hPCuaHA+7F6fLmzMDLVUBAllugst1C3U+L/paD7tqIa4ka+KNPCbSfwazmJrt4XNiivPR4hwH5g==", + ), + ]), + )); + + $resp = $client->sendRequest($request); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"x509_certificate_chain\":[\"MIIDeDCCAmCgAwIBAgIUBzj/nGGKxP2iXawsSquHmQjCJmMwDQYJKoZIhvcNAQELBQAwUzErMCkGA1UEAxMiRWxhc3RpY\ + 3NlYXJjaCBUZXN0IEludGVybWVkaWF0ZSBDQTEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMB4XDTIzMDcxODE5MjkwNloXDTQzMDcxMzE5Mj\ + kwNlowSjEiMCAGA1UEAxMZRWxhc3RpY3NlYXJjaCBUZXN0IENsaWVudDEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMIIBIjANBgkqhkiG9w0\ + BAQEFAAOCAQ8AMIIBCgKCAQEAllHL4pQkkfwAm/oLkxYYO+r950DEy1bjH+4viCHzNADLCTWO+lOZJVlNx7QEzJE3QGMdif9CCBBxQFMapA7oUFCLq84fPSQQu5An\ + vvbltVD9nwVtCs+9ZGDjMKsz98RhSLMFIkxdxi6HkQ3Lfa4ZSI4lvba4oo+T/GveazBDS+NgmKyq00EOXt3tWi1G9vEVItommzXWfv0agJWzVnLMldwkPqsw0W7zr\ + pyT7FZS4iLbQADGceOW8fiauOGMkscu9zAnDR/SbWl/chYioQOdw6ndFLn1YIFPd37xL0WsdsldTpn0vH3YfzgLMffT/3P6YlwBegWzsx6FnM/93Ecb4wIDAQABo0\ + 0wSzAJBgNVHRMEAjAAMB0GA1UdDgQWBBQKNRwjW+Ad/FN1Rpoqme/5+jrFWzAfBgNVHSMEGDAWgBRcya0c0x/PaI7MbmJVIylWgLqXNjANBgkqhkiG9w0BAQsFAAO\ + CAQEACZ3PF7Uqu47lplXHP6YlzYL2jL0D28hpj5lGtdha4Muw1m/BjDb0Pu8l0NQ1z3AP6AVcvjNDkQq6Y5jeSz0bwQlealQpYfo7EMXjOidrft1GbqOMFmTBLpLA\ + 9SvwYGobSTXWTkJzonqVaTcf80HpMgM2uEhodwTcvz6v1WEfeT/HMjmdIsq4ImrOL9RNrcZG6nWfw0HR3JNOgrbfyEztEI471jHznZ336OEcyX7gQuvHE8tOv5+oD\ + 1d7s3Xg1yuFp+Ynh+FfOi3hPCuaHA+7F6fLmzMDLVUBAllugst1C3U+L/paD7tqIa4ka+KNPCbSfwazmJrt4XNiivPR4hwH5g==\"]}' + \"$ELASTICSEARCH_URL/_security/delegate_pki\"" diff --git a/specification/security/delete_privileges/examples/request/SecurityDeletePrivilegesRequestExample1.yaml b/specification/security/delete_privileges/examples/request/SecurityDeletePrivilegesRequestExample1.yaml index 82493c1cf2..6b13b27f25 100644 --- a/specification/security/delete_privileges/examples/request/SecurityDeletePrivilegesRequestExample1.yaml +++ b/specification/security/delete_privileges/examples/request/SecurityDeletePrivilegesRequestExample1.yaml @@ -1 +1,28 @@ method_request: DELETE /_security/privilege/myapp/read +alternatives: + - language: Python + code: |- + resp = client.security.delete_privileges( + application="myapp", + name="read", + ) + - language: JavaScript + code: |- + const response = await client.security.deletePrivileges({ + application: "myapp", + name: "read", + }); + - language: Ruby + code: |- + response = client.security.delete_privileges( + application: "myapp", + name: "read" + ) + - language: PHP + code: |- + $resp = $client->security()->deletePrivileges([ + "application" => "myapp", + "name" => "read", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_security/privilege/myapp/read"' diff --git a/specification/security/delete_role/examples/request/SecurityDeleteRoleRequestExample1.yaml b/specification/security/delete_role/examples/request/SecurityDeleteRoleRequestExample1.yaml index 2d33c5033a..f094778572 100644 --- a/specification/security/delete_role/examples/request/SecurityDeleteRoleRequestExample1.yaml +++ b/specification/security/delete_role/examples/request/SecurityDeleteRoleRequestExample1.yaml @@ -1 +1,24 @@ method_request: DELETE /_security/role/my_admin_role +alternatives: + - language: Python + code: |- + resp = client.security.delete_role( + name="my_admin_role", + ) + - language: JavaScript + code: |- + const response = await client.security.deleteRole({ + name: "my_admin_role", + }); + - language: Ruby + code: |- + response = client.security.delete_role( + name: "my_admin_role" + ) + - language: PHP + code: |- + $resp = $client->security()->deleteRole([ + "name" => "my_admin_role", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_security/role/my_admin_role"' diff --git a/specification/security/delete_role_mapping/examples/request/SecurityDeleteRoleMappingRequestExample1.yaml b/specification/security/delete_role_mapping/examples/request/SecurityDeleteRoleMappingRequestExample1.yaml index 0844e2ce99..4db1ae8190 100644 --- a/specification/security/delete_role_mapping/examples/request/SecurityDeleteRoleMappingRequestExample1.yaml +++ b/specification/security/delete_role_mapping/examples/request/SecurityDeleteRoleMappingRequestExample1.yaml @@ -1 +1,24 @@ method_request: DELETE /_security/role_mapping/mapping1 +alternatives: + - language: Python + code: |- + resp = client.security.delete_role_mapping( + name="mapping1", + ) + - language: JavaScript + code: |- + const response = await client.security.deleteRoleMapping({ + name: "mapping1", + }); + - language: Ruby + code: |- + response = client.security.delete_role_mapping( + name: "mapping1" + ) + - language: PHP + code: |- + $resp = $client->security()->deleteRoleMapping([ + "name" => "mapping1", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_security/role_mapping/mapping1"' diff --git a/specification/security/delete_service_token/examples/request/DeleteServiceTokenRequestExample1.yaml b/specification/security/delete_service_token/examples/request/DeleteServiceTokenRequestExample1.yaml index e072e81aa8..12dbd6dd7d 100644 --- a/specification/security/delete_service_token/examples/request/DeleteServiceTokenRequestExample1.yaml +++ b/specification/security/delete_service_token/examples/request/DeleteServiceTokenRequestExample1.yaml @@ -1 +1,33 @@ method_request: DELETE /_security/service/elastic/fleet-server/credential/token/token42 +alternatives: + - language: Python + code: |- + resp = client.security.delete_service_token( + namespace="elastic", + service="fleet-server", + name="token42", + ) + - language: JavaScript + code: |- + const response = await client.security.deleteServiceToken({ + namespace: "elastic", + service: "fleet-server", + name: "token42", + }); + - language: Ruby + code: |- + response = client.security.delete_service_token( + namespace: "elastic", + service: "fleet-server", + name: "token42" + ) + - language: PHP + code: |- + $resp = $client->security()->deleteServiceToken([ + "namespace" => "elastic", + "service" => "fleet-server", + "name" => "token42", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_security/service/elastic/fleet-server/credential/token/token42"' diff --git a/specification/security/delete_user/examples/request/SecurityDeleteUserRequestExample1.yaml b/specification/security/delete_user/examples/request/SecurityDeleteUserRequestExample1.yaml index 51f768bda3..6afdcb8b92 100644 --- a/specification/security/delete_user/examples/request/SecurityDeleteUserRequestExample1.yaml +++ b/specification/security/delete_user/examples/request/SecurityDeleteUserRequestExample1.yaml @@ -1 +1,24 @@ method_request: DELETE /_security/user/jacknich +alternatives: + - language: Python + code: |- + resp = client.security.delete_user( + username="jacknich", + ) + - language: JavaScript + code: |- + const response = await client.security.deleteUser({ + username: "jacknich", + }); + - language: Ruby + code: |- + response = client.security.delete_user( + username: "jacknich" + ) + - language: PHP + code: |- + $resp = $client->security()->deleteUser([ + "username" => "jacknich", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_security/user/jacknich"' diff --git a/specification/security/disable_user/examples/request/SecurityDisableUserExample1.yaml b/specification/security/disable_user/examples/request/SecurityDisableUserExample1.yaml index 9b277ada09..71989d7463 100644 --- a/specification/security/disable_user/examples/request/SecurityDisableUserExample1.yaml +++ b/specification/security/disable_user/examples/request/SecurityDisableUserExample1.yaml @@ -1 +1,24 @@ method_request: PUT /_security/user/jacknich/_disable +alternatives: + - language: Python + code: |- + resp = client.security.disable_user( + username="jacknich", + ) + - language: JavaScript + code: |- + const response = await client.security.disableUser({ + username: "jacknich", + }); + - language: Ruby + code: |- + response = client.security.disable_user( + username: "jacknich" + ) + - language: PHP + code: |- + $resp = $client->security()->disableUser([ + "username" => "jacknich", + ]); + - language: curl + code: 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_security/user/jacknich/_disable"' diff --git a/specification/security/disable_user_profile/examples/request/SecurityDisableUserProfileExample1.yaml b/specification/security/disable_user_profile/examples/request/SecurityDisableUserProfileExample1.yaml index 5a913badc6..1c36d41e9b 100644 --- a/specification/security/disable_user_profile/examples/request/SecurityDisableUserProfileExample1.yaml +++ b/specification/security/disable_user_profile/examples/request/SecurityDisableUserProfileExample1.yaml @@ -1 +1,25 @@ method_request: POST /_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0/_disable +alternatives: + - language: Python + code: |- + resp = client.security.disable_user_profile( + uid="u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0", + ) + - language: JavaScript + code: |- + const response = await client.security.disableUserProfile({ + uid: "u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0", + }); + - language: Ruby + code: |- + response = client.security.disable_user_profile( + uid: "u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0" + ) + - language: PHP + code: |- + $resp = $client->security()->disableUserProfile([ + "uid" => "u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0/_disable"' diff --git a/specification/security/enable_user/examples/request/SecurityEnableUserExample1.yaml b/specification/security/enable_user/examples/request/SecurityEnableUserExample1.yaml index 4e9a5b5a4b..478cb29b41 100644 --- a/specification/security/enable_user/examples/request/SecurityEnableUserExample1.yaml +++ b/specification/security/enable_user/examples/request/SecurityEnableUserExample1.yaml @@ -1 +1,24 @@ method_request: PUT _security/user/logstash_system/_enable +alternatives: + - language: Python + code: |- + resp = client.security.enable_user( + username="logstash_system", + ) + - language: JavaScript + code: |- + const response = await client.security.enableUser({ + username: "logstash_system", + }); + - language: Ruby + code: |- + response = client.security.enable_user( + username: "logstash_system" + ) + - language: PHP + code: |- + $resp = $client->security()->enableUser([ + "username" => "logstash_system", + ]); + - language: curl + code: 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_security/user/logstash_system/_enable"' diff --git a/specification/security/enable_user_profile/examples/request/SecurityEnableUserProfileExample1.yaml b/specification/security/enable_user_profile/examples/request/SecurityEnableUserProfileExample1.yaml index 0eb63f53b1..eef90207ac 100644 --- a/specification/security/enable_user_profile/examples/request/SecurityEnableUserProfileExample1.yaml +++ b/specification/security/enable_user_profile/examples/request/SecurityEnableUserProfileExample1.yaml @@ -1 +1,25 @@ method_request: POST /_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0/_enable +alternatives: + - language: Python + code: |- + resp = client.security.enable_user_profile( + uid="u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0", + ) + - language: JavaScript + code: |- + const response = await client.security.enableUserProfile({ + uid: "u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0", + }); + - language: Ruby + code: |- + response = client.security.enable_user_profile( + uid: "u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0" + ) + - language: PHP + code: |- + $resp = $client->security()->enableUserProfile([ + "uid" => "u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0/_enable"' diff --git a/specification/security/enroll_kibana/examples/request/EnrollKibanaRequestExample1.yaml b/specification/security/enroll_kibana/examples/request/EnrollKibanaRequestExample1.yaml index f9d13d8221..d94e1f905b 100644 --- a/specification/security/enroll_kibana/examples/request/EnrollKibanaRequestExample1.yaml +++ b/specification/security/enroll_kibana/examples/request/EnrollKibanaRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET /_security/enroll/kibana +alternatives: + - language: Python + code: resp = client.security.enroll_kibana() + - language: JavaScript + code: const response = await client.security.enrollKibana(); + - language: Ruby + code: response = client.security.enroll_kibana + - language: PHP + code: $resp = $client->security()->enrollKibana(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_security/enroll/kibana"' diff --git a/specification/security/get_api_key/examples/request/SecurityGetApiKeyRequestExample2.yaml b/specification/security/get_api_key/examples/request/SecurityGetApiKeyRequestExample2.yaml index d01a5d4562..62f87d3a76 100644 --- a/specification/security/get_api_key/examples/request/SecurityGetApiKeyRequestExample2.yaml +++ b/specification/security/get_api_key/examples/request/SecurityGetApiKeyRequestExample2.yaml @@ -1 +1,29 @@ method_request: GET /_security/api_key?username=myuser&realm_name=native1 +alternatives: + - language: Python + code: |- + resp = client.security.get_api_key( + username="myuser", + realm_name="native1", + ) + - language: JavaScript + code: |- + const response = await client.security.getApiKey({ + username: "myuser", + realm_name: "native1", + }); + - language: Ruby + code: |- + response = client.security.get_api_key( + username: "myuser", + realm_name: "native1" + ) + - language: PHP + code: |- + $resp = $client->security()->getApiKey([ + "username" => "myuser", + "realm_name" => "native1", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_security/api_key?username=myuser&realm_name=native1"' diff --git a/specification/security/get_builtin_privileges/examples/request/SecurityGetBuiltinPrivilegesRequestExample1.yaml b/specification/security/get_builtin_privileges/examples/request/SecurityGetBuiltinPrivilegesRequestExample1.yaml index f2787c15c6..4a101265d1 100644 --- a/specification/security/get_builtin_privileges/examples/request/SecurityGetBuiltinPrivilegesRequestExample1.yaml +++ b/specification/security/get_builtin_privileges/examples/request/SecurityGetBuiltinPrivilegesRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET /_security/privilege/_builtin +alternatives: + - language: Python + code: resp = client.security.get_builtin_privileges() + - language: JavaScript + code: const response = await client.security.getBuiltinPrivileges(); + - language: Ruby + code: response = client.security.get_builtin_privileges + - language: PHP + code: $resp = $client->security()->getBuiltinPrivileges(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_security/privilege/_builtin"' diff --git a/specification/security/get_privileges/examples/request/SecurityGetPrivilegesRequestExample1.yaml b/specification/security/get_privileges/examples/request/SecurityGetPrivilegesRequestExample1.yaml index e88cd1e08d..770de5e5c9 100644 --- a/specification/security/get_privileges/examples/request/SecurityGetPrivilegesRequestExample1.yaml +++ b/specification/security/get_privileges/examples/request/SecurityGetPrivilegesRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET /_security/privilege/myapp/read +alternatives: + - language: Python + code: |- + resp = client.security.get_privileges( + application="myapp", + name="read", + ) + - language: JavaScript + code: |- + const response = await client.security.getPrivileges({ + application: "myapp", + name: "read", + }); + - language: Ruby + code: |- + response = client.security.get_privileges( + application: "myapp", + name: "read" + ) + - language: PHP + code: |- + $resp = $client->security()->getPrivileges([ + "application" => "myapp", + "name" => "read", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_security/privilege/myapp/read"' diff --git a/specification/security/get_role/examples/request/SecurityGetRoleRequestExample1.yaml b/specification/security/get_role/examples/request/SecurityGetRoleRequestExample1.yaml index 49df6d76a6..324a490e48 100644 --- a/specification/security/get_role/examples/request/SecurityGetRoleRequestExample1.yaml +++ b/specification/security/get_role/examples/request/SecurityGetRoleRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET /_security/role/my_admin_role +alternatives: + - language: Python + code: |- + resp = client.security.get_role( + name="my_admin_role", + ) + - language: JavaScript + code: |- + const response = await client.security.getRole({ + name: "my_admin_role", + }); + - language: Ruby + code: |- + response = client.security.get_role( + name: "my_admin_role" + ) + - language: PHP + code: |- + $resp = $client->security()->getRole([ + "name" => "my_admin_role", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_security/role/my_admin_role"' diff --git a/specification/security/get_role_mapping/examples/request/SecurityGetRoleMappingRequestExample1.yaml b/specification/security/get_role_mapping/examples/request/SecurityGetRoleMappingRequestExample1.yaml index 49a6a976b2..ef57900871 100644 --- a/specification/security/get_role_mapping/examples/request/SecurityGetRoleMappingRequestExample1.yaml +++ b/specification/security/get_role_mapping/examples/request/SecurityGetRoleMappingRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET /_security/role_mapping/mapping1 +alternatives: + - language: Python + code: |- + resp = client.security.get_role_mapping( + name="mapping1", + ) + - language: JavaScript + code: |- + const response = await client.security.getRoleMapping({ + name: "mapping1", + }); + - language: Ruby + code: |- + response = client.security.get_role_mapping( + name: "mapping1" + ) + - language: PHP + code: |- + $resp = $client->security()->getRoleMapping([ + "name" => "mapping1", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_security/role_mapping/mapping1"' diff --git a/specification/security/get_service_accounts/examples/request/GetServiceAccountsRequestExample1.yaml b/specification/security/get_service_accounts/examples/request/GetServiceAccountsRequestExample1.yaml index 93531186a5..8587fbb920 100644 --- a/specification/security/get_service_accounts/examples/request/GetServiceAccountsRequestExample1.yaml +++ b/specification/security/get_service_accounts/examples/request/GetServiceAccountsRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET /_security/service/elastic/fleet-server +alternatives: + - language: Python + code: |- + resp = client.security.get_service_accounts( + namespace="elastic", + service="fleet-server", + ) + - language: JavaScript + code: |- + const response = await client.security.getServiceAccounts({ + namespace: "elastic", + service: "fleet-server", + }); + - language: Ruby + code: |- + response = client.security.get_service_accounts( + namespace: "elastic", + service: "fleet-server" + ) + - language: PHP + code: |- + $resp = $client->security()->getServiceAccounts([ + "namespace" => "elastic", + "service" => "fleet-server", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_security/service/elastic/fleet-server"' diff --git a/specification/security/get_service_credentials/examples/request/GetServiceCredentialsRequestExample1.yaml b/specification/security/get_service_credentials/examples/request/GetServiceCredentialsRequestExample1.yaml index 40c009c1a9..ec3cb42938 100644 --- a/specification/security/get_service_credentials/examples/request/GetServiceCredentialsRequestExample1.yaml +++ b/specification/security/get_service_credentials/examples/request/GetServiceCredentialsRequestExample1.yaml @@ -1 +1,29 @@ method_request: GET /_security/service/elastic/fleet-server/credential +alternatives: + - language: Python + code: |- + resp = client.security.get_service_credentials( + namespace="elastic", + service="fleet-server", + ) + - language: JavaScript + code: |- + const response = await client.security.getServiceCredentials({ + namespace: "elastic", + service: "fleet-server", + }); + - language: Ruby + code: |- + response = client.security.get_service_credentials( + namespace: "elastic", + service: "fleet-server" + ) + - language: PHP + code: |- + $resp = $client->security()->getServiceCredentials([ + "namespace" => "elastic", + "service" => "fleet-server", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_security/service/elastic/fleet-server/credential"' diff --git a/specification/security/get_settings/examples/request/SecurityGetSettingsExample1.yaml b/specification/security/get_settings/examples/request/SecurityGetSettingsExample1.yaml index db30177b6a..37e1346388 100644 --- a/specification/security/get_settings/examples/request/SecurityGetSettingsExample1.yaml +++ b/specification/security/get_settings/examples/request/SecurityGetSettingsExample1.yaml @@ -1 +1,12 @@ method_request: GET /_security/settings +alternatives: + - language: Python + code: resp = client.security.get_settings() + - language: JavaScript + code: const response = await client.security.getSettings(); + - language: Ruby + code: response = client.security.get_settings + - language: PHP + code: $resp = $client->security()->getSettings(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_security/settings"' diff --git a/specification/security/get_token/examples/request/GetUserAccessTokenRequestExample1.yaml b/specification/security/get_token/examples/request/GetUserAccessTokenRequestExample1.yaml index b3c19fd082..37105f9ee4 100644 --- a/specification/security/get_token/examples/request/GetUserAccessTokenRequestExample1.yaml +++ b/specification/security/get_token/examples/request/GetUserAccessTokenRequestExample1.yaml @@ -1,9 +1,39 @@ summary: A client_credentials grant type example method_request: POST /_security/oauth2/token description: > - Run `POST /_security/oauth2/token` to obtain a token using the `client_credentials` grant type, which simply creates a token as the authenticated user. + Run `POST /_security/oauth2/token` to obtain a token using the `client_credentials` grant type, which simply creates a token as + the authenticated user. # type: request value: |- { "grant_type" : "client_credentials" } +alternatives: + - language: Python + code: |- + resp = client.security.get_token( + grant_type="client_credentials", + ) + - language: JavaScript + code: |- + const response = await client.security.getToken({ + grant_type: "client_credentials", + }); + - language: Ruby + code: |- + response = client.security.get_token( + body: { + "grant_type": "client_credentials" + } + ) + - language: PHP + code: |- + $resp = $client->security()->getToken([ + "body" => [ + "grant_type" => "client_credentials", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"grant_type":"client_credentials"}'' "$ELASTICSEARCH_URL/_security/oauth2/token"' diff --git a/specification/security/get_token/examples/request/GetUserAccessTokenRequestExample2.yaml b/specification/security/get_token/examples/request/GetUserAccessTokenRequestExample2.yaml index be097cdfa4..a3d59e66f6 100644 --- a/specification/security/get_token/examples/request/GetUserAccessTokenRequestExample2.yaml +++ b/specification/security/get_token/examples/request/GetUserAccessTokenRequestExample2.yaml @@ -1,8 +1,9 @@ summary: A password grant type example method_request: POST /_security/oauth2/token description: > - Run `POST /_security/oauth2/token` to obtain a token for the `test_admin` user using the password grant type. - This request needs to be made by an authenticated user with sufficient privileges that may or may not be the same as the one whose username is passed in the `username` parameter. + Run `POST /_security/oauth2/token` to obtain a token for the `test_admin` user using the password grant type. This request needs + to be made by an authenticated user with sufficient privileges that may or may not be the same as the one whose username is passed + in the `username` parameter. # type: request value: |- { @@ -10,3 +11,41 @@ value: |- "username" : "test_admin", "password" : "x-pack-test-password" } +alternatives: + - language: Python + code: |- + resp = client.security.get_token( + grant_type="password", + username="test_admin", + password="x-pack-test-password", + ) + - language: JavaScript + code: |- + const response = await client.security.getToken({ + grant_type: "password", + username: "test_admin", + password: "x-pack-test-password", + }); + - language: Ruby + code: |- + response = client.security.get_token( + body: { + "grant_type": "password", + "username": "test_admin", + "password": "x-pack-test-password" + } + ) + - language: PHP + code: |- + $resp = $client->security()->getToken([ + "body" => [ + "grant_type" => "password", + "username" => "test_admin", + "password" => "x-pack-test-password", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"grant_type":"password","username":"test_admin","password":"x-pack-test-password"}'' + "$ELASTICSEARCH_URL/_security/oauth2/token"' diff --git a/specification/security/get_user/examples/request/SecurityGetUserRequestExample1.yaml b/specification/security/get_user/examples/request/SecurityGetUserRequestExample1.yaml index 71eb4c9b92..b1e26db578 100644 --- a/specification/security/get_user/examples/request/SecurityGetUserRequestExample1.yaml +++ b/specification/security/get_user/examples/request/SecurityGetUserRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET /_security/user/jacknich?with_profile_uid=true +alternatives: + - language: Python + code: |- + resp = client.security.get_user( + username="jacknich", + with_profile_uid=True, + ) + - language: JavaScript + code: |- + const response = await client.security.getUser({ + username: "jacknich", + with_profile_uid: "true", + }); + - language: Ruby + code: |- + response = client.security.get_user( + username: "jacknich", + with_profile_uid: "true" + ) + - language: PHP + code: |- + $resp = $client->security()->getUser([ + "username" => "jacknich", + "with_profile_uid" => "true", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_security/user/jacknich?with_profile_uid=true"' diff --git a/specification/security/get_user_privileges/examples/request/SecurityGetUserPrivilegesRequestExample1.yaml b/specification/security/get_user_privileges/examples/request/SecurityGetUserPrivilegesRequestExample1.yaml index d5b5273802..5b14cd486f 100644 --- a/specification/security/get_user_privileges/examples/request/SecurityGetUserPrivilegesRequestExample1.yaml +++ b/specification/security/get_user_privileges/examples/request/SecurityGetUserPrivilegesRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET /_security/user/_privileges +alternatives: + - language: Python + code: resp = client.security.get_user_privileges() + - language: JavaScript + code: const response = await client.security.getUserPrivileges(); + - language: Ruby + code: response = client.security.get_user_privileges + - language: PHP + code: $resp = $client->security()->getUserPrivileges(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_security/user/_privileges"' diff --git a/specification/security/get_user_profile/examples/request/GetUserProfileRequestExample1.yaml b/specification/security/get_user_profile/examples/request/GetUserProfileRequestExample1.yaml index 2c54c0f69d..a3442c9495 100644 --- a/specification/security/get_user_profile/examples/request/GetUserProfileRequestExample1.yaml +++ b/specification/security/get_user_profile/examples/request/GetUserProfileRequestExample1.yaml @@ -1 +1,25 @@ method_request: GET /_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0 +alternatives: + - language: Python + code: |- + resp = client.security.get_user_profile( + uid="u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0", + ) + - language: JavaScript + code: |- + const response = await client.security.getUserProfile({ + uid: "u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0", + }); + - language: Ruby + code: |- + response = client.security.get_user_profile( + uid: "u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0" + ) + - language: PHP + code: |- + $resp = $client->security()->getUserProfile([ + "uid" => "u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0"' diff --git a/specification/security/grant_api_key/examples/request/SecurityGrantApiKeyRequestExample1.yaml b/specification/security/grant_api_key/examples/request/SecurityGrantApiKeyRequestExample1.yaml index 098e51e7d9..b7d5818558 100644 --- a/specification/security/grant_api_key/examples/request/SecurityGrantApiKeyRequestExample1.yaml +++ b/specification/security/grant_api_key/examples/request/SecurityGrantApiKeyRequestExample1.yaml @@ -41,3 +41,217 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.security.grant_api_key( + grant_type="password", + username="test_admin", + password="x-pack-test-password", + api_key={ + "name": "my-api-key", + "expiration": "1d", + "role_descriptors": { + "role-a": { + "cluster": [ + "all" + ], + "indices": [ + { + "names": [ + "index-a*" + ], + "privileges": [ + "read" + ] + } + ] + }, + "role-b": { + "cluster": [ + "all" + ], + "indices": [ + { + "names": [ + "index-b*" + ], + "privileges": [ + "all" + ] + } + ] + } + }, + "metadata": { + "application": "my-application", + "environment": { + "level": 1, + "trusted": True, + "tags": [ + "dev", + "staging" + ] + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.security.grantApiKey({ + grant_type: "password", + username: "test_admin", + password: "x-pack-test-password", + api_key: { + name: "my-api-key", + expiration: "1d", + role_descriptors: { + "role-a": { + cluster: ["all"], + indices: [ + { + names: ["index-a*"], + privileges: ["read"], + }, + ], + }, + "role-b": { + cluster: ["all"], + indices: [ + { + names: ["index-b*"], + privileges: ["all"], + }, + ], + }, + }, + metadata: { + application: "my-application", + environment: { + level: 1, + trusted: true, + tags: ["dev", "staging"], + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.security.grant_api_key( + body: { + "grant_type": "password", + "username": "test_admin", + "password": "x-pack-test-password", + "api_key": { + "name": "my-api-key", + "expiration": "1d", + "role_descriptors": { + "role-a": { + "cluster": [ + "all" + ], + "indices": [ + { + "names": [ + "index-a*" + ], + "privileges": [ + "read" + ] + } + ] + }, + "role-b": { + "cluster": [ + "all" + ], + "indices": [ + { + "names": [ + "index-b*" + ], + "privileges": [ + "all" + ] + } + ] + } + }, + "metadata": { + "application": "my-application", + "environment": { + "level": 1, + "trusted": true, + "tags": [ + "dev", + "staging" + ] + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->grantApiKey([ + "body" => [ + "grant_type" => "password", + "username" => "test_admin", + "password" => "x-pack-test-password", + "api_key" => [ + "name" => "my-api-key", + "expiration" => "1d", + "role_descriptors" => [ + "role-a" => [ + "cluster" => array( + "all", + ), + "indices" => array( + [ + "names" => array( + "index-a*", + ), + "privileges" => array( + "read", + ), + ], + ), + ], + "role-b" => [ + "cluster" => array( + "all", + ), + "indices" => array( + [ + "names" => array( + "index-b*", + ), + "privileges" => array( + "all", + ), + ], + ), + ], + ], + "metadata" => [ + "application" => "my-application", + "environment" => [ + "level" => 1, + "trusted" => true, + "tags" => array( + "dev", + "staging", + ), + ], + ], + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"grant_type\":\"password\",\"username\":\"test_admin\",\"password\":\"x-pack-test-password\",\"api_key\":{\"name\":\"my-ap\ + i-key\",\"expiration\":\"1d\",\"role_descriptors\":{\"role-a\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index-a*\"],\ + \"privileges\":[\"read\"]}]},\"role-b\":{\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index-b*\"],\"privileges\":[\"all\"\ + ]}]}},\"metadata\":{\"application\":\"my-application\",\"environment\":{\"level\":1,\"trusted\":true,\"tags\":[\"dev\",\"stag\ + ing\"]}}}}' \"$ELASTICSEARCH_URL/_security/api_key/grant\"" diff --git a/specification/security/grant_api_key/examples/request/SecurityGrantApiKeyRequestExample2.yaml b/specification/security/grant_api_key/examples/request/SecurityGrantApiKeyRequestExample2.yaml index d3a1db2c9d..a7e3ba5abd 100644 --- a/specification/security/grant_api_key/examples/request/SecurityGrantApiKeyRequestExample2.yaml +++ b/specification/security/grant_api_key/examples/request/SecurityGrantApiKeyRequestExample2.yaml @@ -1,9 +1,8 @@ summary: Grant an API key with run_as method_request: POST /_security/api_key/grant description: > - Run `POST /_security/api_key/grant`. - The user (`test_admin`) whose credentials are provided can "run as" another user (`test_user`). - The API key will be granted to the impersonated user (`test_user`). + Run `POST /_security/api_key/grant`. The user (`test_admin`) whose credentials are provided can "run as" another user + (`test_user`). The API key will be granted to the impersonated user (`test_user`). # type: request value: |- { @@ -15,3 +14,57 @@ value: |- "name": "another-api-key" } } +alternatives: + - language: Python + code: |- + resp = client.security.grant_api_key( + grant_type="password", + username="test_admin", + password="x-pack-test-password", + run_as="test_user", + api_key={ + "name": "another-api-key" + }, + ) + - language: JavaScript + code: |- + const response = await client.security.grantApiKey({ + grant_type: "password", + username: "test_admin", + password: "x-pack-test-password", + run_as: "test_user", + api_key: { + name: "another-api-key", + }, + }); + - language: Ruby + code: |- + response = client.security.grant_api_key( + body: { + "grant_type": "password", + "username": "test_admin", + "password": "x-pack-test-password", + "run_as": "test_user", + "api_key": { + "name": "another-api-key" + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->grantApiKey([ + "body" => [ + "grant_type" => "password", + "username" => "test_admin", + "password" => "x-pack-test-password", + "run_as" => "test_user", + "api_key" => [ + "name" => "another-api-key", + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"grant_type\":\"password\",\"username\":\"test_admin\",\"password\":\"x-pack-test-password\",\"run_as\":\"test_user\",\"ap\ + i_key\":{\"name\":\"another-api-key\"}}' \"$ELASTICSEARCH_URL/_security/api_key/grant\"" diff --git a/specification/security/has_privileges/examples/request/SecurityHasPrivilegesRequestExample1.yaml b/specification/security/has_privileges/examples/request/SecurityHasPrivilegesRequestExample1.yaml index 467b269e86..cb6ff1eeaa 100644 --- a/specification/security/has_privileges/examples/request/SecurityHasPrivilegesRequestExample1.yaml +++ b/specification/security/has_privileges/examples/request/SecurityHasPrivilegesRequestExample1.yaml @@ -1,6 +1,8 @@ # summary: method_request: GET /_security/user/_has_privileges -description: Run `GET /_security/user/_has_privileges` to check whether the current user has a specific set of cluster, index, and application privileges. +description: + Run `GET /_security/user/_has_privileges` to check whether the current user has a specific set of cluster, index, and + application privileges. # type: request value: |- { @@ -23,3 +25,157 @@ value: |- } ] } +alternatives: + - language: Python + code: |- + resp = client.security.has_privileges( + cluster=[ + "monitor", + "manage" + ], + index=[ + { + "names": [ + "suppliers", + "products" + ], + "privileges": [ + "read" + ] + }, + { + "names": [ + "inventory" + ], + "privileges": [ + "read", + "write" + ] + } + ], + application=[ + { + "application": "inventory_manager", + "privileges": [ + "read", + "data:write/inventory" + ], + "resources": [ + "product/1852563" + ] + } + ], + ) + - language: JavaScript + code: |- + const response = await client.security.hasPrivileges({ + cluster: ["monitor", "manage"], + index: [ + { + names: ["suppliers", "products"], + privileges: ["read"], + }, + { + names: ["inventory"], + privileges: ["read", "write"], + }, + ], + application: [ + { + application: "inventory_manager", + privileges: ["read", "data:write/inventory"], + resources: ["product/1852563"], + }, + ], + }); + - language: Ruby + code: |- + response = client.security.has_privileges( + body: { + "cluster": [ + "monitor", + "manage" + ], + "index": [ + { + "names": [ + "suppliers", + "products" + ], + "privileges": [ + "read" + ] + }, + { + "names": [ + "inventory" + ], + "privileges": [ + "read", + "write" + ] + } + ], + "application": [ + { + "application": "inventory_manager", + "privileges": [ + "read", + "data:write/inventory" + ], + "resources": [ + "product/1852563" + ] + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->security()->hasPrivileges([ + "body" => [ + "cluster" => array( + "monitor", + "manage", + ), + "index" => array( + [ + "names" => array( + "suppliers", + "products", + ), + "privileges" => array( + "read", + ), + ], + [ + "names" => array( + "inventory", + ), + "privileges" => array( + "read", + "write", + ), + ], + ), + "application" => array( + [ + "application" => "inventory_manager", + "privileges" => array( + "read", + "data:write/inventory", + ), + "resources" => array( + "product/1852563", + ), + ], + ), + ], + ]); + - language: curl + code: + "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"cluster\":[\"monitor\",\"manage\"],\"index\":[{\"names\":[\"suppliers\",\"products\"],\"privileges\":[\"read\"]},{\"names\ + \":[\"inventory\"],\"privileges\":[\"read\",\"write\"]}],\"application\":[{\"application\":\"inventory_manager\",\"privileges\ + \":[\"read\",\"data:write/inventory\"],\"resources\":[\"product/1852563\"]}]}' + \"$ELASTICSEARCH_URL/_security/user/_has_privileges\"" diff --git a/specification/security/has_privileges_user_profile/examples/request/HasPrivilegesUserProfileRequestExample1.yaml b/specification/security/has_privileges_user_profile/examples/request/HasPrivilegesUserProfileRequestExample1.yaml index d1672cc8c4..85f9d53e1a 100644 --- a/specification/security/has_privileges_user_profile/examples/request/HasPrivilegesUserProfileRequestExample1.yaml +++ b/specification/security/has_privileges_user_profile/examples/request/HasPrivilegesUserProfileRequestExample1.yaml @@ -1,7 +1,8 @@ # summary: method_request: POST /_security/profile/_has_privileges description: > - Run `POST /_security/profile/_has_privileges` to check whether the two users associated with the specified profiles have all the requested set of cluster, index, and application privileges. + Run `POST /_security/profile/_has_privileges` to check whether the two users associated with the specified profiles have all the + requested set of cluster, index, and application privileges. # type: request value: |- { @@ -31,3 +32,189 @@ value: |- ] } } +alternatives: + - language: Python + code: |- + resp = client.security.has_privileges_user_profile( + uids=[ + "u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0", + "u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1", + "u_does-not-exist_0" + ], + privileges={ + "cluster": [ + "monitor", + "create_snapshot", + "manage_ml" + ], + "index": [ + { + "names": [ + "suppliers", + "products" + ], + "privileges": [ + "create_doc" + ] + }, + { + "names": [ + "inventory" + ], + "privileges": [ + "read", + "write" + ] + } + ], + "application": [ + { + "application": "inventory_manager", + "privileges": [ + "read", + "data:write/inventory" + ], + "resources": [ + "product/1852563" + ] + } + ] + }, + ) + - language: JavaScript + code: |- + const response = await client.security.hasPrivilegesUserProfile({ + uids: [ + "u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0", + "u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1", + "u_does-not-exist_0", + ], + privileges: { + cluster: ["monitor", "create_snapshot", "manage_ml"], + index: [ + { + names: ["suppliers", "products"], + privileges: ["create_doc"], + }, + { + names: ["inventory"], + privileges: ["read", "write"], + }, + ], + application: [ + { + application: "inventory_manager", + privileges: ["read", "data:write/inventory"], + resources: ["product/1852563"], + }, + ], + }, + }); + - language: Ruby + code: |- + response = client.security.has_privileges_user_profile( + body: { + "uids": [ + "u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0", + "u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1", + "u_does-not-exist_0" + ], + "privileges": { + "cluster": [ + "monitor", + "create_snapshot", + "manage_ml" + ], + "index": [ + { + "names": [ + "suppliers", + "products" + ], + "privileges": [ + "create_doc" + ] + }, + { + "names": [ + "inventory" + ], + "privileges": [ + "read", + "write" + ] + } + ], + "application": [ + { + "application": "inventory_manager", + "privileges": [ + "read", + "data:write/inventory" + ], + "resources": [ + "product/1852563" + ] + } + ] + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->hasPrivilegesUserProfile([ + "body" => [ + "uids" => array( + "u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0", + "u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1", + "u_does-not-exist_0", + ), + "privileges" => [ + "cluster" => array( + "monitor", + "create_snapshot", + "manage_ml", + ), + "index" => array( + [ + "names" => array( + "suppliers", + "products", + ), + "privileges" => array( + "create_doc", + ), + ], + [ + "names" => array( + "inventory", + ), + "privileges" => array( + "read", + "write", + ), + ], + ), + "application" => array( + [ + "application" => "inventory_manager", + "privileges" => array( + "read", + "data:write/inventory", + ), + "resources" => array( + "product/1852563", + ), + ], + ), + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"uids\":[\"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0\",\"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1\",\"u_does-\ + not-exist_0\"],\"privileges\":{\"cluster\":[\"monitor\",\"create_snapshot\",\"manage_ml\"],\"index\":[{\"names\":[\"suppliers\ + \",\"products\"],\"privileges\":[\"create_doc\"]},{\"names\":[\"inventory\"],\"privileges\":[\"read\",\"write\"]}],\"applicat\ + ion\":[{\"application\":\"inventory_manager\",\"privileges\":[\"read\",\"data:write/inventory\"],\"resources\":[\"product/185\ + 2563\"]}]}}' \"$ELASTICSEARCH_URL/_security/profile/_has_privileges\"" diff --git a/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample1.yaml b/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample1.yaml index 8178b35106..f76c3cb92c 100644 --- a/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample1.yaml +++ b/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample1.yaml @@ -6,3 +6,38 @@ value: |- { "ids" : [ "VuaCfGcBCdbkQm-e5aOx" ] } +alternatives: + - language: Python + code: |- + resp = client.security.invalidate_api_key( + ids=[ + "VuaCfGcBCdbkQm-e5aOx" + ], + ) + - language: JavaScript + code: |- + const response = await client.security.invalidateApiKey({ + ids: ["VuaCfGcBCdbkQm-e5aOx"], + }); + - language: Ruby + code: |- + response = client.security.invalidate_api_key( + body: { + "ids": [ + "VuaCfGcBCdbkQm-e5aOx" + ] + } + ) + - language: PHP + code: |- + $resp = $client->security()->invalidateApiKey([ + "body" => [ + "ids" => array( + "VuaCfGcBCdbkQm-e5aOx", + ), + ], + ]); + - language: curl + code: + 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"ids":["VuaCfGcBCdbkQm-e5aOx"]}'' "$ELASTICSEARCH_URL/_security/api_key"' diff --git a/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample2.yaml b/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample2.yaml index 47d23583f6..d2d0282f9a 100644 --- a/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample2.yaml +++ b/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample2.yaml @@ -6,3 +6,32 @@ value: |- { "name" : "my-api-key" } +alternatives: + - language: Python + code: |- + resp = client.security.invalidate_api_key( + name="my-api-key", + ) + - language: JavaScript + code: |- + const response = await client.security.invalidateApiKey({ + name: "my-api-key", + }); + - language: Ruby + code: |- + response = client.security.invalidate_api_key( + body: { + "name": "my-api-key" + } + ) + - language: PHP + code: |- + $resp = $client->security()->invalidateApiKey([ + "body" => [ + "name" => "my-api-key", + ], + ]); + - language: curl + code: + 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"name":"my-api-key"}'' "$ELASTICSEARCH_URL/_security/api_key"' diff --git a/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample3.yaml b/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample3.yaml index ec726f5570..1417d399b9 100644 --- a/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample3.yaml +++ b/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample3.yaml @@ -6,3 +6,32 @@ value: |- { "realm_name" : "native1" } +alternatives: + - language: Python + code: |- + resp = client.security.invalidate_api_key( + realm_name="native1", + ) + - language: JavaScript + code: |- + const response = await client.security.invalidateApiKey({ + realm_name: "native1", + }); + - language: Ruby + code: |- + response = client.security.invalidate_api_key( + body: { + "realm_name": "native1" + } + ) + - language: PHP + code: |- + $resp = $client->security()->invalidateApiKey([ + "body" => [ + "realm_name" => "native1", + ], + ]); + - language: curl + code: + 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"realm_name":"native1"}'' "$ELASTICSEARCH_URL/_security/api_key"' diff --git a/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample4.yaml b/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample4.yaml index fdfcf4f9d4..3cc518865a 100644 --- a/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample4.yaml +++ b/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample4.yaml @@ -6,3 +6,32 @@ value: |- { "username" : "myuser" } +alternatives: + - language: Python + code: |- + resp = client.security.invalidate_api_key( + username="myuser", + ) + - language: JavaScript + code: |- + const response = await client.security.invalidateApiKey({ + username: "myuser", + }); + - language: Ruby + code: |- + response = client.security.invalidate_api_key( + body: { + "username": "myuser" + } + ) + - language: PHP + code: |- + $resp = $client->security()->invalidateApiKey([ + "body" => [ + "username" => "myuser", + ], + ]); + - language: curl + code: + 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"username":"myuser"}'' "$ELASTICSEARCH_URL/_security/api_key"' diff --git a/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample5.yaml b/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample5.yaml index 58b4bc8490..0e81676efc 100644 --- a/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample5.yaml +++ b/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample5.yaml @@ -7,3 +7,42 @@ value: |- "ids" : ["VuaCfGcBCdbkQm-e5aOx"], "owner" : "true" } +alternatives: + - language: Python + code: |- + resp = client.security.invalidate_api_key( + ids=[ + "VuaCfGcBCdbkQm-e5aOx" + ], + owner=True, + ) + - language: JavaScript + code: |- + const response = await client.security.invalidateApiKey({ + ids: ["VuaCfGcBCdbkQm-e5aOx"], + owner: "true", + }); + - language: Ruby + code: |- + response = client.security.invalidate_api_key( + body: { + "ids": [ + "VuaCfGcBCdbkQm-e5aOx" + ], + "owner": "true" + } + ) + - language: PHP + code: |- + $resp = $client->security()->invalidateApiKey([ + "body" => [ + "ids" => array( + "VuaCfGcBCdbkQm-e5aOx", + ), + "owner" => "true", + ], + ]); + - language: curl + code: + 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"ids":["VuaCfGcBCdbkQm-e5aOx"],"owner":"true"}'' "$ELASTICSEARCH_URL/_security/api_key"' diff --git a/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample6.yaml b/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample6.yaml index e14be85655..8f3617d64e 100644 --- a/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample6.yaml +++ b/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample6.yaml @@ -7,3 +7,36 @@ value: |- "username" : "myuser", "realm_name" : "native1" } +alternatives: + - language: Python + code: |- + resp = client.security.invalidate_api_key( + username="myuser", + realm_name="native1", + ) + - language: JavaScript + code: |- + const response = await client.security.invalidateApiKey({ + username: "myuser", + realm_name: "native1", + }); + - language: Ruby + code: |- + response = client.security.invalidate_api_key( + body: { + "username": "myuser", + "realm_name": "native1" + } + ) + - language: PHP + code: |- + $resp = $client->security()->invalidateApiKey([ + "body" => [ + "username" => "myuser", + "realm_name" => "native1", + ], + ]); + - language: curl + code: + 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"username":"myuser","realm_name":"native1"}'' "$ELASTICSEARCH_URL/_security/api_key"' diff --git a/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample1.yaml b/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample1.yaml index afba06ea7f..31e2282815 100644 --- a/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample1.yaml +++ b/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample1.yaml @@ -7,3 +7,34 @@ value: |- { "token" : "dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==" } +alternatives: + - language: Python + code: |- + resp = client.security.invalidate_token( + token="dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==", + ) + - language: JavaScript + code: |- + const response = await client.security.invalidateToken({ + token: + "dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==", + }); + - language: Ruby + code: |- + response = client.security.invalidate_token( + body: { + "token": "dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==" + } + ) + - language: PHP + code: |- + $resp = $client->security()->invalidateToken([ + "body" => [ + "token" => "dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==", + ], + ]); + - language: curl + code: + 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"token":"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ=="}'' + "$ELASTICSEARCH_URL/_security/oauth2/token"' diff --git a/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample2.yaml b/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample2.yaml index e96cc83ecf..29ecda455d 100644 --- a/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample2.yaml +++ b/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample2.yaml @@ -7,3 +7,32 @@ value: |- { "refresh_token" : "vLBPvmAB6KvwvJZr27cS" } +alternatives: + - language: Python + code: |- + resp = client.security.invalidate_token( + refresh_token="vLBPvmAB6KvwvJZr27cS", + ) + - language: JavaScript + code: |- + const response = await client.security.invalidateToken({ + refresh_token: "vLBPvmAB6KvwvJZr27cS", + }); + - language: Ruby + code: |- + response = client.security.invalidate_token( + body: { + "refresh_token": "vLBPvmAB6KvwvJZr27cS" + } + ) + - language: PHP + code: |- + $resp = $client->security()->invalidateToken([ + "body" => [ + "refresh_token" => "vLBPvmAB6KvwvJZr27cS", + ], + ]); + - language: curl + code: + 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"refresh_token":"vLBPvmAB6KvwvJZr27cS"}'' "$ELASTICSEARCH_URL/_security/oauth2/token"' diff --git a/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample3.yaml b/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample3.yaml index 73f9627844..3d6f386897 100644 --- a/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample3.yaml +++ b/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample3.yaml @@ -6,3 +6,32 @@ value: |- { "realm_name" : "saml1" } +alternatives: + - language: Python + code: |- + resp = client.security.invalidate_token( + realm_name="saml1", + ) + - language: JavaScript + code: |- + const response = await client.security.invalidateToken({ + realm_name: "saml1", + }); + - language: Ruby + code: |- + response = client.security.invalidate_token( + body: { + "realm_name": "saml1" + } + ) + - language: PHP + code: |- + $resp = $client->security()->invalidateToken([ + "body" => [ + "realm_name" => "saml1", + ], + ]); + - language: curl + code: + 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"realm_name":"saml1"}'' "$ELASTICSEARCH_URL/_security/oauth2/token"' diff --git a/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample4.yaml b/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample4.yaml index 176f328e65..5c30fbbd27 100644 --- a/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample4.yaml +++ b/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample4.yaml @@ -6,3 +6,32 @@ value: |- { "username" : "myuser" } +alternatives: + - language: Python + code: |- + resp = client.security.invalidate_token( + username="myuser", + ) + - language: JavaScript + code: |- + const response = await client.security.invalidateToken({ + username: "myuser", + }); + - language: Ruby + code: |- + response = client.security.invalidate_token( + body: { + "username": "myuser" + } + ) + - language: PHP + code: |- + $resp = $client->security()->invalidateToken([ + "body" => [ + "username" => "myuser", + ], + ]); + - language: curl + code: + 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"username":"myuser"}'' "$ELASTICSEARCH_URL/_security/oauth2/token"' diff --git a/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample5.yaml b/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample5.yaml index 3941357e67..a23798d23f 100644 --- a/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample5.yaml +++ b/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample5.yaml @@ -7,3 +7,36 @@ value: |- "username" : "myuser", "realm_name" : "saml1" } +alternatives: + - language: Python + code: |- + resp = client.security.invalidate_token( + username="myuser", + realm_name="saml1", + ) + - language: JavaScript + code: |- + const response = await client.security.invalidateToken({ + username: "myuser", + realm_name: "saml1", + }); + - language: Ruby + code: |- + response = client.security.invalidate_token( + body: { + "username": "myuser", + "realm_name": "saml1" + } + ) + - language: PHP + code: |- + $resp = $client->security()->invalidateToken([ + "body" => [ + "username" => "myuser", + "realm_name" => "saml1", + ], + ]); + - language: curl + code: + 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"username":"myuser","realm_name":"saml1"}'' "$ELASTICSEARCH_URL/_security/oauth2/token"' diff --git a/specification/security/oidc_authenticate/examples/request/OidcAuthenticateRequestExample1.yaml b/specification/security/oidc_authenticate/examples/request/OidcAuthenticateRequestExample1.yaml index d7a4ac4a42..c384c4207b 100644 --- a/specification/security/oidc_authenticate/examples/request/OidcAuthenticateRequestExample1.yaml +++ b/specification/security/oidc_authenticate/examples/request/OidcAuthenticateRequestExample1.yaml @@ -1,8 +1,9 @@ # summary: method_request: POST /_security/oidc/authenticate description: > - Run `POST /_security/oidc/authenticate` to exchange the response that was returned from the OpenID Connect Provider after a successful authentication for an Elasticsearch access token and refresh token. - This example is from an authentication that uses the authorization code grant flow. + Run `POST /_security/oidc/authenticate` to exchange the response that was returned from the OpenID Connect Provider after a + successful authentication for an Elasticsearch access token and refresh token. This example is from an authentication that uses + the authorization code grant flow. # type: request value: |- { @@ -11,3 +12,47 @@ value: |- "nonce" : "WaBPH0KqPVdG5HHdSxPRjfoZbXMCicm5v1OiAj0DUFM", "realm" : "oidc1" } +alternatives: + - language: Python + code: >- + resp = client.security.oidc_authenticate( + redirect_uri="https://oidc-kibana.elastic.co:5603/api/security/oidc/callback?code=jtI3Ntt8v3_XvcLzCFGq&state=4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I", + state="4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I", + nonce="WaBPH0KqPVdG5HHdSxPRjfoZbXMCicm5v1OiAj0DUFM", + realm="oidc1", + ) + - language: JavaScript + code: >- + const response = await client.security.oidcAuthenticate({ + redirect_uri: + "https://oidc-kibana.elastic.co:5603/api/security/oidc/callback?code=jtI3Ntt8v3_XvcLzCFGq&state=4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I", + state: "4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I", + nonce: "WaBPH0KqPVdG5HHdSxPRjfoZbXMCicm5v1OiAj0DUFM", + realm: "oidc1", + }); + - language: Ruby + code: >- + response = client.security.oidc_authenticate( + body: { + "redirect_uri": "https://oidc-kibana.elastic.co:5603/api/security/oidc/callback?code=jtI3Ntt8v3_XvcLzCFGq&state=4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I", + "state": "4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I", + "nonce": "WaBPH0KqPVdG5HHdSxPRjfoZbXMCicm5v1OiAj0DUFM", + "realm": "oidc1" + } + ) + - language: PHP + code: >- + $resp = $client->security()->oidcAuthenticate([ + "body" => [ + "redirect_uri" => "https://oidc-kibana.elastic.co:5603/api/security/oidc/callback?code=jtI3Ntt8v3_XvcLzCFGq&state=4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I", + "state" => "4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I", + "nonce" => "WaBPH0KqPVdG5HHdSxPRjfoZbXMCicm5v1OiAj0DUFM", + "realm" => "oidc1", + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"redirect_uri\":\"https://oidc-kibana.elastic.co:5603/api/security/oidc/callback?code=jtI3Ntt8v3_XvcLzCFGq&state=4dbrihtIA\ + t3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\"state\":\"4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\"nonce\":\"WaBPH0KqPVdG5HHdSx\ + PRjfoZbXMCicm5v1OiAj0DUFM\",\"realm\":\"oidc1\"}' \"$ELASTICSEARCH_URL/_security/oidc/authenticate\"" diff --git a/specification/security/oidc_logout/examples/request/OidcLogoutRequestExample1.yaml b/specification/security/oidc_logout/examples/request/OidcLogoutRequestExample1.yaml index f41ea4c820..a7f378c83c 100644 --- a/specification/security/oidc_logout/examples/request/OidcLogoutRequestExample1.yaml +++ b/specification/security/oidc_logout/examples/request/OidcLogoutRequestExample1.yaml @@ -7,3 +7,38 @@ value: |- "token" : "dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==", "refresh_token": "vLBPvmAB6KvwvJZr27cS" } +alternatives: + - language: Python + code: |- + resp = client.security.oidc_logout( + token="dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==", + refresh_token="vLBPvmAB6KvwvJZr27cS", + ) + - language: JavaScript + code: |- + const response = await client.security.oidcLogout({ + token: + "dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==", + refresh_token: "vLBPvmAB6KvwvJZr27cS", + }); + - language: Ruby + code: |- + response = client.security.oidc_logout( + body: { + "token": "dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==", + "refresh_token": "vLBPvmAB6KvwvJZr27cS" + } + ) + - language: PHP + code: |- + $resp = $client->security()->oidcLogout([ + "body" => [ + "token" => "dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==", + "refresh_token" => "vLBPvmAB6KvwvJZr27cS", + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"token\":\"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\"re\ + fresh_token\":\"vLBPvmAB6KvwvJZr27cS\"}' \"$ELASTICSEARCH_URL/_security/oidc/logout\"" diff --git a/specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample1.yaml b/specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample1.yaml index 4f788b839c..e0a4568ffb 100644 --- a/specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample1.yaml +++ b/specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample1.yaml @@ -7,3 +7,32 @@ value: |- { "realm" : "oidc1" } +alternatives: + - language: Python + code: |- + resp = client.security.oidc_prepare_authentication( + realm="oidc1", + ) + - language: JavaScript + code: |- + const response = await client.security.oidcPrepareAuthentication({ + realm: "oidc1", + }); + - language: Ruby + code: |- + response = client.security.oidc_prepare_authentication( + body: { + "realm": "oidc1" + } + ) + - language: PHP + code: |- + $resp = $client->security()->oidcPrepareAuthentication([ + "body" => [ + "realm" => "oidc1", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"realm":"oidc1"}'' + "$ELASTICSEARCH_URL/_security/oidc/prepare"' diff --git a/specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample2.yaml b/specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample2.yaml index 98d5f7a5bb..9d32573994 100644 --- a/specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample2.yaml +++ b/specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample2.yaml @@ -1,7 +1,8 @@ summary: Prepare with realm, state, and nonce method_request: POST /_security/oidc/prepare description: > - Run `POST /_security/oidc/prepare` to generate an authentication request for the OpenID Connect Realm `oidc1`, where the values for the `state` and the `nonce` have been generated by the client. + Run `POST /_security/oidc/prepare` to generate an authentication request for the OpenID Connect Realm `oidc1`, where the values + for the `state` and the `nonce` have been generated by the client. # type: request value: |- { @@ -9,3 +10,41 @@ value: |- "state" : "lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO", "nonce" : "zOBXLJGUooRrbLbQk5YCcyC8AXw3iloynvluYhZ5" } +alternatives: + - language: Python + code: |- + resp = client.security.oidc_prepare_authentication( + realm="oidc1", + state="lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO", + nonce="zOBXLJGUooRrbLbQk5YCcyC8AXw3iloynvluYhZ5", + ) + - language: JavaScript + code: |- + const response = await client.security.oidcPrepareAuthentication({ + realm: "oidc1", + state: "lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO", + nonce: "zOBXLJGUooRrbLbQk5YCcyC8AXw3iloynvluYhZ5", + }); + - language: Ruby + code: |- + response = client.security.oidc_prepare_authentication( + body: { + "realm": "oidc1", + "state": "lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO", + "nonce": "zOBXLJGUooRrbLbQk5YCcyC8AXw3iloynvluYhZ5" + } + ) + - language: PHP + code: |- + $resp = $client->security()->oidcPrepareAuthentication([ + "body" => [ + "realm" => "oidc1", + "state" => "lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO", + "nonce" => "zOBXLJGUooRrbLbQk5YCcyC8AXw3iloynvluYhZ5", + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"realm\":\"oidc1\",\"state\":\"lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO\",\"nonce\":\"zOBXLJGUooRrbLbQk5YCcyC8AXw3iloynvlu\ + YhZ5\"}' \"$ELASTICSEARCH_URL/_security/oidc/prepare\"" diff --git a/specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample3.yaml b/specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample3.yaml index 71c2376855..d4518d61f9 100644 --- a/specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample3.yaml +++ b/specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample3.yaml @@ -1,11 +1,45 @@ summary: Prepare by realm method_request: POST /_security/oidc/prepare description: > - Run `POST /_security/oidc/prepare` to generate an authentication request for a third party initiated single sign on. - Specify the issuer that should be used for matching the appropriate OpenID Connect Authentication realm. + Run `POST /_security/oidc/prepare` to generate an authentication request for a third party initiated single sign on. Specify the + issuer that should be used for matching the appropriate OpenID Connect Authentication realm. # type: request value: |- { "iss" : "http://127.0.0.1:8080", "login_hint": "this_is_an_opaque_string" } +alternatives: + - language: Python + code: |- + resp = client.security.oidc_prepare_authentication( + iss="http://127.0.0.1:8080", + login_hint="this_is_an_opaque_string", + ) + - language: JavaScript + code: |- + const response = await client.security.oidcPrepareAuthentication({ + iss: "http://127.0.0.1:8080", + login_hint: "this_is_an_opaque_string", + }); + - language: Ruby + code: |- + response = client.security.oidc_prepare_authentication( + body: { + "iss": "http://127.0.0.1:8080", + "login_hint": "this_is_an_opaque_string" + } + ) + - language: PHP + code: |- + $resp = $client->security()->oidcPrepareAuthentication([ + "body" => [ + "iss" => "http://127.0.0.1:8080", + "login_hint" => "this_is_an_opaque_string", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"iss":"http://127.0.0.1:8080","login_hint":"this_is_an_opaque_string"}'' + "$ELASTICSEARCH_URL/_security/oidc/prepare"' diff --git a/specification/security/put_privileges/examples/request/SecurityPutPrivilegesRequestExample1.yaml b/specification/security/put_privileges/examples/request/SecurityPutPrivilegesRequestExample1.yaml index 30963567ac..3805b1d904 100644 --- a/specification/security/put_privileges/examples/request/SecurityPutPrivilegesRequestExample1.yaml +++ b/specification/security/put_privileges/examples/request/SecurityPutPrivilegesRequestExample1.yaml @@ -1,10 +1,10 @@ summary: Add a privilege method_request: PUT /_security/privilege description: > - Run `PUT /_security/privilege` to add a single application privilege. - The wildcard (`*`) means that this privilege grants access to all actions that start with `data:read/`. - Elasticsearch does not assign any meaning to these actions. However, - if the request includes an application privilege such as `data:read/users` or `data:read/settings`, the has privileges API respects the use of a wildcard and returns `true`. + Run `PUT /_security/privilege` to add a single application privilege. The wildcard (`*`) means that this privilege grants access + to all actions that start with `data:read/`. Elasticsearch does not assign any meaning to these actions. However, if the request + includes an application privilege such as `data:read/users` or `data:read/settings`, the has privileges API respects the use of a + wildcard and returns `true`. # type: request value: |- { @@ -19,3 +19,74 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.security.put_privileges( + privileges={ + "myapp": { + "read": { + "actions": [ + "data:read/*", + "action:login" + ], + "metadata": { + "description": "Read access to myapp" + } + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.security.putPrivileges({ + privileges: { + myapp: { + read: { + actions: ["data:read/*", "action:login"], + metadata: { + description: "Read access to myapp", + }, + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.security.put_privileges( + body: { + "myapp": { + "read": { + "actions": [ + "data:read/*", + "action:login" + ], + "metadata": { + "description": "Read access to myapp" + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->putPrivileges([ + "body" => [ + "myapp" => [ + "read" => [ + "actions" => array( + "data:read/*", + "action:login", + ), + "metadata" => [ + "description" => "Read access to myapp", + ], + ], + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"myapp":{"read":{"actions":["data:read/*","action:login"],"metadata":{"description":"Read access to + myapp"}}}}'' "$ELASTICSEARCH_URL/_security/privilege"' diff --git a/specification/security/put_privileges/examples/request/SecurityPutPrivilegesRequestExample2.yaml b/specification/security/put_privileges/examples/request/SecurityPutPrivilegesRequestExample2.yaml index 50b41c054b..1e961adaf0 100644 --- a/specification/security/put_privileges/examples/request/SecurityPutPrivilegesRequestExample2.yaml +++ b/specification/security/put_privileges/examples/request/SecurityPutPrivilegesRequestExample2.yaml @@ -19,3 +19,109 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.security.put_privileges( + privileges={ + "app01": { + "read": { + "actions": [ + "action:login", + "data:read/*" + ] + }, + "write": { + "actions": [ + "action:login", + "data:write/*" + ] + } + }, + "app02": { + "all": { + "actions": [ + "*" + ] + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.security.putPrivileges({ + privileges: { + app01: { + read: { + actions: ["action:login", "data:read/*"], + }, + write: { + actions: ["action:login", "data:write/*"], + }, + }, + app02: { + all: { + actions: ["*"], + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.security.put_privileges( + body: { + "app01": { + "read": { + "actions": [ + "action:login", + "data:read/*" + ] + }, + "write": { + "actions": [ + "action:login", + "data:write/*" + ] + } + }, + "app02": { + "all": { + "actions": [ + "*" + ] + } + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->putPrivileges([ + "body" => [ + "app01" => [ + "read" => [ + "actions" => array( + "action:login", + "data:read/*", + ), + ], + "write" => [ + "actions" => array( + "action:login", + "data:write/*", + ), + ], + ], + "app02" => [ + "all" => [ + "actions" => array( + "*", + ), + ], + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"app01\":{\"read\":{\"actions\":[\"action:login\",\"data:read/*\"]},\"write\":{\"actions\":[\"action:login\",\"data:write/*\ + \"]}},\"app02\":{\"all\":{\"actions\":[\"*\"]}}}' \"$ELASTICSEARCH_URL/_security/privilege\"" diff --git a/specification/security/put_role/examples/request/SecurityPutRoleRequestExample1.yaml b/specification/security/put_role/examples/request/SecurityPutRoleRequestExample1.yaml index 3f54366fb4..2488f685ae 100644 --- a/specification/security/put_role/examples/request/SecurityPutRoleRequestExample1.yaml +++ b/specification/security/put_role/examples/request/SecurityPutRoleRequestExample1.yaml @@ -28,3 +28,180 @@ value: |- "version" : 1 } } +alternatives: + - language: Python + code: |- + resp = client.security.put_role( + name="my_admin_role", + description="Grants full access to all management features within the cluster.", + cluster=[ + "all" + ], + indices=[ + { + "names": [ + "index1", + "index2" + ], + "privileges": [ + "all" + ], + "field_security": { + "grant": [ + "title", + "body" + ] + }, + "query": "{\"match\": {\"title\": \"foo\"}}" + } + ], + applications=[ + { + "application": "myapp", + "privileges": [ + "admin", + "read" + ], + "resources": [ + "*" + ] + } + ], + run_as=[ + "other_user" + ], + metadata={ + "version": 1 + }, + ) + - language: JavaScript + code: |- + const response = await client.security.putRole({ + name: "my_admin_role", + description: + "Grants full access to all management features within the cluster.", + cluster: ["all"], + indices: [ + { + names: ["index1", "index2"], + privileges: ["all"], + field_security: { + grant: ["title", "body"], + }, + query: '{"match": {"title": "foo"}}', + }, + ], + applications: [ + { + application: "myapp", + privileges: ["admin", "read"], + resources: ["*"], + }, + ], + run_as: ["other_user"], + metadata: { + version: 1, + }, + }); + - language: Ruby + code: |- + response = client.security.put_role( + name: "my_admin_role", + body: { + "description": "Grants full access to all management features within the cluster.", + "cluster": [ + "all" + ], + "indices": [ + { + "names": [ + "index1", + "index2" + ], + "privileges": [ + "all" + ], + "field_security": { + "grant": [ + "title", + "body" + ] + }, + "query": "{\"match\": {\"title\": \"foo\"}}" + } + ], + "applications": [ + { + "application": "myapp", + "privileges": [ + "admin", + "read" + ], + "resources": [ + "*" + ] + } + ], + "run_as": [ + "other_user" + ], + "metadata": { + "version": 1 + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->putRole([ + "name" => "my_admin_role", + "body" => [ + "description" => "Grants full access to all management features within the cluster.", + "cluster" => array( + "all", + ), + "indices" => array( + [ + "names" => array( + "index1", + "index2", + ), + "privileges" => array( + "all", + ), + "field_security" => [ + "grant" => array( + "title", + "body", + ), + ], + "query" => "{\"match\": {\"title\": \"foo\"}}", + ], + ), + "applications" => array( + [ + "application" => "myapp", + "privileges" => array( + "admin", + "read", + ), + "resources" => array( + "*", + ), + ], + ), + "run_as" => array( + "other_user", + ), + "metadata" => [ + "version" => 1, + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"description\":\"Grants full access to all management features within the + cluster.\",\"cluster\":[\"all\"],\"indices\":[{\"names\":[\"index1\",\"index2\"],\"privileges\":[\"all\"],\"field_security\":{\ + \"grant\":[\"title\",\"body\"]},\"query\":\"{\\\"match\\\": {\\\"title\\\": + \\\"foo\\\"}}\"}],\"applications\":[{\"application\":\"myapp\",\"privileges\":[\"admin\",\"read\"],\"resources\":[\"*\"]}],\"\ + run_as\":[\"other_user\"],\"metadata\":{\"version\":1}}' \"$ELASTICSEARCH_URL/_security/role/my_admin_role\"" diff --git a/specification/security/put_role/examples/request/SecurityPutRoleRequestExample2.yaml b/specification/security/put_role/examples/request/SecurityPutRoleRequestExample2.yaml index 531cb552ba..92375913ff 100644 --- a/specification/security/put_role/examples/request/SecurityPutRoleRequestExample2.yaml +++ b/specification/security/put_role/examples/request/SecurityPutRoleRequestExample2.yaml @@ -12,3 +12,82 @@ value: |- } ] } +alternatives: + - language: Python + code: |- + resp = client.security.put_role( + name="cli_or_drivers_minimal", + cluster=[ + "cluster:monitor/main" + ], + indices=[ + { + "names": [ + "test" + ], + "privileges": [ + "read", + "indices:admin/get" + ] + } + ], + ) + - language: JavaScript + code: |- + const response = await client.security.putRole({ + name: "cli_or_drivers_minimal", + cluster: ["cluster:monitor/main"], + indices: [ + { + names: ["test"], + privileges: ["read", "indices:admin/get"], + }, + ], + }); + - language: Ruby + code: |- + response = client.security.put_role( + name: "cli_or_drivers_minimal", + body: { + "cluster": [ + "cluster:monitor/main" + ], + "indices": [ + { + "names": [ + "test" + ], + "privileges": [ + "read", + "indices:admin/get" + ] + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->security()->putRole([ + "name" => "cli_or_drivers_minimal", + "body" => [ + "cluster" => array( + "cluster:monitor/main", + ), + "indices" => array( + [ + "names" => array( + "test", + ), + "privileges" => array( + "read", + "indices:admin/get", + ), + ], + ), + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"cluster\":[\"cluster:monitor/main\"],\"indices\":[{\"names\":[\"test\"],\"privileges\":[\"read\",\"indices:admin/get\"]}]\ + }' \"$ELASTICSEARCH_URL/_security/role/cli_or_drivers_minimal\"" diff --git a/specification/security/put_role/examples/request/SecurityPutRoleRequestExample3.yaml b/specification/security/put_role/examples/request/SecurityPutRoleRequestExample3.yaml index 5d799044d0..d4d3100d2a 100644 --- a/specification/security/put_role/examples/request/SecurityPutRoleRequestExample3.yaml +++ b/specification/security/put_role/examples/request/SecurityPutRoleRequestExample3.yaml @@ -1,6 +1,8 @@ summary: Role example 3 method_request: POST /_security/role/only_remote_access_role -description: Run `POST /_security/role/only_remote_access_role` to configure a role with remote indices and remote cluster privileges for a remote cluster. +description: + Run `POST /_security/role/only_remote_access_role` to configure a role with remote indices and remote cluster + privileges for a remote cluster. # type: request value: |- { @@ -18,3 +20,122 @@ value: |- } ] } +alternatives: + - language: Python + code: |- + resp = client.security.put_role( + name="only_remote_access_role", + remote_indices=[ + { + "clusters": [ + "my_remote" + ], + "names": [ + "logs*" + ], + "privileges": [ + "read", + "read_cross_cluster", + "view_index_metadata" + ] + } + ], + remote_cluster=[ + { + "clusters": [ + "my_remote" + ], + "privileges": [ + "monitor_stats" + ] + } + ], + ) + - language: JavaScript + code: |- + const response = await client.security.putRole({ + name: "only_remote_access_role", + remote_indices: [ + { + clusters: ["my_remote"], + names: ["logs*"], + privileges: ["read", "read_cross_cluster", "view_index_metadata"], + }, + ], + remote_cluster: [ + { + clusters: ["my_remote"], + privileges: ["monitor_stats"], + }, + ], + }); + - language: Ruby + code: |- + response = client.security.put_role( + name: "only_remote_access_role", + body: { + "remote_indices": [ + { + "clusters": [ + "my_remote" + ], + "names": [ + "logs*" + ], + "privileges": [ + "read", + "read_cross_cluster", + "view_index_metadata" + ] + } + ], + "remote_cluster": [ + { + "clusters": [ + "my_remote" + ], + "privileges": [ + "monitor_stats" + ] + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->security()->putRole([ + "name" => "only_remote_access_role", + "body" => [ + "remote_indices" => array( + [ + "clusters" => array( + "my_remote", + ), + "names" => array( + "logs*", + ), + "privileges" => array( + "read", + "read_cross_cluster", + "view_index_metadata", + ), + ], + ), + "remote_cluster" => array( + [ + "clusters" => array( + "my_remote", + ), + "privileges" => array( + "monitor_stats", + ), + ], + ), + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"remote_indices\":[{\"clusters\":[\"my_remote\"],\"names\":[\"logs*\"],\"privileges\":[\"read\",\"read_cross_cluster\",\"v\ + iew_index_metadata\"]}],\"remote_cluster\":[{\"clusters\":[\"my_remote\"],\"privileges\":[\"monitor_stats\"]}]}' + \"$ELASTICSEARCH_URL/_security/role/only_remote_access_role\"" diff --git a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample1.yaml b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample1.yaml index 1f3359b130..6856069214 100644 --- a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample1.yaml +++ b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample1.yaml @@ -14,3 +14,79 @@ value: |- "version" : 1 } } +alternatives: + - language: Python + code: |- + resp = client.security.put_role_mapping( + name="mapping1", + roles=[ + "user" + ], + enabled=True, + rules={ + "field": { + "username": "*" + } + }, + metadata={ + "version": 1 + }, + ) + - language: JavaScript + code: |- + const response = await client.security.putRoleMapping({ + name: "mapping1", + roles: ["user"], + enabled: true, + rules: { + field: { + username: "*", + }, + }, + metadata: { + version: 1, + }, + }); + - language: Ruby + code: |- + response = client.security.put_role_mapping( + name: "mapping1", + body: { + "roles": [ + "user" + ], + "enabled": true, + "rules": { + "field": { + "username": "*" + } + }, + "metadata": { + "version": 1 + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->putRoleMapping([ + "name" => "mapping1", + "body" => [ + "roles" => array( + "user", + ), + "enabled" => true, + "rules" => [ + "field" => [ + "username" => "*", + ], + ], + "metadata" => [ + "version" => 1, + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"roles":["user"],"enabled":true,"rules":{"field":{"username":"*"}},"metadata":{"version":1}}'' + "$ELASTICSEARCH_URL/_security/role_mapping/mapping1"' diff --git a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample2.yaml b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample2.yaml index ab7b53ca08..9461487455 100644 --- a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample2.yaml +++ b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample2.yaml @@ -11,3 +11,79 @@ value: |- "field" : { "username" : [ "esadmin01", "esadmin02" ] } } } +alternatives: + - language: Python + code: |- + resp = client.security.put_role_mapping( + name="mapping2", + roles=[ + "user", + "admin" + ], + enabled=True, + rules={ + "field": { + "username": [ + "esadmin01", + "esadmin02" + ] + } + }, + ) + - language: JavaScript + code: |- + const response = await client.security.putRoleMapping({ + name: "mapping2", + roles: ["user", "admin"], + enabled: true, + rules: { + field: { + username: ["esadmin01", "esadmin02"], + }, + }, + }); + - language: Ruby + code: |- + response = client.security.put_role_mapping( + name: "mapping2", + body: { + "roles": [ + "user", + "admin" + ], + "enabled": true, + "rules": { + "field": { + "username": [ + "esadmin01", + "esadmin02" + ] + } + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->putRoleMapping([ + "name" => "mapping2", + "body" => [ + "roles" => array( + "user", + "admin", + ), + "enabled" => true, + "rules" => [ + "field" => [ + "username" => array( + "esadmin01", + "esadmin02", + ), + ], + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"roles":["user","admin"],"enabled":true,"rules":{"field":{"username":["esadmin01","esadmin02"]}}}'' + "$ELASTICSEARCH_URL/_security/role_mapping/mapping2"' diff --git a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample3.yaml b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample3.yaml index 8419cd938e..43f2d08044 100644 --- a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample3.yaml +++ b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample3.yaml @@ -11,3 +11,67 @@ value: |- "field" : { "realm.name" : "ldap1" } } } +alternatives: + - language: Python + code: |- + resp = client.security.put_role_mapping( + name="mapping3", + roles=[ + "ldap-user" + ], + enabled=True, + rules={ + "field": { + "realm.name": "ldap1" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.security.putRoleMapping({ + name: "mapping3", + roles: ["ldap-user"], + enabled: true, + rules: { + field: { + "realm.name": "ldap1", + }, + }, + }); + - language: Ruby + code: |- + response = client.security.put_role_mapping( + name: "mapping3", + body: { + "roles": [ + "ldap-user" + ], + "enabled": true, + "rules": { + "field": { + "realm.name": "ldap1" + } + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->putRoleMapping([ + "name" => "mapping3", + "body" => [ + "roles" => array( + "ldap-user", + ), + "enabled" => true, + "rules" => [ + "field" => [ + "realm.name" => "ldap1", + ], + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"roles":["ldap-user"],"enabled":true,"rules":{"field":{"realm.name":"ldap1"}}}'' + "$ELASTICSEARCH_URL/_security/role_mapping/mapping3"' diff --git a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample4.yaml b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample4.yaml index 0f3f0679fc..34f256f667 100644 --- a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample4.yaml +++ b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample4.yaml @@ -1,9 +1,10 @@ summary: Roles for specific groups method_request: POST /_security/role_mapping/mapping4 description: > - Run `POST /_security/role_mapping/mapping4` to match any user where either the username is `esadmin` or the user is in the `cn=admin,dc=example,dc=com group`. - This example is useful when the group names in your identity management system (such as Active Directory, or a SAML Identity Provider) do not have a one-to-one correspondence with the names of roles in Elasticsearch. - The role mapping is the means by which you link a group name with a role name. + Run `POST /_security/role_mapping/mapping4` to match any user where either the username is `esadmin` or the user is in the + `cn=admin,dc=example,dc=com group`. This example is useful when the group names in your identity management system (such as Active + Directory, or a SAML Identity Provider) do not have a one-to-one correspondence with the names of roles in Elasticsearch. The role + mapping is the means by which you link a group name with a role name. # type: request value: |- { @@ -24,3 +25,103 @@ value: |- ] } } +alternatives: + - language: Python + code: |- + resp = client.security.put_role_mapping( + name="mapping4", + roles=[ + "superuser" + ], + enabled=True, + rules={ + "any": [ + { + "field": { + "username": "esadmin" + } + }, + { + "field": { + "groups": "cn=admins,dc=example,dc=com" + } + } + ] + }, + ) + - language: JavaScript + code: |- + const response = await client.security.putRoleMapping({ + name: "mapping4", + roles: ["superuser"], + enabled: true, + rules: { + any: [ + { + field: { + username: "esadmin", + }, + }, + { + field: { + groups: "cn=admins,dc=example,dc=com", + }, + }, + ], + }, + }); + - language: Ruby + code: |- + response = client.security.put_role_mapping( + name: "mapping4", + body: { + "roles": [ + "superuser" + ], + "enabled": true, + "rules": { + "any": [ + { + "field": { + "username": "esadmin" + } + }, + { + "field": { + "groups": "cn=admins,dc=example,dc=com" + } + } + ] + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->putRoleMapping([ + "name" => "mapping4", + "body" => [ + "roles" => array( + "superuser", + ), + "enabled" => true, + "rules" => [ + "any" => array( + [ + "field" => [ + "username" => "esadmin", + ], + ], + [ + "field" => [ + "groups" => "cn=admins,dc=example,dc=com", + ], + ], + ), + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"roles\":[\"superuser\"],\"enabled\":true,\"rules\":{\"any\":[{\"field\":{\"username\":\"esadmin\"}},{\"field\":{\"groups\ + \":\"cn=admins,dc=example,dc=com\"}}]}}' \"$ELASTICSEARCH_URL/_security/role_mapping/mapping4\"" diff --git a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample5.yaml b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample5.yaml index f08db5f989..9a6993a6e9 100644 --- a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample5.yaml +++ b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample5.yaml @@ -1,8 +1,8 @@ summary: Roles for multiple groups method_request: POST /_security/role_mapping/mapping5 description: > - Run `POST /_security/role_mapping/mapping5` to use an array syntax for the groups field when there are multiple groups. - This pattern matches any of the groups (rather than all of the groups). + Run `POST /_security/role_mapping/mapping5` to use an array syntax for the groups field when there are multiple groups. This + pattern matches any of the groups (rather than all of the groups). # type: request value: |- { @@ -17,3 +17,89 @@ value: |- }, "enabled": true } +alternatives: + - language: Python + code: |- + resp = client.security.put_role_mapping( + name="mapping5", + role_templates=[ + { + "template": { + "source": "{{#tojson}}groups{{/tojson}}" + }, + "format": "json" + } + ], + rules={ + "field": { + "realm.name": "saml1" + } + }, + enabled=True, + ) + - language: JavaScript + code: |- + const response = await client.security.putRoleMapping({ + name: "mapping5", + role_templates: [ + { + template: { + source: "{{#tojson}}groups{{/tojson}}", + }, + format: "json", + }, + ], + rules: { + field: { + "realm.name": "saml1", + }, + }, + enabled: true, + }); + - language: Ruby + code: |- + response = client.security.put_role_mapping( + name: "mapping5", + body: { + "role_templates": [ + { + "template": { + "source": "{{#tojson}}groups{{/tojson}}" + }, + "format": "json" + } + ], + "rules": { + "field": { + "realm.name": "saml1" + } + }, + "enabled": true + } + ) + - language: PHP + code: |- + $resp = $client->security()->putRoleMapping([ + "name" => "mapping5", + "body" => [ + "role_templates" => array( + [ + "template" => [ + "source" => "{{#tojson}}groups{{/tojson}}", + ], + "format" => "json", + ], + ), + "rules" => [ + "field" => [ + "realm.name" => "saml1", + ], + ], + "enabled" => true, + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"role_templates\":[{\"template\":{\"source\":\"{{#tojson}}groups{{/tojson}}\"},\"format\":\"json\"}],\"rules\":{\"field\":{\ + \"realm.name\":\"saml1\"}},\"enabled\":true}' \"$ELASTICSEARCH_URL/_security/role_mapping/mapping5\"" diff --git a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample6.yaml b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample6.yaml index 4aa67a3721..3fe8c33a3e 100644 --- a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample6.yaml +++ b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample6.yaml @@ -1,15 +1,17 @@ summary: Templated roles for groups method_request: POST /_security/role_mapping/mapping6 description: > - Run `POST /_security/role_mapping/mapping6` for rare cases when the names of your groups may be an exact match for the names of your Elasticsearch roles. - This can be the case when your SAML Identity Provider includes its own "group mapping" feature and can be configured to release Elasticsearch role names in the user's SAML attributes. - In these cases it is possible to use a template that treats the group names as role names. + Run `POST /_security/role_mapping/mapping6` for rare cases when the names of your groups may be an exact match for the names of + your Elasticsearch roles. This can be the case when your SAML Identity Provider includes its own "group mapping" feature and can + be configured to release Elasticsearch role names in the user's SAML attributes. In these cases it is possible to use a template + that treats the group names as role names. - NOTE: This should only be done if you intend to define roles for all of the provided groups. - Mapping a user to a large number of unnecessary or undefined roles is inefficient and can have a negative effect on system performance. - If you only need to map a subset of the groups, you should do it by using explicit mappings. + NOTE: This should only be done if you intend to define roles for all of the provided groups. Mapping a user to a large number of + unnecessary or undefined roles is inefficient and can have a negative effect on system performance. If you only need to map a + subset of the groups, you should do it by using explicit mappings. - The `tojson` mustache function is used to convert the list of group names into a valid JSON array. Because the template produces a JSON array, the `format` must be set to `json`. + The `tojson` mustache function is used to convert the list of group names into a valid JSON array. Because the template produces a + JSON array, the `format` must be set to `json`. # type: request value: |- { @@ -24,3 +26,89 @@ value: |- }, "enabled": true } +alternatives: + - language: Python + code: |- + resp = client.security.put_role_mapping( + name="mapping6", + role_templates=[ + { + "template": { + "source": "{{#tojson}}groups{{/tojson}}" + }, + "format": "json" + } + ], + rules={ + "field": { + "realm.name": "saml1" + } + }, + enabled=True, + ) + - language: JavaScript + code: |- + const response = await client.security.putRoleMapping({ + name: "mapping6", + role_templates: [ + { + template: { + source: "{{#tojson}}groups{{/tojson}}", + }, + format: "json", + }, + ], + rules: { + field: { + "realm.name": "saml1", + }, + }, + enabled: true, + }); + - language: Ruby + code: |- + response = client.security.put_role_mapping( + name: "mapping6", + body: { + "role_templates": [ + { + "template": { + "source": "{{#tojson}}groups{{/tojson}}" + }, + "format": "json" + } + ], + "rules": { + "field": { + "realm.name": "saml1" + } + }, + "enabled": true + } + ) + - language: PHP + code: |- + $resp = $client->security()->putRoleMapping([ + "name" => "mapping6", + "body" => [ + "role_templates" => array( + [ + "template" => [ + "source" => "{{#tojson}}groups{{/tojson}}", + ], + "format" => "json", + ], + ), + "rules" => [ + "field" => [ + "realm.name" => "saml1", + ], + ], + "enabled" => true, + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"role_templates\":[{\"template\":{\"source\":\"{{#tojson}}groups{{/tojson}}\"},\"format\":\"json\"}],\"rules\":{\"field\":{\ + \"realm.name\":\"saml1\"}},\"enabled\":true}' \"$ELASTICSEARCH_URL/_security/role_mapping/mapping6\"" diff --git a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample7.yaml b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample7.yaml index a553449400..c5c9d32bc1 100644 --- a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample7.yaml +++ b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample7.yaml @@ -14,3 +14,103 @@ value: |- ] } } +alternatives: + - language: Python + code: |- + resp = client.security.put_role_mapping( + name="mapping7", + roles=[ + "ldap-example-user" + ], + enabled=True, + rules={ + "all": [ + { + "field": { + "dn": "*,ou=subtree,dc=example,dc=com" + } + }, + { + "field": { + "realm.name": "ldap1" + } + } + ] + }, + ) + - language: JavaScript + code: |- + const response = await client.security.putRoleMapping({ + name: "mapping7", + roles: ["ldap-example-user"], + enabled: true, + rules: { + all: [ + { + field: { + dn: "*,ou=subtree,dc=example,dc=com", + }, + }, + { + field: { + "realm.name": "ldap1", + }, + }, + ], + }, + }); + - language: Ruby + code: |- + response = client.security.put_role_mapping( + name: "mapping7", + body: { + "roles": [ + "ldap-example-user" + ], + "enabled": true, + "rules": { + "all": [ + { + "field": { + "dn": "*,ou=subtree,dc=example,dc=com" + } + }, + { + "field": { + "realm.name": "ldap1" + } + } + ] + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->putRoleMapping([ + "name" => "mapping7", + "body" => [ + "roles" => array( + "ldap-example-user", + ), + "enabled" => true, + "rules" => [ + "all" => array( + [ + "field" => [ + "dn" => "*,ou=subtree,dc=example,dc=com", + ], + ], + [ + "field" => [ + "realm.name" => "ldap1", + ], + ], + ), + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"roles\":[\"ldap-example-user\"],\"enabled\":true,\"rules\":{\"all\":[{\"field\":{\"dn\":\"*,ou=subtree,dc=example,dc=com\ + \"}},{\"field\":{\"realm.name\":\"ldap1\"}}]}}' \"$ELASTICSEARCH_URL/_security/role_mapping/mapping7\"" diff --git a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample8.yaml b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample8.yaml index 20158d2d2c..4743124637 100644 --- a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample8.yaml +++ b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample8.yaml @@ -1,7 +1,10 @@ summary: Complex roles method_request: POST /_security/role_mapping/mapping8 description: > - Run `POST /_security/role_mapping/mapping8` to assign rules that are complex and include wildcard matching. For example, this mapping matches any user where all of these conditions are met: the Distinguished Name matches the pattern `*,ou=admin,dc=example,dc=com`, or the `username` is `es-admin`, or the `username` is `es-system`; the user is in the `cn=people,dc=example,dc=com` group; the user does not have a `terminated_date`. + Run `POST /_security/role_mapping/mapping8` to assign rules that are complex and include wildcard matching. For example, this + mapping matches any user where all of these conditions are met: the Distinguished Name matches the pattern + `*,ou=admin,dc=example,dc=com`, or the `username` is `es-admin`, or the `username` is `es-system`; the user is in the + `cn=people,dc=example,dc=com` group; the user does not have a `terminated_date`. # type: request value: |- { @@ -38,3 +41,177 @@ value: |- ] } } +alternatives: + - language: Python + code: |- + resp = client.security.put_role_mapping( + name="mapping8", + roles=[ + "superuser" + ], + enabled=True, + rules={ + "all": [ + { + "any": [ + { + "field": { + "dn": "*,ou=admin,dc=example,dc=com" + } + }, + { + "field": { + "username": [ + "es-admin", + "es-system" + ] + } + } + ] + }, + { + "field": { + "groups": "cn=people,dc=example,dc=com" + } + }, + { + "except": { + "field": { + "metadata.terminated_date": None + } + } + } + ] + }, + ) + - language: JavaScript + code: |- + const response = await client.security.putRoleMapping({ + name: "mapping8", + roles: ["superuser"], + enabled: true, + rules: { + all: [ + { + any: [ + { + field: { + dn: "*,ou=admin,dc=example,dc=com", + }, + }, + { + field: { + username: ["es-admin", "es-system"], + }, + }, + ], + }, + { + field: { + groups: "cn=people,dc=example,dc=com", + }, + }, + { + except: { + field: { + "metadata.terminated_date": null, + }, + }, + }, + ], + }, + }); + - language: Ruby + code: |- + response = client.security.put_role_mapping( + name: "mapping8", + body: { + "roles": [ + "superuser" + ], + "enabled": true, + "rules": { + "all": [ + { + "any": [ + { + "field": { + "dn": "*,ou=admin,dc=example,dc=com" + } + }, + { + "field": { + "username": [ + "es-admin", + "es-system" + ] + } + } + ] + }, + { + "field": { + "groups": "cn=people,dc=example,dc=com" + } + }, + { + "except": { + "field": { + "metadata.terminated_date": nil + } + } + } + ] + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->putRoleMapping([ + "name" => "mapping8", + "body" => [ + "roles" => array( + "superuser", + ), + "enabled" => true, + "rules" => [ + "all" => array( + [ + "any" => array( + [ + "field" => [ + "dn" => "*,ou=admin,dc=example,dc=com", + ], + ], + [ + "field" => [ + "username" => array( + "es-admin", + "es-system", + ), + ], + ], + ), + ], + [ + "field" => [ + "groups" => "cn=people,dc=example,dc=com", + ], + ], + [ + "except" => [ + "field" => [ + "metadata.terminated_date" => null, + ], + ], + ], + ), + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"roles\":[\"superuser\"],\"enabled\":true,\"rules\":{\"all\":[{\"any\":[{\"field\":{\"dn\":\"*,ou=admin,dc=example,dc=com\ + \"}},{\"field\":{\"username\":[\"es-admin\",\"es-system\"]}}]},{\"field\":{\"groups\":\"cn=people,dc=example,dc=com\"}},{\"ex\ + cept\":{\"field\":{\"metadata.terminated_date\":null}}}]}}' \"$ELASTICSEARCH_URL/_security/role_mapping/mapping8\"" diff --git a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample9.yaml b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample9.yaml index 2551397f52..e46aa0c91c 100644 --- a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample9.yaml +++ b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample9.yaml @@ -1,9 +1,10 @@ summary: Templated roles method_request: POST /_security/role_mapping/mapping9 description: > - Run `POST /_security/role_mapping/mapping9` to use templated roles to automatically map every user to their own custom role. - In this example every user who authenticates using the `cloud-saml` realm will be automatically mapped to two roles: the `saml_user` role and a role that is their username prefixed with `_user_`. - For example, the user `nwong` would be assigned the `saml_user` and `_user_nwong` roles. + Run `POST /_security/role_mapping/mapping9` to use templated roles to automatically map every user to their own custom role. In + this example every user who authenticates using the `cloud-saml` realm will be automatically mapped to two roles: the `saml_user` + role and a role that is their username prefixed with `_user_`. For example, the user `nwong` would be assigned the `saml_user` and + `_user_nwong` roles. # type: request value: |- { @@ -14,3 +15,105 @@ value: |- ], "enabled": true } +alternatives: + - language: Python + code: |- + resp = client.security.put_role_mapping( + name="mapping9", + rules={ + "field": { + "realm.name": "cloud-saml" + } + }, + role_templates=[ + { + "template": { + "source": "saml_user" + } + }, + { + "template": { + "source": "_user_{{username}}" + } + } + ], + enabled=True, + ) + - language: JavaScript + code: |- + const response = await client.security.putRoleMapping({ + name: "mapping9", + rules: { + field: { + "realm.name": "cloud-saml", + }, + }, + role_templates: [ + { + template: { + source: "saml_user", + }, + }, + { + template: { + source: "_user_{{username}}", + }, + }, + ], + enabled: true, + }); + - language: Ruby + code: |- + response = client.security.put_role_mapping( + name: "mapping9", + body: { + "rules": { + "field": { + "realm.name": "cloud-saml" + } + }, + "role_templates": [ + { + "template": { + "source": "saml_user" + } + }, + { + "template": { + "source": "_user_{{username}}" + } + } + ], + "enabled": true + } + ) + - language: PHP + code: |- + $resp = $client->security()->putRoleMapping([ + "name" => "mapping9", + "body" => [ + "rules" => [ + "field" => [ + "realm.name" => "cloud-saml", + ], + ], + "role_templates" => array( + [ + "template" => [ + "source" => "saml_user", + ], + ], + [ + "template" => [ + "source" => "_user_{{username}}", + ], + ], + ), + "enabled" => true, + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"rules\":{\"field\":{\"realm.name\":\"cloud-saml\"}},\"role_templates\":[{\"template\":{\"source\":\"saml_user\"}},{\"temp\ + late\":{\"source\":\"_user_{{username}}\"}}],\"enabled\":true}' \"$ELASTICSEARCH_URL/_security/role_mapping/mapping9\"" diff --git a/specification/security/put_user/examples/request/SecurityPutUserRequestExample1.yaml b/specification/security/put_user/examples/request/SecurityPutUserRequestExample1.yaml index 5d14f8d8ba..50cd7da5b5 100644 --- a/specification/security/put_user/examples/request/SecurityPutUserRequestExample1.yaml +++ b/specification/security/put_user/examples/request/SecurityPutUserRequestExample1.yaml @@ -12,3 +12,71 @@ value: |- "intelligence" : 7 } } +alternatives: + - language: Python + code: |- + resp = client.security.put_user( + username="jacknich", + password="l0ng-r4nd0m-p@ssw0rd", + roles=[ + "admin", + "other_role1" + ], + full_name="Jack Nicholson", + email="jacknich@example.com", + metadata={ + "intelligence": 7 + }, + ) + - language: JavaScript + code: |- + const response = await client.security.putUser({ + username: "jacknich", + password: "l0ng-r4nd0m-p@ssw0rd", + roles: ["admin", "other_role1"], + full_name: "Jack Nicholson", + email: "jacknich@example.com", + metadata: { + intelligence: 7, + }, + }); + - language: Ruby + code: |- + response = client.security.put_user( + username: "jacknich", + body: { + "password": "l0ng-r4nd0m-p@ssw0rd", + "roles": [ + "admin", + "other_role1" + ], + "full_name": "Jack Nicholson", + "email": "jacknich@example.com", + "metadata": { + "intelligence": 7 + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->putUser([ + "username" => "jacknich", + "body" => [ + "password" => "l0ng-r4nd0m-p@ssw0rd", + "roles" => array( + "admin", + "other_role1", + ), + "full_name" => "Jack Nicholson", + "email" => "jacknich@example.com", + "metadata" => [ + "intelligence" => 7, + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"password":"l0ng-r4nd0m-p@ssw0rd","roles":["admin","other_role1"],"full_name":"Jack + Nicholson","email":"jacknich@example.com","metadata":{"intelligence":7}}'' + "$ELASTICSEARCH_URL/_security/user/jacknich"' diff --git a/specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample1.yaml b/specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample1.yaml index 8a41ec3283..cc28952d41 100644 --- a/specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample1.yaml +++ b/specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample1.yaml @@ -12,3 +12,59 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.security.query_api_keys( + with_limited_by=True, + query={ + "ids": { + "values": [ + "VuaCfGcBCdbkQm-e5aOx" + ] + } + }, + ) + - language: JavaScript + code: |- + const response = await client.security.queryApiKeys({ + with_limited_by: "true", + query: { + ids: { + values: ["VuaCfGcBCdbkQm-e5aOx"], + }, + }, + }); + - language: Ruby + code: |- + response = client.security.query_api_keys( + with_limited_by: "true", + body: { + "query": { + "ids": { + "values": [ + "VuaCfGcBCdbkQm-e5aOx" + ] + } + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->queryApiKeys([ + "with_limited_by" => "true", + "body" => [ + "query" => [ + "ids" => [ + "values" => array( + "VuaCfGcBCdbkQm-e5aOx", + ), + ], + ], + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"query":{"ids":{"values":["VuaCfGcBCdbkQm-e5aOx"]}}}'' + "$ELASTICSEARCH_URL/_security/_query/api_key?with_limited_by=true"' diff --git a/specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample2.yaml b/specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample2.yaml index 82275261e5..8f3866d3cc 100644 --- a/specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample2.yaml +++ b/specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample2.yaml @@ -1,12 +1,10 @@ summary: Query API keys with pagination method_request: GET /_security/_query/api_key description: > - Run `GET /_security/_query/api_key`. - Use a `bool` query to issue complex logical conditions and use `from`, `size`, and `sort` to help paginate the result. - For example, the API key name must begin with `app1-key-` and must not be `app1-key-01`. - It must be owned by a username with the wildcard pattern `org-*-user` and the `environment` metadata field must have a `production` value. - The offset to begin the search result is the twentieth (zero-based index) API key. - The page size of the response is 10 API keys. + Run `GET /_security/_query/api_key`. Use a `bool` query to issue complex logical conditions and use `from`, `size`, and `sort` to + help paginate the result. For example, the API key name must begin with `app1-key-` and must not be `app1-key-01`. It must be + owned by a username with the wildcard pattern `org-*-user` and the `environment` metadata field must have a `production` value. + The offset to begin the search result is the twentieth (zero-based index) API key. The page size of the response is 10 API keys. The result is first sorted by creation date in descending order, then by name in ascending order. # type: request value: |- @@ -53,3 +51,215 @@ value: |- "name" ] } +alternatives: + - language: Python + code: |- + resp = client.security.query_api_keys( + query={ + "bool": { + "must": [ + { + "prefix": { + "name": "app1-key-" + } + }, + { + "term": { + "invalidated": "false" + } + } + ], + "must_not": [ + { + "term": { + "name": "app1-key-01" + } + } + ], + "filter": [ + { + "wildcard": { + "username": "org-*-user" + } + }, + { + "term": { + "metadata.environment": "production" + } + } + ] + } + }, + from=20, + size=10, + sort=[ + { + "creation": { + "order": "desc", + "format": "date_time" + } + }, + "name" + ], + ) + - language: JavaScript + code: |- + const response = await client.security.queryApiKeys({ + query: { + bool: { + must: [ + { + prefix: { + name: "app1-key-", + }, + }, + { + term: { + invalidated: "false", + }, + }, + ], + must_not: [ + { + term: { + name: "app1-key-01", + }, + }, + ], + filter: [ + { + wildcard: { + username: "org-*-user", + }, + }, + { + term: { + "metadata.environment": "production", + }, + }, + ], + }, + }, + from: 20, + size: 10, + sort: [ + { + creation: { + order: "desc", + format: "date_time", + }, + }, + "name", + ], + }); + - language: Ruby + code: |- + response = client.security.query_api_keys( + body: { + "query": { + "bool": { + "must": [ + { + "prefix": { + "name": "app1-key-" + } + }, + { + "term": { + "invalidated": "false" + } + } + ], + "must_not": [ + { + "term": { + "name": "app1-key-01" + } + } + ], + "filter": [ + { + "wildcard": { + "username": "org-*-user" + } + }, + { + "term": { + "metadata.environment": "production" + } + } + ] + } + }, + "from": 20, + "size": 10, + "sort": [ + { + "creation": { + "order": "desc", + "format": "date_time" + } + }, + "name" + ] + } + ) + - language: PHP + code: |- + $resp = $client->security()->queryApiKeys([ + "body" => [ + "query" => [ + "bool" => [ + "must" => array( + [ + "prefix" => [ + "name" => "app1-key-", + ], + ], + [ + "term" => [ + "invalidated" => "false", + ], + ], + ), + "must_not" => array( + [ + "term" => [ + "name" => "app1-key-01", + ], + ], + ), + "filter" => array( + [ + "wildcard" => [ + "username" => "org-*-user", + ], + ], + [ + "term" => [ + "metadata.environment" => "production", + ], + ], + ), + ], + ], + "from" => 20, + "size" => 10, + "sort" => array( + [ + "creation" => [ + "order" => "desc", + "format" => "date_time", + ], + ], + "name", + ), + ], + ]); + - language: curl + code: + "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"query\":{\"bool\":{\"must\":[{\"prefix\":{\"name\":\"app1-key-\"}},{\"term\":{\"invalidated\":\"false\"}}],\"must_not\":[{\ + \"term\":{\"name\":\"app1-key-01\"}}],\"filter\":[{\"wildcard\":{\"username\":\"org-*-user\"}},{\"term\":{\"metadata.environm\ + ent\":\"production\"}}]}},\"from\":20,\"size\":10,\"sort\":[{\"creation\":{\"order\":\"desc\",\"format\":\"date_time\"}},\"na\ + me\"]}' \"$ELASTICSEARCH_URL/_security/_query/api_key\"" diff --git a/specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample3.yaml b/specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample3.yaml index 8e572b2192..3de94c849f 100644 --- a/specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample3.yaml +++ b/specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample3.yaml @@ -12,3 +12,56 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.security.query_api_keys( + query={ + "term": { + "name": { + "value": "application-key-1" + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.security.queryApiKeys({ + query: { + term: { + name: { + value: "application-key-1", + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.security.query_api_keys( + body: { + "query": { + "term": { + "name": { + "value": "application-key-1" + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->queryApiKeys([ + "body" => [ + "query" => [ + "term" => [ + "name" => [ + "value" => "application-key-1", + ], + ], + ], + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"query":{"term":{"name":{"value":"application-key-1"}}}}'' "$ELASTICSEARCH_URL/_security/_query/api_key"' diff --git a/specification/security/query_role/examples/request/QueryRolesRequestExample1.yaml b/specification/security/query_role/examples/request/QueryRolesRequestExample1.yaml index 922ce173cd..1f891fefb1 100644 --- a/specification/security/query_role/examples/request/QueryRolesRequestExample1.yaml +++ b/specification/security/query_role/examples/request/QueryRolesRequestExample1.yaml @@ -6,3 +6,38 @@ value: |- { "sort": ["name"] } +alternatives: + - language: Python + code: |- + resp = client.security.query_role( + sort=[ + "name" + ], + ) + - language: JavaScript + code: |- + const response = await client.security.queryRole({ + sort: ["name"], + }); + - language: Ruby + code: |- + response = client.security.query_role( + body: { + "sort": [ + "name" + ] + } + ) + - language: PHP + code: |- + $resp = $client->security()->queryRole([ + "body" => [ + "sort" => array( + "name", + ), + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"sort":["name"]}'' + "$ELASTICSEARCH_URL/_security/_query/role"' diff --git a/specification/security/query_role/examples/request/QueryRolesRequestExample2.yaml b/specification/security/query_role/examples/request/QueryRolesRequestExample2.yaml index 0e4824fcc1..7f6b4c1cac 100644 --- a/specification/security/query_role/examples/request/QueryRolesRequestExample2.yaml +++ b/specification/security/query_role/examples/request/QueryRolesRequestExample2.yaml @@ -1,8 +1,8 @@ summary: Query roles by description method_request: POST /_security/_query/role description: > - Run `POST /_security/_query/role` to query only the user access role, given its description. - It returns only the best matching role because `size` is set to `1`. + Run `POST /_security/_query/role` to query only the user access role, given its description. It returns only the best matching + role because `size` is set to `1`. # type: request value: |- { @@ -15,3 +15,61 @@ value: |- }, "size": 1 } +alternatives: + - language: Python + code: |- + resp = client.security.query_role( + query={ + "match": { + "description": { + "query": "user access" + } + } + }, + size=1, + ) + - language: JavaScript + code: |- + const response = await client.security.queryRole({ + query: { + match: { + description: { + query: "user access", + }, + }, + }, + size: 1, + }); + - language: Ruby + code: |- + response = client.security.query_role( + body: { + "query": { + "match": { + "description": { + "query": "user access" + } + } + }, + "size": 1 + } + ) + - language: PHP + code: |- + $resp = $client->security()->queryRole([ + "body" => [ + "query" => [ + "match" => [ + "description" => [ + "query" => "user access", + ], + ], + ], + "size" => 1, + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"query":{"match":{"description":{"query":"user access"}}},"size":1}'' + "$ELASTICSEARCH_URL/_security/_query/role"' diff --git a/specification/security/query_user/examples/request/SecurityQueryUserRequestExample1.yaml b/specification/security/query_user/examples/request/SecurityQueryUserRequestExample1.yaml index 0ebe993cc1..d70f3eb41d 100644 --- a/specification/security/query_user/examples/request/SecurityQueryUserRequestExample1.yaml +++ b/specification/security/query_user/examples/request/SecurityQueryUserRequestExample1.yaml @@ -1,8 +1,8 @@ summary: Query users by role prefix method_request: POST /_security/_query/user?with_profile_uid=true description: > - Run `POST /_security/_query/user?with_profile_uid=true` to get users that have roles that are prefixed with `other`. - It will also include the user `profile_uid` in the response. + Run `POST /_security/_query/user?with_profile_uid=true` to get users that have roles that are prefixed with `other`. It will also + include the user `profile_uid` in the response. # type: request value: |- { @@ -12,3 +12,52 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.security.query_user( + with_profile_uid=True, + query={ + "prefix": { + "roles": "other" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.security.queryUser({ + with_profile_uid: "true", + query: { + prefix: { + roles: "other", + }, + }, + }); + - language: Ruby + code: |- + response = client.security.query_user( + with_profile_uid: "true", + body: { + "query": { + "prefix": { + "roles": "other" + } + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->queryUser([ + "with_profile_uid" => "true", + "body" => [ + "query" => [ + "prefix" => [ + "roles" => "other", + ], + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"query":{"prefix":{"roles":"other"}}}'' "$ELASTICSEARCH_URL/_security/_query/user?with_profile_uid=true"' diff --git a/specification/security/query_user/examples/request/SecurityQueryUserRequestExample2.yaml b/specification/security/query_user/examples/request/SecurityQueryUserRequestExample2.yaml index 2ebb408b2c..8eb102180e 100644 --- a/specification/security/query_user/examples/request/SecurityQueryUserRequestExample2.yaml +++ b/specification/security/query_user/examples/request/SecurityQueryUserRequestExample2.yaml @@ -1,14 +1,10 @@ summary: Query users with multiple conditions method_request: POST /_security/_query/user description: > - Run `POST /_security/_query/user`. - Use a `bool` query to issue complex logical conditions: - The `email` must end with `example.com`. - The user must be enabled. - The result will be filtered to only contain users with at least one role that contains the substring `other`. - The offset to begin the search result is the second (zero-based index) user. - The page size of the response is two users. - The result is sorted by `username` in descending order. + Run `POST /_security/_query/user`. Use a `bool` query to issue complex logical conditions: The `email` must end with + `example.com`. The user must be enabled. The result will be filtered to only contain users with at least one role that contains + the substring `other`. The offset to begin the search result is the second (zero-based index) user. The page size of the response + is two users. The result is sorted by `username` in descending order. # type: request value: |- { @@ -41,3 +37,158 @@ value: |- { "username": { "order": "desc"} } ] } +alternatives: + - language: Python + code: |- + resp = client.security.query_user( + query={ + "bool": { + "must": [ + { + "wildcard": { + "email": "*example.com" + } + }, + { + "term": { + "enabled": True + } + } + ], + "filter": [ + { + "wildcard": { + "roles": "*other*" + } + } + ] + } + }, + from=1, + size=2, + sort=[ + { + "username": { + "order": "desc" + } + } + ], + ) + - language: JavaScript + code: |- + const response = await client.security.queryUser({ + query: { + bool: { + must: [ + { + wildcard: { + email: "*example.com", + }, + }, + { + term: { + enabled: true, + }, + }, + ], + filter: [ + { + wildcard: { + roles: "*other*", + }, + }, + ], + }, + }, + from: 1, + size: 2, + sort: [ + { + username: { + order: "desc", + }, + }, + ], + }); + - language: Ruby + code: |- + response = client.security.query_user( + body: { + "query": { + "bool": { + "must": [ + { + "wildcard": { + "email": "*example.com" + } + }, + { + "term": { + "enabled": true + } + } + ], + "filter": [ + { + "wildcard": { + "roles": "*other*" + } + } + ] + } + }, + "from": 1, + "size": 2, + "sort": [ + { + "username": { + "order": "desc" + } + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->security()->queryUser([ + "body" => [ + "query" => [ + "bool" => [ + "must" => array( + [ + "wildcard" => [ + "email" => "*example.com", + ], + ], + [ + "term" => [ + "enabled" => true, + ], + ], + ), + "filter" => array( + [ + "wildcard" => [ + "roles" => "*other*", + ], + ], + ), + ], + ], + "from" => 1, + "size" => 2, + "sort" => array( + [ + "username" => [ + "order" => "desc", + ], + ], + ), + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"query\":{\"bool\":{\"must\":[{\"wildcard\":{\"email\":\"*example.com\"}},{\"term\":{\"enabled\":true}}],\"filter\":[{\"wi\ + ldcard\":{\"roles\":\"*other*\"}}]}},\"from\":1,\"size\":2,\"sort\":[{\"username\":{\"order\":\"desc\"}}]}' + \"$ELASTICSEARCH_URL/_security/_query/user\"" diff --git a/specification/security/saml_authenticate/examples/request/SamlAuthenticateRequestExample1.yaml b/specification/security/saml_authenticate/examples/request/SamlAuthenticateRequestExample1.yaml index df5f2bd865..0ec7232a66 100644 --- a/specification/security/saml_authenticate/examples/request/SamlAuthenticateRequestExample1.yaml +++ b/specification/security/saml_authenticate/examples/request/SamlAuthenticateRequestExample1.yaml @@ -1,10 +1,53 @@ # summary: method_request: POST /_security/saml/authenticate description: > - Run `POST /_security/saml/authenticate` to exchange a SAML Response indicating a successful authentication at the SAML IdP for an Elasticsearch access token and refresh token to be used in subsequent requests. + Run `POST /_security/saml/authenticate` to exchange a SAML Response indicating a successful authentication at the SAML IdP for an + Elasticsearch access token and refresh token to be used in subsequent requests. # type: request value: |- { "content" : "PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....", "ids" : ["4fee3b046395c4e751011e97f8900b5273d56685"] } +alternatives: + - language: Python + code: >- + resp = client.security.saml_authenticate( + content="PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....", + ids=[ + "4fee3b046395c4e751011e97f8900b5273d56685" + ], + ) + - language: JavaScript + code: >- + const response = await client.security.samlAuthenticate({ + content: + "PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....", + ids: ["4fee3b046395c4e751011e97f8900b5273d56685"], + }); + - language: Ruby + code: >- + response = client.security.saml_authenticate( + body: { + "content": "PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....", + "ids": [ + "4fee3b046395c4e751011e97f8900b5273d56685" + ] + } + ) + - language: PHP + code: >- + $resp = $client->security()->samlAuthenticate([ + "body" => [ + "content" => "PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....", + "ids" => array( + "4fee3b046395c4e751011e97f8900b5273d56685", + ), + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"content\":\"PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVyb\ + jpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....\",\"ids\":[\"4fee3b046395c4e751011e97f8900b5273d56685\"]}' + \"$ELASTICSEARCH_URL/_security/saml/authenticate\"" diff --git a/specification/security/saml_complete_logout/examples/request/SamlCompleteLogoutRequestExample1.yaml b/specification/security/saml_complete_logout/examples/request/SamlCompleteLogoutRequestExample1.yaml index a82f894279..25f91c2474 100644 --- a/specification/security/saml_complete_logout/examples/request/SamlCompleteLogoutRequestExample1.yaml +++ b/specification/security/saml_complete_logout/examples/request/SamlCompleteLogoutRequestExample1.yaml @@ -9,3 +9,49 @@ value: |- "ids": [ "_1c368075e0b3..." ], "query_string": "SAMLResponse=fZHLasMwEEVbfb1bf...&SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=CuCmFn%2BLqnaZGZJqK..." } +alternatives: + - language: Python + code: >- + resp = client.security.saml_complete_logout( + realm="saml1", + ids=[ + "_1c368075e0b3..." + ], + query_string="SAMLResponse=fZHLasMwEEVbfb1bf...&SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=CuCmFn%2BLqnaZGZJqK...", + ) + - language: JavaScript + code: >- + const response = await client.security.samlCompleteLogout({ + realm: "saml1", + ids: ["_1c368075e0b3..."], + query_string: + "SAMLResponse=fZHLasMwEEVbfb1bf...&SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=CuCmFn%2BLqnaZGZJqK...", + }); + - language: Ruby + code: >- + response = client.security.saml_complete_logout( + body: { + "realm": "saml1", + "ids": [ + "_1c368075e0b3..." + ], + "query_string": "SAMLResponse=fZHLasMwEEVbfb1bf...&SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=CuCmFn%2BLqnaZGZJqK..." + } + ) + - language: PHP + code: >- + $resp = $client->security()->samlCompleteLogout([ + "body" => [ + "realm" => "saml1", + "ids" => array( + "_1c368075e0b3...", + ), + "query_string" => "SAMLResponse=fZHLasMwEEVbfb1bf...&SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=CuCmFn%2BLqnaZGZJqK...", + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"realm\":\"saml1\",\"ids\":[\"_1c368075e0b3...\"],\"query_string\":\"SAMLResponse=fZHLasMwEEVbfb1bf...&SigAlg=http%3A%2F%2\ + Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=CuCmFn%2BLqnaZGZJqK...\"}' + \"$ELASTICSEARCH_URL/_security/saml/complete_logout\"" diff --git a/specification/security/saml_complete_logout/examples/request/SamlCompleteLogoutRequestExample2.yaml b/specification/security/saml_complete_logout/examples/request/SamlCompleteLogoutRequestExample2.yaml index 0e5aab05da..3f7ece2c10 100644 --- a/specification/security/saml_complete_logout/examples/request/SamlCompleteLogoutRequestExample2.yaml +++ b/specification/security/saml_complete_logout/examples/request/SamlCompleteLogoutRequestExample2.yaml @@ -9,3 +9,47 @@ value: |- "ids": [ "_1c368075e0b3..." ], "content": "PHNhbWxwOkxvZ291dFJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46..." } +alternatives: + - language: Python + code: |- + resp = client.security.saml_complete_logout( + realm="saml1", + ids=[ + "_1c368075e0b3..." + ], + content="PHNhbWxwOkxvZ291dFJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46...", + ) + - language: JavaScript + code: |- + const response = await client.security.samlCompleteLogout({ + realm: "saml1", + ids: ["_1c368075e0b3..."], + content: "PHNhbWxwOkxvZ291dFJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46...", + }); + - language: Ruby + code: |- + response = client.security.saml_complete_logout( + body: { + "realm": "saml1", + "ids": [ + "_1c368075e0b3..." + ], + "content": "PHNhbWxwOkxvZ291dFJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46..." + } + ) + - language: PHP + code: |- + $resp = $client->security()->samlCompleteLogout([ + "body" => [ + "realm" => "saml1", + "ids" => array( + "_1c368075e0b3...", + ), + "content" => "PHNhbWxwOkxvZ291dFJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46...", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"realm":"saml1","ids":["_1c368075e0b3..."],"content":"PHNhbWxwOkxvZ291dFJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46..."}'' + "$ELASTICSEARCH_URL/_security/saml/complete_logout"' diff --git a/specification/security/saml_invalidate/examples/request/SamlInvalidateRequestExample1.yaml b/specification/security/saml_invalidate/examples/request/SamlInvalidateRequestExample1.yaml index 97b5aa7be7..5a4b85ab69 100644 --- a/specification/security/saml_invalidate/examples/request/SamlInvalidateRequestExample1.yaml +++ b/specification/security/saml_invalidate/examples/request/SamlInvalidateRequestExample1.yaml @@ -1,10 +1,51 @@ # summary: method_request: POST /_security/saml/invalidate description: > - Run `POST /_security/saml/invalidate` to invalidate all the tokens for realm `saml1` pertaining to the user that is identified in the SAML Logout Request. + Run `POST /_security/saml/invalidate` to invalidate all the tokens for realm `saml1` pertaining to the user that is identified in + the SAML Logout Request. # type: request value: |- { "query_string" : "SAMLRequest=nZFda4MwFIb%2FiuS%2BmviRpqFaClKQdbvo2g12M2KMraCJ9cRR9utnW4Wyi13sMie873MeznJ1aWrnS3VQGR0j4mLkKC1NUeljjA77zYyhVbIE0dR%2By7fmaHq7U%2BdegXWGpAZ%2B%2F4pR32luBFTAtWgUcCv56%2Fp5y30X87Yz1khTIycdgpUW9kY7WdsC9zxoXTvMvWuVV98YyMnSGH2SYE5pwALBIr9QKiwDGpW0oGVUznGeMyJZKFkQ4jBf5HnhUymjIhzCAL3KNFihbYx8TBYzzGaY7EnIyZwHzCWMfiDnbRIftkSjJr%2BFu0e9v%2B0EgOquRiiZjKpiVFp6j50T4WXoyNJ%2FEWC9fdqc1t%2F1%2B2F3aUpjzhPiXpqMz1%2FHSn4A&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256&Signature=MsAYz2NFdovMG2mXf6TSpu5vlQQyEJAg%2B4KCwBqJTmrb3yGXKUtIgvjqf88eCAK32v3eN8vupjPC8LglYmke1ZnjK0%2FKxzkvSjTVA7mMQe2AQdKbkyC038zzRq%2FYHcjFDE%2Bz0qISwSHZY2NyLePmwU7SexEXnIz37jKC6NMEhus%3D", "realm" : "saml1" } +alternatives: + - language: Python + code: >- + resp = client.security.saml_invalidate( + query_string="SAMLRequest=nZFda4MwFIb%2FiuS%2BmviRpqFaClKQdbvo2g12M2KMraCJ9cRR9utnW4Wyi13sMie873MeznJ1aWrnS3VQGR0j4mLkKC1NUeljjA77zYyhVbIE0dR%2By7fmaHq7U%2BdegXWGpAZ%2B%2F4pR32luBFTAtWgUcCv56%2Fp5y30X87Yz1khTIycdgpUW9kY7WdsC9zxoXTvMvWuVV98YyMnSGH2SYE5pwALBIr9QKiwDGpW0oGVUznGeMyJZKFkQ4jBf5HnhUymjIhzCAL3KNFihbYx8TBYzzGaY7EnIyZwHzCWMfiDnbRIftkSjJr%2BFu0e9v%2B0EgOquRiiZjKpiVFp6j50T4WXoyNJ%2FEWC9fdqc1t%2F1%2B2F3aUpjzhPiXpqMz1%2FHSn4A&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256&Signature=MsAYz2NFdovMG2mXf6TSpu5vlQQyEJAg%2B4KCwBqJTmrb3yGXKUtIgvjqf88eCAK32v3eN8vupjPC8LglYmke1ZnjK0%2FKxzkvSjTVA7mMQe2AQdKbkyC038zzRq%2FYHcjFDE%2Bz0qISwSHZY2NyLePmwU7SexEXnIz37jKC6NMEhus%3D", + realm="saml1", + ) + - language: JavaScript + code: >- + const response = await client.security.samlInvalidate({ + query_string: + "SAMLRequest=nZFda4MwFIb%2FiuS%2BmviRpqFaClKQdbvo2g12M2KMraCJ9cRR9utnW4Wyi13sMie873MeznJ1aWrnS3VQGR0j4mLkKC1NUeljjA77zYyhVbIE0dR%2By7fmaHq7U%2BdegXWGpAZ%2B%2F4pR32luBFTAtWgUcCv56%2Fp5y30X87Yz1khTIycdgpUW9kY7WdsC9zxoXTvMvWuVV98YyMnSGH2SYE5pwALBIr9QKiwDGpW0oGVUznGeMyJZKFkQ4jBf5HnhUymjIhzCAL3KNFihbYx8TBYzzGaY7EnIyZwHzCWMfiDnbRIftkSjJr%2BFu0e9v%2B0EgOquRiiZjKpiVFp6j50T4WXoyNJ%2FEWC9fdqc1t%2F1%2B2F3aUpjzhPiXpqMz1%2FHSn4A&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256&Signature=MsAYz2NFdovMG2mXf6TSpu5vlQQyEJAg%2B4KCwBqJTmrb3yGXKUtIgvjqf88eCAK32v3eN8vupjPC8LglYmke1ZnjK0%2FKxzkvSjTVA7mMQe2AQdKbkyC038zzRq%2FYHcjFDE%2Bz0qISwSHZY2NyLePmwU7SexEXnIz37jKC6NMEhus%3D", + realm: "saml1", + }); + - language: Ruby + code: >- + response = client.security.saml_invalidate( + body: { + "query_string": "SAMLRequest=nZFda4MwFIb%2FiuS%2BmviRpqFaClKQdbvo2g12M2KMraCJ9cRR9utnW4Wyi13sMie873MeznJ1aWrnS3VQGR0j4mLkKC1NUeljjA77zYyhVbIE0dR%2By7fmaHq7U%2BdegXWGpAZ%2B%2F4pR32luBFTAtWgUcCv56%2Fp5y30X87Yz1khTIycdgpUW9kY7WdsC9zxoXTvMvWuVV98YyMnSGH2SYE5pwALBIr9QKiwDGpW0oGVUznGeMyJZKFkQ4jBf5HnhUymjIhzCAL3KNFihbYx8TBYzzGaY7EnIyZwHzCWMfiDnbRIftkSjJr%2BFu0e9v%2B0EgOquRiiZjKpiVFp6j50T4WXoyNJ%2FEWC9fdqc1t%2F1%2B2F3aUpjzhPiXpqMz1%2FHSn4A&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256&Signature=MsAYz2NFdovMG2mXf6TSpu5vlQQyEJAg%2B4KCwBqJTmrb3yGXKUtIgvjqf88eCAK32v3eN8vupjPC8LglYmke1ZnjK0%2FKxzkvSjTVA7mMQe2AQdKbkyC038zzRq%2FYHcjFDE%2Bz0qISwSHZY2NyLePmwU7SexEXnIz37jKC6NMEhus%3D", + "realm": "saml1" + } + ) + - language: PHP + code: >- + $resp = $client->security()->samlInvalidate([ + "body" => [ + "query_string" => "SAMLRequest=nZFda4MwFIb%2FiuS%2BmviRpqFaClKQdbvo2g12M2KMraCJ9cRR9utnW4Wyi13sMie873MeznJ1aWrnS3VQGR0j4mLkKC1NUeljjA77zYyhVbIE0dR%2By7fmaHq7U%2BdegXWGpAZ%2B%2F4pR32luBFTAtWgUcCv56%2Fp5y30X87Yz1khTIycdgpUW9kY7WdsC9zxoXTvMvWuVV98YyMnSGH2SYE5pwALBIr9QKiwDGpW0oGVUznGeMyJZKFkQ4jBf5HnhUymjIhzCAL3KNFihbYx8TBYzzGaY7EnIyZwHzCWMfiDnbRIftkSjJr%2BFu0e9v%2B0EgOquRiiZjKpiVFp6j50T4WXoyNJ%2FEWC9fdqc1t%2F1%2B2F3aUpjzhPiXpqMz1%2FHSn4A&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256&Signature=MsAYz2NFdovMG2mXf6TSpu5vlQQyEJAg%2B4KCwBqJTmrb3yGXKUtIgvjqf88eCAK32v3eN8vupjPC8LglYmke1ZnjK0%2FKxzkvSjTVA7mMQe2AQdKbkyC038zzRq%2FYHcjFDE%2Bz0qISwSHZY2NyLePmwU7SexEXnIz37jKC6NMEhus%3D", + "realm" => "saml1", + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"query_string\":\"SAMLRequest=nZFda4MwFIb%2FiuS%2BmviRpqFaClKQdbvo2g12M2KMraCJ9cRR9utnW4Wyi13sMie873MeznJ1aWrnS3VQGR0j4mLk\ + KC1NUeljjA77zYyhVbIE0dR%2By7fmaHq7U%2BdegXWGpAZ%2B%2F4pR32luBFTAtWgUcCv56%2Fp5y30X87Yz1khTIycdgpUW9kY7WdsC9zxoXTvMvWuVV98YyMn\ + SGH2SYE5pwALBIr9QKiwDGpW0oGVUznGeMyJZKFkQ4jBf5HnhUymjIhzCAL3KNFihbYx8TBYzzGaY7EnIyZwHzCWMfiDnbRIftkSjJr%2BFu0e9v%2B0EgOquRiiZ\ + jKpiVFp6j50T4WXoyNJ%2FEWC9fdqc1t%2F1%2B2F3aUpjzhPiXpqMz1%2FHSn4A&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23\ + rsa-sha256&Signature=MsAYz2NFdovMG2mXf6TSpu5vlQQyEJAg%2B4KCwBqJTmrb3yGXKUtIgvjqf88eCAK32v3eN8vupjPC8LglYmke1ZnjK0%2FKxzkvSjTV\ + A7mMQe2AQdKbkyC038zzRq%2FYHcjFDE%2Bz0qISwSHZY2NyLePmwU7SexEXnIz37jKC6NMEhus%3D\",\"realm\":\"saml1\"}' + \"$ELASTICSEARCH_URL/_security/saml/invalidate\"" diff --git a/specification/security/saml_logout/examples/request/SamlLogoutRequestExample1.yaml b/specification/security/saml_logout/examples/request/SamlLogoutRequestExample1.yaml index e22d071f83..6c081d9dc9 100644 --- a/specification/security/saml_logout/examples/request/SamlLogoutRequestExample1.yaml +++ b/specification/security/saml_logout/examples/request/SamlLogoutRequestExample1.yaml @@ -1,10 +1,45 @@ # summary: method_request: POST /_security/saml/logout description: > - Run `POST /_security/saml/logout` to invalidate the pair of tokens that were generated by calling the SAML authenticate API with a successful SAML response. + Run `POST /_security/saml/logout` to invalidate the pair of tokens that were generated by calling the SAML authenticate API with a + successful SAML response. # type: request value: |- { "token" : "46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3", "refresh_token" : "mJdXLtmvTUSpoLwMvdBt_w" } +alternatives: + - language: Python + code: |- + resp = client.security.saml_logout( + token="46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3", + refresh_token="mJdXLtmvTUSpoLwMvdBt_w", + ) + - language: JavaScript + code: |- + const response = await client.security.samlLogout({ + token: "46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3", + refresh_token: "mJdXLtmvTUSpoLwMvdBt_w", + }); + - language: Ruby + code: |- + response = client.security.saml_logout( + body: { + "token": "46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3", + "refresh_token": "mJdXLtmvTUSpoLwMvdBt_w" + } + ) + - language: PHP + code: |- + $resp = $client->security()->samlLogout([ + "body" => [ + "token" => "46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3", + "refresh_token" => "mJdXLtmvTUSpoLwMvdBt_w", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"token":"46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3","refresh_token":"mJdXLtmvTUSpoLwMvdBt_w"}'' + "$ELASTICSEARCH_URL/_security/saml/logout"' diff --git a/specification/security/saml_prepare_authentication/examples/request/SamlPrepareAuthenticationRequestExample1.yaml b/specification/security/saml_prepare_authentication/examples/request/SamlPrepareAuthenticationRequestExample1.yaml index 04d4820ecf..0a0e4d41e0 100644 --- a/specification/security/saml_prepare_authentication/examples/request/SamlPrepareAuthenticationRequestExample1.yaml +++ b/specification/security/saml_prepare_authentication/examples/request/SamlPrepareAuthenticationRequestExample1.yaml @@ -7,3 +7,32 @@ value: |- { "realm" : "saml1" } +alternatives: + - language: Python + code: |- + resp = client.security.saml_prepare_authentication( + realm="saml1", + ) + - language: JavaScript + code: |- + const response = await client.security.samlPrepareAuthentication({ + realm: "saml1", + }); + - language: Ruby + code: |- + response = client.security.saml_prepare_authentication( + body: { + "realm": "saml1" + } + ) + - language: PHP + code: |- + $resp = $client->security()->samlPrepareAuthentication([ + "body" => [ + "realm" => "saml1", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"realm":"saml1"}'' + "$ELASTICSEARCH_URL/_security/saml/prepare"' diff --git a/specification/security/saml_prepare_authentication/examples/request/SamlPrepareAuthenticationRequestExample2.yaml b/specification/security/saml_prepare_authentication/examples/request/SamlPrepareAuthenticationRequestExample2.yaml index d6fb872881..28494ffa37 100644 --- a/specification/security/saml_prepare_authentication/examples/request/SamlPrepareAuthenticationRequestExample2.yaml +++ b/specification/security/saml_prepare_authentication/examples/request/SamlPrepareAuthenticationRequestExample2.yaml @@ -1,9 +1,39 @@ summary: Prepare with an ACS method_request: POST /_security/saml/prepare description: > - Run `POST /_security/saml/prepare` to generate a SAML authentication request for the SAML realm with an Assertion Consuming Service (ACS) URL. + Run `POST /_security/saml/prepare` to generate a SAML authentication request for the SAML realm with an Assertion Consuming + Service (ACS) URL. # type: request value: |- { "acs" : "https://kibana.org/api/security/saml/callback" } +alternatives: + - language: Python + code: |- + resp = client.security.saml_prepare_authentication( + acs="https://kibana.org/api/security/saml/callback", + ) + - language: JavaScript + code: |- + const response = await client.security.samlPrepareAuthentication({ + acs: "https://kibana.org/api/security/saml/callback", + }); + - language: Ruby + code: |- + response = client.security.saml_prepare_authentication( + body: { + "acs": "https://kibana.org/api/security/saml/callback" + } + ) + - language: PHP + code: |- + $resp = $client->security()->samlPrepareAuthentication([ + "body" => [ + "acs" => "https://kibana.org/api/security/saml/callback", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"acs":"https://kibana.org/api/security/saml/callback"}'' "$ELASTICSEARCH_URL/_security/saml/prepare"' diff --git a/specification/security/saml_service_provider_metadata/examples/request/SamlServiceProviderMetadataRequestExample1.yaml b/specification/security/saml_service_provider_metadata/examples/request/SamlServiceProviderMetadataRequestExample1.yaml index d19fa7f868..9ddbc9ba31 100644 --- a/specification/security/saml_service_provider_metadata/examples/request/SamlServiceProviderMetadataRequestExample1.yaml +++ b/specification/security/saml_service_provider_metadata/examples/request/SamlServiceProviderMetadataRequestExample1.yaml @@ -1 +1,25 @@ method_request: POST /_security/profile/u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0/_data +alternatives: + - language: Python + code: |- + resp = client.security.update_user_profile_data( + uid="u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0", + ) + - language: JavaScript + code: |- + const response = await client.security.updateUserProfileData({ + uid: "u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0", + }); + - language: Ruby + code: |- + response = client.security.update_user_profile_data( + uid: "u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0" + ) + - language: PHP + code: |- + $resp = $client->security()->updateUserProfileData([ + "uid" => "u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_security/profile/u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0/_data"' diff --git a/specification/security/suggest_user_profiles/examples/request/SuggestUserProfilesRequestExample1.yaml b/specification/security/suggest_user_profiles/examples/request/SuggestUserProfilesRequestExample1.yaml index 60a125d813..519860ec84 100644 --- a/specification/security/suggest_user_profiles/examples/request/SuggestUserProfilesRequestExample1.yaml +++ b/specification/security/suggest_user_profiles/examples/request/SuggestUserProfilesRequestExample1.yaml @@ -1,9 +1,9 @@ # summary: method_request: POST /_security/profile/_suggest description: > - Run `POST /_security/profile/_suggest` to get suggestions for profile documents with name-related fields matching `jack`. - It specifies both `uids` and `labels` hints for better relevance. - The `labels` hint ranks profiles higher if their `direction` label matches either `north` or `east`. + Run `POST /_security/profile/_suggest` to get suggestions for profile documents with name-related fields matching `jack`. It + specifies both `uids` and `labels` hints for better relevance. The `labels` hint ranks profiles higher if their `direction` label + matches either `north` or `east`. # type: request value: |- { @@ -18,3 +18,78 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.security.suggest_user_profiles( + name="jack", + hint={ + "uids": [ + "u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0", + "u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0" + ], + "labels": { + "direction": [ + "north", + "east" + ] + } + }, + ) + - language: JavaScript + code: |- + const response = await client.security.suggestUserProfiles({ + name: "jack", + hint: { + uids: [ + "u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0", + "u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0", + ], + labels: { + direction: ["north", "east"], + }, + }, + }); + - language: Ruby + code: |- + response = client.security.suggest_user_profiles( + body: { + "name": "jack", + "hint": { + "uids": [ + "u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0", + "u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0" + ], + "labels": { + "direction": [ + "north", + "east" + ] + } + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->suggestUserProfiles([ + "body" => [ + "name" => "jack", + "hint" => [ + "uids" => array( + "u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0", + "u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0", + ), + "labels" => [ + "direction" => array( + "north", + "east", + ), + ], + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"name\":\"jack\",\"hint\":{\"uids\":[\"u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0\",\"u_79HkWkwmnBH5gqFKwoxggWPjEBOur\ + 1zLPXQPEl1VBW0_0\"],\"labels\":{\"direction\":[\"north\",\"east\"]}}}' \"$ELASTICSEARCH_URL/_security/profile/_suggest\"" diff --git a/specification/security/update_api_key/examples/request/UpdateApiKeyRequestExample1.yaml b/specification/security/update_api_key/examples/request/UpdateApiKeyRequestExample1.yaml index f2fa4492bd..462eb35033 100644 --- a/specification/security/update_api_key/examples/request/UpdateApiKeyRequestExample1.yaml +++ b/specification/security/update_api_key/examples/request/UpdateApiKeyRequestExample1.yaml @@ -23,3 +23,119 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.security.update_api_key( + id="VuaCfGcBCdbkQm-e5aOx", + role_descriptors={ + "role-a": { + "indices": [ + { + "names": [ + "*" + ], + "privileges": [ + "write" + ] + } + ] + } + }, + metadata={ + "environment": { + "level": 2, + "trusted": True, + "tags": [ + "production" + ] + } + }, + ) + - language: JavaScript + code: |- + const response = await client.security.updateApiKey({ + id: "VuaCfGcBCdbkQm-e5aOx", + role_descriptors: { + "role-a": { + indices: [ + { + names: ["*"], + privileges: ["write"], + }, + ], + }, + }, + metadata: { + environment: { + level: 2, + trusted: true, + tags: ["production"], + }, + }, + }); + - language: Ruby + code: |- + response = client.security.update_api_key( + id: "VuaCfGcBCdbkQm-e5aOx", + body: { + "role_descriptors": { + "role-a": { + "indices": [ + { + "names": [ + "*" + ], + "privileges": [ + "write" + ] + } + ] + } + }, + "metadata": { + "environment": { + "level": 2, + "trusted": true, + "tags": [ + "production" + ] + } + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->updateApiKey([ + "id" => "VuaCfGcBCdbkQm-e5aOx", + "body" => [ + "role_descriptors" => [ + "role-a" => [ + "indices" => array( + [ + "names" => array( + "*", + ), + "privileges" => array( + "write", + ), + ], + ), + ], + ], + "metadata" => [ + "environment" => [ + "level" => 2, + "trusted" => true, + "tags" => array( + "production", + ), + ], + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"role_descriptors\":{\"role-a\":{\"indices\":[{\"names\":[\"*\"],\"privileges\":[\"write\"]}]}},\"metadata\":{\"environment\ + \":{\"level\":2,\"trusted\":true,\"tags\":[\"production\"]}}}' \"$ELASTICSEARCH_URL/_security/api_key/VuaCfGcBCdbkQm-e5aOx\"" diff --git a/specification/security/update_api_key/examples/request/UpdateApiKeyRequestExample2.yaml b/specification/security/update_api_key/examples/request/UpdateApiKeyRequestExample2.yaml index 820555174f..d2f488d2a0 100644 --- a/specification/security/update_api_key/examples/request/UpdateApiKeyRequestExample2.yaml +++ b/specification/security/update_api_key/examples/request/UpdateApiKeyRequestExample2.yaml @@ -1,10 +1,43 @@ summary: Remove permissions method_request: PUT /_security/api_key/VuaCfGcBCdbkQm-e5aOx description: > - Run `PUT /_security/api_key/VuaCfGcBCdbkQm-e5aOx` to remove the API key's previously assigned permissions. - It will inherit the owner user's full permissions. + Run `PUT /_security/api_key/VuaCfGcBCdbkQm-e5aOx` to remove the API key's previously assigned permissions. It will inherit the + owner user's full permissions. # type: request value: |- { "role_descriptors": {} } +alternatives: + - language: Python + code: |- + resp = client.security.update_api_key( + id="VuaCfGcBCdbkQm-e5aOx", + role_descriptors={}, + ) + - language: JavaScript + code: |- + const response = await client.security.updateApiKey({ + id: "VuaCfGcBCdbkQm-e5aOx", + role_descriptors: {}, + }); + - language: Ruby + code: |- + response = client.security.update_api_key( + id: "VuaCfGcBCdbkQm-e5aOx", + body: { + "role_descriptors": {} + } + ) + - language: PHP + code: |- + $resp = $client->security()->updateApiKey([ + "id" => "VuaCfGcBCdbkQm-e5aOx", + "body" => [ + "role_descriptors" => new ArrayObject([]), + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"role_descriptors":{}}'' "$ELASTICSEARCH_URL/_security/api_key/VuaCfGcBCdbkQm-e5aOx"' diff --git a/specification/security/update_cross_cluster_api_key/examples/request/UpdateCrossClusterApiKeyRequestExample1.yaml b/specification/security/update_cross_cluster_api_key/examples/request/UpdateCrossClusterApiKeyRequestExample1.yaml index 6316b68079..f5b1092dd7 100644 --- a/specification/security/update_cross_cluster_api_key/examples/request/UpdateCrossClusterApiKeyRequestExample1.yaml +++ b/specification/security/update_cross_cluster_api_key/examples/request/UpdateCrossClusterApiKeyRequestExample1.yaml @@ -1,7 +1,8 @@ # summary: method_request: PUT /_security/cross_cluster/api_key/VuaCfGcBCdbkQm-e5aOx description: > - Run `PUT /_security/cross_cluster/api_key/VuaCfGcBCdbkQm-e5aOx` to update a cross-cluster API key, assigning it new access scope and metadata. + Run `PUT /_security/cross_cluster/api_key/VuaCfGcBCdbkQm-e5aOx` to update a cross-cluster API key, assigning it new access scope + and metadata. # type: request value: |- { @@ -16,3 +17,79 @@ value: |- "application": "replication" } } +alternatives: + - language: Python + code: |- + resp = client.security.update_cross_cluster_api_key( + id="VuaCfGcBCdbkQm-e5aOx", + access={ + "replication": [ + { + "names": [ + "archive" + ] + } + ] + }, + metadata={ + "application": "replication" + }, + ) + - language: JavaScript + code: |- + const response = await client.security.updateCrossClusterApiKey({ + id: "VuaCfGcBCdbkQm-e5aOx", + access: { + replication: [ + { + names: ["archive"], + }, + ], + }, + metadata: { + application: "replication", + }, + }); + - language: Ruby + code: |- + response = client.security.update_cross_cluster_api_key( + id: "VuaCfGcBCdbkQm-e5aOx", + body: { + "access": { + "replication": [ + { + "names": [ + "archive" + ] + } + ] + }, + "metadata": { + "application": "replication" + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->updateCrossClusterApiKey([ + "id" => "VuaCfGcBCdbkQm-e5aOx", + "body" => [ + "access" => [ + "replication" => array( + [ + "names" => array( + "archive", + ), + ], + ), + ], + "metadata" => [ + "application" => "replication", + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"access":{"replication":[{"names":["archive"]}]},"metadata":{"application":"replication"}}'' + "$ELASTICSEARCH_URL/_security/cross_cluster/api_key/VuaCfGcBCdbkQm-e5aOx"' diff --git a/specification/security/update_settings/examples/request/SecurityUpdateSettingsRequestExample1.yaml b/specification/security/update_settings/examples/request/SecurityUpdateSettingsRequestExample1.yaml index 469d1ea0c9..2d18a88449 100644 --- a/specification/security/update_settings/examples/request/SecurityUpdateSettingsRequestExample1.yaml +++ b/specification/security/update_settings/examples/request/SecurityUpdateSettingsRequestExample1.yaml @@ -14,3 +14,65 @@ value: |- "index.auto_expand_replicas": "0-all" } } +alternatives: + - language: Python + code: |- + resp = client.security.update_settings( + security={ + "index.auto_expand_replicas": "0-all" + }, + security-tokens={ + "index.auto_expand_replicas": "0-all" + }, + security-profile={ + "index.auto_expand_replicas": "0-all" + }, + ) + - language: JavaScript + code: |- + const response = await client.security.updateSettings({ + security: { + "index.auto_expand_replicas": "0-all", + }, + "security-tokens": { + "index.auto_expand_replicas": "0-all", + }, + "security-profile": { + "index.auto_expand_replicas": "0-all", + }, + }); + - language: Ruby + code: |- + response = client.security.update_settings( + body: { + "security": { + "index.auto_expand_replicas": "0-all" + }, + "security-tokens": { + "index.auto_expand_replicas": "0-all" + }, + "security-profile": { + "index.auto_expand_replicas": "0-all" + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->updateSettings([ + "body" => [ + "security" => [ + "index.auto_expand_replicas" => "0-all", + ], + "security-tokens" => [ + "index.auto_expand_replicas" => "0-all", + ], + "security-profile" => [ + "index.auto_expand_replicas" => "0-all", + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"security\":{\"index.auto_expand_replicas\":\"0-all\"},\"security-tokens\":{\"index.auto_expand_replicas\":\"0-all\"},\"se\ + curity-profile\":{\"index.auto_expand_replicas\":\"0-all\"}}' \"$ELASTICSEARCH_URL/_security/settings\"" diff --git a/specification/security/update_user_profile_data/examples/request/UpdateUserProfileDataRequestExample1.yaml b/specification/security/update_user_profile_data/examples/request/UpdateUserProfileDataRequestExample1.yaml index ff8aea1c43..83528e80e9 100644 --- a/specification/security/update_user_profile_data/examples/request/UpdateUserProfileDataRequestExample1.yaml +++ b/specification/security/update_user_profile_data/examples/request/UpdateUserProfileDataRequestExample1.yaml @@ -1,7 +1,8 @@ # summary: method_request: POST /_security/profile/u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0/_data description: > - Run `POST /_security/profile/u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0/_data` to update a profile document for the `u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0` user profile. + Run `POST /_security/profile/u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0/_data` to update a profile document for the + `u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0` user profile. # type: request value: |- { @@ -14,3 +15,65 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.security.update_user_profile_data( + uid="u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0", + labels={ + "direction": "east" + }, + data={ + "app1": { + "theme": "default" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.security.updateUserProfileData({ + uid: "u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0", + labels: { + direction: "east", + }, + data: { + app1: { + theme: "default", + }, + }, + }); + - language: Ruby + code: |- + response = client.security.update_user_profile_data( + uid: "u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0", + body: { + "labels": { + "direction": "east" + }, + "data": { + "app1": { + "theme": "default" + } + } + } + ) + - language: PHP + code: |- + $resp = $client->security()->updateUserProfileData([ + "uid" => "u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0", + "body" => [ + "labels" => [ + "direction" => "east", + ], + "data" => [ + "app1" => [ + "theme" => "default", + ], + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"labels":{"direction":"east"},"data":{"app1":{"theme":"default"}}}'' + "$ELASTICSEARCH_URL/_security/profile/u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0/_data"' diff --git a/specification/shutdown/delete_node/examples/request/ShutdownDeleteNodeRequestExample1.yaml b/specification/shutdown/delete_node/examples/request/ShutdownDeleteNodeRequestExample1.yaml index cb044b354d..cb63718c1c 100644 --- a/specification/shutdown/delete_node/examples/request/ShutdownDeleteNodeRequestExample1.yaml +++ b/specification/shutdown/delete_node/examples/request/ShutdownDeleteNodeRequestExample1.yaml @@ -1 +1,24 @@ method_request: DELETE /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown +alternatives: + - language: Python + code: |- + resp = client.shutdown.delete_node( + node_id="USpTGYaBSIKbgSUJR2Z9lg", + ) + - language: JavaScript + code: |- + const response = await client.shutdown.deleteNode({ + node_id: "USpTGYaBSIKbgSUJR2Z9lg", + }); + - language: Ruby + code: |- + response = client.shutdown.delete_node( + node_id: "USpTGYaBSIKbgSUJR2Z9lg" + ) + - language: PHP + code: |- + $resp = $client->shutdown()->deleteNode([ + "node_id" => "USpTGYaBSIKbgSUJR2Z9lg", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown"' diff --git a/specification/shutdown/get_node/examples/request/ShutdownGetNodeRequestExample1.yaml b/specification/shutdown/get_node/examples/request/ShutdownGetNodeRequestExample1.yaml index 0391f2dc2b..5108c71d73 100644 --- a/specification/shutdown/get_node/examples/request/ShutdownGetNodeRequestExample1.yaml +++ b/specification/shutdown/get_node/examples/request/ShutdownGetNodeRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown +alternatives: + - language: Python + code: |- + resp = client.shutdown.get_node( + node_id="USpTGYaBSIKbgSUJR2Z9lg", + ) + - language: JavaScript + code: |- + const response = await client.shutdown.getNode({ + node_id: "USpTGYaBSIKbgSUJR2Z9lg", + }); + - language: Ruby + code: |- + response = client.shutdown.get_node( + node_id: "USpTGYaBSIKbgSUJR2Z9lg" + ) + - language: PHP + code: |- + $resp = $client->shutdown()->getNode([ + "node_id" => "USpTGYaBSIKbgSUJR2Z9lg", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown"' diff --git a/specification/shutdown/put_node/examples/request/ShutdownPutNodeRequestExample1.yaml b/specification/shutdown/put_node/examples/request/ShutdownPutNodeRequestExample1.yaml index d8700cd954..dcd0208995 100644 --- a/specification/shutdown/put_node/examples/request/ShutdownPutNodeRequestExample1.yaml +++ b/specification/shutdown/put_node/examples/request/ShutdownPutNodeRequestExample1.yaml @@ -1,9 +1,57 @@ # summary: method_request: PUT /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown description: > - Register a node for shutdown with `PUT /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown`. - The `restart` type prepares the node to be restarted. + Register a node for shutdown with `PUT /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown`. The `restart` type prepares the node to be + restarted. # type: request -value: - "{\n \"type\": \"restart\",\n \"reason\": \"Demonstrating how the node shutdown\ - \ API works\",\n \"allocation_delay\": \"20m\"\n}" +value: "{ + + \ \"type\": \"restart\", + + \ \"reason\": \"Demonstrating how the node shutdown API works\", + + \ \"allocation_delay\": \"20m\" + + }" +alternatives: + - language: Python + code: |- + resp = client.shutdown.put_node( + node_id="USpTGYaBSIKbgSUJR2Z9lg", + type="restart", + reason="Demonstrating how the node shutdown API works", + allocation_delay="20m", + ) + - language: JavaScript + code: |- + const response = await client.shutdown.putNode({ + node_id: "USpTGYaBSIKbgSUJR2Z9lg", + type: "restart", + reason: "Demonstrating how the node shutdown API works", + allocation_delay: "20m", + }); + - language: Ruby + code: |- + response = client.shutdown.put_node( + node_id: "USpTGYaBSIKbgSUJR2Z9lg", + body: { + "type": "restart", + "reason": "Demonstrating how the node shutdown API works", + "allocation_delay": "20m" + } + ) + - language: PHP + code: |- + $resp = $client->shutdown()->putNode([ + "node_id" => "USpTGYaBSIKbgSUJR2Z9lg", + "body" => [ + "type" => "restart", + "reason" => "Demonstrating how the node shutdown API works", + "allocation_delay" => "20m", + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"type":"restart","reason":"Demonstrating how the node shutdown API works","allocation_delay":"20m"}'' + "$ELASTICSEARCH_URL/_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown"' diff --git a/specification/simulate/ingest/examples/request/SimulateIngestRequestExample1.yaml b/specification/simulate/ingest/examples/request/SimulateIngestRequestExample1.yaml index bfbe50124e..eb29b97d82 100644 --- a/specification/simulate/ingest/examples/request/SimulateIngestRequestExample1.yaml +++ b/specification/simulate/ingest/examples/request/SimulateIngestRequestExample1.yaml @@ -1,6 +1,9 @@ summary: Existing pipeline definitions method_request: POST /_ingest/_simulate -description: In this example the index `my-index` has a default pipeline called `my-pipeline` and a final pipeline called `my-final-pipeline`. Since both documents are being ingested into `my-index`, both pipelines are run using the pipeline definitions that are already in the system. +description: + In this example the index `my-index` has a default pipeline called `my-pipeline` and a final pipeline called + `my-final-pipeline`. Since both documents are being ingested into `my-index`, both pipelines are run using the pipeline + definitions that are already in the system. # type: request value: docs: @@ -12,3 +15,93 @@ value: _index: my-index _source: foo: rab +alternatives: + - language: Python + code: |- + resp = client.simulate.ingest( + docs=[ + { + "_id": 123, + "_index": "my-index", + "_source": { + "foo": "bar" + } + }, + { + "_id": 456, + "_index": "my-index", + "_source": { + "foo": "rab" + } + } + ], + ) + - language: JavaScript + code: |- + const response = await client.simulate.ingest({ + docs: [ + { + _id: 123, + _index: "my-index", + _source: { + foo: "bar", + }, + }, + { + _id: 456, + _index: "my-index", + _source: { + foo: "rab", + }, + }, + ], + }); + - language: Ruby + code: |- + response = client.simulate.ingest( + body: { + "docs": [ + { + "_id": 123, + "_index": "my-index", + "_source": { + "foo": "bar" + } + }, + { + "_id": 456, + "_index": "my-index", + "_source": { + "foo": "rab" + } + } + ] + } + ) + - language: PHP + code: |- + $resp = $client->simulate()->ingest([ + "body" => [ + "docs" => array( + [ + "_id" => 123, + "_index" => "my-index", + "_source" => [ + "foo" => "bar", + ], + ], + [ + "_id" => 456, + "_index" => "my-index", + "_source" => [ + "foo" => "rab", + ], + ], + ), + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"docs\":[{\"_id\":123,\"_index\":\"my-index\",\"_source\":{\"foo\":\"bar\"}},{\"_id\":456,\"_index\":\"my-index\",\"_source\ + \":{\"foo\":\"rab\"}}]}' \"$ELASTICSEARCH_URL/_ingest/_simulate\"" diff --git a/specification/simulate/ingest/examples/request/SimulateIngestRequestExample2.yaml b/specification/simulate/ingest/examples/request/SimulateIngestRequestExample2.yaml index 6abbfe96b7..d0c997f00e 100644 --- a/specification/simulate/ingest/examples/request/SimulateIngestRequestExample2.yaml +++ b/specification/simulate/ingest/examples/request/SimulateIngestRequestExample2.yaml @@ -1,6 +1,10 @@ summary: Pipeline substitions method_request: POST /_ingest/_simulate -description: In this example the index `my-index` has a default pipeline called `my-pipeline` and a final pipeline called `my-final-pipeline`. But a substitute definition of `my-pipeline` is provided in `pipeline_substitutions`. The substitute `my-pipeline` will be used in place of the `my-pipeline` that is in the system, and then the `my-final-pipeline` that is already defined in the system will run. +description: + In this example the index `my-index` has a default pipeline called `my-pipeline` and a final pipeline called + `my-final-pipeline`. But a substitute definition of `my-pipeline` is provided in `pipeline_substitutions`. The substitute + `my-pipeline` will be used in place of the `my-pipeline` that is in the system, and then the `my-final-pipeline` that is already + defined in the system will run. # type: request value: docs: @@ -17,3 +21,138 @@ value: processors: - uppercase: field: foo +alternatives: + - language: Python + code: |- + resp = client.simulate.ingest( + docs=[ + { + "_index": "my-index", + "_id": 123, + "_source": { + "foo": "bar" + } + }, + { + "_index": "my-index", + "_id": 456, + "_source": { + "foo": "rab" + } + } + ], + pipeline_substitutions={ + "my-pipeline": { + "processors": [ + { + "uppercase": { + "field": "foo" + } + } + ] + } + }, + ) + - language: JavaScript + code: |- + const response = await client.simulate.ingest({ + docs: [ + { + _index: "my-index", + _id: 123, + _source: { + foo: "bar", + }, + }, + { + _index: "my-index", + _id: 456, + _source: { + foo: "rab", + }, + }, + ], + pipeline_substitutions: { + "my-pipeline": { + processors: [ + { + uppercase: { + field: "foo", + }, + }, + ], + }, + }, + }); + - language: Ruby + code: |- + response = client.simulate.ingest( + body: { + "docs": [ + { + "_index": "my-index", + "_id": 123, + "_source": { + "foo": "bar" + } + }, + { + "_index": "my-index", + "_id": 456, + "_source": { + "foo": "rab" + } + } + ], + "pipeline_substitutions": { + "my-pipeline": { + "processors": [ + { + "uppercase": { + "field": "foo" + } + } + ] + } + } + } + ) + - language: PHP + code: |- + $resp = $client->simulate()->ingest([ + "body" => [ + "docs" => array( + [ + "_index" => "my-index", + "_id" => 123, + "_source" => [ + "foo" => "bar", + ], + ], + [ + "_index" => "my-index", + "_id" => 456, + "_source" => [ + "foo" => "rab", + ], + ], + ), + "pipeline_substitutions" => [ + "my-pipeline" => [ + "processors" => array( + [ + "uppercase" => [ + "field" => "foo", + ], + ], + ), + ], + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"docs\":[{\"_index\":\"my-index\",\"_id\":123,\"_source\":{\"foo\":\"bar\"}},{\"_index\":\"my-index\",\"_id\":456,\"_source\ + \":{\"foo\":\"rab\"}}],\"pipeline_substitutions\":{\"my-pipeline\":{\"processors\":[{\"uppercase\":{\"field\":\"foo\"}}]}}}' + \"$ELASTICSEARCH_URL/_ingest/_simulate\"" diff --git a/specification/simulate/ingest/examples/request/SimulateIngestRequestExample3.yaml b/specification/simulate/ingest/examples/request/SimulateIngestRequestExample3.yaml index 60602b8dca..759886476a 100644 --- a/specification/simulate/ingest/examples/request/SimulateIngestRequestExample3.yaml +++ b/specification/simulate/ingest/examples/request/SimulateIngestRequestExample3.yaml @@ -1,10 +1,10 @@ summary: Component template substitutions method_request: POST /_ingest/_simulate description: > - In this example, imagine that the index `my-index` has a strict mapping with only the `foo` keyword field defined. - Say that field mapping came from a component template named `my-mappings-template`. You want to test adding a new field, `bar`. - So a substitute definition of `my-mappings-template` is provided in `component_template_substitutions`. - The substitute `my-mappings-template` will be used in place of the existing mapping for `my-index` and in place of the `my-mappings-template` that is in the system. + In this example, imagine that the index `my-index` has a strict mapping with only the `foo` keyword field defined. Say that field + mapping came from a component template named `my-mappings-template`. You want to test adding a new field, `bar`. So a substitute + definition of `my-mappings-template` is provided in `component_template_substitutions`. The substitute `my-mappings-template` will + be used in place of the existing mapping for `my-index` and in place of the `my-mappings-template` that is in the system. # type: request value: |- { @@ -42,3 +42,163 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.simulate.ingest( + docs=[ + { + "_index": "my-index", + "_id": "123", + "_source": { + "foo": "foo" + } + }, + { + "_index": "my-index", + "_id": "456", + "_source": { + "bar": "rab" + } + } + ], + component_template_substitutions={ + "my-mappings_template": { + "template": { + "mappings": { + "dynamic": "strict", + "properties": { + "foo": { + "type": "keyword" + }, + "bar": { + "type": "keyword" + } + } + } + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.simulate.ingest({ + docs: [ + { + _index: "my-index", + _id: "123", + _source: { + foo: "foo", + }, + }, + { + _index: "my-index", + _id: "456", + _source: { + bar: "rab", + }, + }, + ], + component_template_substitutions: { + "my-mappings_template": { + template: { + mappings: { + dynamic: "strict", + properties: { + foo: { + type: "keyword", + }, + bar: { + type: "keyword", + }, + }, + }, + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.simulate.ingest( + body: { + "docs": [ + { + "_index": "my-index", + "_id": "123", + "_source": { + "foo": "foo" + } + }, + { + "_index": "my-index", + "_id": "456", + "_source": { + "bar": "rab" + } + } + ], + "component_template_substitutions": { + "my-mappings_template": { + "template": { + "mappings": { + "dynamic": "strict", + "properties": { + "foo": { + "type": "keyword" + }, + "bar": { + "type": "keyword" + } + } + } + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->simulate()->ingest([ + "body" => [ + "docs" => array( + [ + "_index" => "my-index", + "_id" => "123", + "_source" => [ + "foo" => "foo", + ], + ], + [ + "_index" => "my-index", + "_id" => "456", + "_source" => [ + "bar" => "rab", + ], + ], + ), + "component_template_substitutions" => [ + "my-mappings_template" => [ + "template" => [ + "mappings" => [ + "dynamic" => "strict", + "properties" => [ + "foo" => [ + "type" => "keyword", + ], + "bar" => [ + "type" => "keyword", + ], + ], + ], + ], + ], + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"docs\":[{\"_index\":\"my-index\",\"_id\":\"123\",\"_source\":{\"foo\":\"foo\"}},{\"_index\":\"my-index\",\"_id\":\"456\",\ + \"_source\":{\"bar\":\"rab\"}}],\"component_template_substitutions\":{\"my-mappings_template\":{\"template\":{\"mappings\":{\ + \"dynamic\":\"strict\",\"properties\":{\"foo\":{\"type\":\"keyword\"},\"bar\":{\"type\":\"keyword\"}}}}}}}' + \"$ELASTICSEARCH_URL/_ingest/_simulate\"" diff --git a/specification/simulate/ingest/examples/request/SimulateIngestRequestExample4.yaml b/specification/simulate/ingest/examples/request/SimulateIngestRequestExample4.yaml index 29e947ed0e..2bd2df773b 100644 --- a/specification/simulate/ingest/examples/request/SimulateIngestRequestExample4.yaml +++ b/specification/simulate/ingest/examples/request/SimulateIngestRequestExample4.yaml @@ -1,6 +1,8 @@ summary: Multiple substitutions method_request: POST /_ingest/_simulate -description: The pipeline, component template, and index template substitutions replace the existing pipeline details for the duration of this request. +description: + The pipeline, component template, and index template substitutions replace the existing pipeline details for the + duration of this request. # type: request value: docs: @@ -41,3 +43,293 @@ value: properties: foo: type: keyword +alternatives: + - language: Python + code: |- + resp = client.simulate.ingest( + docs=[ + { + "_id": "id", + "_index": "my-index", + "_source": { + "foo": "bar" + } + }, + { + "_id": "id", + "_index": "my-index", + "_source": { + "foo": "rab" + } + } + ], + pipeline_substitutions={ + "my-pipeline": { + "processors": [ + { + "set": { + "field": "field3", + "value": "value3" + } + } + ] + } + }, + component_template_substitutions={ + "my-component-template": { + "template": { + "mappings": { + "dynamic": True, + "properties": { + "field3": { + "type": "keyword" + } + } + }, + "settings": { + "index": { + "default_pipeline": "my-pipeline" + } + } + } + } + }, + index_template_substitutions={ + "my-index-template": { + "index_patterns": [ + "my-index-*" + ], + "composed_of": [ + "component_template_1", + "component_template_2" + ] + } + }, + mapping_addition={ + "dynamic": "strict", + "properties": { + "foo": { + "type": "keyword" + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.simulate.ingest({ + docs: [ + { + _id: "id", + _index: "my-index", + _source: { + foo: "bar", + }, + }, + { + _id: "id", + _index: "my-index", + _source: { + foo: "rab", + }, + }, + ], + pipeline_substitutions: { + "my-pipeline": { + processors: [ + { + set: { + field: "field3", + value: "value3", + }, + }, + ], + }, + }, + component_template_substitutions: { + "my-component-template": { + template: { + mappings: { + dynamic: true, + properties: { + field3: { + type: "keyword", + }, + }, + }, + settings: { + index: { + default_pipeline: "my-pipeline", + }, + }, + }, + }, + }, + index_template_substitutions: { + "my-index-template": { + index_patterns: ["my-index-*"], + composed_of: ["component_template_1", "component_template_2"], + }, + }, + mapping_addition: { + dynamic: "strict", + properties: { + foo: { + type: "keyword", + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.simulate.ingest( + body: { + "docs": [ + { + "_id": "id", + "_index": "my-index", + "_source": { + "foo": "bar" + } + }, + { + "_id": "id", + "_index": "my-index", + "_source": { + "foo": "rab" + } + } + ], + "pipeline_substitutions": { + "my-pipeline": { + "processors": [ + { + "set": { + "field": "field3", + "value": "value3" + } + } + ] + } + }, + "component_template_substitutions": { + "my-component-template": { + "template": { + "mappings": { + "dynamic": true, + "properties": { + "field3": { + "type": "keyword" + } + } + }, + "settings": { + "index": { + "default_pipeline": "my-pipeline" + } + } + } + } + }, + "index_template_substitutions": { + "my-index-template": { + "index_patterns": [ + "my-index-*" + ], + "composed_of": [ + "component_template_1", + "component_template_2" + ] + } + }, + "mapping_addition": { + "dynamic": "strict", + "properties": { + "foo": { + "type": "keyword" + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->simulate()->ingest([ + "body" => [ + "docs" => array( + [ + "_id" => "id", + "_index" => "my-index", + "_source" => [ + "foo" => "bar", + ], + ], + [ + "_id" => "id", + "_index" => "my-index", + "_source" => [ + "foo" => "rab", + ], + ], + ), + "pipeline_substitutions" => [ + "my-pipeline" => [ + "processors" => array( + [ + "set" => [ + "field" => "field3", + "value" => "value3", + ], + ], + ), + ], + ], + "component_template_substitutions" => [ + "my-component-template" => [ + "template" => [ + "mappings" => [ + "dynamic" => true, + "properties" => [ + "field3" => [ + "type" => "keyword", + ], + ], + ], + "settings" => [ + "index" => [ + "default_pipeline" => "my-pipeline", + ], + ], + ], + ], + ], + "index_template_substitutions" => [ + "my-index-template" => [ + "index_patterns" => array( + "my-index-*", + ), + "composed_of" => array( + "component_template_1", + "component_template_2", + ), + ], + ], + "mapping_addition" => [ + "dynamic" => "strict", + "properties" => [ + "foo" => [ + "type" => "keyword", + ], + ], + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"docs\":[{\"_id\":\"id\",\"_index\":\"my-index\",\"_source\":{\"foo\":\"bar\"}},{\"_id\":\"id\",\"_index\":\"my-index\",\"\ + _source\":{\"foo\":\"rab\"}}],\"pipeline_substitutions\":{\"my-pipeline\":{\"processors\":[{\"set\":{\"field\":\"field3\",\"v\ + alue\":\"value3\"}}]}},\"component_template_substitutions\":{\"my-component-template\":{\"template\":{\"mappings\":{\"dynamic\ + \":true,\"properties\":{\"field3\":{\"type\":\"keyword\"}}},\"settings\":{\"index\":{\"default_pipeline\":\"my-pipeline\"}}}}\ + },\"index_template_substitutions\":{\"my-index-template\":{\"index_patterns\":[\"my-index-*\"],\"composed_of\":[\"component_t\ + emplate_1\",\"component_template_2\"]}},\"mapping_addition\":{\"dynamic\":\"strict\",\"properties\":{\"foo\":{\"type\":\"keyw\ + ord\"}}}}' \"$ELASTICSEARCH_URL/_ingest/_simulate\"" diff --git a/specification/slm/delete_lifecycle/examples/request/SlmDeleteLifecycleExample1.yaml b/specification/slm/delete_lifecycle/examples/request/SlmDeleteLifecycleExample1.yaml index b7692f83fb..f6bcca8ceb 100644 --- a/specification/slm/delete_lifecycle/examples/request/SlmDeleteLifecycleExample1.yaml +++ b/specification/slm/delete_lifecycle/examples/request/SlmDeleteLifecycleExample1.yaml @@ -1 +1,24 @@ method_request: DELETE /_slm/policy/daily-snapshots +alternatives: + - language: Python + code: |- + resp = client.slm.delete_lifecycle( + policy_id="daily-snapshots", + ) + - language: JavaScript + code: |- + const response = await client.slm.deleteLifecycle({ + policy_id: "daily-snapshots", + }); + - language: Ruby + code: |- + response = client.slm.delete_lifecycle( + policy_id: "daily-snapshots" + ) + - language: PHP + code: |- + $resp = $client->slm()->deleteLifecycle([ + "policy_id" => "daily-snapshots", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_slm/policy/daily-snapshots"' diff --git a/specification/slm/execute_lifecycle/examples/request/ExecuteSnapshotLifecycleRequestExample1.yaml b/specification/slm/execute_lifecycle/examples/request/ExecuteSnapshotLifecycleRequestExample1.yaml index 055e6444e8..fbcb6f1183 100644 --- a/specification/slm/execute_lifecycle/examples/request/ExecuteSnapshotLifecycleRequestExample1.yaml +++ b/specification/slm/execute_lifecycle/examples/request/ExecuteSnapshotLifecycleRequestExample1.yaml @@ -1 +1,24 @@ -method_request: POST /_slm/policy/daily-snapshots/_execute +method_request: PUT /_slm/policy/daily-snapshots/_execute +alternatives: + - language: Python + code: |- + resp = client.slm.execute_lifecycle( + policy_id="daily-snapshots", + ) + - language: JavaScript + code: |- + const response = await client.slm.executeLifecycle({ + policy_id: "daily-snapshots", + }); + - language: Ruby + code: |- + response = client.slm.execute_lifecycle( + policy_id: "daily-snapshots" + ) + - language: PHP + code: |- + $resp = $client->slm()->executeLifecycle([ + "policy_id" => "daily-snapshots", + ]); + - language: curl + code: 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_slm/policy/daily-snapshots/_execute"' diff --git a/specification/slm/execute_retention/examples/request/SlmExecuteRetentionExample1.yaml b/specification/slm/execute_retention/examples/request/SlmExecuteRetentionExample1.yaml index baa2e6b8f1..6852a5ba05 100644 --- a/specification/slm/execute_retention/examples/request/SlmExecuteRetentionExample1.yaml +++ b/specification/slm/execute_retention/examples/request/SlmExecuteRetentionExample1.yaml @@ -1 +1,12 @@ method_request: POST _slm/_execute_retention +alternatives: + - language: Python + code: resp = client.slm.execute_retention() + - language: JavaScript + code: const response = await client.slm.executeRetention(); + - language: Ruby + code: response = client.slm.execute_retention + - language: PHP + code: $resp = $client->slm()->executeRetention(); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_slm/_execute_retention"' diff --git a/specification/slm/get_lifecycle/examples/request/GetSnapshotLifecycleRequestExample1.yaml b/specification/slm/get_lifecycle/examples/request/GetSnapshotLifecycleRequestExample1.yaml index 9a1979971c..ff6ff39fd1 100644 --- a/specification/slm/get_lifecycle/examples/request/GetSnapshotLifecycleRequestExample1.yaml +++ b/specification/slm/get_lifecycle/examples/request/GetSnapshotLifecycleRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET _slm/policy/daily-snapshots?human +alternatives: + - language: Python + code: |- + resp = client.slm.get_lifecycle( + policy_id="daily-snapshots", + human=True, + ) + - language: JavaScript + code: |- + const response = await client.slm.getLifecycle({ + policy_id: "daily-snapshots", + human: "true", + }); + - language: Ruby + code: |- + response = client.slm.get_lifecycle( + policy_id: "daily-snapshots", + human: "true" + ) + - language: PHP + code: |- + $resp = $client->slm()->getLifecycle([ + "policy_id" => "daily-snapshots", + "human" => "true", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_slm/policy/daily-snapshots?human"' diff --git a/specification/slm/get_stats/examples/request/GetSnapshotLifecycleManagementStatsRequestExample1.yaml b/specification/slm/get_stats/examples/request/GetSnapshotLifecycleManagementStatsRequestExample1.yaml index bd0a032ae8..0a78d36f83 100644 --- a/specification/slm/get_stats/examples/request/GetSnapshotLifecycleManagementStatsRequestExample1.yaml +++ b/specification/slm/get_stats/examples/request/GetSnapshotLifecycleManagementStatsRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET /_slm/stats +alternatives: + - language: Python + code: resp = client.slm.get_stats() + - language: JavaScript + code: const response = await client.slm.getStats(); + - language: Ruby + code: response = client.slm.get_stats + - language: PHP + code: $resp = $client->slm()->getStats(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_slm/stats"' diff --git a/specification/slm/get_status/examples/request/GetSnapshotLifecycleManagementStatusRequestExample1.yaml b/specification/slm/get_status/examples/request/GetSnapshotLifecycleManagementStatusRequestExample1.yaml index 7a29eec0e2..56eefa7d7e 100644 --- a/specification/slm/get_status/examples/request/GetSnapshotLifecycleManagementStatusRequestExample1.yaml +++ b/specification/slm/get_status/examples/request/GetSnapshotLifecycleManagementStatusRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET _slm/status +alternatives: + - language: Python + code: resp = client.slm.get_status() + - language: JavaScript + code: const response = await client.slm.getStatus(); + - language: Ruby + code: response = client.slm.get_status + - language: PHP + code: $resp = $client->slm()->getStatus(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_slm/status"' diff --git a/specification/slm/put_lifecycle/examples/request/PutSnapshotLifecycleRequestExample1 copy.yaml b/specification/slm/put_lifecycle/examples/request/PutSnapshotLifecycleRequestExample1 copy.yaml index dba952024c..cecb416f3c 100644 --- a/specification/slm/put_lifecycle/examples/request/PutSnapshotLifecycleRequestExample1 copy.yaml +++ b/specification/slm/put_lifecycle/examples/request/PutSnapshotLifecycleRequestExample1 copy.yaml @@ -1,13 +1,129 @@ summary: Create a policy method_request: PUT /_slm/policy/daily-snapshots description: > - Run `PUT /_slm/policy/daily-snapshots` to create a lifecycle policy. - The `schedule` is when the snapshot should be taken, in this case, 1:30am daily. - The `retention` details specify to: keep snapshots for 30 days; always keep at least 5 successful snapshots, even if they're more than 30 days old; keep no more than 50 successful snapshots, even if they're less than 30 days old. + Run `PUT /_slm/policy/daily-snapshots` to create a lifecycle policy. The `schedule` is when the snapshot should be taken, in this + case, 1:30am daily. The `retention` details specify to: keep snapshots for 30 days; always keep at least 5 successful snapshots, + even if they're more than 30 days old; keep no more than 50 successful snapshots, even if they're less than 30 days old. # type: request -value: - "{\n \"schedule\": \"0 30 1 * * ?\",\n \"name\": \"\"\ - ,\n \"repository\": \"my_repository\",\n \"config\": {\n \"indices\": [\"data-*\"\ - , \"important\"],\n \"ignore_unavailable\": false,\n \"include_global_state\"\ - : false\n },\n \"retention\": {\n \"expire_after\": \"30d\",\n \"min_count\"\ - : 5,\n \"max_count\": 50\n }\n}" +value: "{ + + \ \"schedule\": \"0 30 1 * * ?\", + + \ \"name\": \"\", + + \ \"repository\": \"my_repository\", + + \ \"config\": { + + \ \"indices\": [\"data-*\", \"important\"], + + \ \"ignore_unavailable\": false, + + \ \"include_global_state\": false + + \ }, + + \ \"retention\": { + + \ \"expire_after\": \"30d\", + + \ \"min_count\": 5, + + \ \"max_count\": 50 + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.slm.put_lifecycle( + policy_id="daily-snapshots", + schedule="0 30 1 * * ?", + name="", + repository="my_repository", + config={ + "indices": [ + "data-*", + "important" + ], + "ignore_unavailable": False, + "include_global_state": False + }, + retention={ + "expire_after": "30d", + "min_count": 5, + "max_count": 50 + }, + ) + - language: JavaScript + code: |- + const response = await client.slm.putLifecycle({ + policy_id: "daily-snapshots", + schedule: "0 30 1 * * ?", + name: "", + repository: "my_repository", + config: { + indices: ["data-*", "important"], + ignore_unavailable: false, + include_global_state: false, + }, + retention: { + expire_after: "30d", + min_count: 5, + max_count: 50, + }, + }); + - language: Ruby + code: |- + response = client.slm.put_lifecycle( + policy_id: "daily-snapshots", + body: { + "schedule": "0 30 1 * * ?", + "name": "", + "repository": "my_repository", + "config": { + "indices": [ + "data-*", + "important" + ], + "ignore_unavailable": false, + "include_global_state": false + }, + "retention": { + "expire_after": "30d", + "min_count": 5, + "max_count": 50 + } + } + ) + - language: PHP + code: |- + $resp = $client->slm()->putLifecycle([ + "policy_id" => "daily-snapshots", + "body" => [ + "schedule" => "0 30 1 * * ?", + "name" => "", + "repository" => "my_repository", + "config" => [ + "indices" => array( + "data-*", + "important", + ), + "ignore_unavailable" => false, + "include_global_state" => false, + ], + "retention" => [ + "expire_after" => "30d", + "min_count" => 5, + "max_count" => 50, + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"schedule\":\"0 30 1 * + * + ?\",\"name\":\"\",\"repository\":\"my_repository\",\"config\":{\"indices\":[\"data-*\",\"important\"],\"i\ + gnore_unavailable\":false,\"include_global_state\":false},\"retention\":{\"expire_after\":\"30d\",\"min_count\":5,\"max_count\ + \":50}}' \"$ELASTICSEARCH_URL/_slm/policy/daily-snapshots\"" diff --git a/specification/slm/put_lifecycle/examples/request/PutSnapshotLifecycleRequestExample2.yaml b/specification/slm/put_lifecycle/examples/request/PutSnapshotLifecycleRequestExample2.yaml index 6e9c8addd3..acd0dccdd0 100644 --- a/specification/slm/put_lifecycle/examples/request/PutSnapshotLifecycleRequestExample2.yaml +++ b/specification/slm/put_lifecycle/examples/request/PutSnapshotLifecycleRequestExample2.yaml @@ -1,9 +1,9 @@ summary: Create a policy with intevals method_request: PUT /_slm/policy/hourly-snapshots description: > - Run `PUT /_slm/policy/hourly-snapshots` to create a lifecycle policy that uses interval scheduling. - It creates a snapshot once every hour. - The first snapshot will be created one hour after the policy is modified, with subsequent snapshots every hour afterward. + Run `PUT /_slm/policy/hourly-snapshots` to create a lifecycle policy that uses interval scheduling. It creates a snapshot once + every hour. The first snapshot will be created one hour after the policy is modified, with subsequent snapshots every hour + afterward. # type: request value: |- { @@ -14,3 +14,66 @@ value: |- "indices": ["data-*", "important"] } } +alternatives: + - language: Python + code: |- + resp = client.slm.put_lifecycle( + policy_id="hourly-snapshots", + schedule="1h", + name="", + repository="my_repository", + config={ + "indices": [ + "data-*", + "important" + ] + }, + ) + - language: JavaScript + code: |- + const response = await client.slm.putLifecycle({ + policy_id: "hourly-snapshots", + schedule: "1h", + name: "", + repository: "my_repository", + config: { + indices: ["data-*", "important"], + }, + }); + - language: Ruby + code: |- + response = client.slm.put_lifecycle( + policy_id: "hourly-snapshots", + body: { + "schedule": "1h", + "name": "", + "repository": "my_repository", + "config": { + "indices": [ + "data-*", + "important" + ] + } + } + ) + - language: PHP + code: |- + $resp = $client->slm()->putLifecycle([ + "policy_id" => "hourly-snapshots", + "body" => [ + "schedule" => "1h", + "name" => "", + "repository" => "my_repository", + "config" => [ + "indices" => array( + "data-*", + "important", + ), + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"schedule\":\"1h\",\"name\":\"\",\"repository\":\"my_repository\",\"config\":{\"indices\":[\"data-*\",\ + \"important\"]}}' \"$ELASTICSEARCH_URL/_slm/policy/hourly-snapshots\"" diff --git a/specification/slm/start/examples/request/StartSnapshotLifecycleManagementRequestExample1.yaml b/specification/slm/start/examples/request/StartSnapshotLifecycleManagementRequestExample1.yaml index d492c9aeb5..f73619ee35 100644 --- a/specification/slm/start/examples/request/StartSnapshotLifecycleManagementRequestExample1.yaml +++ b/specification/slm/start/examples/request/StartSnapshotLifecycleManagementRequestExample1.yaml @@ -1 +1,12 @@ method_request: POST _slm/start +alternatives: + - language: Python + code: resp = client.slm.start() + - language: JavaScript + code: const response = await client.slm.start(); + - language: Ruby + code: response = client.slm.start + - language: PHP + code: $resp = $client->slm()->start(); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_slm/start"' diff --git a/specification/snapshot/cleanup_repository/examples/request/SnapshotCleanupRepositoryRequestExample1.yaml b/specification/snapshot/cleanup_repository/examples/request/SnapshotCleanupRepositoryRequestExample1.yaml index 50442f35ae..4fbfdad9b8 100644 --- a/specification/snapshot/cleanup_repository/examples/request/SnapshotCleanupRepositoryRequestExample1.yaml +++ b/specification/snapshot/cleanup_repository/examples/request/SnapshotCleanupRepositoryRequestExample1.yaml @@ -1 +1,24 @@ method_request: POST /_snapshot/my_repository/_cleanup +alternatives: + - language: Python + code: |- + resp = client.snapshot.cleanup_repository( + name="my_repository", + ) + - language: JavaScript + code: |- + const response = await client.snapshot.cleanupRepository({ + name: "my_repository", + }); + - language: Ruby + code: |- + response = client.snapshot.cleanup_repository( + repository: "my_repository" + ) + - language: PHP + code: |- + $resp = $client->snapshot()->cleanupRepository([ + "repository" => "my_repository", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_snapshot/my_repository/_cleanup"' diff --git a/specification/snapshot/clone/examples/request/SnapshotCloneRequestExample1.yaml b/specification/snapshot/clone/examples/request/SnapshotCloneRequestExample1.yaml index d56f6994ee..dde0b16284 100644 --- a/specification/snapshot/clone/examples/request/SnapshotCloneRequestExample1.yaml +++ b/specification/snapshot/clone/examples/request/SnapshotCloneRequestExample1.yaml @@ -1,5 +1,52 @@ # summary: method_request: PUT /_snapshot/my_repository/source_snapshot/_clone/target_snapshot -description: Run `PUT /_snapshot/my_repository/source_snapshot/_clone/target_snapshot` to clone the `source_snapshot` into a new `target_snapshot`. +description: + Run `PUT /_snapshot/my_repository/source_snapshot/_clone/target_snapshot` to clone the `source_snapshot` into a new + `target_snapshot`. # type: request -value: "{\n \"indices\": \"index_a,index_b\"\n}" +value: "{ + + \ \"indices\": \"index_a,index_b\" + + }" +alternatives: + - language: Python + code: |- + resp = client.snapshot.clone( + repository="my_repository", + snapshot="source_snapshot", + target_snapshot="target_snapshot", + indices="index_a,index_b", + ) + - language: JavaScript + code: |- + const response = await client.snapshot.clone({ + repository: "my_repository", + snapshot: "source_snapshot", + target_snapshot: "target_snapshot", + indices: "index_a,index_b", + }); + - language: Ruby + code: |- + response = client.snapshot.clone( + repository: "my_repository", + snapshot: "source_snapshot", + target_snapshot: "target_snapshot", + body: { + "indices": "index_a,index_b" + } + ) + - language: PHP + code: |- + $resp = $client->snapshot()->clone([ + "repository" => "my_repository", + "snapshot" => "source_snapshot", + "target_snapshot" => "target_snapshot", + "body" => [ + "indices" => "index_a,index_b", + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"indices":"index_a,index_b"}'' "$ELASTICSEARCH_URL/_snapshot/my_repository/source_snapshot/_clone/target_snapshot"' diff --git a/specification/snapshot/create/examples/request/SnapshotCreateRequestExample1.yaml b/specification/snapshot/create/examples/request/SnapshotCreateRequestExample1.yaml index 84790b826b..81fa6ab5ea 100644 --- a/specification/snapshot/create/examples/request/SnapshotCreateRequestExample1.yaml +++ b/specification/snapshot/create/examples/request/SnapshotCreateRequestExample1.yaml @@ -2,7 +2,87 @@ method_request: PUT /_snapshot/my_repository/snapshot_2?wait_for_completion=true description: Run `PUT /_snapshot/my_repository/snapshot_2?wait_for_completion=true` to take a snapshot of `index_1` and `index_2`. # type: request -value: - "{\n \"indices\": \"index_1,index_2\",\n \"ignore_unavailable\": true,\n\ - \ \"include_global_state\": false,\n \"metadata\": {\n \"taken_by\": \"user123\"\ - ,\n \"taken_because\": \"backup before upgrading\"\n }\n}" +value: "{ + + \ \"indices\": \"index_1,index_2\", + + \ \"ignore_unavailable\": true, + + \ \"include_global_state\": false, + + \ \"metadata\": { + + \ \"taken_by\": \"user123\", + + \ \"taken_because\": \"backup before upgrading\" + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.snapshot.create( + repository="my_repository", + snapshot="snapshot_2", + wait_for_completion=True, + indices="index_1,index_2", + ignore_unavailable=True, + include_global_state=False, + metadata={ + "taken_by": "user123", + "taken_because": "backup before upgrading" + }, + ) + - language: JavaScript + code: |- + const response = await client.snapshot.create({ + repository: "my_repository", + snapshot: "snapshot_2", + wait_for_completion: "true", + indices: "index_1,index_2", + ignore_unavailable: true, + include_global_state: false, + metadata: { + taken_by: "user123", + taken_because: "backup before upgrading", + }, + }); + - language: Ruby + code: |- + response = client.snapshot.create( + repository: "my_repository", + snapshot: "snapshot_2", + wait_for_completion: "true", + body: { + "indices": "index_1,index_2", + "ignore_unavailable": true, + "include_global_state": false, + "metadata": { + "taken_by": "user123", + "taken_because": "backup before upgrading" + } + } + ) + - language: PHP + code: |- + $resp = $client->snapshot()->create([ + "repository" => "my_repository", + "snapshot" => "snapshot_2", + "wait_for_completion" => "true", + "body" => [ + "indices" => "index_1,index_2", + "ignore_unavailable" => true, + "include_global_state" => false, + "metadata" => [ + "taken_by" => "user123", + "taken_because" => "backup before upgrading", + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"indices\":\"index_1,index_2\",\"ignore_unavailable\":true,\"include_global_state\":false,\"metadata\":{\"taken_by\":\"use\ + r123\",\"taken_because\":\"backup before upgrading\"}}' + \"$ELASTICSEARCH_URL/_snapshot/my_repository/snapshot_2?wait_for_completion=true\"" diff --git a/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample1.yaml b/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample1.yaml index 6cd578dd10..74fea999a7 100644 --- a/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample1.yaml +++ b/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample1.yaml @@ -2,6 +2,63 @@ summary: A shared file system repository method_request: PUT /_snapshot/my_repository description: Run `PUT /_snapshot/my_repository` to create or update a shared file system snapshot repository. # type: request -value: - "{\n \"type\": \"fs\",\n \"settings\": {\n \"location\": \"my_backup_location\"\ - \n }\n}" +value: "{ + + \ \"type\": \"fs\", + + \ \"settings\": { + + \ \"location\": \"my_backup_location\" + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.snapshot.create_repository( + name="my_repository", + repository={ + "type": "fs", + "settings": { + "location": "my_backup_location" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.snapshot.createRepository({ + name: "my_repository", + repository: { + type: "fs", + settings: { + location: "my_backup_location", + }, + }, + }); + - language: Ruby + code: |- + response = client.snapshot.create_repository( + repository: "my_repository", + body: { + "type": "fs", + "settings": { + "location": "my_backup_location" + } + } + ) + - language: PHP + code: |- + $resp = $client->snapshot()->createRepository([ + "repository" => "my_repository", + "body" => [ + "type" => "fs", + "settings" => [ + "location" => "my_backup_location", + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"type":"fs","settings":{"location":"my_backup_location"}}'' "$ELASTICSEARCH_URL/_snapshot/my_repository"' diff --git a/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample2.yaml b/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample2.yaml index b5661e4cd6..4bc38615d4 100644 --- a/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample2.yaml +++ b/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample2.yaml @@ -2,6 +2,63 @@ summary: An Azure repository method_request: PUT _snapshot/my_backup description: Run `PUT /_snapshot/my_repository` to create or update an Azure snapshot repository. # type: request -value: - "{\n \"type\": \"azure\",\n \"settings\": {\n \"client\": \"secondary\"\ - \n }\n}" +value: "{ + + \ \"type\": \"azure\", + + \ \"settings\": { + + \ \"client\": \"secondary\" + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.snapshot.create_repository( + name="my_backup", + repository={ + "type": "azure", + "settings": { + "client": "secondary" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.snapshot.createRepository({ + name: "my_backup", + repository: { + type: "azure", + settings: { + client: "secondary", + }, + }, + }); + - language: Ruby + code: |- + response = client.snapshot.create_repository( + repository: "my_backup", + body: { + "type": "azure", + "settings": { + "client": "secondary" + } + } + ) + - language: PHP + code: |- + $resp = $client->snapshot()->createRepository([ + "repository" => "my_backup", + "body" => [ + "type" => "azure", + "settings" => [ + "client" => "secondary", + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"type":"azure","settings":{"client":"secondary"}}'' "$ELASTICSEARCH_URL/_snapshot/my_backup"' diff --git a/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample3.yaml b/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample3.yaml index afa57618d9..7e8de1b8e5 100644 --- a/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample3.yaml +++ b/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample3.yaml @@ -2,6 +2,70 @@ summary: A Google Cloud Storage repository method_request: PUT _snapshot/my_gcs_repository description: Run `PUT /_snapshot/my_gcs_repository` to create or update a Google Cloud Storage snapshot repository. # type: request -value: - "{\n \"type\": \"gcs\",\n \"settings\": {\n \"bucket\": \"my_other_bucket\"\ - ,\n \"base_path\": \"dev\"\n }\n}" +value: "{ + + \ \"type\": \"gcs\", + + \ \"settings\": { + + \ \"bucket\": \"my_other_bucket\", + + \ \"base_path\": \"dev\" + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.snapshot.create_repository( + name="my_gcs_repository", + repository={ + "type": "gcs", + "settings": { + "bucket": "my_other_bucket", + "base_path": "dev" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.snapshot.createRepository({ + name: "my_gcs_repository", + repository: { + type: "gcs", + settings: { + bucket: "my_other_bucket", + base_path: "dev", + }, + }, + }); + - language: Ruby + code: |- + response = client.snapshot.create_repository( + repository: "my_gcs_repository", + body: { + "type": "gcs", + "settings": { + "bucket": "my_other_bucket", + "base_path": "dev" + } + } + ) + - language: PHP + code: |- + $resp = $client->snapshot()->createRepository([ + "repository" => "my_gcs_repository", + "body" => [ + "type" => "gcs", + "settings" => [ + "bucket" => "my_other_bucket", + "base_path" => "dev", + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"type":"gcs","settings":{"bucket":"my_other_bucket","base_path":"dev"}}'' + "$ELASTICSEARCH_URL/_snapshot/my_gcs_repository"' diff --git a/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample4.yaml b/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample4.yaml index 2140caee4c..b119c6d1ea 100644 --- a/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample4.yaml +++ b/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample4.yaml @@ -2,6 +2,63 @@ summary: An S3 repository method_request: PUT _snapshot/my_s3_repository description: Run `PUT /_snapshot/my_s3_repository` to create or update an AWS S3 snapshot repository. # type: request -value: - "{\n \"type\": \"s3\",\n \"settings\": {\n \"bucket\": \"my-bucket\"\n\ - \ }\n}" +value: "{ + + \ \"type\": \"s3\", + + \ \"settings\": { + + \ \"bucket\": \"my-bucket\" + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.snapshot.create_repository( + name="my_s3_repository", + repository={ + "type": "s3", + "settings": { + "bucket": "my-bucket" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.snapshot.createRepository({ + name: "my_s3_repository", + repository: { + type: "s3", + settings: { + bucket: "my-bucket", + }, + }, + }); + - language: Ruby + code: |- + response = client.snapshot.create_repository( + repository: "my_s3_repository", + body: { + "type": "s3", + "settings": { + "bucket": "my-bucket" + } + } + ) + - language: PHP + code: |- + $resp = $client->snapshot()->createRepository([ + "repository" => "my_s3_repository", + "body" => [ + "type" => "s3", + "settings" => [ + "bucket" => "my-bucket", + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"type":"s3","settings":{"bucket":"my-bucket"}}'' "$ELASTICSEARCH_URL/_snapshot/my_s3_repository"' diff --git a/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample5.yaml b/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample5.yaml index c34f5110cf..22642c1576 100644 --- a/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample5.yaml +++ b/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample5.yaml @@ -2,6 +2,70 @@ summary: A source-only repository method_request: PUT _snapshot/my_src_only_repository description: Run `PUT _snapshot/my_src_only_repository` to create or update a source-only snapshot repository. # type: request -value: - "{\n \"type\": \"source\",\n \"settings\": {\n \"delegate_type\": \"fs\"\ - ,\n \"location\": \"my_backup_repository\"\n }\n}" +value: "{ + + \ \"type\": \"source\", + + \ \"settings\": { + + \ \"delegate_type\": \"fs\", + + \ \"location\": \"my_backup_repository\" + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.snapshot.create_repository( + name="my_src_only_repository", + repository={ + "type": "source", + "settings": { + "delegate_type": "fs", + "location": "my_backup_repository" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.snapshot.createRepository({ + name: "my_src_only_repository", + repository: { + type: "source", + settings: { + delegate_type: "fs", + location: "my_backup_repository", + }, + }, + }); + - language: Ruby + code: |- + response = client.snapshot.create_repository( + repository: "my_src_only_repository", + body: { + "type": "source", + "settings": { + "delegate_type": "fs", + "location": "my_backup_repository" + } + } + ) + - language: PHP + code: |- + $resp = $client->snapshot()->createRepository([ + "repository" => "my_src_only_repository", + "body" => [ + "type" => "source", + "settings" => [ + "delegate_type" => "fs", + "location" => "my_backup_repository", + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"type":"source","settings":{"delegate_type":"fs","location":"my_backup_repository"}}'' + "$ELASTICSEARCH_URL/_snapshot/my_src_only_repository"' diff --git a/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample6.yaml b/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample6.yaml index efa63c0250..0d99e1c5cf 100644 --- a/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample6.yaml +++ b/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample6.yaml @@ -2,6 +2,64 @@ summary: A read-only URL repository method_request: PUT _snapshot/my_read_only_url_repository description: Run `PUT _snapshot/my_read_only_url_repository` to create or update a read-only URL snapshot repository. # type: request -value: - "{\n \"type\": \"url\",\n \"settings\": {\n \"url\": \"file:/mount/backups/my_fs_backup_location\"\ - \n }\n}" +value: "{ + + \ \"type\": \"url\", + + \ \"settings\": { + + \ \"url\": \"file:/mount/backups/my_fs_backup_location\" + + \ } + + }" +alternatives: + - language: Python + code: |- + resp = client.snapshot.create_repository( + name="my_read_only_url_repository", + repository={ + "type": "url", + "settings": { + "url": "file:/mount/backups/my_fs_backup_location" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.snapshot.createRepository({ + name: "my_read_only_url_repository", + repository: { + type: "url", + settings: { + url: "file:/mount/backups/my_fs_backup_location", + }, + }, + }); + - language: Ruby + code: |- + response = client.snapshot.create_repository( + repository: "my_read_only_url_repository", + body: { + "type": "url", + "settings": { + "url": "file:/mount/backups/my_fs_backup_location" + } + } + ) + - language: PHP + code: |- + $resp = $client->snapshot()->createRepository([ + "repository" => "my_read_only_url_repository", + "body" => [ + "type" => "url", + "settings" => [ + "url" => "file:/mount/backups/my_fs_backup_location", + ], + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"type":"url","settings":{"url":"file:/mount/backups/my_fs_backup_location"}}'' + "$ELASTICSEARCH_URL/_snapshot/my_read_only_url_repository"' diff --git a/specification/snapshot/delete/examples/request/SnapshotDeleteRequestExample1.yaml b/specification/snapshot/delete/examples/request/SnapshotDeleteRequestExample1.yaml index ae0b5b6df6..e879869c67 100644 --- a/specification/snapshot/delete/examples/request/SnapshotDeleteRequestExample1.yaml +++ b/specification/snapshot/delete/examples/request/SnapshotDeleteRequestExample1.yaml @@ -1 +1,28 @@ method_request: DELETE /_snapshot/my_repository/snapshot_2,snapshot_3 +alternatives: + - language: Python + code: |- + resp = client.snapshot.delete( + repository="my_repository", + snapshot="snapshot_2,snapshot_3", + ) + - language: JavaScript + code: |- + const response = await client.snapshot.delete({ + repository: "my_repository", + snapshot: "snapshot_2,snapshot_3", + }); + - language: Ruby + code: |- + response = client.snapshot.delete( + repository: "my_repository", + snapshot: "snapshot_2,snapshot_3" + ) + - language: PHP + code: |- + $resp = $client->snapshot()->delete([ + "repository" => "my_repository", + "snapshot" => "snapshot_2,snapshot_3", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_snapshot/my_repository/snapshot_2,snapshot_3"' diff --git a/specification/snapshot/delete_repository/examples/request/SnapshotDeleteRepositoryExample1.yaml b/specification/snapshot/delete_repository/examples/request/SnapshotDeleteRepositoryExample1.yaml index e60bd7a306..b256110836 100644 --- a/specification/snapshot/delete_repository/examples/request/SnapshotDeleteRepositoryExample1.yaml +++ b/specification/snapshot/delete_repository/examples/request/SnapshotDeleteRepositoryExample1.yaml @@ -1 +1,24 @@ method_request: DELETE /_snapshot/my_repository +alternatives: + - language: Python + code: |- + resp = client.snapshot.delete_repository( + name="my_repository", + ) + - language: JavaScript + code: |- + const response = await client.snapshot.deleteRepository({ + name: "my_repository", + }); + - language: Ruby + code: |- + response = client.snapshot.delete_repository( + repository: "my_repository" + ) + - language: PHP + code: |- + $resp = $client->snapshot()->deleteRepository([ + "repository" => "my_repository", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_snapshot/my_repository"' diff --git a/specification/snapshot/get/examples/request/SnapshotGetRequestExample1.yaml b/specification/snapshot/get/examples/request/SnapshotGetRequestExample1.yaml index 18780bc2f9..7197e3236c 100644 --- a/specification/snapshot/get/examples/request/SnapshotGetRequestExample1.yaml +++ b/specification/snapshot/get/examples/request/SnapshotGetRequestExample1.yaml @@ -1 +1,37 @@ method_request: GET /_snapshot/my_repository/snapshot_*?sort=start_time&from_sort_value=1577833200000 +alternatives: + - language: Python + code: |- + resp = client.snapshot.get( + repository="my_repository", + snapshot="snapshot_*", + sort="start_time", + from_sort_value="1577833200000", + ) + - language: JavaScript + code: |- + const response = await client.snapshot.get({ + repository: "my_repository", + snapshot: "snapshot_*", + sort: "start_time", + from_sort_value: 1577833200000, + }); + - language: Ruby + code: |- + response = client.snapshot.get( + repository: "my_repository", + snapshot: "snapshot_*", + sort: "start_time", + from_sort_value: "1577833200000" + ) + - language: PHP + code: |- + $resp = $client->snapshot()->get([ + "repository" => "my_repository", + "snapshot" => "snapshot_*", + "sort" => "start_time", + "from_sort_value" => "1577833200000", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_snapshot/my_repository/snapshot_*?sort=start_time&from_sort_value=1577833200000"' diff --git a/specification/snapshot/get_repository/examples/request/SnapshotGetRepositoryRequestExample1.yaml b/specification/snapshot/get_repository/examples/request/SnapshotGetRepositoryRequestExample1.yaml index b327a9b4d9..4d2c73e944 100644 --- a/specification/snapshot/get_repository/examples/request/SnapshotGetRepositoryRequestExample1.yaml +++ b/specification/snapshot/get_repository/examples/request/SnapshotGetRepositoryRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET /_snapshot/my_repository +alternatives: + - language: Python + code: |- + resp = client.snapshot.get_repository( + name="my_repository", + ) + - language: JavaScript + code: |- + const response = await client.snapshot.getRepository({ + name: "my_repository", + }); + - language: Ruby + code: |- + response = client.snapshot.get_repository( + repository: "my_repository" + ) + - language: PHP + code: |- + $resp = $client->snapshot()->getRepository([ + "repository" => "my_repository", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_snapshot/my_repository"' diff --git a/specification/snapshot/repository_analyze/examples/request/SnapshotRepositoryAnalyzeRequestExample1.yaml b/specification/snapshot/repository_analyze/examples/request/SnapshotRepositoryAnalyzeRequestExample1.yaml index d8348ca32b..87dbdc32c4 100644 --- a/specification/snapshot/repository_analyze/examples/request/SnapshotRepositoryAnalyzeRequestExample1.yaml +++ b/specification/snapshot/repository_analyze/examples/request/SnapshotRepositoryAnalyzeRequestExample1.yaml @@ -2,3 +2,39 @@ summary: Analyze a repository method_request: POST /_snapshot/my_repository/_analyze?blob_count=10&max_blob_size=1mb&timeout=120s type: request description: Analyze `my_repository` by writing 10 blobs of 1mb max. Cancel the test after 2 minutes. +alternatives: + - language: Python + code: |- + resp = client.snapshot.repository_analyze( + name="my_repository", + blob_count="10", + max_blob_size="1mb", + timeout="120s", + ) + - language: JavaScript + code: |- + const response = await client.snapshot.repositoryAnalyze({ + name: "my_repository", + blob_count: 10, + max_blob_size: "1mb", + timeout: "120s", + }); + - language: Ruby + code: |- + response = client.snapshot.repository_analyze( + repository: "my_repository", + blob_count: "10", + max_blob_size: "1mb", + timeout: "120s" + ) + - language: PHP + code: |- + $resp = $client->snapshot()->repositoryAnalyze([ + "repository" => "my_repository", + "blob_count" => "10", + "max_blob_size" => "1mb", + "timeout" => "120s", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_snapshot/my_repository/_analyze?blob_count=10&max_blob_size=1mb&timeout=120s"' diff --git a/specification/snapshot/repository_verify_integrity/examples/request/SnapshotRepositoryVerifyIntegrityExample1.yaml b/specification/snapshot/repository_verify_integrity/examples/request/SnapshotRepositoryVerifyIntegrityExample1.yaml index 615f0c9723..45c1f0602e 100644 --- a/specification/snapshot/repository_verify_integrity/examples/request/SnapshotRepositoryVerifyIntegrityExample1.yaml +++ b/specification/snapshot/repository_verify_integrity/examples/request/SnapshotRepositoryVerifyIntegrityExample1.yaml @@ -1 +1,31 @@ method_request: POST /_snapshot/my_repository/_verify_integrity +alternatives: + - language: Python + code: |- + resp = client.perform_request( + "POST", + "/_snapshot/my_repository/_verify_integrity", + ) + - language: JavaScript + code: |- + const response = await client.transport.request({ + method: "POST", + path: "/_snapshot/my_repository/_verify_integrity", + }); + - language: Ruby + code: |- + response = client.perform_request( + "POST", + "/_snapshot/my_repository/_verify_integrity", + {}, + ) + - language: PHP + code: |- + $requestFactory = Psr17FactoryDiscovery::findRequestFactory(); + $request = $requestFactory->createRequest( + "POST", + "/_snapshot/my_repository/_verify_integrity", + ); + $resp = $client->sendRequest($request); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_snapshot/my_repository/_verify_integrity"' diff --git a/specification/snapshot/restore/examples/request/SnapshotRestoreRequestExample1.yaml b/specification/snapshot/restore/examples/request/SnapshotRestoreRequestExample1.yaml index ae04fbe1b3..5c5be823f0 100644 --- a/specification/snapshot/restore/examples/request/SnapshotRestoreRequestExample1.yaml +++ b/specification/snapshot/restore/examples/request/SnapshotRestoreRequestExample1.yaml @@ -1,12 +1,85 @@ summary: Restore with rename pattern method_request: POST /_snapshot/my_repository/snapshot_2/_restore?wait_for_completion=true description: > - Run `POST /_snapshot/my_repository/snapshot_2/_restore?wait_for_completion=true`. - It restores `index_1` and `index_2` from `snapshot_2`. - The `rename_pattern` and `rename_replacement` parameters indicate any index matching the regular expression `index_(.+)` will be renamed using the pattern `restored_index_$1`. - For example, `index_1` will be renamed to `restored_index_1`. + Run `POST /_snapshot/my_repository/snapshot_2/_restore?wait_for_completion=true`. It restores `index_1` and `index_2` from + `snapshot_2`. The `rename_pattern` and `rename_replacement` parameters indicate any index matching the regular expression + `index_(.+)` will be renamed using the pattern `restored_index_$1`. For example, `index_1` will be renamed to `restored_index_1`. # type: request -value: - "{\n \"indices\": \"index_1,index_2\",\n \"ignore_unavailable\": true,\n\ - \ \"include_global_state\": false,\n \"rename_pattern\": \"index_(.+)\",\n \"\ - rename_replacement\": \"restored_index_$1\",\n \"include_aliases\": false\n}" +value: "{ + + \ \"indices\": \"index_1,index_2\", + + \ \"ignore_unavailable\": true, + + \ \"include_global_state\": false, + + \ \"rename_pattern\": \"index_(.+)\", + + \ \"rename_replacement\": \"restored_index_$1\", + + \ \"include_aliases\": false + + }" +alternatives: + - language: Python + code: |- + resp = client.snapshot.restore( + repository="my_repository", + snapshot="snapshot_2", + wait_for_completion=True, + indices="index_1,index_2", + ignore_unavailable=True, + include_global_state=False, + rename_pattern="index_(.+)", + rename_replacement="restored_index_$1", + include_aliases=False, + ) + - language: JavaScript + code: |- + const response = await client.snapshot.restore({ + repository: "my_repository", + snapshot: "snapshot_2", + wait_for_completion: "true", + indices: "index_1,index_2", + ignore_unavailable: true, + include_global_state: false, + rename_pattern: "index_(.+)", + rename_replacement: "restored_index_$1", + include_aliases: false, + }); + - language: Ruby + code: |- + response = client.snapshot.restore( + repository: "my_repository", + snapshot: "snapshot_2", + wait_for_completion: "true", + body: { + "indices": "index_1,index_2", + "ignore_unavailable": true, + "include_global_state": false, + "rename_pattern": "index_(.+)", + "rename_replacement": "restored_index_$1", + "include_aliases": false + } + ) + - language: PHP + code: |- + $resp = $client->snapshot()->restore([ + "repository" => "my_repository", + "snapshot" => "snapshot_2", + "wait_for_completion" => "true", + "body" => [ + "indices" => "index_1,index_2", + "ignore_unavailable" => true, + "include_global_state" => false, + "rename_pattern" => "index_(.+)", + "rename_replacement" => "restored_index_$1", + "include_aliases" => false, + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"indices\":\"index_1,index_2\",\"ignore_unavailable\":true,\"include_global_state\":false,\"rename_pattern\":\"index_(.+)\ + \",\"rename_replacement\":\"restored_index_$1\",\"include_aliases\":false}' + \"$ELASTICSEARCH_URL/_snapshot/my_repository/snapshot_2/_restore?wait_for_completion=true\"" diff --git a/specification/snapshot/restore/examples/request/SnapshotRestoreRequestExample2.yaml b/specification/snapshot/restore/examples/request/SnapshotRestoreRequestExample2.yaml index 851462ef2a..e97a7197d8 100644 --- a/specification/snapshot/restore/examples/request/SnapshotRestoreRequestExample2.yaml +++ b/specification/snapshot/restore/examples/request/SnapshotRestoreRequestExample2.yaml @@ -1,8 +1,38 @@ summary: Restore in-place method_request: PUT _cluster/settings description: > - Close `index_1` then run `POST /_snapshot/my_repository/snapshot_2/_restore?wait_for_completion=true` to restore an index in-place. - For example, you might want to perform this type of restore operation when no alternative options surface after the cluster allocation explain API reports `no_valid_shard_copy`. + Close `index_1` then run `POST /_snapshot/my_repository/snapshot_2/_restore?wait_for_completion=true` to restore an index + in-place. For example, you might want to perform this type of restore operation when no alternative options surface after the + cluster allocation explain API reports `no_valid_shard_copy`. # type: request value: indices: index_1 +alternatives: + - language: Python + code: |- + resp = client.cluster.put_settings( + indices="index_1", + ) + - language: JavaScript + code: |- + const response = await client.cluster.putSettings({ + indices: "index_1", + }); + - language: Ruby + code: |- + response = client.cluster.put_settings( + body: { + "indices": "index_1" + } + ) + - language: PHP + code: |- + $resp = $client->cluster()->putSettings([ + "body" => [ + "indices" => "index_1", + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"indices":"index_1"}'' "$ELASTICSEARCH_URL/_cluster/settings"' diff --git a/specification/snapshot/status/examples/request/SnapshotStatusRequestExample1.yaml b/specification/snapshot/status/examples/request/SnapshotStatusRequestExample1.yaml index 37d4c3b95d..5a4a6f381e 100644 --- a/specification/snapshot/status/examples/request/SnapshotStatusRequestExample1.yaml +++ b/specification/snapshot/status/examples/request/SnapshotStatusRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET _snapshot/my_repository/snapshot_2/_status +alternatives: + - language: Python + code: |- + resp = client.snapshot.status( + repository="my_repository", + snapshot="snapshot_2", + ) + - language: JavaScript + code: |- + const response = await client.snapshot.status({ + repository: "my_repository", + snapshot: "snapshot_2", + }); + - language: Ruby + code: |- + response = client.snapshot.status( + repository: "my_repository", + snapshot: "snapshot_2" + ) + - language: PHP + code: |- + $resp = $client->snapshot()->status([ + "repository" => "my_repository", + "snapshot" => "snapshot_2", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_snapshot/my_repository/snapshot_2/_status"' diff --git a/specification/snapshot/verify_repository/examples/request/SnapshotVerifyRepositoryExample1.yaml b/specification/snapshot/verify_repository/examples/request/SnapshotVerifyRepositoryExample1.yaml index 3ed8b23d23..d9931ab53d 100644 --- a/specification/snapshot/verify_repository/examples/request/SnapshotVerifyRepositoryExample1.yaml +++ b/specification/snapshot/verify_repository/examples/request/SnapshotVerifyRepositoryExample1.yaml @@ -1 +1,24 @@ method_request: POST _snapshot/my_unverified_backup/_verify +alternatives: + - language: Python + code: |- + resp = client.snapshot.verify_repository( + name="my_unverified_backup", + ) + - language: JavaScript + code: |- + const response = await client.snapshot.verifyRepository({ + name: "my_unverified_backup", + }); + - language: Ruby + code: |- + response = client.snapshot.verify_repository( + repository: "my_unverified_backup" + ) + - language: PHP + code: |- + $resp = $client->snapshot()->verifyRepository([ + "repository" => "my_unverified_backup", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_snapshot/my_unverified_backup/_verify"' diff --git a/specification/sql/clear_cursor/examples/request/ClearSqlCursorRequestExample1.yaml b/specification/sql/clear_cursor/examples/request/ClearSqlCursorRequestExample1.yaml index 7a0e161e30..9019c75fa8 100644 --- a/specification/sql/clear_cursor/examples/request/ClearSqlCursorRequestExample1.yaml +++ b/specification/sql/clear_cursor/examples/request/ClearSqlCursorRequestExample1.yaml @@ -2,6 +2,40 @@ method_request: POST _sql/close description: Run `POST _sql/close` to clear an SQL search cursor. # type: request -value: - "{\n \"cursor\": \"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\"\ - \n}" +value: "{ + + \ \"cursor\": + \"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\" + + }" +alternatives: + - language: Python + code: >- + resp = client.sql.clear_cursor( + cursor="sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=", + ) + - language: JavaScript + code: |- + const response = await client.sql.clearCursor({ + cursor: + "sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=", + }); + - language: Ruby + code: >- + response = client.sql.clear_cursor( + body: { + "cursor": "sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=" + } + ) + - language: PHP + code: >- + $resp = $client->sql()->clearCursor([ + "body" => [ + "cursor" => "sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=", + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"cursor\":\"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy\ + 9f///w8=\"}' \"$ELASTICSEARCH_URL/_sql/close\"" diff --git a/specification/sql/delete_async/examples/request/SqlDeleteAsyncExample1.yaml b/specification/sql/delete_async/examples/request/SqlDeleteAsyncExample1.yaml index 20507060b5..fc9fbc4c83 100644 --- a/specification/sql/delete_async/examples/request/SqlDeleteAsyncExample1.yaml +++ b/specification/sql/delete_async/examples/request/SqlDeleteAsyncExample1.yaml @@ -1 +1,25 @@ method_request: DELETE _sql/async/delete/FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI= +alternatives: + - language: Python + code: |- + resp = client.sql.delete_async( + id="FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=", + ) + - language: JavaScript + code: |- + const response = await client.sql.deleteAsync({ + id: "FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=", + }); + - language: Ruby + code: |- + response = client.sql.delete_async( + id: "FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=" + ) + - language: PHP + code: |- + $resp = $client->sql()->deleteAsync([ + "id" => "FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_sql/async/delete/FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI="' diff --git a/specification/sql/get_async/examples/request/SqlGetAsyncExample1.yaml b/specification/sql/get_async/examples/request/SqlGetAsyncExample1.yaml index 24bc18cf81..45e0daa0a9 100644 --- a/specification/sql/get_async/examples/request/SqlGetAsyncExample1.yaml +++ b/specification/sql/get_async/examples/request/SqlGetAsyncExample1.yaml @@ -1 +1,33 @@ method_request: GET _sql/async/FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=?wait_for_completion_timeout=2s&format=json +alternatives: + - language: Python + code: |- + resp = client.sql.get_async( + id="FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=", + wait_for_completion_timeout="2s", + format="json", + ) + - language: JavaScript + code: |- + const response = await client.sql.getAsync({ + id: "FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=", + wait_for_completion_timeout: "2s", + format: "json", + }); + - language: Ruby + code: |- + response = client.sql.get_async( + id: "FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=", + wait_for_completion_timeout: "2s", + format: "json" + ) + - language: PHP + code: |- + $resp = $client->sql()->getAsync([ + "id" => "FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=", + "wait_for_completion_timeout" => "2s", + "format" => "json", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_sql/async/FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=?wait_for_completion_timeout=2s&format=json"' diff --git a/specification/sql/get_async_status/examples/request/SqlGetAsyncStatusExample1.yaml b/specification/sql/get_async_status/examples/request/SqlGetAsyncStatusExample1.yaml index 26d6c9f359..a19a8ba9e0 100644 --- a/specification/sql/get_async_status/examples/request/SqlGetAsyncStatusExample1.yaml +++ b/specification/sql/get_async_status/examples/request/SqlGetAsyncStatusExample1.yaml @@ -1 +1,25 @@ method_request: GET _sql/async/status/FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU= +alternatives: + - language: Python + code: |- + resp = client.sql.get_async_status( + id="FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=", + ) + - language: JavaScript + code: |- + const response = await client.sql.getAsyncStatus({ + id: "FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=", + }); + - language: Ruby + code: |- + response = client.sql.get_async_status( + id: "FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=" + ) + - language: PHP + code: |- + $resp = $client->sql()->getAsyncStatus([ + "id" => "FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_sql/async/status/FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU="' diff --git a/specification/sql/query/examples/request/QuerySqlRequestExample1.yaml b/specification/sql/query/examples/request/QuerySqlRequestExample1.yaml index 3ce3f9b4ff..0458614bc6 100644 --- a/specification/sql/query/examples/request/QuerySqlRequestExample1.yaml +++ b/specification/sql/query/examples/request/QuerySqlRequestExample1.yaml @@ -2,6 +2,41 @@ method_request: POST _sql?format=txt description: Run `POST _sql?format=txt` to get results for an SQL search. # type: request -value: - "{\n \"query\": \"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\"\ - \n}" +value: "{ + + \ \"query\": \"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\" + + }" +alternatives: + - language: Python + code: |- + resp = client.sql.query( + format="txt", + query="SELECT * FROM library ORDER BY page_count DESC LIMIT 5", + ) + - language: JavaScript + code: |- + const response = await client.sql.query({ + format: "txt", + query: "SELECT * FROM library ORDER BY page_count DESC LIMIT 5", + }); + - language: Ruby + code: |- + response = client.sql.query( + format: "txt", + body: { + "query": "SELECT * FROM library ORDER BY page_count DESC LIMIT 5" + } + ) + - language: PHP + code: |- + $resp = $client->sql()->query([ + "format" => "txt", + "body" => [ + "query" => "SELECT * FROM library ORDER BY page_count DESC LIMIT 5", + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"query":"SELECT * + FROM library ORDER BY page_count DESC LIMIT 5"}'' "$ELASTICSEARCH_URL/_sql?format=txt"' diff --git a/specification/sql/translate/examples/request/TranslateSqlRequestExample1.yaml b/specification/sql/translate/examples/request/TranslateSqlRequestExample1.yaml index 7579045f2c..78720d7f83 100644 --- a/specification/sql/translate/examples/request/TranslateSqlRequestExample1.yaml +++ b/specification/sql/translate/examples/request/TranslateSqlRequestExample1.yaml @@ -2,6 +2,43 @@ summary: sql/apis/sql-translate-api.asciidoc:12 method_request: POST _sql/translate description: '' type: request -value: - "{\n \"query\": \"SELECT * FROM library ORDER BY page_count DESC\",\n \"\ - fetch_size\": 10\n}" +value: "{ + + \ \"query\": \"SELECT * FROM library ORDER BY page_count DESC\", + + \ \"fetch_size\": 10 + + }" +alternatives: + - language: Python + code: |- + resp = client.sql.translate( + query="SELECT * FROM library ORDER BY page_count DESC", + fetch_size=10, + ) + - language: JavaScript + code: |- + const response = await client.sql.translate({ + query: "SELECT * FROM library ORDER BY page_count DESC", + fetch_size: 10, + }); + - language: Ruby + code: |- + response = client.sql.translate( + body: { + "query": "SELECT * FROM library ORDER BY page_count DESC", + "fetch_size": 10 + } + ) + - language: PHP + code: |- + $resp = $client->sql()->translate([ + "body" => [ + "query" => "SELECT * FROM library ORDER BY page_count DESC", + "fetch_size" => 10, + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"query":"SELECT * + FROM library ORDER BY page_count DESC","fetch_size":10}'' "$ELASTICSEARCH_URL/_sql/translate"' diff --git a/specification/ssl/certificates/examples/request/GetCertificatesRequestExample1.yaml b/specification/ssl/certificates/examples/request/GetCertificatesRequestExample1.yaml index 175c6df797..49b591baf5 100644 --- a/specification/ssl/certificates/examples/request/GetCertificatesRequestExample1.yaml +++ b/specification/ssl/certificates/examples/request/GetCertificatesRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET /_ssl/certificates +alternatives: + - language: Python + code: resp = client.ssl.certificates() + - language: JavaScript + code: const response = await client.ssl.certificates(); + - language: Ruby + code: response = client.ssl.certificates + - language: PHP + code: $resp = $client->ssl()->certificates(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_ssl/certificates"' diff --git a/specification/synonyms/delete_synonym/examples/request/SynonymsDeleteSynonymExample1.yaml b/specification/synonyms/delete_synonym/examples/request/SynonymsDeleteSynonymExample1.yaml index 6950eb1400..7fa7ad11b6 100644 --- a/specification/synonyms/delete_synonym/examples/request/SynonymsDeleteSynonymExample1.yaml +++ b/specification/synonyms/delete_synonym/examples/request/SynonymsDeleteSynonymExample1.yaml @@ -1 +1,24 @@ method_request: DELETE _synonyms/my-synonyms-set +alternatives: + - language: Python + code: |- + resp = client.synonyms.delete_synonym( + id="my-synonyms-set", + ) + - language: JavaScript + code: |- + const response = await client.synonyms.deleteSynonym({ + id: "my-synonyms-set", + }); + - language: Ruby + code: |- + response = client.synonyms.delete_synonym( + id: "my-synonyms-set" + ) + - language: PHP + code: |- + $resp = $client->synonyms()->deleteSynonym([ + "id" => "my-synonyms-set", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_synonyms/my-synonyms-set"' diff --git a/specification/synonyms/delete_synonym_rule/examples/request/SynonymRuleDeleteRequestExample1.yaml b/specification/synonyms/delete_synonym_rule/examples/request/SynonymRuleDeleteRequestExample1.yaml index c5704a7c19..19c37cc2c0 100644 --- a/specification/synonyms/delete_synonym_rule/examples/request/SynonymRuleDeleteRequestExample1.yaml +++ b/specification/synonyms/delete_synonym_rule/examples/request/SynonymRuleDeleteRequestExample1.yaml @@ -1 +1,28 @@ method_request: DELETE _synonyms/my-synonyms-set/test-1 +alternatives: + - language: Python + code: |- + resp = client.synonyms.delete_synonym_rule( + set_id="my-synonyms-set", + rule_id="test-1", + ) + - language: JavaScript + code: |- + const response = await client.synonyms.deleteSynonymRule({ + set_id: "my-synonyms-set", + rule_id: "test-1", + }); + - language: Ruby + code: |- + response = client.synonyms.delete_synonym_rule( + set_id: "my-synonyms-set", + rule_id: "test-1" + ) + - language: PHP + code: |- + $resp = $client->synonyms()->deleteSynonymRule([ + "set_id" => "my-synonyms-set", + "rule_id" => "test-1", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_synonyms/my-synonyms-set/test-1"' diff --git a/specification/synonyms/get_synonym/examples/request/SynonymsGetRequestExample1.yaml b/specification/synonyms/get_synonym/examples/request/SynonymsGetRequestExample1.yaml index 384a86fcc2..ee18c5a366 100644 --- a/specification/synonyms/get_synonym/examples/request/SynonymsGetRequestExample1.yaml +++ b/specification/synonyms/get_synonym/examples/request/SynonymsGetRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET _synonyms/my-synonyms-set +alternatives: + - language: Python + code: |- + resp = client.synonyms.get_synonym( + id="my-synonyms-set", + ) + - language: JavaScript + code: |- + const response = await client.synonyms.getSynonym({ + id: "my-synonyms-set", + }); + - language: Ruby + code: |- + response = client.synonyms.get_synonym( + id: "my-synonyms-set" + ) + - language: PHP + code: |- + $resp = $client->synonyms()->getSynonym([ + "id" => "my-synonyms-set", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_synonyms/my-synonyms-set"' diff --git a/specification/synonyms/get_synonym_rule/examples/request/SynonymRuleGetRequestExample1.yaml b/specification/synonyms/get_synonym_rule/examples/request/SynonymRuleGetRequestExample1.yaml index 05284fc243..6b25239a2d 100644 --- a/specification/synonyms/get_synonym_rule/examples/request/SynonymRuleGetRequestExample1.yaml +++ b/specification/synonyms/get_synonym_rule/examples/request/SynonymRuleGetRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET _synonyms/my-synonyms-set/test-1 +alternatives: + - language: Python + code: |- + resp = client.synonyms.get_synonym_rule( + set_id="my-synonyms-set", + rule_id="test-1", + ) + - language: JavaScript + code: |- + const response = await client.synonyms.getSynonymRule({ + set_id: "my-synonyms-set", + rule_id: "test-1", + }); + - language: Ruby + code: |- + response = client.synonyms.get_synonym_rule( + set_id: "my-synonyms-set", + rule_id: "test-1" + ) + - language: PHP + code: |- + $resp = $client->synonyms()->getSynonymRule([ + "set_id" => "my-synonyms-set", + "rule_id" => "test-1", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_synonyms/my-synonyms-set/test-1"' diff --git a/specification/synonyms/get_synonyms_sets/examples/request/SynonymsSetsGetRequestExample1.yaml b/specification/synonyms/get_synonyms_sets/examples/request/SynonymsSetsGetRequestExample1.yaml index 0b019af6ed..97939c8856 100644 --- a/specification/synonyms/get_synonyms_sets/examples/request/SynonymsSetsGetRequestExample1.yaml +++ b/specification/synonyms/get_synonyms_sets/examples/request/SynonymsSetsGetRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET _synonyms +alternatives: + - language: Python + code: resp = client.synonyms.get_synonyms_sets() + - language: JavaScript + code: const response = await client.synonyms.getSynonymsSets(); + - language: Ruby + code: response = client.synonyms.get_synonyms_sets + - language: PHP + code: $resp = $client->synonyms()->getSynonymsSets(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_synonyms"' diff --git a/specification/synonyms/put_synonym/examples/request/SynonymsPutRequestExample1.yaml b/specification/synonyms/put_synonym/examples/request/SynonymsPutRequestExample1.yaml index 333ab6f65f..62e162b3c3 100644 --- a/specification/synonyms/put_synonym/examples/request/SynonymsPutRequestExample1.yaml +++ b/specification/synonyms/put_synonym/examples/request/SynonymsPutRequestExample1.yaml @@ -1 +1,24 @@ method_request: PUT _synonyms/my-synonyms-set +alternatives: + - language: Python + code: |- + resp = client.synonyms.put_synonym( + id="my-synonyms-set", + ) + - language: JavaScript + code: |- + const response = await client.synonyms.putSynonym({ + id: "my-synonyms-set", + }); + - language: Ruby + code: |- + response = client.synonyms.put_synonym( + id: "my-synonyms-set" + ) + - language: PHP + code: |- + $resp = $client->synonyms()->putSynonym([ + "id" => "my-synonyms-set", + ]); + - language: curl + code: 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_synonyms/my-synonyms-set"' diff --git a/specification/synonyms/put_synonym_rule/examples/request/SynonymRulePutRequestExample1.yaml b/specification/synonyms/put_synonym_rule/examples/request/SynonymRulePutRequestExample1.yaml index ca6523d195..7fe8950e01 100644 --- a/specification/synonyms/put_synonym_rule/examples/request/SynonymRulePutRequestExample1.yaml +++ b/specification/synonyms/put_synonym_rule/examples/request/SynonymRulePutRequestExample1.yaml @@ -2,4 +2,45 @@ summary: synonyms/apis/put-synonym-rule.asciidoc:107 method_request: PUT _synonyms/my-synonyms-set/test-1 description: '' type: request -value: "{\n \"synonyms\": \"hello, hi, howdy\"\n}" +value: "{ + + \ \"synonyms\": \"hello, hi, howdy\" + + }" +alternatives: + - language: Python + code: |- + resp = client.synonyms.put_synonym_rule( + set_id="my-synonyms-set", + rule_id="test-1", + synonyms="hello, hi, howdy", + ) + - language: JavaScript + code: |- + const response = await client.synonyms.putSynonymRule({ + set_id: "my-synonyms-set", + rule_id: "test-1", + synonyms: "hello, hi, howdy", + }); + - language: Ruby + code: |- + response = client.synonyms.put_synonym_rule( + set_id: "my-synonyms-set", + rule_id: "test-1", + body: { + "synonyms": "hello, hi, howdy" + } + ) + - language: PHP + code: |- + $resp = $client->synonyms()->putSynonymRule([ + "set_id" => "my-synonyms-set", + "rule_id" => "test-1", + "body" => [ + "synonyms" => "hello, hi, howdy", + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"synonyms":"hello, + hi, howdy"}'' "$ELASTICSEARCH_URL/_synonyms/my-synonyms-set/test-1"' diff --git a/specification/tasks/cancel/examples/request/TasksCancelExample1.yaml b/specification/tasks/cancel/examples/request/TasksCancelExample1.yaml index b286e870fa..de8cd3fce1 100644 --- a/specification/tasks/cancel/examples/request/TasksCancelExample1.yaml +++ b/specification/tasks/cancel/examples/request/TasksCancelExample1.yaml @@ -1 +1,24 @@ method_request: POST _tasks//_cancel +alternatives: + - language: Python + code: |- + resp = client.tasks.cancel( + task_id="", + ) + - language: JavaScript + code: |- + const response = await client.tasks.cancel({ + task_id: "", + }); + - language: Ruby + code: |- + response = client.tasks.cancel( + task_id: "" + ) + - language: PHP + code: |- + $resp = $client->tasks()->cancel([ + "task_id" => "", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_tasks//_cancel"' diff --git a/specification/tasks/get/examples/request/GetTaskRequestExample2.yaml b/specification/tasks/get/examples/request/GetTaskRequestExample2.yaml index 7e7484325d..2866cc7023 100644 --- a/specification/tasks/get/examples/request/GetTaskRequestExample2.yaml +++ b/specification/tasks/get/examples/request/GetTaskRequestExample2.yaml @@ -1 +1,28 @@ method_request: GET _tasks?detailed=true&actions=*/delete/byquery +alternatives: + - language: Python + code: |- + resp = client.tasks.list( + detailed=True, + actions="*/delete/byquery", + ) + - language: JavaScript + code: |- + const response = await client.tasks.list({ + detailed: "true", + actions: "*/delete/byquery", + }); + - language: Ruby + code: |- + response = client.tasks.list( + detailed: "true", + actions: "*/delete/byquery" + ) + - language: PHP + code: |- + $resp = $client->tasks()->list([ + "detailed" => "true", + "actions" => "*/delete/byquery", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_tasks?detailed=true&actions=*/delete/byquery"' diff --git a/specification/tasks/list/examples/request/ListTasksRequestExample1.yaml b/specification/tasks/list/examples/request/ListTasksRequestExample1.yaml index ece939dea9..3caa781870 100644 --- a/specification/tasks/list/examples/request/ListTasksRequestExample1.yaml +++ b/specification/tasks/list/examples/request/ListTasksRequestExample1.yaml @@ -1 +1,28 @@ method_request: GET _tasks?actions=*search&detailed +alternatives: + - language: Python + code: |- + resp = client.tasks.list( + actions="*search", + detailed=True, + ) + - language: JavaScript + code: |- + const response = await client.tasks.list({ + actions: "*search", + detailed: "true", + }); + - language: Ruby + code: |- + response = client.tasks.list( + actions: "*search", + detailed: "true" + ) + - language: PHP + code: |- + $resp = $client->tasks()->list([ + "actions" => "*search", + "detailed" => "true", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_tasks?actions=*search&detailed"' diff --git a/specification/text_structure/find_field_structure/examples/request/FindFieldStructureRequestExample1.yaml b/specification/text_structure/find_field_structure/examples/request/FindFieldStructureRequestExample1.yaml index eaf803b14c..4ae09bd804 100644 --- a/specification/text_structure/find_field_structure/examples/request/FindFieldStructureRequestExample1.yaml +++ b/specification/text_structure/find_field_structure/examples/request/FindFieldStructureRequestExample1.yaml @@ -1 +1,29 @@ method_request: GET _text_structure/find_field_structure?index=test-logs&field=message +alternatives: + - language: Python + code: |- + resp = client.text_structure.find_field_structure( + index="test-logs", + field="message", + ) + - language: JavaScript + code: |- + const response = await client.textStructure.findFieldStructure({ + index: "test-logs", + field: "message", + }); + - language: Ruby + code: |- + response = client.text_structure.find_field_structure( + index: "test-logs", + field: "message" + ) + - language: PHP + code: |- + $resp = $client->textStructure()->findFieldStructure([ + "index" => "test-logs", + "field" => "message", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" + "$ELASTICSEARCH_URL/_text_structure/find_field_structure?index=test-logs&field=message"' diff --git a/specification/text_structure/find_message_structure/examples/request/FindMessageStructureRequestExample1.yaml b/specification/text_structure/find_message_structure/examples/request/FindMessageStructureRequestExample1.yaml index 55a9496b4e..915db8a301 100644 --- a/specification/text_structure/find_message_structure/examples/request/FindMessageStructureRequestExample1.yaml +++ b/specification/text_structure/find_message_structure/examples/request/FindMessageStructureRequestExample1.yaml @@ -3,34 +3,202 @@ method_request: POST _text_structure/find_message_structure description: > Run `POST _text_structure/find_message_structure` to analyze Elasticsearch log files. # type: request -value: - "{\n \"messages\": [\n \"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider]\ - \ [laptop] Java vector incubator API enabled; uses preferredBitSize=128\",\n \ - \ \"[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded\ - \ module [repository-url]\",\n \"[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService\ - \ ] [laptop] loaded module [rest-root]\",\n \"[2024-03-05T10:52:41,043][INFO\ - \ ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]\",\n \"[2024-03-05T10:52:41,043][INFO\ - \ ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]\",\n \"\ - [2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module\ - \ [ingest-user-agent]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService\ - \ ] [laptop] loaded module [x-pack-monitoring]\",\n \"[2024-03-05T10:52:41,044][INFO\ - \ ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]\",\n \"\ - [2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module\ - \ [x-pack-analytics]\",\n \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService\ - \ ] [laptop] loaded module [x-pack-ent-search]\",\n \"[2024-03-05T10:52:41,044][INFO\ - \ ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]\",\n\ - \ \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded\ - \ module [lang-painless]]\",\n \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService\ - \ ] [laptop] loaded module [lang-expression]\",\n \"[2024-03-05T10:52:41,059][INFO\ - \ ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]\",\n \"[2024-03-05T10:52:43,291][INFO\ - \ ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object\ - \ pointers [true]\",\n \"[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security \ - \ ] [laptop] Security is enabled\",\n \"[2024-03-05T10:52:47,227][INFO\ - \ ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled\",\n \"[2024-03-05T10:52:47,259][INFO\ - \ ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed\ - \ or reinstalled\",\n \"[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings\ - \ ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]\"\ - ,\n \"[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using\ - \ discovery type [multi-node] and seed hosts providers [settings]\",\n \"[2024-03-05T10:52:49,188][INFO\ - \ ][o.e.n.Node ] [laptop] initialized\",\n \"[2024-03-05T10:52:49,199][INFO\ - \ ][o.e.n.Node ] [laptop] starting ...\"\n ]\n}" +value: "{ + + \ \"messages\": [ + + \ \"[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses + preferredBitSize=128\", + + \ \"[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]\", + + \ \"[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]\", + + \ \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]\", + + \ \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]\", + + \ \"[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]\", + + \ \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]\", + + \ \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]\", + + \ \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]\", + + \ \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]\", + + \ \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]\", + + \ \"[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]\", + + \ \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]\", + + \ \"[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]\", + + \ \"[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers + [true]\", + + \ \"[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled\", + + \ \"[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled\", + + \ \"[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or + reinstalled\", + + \ \"[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, + write=0b, max=0b]\", + + \ \"[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts + providers [settings]\", + + \ \"[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized\", + + \ \"[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ...\" + + \ ] + + }" +alternatives: + - language: Python + code: >- + resp = client.text_structure.find_message_structure( + messages=[ + "[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128", + "[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]", + "[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]", + "[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]", + "[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]", + "[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]", + "[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]", + "[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]", + "[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]", + "[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled", + "[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled", + "[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled", + "[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]", + "[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]", + "[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized", + "[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ..." + ], + ) + - language: JavaScript + code: >- + const response = await client.textStructure.findMessageStructure({ + messages: [ + "[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128", + "[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]", + "[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]", + "[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]", + "[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]", + "[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]", + "[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]", + "[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]", + "[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]", + "[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled", + "[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled", + "[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled", + "[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]", + "[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]", + "[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized", + "[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ...", + ], + }); + - language: Ruby + code: >- + response = client.text_structure.find_message_structure( + body: { + "messages": [ + "[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128", + "[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]", + "[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]", + "[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]", + "[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]", + "[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]", + "[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]", + "[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]", + "[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]", + "[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled", + "[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled", + "[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled", + "[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]", + "[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]", + "[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized", + "[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ..." + ] + } + ) + - language: PHP + code: >- + $resp = $client->textStructure()->findMessageStructure([ + "body" => [ + "messages" => array( + "[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128", + "[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]", + "[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]", + "[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]", + "[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]", + "[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]", + "[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]", + "[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]", + "[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]", + "[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled", + "[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled", + "[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled", + "[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]", + "[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]", + "[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized", + "[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ...", + ), + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"messages":["[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API + enabled; uses preferredBitSize=128","[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module + [repository-url]","[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module + [rest-root]","[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module + [x-pack-core]","[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module + [x-pack-redact]","[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module + [ingest-user-agent]","[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module + [x-pack-monitoring]","[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module + [repository-s3]","[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module + [x-pack-analytics]","[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module + [x-pack-ent-search]","[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module + [x-pack-autoscaling]","[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module + [lang-painless]]","[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module + [lang-expression]","[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module + [x-pack-eql]","[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary + object pointers [true]","[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is + enabled","[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is + enabled","[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be + installed or reinstalled","[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with + [default=40mb, read=0b, write=0b, max=0b]","[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using + discovery type [multi-node] and seed hosts providers [settings]","[2024-03-05T10:52:49,188][INFO + ][o.e.n.Node ] [laptop] initialized","[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] + starting ..."]}'' "$ELASTICSEARCH_URL/_text_structure/find_message_structure"' diff --git a/specification/text_structure/find_structure/examples/request/FindStructureRequestExample1.yaml b/specification/text_structure/find_structure/examples/request/FindStructureRequestExample1.yaml index 732658d28d..d0a26b42ec 100644 --- a/specification/text_structure/find_structure/examples/request/FindStructureRequestExample1.yaml +++ b/specification/text_structure/find_structure/examples/request/FindStructureRequestExample1.yaml @@ -3,74 +3,680 @@ method_request: POST _text_structure/find_structure description: Run `POST _text_structure/find_structure` to analyze newline-delimited JSON text. # type: request value: - '{"name": "Leviathan Wakes", "author": "James S.A. Corey", "release_date": - "2011-06-02", "page_count": 561} + '{"name": "Leviathan Wakes", "author": "James S.A. Corey", "release_date": "2011-06-02", "page_count": 561} - {"name": "Hyperion", "author": "Dan Simmons", "release_date": "1989-05-26", "page_count": - 482} + {"name": "Hyperion", "author": "Dan Simmons", "release_date": "1989-05-26", "page_count": 482} - {"name": "Dune", "author": "Frank Herbert", "release_date": "1965-06-01", "page_count": - 604} + {"name": "Dune", "author": "Frank Herbert", "release_date": "1965-06-01", "page_count": 604} - {"name": "Dune Messiah", "author": "Frank Herbert", "release_date": "1969-10-15", - "page_count": 331} + {"name": "Dune Messiah", "author": "Frank Herbert", "release_date": "1969-10-15", "page_count": 331} - {"name": "Children of Dune", "author": "Frank Herbert", "release_date": "1976-04-21", - "page_count": 408} + {"name": "Children of Dune", "author": "Frank Herbert", "release_date": "1976-04-21", "page_count": 408} - {"name": "God Emperor of Dune", "author": "Frank Herbert", "release_date": "1981-05-28", - "page_count": 454} + {"name": "God Emperor of Dune", "author": "Frank Herbert", "release_date": "1981-05-28", "page_count": 454} - {"name": "Consider Phlebas", "author": "Iain M. Banks", "release_date": "1987-04-23", - "page_count": 471} + {"name": "Consider Phlebas", "author": "Iain M. Banks", "release_date": "1987-04-23", "page_count": 471} - {"name": "Pandora''s Star", "author": "Peter F. Hamilton", "release_date": "2004-03-02", - "page_count": 768} + {"name": "Pandora''s Star", "author": "Peter F. Hamilton", "release_date": "2004-03-02", "page_count": 768} - {"name": "Revelation Space", "author": "Alastair Reynolds", "release_date": "2000-03-15", - "page_count": 585} + {"name": "Revelation Space", "author": "Alastair Reynolds", "release_date": "2000-03-15", "page_count": 585} - {"name": "A Fire Upon the Deep", "author": "Vernor Vinge", "release_date": "1992-06-01", - "page_count": 613} + {"name": "A Fire Upon the Deep", "author": "Vernor Vinge", "release_date": "1992-06-01", "page_count": 613} - {"name": "Ender''s Game", "author": "Orson Scott Card", "release_date": "1985-06-01", - "page_count": 324} + {"name": "Ender''s Game", "author": "Orson Scott Card", "release_date": "1985-06-01", "page_count": 324} - {"name": "1984", "author": "George Orwell", "release_date": "1985-06-01", "page_count": - 328} + {"name": "1984", "author": "George Orwell", "release_date": "1985-06-01", "page_count": 328} - {"name": "Fahrenheit 451", "author": "Ray Bradbury", "release_date": "1953-10-15", - "page_count": 227} + {"name": "Fahrenheit 451", "author": "Ray Bradbury", "release_date": "1953-10-15", "page_count": 227} - {"name": "Brave New World", "author": "Aldous Huxley", "release_date": "1932-06-01", - "page_count": 268} + {"name": "Brave New World", "author": "Aldous Huxley", "release_date": "1932-06-01", "page_count": 268} - {"name": "Foundation", "author": "Isaac Asimov", "release_date": "1951-06-01", "page_count": - 224} + {"name": "Foundation", "author": "Isaac Asimov", "release_date": "1951-06-01", "page_count": 224} - {"name": "The Giver", "author": "Lois Lowry", "release_date": "1993-04-26", "page_count": - 208} + {"name": "The Giver", "author": "Lois Lowry", "release_date": "1993-04-26", "page_count": 208} - {"name": "Slaughterhouse-Five", "author": "Kurt Vonnegut", "release_date": "1969-06-01", - "page_count": 275} + {"name": "Slaughterhouse-Five", "author": "Kurt Vonnegut", "release_date": "1969-06-01", "page_count": 275} - {"name": "The Hitchhiker''s Guide to the Galaxy", "author": "Douglas Adams", "release_date": - "1979-10-12", "page_count": 180} + {"name": "The Hitchhiker''s Guide to the Galaxy", "author": "Douglas Adams", "release_date": "1979-10-12", "page_count": 180} - {"name": "Snow Crash", "author": "Neal Stephenson", "release_date": "1992-06-01", - "page_count": 470} + {"name": "Snow Crash", "author": "Neal Stephenson", "release_date": "1992-06-01", "page_count": 470} - {"name": "Neuromancer", "author": "William Gibson", "release_date": "1984-07-01", - "page_count": 271} + {"name": "Neuromancer", "author": "William Gibson", "release_date": "1984-07-01", "page_count": 271} - {"name": "The Handmaid''s Tale", "author": "Margaret Atwood", "release_date": "1985-06-01", - "page_count": 311} + {"name": "The Handmaid''s Tale", "author": "Margaret Atwood", "release_date": "1985-06-01", "page_count": 311} - {"name": "Starship Troopers", "author": "Robert A. Heinlein", "release_date": "1959-12-01", - "page_count": 335} + {"name": "Starship Troopers", "author": "Robert A. Heinlein", "release_date": "1959-12-01", "page_count": 335} - {"name": "The Left Hand of Darkness", "author": "Ursula K. Le Guin", "release_date": - "1969-06-01", "page_count": 304} + {"name": "The Left Hand of Darkness", "author": "Ursula K. Le Guin", "release_date": "1969-06-01", "page_count": 304} - {"name": "The Moon is a Harsh Mistress", "author": "Robert A. Heinlein", "release_date": - "1966-04-01", "page_count": 288}' + {"name": "The Moon is a Harsh Mistress", "author": "Robert A. Heinlein", "release_date": "1966-04-01", "page_count": 288}' +alternatives: + - language: Python + code: |- + resp = client.text_structure.find_structure( + text_files=[ + { + "name": "Leviathan Wakes", + "author": "James S.A. Corey", + "release_date": "2011-06-02", + "page_count": 561 + }, + { + "name": "Hyperion", + "author": "Dan Simmons", + "release_date": "1989-05-26", + "page_count": 482 + }, + { + "name": "Dune", + "author": "Frank Herbert", + "release_date": "1965-06-01", + "page_count": 604 + }, + { + "name": "Dune Messiah", + "author": "Frank Herbert", + "release_date": "1969-10-15", + "page_count": 331 + }, + { + "name": "Children of Dune", + "author": "Frank Herbert", + "release_date": "1976-04-21", + "page_count": 408 + }, + { + "name": "God Emperor of Dune", + "author": "Frank Herbert", + "release_date": "1981-05-28", + "page_count": 454 + }, + { + "name": "Consider Phlebas", + "author": "Iain M. Banks", + "release_date": "1987-04-23", + "page_count": 471 + }, + { + "name": "Pandora's Star", + "author": "Peter F. Hamilton", + "release_date": "2004-03-02", + "page_count": 768 + }, + { + "name": "Revelation Space", + "author": "Alastair Reynolds", + "release_date": "2000-03-15", + "page_count": 585 + }, + { + "name": "A Fire Upon the Deep", + "author": "Vernor Vinge", + "release_date": "1992-06-01", + "page_count": 613 + }, + { + "name": "Ender's Game", + "author": "Orson Scott Card", + "release_date": "1985-06-01", + "page_count": 324 + }, + { + "name": "1984", + "author": "George Orwell", + "release_date": "1985-06-01", + "page_count": 328 + }, + { + "name": "Fahrenheit 451", + "author": "Ray Bradbury", + "release_date": "1953-10-15", + "page_count": 227 + }, + { + "name": "Brave New World", + "author": "Aldous Huxley", + "release_date": "1932-06-01", + "page_count": 268 + }, + { + "name": "Foundation", + "author": "Isaac Asimov", + "release_date": "1951-06-01", + "page_count": 224 + }, + { + "name": "The Giver", + "author": "Lois Lowry", + "release_date": "1993-04-26", + "page_count": 208 + }, + { + "name": "Slaughterhouse-Five", + "author": "Kurt Vonnegut", + "release_date": "1969-06-01", + "page_count": 275 + }, + { + "name": "The Hitchhiker's Guide to the Galaxy", + "author": "Douglas Adams", + "release_date": "1979-10-12", + "page_count": 180 + }, + { + "name": "Snow Crash", + "author": "Neal Stephenson", + "release_date": "1992-06-01", + "page_count": 470 + }, + { + "name": "Neuromancer", + "author": "William Gibson", + "release_date": "1984-07-01", + "page_count": 271 + }, + { + "name": "The Handmaid's Tale", + "author": "Margaret Atwood", + "release_date": "1985-06-01", + "page_count": 311 + }, + { + "name": "Starship Troopers", + "author": "Robert A. Heinlein", + "release_date": "1959-12-01", + "page_count": 335 + }, + { + "name": "The Left Hand of Darkness", + "author": "Ursula K. Le Guin", + "release_date": "1969-06-01", + "page_count": 304 + }, + { + "name": "The Moon is a Harsh Mistress", + "author": "Robert A. Heinlein", + "release_date": "1966-04-01", + "page_count": 288 + } + ], + ) + - language: JavaScript + code: |- + const response = await client.textStructure.findStructure({ + text_files: [ + { + name: "Leviathan Wakes", + author: "James S.A. Corey", + release_date: "2011-06-02", + page_count: 561, + }, + { + name: "Hyperion", + author: "Dan Simmons", + release_date: "1989-05-26", + page_count: 482, + }, + { + name: "Dune", + author: "Frank Herbert", + release_date: "1965-06-01", + page_count: 604, + }, + { + name: "Dune Messiah", + author: "Frank Herbert", + release_date: "1969-10-15", + page_count: 331, + }, + { + name: "Children of Dune", + author: "Frank Herbert", + release_date: "1976-04-21", + page_count: 408, + }, + { + name: "God Emperor of Dune", + author: "Frank Herbert", + release_date: "1981-05-28", + page_count: 454, + }, + { + name: "Consider Phlebas", + author: "Iain M. Banks", + release_date: "1987-04-23", + page_count: 471, + }, + { + name: "Pandora's Star", + author: "Peter F. Hamilton", + release_date: "2004-03-02", + page_count: 768, + }, + { + name: "Revelation Space", + author: "Alastair Reynolds", + release_date: "2000-03-15", + page_count: 585, + }, + { + name: "A Fire Upon the Deep", + author: "Vernor Vinge", + release_date: "1992-06-01", + page_count: 613, + }, + { + name: "Ender's Game", + author: "Orson Scott Card", + release_date: "1985-06-01", + page_count: 324, + }, + { + name: "1984", + author: "George Orwell", + release_date: "1985-06-01", + page_count: 328, + }, + { + name: "Fahrenheit 451", + author: "Ray Bradbury", + release_date: "1953-10-15", + page_count: 227, + }, + { + name: "Brave New World", + author: "Aldous Huxley", + release_date: "1932-06-01", + page_count: 268, + }, + { + name: "Foundation", + author: "Isaac Asimov", + release_date: "1951-06-01", + page_count: 224, + }, + { + name: "The Giver", + author: "Lois Lowry", + release_date: "1993-04-26", + page_count: 208, + }, + { + name: "Slaughterhouse-Five", + author: "Kurt Vonnegut", + release_date: "1969-06-01", + page_count: 275, + }, + { + name: "The Hitchhiker's Guide to the Galaxy", + author: "Douglas Adams", + release_date: "1979-10-12", + page_count: 180, + }, + { + name: "Snow Crash", + author: "Neal Stephenson", + release_date: "1992-06-01", + page_count: 470, + }, + { + name: "Neuromancer", + author: "William Gibson", + release_date: "1984-07-01", + page_count: 271, + }, + { + name: "The Handmaid's Tale", + author: "Margaret Atwood", + release_date: "1985-06-01", + page_count: 311, + }, + { + name: "Starship Troopers", + author: "Robert A. Heinlein", + release_date: "1959-12-01", + page_count: 335, + }, + { + name: "The Left Hand of Darkness", + author: "Ursula K. Le Guin", + release_date: "1969-06-01", + page_count: 304, + }, + { + name: "The Moon is a Harsh Mistress", + author: "Robert A. Heinlein", + release_date: "1966-04-01", + page_count: 288, + }, + ], + }); + - language: Ruby + code: |- + response = client.text_structure.find_structure( + body: [ + { + "name": "Leviathan Wakes", + "author": "James S.A. Corey", + "release_date": "2011-06-02", + "page_count": 561 + }, + { + "name": "Hyperion", + "author": "Dan Simmons", + "release_date": "1989-05-26", + "page_count": 482 + }, + { + "name": "Dune", + "author": "Frank Herbert", + "release_date": "1965-06-01", + "page_count": 604 + }, + { + "name": "Dune Messiah", + "author": "Frank Herbert", + "release_date": "1969-10-15", + "page_count": 331 + }, + { + "name": "Children of Dune", + "author": "Frank Herbert", + "release_date": "1976-04-21", + "page_count": 408 + }, + { + "name": "God Emperor of Dune", + "author": "Frank Herbert", + "release_date": "1981-05-28", + "page_count": 454 + }, + { + "name": "Consider Phlebas", + "author": "Iain M. Banks", + "release_date": "1987-04-23", + "page_count": 471 + }, + { + "name": "Pandora's Star", + "author": "Peter F. Hamilton", + "release_date": "2004-03-02", + "page_count": 768 + }, + { + "name": "Revelation Space", + "author": "Alastair Reynolds", + "release_date": "2000-03-15", + "page_count": 585 + }, + { + "name": "A Fire Upon the Deep", + "author": "Vernor Vinge", + "release_date": "1992-06-01", + "page_count": 613 + }, + { + "name": "Ender's Game", + "author": "Orson Scott Card", + "release_date": "1985-06-01", + "page_count": 324 + }, + { + "name": "1984", + "author": "George Orwell", + "release_date": "1985-06-01", + "page_count": 328 + }, + { + "name": "Fahrenheit 451", + "author": "Ray Bradbury", + "release_date": "1953-10-15", + "page_count": 227 + }, + { + "name": "Brave New World", + "author": "Aldous Huxley", + "release_date": "1932-06-01", + "page_count": 268 + }, + { + "name": "Foundation", + "author": "Isaac Asimov", + "release_date": "1951-06-01", + "page_count": 224 + }, + { + "name": "The Giver", + "author": "Lois Lowry", + "release_date": "1993-04-26", + "page_count": 208 + }, + { + "name": "Slaughterhouse-Five", + "author": "Kurt Vonnegut", + "release_date": "1969-06-01", + "page_count": 275 + }, + { + "name": "The Hitchhiker's Guide to the Galaxy", + "author": "Douglas Adams", + "release_date": "1979-10-12", + "page_count": 180 + }, + { + "name": "Snow Crash", + "author": "Neal Stephenson", + "release_date": "1992-06-01", + "page_count": 470 + }, + { + "name": "Neuromancer", + "author": "William Gibson", + "release_date": "1984-07-01", + "page_count": 271 + }, + { + "name": "The Handmaid's Tale", + "author": "Margaret Atwood", + "release_date": "1985-06-01", + "page_count": 311 + }, + { + "name": "Starship Troopers", + "author": "Robert A. Heinlein", + "release_date": "1959-12-01", + "page_count": 335 + }, + { + "name": "The Left Hand of Darkness", + "author": "Ursula K. Le Guin", + "release_date": "1969-06-01", + "page_count": 304 + }, + { + "name": "The Moon is a Harsh Mistress", + "author": "Robert A. Heinlein", + "release_date": "1966-04-01", + "page_count": 288 + } + ] + ) + - language: PHP + code: |- + $resp = $client->textStructure()->findStructure([ + "body" => array( + [ + "name" => "Leviathan Wakes", + "author" => "James S.A. Corey", + "release_date" => "2011-06-02", + "page_count" => 561, + ], + [ + "name" => "Hyperion", + "author" => "Dan Simmons", + "release_date" => "1989-05-26", + "page_count" => 482, + ], + [ + "name" => "Dune", + "author" => "Frank Herbert", + "release_date" => "1965-06-01", + "page_count" => 604, + ], + [ + "name" => "Dune Messiah", + "author" => "Frank Herbert", + "release_date" => "1969-10-15", + "page_count" => 331, + ], + [ + "name" => "Children of Dune", + "author" => "Frank Herbert", + "release_date" => "1976-04-21", + "page_count" => 408, + ], + [ + "name" => "God Emperor of Dune", + "author" => "Frank Herbert", + "release_date" => "1981-05-28", + "page_count" => 454, + ], + [ + "name" => "Consider Phlebas", + "author" => "Iain M. Banks", + "release_date" => "1987-04-23", + "page_count" => 471, + ], + [ + "name" => "Pandora's Star", + "author" => "Peter F. Hamilton", + "release_date" => "2004-03-02", + "page_count" => 768, + ], + [ + "name" => "Revelation Space", + "author" => "Alastair Reynolds", + "release_date" => "2000-03-15", + "page_count" => 585, + ], + [ + "name" => "A Fire Upon the Deep", + "author" => "Vernor Vinge", + "release_date" => "1992-06-01", + "page_count" => 613, + ], + [ + "name" => "Ender's Game", + "author" => "Orson Scott Card", + "release_date" => "1985-06-01", + "page_count" => 324, + ], + [ + "name" => "1984", + "author" => "George Orwell", + "release_date" => "1985-06-01", + "page_count" => 328, + ], + [ + "name" => "Fahrenheit 451", + "author" => "Ray Bradbury", + "release_date" => "1953-10-15", + "page_count" => 227, + ], + [ + "name" => "Brave New World", + "author" => "Aldous Huxley", + "release_date" => "1932-06-01", + "page_count" => 268, + ], + [ + "name" => "Foundation", + "author" => "Isaac Asimov", + "release_date" => "1951-06-01", + "page_count" => 224, + ], + [ + "name" => "The Giver", + "author" => "Lois Lowry", + "release_date" => "1993-04-26", + "page_count" => 208, + ], + [ + "name" => "Slaughterhouse-Five", + "author" => "Kurt Vonnegut", + "release_date" => "1969-06-01", + "page_count" => 275, + ], + [ + "name" => "The Hitchhiker's Guide to the Galaxy", + "author" => "Douglas Adams", + "release_date" => "1979-10-12", + "page_count" => 180, + ], + [ + "name" => "Snow Crash", + "author" => "Neal Stephenson", + "release_date" => "1992-06-01", + "page_count" => 470, + ], + [ + "name" => "Neuromancer", + "author" => "William Gibson", + "release_date" => "1984-07-01", + "page_count" => 271, + ], + [ + "name" => "The Handmaid's Tale", + "author" => "Margaret Atwood", + "release_date" => "1985-06-01", + "page_count" => 311, + ], + [ + "name" => "Starship Troopers", + "author" => "Robert A. Heinlein", + "release_date" => "1959-12-01", + "page_count" => 335, + ], + [ + "name" => "The Left Hand of Darkness", + "author" => "Ursula K. Le Guin", + "release_date" => "1969-06-01", + "page_count" => 304, + ], + [ + "name" => "The Moon is a Harsh Mistress", + "author" => "Robert A. Heinlein", + "release_date" => "1966-04-01", + "page_count" => 288, + ], + ), + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''[{"name":"Leviathan + Wakes","author":"James S.A. + Corey","release_date":"2011-06-02","page_count":561},{"name":"Hyperion","author":"Dan + Simmons","release_date":"1989-05-26","page_count":482},{"name":"Dune","author":"Frank + Herbert","release_date":"1965-06-01","page_count":604},{"name":"Dune Messiah","author":"Frank + Herbert","release_date":"1969-10-15","page_count":331},{"name":"Children of Dune","author":"Frank + Herbert","release_date":"1976-04-21","page_count":408},{"name":"God Emperor of Dune","author":"Frank + Herbert","release_date":"1981-05-28","page_count":454},{"name":"Consider Phlebas","author":"Iain M. + Banks","release_date":"1987-04-23","page_count":471},{"name":"Pandora''"''"''s Star","author":"Peter F. + Hamilton","release_date":"2004-03-02","page_count":768},{"name":"Revelation Space","author":"Alastair + Reynolds","release_date":"2000-03-15","page_count":585},{"name":"A Fire Upon the Deep","author":"Vernor + Vinge","release_date":"1992-06-01","page_count":613},{"name":"Ender''"''"''s Game","author":"Orson Scott + Card","release_date":"1985-06-01","page_count":324},{"name":"1984","author":"George + Orwell","release_date":"1985-06-01","page_count":328},{"name":"Fahrenheit 451","author":"Ray + Bradbury","release_date":"1953-10-15","page_count":227},{"name":"Brave New World","author":"Aldous + Huxley","release_date":"1932-06-01","page_count":268},{"name":"Foundation","author":"Isaac + Asimov","release_date":"1951-06-01","page_count":224},{"name":"The Giver","author":"Lois + Lowry","release_date":"1993-04-26","page_count":208},{"name":"Slaughterhouse-Five","author":"Kurt + Vonnegut","release_date":"1969-06-01","page_count":275},{"name":"The Hitchhiker''"''"''s Guide to the + Galaxy","author":"Douglas Adams","release_date":"1979-10-12","page_count":180},{"name":"Snow + Crash","author":"Neal + Stephenson","release_date":"1992-06-01","page_count":470},{"name":"Neuromancer","author":"William + Gibson","release_date":"1984-07-01","page_count":271},{"name":"The Handmaid''"''"''s Tale","author":"Margaret + Atwood","release_date":"1985-06-01","page_count":311},{"name":"Starship Troopers","author":"Robert A. + Heinlein","release_date":"1959-12-01","page_count":335},{"name":"The Left Hand of Darkness","author":"Ursula K. + Le Guin","release_date":"1969-06-01","page_count":304},{"name":"The Moon is a Harsh Mistress","author":"Robert + A. Heinlein","release_date":"1966-04-01","page_count":288}]'' "$ELASTICSEARCH_URL/_text_structure/find_structure"' diff --git a/specification/text_structure/test_grok_pattern/examples/request/TestGrokPatternRequestExample1.yaml b/specification/text_structure/test_grok_pattern/examples/request/TestGrokPatternRequestExample1.yaml index dca16d4b08..b6da867dcb 100644 --- a/specification/text_structure/test_grok_pattern/examples/request/TestGrokPatternRequestExample1.yaml +++ b/specification/text_structure/test_grok_pattern/examples/request/TestGrokPatternRequestExample1.yaml @@ -2,6 +2,59 @@ method_request: GET _text_structure/test_grok_pattern description: Run `GET _text_structure/test_grok_pattern` to test a Grok pattern. # type: request -value: - "{\n \"grok_pattern\": \"Hello %{WORD:first_name} %{WORD:last_name}\",\n \ - \ \"text\": [\n \"Hello John Doe\",\n \"this does not match\"\n ]\n}" +value: "{ + + \ \"grok_pattern\": \"Hello %{WORD:first_name} %{WORD:last_name}\", + + \ \"text\": [ + + \ \"Hello John Doe\", + + \ \"this does not match\" + + \ ] + + }" +alternatives: + - language: Python + code: |- + resp = client.text_structure.test_grok_pattern( + grok_pattern="Hello %{WORD:first_name} %{WORD:last_name}", + text=[ + "Hello John Doe", + "this does not match" + ], + ) + - language: JavaScript + code: |- + const response = await client.textStructure.testGrokPattern({ + grok_pattern: "Hello %{WORD:first_name} %{WORD:last_name}", + text: ["Hello John Doe", "this does not match"], + }); + - language: Ruby + code: |- + response = client.text_structure.test_grok_pattern( + body: { + "grok_pattern": "Hello %{WORD:first_name} %{WORD:last_name}", + "text": [ + "Hello John Doe", + "this does not match" + ] + } + ) + - language: PHP + code: |- + $resp = $client->textStructure()->testGrokPattern([ + "body" => [ + "grok_pattern" => "Hello %{WORD:first_name} %{WORD:last_name}", + "text" => array( + "Hello John Doe", + "this does not match", + ), + ], + ]); + - language: curl + code: + 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"grok_pattern":"Hello + %{WORD:first_name} %{WORD:last_name}","text":["Hello John Doe","this does not match"]}'' + "$ELASTICSEARCH_URL/_text_structure/test_grok_pattern"' diff --git a/specification/transform/delete_transform/examples/request/TransformDeleteTransformExample1.yaml b/specification/transform/delete_transform/examples/request/TransformDeleteTransformExample1.yaml index fbce5ab4f5..515c10d80a 100644 --- a/specification/transform/delete_transform/examples/request/TransformDeleteTransformExample1.yaml +++ b/specification/transform/delete_transform/examples/request/TransformDeleteTransformExample1.yaml @@ -1 +1,24 @@ method_request: DELETE _transform/ecommerce_transform +alternatives: + - language: Python + code: |- + resp = client.transform.delete_transform( + transform_id="ecommerce_transform", + ) + - language: JavaScript + code: |- + const response = await client.transform.deleteTransform({ + transform_id: "ecommerce_transform", + }); + - language: Ruby + code: |- + response = client.transform.delete_transform( + transform_id: "ecommerce_transform" + ) + - language: PHP + code: |- + $resp = $client->transform()->deleteTransform([ + "transform_id" => "ecommerce_transform", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_transform/ecommerce_transform"' diff --git a/specification/transform/get_transform/examples/request/TransformGetTransformExample1.yaml b/specification/transform/get_transform/examples/request/TransformGetTransformExample1.yaml index 75e526a10e..eed60a9747 100644 --- a/specification/transform/get_transform/examples/request/TransformGetTransformExample1.yaml +++ b/specification/transform/get_transform/examples/request/TransformGetTransformExample1.yaml @@ -1 +1,24 @@ method_request: GET _transform?size=10 +alternatives: + - language: Python + code: |- + resp = client.transform.get_transform( + size="10", + ) + - language: JavaScript + code: |- + const response = await client.transform.getTransform({ + size: 10, + }); + - language: Ruby + code: |- + response = client.transform.get_transform( + size: "10" + ) + - language: PHP + code: |- + $resp = $client->transform()->getTransform([ + "size" => "10", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_transform?size=10"' diff --git a/specification/transform/get_transform_stats/examples/request/TransformGetTransformStatsExample1.yaml b/specification/transform/get_transform_stats/examples/request/TransformGetTransformStatsExample1.yaml index a6416b60c4..04ecda19fb 100644 --- a/specification/transform/get_transform_stats/examples/request/TransformGetTransformStatsExample1.yaml +++ b/specification/transform/get_transform_stats/examples/request/TransformGetTransformStatsExample1.yaml @@ -1 +1,24 @@ method_request: GET _transform/ecommerce-customer-transform/_stats +alternatives: + - language: Python + code: |- + resp = client.transform.get_transform_stats( + transform_id="ecommerce-customer-transform", + ) + - language: JavaScript + code: |- + const response = await client.transform.getTransformStats({ + transform_id: "ecommerce-customer-transform", + }); + - language: Ruby + code: |- + response = client.transform.get_transform_stats( + transform_id: "ecommerce-customer-transform" + ) + - language: PHP + code: |- + $resp = $client->transform()->getTransformStats([ + "transform_id" => "ecommerce-customer-transform", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_transform/ecommerce-customer-transform/_stats"' diff --git a/specification/transform/preview_transform/examples/request/PreviewTransformRequestExample1.yaml b/specification/transform/preview_transform/examples/request/PreviewTransformRequestExample1.yaml index 010fd3e0d2..4a75c24f54 100644 --- a/specification/transform/preview_transform/examples/request/PreviewTransformRequestExample1.yaml +++ b/specification/transform/preview_transform/examples/request/PreviewTransformRequestExample1.yaml @@ -15,3 +15,110 @@ value: max_price: max: field: taxful_total_price +alternatives: + - language: Python + code: |- + resp = client.transform.preview_transform( + source={ + "index": "kibana_sample_data_ecommerce" + }, + pivot={ + "group_by": { + "customer_id": { + "terms": { + "field": "customer_id", + "missing_bucket": True + } + } + }, + "aggregations": { + "max_price": { + "max": { + "field": "taxful_total_price" + } + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.transform.previewTransform({ + source: { + index: "kibana_sample_data_ecommerce", + }, + pivot: { + group_by: { + customer_id: { + terms: { + field: "customer_id", + missing_bucket: true, + }, + }, + }, + aggregations: { + max_price: { + max: { + field: "taxful_total_price", + }, + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.transform.preview_transform( + body: { + "source": { + "index": "kibana_sample_data_ecommerce" + }, + "pivot": { + "group_by": { + "customer_id": { + "terms": { + "field": "customer_id", + "missing_bucket": true + } + } + }, + "aggregations": { + "max_price": { + "max": { + "field": "taxful_total_price" + } + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->transform()->previewTransform([ + "body" => [ + "source" => [ + "index" => "kibana_sample_data_ecommerce", + ], + "pivot" => [ + "group_by" => [ + "customer_id" => [ + "terms" => [ + "field" => "customer_id", + "missing_bucket" => true, + ], + ], + ], + "aggregations" => [ + "max_price" => [ + "max" => [ + "field" => "taxful_total_price", + ], + ], + ], + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"source\":{\"index\":\"kibana_sample_data_ecommerce\"},\"pivot\":{\"group_by\":{\"customer_id\":{\"terms\":{\"field\":\"cu\ + stomer_id\",\"missing_bucket\":true}}},\"aggregations\":{\"max_price\":{\"max\":{\"field\":\"taxful_total_price\"}}}}}' + \"$ELASTICSEARCH_URL/_transform/_preview\"" diff --git a/specification/transform/put_transform/examples/request/PutTransformRequestExample1.yaml b/specification/transform/put_transform/examples/request/PutTransformRequestExample1.yaml index 08f479163c..3145efdf83 100644 --- a/specification/transform/put_transform/examples/request/PutTransformRequestExample1.yaml +++ b/specification/transform/put_transform/examples/request/PutTransformRequestExample1.yaml @@ -32,3 +32,217 @@ value: time: field: order_date max_age: 30d +alternatives: + - language: Python + code: |- + resp = client.transform.put_transform( + transform_id="ecommerce_transform1", + source={ + "index": "kibana_sample_data_ecommerce", + "query": { + "term": { + "geoip.continent_name": { + "value": "Asia" + } + } + } + }, + pivot={ + "group_by": { + "customer_id": { + "terms": { + "field": "customer_id", + "missing_bucket": True + } + } + }, + "aggregations": { + "max_price": { + "max": { + "field": "taxful_total_price" + } + } + } + }, + description="Maximum priced ecommerce data by customer_id in Asia", + dest={ + "index": "kibana_sample_data_ecommerce_transform1", + "pipeline": "add_timestamp_pipeline" + }, + frequency="5m", + sync={ + "time": { + "field": "order_date", + "delay": "60s" + } + }, + retention_policy={ + "time": { + "field": "order_date", + "max_age": "30d" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.transform.putTransform({ + transform_id: "ecommerce_transform1", + source: { + index: "kibana_sample_data_ecommerce", + query: { + term: { + "geoip.continent_name": { + value: "Asia", + }, + }, + }, + }, + pivot: { + group_by: { + customer_id: { + terms: { + field: "customer_id", + missing_bucket: true, + }, + }, + }, + aggregations: { + max_price: { + max: { + field: "taxful_total_price", + }, + }, + }, + }, + description: "Maximum priced ecommerce data by customer_id in Asia", + dest: { + index: "kibana_sample_data_ecommerce_transform1", + pipeline: "add_timestamp_pipeline", + }, + frequency: "5m", + sync: { + time: { + field: "order_date", + delay: "60s", + }, + }, + retention_policy: { + time: { + field: "order_date", + max_age: "30d", + }, + }, + }); + - language: Ruby + code: |- + response = client.transform.put_transform( + transform_id: "ecommerce_transform1", + body: { + "source": { + "index": "kibana_sample_data_ecommerce", + "query": { + "term": { + "geoip.continent_name": { + "value": "Asia" + } + } + } + }, + "pivot": { + "group_by": { + "customer_id": { + "terms": { + "field": "customer_id", + "missing_bucket": true + } + } + }, + "aggregations": { + "max_price": { + "max": { + "field": "taxful_total_price" + } + } + } + }, + "description": "Maximum priced ecommerce data by customer_id in Asia", + "dest": { + "index": "kibana_sample_data_ecommerce_transform1", + "pipeline": "add_timestamp_pipeline" + }, + "frequency": "5m", + "sync": { + "time": { + "field": "order_date", + "delay": "60s" + } + }, + "retention_policy": { + "time": { + "field": "order_date", + "max_age": "30d" + } + } + } + ) + - language: PHP + code: |- + $resp = $client->transform()->putTransform([ + "transform_id" => "ecommerce_transform1", + "body" => [ + "source" => [ + "index" => "kibana_sample_data_ecommerce", + "query" => [ + "term" => [ + "geoip.continent_name" => [ + "value" => "Asia", + ], + ], + ], + ], + "pivot" => [ + "group_by" => [ + "customer_id" => [ + "terms" => [ + "field" => "customer_id", + "missing_bucket" => true, + ], + ], + ], + "aggregations" => [ + "max_price" => [ + "max" => [ + "field" => "taxful_total_price", + ], + ], + ], + ], + "description" => "Maximum priced ecommerce data by customer_id in Asia", + "dest" => [ + "index" => "kibana_sample_data_ecommerce_transform1", + "pipeline" => "add_timestamp_pipeline", + ], + "frequency" => "5m", + "sync" => [ + "time" => [ + "field" => "order_date", + "delay" => "60s", + ], + ], + "retention_policy" => [ + "time" => [ + "field" => "order_date", + "max_age" => "30d", + ], + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"source\":{\"index\":\"kibana_sample_data_ecommerce\",\"query\":{\"term\":{\"geoip.continent_name\":{\"value\":\"Asia\"}}}\ + },\"pivot\":{\"group_by\":{\"customer_id\":{\"terms\":{\"field\":\"customer_id\",\"missing_bucket\":true}}},\"aggregations\":{\ + \"max_price\":{\"max\":{\"field\":\"taxful_total_price\"}}}},\"description\":\"Maximum priced ecommerce data by customer_id in + Asia\",\"dest\":{\"index\":\"kibana_sample_data_ecommerce_transform1\",\"pipeline\":\"add_timestamp_pipeline\"},\"frequency\":\ + \"5m\",\"sync\":{\"time\":{\"field\":\"order_date\",\"delay\":\"60s\"}},\"retention_policy\":{\"time\":{\"field\":\"order_date\ + \",\"max_age\":\"30d\"}}}' \"$ELASTICSEARCH_URL/_transform/ecommerce_transform1\"" diff --git a/specification/transform/put_transform/examples/request/PutTransformRequestExample2.yaml b/specification/transform/put_transform/examples/request/PutTransformRequestExample2.yaml index 003891916d..e2346b0101 100644 --- a/specification/transform/put_transform/examples/request/PutTransformRequestExample2.yaml +++ b/specification/transform/put_transform/examples/request/PutTransformRequestExample2.yaml @@ -17,3 +17,113 @@ value: time: field: order_date delay: 60s +alternatives: + - language: Python + code: |- + resp = client.transform.put_transform( + transform_id="ecommerce_transform2", + source={ + "index": "kibana_sample_data_ecommerce" + }, + latest={ + "unique_key": [ + "customer_id" + ], + "sort": "order_date" + }, + description="Latest order for each customer", + dest={ + "index": "kibana_sample_data_ecommerce_transform2" + }, + frequency="5m", + sync={ + "time": { + "field": "order_date", + "delay": "60s" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.transform.putTransform({ + transform_id: "ecommerce_transform2", + source: { + index: "kibana_sample_data_ecommerce", + }, + latest: { + unique_key: ["customer_id"], + sort: "order_date", + }, + description: "Latest order for each customer", + dest: { + index: "kibana_sample_data_ecommerce_transform2", + }, + frequency: "5m", + sync: { + time: { + field: "order_date", + delay: "60s", + }, + }, + }); + - language: Ruby + code: |- + response = client.transform.put_transform( + transform_id: "ecommerce_transform2", + body: { + "source": { + "index": "kibana_sample_data_ecommerce" + }, + "latest": { + "unique_key": [ + "customer_id" + ], + "sort": "order_date" + }, + "description": "Latest order for each customer", + "dest": { + "index": "kibana_sample_data_ecommerce_transform2" + }, + "frequency": "5m", + "sync": { + "time": { + "field": "order_date", + "delay": "60s" + } + } + } + ) + - language: PHP + code: |- + $resp = $client->transform()->putTransform([ + "transform_id" => "ecommerce_transform2", + "body" => [ + "source" => [ + "index" => "kibana_sample_data_ecommerce", + ], + "latest" => [ + "unique_key" => array( + "customer_id", + ), + "sort" => "order_date", + ], + "description" => "Latest order for each customer", + "dest" => [ + "index" => "kibana_sample_data_ecommerce_transform2", + ], + "frequency" => "5m", + "sync" => [ + "time" => [ + "field" => "order_date", + "delay" => "60s", + ], + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"source\":{\"index\":\"kibana_sample_data_ecommerce\"},\"latest\":{\"unique_key\":[\"customer_id\"],\"sort\":\"order_date\ + \"},\"description\":\"Latest order for each + customer\",\"dest\":{\"index\":\"kibana_sample_data_ecommerce_transform2\"},\"frequency\":\"5m\",\"sync\":{\"time\":{\"field\ + \":\"order_date\",\"delay\":\"60s\"}}}' \"$ELASTICSEARCH_URL/_transform/ecommerce_transform2\"" diff --git a/specification/transform/reset_transform/examples/request/TransformResetTransformExample1.yaml b/specification/transform/reset_transform/examples/request/TransformResetTransformExample1.yaml index ca1bd4d181..cb8f772072 100644 --- a/specification/transform/reset_transform/examples/request/TransformResetTransformExample1.yaml +++ b/specification/transform/reset_transform/examples/request/TransformResetTransformExample1.yaml @@ -1 +1,24 @@ method_request: POST _transform/ecommerce_transform/_reset +alternatives: + - language: Python + code: |- + resp = client.transform.reset_transform( + transform_id="ecommerce_transform", + ) + - language: JavaScript + code: |- + const response = await client.transform.resetTransform({ + transform_id: "ecommerce_transform", + }); + - language: Ruby + code: |- + response = client.transform.reset_transform( + transform_id: "ecommerce_transform" + ) + - language: PHP + code: |- + $resp = $client->transform()->resetTransform([ + "transform_id" => "ecommerce_transform", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_transform/ecommerce_transform/_reset"' diff --git a/specification/transform/schedule_now_transform/examples/request/TransformScheduleNowTransformExample1.yaml b/specification/transform/schedule_now_transform/examples/request/TransformScheduleNowTransformExample1.yaml index 2d90b03137..b110efd8e6 100644 --- a/specification/transform/schedule_now_transform/examples/request/TransformScheduleNowTransformExample1.yaml +++ b/specification/transform/schedule_now_transform/examples/request/TransformScheduleNowTransformExample1.yaml @@ -1 +1,24 @@ method_request: POST _transform/ecommerce_transform/_schedule_now +alternatives: + - language: Python + code: |- + resp = client.transform.schedule_now_transform( + transform_id="ecommerce_transform", + ) + - language: JavaScript + code: |- + const response = await client.transform.scheduleNowTransform({ + transform_id: "ecommerce_transform", + }); + - language: Ruby + code: |- + response = client.transform.schedule_now_transform( + transform_id: "ecommerce_transform" + ) + - language: PHP + code: |- + $resp = $client->transform()->scheduleNowTransform([ + "transform_id" => "ecommerce_transform", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_transform/ecommerce_transform/_schedule_now"' diff --git a/specification/transform/start_transform/examples/request/TransformStartTransformExample1.yaml b/specification/transform/start_transform/examples/request/TransformStartTransformExample1.yaml index 18bafb90ed..9a9454ed65 100644 --- a/specification/transform/start_transform/examples/request/TransformStartTransformExample1.yaml +++ b/specification/transform/start_transform/examples/request/TransformStartTransformExample1.yaml @@ -1 +1,24 @@ method_request: POST _transform/ecommerce-customer-transform/_start +alternatives: + - language: Python + code: |- + resp = client.transform.start_transform( + transform_id="ecommerce-customer-transform", + ) + - language: JavaScript + code: |- + const response = await client.transform.startTransform({ + transform_id: "ecommerce-customer-transform", + }); + - language: Ruby + code: |- + response = client.transform.start_transform( + transform_id: "ecommerce-customer-transform" + ) + - language: PHP + code: |- + $resp = $client->transform()->startTransform([ + "transform_id" => "ecommerce-customer-transform", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_transform/ecommerce-customer-transform/_start"' diff --git a/specification/transform/stop_transform/examples/request/TransformStopTransformExample1.yaml b/specification/transform/stop_transform/examples/request/TransformStopTransformExample1.yaml index 12dc9d32b9..56cc5e3883 100644 --- a/specification/transform/stop_transform/examples/request/TransformStopTransformExample1.yaml +++ b/specification/transform/stop_transform/examples/request/TransformStopTransformExample1.yaml @@ -1 +1,24 @@ method_request: POST _transform/ecommerce_transform/_stop +alternatives: + - language: Python + code: |- + resp = client.transform.stop_transform( + transform_id="ecommerce_transform", + ) + - language: JavaScript + code: |- + const response = await client.transform.stopTransform({ + transform_id: "ecommerce_transform", + }); + - language: Ruby + code: |- + response = client.transform.stop_transform( + transform_id: "ecommerce_transform" + ) + - language: PHP + code: |- + $resp = $client->transform()->stopTransform([ + "transform_id" => "ecommerce_transform", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_transform/ecommerce_transform/_stop"' diff --git a/specification/transform/update_transform/examples/request/UpdateTransformRequestExample1.yaml b/specification/transform/update_transform/examples/request/UpdateTransformRequestExample1.yaml index 03d19e5da9..c1a710e65b 100644 --- a/specification/transform/update_transform/examples/request/UpdateTransformRequestExample1.yaml +++ b/specification/transform/update_transform/examples/request/UpdateTransformRequestExample1.yaml @@ -32,3 +32,217 @@ value: time: field: order_date max_age: 30d +alternatives: + - language: Python + code: |- + resp = client.transform.update_transform( + transform_id="simple-kibana-ecomm-pivot", + source={ + "index": "kibana_sample_data_ecommerce", + "query": { + "term": { + "geoip.continent_name": { + "value": "Asia" + } + } + } + }, + pivot={ + "group_by": { + "customer_id": { + "terms": { + "field": "customer_id", + "missing_bucket": True + } + } + }, + "aggregations": { + "max_price": { + "max": { + "field": "taxful_total_price" + } + } + } + }, + description="Maximum priced ecommerce data by customer_id in Asia", + dest={ + "index": "kibana_sample_data_ecommerce_transform1", + "pipeline": "add_timestamp_pipeline" + }, + frequency="5m", + sync={ + "time": { + "field": "order_date", + "delay": "60s" + } + }, + retention_policy={ + "time": { + "field": "order_date", + "max_age": "30d" + } + }, + ) + - language: JavaScript + code: |- + const response = await client.transform.updateTransform({ + transform_id: "simple-kibana-ecomm-pivot", + source: { + index: "kibana_sample_data_ecommerce", + query: { + term: { + "geoip.continent_name": { + value: "Asia", + }, + }, + }, + }, + pivot: { + group_by: { + customer_id: { + terms: { + field: "customer_id", + missing_bucket: true, + }, + }, + }, + aggregations: { + max_price: { + max: { + field: "taxful_total_price", + }, + }, + }, + }, + description: "Maximum priced ecommerce data by customer_id in Asia", + dest: { + index: "kibana_sample_data_ecommerce_transform1", + pipeline: "add_timestamp_pipeline", + }, + frequency: "5m", + sync: { + time: { + field: "order_date", + delay: "60s", + }, + }, + retention_policy: { + time: { + field: "order_date", + max_age: "30d", + }, + }, + }); + - language: Ruby + code: |- + response = client.transform.update_transform( + transform_id: "simple-kibana-ecomm-pivot", + body: { + "source": { + "index": "kibana_sample_data_ecommerce", + "query": { + "term": { + "geoip.continent_name": { + "value": "Asia" + } + } + } + }, + "pivot": { + "group_by": { + "customer_id": { + "terms": { + "field": "customer_id", + "missing_bucket": true + } + } + }, + "aggregations": { + "max_price": { + "max": { + "field": "taxful_total_price" + } + } + } + }, + "description": "Maximum priced ecommerce data by customer_id in Asia", + "dest": { + "index": "kibana_sample_data_ecommerce_transform1", + "pipeline": "add_timestamp_pipeline" + }, + "frequency": "5m", + "sync": { + "time": { + "field": "order_date", + "delay": "60s" + } + }, + "retention_policy": { + "time": { + "field": "order_date", + "max_age": "30d" + } + } + } + ) + - language: PHP + code: |- + $resp = $client->transform()->updateTransform([ + "transform_id" => "simple-kibana-ecomm-pivot", + "body" => [ + "source" => [ + "index" => "kibana_sample_data_ecommerce", + "query" => [ + "term" => [ + "geoip.continent_name" => [ + "value" => "Asia", + ], + ], + ], + ], + "pivot" => [ + "group_by" => [ + "customer_id" => [ + "terms" => [ + "field" => "customer_id", + "missing_bucket" => true, + ], + ], + ], + "aggregations" => [ + "max_price" => [ + "max" => [ + "field" => "taxful_total_price", + ], + ], + ], + ], + "description" => "Maximum priced ecommerce data by customer_id in Asia", + "dest" => [ + "index" => "kibana_sample_data_ecommerce_transform1", + "pipeline" => "add_timestamp_pipeline", + ], + "frequency" => "5m", + "sync" => [ + "time" => [ + "field" => "order_date", + "delay" => "60s", + ], + ], + "retention_policy" => [ + "time" => [ + "field" => "order_date", + "max_age" => "30d", + ], + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"source\":{\"index\":\"kibana_sample_data_ecommerce\",\"query\":{\"term\":{\"geoip.continent_name\":{\"value\":\"Asia\"}}}\ + },\"pivot\":{\"group_by\":{\"customer_id\":{\"terms\":{\"field\":\"customer_id\",\"missing_bucket\":true}}},\"aggregations\":{\ + \"max_price\":{\"max\":{\"field\":\"taxful_total_price\"}}}},\"description\":\"Maximum priced ecommerce data by customer_id in + Asia\",\"dest\":{\"index\":\"kibana_sample_data_ecommerce_transform1\",\"pipeline\":\"add_timestamp_pipeline\"},\"frequency\":\ + \"5m\",\"sync\":{\"time\":{\"field\":\"order_date\",\"delay\":\"60s\"}},\"retention_policy\":{\"time\":{\"field\":\"order_date\ + \",\"max_age\":\"30d\"}}}' \"$ELASTICSEARCH_URL/_transform/simple-kibana-ecomm-pivot/_update\"" diff --git a/specification/transform/upgrade_transforms/examples/request/TransformUpgradeTransformsExample1.yaml b/specification/transform/upgrade_transforms/examples/request/TransformUpgradeTransformsExample1.yaml index fdf4f3573b..6569b3a8ff 100644 --- a/specification/transform/upgrade_transforms/examples/request/TransformUpgradeTransformsExample1.yaml +++ b/specification/transform/upgrade_transforms/examples/request/TransformUpgradeTransformsExample1.yaml @@ -1 +1,12 @@ method_request: POST _transform/_upgrade +alternatives: + - language: Python + code: resp = client.transform.upgrade_transforms() + - language: JavaScript + code: const response = await client.transform.upgradeTransforms(); + - language: Ruby + code: response = client.transform.upgrade_transforms + - language: PHP + code: $resp = $client->transform()->upgradeTransforms(); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_transform/_upgrade"' diff --git a/specification/watcher/ack_watch/examples/request/WatcherAckWatchRequestExample1.yaml b/specification/watcher/ack_watch/examples/request/WatcherAckWatchRequestExample1.yaml index 458d9b7f68..9fcf945f96 100644 --- a/specification/watcher/ack_watch/examples/request/WatcherAckWatchRequestExample1.yaml +++ b/specification/watcher/ack_watch/examples/request/WatcherAckWatchRequestExample1.yaml @@ -1 +1,24 @@ method_request: POST _watcher/watch/my_watch/_ack +alternatives: + - language: Python + code: |- + resp = client.watcher.ack_watch( + watch_id="my_watch", + ) + - language: JavaScript + code: |- + const response = await client.watcher.ackWatch({ + watch_id: "my_watch", + }); + - language: Ruby + code: |- + response = client.watcher.ack_watch( + watch_id: "my_watch" + ) + - language: PHP + code: |- + $resp = $client->watcher()->ackWatch([ + "watch_id" => "my_watch", + ]); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_watcher/watch/my_watch/_ack"' diff --git a/specification/watcher/activate_watch/examples/request/WatcherActivateWatchExample1.yaml b/specification/watcher/activate_watch/examples/request/WatcherActivateWatchExample1.yaml index 902463d7c5..196d71c437 100644 --- a/specification/watcher/activate_watch/examples/request/WatcherActivateWatchExample1.yaml +++ b/specification/watcher/activate_watch/examples/request/WatcherActivateWatchExample1.yaml @@ -1 +1,24 @@ method_request: PUT _watcher/watch/my_watch/_activate +alternatives: + - language: Python + code: |- + resp = client.watcher.activate_watch( + watch_id="my_watch", + ) + - language: JavaScript + code: |- + const response = await client.watcher.activateWatch({ + watch_id: "my_watch", + }); + - language: Ruby + code: |- + response = client.watcher.activate_watch( + watch_id: "my_watch" + ) + - language: PHP + code: |- + $resp = $client->watcher()->activateWatch([ + "watch_id" => "my_watch", + ]); + - language: curl + code: 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_watcher/watch/my_watch/_activate"' diff --git a/specification/watcher/deactivate_watch/examples/request/WatcherDeactivateWatchExample1.yaml b/specification/watcher/deactivate_watch/examples/request/WatcherDeactivateWatchExample1.yaml index 1857a34e66..cace64e313 100644 --- a/specification/watcher/deactivate_watch/examples/request/WatcherDeactivateWatchExample1.yaml +++ b/specification/watcher/deactivate_watch/examples/request/WatcherDeactivateWatchExample1.yaml @@ -1 +1,24 @@ method_request: PUT _watcher/watch/my_watch/_deactivate +alternatives: + - language: Python + code: |- + resp = client.watcher.deactivate_watch( + watch_id="my_watch", + ) + - language: JavaScript + code: |- + const response = await client.watcher.deactivateWatch({ + watch_id: "my_watch", + }); + - language: Ruby + code: |- + response = client.watcher.deactivate_watch( + watch_id: "my_watch" + ) + - language: PHP + code: |- + $resp = $client->watcher()->deactivateWatch([ + "watch_id" => "my_watch", + ]); + - language: curl + code: 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_watcher/watch/my_watch/_deactivate"' diff --git a/specification/watcher/delete_watch/examples/request/DeleteWatchRequestExample1.yaml b/specification/watcher/delete_watch/examples/request/DeleteWatchRequestExample1.yaml index af1cfc6370..442bdc43a6 100644 --- a/specification/watcher/delete_watch/examples/request/DeleteWatchRequestExample1.yaml +++ b/specification/watcher/delete_watch/examples/request/DeleteWatchRequestExample1.yaml @@ -1 +1,24 @@ method_request: DELETE _watcher/watch/my_watch +alternatives: + - language: Python + code: |- + resp = client.watcher.delete_watch( + id="my_watch", + ) + - language: JavaScript + code: |- + const response = await client.watcher.deleteWatch({ + id: "my_watch", + }); + - language: Ruby + code: |- + response = client.watcher.delete_watch( + id: "my_watch" + ) + - language: PHP + code: |- + $resp = $client->watcher()->deleteWatch([ + "id" => "my_watch", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_watcher/watch/my_watch"' diff --git a/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample1.yaml b/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample1.yaml index d30e5f1c87..59772b0d92 100644 --- a/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample1.yaml +++ b/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample1.yaml @@ -1,11 +1,10 @@ summary: Run a watch method_request: POST _watcher/watch/my_watch/_execute description: > - Run `POST _watcher/watch/my_watch/_execute` to run a watch. - The input defined in the watch is ignored and the `alternative_input` is used as the payload. - The condition as defined by the watch is ignored and is assumed to evaluate to true. - The `force_simulate` action forces the simulation of `my-action`. - Forcing the simulation means that throttling is ignored and the watch is simulated by Watcher instead of being run normally. + Run `POST _watcher/watch/my_watch/_execute` to run a watch. The input defined in the watch is ignored and the `alternative_input` + is used as the payload. The condition as defined by the watch is ignored and is assumed to evaluate to true. The `force_simulate` + action forces the simulation of `my-action`. Forcing the simulation means that throttling is ignored and the watch is simulated by + Watcher instead of being run normally. # type: request value: |- { @@ -22,3 +21,82 @@ value: |- }, "record_execution" : true } +alternatives: + - language: Python + code: |- + resp = client.watcher.execute_watch( + id="my_watch", + trigger_data={ + "triggered_time": "now", + "scheduled_time": "now" + }, + alternative_input={ + "foo": "bar" + }, + ignore_condition=True, + action_modes={ + "my-action": "force_simulate" + }, + record_execution=True, + ) + - language: JavaScript + code: |- + const response = await client.watcher.executeWatch({ + id: "my_watch", + trigger_data: { + triggered_time: "now", + scheduled_time: "now", + }, + alternative_input: { + foo: "bar", + }, + ignore_condition: true, + action_modes: { + "my-action": "force_simulate", + }, + record_execution: true, + }); + - language: Ruby + code: |- + response = client.watcher.execute_watch( + id: "my_watch", + body: { + "trigger_data": { + "triggered_time": "now", + "scheduled_time": "now" + }, + "alternative_input": { + "foo": "bar" + }, + "ignore_condition": true, + "action_modes": { + "my-action": "force_simulate" + }, + "record_execution": true + } + ) + - language: PHP + code: |- + $resp = $client->watcher()->executeWatch([ + "id" => "my_watch", + "body" => [ + "trigger_data" => [ + "triggered_time" => "now", + "scheduled_time" => "now", + ], + "alternative_input" => [ + "foo" => "bar", + ], + "ignore_condition" => true, + "action_modes" => [ + "my-action" => "force_simulate", + ], + "record_execution" => true, + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"trigger_data\":{\"triggered_time\":\"now\",\"scheduled_time\":\"now\"},\"alternative_input\":{\"foo\":\"bar\"},\"ignore_c\ + ondition\":true,\"action_modes\":{\"my-action\":\"force_simulate\"},\"record_execution\":true}' + \"$ELASTICSEARCH_URL/_watcher/watch/my_watch/_execute\"" diff --git a/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample2.yaml b/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample2.yaml index 1de0d20d82..4dd81bfbf1 100644 --- a/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample2.yaml +++ b/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample2.yaml @@ -10,3 +10,49 @@ value: |- "action2" : "skip" } } +alternatives: + - language: Python + code: |- + resp = client.watcher.execute_watch( + id="my_watch", + action_modes={ + "action1": "force_simulate", + "action2": "skip" + }, + ) + - language: JavaScript + code: |- + const response = await client.watcher.executeWatch({ + id: "my_watch", + action_modes: { + action1: "force_simulate", + action2: "skip", + }, + }); + - language: Ruby + code: |- + response = client.watcher.execute_watch( + id: "my_watch", + body: { + "action_modes": { + "action1": "force_simulate", + "action2": "skip" + } + } + ) + - language: PHP + code: |- + $resp = $client->watcher()->executeWatch([ + "id" => "my_watch", + "body" => [ + "action_modes" => [ + "action1" => "force_simulate", + "action2" => "skip", + ], + ], + ]); + - language: curl + code: + 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"action_modes":{"action1":"force_simulate","action2":"skip"}}'' + "$ELASTICSEARCH_URL/_watcher/watch/my_watch/_execute"' diff --git a/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample3.yaml b/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample3.yaml index ed41be3714..5f28afbbbd 100644 --- a/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample3.yaml +++ b/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample3.yaml @@ -1,9 +1,8 @@ summary: Run a watch inline method_request: POST _watcher/watch/_execute description: > - Run `POST _watcher/watch/_execute` to run a watch inline. - All other settings for this API still apply when inlining a watch. - In this example, while the inline watch defines a compare condition, during the execution this condition will be ignored. + Run `POST _watcher/watch/_execute` to run a watch inline. All other settings for this API still apply when inlining a watch. In + this example, while the inline watch defines a compare condition, during the execution this condition will be ignored. # type: request value: |- { @@ -33,3 +32,177 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.watcher.execute_watch( + watch={ + "trigger": { + "schedule": { + "interval": "10s" + } + }, + "input": { + "search": { + "request": { + "indices": [ + "logs" + ], + "body": { + "query": { + "match": { + "message": "error" + } + } + } + } + } + }, + "condition": { + "compare": { + "ctx.payload.hits.total": { + "gt": 0 + } + } + }, + "actions": { + "log_error": { + "logging": { + "text": "Found {{ctx.payload.hits.total}} errors in the logs" + } + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.watcher.executeWatch({ + watch: { + trigger: { + schedule: { + interval: "10s", + }, + }, + input: { + search: { + request: { + indices: ["logs"], + body: { + query: { + match: { + message: "error", + }, + }, + }, + }, + }, + }, + condition: { + compare: { + "ctx.payload.hits.total": { + gt: 0, + }, + }, + }, + actions: { + log_error: { + logging: { + text: "Found {{ctx.payload.hits.total}} errors in the logs", + }, + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.watcher.execute_watch( + body: { + "watch": { + "trigger": { + "schedule": { + "interval": "10s" + } + }, + "input": { + "search": { + "request": { + "indices": [ + "logs" + ], + "body": { + "query": { + "match": { + "message": "error" + } + } + } + } + } + }, + "condition": { + "compare": { + "ctx.payload.hits.total": { + "gt": 0 + } + } + }, + "actions": { + "log_error": { + "logging": { + "text": "Found {{ctx.payload.hits.total}} errors in the logs" + } + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->watcher()->executeWatch([ + "body" => [ + "watch" => [ + "trigger" => [ + "schedule" => [ + "interval" => "10s", + ], + ], + "input" => [ + "search" => [ + "request" => [ + "indices" => array( + "logs", + ), + "body" => [ + "query" => [ + "match" => [ + "message" => "error", + ], + ], + ], + ], + ], + ], + "condition" => [ + "compare" => [ + "ctx.payload.hits.total" => [ + "gt" => 0, + ], + ], + ], + "actions" => [ + "log_error" => [ + "logging" => [ + "text" => "Found {{ctx.payload.hits.total}} errors in the logs", + ], + ], + ], + ], + ], + ]); + - language: curl + code: + "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"watch\":{\"trigger\":{\"schedule\":{\"interval\":\"10s\"}},\"input\":{\"search\":{\"request\":{\"indices\":[\"logs\"],\"b\ + ody\":{\"query\":{\"match\":{\"message\":\"error\"}}}}}},\"condition\":{\"compare\":{\"ctx.payload.hits.total\":{\"gt\":0}}},\ + \"actions\":{\"log_error\":{\"logging\":{\"text\":\"Found {{ctx.payload.hits.total}} errors in the logs\"}}}}}' + \"$ELASTICSEARCH_URL/_watcher/watch/_execute\"" diff --git a/specification/watcher/get_settings/examples/request/WatcherGetSettingsExample1.yaml b/specification/watcher/get_settings/examples/request/WatcherGetSettingsExample1.yaml index 1ab70df900..4968813cea 100644 --- a/specification/watcher/get_settings/examples/request/WatcherGetSettingsExample1.yaml +++ b/specification/watcher/get_settings/examples/request/WatcherGetSettingsExample1.yaml @@ -1 +1,12 @@ method_request: GET /_watcher/settings +alternatives: + - language: Python + code: resp = client.watcher.get_settings() + - language: JavaScript + code: const response = await client.watcher.getSettings(); + - language: Ruby + code: response = client.watcher.get_settings + - language: PHP + code: $resp = $client->watcher()->getSettings(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_watcher/settings"' diff --git a/specification/watcher/get_watch/examples/request/GetWatchRequestExample1.yaml b/specification/watcher/get_watch/examples/request/GetWatchRequestExample1.yaml index 6c9874e82e..b4dd14035a 100644 --- a/specification/watcher/get_watch/examples/request/GetWatchRequestExample1.yaml +++ b/specification/watcher/get_watch/examples/request/GetWatchRequestExample1.yaml @@ -1 +1,24 @@ method_request: GET _watcher/watch/my_watch +alternatives: + - language: Python + code: |- + resp = client.watcher.get_watch( + id="my_watch", + ) + - language: JavaScript + code: |- + const response = await client.watcher.getWatch({ + id: "my_watch", + }); + - language: Ruby + code: |- + response = client.watcher.get_watch( + id: "my_watch" + ) + - language: PHP + code: |- + $resp = $client->watcher()->getWatch([ + "id" => "my_watch", + ]); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_watcher/watch/my_watch"' diff --git a/specification/watcher/put_watch/examples/request/WatcherPutWatchRequestExample1.yaml b/specification/watcher/put_watch/examples/request/WatcherPutWatchRequestExample1.yaml index 9860e3d28b..e14ffb530f 100644 --- a/specification/watcher/put_watch/examples/request/WatcherPutWatchRequestExample1.yaml +++ b/specification/watcher/put_watch/examples/request/WatcherPutWatchRequestExample1.yaml @@ -1,11 +1,9 @@ # summary: method_request: PUT _watcher/watch/my-watch description: > - Run `PUT _watcher/watch/my-watch` add a watch. - The watch schedule triggers every minute. - The watch search input looks for any 404 HTTP responses that occurred in the last five minutes. - The watch condition checks if any search hits where found. - When found, the watch action sends an email to an administrator. + Run `PUT _watcher/watch/my-watch` add a watch. The watch schedule triggers every minute. The watch search input looks for any 404 + HTTP responses that occurred in the last five minutes. The watch condition checks if any search hits where found. When found, the + watch action sends an email to an administrator. # type: request value: |- { @@ -52,3 +50,227 @@ value: |- } } } +alternatives: + - language: Python + code: |- + resp = client.watcher.put_watch( + id="my-watch", + trigger={ + "schedule": { + "cron": "0 0/1 * * * ?" + } + }, + input={ + "search": { + "request": { + "indices": [ + "logstash*" + ], + "body": { + "query": { + "bool": { + "must": { + "match": { + "response": 404 + } + }, + "filter": { + "range": { + "@timestamp": { + "from": "{{ctx.trigger.scheduled_time}}||-5m", + "to": "{{ctx.trigger.triggered_time}}" + } + } + } + } + } + } + } + } + }, + condition={ + "compare": { + "ctx.payload.hits.total": { + "gt": 0 + } + } + }, + actions={ + "email_admin": { + "email": { + "to": "admin@domain.host.com", + "subject": "404 recently encountered" + } + } + }, + ) + - language: JavaScript + code: |- + const response = await client.watcher.putWatch({ + id: "my-watch", + trigger: { + schedule: { + cron: "0 0/1 * * * ?", + }, + }, + input: { + search: { + request: { + indices: ["logstash*"], + body: { + query: { + bool: { + must: { + match: { + response: 404, + }, + }, + filter: { + range: { + "@timestamp": { + from: "{{ctx.trigger.scheduled_time}}||-5m", + to: "{{ctx.trigger.triggered_time}}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + condition: { + compare: { + "ctx.payload.hits.total": { + gt: 0, + }, + }, + }, + actions: { + email_admin: { + email: { + to: "admin@domain.host.com", + subject: "404 recently encountered", + }, + }, + }, + }); + - language: Ruby + code: |- + response = client.watcher.put_watch( + id: "my-watch", + body: { + "trigger": { + "schedule": { + "cron": "0 0/1 * * * ?" + } + }, + "input": { + "search": { + "request": { + "indices": [ + "logstash*" + ], + "body": { + "query": { + "bool": { + "must": { + "match": { + "response": 404 + } + }, + "filter": { + "range": { + "@timestamp": { + "from": "{{ctx.trigger.scheduled_time}}||-5m", + "to": "{{ctx.trigger.triggered_time}}" + } + } + } + } + } + } + } + } + }, + "condition": { + "compare": { + "ctx.payload.hits.total": { + "gt": 0 + } + } + }, + "actions": { + "email_admin": { + "email": { + "to": "admin@domain.host.com", + "subject": "404 recently encountered" + } + } + } + } + ) + - language: PHP + code: |- + $resp = $client->watcher()->putWatch([ + "id" => "my-watch", + "body" => [ + "trigger" => [ + "schedule" => [ + "cron" => "0 0/1 * * * ?", + ], + ], + "input" => [ + "search" => [ + "request" => [ + "indices" => array( + "logstash*", + ), + "body" => [ + "query" => [ + "bool" => [ + "must" => [ + "match" => [ + "response" => 404, + ], + ], + "filter" => [ + "range" => [ + "@timestamp" => [ + "from" => "{{ctx.trigger.scheduled_time}}||-5m", + "to" => "{{ctx.trigger.triggered_time}}", + ], + ], + ], + ], + ], + ], + ], + ], + ], + "condition" => [ + "compare" => [ + "ctx.payload.hits.total" => [ + "gt" => 0, + ], + ], + ], + "actions" => [ + "email_admin" => [ + "email" => [ + "to" => "admin@domain.host.com", + "subject" => "404 recently encountered", + ], + ], + ], + ], + ]); + - language: curl + code: + "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d + '{\"trigger\":{\"schedule\":{\"cron\":\"0 0/1 * * * + ?\"}},\"input\":{\"search\":{\"request\":{\"indices\":[\"logstash*\"],\"body\":{\"query\":{\"bool\":{\"must\":{\"match\":{\"r\ + esponse\":404}},\"filter\":{\"range\":{\"@timestamp\":{\"from\":\"{{ctx.trigger.scheduled_time}}||-5m\",\"to\":\"{{ctx.trigge\ + r.triggered_time}}\"}}}}}}}}},\"condition\":{\"compare\":{\"ctx.payload.hits.total\":{\"gt\":0}}},\"actions\":{\"email_admin\ + \":{\"email\":{\"to\":\"admin@domain.host.com\",\"subject\":\"404 recently encountered\"}}}}' + \"$ELASTICSEARCH_URL/_watcher/watch/my-watch\"" diff --git a/specification/watcher/query_watches/examples/request/WatcherQueryWatchesRequestExample1.yaml b/specification/watcher/query_watches/examples/request/WatcherQueryWatchesRequestExample1.yaml index e3621c8fd9..bebbe5da3f 100644 --- a/specification/watcher/query_watches/examples/request/WatcherQueryWatchesRequestExample1.yaml +++ b/specification/watcher/query_watches/examples/request/WatcherQueryWatchesRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET /_watcher/_query/watches +alternatives: + - language: Python + code: resp = client.watcher.query_watches() + - language: JavaScript + code: const response = await client.watcher.queryWatches(); + - language: Ruby + code: response = client.watcher.query_watches + - language: PHP + code: $resp = $client->watcher()->queryWatches(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_watcher/_query/watches"' diff --git a/specification/watcher/start/examples/request/WatcherStartRequestExample1.yaml b/specification/watcher/start/examples/request/WatcherStartRequestExample1.yaml index 460c900873..876c8c5317 100644 --- a/specification/watcher/start/examples/request/WatcherStartRequestExample1.yaml +++ b/specification/watcher/start/examples/request/WatcherStartRequestExample1.yaml @@ -1 +1,12 @@ method_request: POST _watcher/_start +alternatives: + - language: Python + code: resp = client.watcher.start() + - language: JavaScript + code: const response = await client.watcher.start(); + - language: Ruby + code: response = client.watcher.start + - language: PHP + code: $resp = $client->watcher()->start(); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_watcher/_start"' diff --git a/specification/watcher/stats/examples/request/WatcherStatsRequestExample1.yaml b/specification/watcher/stats/examples/request/WatcherStatsRequestExample1.yaml index ff8b145c37..9414981d4b 100644 --- a/specification/watcher/stats/examples/request/WatcherStatsRequestExample1.yaml +++ b/specification/watcher/stats/examples/request/WatcherStatsRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET _watcher/stats +alternatives: + - language: Python + code: resp = client.watcher.stats() + - language: JavaScript + code: const response = await client.watcher.stats(); + - language: Ruby + code: response = client.watcher.stats + - language: PHP + code: $resp = $client->watcher()->stats(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_watcher/stats"' diff --git a/specification/watcher/stop/examples/request/WatcherStopRequestExample1.yaml b/specification/watcher/stop/examples/request/WatcherStopRequestExample1.yaml index 7bc9342704..96aed5bfa1 100644 --- a/specification/watcher/stop/examples/request/WatcherStopRequestExample1.yaml +++ b/specification/watcher/stop/examples/request/WatcherStopRequestExample1.yaml @@ -1 +1,12 @@ method_request: POST _watcher/_stop +alternatives: + - language: Python + code: resp = client.watcher.stop() + - language: JavaScript + code: const response = await client.watcher.stop(); + - language: Ruby + code: response = client.watcher.stop + - language: PHP + code: $resp = $client->watcher()->stop(); + - language: curl + code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_watcher/_stop"' diff --git a/specification/watcher/update_settings/examples/request/WatcherUpdateSettingsRequestExample1.yaml b/specification/watcher/update_settings/examples/request/WatcherUpdateSettingsRequestExample1.yaml index ea2309603b..5f5efd1a82 100644 --- a/specification/watcher/update_settings/examples/request/WatcherUpdateSettingsRequestExample1.yaml +++ b/specification/watcher/update_settings/examples/request/WatcherUpdateSettingsRequestExample1.yaml @@ -4,3 +4,32 @@ method_request: PUT /_watcher/settings value: index.auto_expand_replicas: 0-4 +alternatives: + - language: Python + code: |- + resp = client.watcher.update_settings( + index.auto_expand_replicas="0-4", + ) + - language: JavaScript + code: |- + const response = await client.watcher.updateSettings({ + "index.auto_expand_replicas": "0-4", + }); + - language: Ruby + code: |- + response = client.watcher.update_settings( + body: { + "index.auto_expand_replicas": "0-4" + } + ) + - language: PHP + code: |- + $resp = $client->watcher()->updateSettings([ + "body" => [ + "index.auto_expand_replicas" => "0-4", + ], + ]); + - language: curl + code: + 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d + ''{"index.auto_expand_replicas":"0-4"}'' "$ELASTICSEARCH_URL/_watcher/settings"' diff --git a/specification/xpack/info/examples/request/XPackInfoRequestExample1.yaml b/specification/xpack/info/examples/request/XPackInfoRequestExample1.yaml index 5a9b53dc54..be3c761c84 100644 --- a/specification/xpack/info/examples/request/XPackInfoRequestExample1.yaml +++ b/specification/xpack/info/examples/request/XPackInfoRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET /_xpack +alternatives: + - language: Python + code: resp = client.xpack.info() + - language: JavaScript + code: const response = await client.xpack.info(); + - language: Ruby + code: response = client.xpack.info + - language: PHP + code: $resp = $client->xpack()->info(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_xpack"' diff --git a/specification/xpack/usage/examples/request/XPackUsageRequestExample1.yaml b/specification/xpack/usage/examples/request/XPackUsageRequestExample1.yaml index 7d5b9e797c..8c666c933f 100644 --- a/specification/xpack/usage/examples/request/XPackUsageRequestExample1.yaml +++ b/specification/xpack/usage/examples/request/XPackUsageRequestExample1.yaml @@ -1 +1,12 @@ method_request: GET /_xpack/usage +alternatives: + - language: Python + code: resp = client.xpack.usage() + - language: JavaScript + code: const response = await client.xpack.usage(); + - language: Ruby + code: response = client.xpack.usage + - language: PHP + code: $resp = $client->xpack()->usage(); + - language: curl + code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_xpack/usage"' diff --git a/typescript-generator/src/metamodel.ts b/typescript-generator/src/metamodel.ts index 3b4e987e30..62aa8bf355 100644 --- a/typescript-generator/src/metamodel.ts +++ b/typescript-generator/src/metamodel.ts @@ -260,6 +260,14 @@ export class Interface extends BaseType { variants?: Container } +/** + * An alternative of an example, coded in a given language. + */ +export class ExampleAlternative { + language: string + code: string +} + /** * The Example type is used for both requests and responses * This type definition is taken from the OpenAPI spec @@ -277,6 +285,8 @@ export class Example { value?: string /** A URI that points to the literal example */ external_value?: string + /** An array of alternatives for this example in other languages */ + alternatives?: ExampleAlternative[] } /**