diff --git a/compiler/src/steps/add-examples.ts b/compiler/src/steps/add-examples.ts index 7878ec461f..7bf870327d 100644 --- a/compiler/src/steps/add-examples.ts +++ b/compiler/src/steps/add-examples.ts @@ -54,10 +54,18 @@ export default class ExamplesProcessor { class BaseExamplesProcessor { model: model.Model specsFolder: string + static languageExamples: Record = {} constructor (model: model.Model, specsFolder: string) { this.model = model this.specsFolder = specsFolder + if (Object.keys(BaseExamplesProcessor.languageExamples).length === 0) { + // load the language examples + const examplesJson = this.specsFolder + '/../docs/examples/languageExamples.json' + if (fs.existsSync(examplesJson)) { + BaseExamplesProcessor.languageExamples = JSON.parse(fs.readFileSync(examplesJson, 'utf8')) + } + } } // Log a 'warning' message. @@ -139,6 +147,11 @@ class BaseExamplesProcessor { const exampleFileContent = fs.readFileSync(filePath, 'utf8') const exampleName = path.basename(fileName, path.extname(fileName)) const example: model.Example = yaml.load(exampleFileContent) + // find the language alternative examples and add them + const alternativeKey = 'specification/' + filePath.split('/specification/')[1] + if (BaseExamplesProcessor.languageExamples[alternativeKey] !== undefined) { + example.alternatives = BaseExamplesProcessor.languageExamples[alternativeKey] + } // Some of the example files set their 'value' as a JSON string, // and some files set their 'value' as an object. For consistency, // if the value is not a JSON string, convert it to a JSON string. diff --git a/docs/examples/generate-language-examples.js b/docs/examples/generate-language-examples.js index 5378c739d9..8136076d13 100644 --- a/docs/examples/generate-language-examples.js +++ b/docs/examples/generate-language-examples.js @@ -25,6 +25,8 @@ const {parseRequest} = require("@elastic/request-converter/dist/parse"); const {JavaCaller} = require("java-caller"); const LANGUAGES = ['Python', 'JavaScript', 'Ruby', 'PHP', 'curl']; +const EXAMPLES_JSON = 'docs/examples/languageExamples.json'; +let languageExamples = {}; async function generateLanguages(example) { const doc = yamlParseDocument(await fs.promises.readFile(example, 'utf8')); @@ -38,14 +40,18 @@ async function generateLanguages(example) { request += '\n' + JSON.stringify(data.value); } } - const alternatives = []; + if (data.alternatives) { + languageExamples[example] = data.alternatives; + delete data.alternatives; + } + let alternatives = []; for (const lang of LANGUAGES) { alternatives.push({ language: lang, code: (await convertRequests(request, lang, {})).trim(), }); } - data.alternatives = alternatives.concat((data.alternatives ?? []).filter(pair => !LANGUAGES.includes(pair.language))); + alternatives = alternatives.concat((languageExamples[example] ?? []).filter(pair => !LANGUAGES.includes(pair.language))); // specific java example generator if (process.argv[2] === "java") { @@ -85,13 +91,13 @@ async function generateLanguages(example) { code: stdout, }); // replace old java examples - data.alternatives = data.alternatives.filter(pair => pair.language !== "Java"); - data.alternatives = data.alternatives.concat(alternative_java); + alternatives = alternatives.filter(pair => pair.language !== "Java"); + alternatives = alternatives.concat(alternative_java); } } doc.delete('alternatives'); - doc.add(doc.createPair('alternatives', data.alternatives)); + languageExamples[example] = alternatives; await fs.promises.writeFile(example, doc.toString({lineWidth: 132})); } @@ -128,6 +134,9 @@ async function main() { let count = 0; let errors = 0; await loadSchema('output/schema/schema.json'); + if (fs.existsSync(EXAMPLES_JSON)) { + languageExamples = JSON.parse(await fs.promises.readFile(EXAMPLES_JSON, 'utf8')); + } for await (const example of walkExamples('./specification/')) { try { await generateLanguages(example); @@ -138,6 +147,7 @@ async function main() { } count += 1; } + await fs.promises.writeFile(EXAMPLES_JSON, JSON.stringify(languageExamples, null, 2)); console.log(`${count} examples processed, ${errors} errors.`); } diff --git a/docs/examples/languageExamples.json b/docs/examples/languageExamples.json new file mode 100644 index 0000000000..73dedecac3 --- /dev/null +++ b/docs/examples/languageExamples.json @@ -0,0 +1,16840 @@ +{ + "specification/xpack/usage/examples/request/XPackUsageRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.xpack().usage(u -> u);\n" + } + ], + "specification/xpack/info/examples/request/XPackInfoRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.xpack().info(i -> i);\n" + } + ], + "specification/cat/shards/examples/request/CatShardsRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.shards(\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.shards({\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.shards(\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->shards([\n \"format\" => \"json\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/shards?format=json\"" + }, + { + "language": "Java", + "code": "client.cat().shards();\n" + } + ], + "specification/cat/component_templates/examples/request/CatComponentTemplatesRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.component_templates(\n name=\"my-template-*\",\n v=True,\n s=\"name\",\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.componentTemplates({\n name: \"my-template-*\",\n v: \"true\",\n s: \"name\",\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.component_templates(\n name: \"my-template-*\",\n v: \"true\",\n s: \"name\",\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->componentTemplates([\n \"name\" => \"my-template-*\",\n \"v\" => \"true\",\n \"s\" => \"name\",\n \"format\" => \"json\",\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.cat().componentTemplates();\n" + } + ], + "specification/cat/tasks/examples/request/CatTasksRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.tasks(\n v=True,\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.tasks({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.tasks(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->tasks([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/tasks?v=true&format=json\"" + }, + { + "language": "Java", + "code": "client.cat().tasks();\n" + } + ], + "specification/cat/indices/examples/request/CatIndicesRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.indices(\n index=\"my-index-*\",\n v=True,\n s=\"index\",\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.indices({\n index: \"my-index-*\",\n v: \"true\",\n s: \"index\",\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.indices(\n index: \"my-index-*\",\n v: \"true\",\n s: \"index\",\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->indices([\n \"index\" => \"my-index-*\",\n \"v\" => \"true\",\n \"s\" => \"index\",\n \"format\" => \"json\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/indices/my-index-*?v=true&s=index&format=json\"" + }, + { + "language": "Java", + "code": "client.cat().indices();\n" + } + ], + "specification/cat/thread_pool/examples/request/CatThreadPoolRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.thread_pool(\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.threadPool({\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.thread_pool(\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->threadPool([\n \"format\" => \"json\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/thread_pool?format=json\"" + }, + { + "language": "Java", + "code": "client.cat().threadPool();\n" + } + ], + "specification/cat/pending_tasks/examples/request/CatPendingTasksRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.pending_tasks(\n v=\"trueh=insertOrder,timeInQueue,priority,source\",\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.pendingTasks({\n v: \"trueh=insertOrder,timeInQueue,priority,source\",\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.pending_tasks(\n v: \"trueh=insertOrder,timeInQueue,priority,source\",\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->pendingTasks([\n \"v\" => \"trueh=insertOrder,timeInQueue,priority,source\",\n \"format\" => \"json\",\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.cat().pendingTasks();\n" + } + ], + "specification/cat/nodeattrs/examples/request/CatNodeAttributesRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.nodeattrs(\n v=True,\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.nodeattrs({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.nodeattrs(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->nodeattrs([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/nodeattrs?v=true&format=json\"" + }, + { + "language": "Java", + "code": "client.cat().nodeattrs();\n" + } + ], + "specification/cat/snapshots/examples/request/CatSnapshotsRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.snapshots(\n repository=\"repo1\",\n v=True,\n s=\"id\",\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.snapshots({\n repository: \"repo1\",\n v: \"true\",\n s: \"id\",\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.snapshots(\n repository: \"repo1\",\n v: \"true\",\n s: \"id\",\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->snapshots([\n \"repository\" => \"repo1\",\n \"v\" => \"true\",\n \"s\" => \"id\",\n \"format\" => \"json\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/snapshots/repo1?v=true&s=id&format=json\"" + }, + { + "language": "Java", + "code": "client.cat().snapshots();\n" + } + ], + "specification/cat/nodes/examples/request/CatNodesRequestExample2.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.nodes(\n v=True,\n h=\"id,ip,port,v,m\",\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.nodes({\n v: \"true\",\n h: \"id,ip,port,v,m\",\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.nodes(\n v: \"true\",\n h: \"id,ip,port,v,m\",\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->nodes([\n \"v\" => \"true\",\n \"h\" => \"id,ip,port,v,m\",\n \"format\" => \"json\",\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.cat().nodes();\n" + } + ], + "specification/cat/ml_datafeeds/examples/request/CatDatafeedsRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.ml_datafeeds(\n v=True,\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.mlDatafeeds({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.ml_datafeeds(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->mlDatafeeds([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/ml/datafeeds?v=true&format=json\"" + }, + { + "language": "Java", + "code": "client.cat().mlDatafeeds();\n" + } + ], + "specification/cat/plugins/examples/request/CatPluginsRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.plugins(\n v=True,\n s=\"component\",\n h=\"name,component,version,description\",\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.plugins({\n v: \"true\",\n s: \"component\",\n h: \"name,component,version,description\",\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.plugins(\n v: \"true\",\n s: \"component\",\n h: \"name,component,version,description\",\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->plugins([\n \"v\" => \"true\",\n \"s\" => \"component\",\n \"h\" => \"name,component,version,description\",\n \"format\" => \"json\",\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.cat().plugins();\n" + } + ], + "specification/cat/recovery/examples/request/CatRecoveryRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.recovery(\n v=True,\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.recovery({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.recovery(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->recovery([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/recovery?v=true&format=json\"" + }, + { + "language": "Java", + "code": "client.cat().recovery();\n" + } + ], + "specification/cat/health/examples/request/CatHealthRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.health(\n v=True,\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.health({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.health(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->health([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/health?v=true&format=json\"" + }, + { + "language": "Java", + "code": "client.cat().health();\n" + } + ], + "specification/cat/ml_jobs/examples/request/CatJobsRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.ml_jobs(\n h=\"id,s,dpr,mb\",\n v=True,\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.mlJobs({\n h: \"id,s,dpr,mb\",\n v: \"true\",\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.ml_jobs(\n h: \"id,s,dpr,mb\",\n v: \"true\",\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->mlJobs([\n \"h\" => \"id,s,dpr,mb\",\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.cat().mlJobs();\n" + } + ], + "specification/cat/count/examples/request/CatCountRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.count(\n index=\"my-index-000001\",\n v=True,\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.count({\n index: \"my-index-000001\",\n v: \"true\",\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.count(\n index: \"my-index-000001\",\n v: \"true\",\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->count([\n \"index\" => \"my-index-000001\",\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/count/my-index-000001?v=true&format=json\"" + }, + { + "language": "Java", + "code": "client.cat().count();\n" + } + ], + "specification/cat/repositories/examples/request/CatRepositoriesRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.repositories(\n v=True,\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.repositories({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.repositories(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->repositories([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/repositories?v=true&format=json\"" + }, + { + "language": "Java", + "code": "client.cat().repositories();\n" + } + ], + "specification/cat/ml_data_frame_analytics/examples/request/CatDataframeanalyticsRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.ml_data_frame_analytics(\n v=True,\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.mlDataFrameAnalytics({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.ml_data_frame_analytics(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->mlDataFrameAnalytics([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/ml/data_frame/analytics?v=true&format=json\"" + }, + { + "language": "Java", + "code": "client.cat().mlDataFrameAnalytics();\n" + } + ], + "specification/cat/transforms/examples/request/CatTransformsRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.transforms(\n v=True,\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.transforms({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.transforms(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->transforms([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/transforms?v=true&format=json\"" + }, + { + "language": "Java", + "code": "client.cat().transforms();\n" + } + ], + "specification/cat/master/examples/request/CatMasterRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.master(\n v=True,\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.master({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.master(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->master([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/master?v=true&format=json\"" + }, + { + "language": "Java", + "code": "client.cat().master();\n" + } + ], + "specification/cat/templates/examples/request/CatTemplatesRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.templates(\n name=\"my-template-*\",\n v=True,\n s=\"name\",\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.templates({\n name: \"my-template-*\",\n v: \"true\",\n s: \"name\",\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.templates(\n name: \"my-template-*\",\n v: \"true\",\n s: \"name\",\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->templates([\n \"name\" => \"my-template-*\",\n \"v\" => \"true\",\n \"s\" => \"name\",\n \"format\" => \"json\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/templates/my-template-*?v=true&s=name&format=json\"" + }, + { + "language": "Java", + "code": "client.cat().templates();\n" + } + ], + "specification/cat/ml_trained_models/examples/request/CatTrainedModelsRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.ml_trained_models(\n v=True,\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.mlTrainedModels({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.ml_trained_models(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->mlTrainedModels([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/ml/trained_models?v=true&format=json\"" + }, + { + "language": "Java", + "code": "client.cat().mlTrainedModels();\n" + } + ], + "specification/cat/aliases/examples/request/CatAliasesRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.aliases(\n format=\"json\",\n v=True,\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.aliases({\n format: \"json\",\n v: \"true\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.aliases(\n format: \"json\",\n v: \"true\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->aliases([\n \"format\" => \"json\",\n \"v\" => \"true\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/aliases?format=json&v=true\"" + }, + { + "language": "Java", + "code": "client.cat().aliases();\n" + } + ], + "specification/cat/fielddata/examples/request/CatFielddataRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.fielddata(\n v=True,\n fields=\"body\",\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.fielddata({\n v: \"true\",\n fields: \"body\",\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.fielddata(\n v: \"true\",\n fields: \"body\",\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->fielddata([\n \"v\" => \"true\",\n \"fields\" => \"body\",\n \"format\" => \"json\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/fielddata?v=true&fields=body&format=json\"" + }, + { + "language": "Java", + "code": "client.cat().fielddata();\n" + } + ], + "specification/cat/segments/examples/request/CatSegmentsRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.segments(\n v=True,\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.segments({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.segments(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->segments([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/segments?v=true&format=json\"" + }, + { + "language": "Java", + "code": "client.cat().segments();\n" + } + ], + "specification/cat/allocation/examples/request/CatAllocationRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cat.allocation(\n v=True,\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cat.allocation({\n v: \"true\",\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cat.allocation(\n v: \"true\",\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cat()->allocation([\n \"v\" => \"true\",\n \"format\" => \"json\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cat/allocation?v=true&format=json\"" + }, + { + "language": "Java", + "code": "client.cat().allocation();\n" + } + ], + "specification/searchable_snapshots/cache_stats/examples/request/CacheStatsRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.searchableSnapshots().cacheStats(c -> c);\n" + } + ], + "specification/searchable_snapshots/clear_cache/examples/request/SearchableSnapshotsClearCacheExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.searchable_snapshots.clear_cache(\n index=\"my-index\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.searchableSnapshots.clearCache({\n index: \"my-index\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.searchable_snapshots.clear_cache(\n index: \"my-index\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->searchableSnapshots()->clearCache([\n \"index\" => \"my-index\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index/_searchable_snapshots/cache/clear\"" + }, + { + "language": "Java", + "code": "client.searchableSnapshots().clearCache(c -> c\n .index(\"my-index\")\n);\n" + } + ], + "specification/searchable_snapshots/mount/examples/request/SearchableSnapshotsMountSnapshotRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.searchableSnapshots().mount(m -> m\n .ignoreIndexSettings(\"index.refresh_interval\")\n .index(\"my_docs\")\n .indexSettings(\"index.number_of_replicas\", JsonData.fromJson(\"0\"))\n .renamedIndex(\"docs\")\n .repository(\"my_repository\")\n .snapshot(\"my_snapshot\")\n .waitForCompletion(true)\n);\n" + } + ], + "specification/searchable_snapshots/stats/examples/request/SearchableSnapshotsStatsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.searchable_snapshots.stats(\n index=\"my-index\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.searchableSnapshots.stats({\n index: \"my-index\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.searchable_snapshots.stats(\n index: \"my-index\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->searchableSnapshots()->stats([\n \"index\" => \"my-index\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index/_searchable_snapshots/stats\"" + }, + { + "language": "Java", + "code": "client.searchableSnapshots().stats(s -> s\n .index(\"my-index\")\n);\n" + } + ], + "specification/snapshot/delete_repository/examples/request/SnapshotDeleteRepositoryExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.snapshot.delete_repository(\n name=\"my_repository\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.snapshot.deleteRepository({\n name: \"my_repository\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.snapshot.delete_repository(\n repository: \"my_repository\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->snapshot()->deleteRepository([\n \"repository\" => \"my_repository\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_repository\"" + }, + { + "language": "Java", + "code": "client.snapshot().deleteRepository(d -> d\n .name(\"my_repository\")\n);\n" + } + ], + "specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample4.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.snapshot().createRepository(c -> c\n .name(\"my_s3_repository\")\n .repository(r -> r\n .s3(s -> s\n .settings(se -> se\n .bucket(\"my-bucket\")\n )\n )\n )\n);\n" + } + ], + "specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample5.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.snapshot().createRepository(c -> c\n .name(\"my_src_only_repository\")\n .repository(r -> r\n .source(s -> s\n .settings(se -> se\n .delegateType(\"fs\")\n )\n )\n )\n);\n" + } + ], + "specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample2.yaml": [ + { + "language": "Python", + "code": "resp = client.snapshot.create_repository(\n name=\"my_backup\",\n repository={\n \"type\": \"azure\",\n \"settings\": {\n \"client\": \"secondary\"\n }\n },\n)" + }, + { + "language": "JavaScript", + "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": "Ruby", + "code": "response = client.snapshot.create_repository(\n repository: \"my_backup\",\n body: {\n \"type\": \"azure\",\n \"settings\": {\n \"client\": \"secondary\"\n }\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->snapshot()->createRepository([\n \"repository\" => \"my_backup\",\n \"body\" => [\n \"type\" => \"azure\",\n \"settings\" => [\n \"client\" => \"secondary\",\n ],\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.snapshot().createRepository(c -> c\n .name(\"my_backup\")\n .repository(r -> r\n .azure(a -> a\n .settings(s -> s\n .client(\"secondary\")\n )\n )\n )\n);\n" + } + ], + "specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample3.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.snapshot().createRepository(c -> c\n .name(\"my_gcs_repository\")\n .repository(r -> r\n .gcs(g -> g\n .settings(s -> s\n .bucket(\"my_other_bucket\")\n .basePath(\"dev\")\n )\n )\n )\n);\n" + } + ], + "specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.snapshot().createRepository(c -> c\n .name(\"my_repository\")\n .repository(r -> r\n .fs(f -> f\n .settings(s -> s\n .location(\"my_backup_location\")\n )\n )\n )\n);\n" + } + ], + "specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample6.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.snapshot().createRepository(c -> c\n .name(\"my_read_only_url_repository\")\n .repository(r -> r\n .url(u -> u\n .settings(s -> s\n .url(\"file:/mount/backups/my_fs_backup_location\")\n )\n )\n )\n);\n" + } + ], + "specification/snapshot/delete/examples/request/SnapshotDeleteRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.snapshot.delete(\n repository=\"my_repository\",\n snapshot=\"snapshot_2,snapshot_3\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.snapshot.delete({\n repository: \"my_repository\",\n snapshot: \"snapshot_2,snapshot_3\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.snapshot.delete(\n repository: \"my_repository\",\n snapshot: \"snapshot_2,snapshot_3\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->snapshot()->delete([\n \"repository\" => \"my_repository\",\n \"snapshot\" => \"snapshot_2,snapshot_3\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_repository/snapshot_2,snapshot_3\"" + }, + { + "language": "Java", + "code": "client.snapshot().delete(d -> d\n .repository(\"my_repository\")\n .snapshot(\"snapshot_2,snapshot_3\")\n);\n" + } + ], + "specification/snapshot/verify_repository/examples/request/SnapshotVerifyRepositoryExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.snapshot.verify_repository(\n name=\"my_unverified_backup\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.snapshot.verifyRepository({\n name: \"my_unverified_backup\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.snapshot.verify_repository(\n repository: \"my_unverified_backup\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->snapshot()->verifyRepository([\n \"repository\" => \"my_unverified_backup\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_unverified_backup/_verify\"" + }, + { + "language": "Java", + "code": "client.snapshot().verifyRepository(v -> v\n .name(\"my_unverified_backup\")\n);\n" + } + ], + "specification/snapshot/get/examples/request/SnapshotGetRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.snapshot.get(\n repository=\"my_repository\",\n snapshot=\"snapshot_*\",\n sort=\"start_time\",\n from_sort_value=\"1577833200000\",\n)" + }, + { + "language": "JavaScript", + "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": "Ruby", + "code": "response = client.snapshot.get(\n repository: \"my_repository\",\n snapshot: \"snapshot_*\",\n sort: \"start_time\",\n from_sort_value: \"1577833200000\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->snapshot()->get([\n \"repository\" => \"my_repository\",\n \"snapshot\" => \"snapshot_*\",\n \"sort\" => \"start_time\",\n \"from_sort_value\" => \"1577833200000\",\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.snapshot().get(g -> g\n .fromSortValue(\"1577833200000\")\n .repository(\"my_repository\")\n .snapshot(\"snapshot_*\")\n .sort(SnapshotSort.StartTime)\n);\n" + } + ], + "specification/snapshot/repository_analyze/examples/request/SnapshotRepositoryAnalyzeRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.snapshot.repository_analyze(\n name=\"my_repository\",\n blob_count=\"10\",\n max_blob_size=\"1mb\",\n timeout=\"120s\",\n)" + }, + { + "language": "JavaScript", + "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": "Ruby", + "code": "response = client.snapshot.repository_analyze(\n repository: \"my_repository\",\n blob_count: \"10\",\n max_blob_size: \"1mb\",\n timeout: \"120s\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->snapshot()->repositoryAnalyze([\n \"repository\" => \"my_repository\",\n \"blob_count\" => \"10\",\n \"max_blob_size\" => \"1mb\",\n \"timeout\" => \"120s\",\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.snapshot().repositoryAnalyze(r -> r\n .blobCount(10)\n .maxBlobSize(\"1mb\")\n .name(\"my_repository\")\n .timeout(t -> t\n .offset(120)\n )\n);\n" + } + ], + "specification/snapshot/status/examples/request/SnapshotStatusRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.snapshot.status(\n repository=\"my_repository\",\n snapshot=\"snapshot_2\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.snapshot.status({\n repository: \"my_repository\",\n snapshot: \"snapshot_2\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.snapshot.status(\n repository: \"my_repository\",\n snapshot: \"snapshot_2\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->snapshot()->status([\n \"repository\" => \"my_repository\",\n \"snapshot\" => \"snapshot_2\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_repository/snapshot_2/_status\"" + }, + { + "language": "Java", + "code": "client.snapshot().status(s -> s\n .repository(\"my_repository\")\n .snapshot(\"snapshot_2\")\n);\n" + } + ], + "specification/snapshot/cleanup_repository/examples/request/SnapshotCleanupRepositoryRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.snapshot.cleanup_repository(\n name=\"my_repository\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.snapshot.cleanupRepository({\n name: \"my_repository\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.snapshot.cleanup_repository(\n repository: \"my_repository\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->snapshot()->cleanupRepository([\n \"repository\" => \"my_repository\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_repository/_cleanup\"" + }, + { + "language": "Java", + "code": "client.snapshot().cleanupRepository(c -> c\n .name(\"my_repository\")\n);\n" + } + ], + "specification/snapshot/repository_verify_integrity/examples/request/SnapshotRepositoryVerifyIntegrityExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.snapshot.repository_verify_integrity(\n name=\"my_repository\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.snapshot.repositoryVerifyIntegrity({\n name: \"my_repository\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.snapshot.repository_verify_integrity(\n repository: \"my_repository\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->snapshot()->repositoryVerifyIntegrity([\n \"repository\" => \"my_repository\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_repository/_verify_integrity\"" + }, + { + "language": "Java", + "code": "client.snapshot().repositoryVerifyIntegrity(r -> r\n .name(\"my_repository\")\n);\n" + } + ], + "specification/snapshot/clone/examples/request/SnapshotCloneRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.snapshot().clone(c -> c\n .indices(\"index_a,index_b\")\n .repository(\"my_repository\")\n .snapshot(\"source_snapshot\")\n .targetSnapshot(\"target_snapshot\")\n);\n" + } + ], + "specification/snapshot/get_repository/examples/request/SnapshotGetRepositoryRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.snapshot.get_repository(\n name=\"my_repository\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.snapshot.getRepository({\n name: \"my_repository\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.snapshot.get_repository(\n repository: \"my_repository\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->snapshot()->getRepository([\n \"repository\" => \"my_repository\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_snapshot/my_repository\"" + }, + { + "language": "Java", + "code": "client.snapshot().getRepository(g -> g\n .name(\"my_repository\")\n);\n" + } + ], + "specification/snapshot/create/examples/request/SnapshotCreateRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\":\"user123\",\"taken_because\":\"backup before upgrading\"}}' \"$ELASTICSEARCH_URL/_snapshot/my_repository/snapshot_2?wait_for_completion=true\"" + }, + { + "language": "Java", + "code": "client.snapshot().create(c -> c\n .ignoreUnavailable(true)\n .includeGlobalState(false)\n .indices(\"index_1,index_2\")\n .metadata(Map.of(\"taken_by\", JsonData.fromJson(\"\\\"user123\\\"\"),\"taken_because\", JsonData.fromJson(\"\\\"backup before upgrading\\\"\")))\n .repository(\"my_repository\")\n .snapshot(\"snapshot_2\")\n .waitForCompletion(true)\n);\n" + } + ], + "specification/snapshot/restore/examples/request/SnapshotRestoreRequestExample2.yaml": [ + { + "language": "Python", + "code": "resp = client.cluster.put_settings(\n indices=\"index_1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cluster.putSettings({\n indices: \"index_1\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cluster.put_settings(\n body: {\n \"indices\": \"index_1\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cluster()->putSettings([\n \"body\" => [\n \"indices\" => \"index_1\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.cluster().putSettings();\n" + } + ], + "specification/snapshot/restore/examples/request/SnapshotRestoreRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.snapshot().restore(r -> r\n .ignoreUnavailable(true)\n .includeAliases(false)\n .includeGlobalState(false)\n .indices(\"index_1,index_2\")\n .renamePattern(\"index_(.+)\")\n .renameReplacement(\"restored_index_$1\")\n .repository(\"my_repository\")\n .snapshot(\"snapshot_2\")\n .waitForCompletion(true)\n);\n" + } + ], + "specification/cluster/delete_component_template/examples/request/ClusterDeleteComponentTemplateExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cluster.delete_component_template(\n name=\"template_1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cluster.deleteComponentTemplate({\n name: \"template_1\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cluster.delete_component_template(\n name: \"template_1\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cluster()->deleteComponentTemplate([\n \"name\" => \"template_1\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_component_template/template_1\"" + }, + { + "language": "Java", + "code": "client.cluster().deleteComponentTemplate(d -> d\n .name(\"template_1\")\n);\n" + } + ], + "specification/cluster/pending_tasks/examples/request/ClusterPendingTasksExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.cluster().pendingTasks(p -> p);\n" + } + ], + "specification/cluster/put_component_template/examples/request/ClusterPutComponentTemplateRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\":{\"host_name\":{\"type\":\"keyword\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z yyyy\"}}}}' \"$ELASTICSEARCH_URL/_component_template/template_1\"" + } + ], + "specification/cluster/put_component_template/examples/request/ClusterPutComponentTemplateRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + } + ], + "specification/cluster/get_settings/examples/request/ClusterGetSettingsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cluster.get_settings(\n filter_path=\"persistent.cluster.remote\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cluster.getSettings({\n filter_path: \"persistent.cluster.remote\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cluster.get_settings(\n filter_path: \"persistent.cluster.remote\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cluster()->getSettings([\n \"filter_path\" => \"persistent.cluster.remote\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cluster/settings?filter_path=persistent.cluster.remote\"" + }, + { + "language": "Java", + "code": "\n" + } + ], + "specification/cluster/reroute/examples/request/ClusterRerouteRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + } + ], + "specification/cluster/allocation_explain/examples/request/ClusterAllocationExplainRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cluster.allocation_explain(\n index=\"my-index-000001\",\n shard=0,\n primary=False,\n current_node=\"my-node\",\n)" + }, + { + "language": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.cluster().allocationExplain(a -> a\n .currentNode(\"my-node\")\n .index(\"my-index-000001\")\n .primary(false)\n .shard(0)\n);\n" + } + ], + "specification/cluster/put_settings/examples/request/ClusterPutSettingsRequestExample2.yaml": [ + { + "language": "Python", + "code": "resp = client.cluster.put_settings(\n persistent={\n \"action.auto_create_index\": \"my-index-000001,index10,-index1*,+ind*\"\n },\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cluster.putSettings({\n persistent: {\n \"action.auto_create_index\": \"my-index-000001,index10,-index1*,+ind*\",\n },\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "code": "$resp = $client->cluster()->putSettings([\n \"body\" => [\n \"persistent\" => [\n \"action.auto_create_index\" => \"my-index-000001,index10,-index1*,+ind*\",\n ],\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.cluster().putSettings(p -> p\n .persistent(\"action.auto_create_index\", JsonData.fromJson(\"\\\"my-index-000001,index10,-index1*,+ind*\\\"\"))\n);\n" + } + ], + "specification/cluster/put_settings/examples/request/ClusterPutSettingsRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cluster.put_settings(\n persistent={\n \"indices.recovery.max_bytes_per_sec\": \"50mb\"\n },\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cluster.putSettings({\n persistent: {\n \"indices.recovery.max_bytes_per_sec\": \"50mb\",\n },\n});" + }, + { + "language": "Ruby", + "code": "response = client.cluster.put_settings(\n body: {\n \"persistent\": {\n \"indices.recovery.max_bytes_per_sec\": \"50mb\"\n }\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cluster()->putSettings([\n \"body\" => [\n \"persistent\" => [\n \"indices.recovery.max_bytes_per_sec\" => \"50mb\",\n ],\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.cluster().putSettings(p -> p\n .persistent(\"indices.recovery.max_bytes_per_sec\", JsonData.fromJson(\"\\\"50mb\\\"\"))\n);\n" + } + ], + "specification/cluster/health/examples/request/ClusterHealthRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.cluster().health(h -> h);\n" + } + ], + "specification/cluster/state/examples/request/ClusterStateExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cluster.state(\n filter_path=\"metadata.cluster_coordination.last_committed_config\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cluster.state({\n filter_path: \"metadata.cluster_coordination.last_committed_config\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cluster.state(\n filter_path: \"metadata.cluster_coordination.last_committed_config\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cluster()->state([\n \"filter_path\" => \"metadata.cluster_coordination.last_committed_config\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_cluster/state?filter_path=metadata.cluster_coordination.last_committed_config\"" + }, + { + "language": "Java", + "code": "\n" + } + ], + "specification/cluster/info/examples/request/ClusterInfoExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cluster.info(\n target=\"_all\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cluster.info({\n target: \"_all\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cluster.info(\n target: \"_all\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cluster()->info([\n \"target\" => \"_all\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_info/_all\"" + }, + { + "language": "Java", + "code": "client.cluster().info(i -> i\n .target(\"_all\")\n);\n" + } + ], + "specification/cluster/remote_info/examples/request/ClusterRemoteInfoExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.cluster().remoteInfo();\n" + } + ], + "specification/cluster/stats/examples/request/ClusterStatsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cluster.stats(\n human=True,\n filter_path=\"indices.mappings.total_deduplicated_mapping_size*\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cluster.stats({\n human: \"true\",\n filter_path: \"indices.mappings.total_deduplicated_mapping_size*\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cluster.stats(\n human: \"true\",\n filter_path: \"indices.mappings.total_deduplicated_mapping_size*\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cluster()->stats([\n \"human\" => \"true\",\n \"filter_path\" => \"indices.mappings.total_deduplicated_mapping_size*\",\n]);" + }, + { + "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*\"" + }, + { + "language": "Java", + "code": "\n" + } + ], + "specification/cluster/get_component_template/examples/request/ClusterGetComponentTemplateExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.cluster.get_component_template(\n name=\"template_1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.cluster.getComponentTemplate({\n name: \"template_1\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.cluster.get_component_template(\n name: \"template_1\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->cluster()->getComponentTemplate([\n \"name\" => \"template_1\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_component_template/template_1\"" + }, + { + "language": "Java", + "code": "client.cluster().getComponentTemplate(g -> g\n .name(\"template_1\")\n);\n" + } + ], + "specification/ssl/certificates/examples/request/GetCertificatesRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.ssl().certificates();\n" + } + ], + "specification/tasks/cancel/examples/request/TasksCancelExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.tasks.cancel(\n task_id=\"\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.tasks.cancel({\n task_id: \"\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.tasks.cancel(\n task_id: \"\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->tasks()->cancel([\n \"task_id\" => \"\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_tasks//_cancel\"" + }, + { + "language": "Java", + "code": "client.tasks().cancel(c -> c\n .taskId(\"\")\n);\n" + } + ], + "specification/tasks/get/examples/request/GetTaskRequestExample2.yaml": [ + { + "language": "Python", + "code": "resp = client.tasks.list(\n detailed=True,\n actions=\"*/delete/byquery\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.tasks.list({\n detailed: \"true\",\n actions: \"*/delete/byquery\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.tasks.list(\n detailed: \"true\",\n actions: \"*/delete/byquery\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->tasks()->list([\n \"detailed\" => \"true\",\n \"actions\" => \"*/delete/byquery\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_tasks?detailed=true&actions=*/delete/byquery\"" + } + ], + "specification/tasks/list/examples/request/ListTasksRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.tasks.list(\n actions=\"*search\",\n detailed=True,\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.tasks.list({\n actions: \"*search\",\n detailed: \"true\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.tasks.list(\n actions: \"*search\",\n detailed: \"true\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->tasks()->list([\n \"actions\" => \"*search\",\n \"detailed\" => \"true\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_tasks?actions=*search&detailed\"" + } + ], + "specification/indices/simulate_template/examples/request/indicesSimulateTemplateRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.indices().simulateTemplate(s -> s\n .composedOf(\"ct2\")\n .indexPatterns(\"my-index-*\")\n .priority(10L)\n .template(t -> t\n .settings(se -> se\n .otherSettings(\"index.number_of_replicas\", JsonData.fromJson(\"1\"))\n )\n )\n);\n" + } + ], + "specification/indices/split/examples/request/indicesSplitRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.indices().split(s -> s\n .index(\"my-index-000001\")\n .settings(\"index.number_of_shards\", JsonData.fromJson(\"2\"))\n .target(\"split-my-index-000001\")\n);\n" + } + ], + "specification/indices/update_aliases/examples/request/IndicesUpdateAliasesExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.indices().updateAliases(u -> u\n .actions(a -> a\n .add(ad -> ad\n .alias(\"logs\")\n .index(\"logs-nginx.access-prod\")\n )\n )\n);\n" + } + ], + "specification/indices/exists_alias/examples/request/IndicesExistsAliasExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.exists_alias(\n name=\"my-alias\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.existsAlias({\n name: \"my-alias\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.exists_alias(\n name: \"my-alias\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->existsAlias([\n \"name\" => \"my-alias\",\n]);" + }, + { + "language": "curl", + "code": "curl --head -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_alias/my-alias\"" + }, + { + "language": "Java", + "code": "client.indices().existsAlias(e -> e\n .name(\"my-alias\")\n);\n" + } + ], + "specification/indices/get_data_stream_mappings/examples/request/IndicesGetDataStreamMappingsRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.get_data_stream_mappings(\n name=\"my-data-stream\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.getDataStreamMappings({\n name: \"my-data-stream\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.get_data_stream_mappings(\n name: \"my-data-stream\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->getDataStreamMappings([\n \"name\" => \"my-data-stream\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/my-data-stream/_mappings\"" + } + ], + "specification/indices/delete_template/examples/request/IndicesDeleteTemplateExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.delete_template(\n name=\".cloud-hot-warm-allocation-0\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.deleteTemplate({\n name: \".cloud-hot-warm-allocation-0\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.delete_template(\n name: \".cloud-hot-warm-allocation-0\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->deleteTemplate([\n \"name\" => \".cloud-hot-warm-allocation-0\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_template/.cloud-hot-warm-allocation-0\"" + }, + { + "language": "Java", + "code": "client.indices().deleteTemplate(d -> d\n .name(\".cloud-hot-warm-allocation-0\")\n);\n" + } + ], + "specification/indices/data_streams_stats/examples/request/indicesDataStreamStatsExampleRequest1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.data_streams_stats(\n name=\"my-index-000001\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.dataStreamsStats({\n name: \"my-index-000001\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.data_streams_stats(\n name: \"my-index-000001\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->dataStreamsStats([\n \"name\" => \"my-index-000001\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/my-index-000001/_stats\"" + }, + { + "language": "Java", + "code": "client.indices().dataStreamsStats(d -> d\n .name(\"my-index-000001\")\n);\n" + } + ], + "specification/indices/delete_index_template/examples/request/IndicesDeleteIndexTemplateExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.delete_index_template(\n name=\"my-index-template\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.deleteIndexTemplate({\n name: \"my-index-template\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.delete_index_template(\n name: \"my-index-template\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->deleteIndexTemplate([\n \"name\" => \"my-index-template\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_index_template/my-index-template\"" + }, + { + "language": "Java", + "code": "client.indices().deleteIndexTemplate(d -> d\n .name(\"my-index-template\")\n);\n" + } + ], + "specification/indices/simulate_index_template/examples/request/indicesSimulateIndexTemplateRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.simulate_index_template(\n name=\"my-index-000001\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.simulateIndexTemplate({\n name: \"my-index-000001\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.simulate_index_template(\n name: \"my-index-000001\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->simulateIndexTemplate([\n \"name\" => \"my-index-000001\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_index_template/_simulate_index/my-index-000001\"" + }, + { + "language": "Java", + "code": "client.indices().simulateIndexTemplate(s -> s\n .name(\"my-index-000001\")\n);\n" + } + ], + "specification/indices/put_template/examples/request/indicesPutTemplateRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.indices().putTemplate(p -> p\n .aliases(Map.of(\"alias1\", Alias.of(a -> a),\"{index}-alias\", Alias.of(a -> a),\"alias2\", Alias.of(a -> a\n .filter(f -> f\n .term(t -> t\n .field(\"user.id\")\n .value(FieldValue.of(\"kimchy\"))\n )\n )\n .routing(\"shard-1\"))))\n .indexPatterns(\"te*\")\n .name(\"template_1\")\n .settings(s -> s\n .numberOfShards(\"1\")\n )\n);\n" + } + ], + "specification/indices/put_template/examples/request/indicesPutTemplateRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.indices().putTemplate(p -> p\n .indexPatterns(List.of(\"te*\",\"bar*\"))\n .mappings(m -> m\n .source(s -> s\n .enabled(false)\n )\n )\n .name(\"template_1\")\n .settings(s -> s\n .numberOfShards(\"1\")\n )\n);\n" + } + ], + "specification/indices/put_data_stream_mappings/examples/request/IndicesPutDataStreamMappingsRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.put_data_stream_mappings(\n name=\"my-data-stream\",\n mappings={\n \"properties\": {\n \"field1\": {\n \"type\": \"ip\"\n },\n \"field3\": {\n \"type\": \"text\"\n }\n }\n },\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.putDataStreamMappings({\n name: \"my-data-stream\",\n mappings: {\n properties: {\n field1: {\n type: \"ip\",\n },\n field3: {\n type: \"text\",\n },\n },\n },\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.put_data_stream_mappings(\n name: \"my-data-stream\",\n body: {\n \"properties\": {\n \"field1\": {\n \"type\": \"ip\"\n },\n \"field3\": {\n \"type\": \"text\"\n }\n }\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->putDataStreamMappings([\n \"name\" => \"my-data-stream\",\n \"body\" => [\n \"properties\" => [\n \"field1\" => [\n \"type\" => \"ip\",\n ],\n \"field3\" => [\n \"type\" => \"text\",\n ],\n ],\n ],\n]);" + }, + { + "language": "curl", + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"properties\":{\"field1\":{\"type\":\"ip\"},\"field3\":{\"type\":\"text\"}}}' \"$ELASTICSEARCH_URL/_data_stream/my-data-stream/_mappings\"" + } + ], + "specification/indices/delete_data_lifecycle/examples/request/IndicesDeleteDataLifecycleExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.delete_data_lifecycle(\n name=\"my-data-stream\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.deleteDataLifecycle({\n name: \"my-data-stream\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.delete_data_lifecycle(\n name: \"my-data-stream\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->deleteDataLifecycle([\n \"name\" => \"my-data-stream\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/my-data-stream/_lifecycle\"" + }, + { + "language": "Java", + "code": "client.indices().deleteDataLifecycle(d -> d\n .name(\"my-data-stream\")\n);\n" + } + ], + "specification/indices/create_from/examples/request/IndicesCreateFromExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.perform_request(\n \"POST\",\n \"/_create_from/my-index/my-new-index\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.transport.request({\n method: \"POST\",\n path: \"/_create_from/my-index/my-new-index\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.perform_request(\n \"POST\",\n \"/_create_from/my-index/my-new-index\",\n {},\n)" + }, + { + "language": "PHP", + "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": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_create_from/my-index/my-new-index\"" + }, + { + "language": "Java", + "code": "client.indices().createFrom(c -> c\n .dest(\"my-new-index\")\n .source(\"my-index\")\n .createFrom(cr -> cr)\n);\n" + } + ], + "specification/indices/close/examples/request/CloseIndexRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.close(\n index=\"my-index-00001\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.close({\n index: \"my-index-00001\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.close(\n index: \"my-index-00001\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->close([\n \"index\" => \"my-index-00001\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-00001/_close\"" + }, + { + "language": "Java", + "code": "client.indices().close(c -> c\n .index(\"my-index-00001\")\n);\n" + } + ], + "specification/indices/get_migrate_reindex_status/examples/request/IndicesGetMigrateReindexStatusExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.perform_request(\n \"GET\",\n \"/_migration/reindex/my-data-stream/_status\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.transport.request({\n method: \"GET\",\n path: \"/_migration/reindex/my-data-stream/_status\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.perform_request(\n \"GET\",\n \"/_migration/reindex/my-data-stream/_status\",\n {},\n)" + }, + { + "language": "PHP", + "code": "$requestFactory = Psr17FactoryDiscovery::findRequestFactory();\n$request = $requestFactory->createRequest(\n \"GET\",\n \"/_migration/reindex/my-data-stream/_status\",\n);\n$resp = $client->sendRequest($request);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_migration/reindex/my-data-stream/_status\"" + }, + { + "language": "Java", + "code": "client.indices().getMigrateReindexStatus(g -> g\n .index(\"my-data-stream\")\n);\n" + } + ], + "specification/indices/get_settings/examples/request/IndicesGetSettingsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.get_settings(\n index=\"_all\",\n expand_wildcards=\"all\",\n filter_path=\"*.settings.index.*.slowlog\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.getSettings({\n index: \"_all\",\n expand_wildcards: \"all\",\n filter_path: \"*.settings.index.*.slowlog\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.get_settings(\n index: \"_all\",\n expand_wildcards: \"all\",\n filter_path: \"*.settings.index.*.slowlog\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->getSettings([\n \"index\" => \"_all\",\n \"expand_wildcards\" => \"all\",\n \"filter_path\" => \"*.settings.index.*.slowlog\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_all/_settings?expand_wildcards=all&filter_path=*.settings.index.*.slowlog\"" + } + ], + "specification/indices/promote_data_stream/examples/request/IndicesPromoteDataStreamExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.promote_data_stream(\n name=\"my-data-stream\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.promoteDataStream({\n name: \"my-data-stream\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.promote_data_stream(\n name: \"my-data-stream\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->promoteDataStream([\n \"name\" => \"my-data-stream\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/_promote/my-data-stream\"" + }, + { + "language": "Java", + "code": "client.indices().promoteDataStream(p -> p\n .name(\"my-data-stream\")\n);\n" + } + ], + "specification/indices/flush/examples/request/IndicesFlushExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.indices().flush(f -> f);\n" + } + ], + "specification/indices/delete/examples/request/IndicesDeleteExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.delete(\n index=\"books\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.delete({\n index: \"books\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.delete(\n index: \"books\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->delete([\n \"index\" => \"books\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/books\"" + }, + { + "language": "Java", + "code": "client.indices().delete(d -> d\n .index(\"books\")\n);\n" + } + ], + "specification/indices/refresh/examples/request/IndicesRefreshExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.indices().refresh(r -> r);\n" + } + ], + "specification/indices/resolve_index/examples/request/ResolveIndexRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.resolve_index(\n name=\"f*,remoteCluster1:bar*\",\n expand_wildcards=\"all\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.resolveIndex({\n name: \"f*,remoteCluster1:bar*\",\n expand_wildcards: \"all\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.resolve_index(\n name: \"f*,remoteCluster1:bar*\",\n expand_wildcards: \"all\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->resolveIndex([\n \"name\" => \"f*,remoteCluster1:bar*\",\n \"expand_wildcards\" => \"all\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_resolve/index/f*,remoteCluster1:bar*?expand_wildcards=all\"" + } + ], + "specification/indices/exists/examples/request/IndicesExistsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.exists(\n index=\"my-data-stream\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.exists({\n index: \"my-data-stream\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.exists(\n index: \"my-data-stream\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->exists([\n \"index\" => \"my-data-stream\",\n]);" + }, + { + "language": "curl", + "code": "curl --head -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-data-stream\"" + }, + { + "language": "Java", + "code": "client.indices().exists(e -> e\n .index(\"my-data-stream\")\n);\n" + } + ], + "specification/indices/recovery/examples/request/indicesRecoveryRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.recovery(\n human=True,\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.recovery({\n human: \"true\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.recovery(\n human: \"true\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->recovery([\n \"human\" => \"true\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_recovery?human\"" + }, + { + "language": "Java", + "code": "\n" + } + ], + "specification/indices/put_settings/examples/request/indicesPutSettingsRequestExample3.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.put_settings(\n index=\"my-index-000001\",\n settings={\n \"analysis\": {\n \"analyzer\": {\n \"content\": {\n \"type\": \"custom\",\n \"tokenizer\": \"whitespace\"\n }\n }\n }\n },\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.putSettings({\n index: \"my-index-000001\",\n settings: {\n analysis: {\n analyzer: {\n content: {\n type: \"custom\",\n tokenizer: \"whitespace\",\n },\n },\n },\n },\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.put_settings(\n index: \"my-index-000001\",\n body: {\n \"analysis\": {\n \"analyzer\": {\n \"content\": {\n \"type\": \"custom\",\n \"tokenizer\": \"whitespace\"\n }\n }\n }\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->putSettings([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"analysis\" => [\n \"analyzer\" => [\n \"content\" => [\n \"type\" => \"custom\",\n \"tokenizer\" => \"whitespace\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "language": "curl", + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"analysis\":{\"analyzer\":{\"content\":{\"type\":\"custom\",\"tokenizer\":\"whitespace\"}}}}' \"$ELASTICSEARCH_URL/my-index-000001/_settings\"" + } + ], + "specification/indices/put_settings/examples/request/indicesPutSettingsRequestExample2.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.put_settings(\n index=\"my-index-000001\",\n settings={\n \"index\": {\n \"refresh_interval\": None\n }\n },\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.putSettings({\n index: \"my-index-000001\",\n settings: {\n index: {\n refresh_interval: null,\n },\n },\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.put_settings(\n index: \"my-index-000001\",\n body: {\n \"index\": {\n \"refresh_interval\": nil\n }\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->putSettings([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"index\" => [\n \"refresh_interval\" => null,\n ],\n ],\n]);" + }, + { + "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\"" + } + ], + "specification/indices/put_settings/examples/request/IndicesPutSettingsRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.put_settings(\n index=\"my-index-000001\",\n settings={\n \"index\": {\n \"number_of_replicas\": 2\n }\n },\n)" + }, + { + "language": "JavaScript", + "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": "Ruby", + "code": "response = client.indices.put_settings(\n index: \"my-index-000001\",\n body: {\n \"index\": {\n \"number_of_replicas\": 2\n }\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->putSettings([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"index\" => [\n \"number_of_replicas\" => 2,\n ],\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.indices().putSettings(p -> p\n .index(\"my-index-000001\")\n .settings(s -> s\n .index(i -> i\n .numberOfReplicas(\"2\")\n )\n )\n);\n" + } + ], + "specification/indices/clear_cache/examples/request/IndicesClearCacheExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.clear_cache(\n index=\"my-index-000001,my-index-000002\",\n request=True,\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.clearCache({\n index: \"my-index-000001,my-index-000002\",\n request: \"true\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.clear_cache(\n index: \"my-index-000001,my-index-000002\",\n request: \"true\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->clearCache([\n \"index\" => \"my-index-000001,my-index-000002\",\n \"request\" => \"true\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001,my-index-000002/_cache/clear?request=true\"" + }, + { + "language": "Java", + "code": "client.indices().clearCache(c -> c\n .index(List.of(\"my-index-000001\",\"my-index-000002\"))\n .request(true)\n);\n" + } + ], + "specification/indices/reload_search_analyzers/examples/request/ReloadSearchAnalyzersRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.reload_search_analyzers(\n index=\"my-index-000001\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.reloadSearchAnalyzers({\n index: \"my-index-000001\",\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "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": "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_analyzers\":[\"my_synonyms\"],\"reloaded_node_ids\":[\"mfdqTXn_T7SGr2Ho2KT8uw\"]}]}' \"$ELASTICSEARCH_URL/my-index-000001/_reload_search_analyzers\"" + } + ], + "specification/indices/cancel_migrate_reindex/examples/request/IndicesCancelMigrateReindexExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.perform_request(\n \"POST\",\n \"/_migration/reindex/my-data-stream/_cancel\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.transport.request({\n method: \"POST\",\n path: \"/_migration/reindex/my-data-stream/_cancel\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.perform_request(\n \"POST\",\n \"/_migration/reindex/my-data-stream/_cancel\",\n {},\n)" + }, + { + "language": "PHP", + "code": "$requestFactory = Psr17FactoryDiscovery::findRequestFactory();\n$request = $requestFactory->createRequest(\n \"POST\",\n \"/_migration/reindex/my-data-stream/_cancel\",\n);\n$resp = $client->sendRequest($request);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_migration/reindex/my-data-stream/_cancel\"" + }, + { + "language": "Java", + "code": "client.indices().cancelMigrateReindex(c -> c\n .index(\"my-data-stream\")\n);\n" + } + ], + "specification/indices/delete_data_stream/examples/request/IndicesDeleteDataStreamExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.delete_data_stream(\n name=\"my-data-stream\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.deleteDataStream({\n name: \"my-data-stream\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.delete_data_stream(\n name: \"my-data-stream\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->deleteDataStream([\n \"name\" => \"my-data-stream\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/my-data-stream\"" + }, + { + "language": "Java", + "code": "client.indices().deleteDataStream(d -> d\n .name(\"my-data-stream\")\n);\n" + } + ], + "specification/indices/get/examples/request/IndicesGetExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.get(\n index=\"my-index-000001\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.get({\n index: \"my-index-000001\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.get(\n index: \"my-index-000001\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->get([\n \"index\" => \"my-index-000001\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001\"" + }, + { + "language": "Java", + "code": "client.indices().get(g -> g\n .index(\"my-index-000001\")\n);\n" + } + ], + "specification/indices/disk_usage/examples/request/IndicesDiskUsageExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.disk_usage(\n index=\"my-index-000001\",\n run_expensive_tasks=True,\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.diskUsage({\n index: \"my-index-000001\",\n run_expensive_tasks: \"true\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.disk_usage(\n index: \"my-index-000001\",\n run_expensive_tasks: \"true\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->diskUsage([\n \"index\" => \"my-index-000001\",\n \"run_expensive_tasks\" => \"true\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_disk_usage?run_expensive_tasks=true\"" + }, + { + "language": "Java", + "code": "client.indices().diskUsage(d -> d\n .index(\"my-index-000001\")\n .runExpensiveTasks(true)\n);\n" + } + ], + "specification/indices/create_data_stream/examples/request/IndicesCreateDataStreamExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.create_data_stream(\n name=\"logs-foo-bar\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.createDataStream({\n name: \"logs-foo-bar\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.create_data_stream(\n name: \"logs-foo-bar\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->createDataStream([\n \"name\" => \"logs-foo-bar\",\n]);" + }, + { + "language": "curl", + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/logs-foo-bar\"" + }, + { + "language": "Java", + "code": "client.indices().createDataStream(c -> c\n .name(\"logs-foo-bar\")\n);\n" + } + ], + "specification/indices/delete_alias/examples/request/IndicesDeleteAliasExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.delete_alias(\n index=\"my-data-stream\",\n name=\"my-alias\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.deleteAlias({\n index: \"my-data-stream\",\n name: \"my-alias\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.delete_alias(\n index: \"my-data-stream\",\n name: \"my-alias\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->deleteAlias([\n \"index\" => \"my-data-stream\",\n \"name\" => \"my-alias\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-data-stream/_alias/my-alias\"" + }, + { + "language": "Java", + "code": "client.indices().deleteAlias(d -> d\n .index(\"my-data-stream\")\n .name(\"my-alias\")\n);\n" + } + ], + "specification/indices/forcemerge/examples/request/IndicesForcemergeExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.forcemerge(\n index=\"my-index-000001\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.forcemerge({\n index: \"my-index-000001\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.forcemerge(\n index: \"my-index-000001\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->forcemerge([\n \"index\" => \"my-index-000001\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_forcemerge\"" + }, + { + "language": "Java", + "code": "client.indices().forcemerge(f -> f\n .index(\"my-index-000001\")\n);\n" + } + ], + "specification/indices/downsample/examples/request/DownsampleRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.indices().downsample(d -> d\n .index(\"my-time-series-index\")\n .targetIndex(\"my-downsampled-time-series-index\")\n .config(c -> c\n .fixedInterval(f -> f\n .time(\"1d\")\n )\n )\n);\n" + } + ], + "specification/indices/get_template/examples/request/IndicesGetTemplateExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.get_template(\n name=\".monitoring-*\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.getTemplate({\n name: \".monitoring-*\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.get_template(\n name: \".monitoring-*\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->getTemplate([\n \"name\" => \".monitoring-*\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_template/.monitoring-*\"" + }, + { + "language": "Java", + "code": "client.indices().getTemplate(g -> g\n .name(\".monitoring-*\")\n);\n" + } + ], + "specification/indices/shrink/examples/request/indicesShrinkRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.indices().shrink(s -> s\n .index(\"my_source_index\")\n .settings(Map.of(\"index.blocks.write\", JsonData.fromJson(\"null\"),\"index.routing.allocation.require._name\", JsonData.fromJson(\"null\")))\n .target(\"my_target_index\")\n);\n" + } + ], + "specification/indices/explain_data_lifecycle/examples/request/IndicesExplainDataLifecycleRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.explain_data_lifecycle(\n index=\".ds-metrics-2023.03.22-000001\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.explainDataLifecycle({\n index: \".ds-metrics-2023.03.22-000001\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.explain_data_lifecycle(\n index: \".ds-metrics-2023.03.22-000001\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->explainDataLifecycle([\n \"index\" => \".ds-metrics-2023.03.22-000001\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/.ds-metrics-2023.03.22-000001/_lifecycle/explain\"" + }, + { + "language": "Java", + "code": "client.indices().explainDataLifecycle(e -> e\n .index(\".ds-metrics-2023.03.22-000001\")\n);\n" + } + ], + "specification/indices/get_mapping/examples/request/IndicesGetMappingExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.get_mapping(\n index=\"books\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.getMapping({\n index: \"books\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.get_mapping(\n index: \"books\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->getMapping([\n \"index\" => \"books\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/books/_mapping\"" + }, + { + "language": "Java", + "code": "client.indices().getMapping(g -> g\n .index(\"books\")\n);\n" + } + ], + "specification/indices/get_data_lifecycle_stats/examples/request/IndicesGetDataLifecycleStatsRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.get_data_lifecycle_stats(\n human=True,\n pretty=True,\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.getDataLifecycleStats({\n human: \"true\",\n pretty: \"true\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.get_data_lifecycle_stats(\n human: \"true\",\n pretty: \"true\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->getDataLifecycleStats([\n \"human\" => \"true\",\n \"pretty\" => \"true\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_lifecycle/stats?human&pretty\"" + }, + { + "language": "Java", + "code": "client.indices().getDataLifecycleStats();\n" + } + ], + "specification/indices/add_block/examples/request/IndicesAddBlockRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.add_block(\n index=\"my-index-000001\",\n block=\"write\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.addBlock({\n index: \"my-index-000001\",\n block: \"write\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.add_block(\n index: \"my-index-000001\",\n block: \"write\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->addBlock([\n \"index\" => \"my-index-000001\",\n \"block\" => \"write\",\n]);" + }, + { + "language": "curl", + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_block/write\"" + }, + { + "language": "Java", + "code": "client.indices().addBlock(a -> a\n .block(IndicesBlockOptions.Write)\n .index(\"my-index-000001\")\n);\n" + } + ], + "specification/indices/rollover/examples/request/indicesRolloverRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.indices().rollover(r -> r\n .alias(\"my-data-stream\")\n .conditions(c -> c\n .maxAge(m -> m\n .time(\"7d\")\n )\n .maxDocs(1000L)\n .maxPrimaryShardSize(\"50gb\")\n .maxPrimaryShardDocs(2000L)\n )\n);\n" + } + ], + "specification/indices/put_data_lifecycle/examples/request/IndicesPutDataLifecycleRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.put_data_lifecycle(\n name=\"my-data-stream\",\n data_retention=\"7d\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.putDataLifecycle({\n name: \"my-data-stream\",\n data_retention: \"7d\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.put_data_lifecycle(\n name: \"my-data-stream\",\n body: {\n \"data_retention\": \"7d\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->putDataLifecycle([\n \"name\" => \"my-data-stream\",\n \"body\" => [\n \"data_retention\" => \"7d\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.indices().putDataLifecycle(p -> p\n .dataRetention(d -> d\n .time(\"7d\")\n )\n .name(\"my-data-stream\")\n);\n" + } + ], + "specification/indices/put_data_lifecycle/examples/request/IndicesPutDataLifecycleRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + } + ], + "specification/indices/exists_template/examples/request/IndicesExistsTemplateExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.exists_template(\n name=\"template_1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.existsTemplate({\n name: \"template_1\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.exists_template(\n name: \"template_1\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->existsTemplate([\n \"name\" => \"template_1\",\n]);" + }, + { + "language": "curl", + "code": "curl --head -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_template/template_1\"" + }, + { + "language": "Java", + "code": "client.indices().existsTemplate(e -> e\n .name(\"template_1\")\n);\n" + } + ], + "specification/indices/validate_query/examples/request/IndicesValidateQueryExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.validate_query(\n index=\"my-index-000001\",\n q=\"user.id:kimchy\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.validateQuery({\n index: \"my-index-000001\",\n q: \"user.id:kimchy\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.validate_query(\n index: \"my-index-000001\",\n q: \"user.id:kimchy\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->validateQuery([\n \"index\" => \"my-index-000001\",\n \"q\" => \"user.id:kimchy\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_validate/query?q=user.id:kimchy\"" + }, + { + "language": "Java", + "code": "client.indices().validateQuery(v -> v\n .index(\"my-index-000001\")\n .q(\"user.id:kimchy\")\n);\n" + } + ], + "specification/indices/put_index_template/examples/request/IndicesPutIndexTemplateRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.indices().putIndexTemplate(p -> p\n .indexPatterns(\"template*\")\n .name(\"template_1\")\n .priority(1L)\n .template(t -> t\n .settings(s -> s\n .numberOfShards(\"2\")\n )\n )\n);\n" + } + ], + "specification/indices/put_index_template/examples/request/IndicesPutIndexTemplateRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.indices().putIndexTemplate(p -> p\n .indexPatterns(\"template*\")\n .name(\"template_1\")\n .template(t -> t\n .aliases(Map.of(\"alias1\", Alias.of(a -> a),\"{index}-alias\", Alias.of(a -> a),\"alias2\", Alias.of(a -> a\n .filter(f -> f\n .term(te -> te\n .field(\"user.id\")\n .value(FieldValue.of(\"kimchy\"))\n )\n )\n .routing(\"shard-1\"))))\n .settings(s -> s\n .numberOfShards(\"1\")\n )\n )\n);\n" + } + ], + "specification/indices/clone/examples/request/indicesCloneRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.indices().clone(c -> c\n .aliases(\"my_search_indices\", a -> a)\n .index(\"my_source_index\")\n .settings(\"index.number_of_shards\", JsonData.fromJson(\"5\"))\n .target(\"my_target_index\")\n);\n" + } + ], + "specification/indices/get_index_template/examples/request/IndicesGetIndexTemplateExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "\n" + } + ], + "specification/indices/get_data_lifecycle/examples/request/IndicesGetDataLifecycleRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.get_data_lifecycle(\n name=\"{name}\",\n human=True,\n pretty=True,\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.getDataLifecycle({\n name: \"{name}\",\n human: \"true\",\n pretty: \"true\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.get_data_lifecycle(\n name: \"{name}\",\n human: \"true\",\n pretty: \"true\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->getDataLifecycle([\n \"name\" => \"{name}\",\n \"human\" => \"true\",\n \"pretty\" => \"true\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/%7Bname%7D/_lifecycle?human&pretty\"" + }, + { + "language": "Java", + "code": "\n" + } + ], + "specification/indices/get_data_stream/examples/request/IndicesGetDataStreamExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.get_data_stream(\n name=\"my-data-stream\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.getDataStream({\n name: \"my-data-stream\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.get_data_stream(\n name: \"my-data-stream\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->getDataStream([\n \"name\" => \"my-data-stream\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/my-data-stream\"" + }, + { + "language": "Java", + "code": "client.indices().getDataStream(g -> g\n .name(\"my-data-stream\")\n);\n" + } + ], + "specification/indices/modify_data_stream/examples/request/IndicesModifyDataStreamExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.indices().modifyDataStream(m -> m\n .actions(List.of(Action.of(a -> a\n .removeBackingIndex(r -> r\n .dataStream(\"my-data-stream\")\n .index(\".ds-my-data-stream-2023.07.26-000001\")\n )),Action.of(ac -> ac\n .addBackingIndex(ad -> ad\n .dataStream(\"my-data-stream\")\n .index(\".ds-my-data-stream-2023.07.26-000001-downsample\")\n ))))\n);\n" + } + ], + "specification/indices/analyze/examples/request/indicesAnalyzeRequestExample3.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.indices().analyze(a -> a\n .charFilter(c -> c\n .name(\"html_strip\")\n )\n .filter(f -> f\n .name(\"lowercase\")\n )\n .text(\"this is a test\")\n .tokenizer(t -> t\n .name(\"keyword\")\n )\n);\n" + } + ], + "specification/indices/analyze/examples/request/indicesAnalyzeRequestExample2.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.analyze(\n analyzer=\"standard\",\n text=[\n \"this is a test\",\n \"the second text\"\n ],\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.analyze({\n analyzer: \"standard\",\n text: [\"this is a test\", \"the second text\"],\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.indices().analyze(a -> a\n .analyzer(\"standard\")\n .text(List.of(\"this is a test\",\"the second text\"))\n);\n" + } + ], + "specification/indices/analyze/examples/request/indicesAnalyzeRequestExample5.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.analyze(\n index=\"analyze_sample\",\n field=\"obj1.field1\",\n text=\"this is a test\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.analyze({\n index: \"analyze_sample\",\n field: \"obj1.field1\",\n text: \"this is a test\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.analyze(\n index: \"analyze_sample\",\n body: {\n \"field\": \"obj1.field1\",\n \"text\": \"this is a test\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->analyze([\n \"index\" => \"analyze_sample\",\n \"body\" => [\n \"field\" => \"obj1.field1\",\n \"text\" => \"this is a test\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.indices().analyze(a -> a\n .field(\"obj1.field1\")\n .index(\"analyze_sample\")\n .text(\"this is a test\")\n);\n" + } + ], + "specification/indices/analyze/examples/request/indicesAnalyzeRequestExample4.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.indices().analyze(a -> a\n .filter(List.of(TokenFilter.of(t -> t\n .name(\"lowercase\"\n )),TokenFilter.of(to -> to\n .definition(d -> d\n .stop(s -> s\n .stopwords(List.of(\"a\",\"is\",\"this\"))\n )\n ))))\n .text(\"this is a test\")\n .tokenizer(tok -> tok\n .name(\"whitespace\")\n )\n);\n" + } + ], + "specification/indices/analyze/examples/request/indicesAnalyzeRequestExample7.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.indices().analyze(a -> a\n .attributes(\"keyword\")\n .explain(true)\n .filter(f -> f\n .name(\"snowball\")\n )\n .text(\"detailed output\")\n .tokenizer(t -> t\n .name(\"standard\")\n )\n);\n" + } + ], + "specification/indices/analyze/examples/request/indicesAnalyzeRequestExample6.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.analyze(\n index=\"analyze_sample\",\n normalizer=\"my_normalizer\",\n text=\"BaR\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.analyze({\n index: \"analyze_sample\",\n normalizer: \"my_normalizer\",\n text: \"BaR\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.analyze(\n index: \"analyze_sample\",\n body: {\n \"normalizer\": \"my_normalizer\",\n \"text\": \"BaR\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->analyze([\n \"index\" => \"analyze_sample\",\n \"body\" => [\n \"normalizer\" => \"my_normalizer\",\n \"text\" => \"BaR\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.indices().analyze(a -> a\n .index(\"analyze_sample\")\n .normalizer(\"my_normalizer\")\n .text(\"BaR\")\n);\n" + } + ], + "specification/indices/analyze/examples/request/indicesAnalyzeRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.analyze(\n analyzer=\"standard\",\n text=\"this is a test\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.analyze({\n analyzer: \"standard\",\n text: \"this is a test\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.analyze(\n body: {\n \"analyzer\": \"standard\",\n \"text\": \"this is a test\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->analyze([\n \"body\" => [\n \"analyzer\" => \"standard\",\n \"text\" => \"this is a test\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.indices().analyze(a -> a\n .analyzer(\"standard\")\n .text(\"this is a test\")\n);\n" + } + ], + "specification/indices/shard_stores/examples/request/indicesShardStoresRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.shard_stores(\n status=\"green\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.shardStores({\n status: \"green\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.shard_stores(\n status: \"green\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->shardStores([\n \"status\" => \"green\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_shard_stores?status=green\"" + } + ], + "specification/indices/get_data_stream_settings/examples/request/IndicesGetDataStreamSettingsRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.get_data_stream_settings(\n name=\"my-data-stream\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.getDataStreamSettings({\n name: \"my-data-stream\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.get_data_stream_settings(\n name: \"my-data-stream\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->getDataStreamSettings([\n \"name\" => \"my-data-stream\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/my-data-stream/_settings\"" + } + ], + "specification/indices/get_alias/examples/request/IndicesGetAliasExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.indices().getAlias(g -> g);\n" + } + ], + "specification/indices/remove_block/examples/request/IndicesRemoveBlockRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.remove_block(\n index=\"my-index-000001\",\n block=\"write\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.removeBlock({\n index: \"my-index-000001\",\n block: \"write\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.remove_block(\n index: \"my-index-000001\",\n block: \"write\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->removeBlock([\n \"index\" => \"my-index-000001\",\n \"block\" => \"write\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_block/write\"" + }, + { + "language": "Java", + "code": "client.indices().removeBlock(a -> a\n .block(IndicesBlockOptions.Write)\n .index(\"my-index-000001\")\n);\n" + } + ], + "specification/indices/put_alias/examples/request/indicesPutAliasRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.indices().updateAliases(u -> u\n .actions(a -> a\n .add(ad -> ad\n .alias(\"my-alias\")\n .index(\"my-data-stream\")\n )\n )\n);\n" + } + ], + "specification/indices/put_data_stream_settings/examples/request/IndicesPutDataStreamSettingsRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.put_data_stream_settings(\n name=\"my-data-stream\",\n settings={\n \"index.lifecycle.name\": \"new-test-policy\",\n \"index.number_of_shards\": 11\n },\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.putDataStreamSettings({\n name: \"my-data-stream\",\n settings: {\n \"index.lifecycle.name\": \"new-test-policy\",\n \"index.number_of_shards\": 11,\n },\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.put_data_stream_settings(\n name: \"my-data-stream\",\n body: {\n \"index.lifecycle.name\": \"new-test-policy\",\n \"index.number_of_shards\": 11\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->putDataStreamSettings([\n \"name\" => \"my-data-stream\",\n \"body\" => [\n \"index.lifecycle.name\" => \"new-test-policy\",\n \"index.number_of_shards\" => 11,\n ],\n]);" + }, + { + "language": "curl", + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index.lifecycle.name\":\"new-test-policy\",\"index.number_of_shards\":11}' \"$ELASTICSEARCH_URL/_data_stream/my-data-stream/_settings\"" + } + ], + "specification/indices/get_field_mapping/examples/request/indicesGetFieldMappingRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.get_field_mapping(\n index=\"publications\",\n fields=\"title\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.getFieldMapping({\n index: \"publications\",\n fields: \"title\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.get_field_mapping(\n index: \"publications\",\n fields: \"title\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->getFieldMapping([\n \"index\" => \"publications\",\n \"fields\" => \"title\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/publications/_mapping/field/title\"" + }, + { + "language": "Java", + "code": "client.indices().getFieldMapping(g -> g\n .fields(\"title\")\n .index(\"publications\")\n);\n" + } + ], + "specification/indices/migrate_reindex/examples/request/IndicesMigrateReindexExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.indices().migrateReindex(m -> m\n .reindex(r -> r\n .mode(ModeEnum.Upgrade)\n .source(s -> s\n .index(\"my-data-stream\")\n )\n )\n);\n" + } + ], + "specification/indices/create/examples/request/indicesCreateRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.indices().create(c -> c\n .index(\"my-index-000001\")\n .settings(s -> s\n .numberOfShards(\"3\")\n .numberOfReplicas(\"2\")\n )\n);\n" + } + ], + "specification/indices/create/examples/request/indicesCreateRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.indices().create(c -> c\n .index(\"test\")\n .mappings(m -> m\n .properties(\"field1\", p -> p\n .text(t -> t)\n )\n )\n .settings(s -> s\n .numberOfShards(\"1\")\n )\n);\n" + } + ], + "specification/indices/create/examples/request/indicesCreateRequestExample3.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.indices().create(c -> c\n .aliases(Map.of(\"alias_2\", Alias.of(a -> a\n .filter(f -> f\n .term(t -> t\n .field(\"user.id\")\n .value(FieldValue.of(\"kimchy\"))\n )\n )\n .routing(\"shard-1\")),\"alias_1\", Alias.of(al -> al)))\n .index(\"test\")\n);\n" + } + ], + "specification/indices/field_usage_stats/examples/request/indicesFieldUsageStatsRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.field_usage_stats(\n index=\"my-index-000001\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.fieldUsageStats({\n index: \"my-index-000001\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.field_usage_stats(\n index: \"my-index-000001\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->fieldUsageStats([\n \"index\" => \"my-index-000001\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_field_usage_stats\"" + }, + { + "language": "Java", + "code": "client.indices().fieldUsageStats(f -> f\n .index(\"my-index-000001\")\n);\n" + } + ], + "specification/indices/migrate_to_data_stream/examples/request/IndicesMigrateToDataStreamExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.migrate_to_data_stream(\n name=\"my-time-series-data\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.migrateToDataStream({\n name: \"my-time-series-data\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.migrate_to_data_stream(\n name: \"my-time-series-data\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->migrateToDataStream([\n \"name\" => \"my-time-series-data\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_data_stream/_migrate/my-time-series-data\"" + }, + { + "language": "Java", + "code": "client.indices().migrateToDataStream(m -> m\n .name(\"my-time-series-data\")\n);\n" + } + ], + "specification/indices/open/examples/request/IndicesOpenExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.open(\n index=\".ds-my-data-stream-2099.03.07-000001\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.open({\n index: \".ds-my-data-stream-2099.03.07-000001\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.open(\n index: \".ds-my-data-stream-2099.03.07-000001\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->open([\n \"index\" => \".ds-my-data-stream-2099.03.07-000001\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/.ds-my-data-stream-2099.03.07-000001/_open/\"" + }, + { + "language": "Java", + "code": "client.indices().open(o -> o\n .index(\".ds-my-data-stream-2099.03.07-000001\")\n);\n" + } + ], + "specification/indices/stats/examples/request/IndicesStatsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.stats(\n metric=\"fielddata\",\n human=True,\n fields=\"my_join_field\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.stats({\n metric: \"fielddata\",\n human: \"true\",\n fields: \"my_join_field\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.stats(\n metric: \"fielddata\",\n human: \"true\",\n fields: \"my_join_field\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->stats([\n \"metric\" => \"fielddata\",\n \"human\" => \"true\",\n \"fields\" => \"my_join_field\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_stats/fielddata?human&fields=my_join_field#question\"" + }, + { + "language": "Java", + "code": "\n" + } + ], + "specification/indices/segments/examples/request/IndicesSegmentsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.segments(\n index=\"my-index-000001\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.segments({\n index: \"my-index-000001\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.segments(\n index: \"my-index-000001\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->segments([\n \"index\" => \"my-index-000001\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_segments\"" + }, + { + "language": "Java", + "code": "client.indices().segments(s -> s\n .index(\"my-index-000001\")\n);\n" + } + ], + "specification/indices/put_mapping/examples/request/indicesPutMappingRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.indices().putMapping(p -> p\n .index(\"my-index-000001\")\n .properties(\"user\", pr -> pr\n .object(o -> o\n .properties(\"name\", pro -> pro\n .keyword(k -> k)\n )\n )\n )\n);\n" + } + ], + "specification/indices/resolve_cluster/examples/request/ResolveClusterRequestExample2.yaml": [ + { + "language": "Python", + "code": "resp = client.indices.resolve_cluster(\n name=\"not-present,clust*:my-index*,oldcluster:*\",\n ignore_unavailable=False,\n timeout=\"5s\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.indices.resolveCluster({\n name: \"not-present,clust*:my-index*,oldcluster:*\",\n ignore_unavailable: \"false\",\n timeout: \"5s\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.indices.resolve_cluster(\n name: \"not-present,clust*:my-index*,oldcluster:*\",\n ignore_unavailable: \"false\",\n timeout: \"5s\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->indices()->resolveCluster([\n \"name\" => \"not-present,clust*:my-index*,oldcluster:*\",\n \"ignore_unavailable\" => \"false\",\n \"timeout\" => \"5s\",\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.indices().resolveCluster(r -> r\n .ignoreUnavailable(false)\n .name(List.of(\"not-present\",\"clust*:my-index*\",\"oldcluster:*\"))\n .timeout(t -> t\n .offset(5)\n )\n);\n" + } + ], + "specification/_global/get_source/examples/request/GetSourceRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.get_source(\n index=\"my-index-000001\",\n id=\"1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.getSource({\n index: \"my-index-000001\",\n id: 1,\n});" + }, + { + "language": "Ruby", + "code": "response = client.get_source(\n index: \"my-index-000001\",\n id: \"1\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->getSource([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_source/1\"" + }, + { + "language": "Java", + "code": "client.getSource(g -> g\n .id(\"1\")\n .index(\"my-index-000001\")\n);\n" + } + ], + "specification/_global/get_script_languages/examples/request/GetScriptLanguagesRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.getScriptLanguages();\n" + } + ], + "specification/_global/update_by_query_rethrottle/examples/request/UpdateByQueryRethrottleRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.update_by_query_rethrottle(\n task_id=\"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second=\"-1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.updateByQueryRethrottle({\n task_id: \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second: \"-1\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.update_by_query_rethrottle(\n task_id: \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second: \"-1\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->updateByQueryRethrottle([\n \"task_id\" => \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n \"requests_per_second\" => \"-1\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_update_by_query/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1\"" + }, + { + "language": "Java", + "code": "client.updateByQueryRethrottle(u -> u\n .requestsPerSecond(-1.0F)\n .taskId(\"r1A2WoRbTwKZ516z6NEs5A:36619\")\n);\n" + } + ], + "specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.scriptsPainlessExecute(s -> s\n .context(PainlessContext.Filter)\n .contextSetup(c -> c\n .document(JsonData.fromJson(\"{\\\"field\\\":\\\"four\\\"}\"))\n .index(\"my-index-000001\")\n )\n .script(sc -> sc\n .source(so -> so\n .scriptString(\"doc['field'].value.length() <= params.max_length\")\n )\n .params(\"max_length\", JsonData.fromJson(\"4\"))\n )\n);\n" + } + ], + "specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample3.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\",\"document\":{\"rank\":4}}}' \"$ELASTICSEARCH_URL/_scripts/painless/_execute\"" + }, + { + "language": "Java", + "code": "client.scriptsPainlessExecute(s -> s\n .context(PainlessContext.Score)\n .contextSetup(c -> c\n .document(JsonData.fromJson(\"{\\\"rank\\\":4}\"))\n .index(\"my-index-000001\")\n )\n .script(sc -> sc\n .source(so -> so\n .scriptString(\"doc['rank'].value / params.max_rank\")\n )\n .params(\"max_rank\", JsonData.fromJson(\"5\"))\n )\n);\n" + } + ], + "specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.scriptsPainlessExecute(s -> s\n .script(sc -> sc\n .source(so -> so\n .scriptString(\"params.count / params.total\")\n )\n .params(Map.of(\"total\", JsonData.fromJson(\"1000\"),\"count\", JsonData.fromJson(\"100\")))\n )\n);\n" + } + ], + "specification/_global/get_script_context/examples/request/GetScriptContextRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.getScriptContext();\n" + } + ], + "specification/_global/msearch_template/examples/request/MultiSearchTemplateRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + } + ], + "specification/_global/terms_enum/examples/request/TermsEnumRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.terms_enum(\n index=\"stackoverflow\",\n field=\"tags\",\n string=\"kiba\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.termsEnum({\n index: \"stackoverflow\",\n field: \"tags\",\n string: \"kiba\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.terms_enum(\n index: \"stackoverflow\",\n body: {\n \"field\": \"tags\",\n \"string\": \"kiba\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->termsEnum([\n \"index\" => \"stackoverflow\",\n \"body\" => [\n \"field\" => \"tags\",\n \"string\" => \"kiba\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.termsEnum(t -> t\n .field(\"tags\")\n .index(\"stackoverflow\")\n .string(\"kiba\")\n);\n" + } + ], + "specification/_global/bulk/examples/request/BulkRequestExample4.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\":\"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\"" + } + ], + "specification/_global/bulk/examples/request/BulkRequestExample3.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + } + ], + "specification/_global/bulk/examples/request/BulkRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\",\"_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\"" + } + ], + "specification/_global/bulk/examples/request/BulkRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"}},{\"doc\":{\"field2\":\"value2\"}}]' \"$ELASTICSEARCH_URL/_bulk\"" + } + ], + "specification/_global/explain/examples/request/ExplainRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.explain(\n index=\"my-index-000001\",\n id=\"0\",\n query={\n \"match\": {\n \"message\": \"elasticsearch\"\n }\n },\n)" + }, + { + "language": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.explain(e -> e\n .id(\"0\")\n .index(\"my-index-000001\")\n .query(q -> q\n .match(m -> m\n .field(\"message\")\n .query(FieldValue.of(\"elasticsearch\"))\n )\n )\n);\n" + } + ], + "specification/_global/get_script/examples/request/GetScriptRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.get_script(\n id=\"my-search-template\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.getScript({\n id: \"my-search-template\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.get_script(\n id: \"my-search-template\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->getScript([\n \"id\" => \"my-search-template\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_scripts/my-search-template\"" + }, + { + "language": "Java", + "code": "client.getScript(g -> g\n .id(\"my-search-template\")\n);\n" + } + ], + "specification/_global/search_template/examples/request/SearchTemplateRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.searchTemplate(s -> s\n .id(\"my-search-template\")\n .index(\"my-index\")\n .params(Map.of(\"size\", JsonData.fromJson(\"10\"),\"from\", JsonData.fromJson(\"0\"),\"query_string\", JsonData.fromJson(\"\\\"hello world\\\"\")))\n);\n" + } + ], + "specification/_global/scroll/examples/request/ScrollRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.scroll(\n scroll_id=\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.scroll({\n scroll_id: \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.scroll(\n body: {\n \"scroll_id\": \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->scroll([\n \"body\" => [\n \"scroll_id\" => \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.scroll(s -> s\n .scrollId(\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\")\n);\n" + } + ], + "specification/_global/update/examples/request/UpdateRequestExample7.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.update(u -> u\n .id(\"1\")\n .index(\"test\")\n .script(s -> s\n .source(so -> so\n .scriptString(\"if (ctx._source.tags.contains(params.tag)) { ctx.op = 'delete' } else { ctx.op = 'noop' }\")\n )\n .params(\"tag\", JsonData.fromJson(\"\\\"green\\\"\"))\n .lang(\"painless\")\n )\n,Void.class);\n" + } + ], + "specification/_global/update/examples/request/UpdateRequestExample6.yaml": [ + { + "language": "Python", + "code": "resp = client.update(\n index=\"test\",\n id=\"1\",\n script=\"ctx._source['my-object'].remove('my-subfield')\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.update({\n index: \"test\",\n id: 1,\n script: \"ctx._source['my-object'].remove('my-subfield')\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.update(\n index: \"test\",\n id: \"1\",\n body: {\n \"script\": \"ctx._source['my-object'].remove('my-subfield')\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->update([\n \"index\" => \"test\",\n \"id\" => \"1\",\n \"body\" => [\n \"script\" => \"ctx._source['my-object'].remove('my-subfield')\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.update(u -> u\n .id(\"1\")\n .index(\"test\")\n .script(s -> s\n .source(so -> so\n .scriptString(\"ctx._source['my-object'].remove('my-subfield')\")\n )\n )\n,Void.class);\n" + } + ], + "specification/_global/update/examples/request/UpdateRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.update(u -> u\n .id(\"1\")\n .index(\"test\")\n .script(s -> s\n .source(so -> so\n .scriptString(\"ctx._source.counter += params.count\")\n )\n .params(\"count\", JsonData.fromJson(\"4\"))\n .lang(\"painless\")\n )\n,Void.class);\n" + } + ], + "specification/_global/update/examples/request/UpdateRequestExample3.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.update(u -> u\n .id(\"1\")\n .index(\"test\")\n .script(s -> s\n .source(so -> so\n .scriptString(\"if (ctx._source.tags.contains(params.tag)) { ctx._source.tags.remove(ctx._source.tags.indexOf(params.tag)) }\")\n )\n .params(\"tag\", JsonData.fromJson(\"\\\"blue\\\"\"))\n .lang(\"painless\")\n )\n,Void.class);\n" + } + ], + "specification/_global/update/examples/request/UpdateRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.update(u -> u\n .id(\"1\")\n .index(\"test\")\n .script(s -> s\n .source(so -> so\n .scriptString(\"ctx._source.tags.add(params.tag)\")\n )\n .params(\"tag\", JsonData.fromJson(\"\\\"blue\\\"\"))\n .lang(\"painless\")\n )\n,Void.class);\n" + } + ], + "specification/_global/update/examples/request/UpdateRequestExample5.yaml": [ + { + "language": "Python", + "code": "resp = client.update(\n index=\"test\",\n id=\"1\",\n script=\"ctx._source.remove('new_field')\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.update({\n index: \"test\",\n id: 1,\n script: \"ctx._source.remove('new_field')\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.update(\n index: \"test\",\n id: \"1\",\n body: {\n \"script\": \"ctx._source.remove('new_field')\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->update([\n \"index\" => \"test\",\n \"id\" => \"1\",\n \"body\" => [\n \"script\" => \"ctx._source.remove('new_field')\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.update(u -> u\n .id(\"1\")\n .index(\"test\")\n .script(s -> s\n .source(so -> so\n .scriptString(\"ctx._source.remove('new_field')\")\n )\n )\n,Void.class);\n" + } + ], + "specification/_global/update/examples/request/UpdateRequestExample10.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.update(u -> u\n .id(\"1\")\n .index(\"test\")\n .script(s -> s\n .source(so -> so\n .scriptString(\"\n if ( ctx.op == 'create' ) {\n ctx._source.counter = params.count\n } else {\n ctx._source.counter += params.count\n }\n \")\n )\n .params(\"count\", JsonData.fromJson(\"4\"))\n )\n .scriptedUpsert(true)\n .upsert(JsonData.fromJson(\"{}\"))\n,Void.class);\n" + } + ], + "specification/_global/update/examples/request/UpdateRequestExample9.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.update(u -> u\n .id(\"1\")\n .index(\"test\")\n .script(s -> s\n .source(so -> so\n .scriptString(\"ctx._source.counter += params.count\")\n )\n .params(\"count\", JsonData.fromJson(\"4\"))\n .lang(\"painless\")\n )\n .upsert(JsonData.fromJson(\"{\\\"counter\\\":1}\"))\n,Void.class);\n" + } + ], + "specification/_global/update/examples/request/UpdateRequestExample8.yaml": [ + { + "language": "Python", + "code": "resp = client.update(\n index=\"test\",\n id=\"1\",\n doc={\n \"name\": \"new_name\"\n },\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.update({\n index: \"test\",\n id: 1,\n doc: {\n name: \"new_name\",\n },\n});" + }, + { + "language": "Ruby", + "code": "response = client.update(\n index: \"test\",\n id: \"1\",\n body: {\n \"doc\": {\n \"name\": \"new_name\"\n }\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->update([\n \"index\" => \"test\",\n \"id\" => \"1\",\n \"body\" => [\n \"doc\" => [\n \"name\" => \"new_name\",\n ],\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.update(u -> u\n .doc(JsonData.fromJson(\"{\\\"name\\\":\\\"new_name\\\"}\"))\n .id(\"1\")\n .index(\"test\")\n,Void.class);\n" + } + ], + "specification/_global/update/examples/request/UpdateRequestExample11.yaml": [ + { + "language": "Python", + "code": "resp = client.update(\n index=\"test\",\n id=\"1\",\n doc={\n \"name\": \"new_name\"\n },\n doc_as_upsert=True,\n)" + }, + { + "language": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.update(u -> u\n .doc(JsonData.fromJson(\"{\\\"name\\\":\\\"new_name\\\"}\"))\n .docAsUpsert(true)\n .id(\"1\")\n .index(\"test\")\n,Void.class);\n" + } + ], + "specification/_global/update/examples/request/UpdateRequestExample4.yaml": [ + { + "language": "Python", + "code": "resp = client.update(\n index=\"test\",\n id=\"1\",\n script=\"ctx._source.new_field = 'value_of_new_field'\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.update({\n index: \"test\",\n id: 1,\n script: \"ctx._source.new_field = 'value_of_new_field'\",\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.update(u -> u\n .id(\"1\")\n .index(\"test\")\n .script(s -> s\n .source(so -> so\n .scriptString(\"ctx._source.new_field = 'value_of_new_field'\")\n )\n )\n,Void.class);\n" + } + ], + "specification/_global/delete/examples/request/DeleteRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.delete(\n index=\"my-index-000001\",\n id=\"1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.delete({\n index: \"my-index-000001\",\n id: 1,\n});" + }, + { + "language": "Ruby", + "code": "response = client.delete(\n index: \"my-index-000001\",\n id: \"1\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->delete([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_doc/1\"" + }, + { + "language": "Java", + "code": "client.delete(d -> d\n .id(\"1\")\n .index(\"my-index-000001\")\n);\n" + } + ], + "specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample4.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.updateByQuery(u -> u\n .index(\"my-index-000001\")\n .refresh(true)\n .script(s -> s\n .source(so -> so\n .scriptString(\"ctx._source['extra'] = 'test'\")\n )\n )\n .slices(sl -> sl\n .value(5)\n )\n);\n" + } + ], + "specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.updateByQuery(u -> u\n .index(\"my-index-000001\")\n .query(q -> q\n .term(t -> t\n .field(\"user.id\")\n .value(FieldValue.of(\"kimchy\"))\n )\n )\n .script(s -> s\n .source(so -> so\n .scriptString(\"ctx._source.count++\")\n )\n .lang(\"painless\")\n )\n);\n" + } + ], + "specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample3.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.updateByQuery(u -> u\n .index(\"my-index-000001\")\n .script(s -> s\n .source(so -> so\n .scriptString(\"ctx._source['extra'] = 'test'\")\n )\n )\n .slice(sl -> sl\n .id(\"0\")\n .max(2)\n )\n);\n" + } + ], + "specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.updateByQuery(u -> u\n .conflicts(Conflicts.Proceed)\n .index(\"my-index-000001\")\n .query(q -> q\n .term(t -> t\n .field(\"user.id\")\n .value(FieldValue.of(\"kimchy\"))\n )\n )\n);\n" + } + ], + "specification/_global/exists/examples/request/DocumentExistsRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.exists(\n index=\"my-index-000001\",\n id=\"0\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.exists({\n index: \"my-index-000001\",\n id: 0,\n});" + }, + { + "language": "Ruby", + "code": "response = client.exists(\n index: \"my-index-000001\",\n id: \"0\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->exists([\n \"index\" => \"my-index-000001\",\n \"id\" => \"0\",\n]);" + }, + { + "language": "curl", + "code": "curl --head -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_doc/0\"" + }, + { + "language": "Java", + "code": "client.exists(e -> e\n .id(\"0\")\n .index(\"my-index-000001\")\n);\n" + } + ], + "specification/_global/put_script/examples/request/PutScriptRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + } + ], + "specification/_global/put_script/examples/request/PutScriptRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.putScript(p -> p\n .id(\"my-stored-script\")\n .script(s -> s\n .lang(\"painless\")\n .source(so -> so\n .scriptString(\"Math.log(_score * 2) + params['my_modifier']\")\n )\n )\n);\n" + } + ], + "specification/_global/reindex_rethrottle/examples/request/ReindexRethrottleRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.reindex_rethrottle(\n task_id=\"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second=\"-1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.reindexRethrottle({\n task_id: \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second: \"-1\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.reindex_rethrottle(\n task_id: \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second: \"-1\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->reindexRethrottle([\n \"task_id\" => \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n \"requests_per_second\" => \"-1\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1\"" + }, + { + "language": "Java", + "code": "client.reindexRethrottle(r -> r\n .requestsPerSecond(-1.0F)\n .taskId(\"r1A2WoRbTwKZ516z6NEs5A:36619\")\n);\n" + } + ], + "specification/_global/count/examples/request/CountRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.count(\n index=\"my-index-000001\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.count({\n index: \"my-index-000001\",\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});" + }, + { + "language": "Ruby", + "code": "response = client.count(\n index: \"my-index-000001\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->count([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.count(c -> c\n .index(\"my-index-000001\")\n .query(q -> q\n .term(t -> t\n .field(\"user.id\")\n .value(FieldValue.of(\"kimchy\"))\n )\n )\n);\n" + } + ], + "specification/_global/termvectors/examples/request/TermVectorsRequestExample3.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.termvectors(t -> t\n .doc(JsonData.fromJson(\"{\\\"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 .fieldStatistics(true)\n .filter(f -> f\n .maxNumTerms(3)\n .minDocFreq(1)\n .minTermFreq(1)\n )\n .index(\"imdb\")\n .offsets(false)\n .positions(false)\n .termStatistics(true)\n);\n" + } + ], + "specification/_global/termvectors/examples/request/TermVectorsRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.termvectors(t -> t\n .doc(JsonData.fromJson(\"{\\\"fullname\\\":\\\"John Doe\\\",\\\"text\\\":\\\"test test test\\\"}\"))\n .fields(\"fullname\")\n .index(\"my-index-000001\")\n .perFieldAnalyzer(\"fullname\", \"keyword\")\n);\n" + } + ], + "specification/_global/termvectors/examples/request/TermVectorsRequestExample5.yaml": [ + { + "language": "Python", + "code": "resp = client.termvectors(\n index=\"my-index-000001\",\n doc={\n \"fullname\": \"John Doe\",\n \"text\": \"test test test\"\n },\n)" + }, + { + "language": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.termvectors(t -> t\n .doc(JsonData.fromJson(\"{\\\"fullname\\\":\\\"John Doe\\\",\\\"text\\\":\\\"test test test\\\"}\"))\n .index(\"my-index-000001\")\n);\n" + } + ], + "specification/_global/termvectors/examples/request/TermVectorsRequestExample4.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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,\"field_statistics\":true}' \"$ELASTICSEARCH_URL/my-index-000001/_termvectors/1\"" + }, + { + "language": "Java", + "code": "client.termvectors(t -> t\n .fieldStatistics(true)\n .fields(List.of(\"text\",\"some_field_without_term_vectors\"))\n .id(\"1\")\n .index(\"my-index-000001\")\n .offsets(true)\n .positions(true)\n .termStatistics(true)\n);\n" + } + ], + "specification/_global/termvectors/examples/request/TermVectorsRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\":true}' \"$ELASTICSEARCH_URL/my-index-000001/_termvectors/1\"" + }, + { + "language": "Java", + "code": "client.termvectors(t -> t\n .fieldStatistics(true)\n .fields(\"text\")\n .id(\"1\")\n .index(\"my-index-000001\")\n .offsets(true)\n .payloads(true)\n .positions(true)\n .termStatistics(true)\n);\n" + } + ], + "specification/_global/search_mvt/examples/request/SearchMvtRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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}},\"aggs\":{\"min_price\":{\"min\":{\"field\":\"price\"}},\"max_price\":{\"max\":{\"field\":\"price\"}},\"avg_price\":{\"avg\":{\"field\":\"price\"}}}}' \"$ELASTICSEARCH_URL/museums/_mvt/location/13/4207/2692\"" + } + ], + "specification/_global/delete_by_query_rethrottle/examples/request/DeleteByQueryRethrottleRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.delete_by_query_rethrottle(\n task_id=\"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second=\"-1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.deleteByQueryRethrottle({\n task_id: \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second: \"-1\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.delete_by_query_rethrottle(\n task_id: \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second: \"-1\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->deleteByQueryRethrottle([\n \"task_id\" => \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n \"requests_per_second\" => \"-1\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_delete_by_query/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1\"" + }, + { + "language": "Java", + "code": "client.deleteByQueryRethrottle(d -> d\n .requestsPerSecond(-1.0F)\n .taskId(\"r1A2WoRbTwKZ516z6NEs5A:36619\")\n);\n" + } + ], + "specification/_global/get/examples/request/GetRequestExample2.yaml": [ + { + "language": "Python", + "code": "resp = client.get(\n index=\"my-index-000001\",\n id=\"1\",\n stored_fields=\"tags,counter\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.get({\n index: \"my-index-000001\",\n id: 1,\n stored_fields: \"tags,counter\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.get(\n index: \"my-index-000001\",\n id: \"1\",\n stored_fields: \"tags,counter\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->get([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"stored_fields\" => \"tags,counter\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_doc/1?stored_fields=tags,counter\"" + } + ], + "specification/_global/render_search_template/examples/request/RenderSearchTemplateRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.renderSearchTemplate(r -> r\n .id(\"my-search-template\")\n .params(Map.of(\"size\", JsonData.fromJson(\"10\"),\"from\", JsonData.fromJson(\"20\"),\"query_string\", JsonData.fromJson(\"\\\"hello world\\\"\")))\n);\n" + } + ], + "specification/_global/open_point_in_time/examples/request/OpenPointInTimeRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.open_point_in_time(\n index=\"my-index-000001\",\n keep_alive=\"1m\",\n allow_partial_search_results=True,\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.openPointInTime({\n index: \"my-index-000001\",\n keep_alive: \"1m\",\n allow_partial_search_results: \"true\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.open_point_in_time(\n index: \"my-index-000001\",\n keep_alive: \"1m\",\n allow_partial_search_results: \"true\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->openPointInTime([\n \"index\" => \"my-index-000001\",\n \"keep_alive\" => \"1m\",\n \"allow_partial_search_results\" => \"true\",\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.openPointInTime(o -> o\n .allowPartialSearchResults(true)\n .index(\"my-index-000001\")\n .keepAlive(k -> k\n .offset(1)\n )\n);\n" + } + ], + "specification/_global/search_shards/examples/request/SearchShardsRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.search_shards(\n index=\"my-index-000001\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.searchShards({\n index: \"my-index-000001\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.search_shards(\n index: \"my-index-000001\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->searchShards([\n \"index\" => \"my-index-000001\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_search_shards\"" + }, + { + "language": "Java", + "code": "client.searchShards(s -> s\n .index(\"my-index-000001\")\n);\n" + } + ], + "specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.delete_by_query(\n index=\"my-index-000001,my-index-000002\",\n query={\n \"match_all\": {}\n },\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.deleteByQuery({\n index: \"my-index-000001,my-index-000002\",\n query: {\n match_all: {},\n },\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.deleteByQuery(d -> d\n .index(List.of(\"my-index-000001\",\"my-index-000002\"))\n .query(q -> q\n .matchAll(m -> m)\n )\n);\n" + } + ], + "specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.deleteByQuery(d -> d\n .index(\"my-index-000001\")\n .maxDocs(1L)\n .query(q -> q\n .term(t -> t\n .field(\"user.id\")\n .value(FieldValue.of(\"kimchy\"))\n )\n )\n);\n" + } + ], + "specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample3.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.deleteByQuery(d -> d\n .index(\"my-index-000001\")\n .query(q -> q\n .range(r -> r\n .untyped(u -> u\n .field(\"http.response.bytes\")\n .lt(JsonData.fromJson(\"2000000\"))\n )\n )\n )\n .slice(s -> s\n .id(\"0\")\n .max(2)\n )\n);\n" + } + ], + "specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample4.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.deleteByQuery(d -> d\n .index(\"my-index-000001\")\n .query(q -> q\n .range(r -> r\n .untyped(u -> u\n .field(\"http.response.bytes\")\n .lt(JsonData.fromJson(\"2000000\"))\n )\n )\n )\n .refresh(true)\n .slices(s -> s\n .value(5)\n )\n);\n" + } + ], + "specification/_global/health_report/examples/request/HealthReportRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.healthReport(h -> h);\n" + } + ], + "specification/_global/field_caps/examples/request/FieldCapabilitiesRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + } + ], + "specification/_global/search/examples/request/SearchRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.search(s -> s\n .from(40)\n .index(\"my-index-000001\")\n .query(q -> q\n .term(t -> t\n .field(\"user.id\")\n .value(FieldValue.of(\"kimchy\"))\n )\n )\n .size(20)\n,Void.class);\n" + } + ], + "specification/_global/search/examples/request/SearchRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\":\"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\",\"keep_alive\":\"1m\"}}' \"$ELASTICSEARCH_URL/_search\"" + }, + { + "language": "Java", + "code": "client.search(s -> s\n .pit(p -> p\n .id(\"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\")\n .keepAlive(k -> k\n .time(\"1m\")\n )\n )\n .query(q -> q\n .match(m -> m\n .field(\"title\")\n .query(FieldValue.of(\"elasticsearch\"))\n )\n )\n .size(100)\n,Void.class);\n" + } + ], + "specification/_global/search/examples/request/SearchRequestExample3.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\":\"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\"}}' \"$ELASTICSEARCH_URL/_search\"" + }, + { + "language": "Java", + "code": "client.search(s -> s\n .pit(p -> p\n .id(\"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\")\n )\n .query(q -> q\n .match(m -> m\n .field(\"message\")\n .query(FieldValue.of(\"foo\"))\n )\n )\n .slice(sl -> sl\n .id(\"0\")\n .max(2)\n )\n,Void.class);\n" + } + ], + "specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.mtermvectors(m -> m\n .docs(List.of(MultiTermVectorsOperation.of(mu -> mu\n .id(\"2\")\n .fields(\"message\")\n .termStatistics(true)),MultiTermVectorsOperation.of(mu -> mu\n .id(\"1\"))))\n .index(\"my-index-000001\")\n);\n" + } + ], + "specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "code": "const response = await client.mtermvectors({\n index: \"my-index-000001\",\n ids: [\"1\", \"2\"],\n fields: [\"message\"],\n term_statistics: true,\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.mtermvectors(m -> m\n .ids(List.of(\"1\",\"2\"))\n .index(\"my-index-000001\")\n);\n" + } + ], + "specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample3.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.mtermvectors(m -> m\n .docs(List.of(MultiTermVectorsOperation.of(mu -> mu\n .index(\"my-index-000001\")\n .doc(JsonData.fromJson(\"{\\\"message\\\":\\\"test test test\\\"}\"))),MultiTermVectorsOperation.of(mu -> mu\n .index(\"my-index-000001\")\n .doc(JsonData.fromJson(\"{\\\"message\\\":\\\"Another test ...\\\"}\")))))\n);\n" + } + ], + "specification/_global/info/examples/request/RootNodeInfoRequestExample1.yaml": [ + { + "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/\"" + }, + { + "language": "Java", + "code": "client.info();\n" + } + ], + "specification/_global/clear_scroll/examples/request/ClearScrollRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.clear_scroll(\n scroll_id=\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.clearScroll({\n scroll_id: \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.clear_scroll(\n body: {\n \"scroll_id\": \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->clearScroll([\n \"body\" => [\n \"scroll_id\" => \"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.clearScroll(c -> c\n .scrollId(\"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==\")\n);\n" + } + ], + "specification/_global/reindex/examples/request/ReindexRequestExample9.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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._source.tag = ctx._source.remove(\\\"flag\\\")\"}}' \"$ELASTICSEARCH_URL/_reindex\"" + } + ], + "specification/_global/reindex/examples/request/ReindexRequestExample5.yaml": [ + { + "language": "Python", + "code": "resp = client.reindex(\n source={\n \"index\": \"source\"\n },\n dest={\n \"index\": \"dest\",\n \"pipeline\": \"some_ingest_pipeline\"\n },\n)" + }, + { + "language": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + } + ], + "specification/_global/reindex/examples/request/ReindexRequestExample11.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + } + ], + "specification/_global/reindex/examples/request/ReindexRequestExample10.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + } + ], + "specification/_global/reindex/examples/request/ReindexRequestExample4.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\":\"=cat\"}}' \"$ELASTICSEARCH_URL/_reindex\"" + } + ], + "specification/_global/reindex/examples/request/ReindexRequestExample8.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + } + ], + "specification/_global/reindex/examples/request/ReindexRequestExample3.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + } + ], + "specification/_global/reindex/examples/request/ReindexRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + } + ], + "specification/_global/reindex/examples/request/ReindexRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.reindex(r -> r\n .dest(d -> d\n .index(\"my-new-index-000002\")\n )\n .source(s -> s\n .index(List.of(\"my-index-000001\",\"my-index-000002\"))\n )\n);\n" + } + ], + "specification/_global/reindex/examples/request/ReindexRequestExample13.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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-index-000001\",\"query\":{\"match\":{\"test\":\"data\"}}},\"dest\":{\"index\":\"my-new-index-000001\"}}' \"$ELASTICSEARCH_URL/_reindex\"" + } + ], + "specification/_global/reindex/examples/request/ReindexRequestExample7.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + } + ], + "specification/_global/reindex/examples/request/ReindexRequestExample6.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + } + ], + "specification/_global/reindex/examples/request/ReindexRequestExample12.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"},\"script\":{\"source\":\"if (ctx._source.foo == '\"'\"'bar'\"'\"') {ctx._version++; ctx._source.remove('\"'\"'foo'\"'\"')}\",\"lang\":\"painless\"}}' \"$ELASTICSEARCH_URL/_reindex\"" + } + ], + "specification/_global/index/examples/request/IndexRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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/\"" + }, + { + "language": "Java", + "code": "client.index(i -> i\n .index(\"my-index-000001\")\n .document(JsonData.fromJson(\"{\\\"@timestamp\\\":\\\"2099-11-15T13:12:00\\\",\\\"message\\\":\\\"GET /search HTTP/1.1 200 1070000\\\",\\\"user\\\":{\\\"id\\\":\\\"kimchy\\\"}}\"))\n);\n" + } + ], + "specification/_global/index/examples/request/IndexRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.index(i -> i\n .id(\"1\")\n .index(\"my-index-000001\")\n .document(JsonData.fromJson(\"{\\\"@timestamp\\\":\\\"2099-11-15T13:12:00\\\",\\\"message\\\":\\\"GET /search HTTP/1.1 200 1070000\\\",\\\"user\\\":{\\\"id\\\":\\\"kimchy\\\"}}\"))\n);\n" + } + ], + "specification/_global/msearch/examples/request/MsearchRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + } + ], + "specification/_global/delete_script/examples/request/DeleteScriptRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.delete_script(\n id=\"my-search-template\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.deleteScript({\n id: \"my-search-template\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.delete_script(\n id: \"my-search-template\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->deleteScript([\n \"id\" => \"my-search-template\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_scripts/my-search-template\"" + }, + { + "language": "Java", + "code": "client.deleteScript(d -> d\n .id(\"my-search-template\")\n);\n" + } + ], + "specification/_global/mget/examples/request/MultiGetRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + } + ], + "specification/_global/mget/examples/request/MultiGetRequestExample3.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.mget(m -> m\n .docs(List.of(MultiGetOperation.of(mu -> mu\n .id(\"1\")\n .index(\"test\")\n .storedFields(List.of(\"field1\",\"field2\"))),MultiGetOperation.of(mu -> mu\n .id(\"2\")\n .index(\"test\")\n .storedFields(List.of(\"field3\",\"field4\")))))\n);\n" + } + ], + "specification/_global/mget/examples/request/MultiGetRequestExample4.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.mget(m -> m\n .docs(List.of(MultiGetOperation.of(mu -> mu\n .id(\"1\")\n .index(\"test\")\n .routing(\"key2\")),MultiGetOperation.of(mu -> mu\n .id(\"2\")\n .index(\"test\"))))\n .routing(\"key1\")\n);\n" + } + ], + "specification/_global/mget/examples/request/MultiGetRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.mget(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ],\n)" + }, + { + "language": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.mget(m -> m\n .docs(List.of(MultiGetOperation.of(mu -> mu\n .id(\"1\")),MultiGetOperation.of(mu -> mu\n .id(\"2\"))))\n .index(\"my-index-000001\")\n);\n" + } + ], + "specification/_global/create/examples/request/CreateRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.create(c -> c\n .id(\"1\")\n .index(\"my-index-000001\")\n .document(JsonData.fromJson(\"{\\\"@timestamp\\\":\\\"2099-11-15T13:12:00\\\",\\\"message\\\":\\\"GET /search HTTP/1.1 200 1070000\\\",\\\"user\\\":{\\\"id\\\":\\\"kimchy\\\"}}\"))\n);\n" + } + ], + "specification/_global/rank_eval/examples/request/RankEvalRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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_threshold\":1,\"ignore_unlabeled\":false}}}' \"$ELASTICSEARCH_URL/my-index-000001/_rank_eval\"" + }, + { + "language": "Java", + "code": "client.rankEval(r -> r\n .index(\"my-index-000001\")\n .metric(m -> m\n .precision(p -> p\n .ignoreUnlabeled(false)\n .relevantRatingThreshold(1)\n .k(20)\n )\n )\n .requests(re -> re\n .id(\"JFK query\")\n .request(req -> req\n .query(q -> q\n .matchAll(m -> m)\n )\n )\n )\n);\n" + } + ], + "specification/_global/exists_source/examples/request/ExistsSourceRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.exists_source(\n index=\"my-index-000001\",\n id=\"1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.existsSource({\n index: \"my-index-000001\",\n id: 1,\n});" + }, + { + "language": "Ruby", + "code": "response = client.exists_source(\n index: \"my-index-000001\",\n id: \"1\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->existsSource([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n]);" + }, + { + "language": "curl", + "code": "curl --head -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_source/1\"" + }, + { + "language": "Java", + "code": "client.existsSource(e -> e\n .id(\"1\")\n .index(\"my-index-000001\")\n);\n" + } + ], + "specification/_global/close_point_in_time/examples/request/ClosePointInTimeRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.close_point_in_time(\n id=\"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.closePointInTime({\n id: \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.close_point_in_time(\n body: {\n \"id\": \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->closePointInTime([\n \"body\" => [\n \"id\" => \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\",\n ],\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\"}' \"$ELASTICSEARCH_URL/_pit\"" + }, + { + "language": "Java", + "code": "client.closePointInTime(c -> c\n .id(\"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\")\n);\n" + } + ], + "specification/shutdown/put_node/examples/request/ShutdownPutNodeRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.shutdown().putNode(p -> p\n .allocationDelay(\"20m\")\n .nodeId(\"USpTGYaBSIKbgSUJR2Z9lg\")\n .reason(\"Demonstrating how the node shutdown API works\")\n .type(Type.Restart)\n);\n" + } + ], + "specification/shutdown/delete_node/examples/request/ShutdownDeleteNodeRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.shutdown.delete_node(\n node_id=\"USpTGYaBSIKbgSUJR2Z9lg\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.shutdown.deleteNode({\n node_id: \"USpTGYaBSIKbgSUJR2Z9lg\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.shutdown.delete_node(\n node_id: \"USpTGYaBSIKbgSUJR2Z9lg\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->shutdown()->deleteNode([\n \"node_id\" => \"USpTGYaBSIKbgSUJR2Z9lg\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown\"" + }, + { + "language": "Java", + "code": "client.shutdown().deleteNode(d -> d\n .nodeId(\"USpTGYaBSIKbgSUJR2Z9lg\")\n);\n" + } + ], + "specification/shutdown/get_node/examples/request/ShutdownGetNodeRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.shutdown.get_node(\n node_id=\"USpTGYaBSIKbgSUJR2Z9lg\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.shutdown.getNode({\n node_id: \"USpTGYaBSIKbgSUJR2Z9lg\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.shutdown.get_node(\n node_id: \"USpTGYaBSIKbgSUJR2Z9lg\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->shutdown()->getNode([\n \"node_id\" => \"USpTGYaBSIKbgSUJR2Z9lg\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown\"" + }, + { + "language": "Java", + "code": "client.shutdown().getNode(g -> g\n .nodeId(\"USpTGYaBSIKbgSUJR2Z9lg\")\n);\n" + } + ], + "specification/watcher/update_settings/examples/request/WatcherUpdateSettingsRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.watcher.update_settings(\n index.auto_expand_replicas=\"0-4\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.watcher.updateSettings({\n \"index.auto_expand_replicas\": \"0-4\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.watcher.update_settings(\n body: {\n \"index.auto_expand_replicas\": \"0-4\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->watcher()->updateSettings([\n \"body\" => [\n \"index.auto_expand_replicas\" => \"0-4\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.watcher().updateSettings(u -> u\n .indexAutoExpandReplicas(\"0-4\")\n);\n" + } + ], + "specification/watcher/activate_watch/examples/request/WatcherActivateWatchExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.watcher.activate_watch(\n watch_id=\"my_watch\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.watcher.activateWatch({\n watch_id: \"my_watch\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.watcher.activate_watch(\n watch_id: \"my_watch\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->watcher()->activateWatch([\n \"watch_id\" => \"my_watch\",\n]);" + }, + { + "language": "curl", + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/watch/my_watch/_activate\"" + }, + { + "language": "Java", + "code": "client.watcher().activateWatch(a -> a\n .watchId(\"my_watch\")\n);\n" + } + ], + "specification/watcher/get_settings/examples/request/WatcherGetSettingsExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.watcher().getSettings(g -> g);\n" + } + ], + "specification/watcher/deactivate_watch/examples/request/WatcherDeactivateWatchExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.watcher.deactivate_watch(\n watch_id=\"my_watch\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.watcher.deactivateWatch({\n watch_id: \"my_watch\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.watcher.deactivate_watch(\n watch_id: \"my_watch\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->watcher()->deactivateWatch([\n \"watch_id\" => \"my_watch\",\n]);" + }, + { + "language": "curl", + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/watch/my_watch/_deactivate\"" + }, + { + "language": "Java", + "code": "client.watcher().deactivateWatch(d -> d\n .watchId(\"my_watch\")\n);\n" + } + ], + "specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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_condition\":true,\"action_modes\":{\"my-action\":\"force_simulate\"},\"record_execution\":true}' \"$ELASTICSEARCH_URL/_watcher/watch/my_watch/_execute\"" + }, + { + "language": "Java", + "code": "client.watcher().executeWatch(e -> e\n .actionModes(\"my-action\", ActionExecutionMode.ForceSimulate)\n .alternativeInput(\"foo\", JsonData.fromJson(\"\\\"bar\\\"\"))\n .id(\"my_watch\")\n .ignoreCondition(true)\n .recordExecution(true)\n .triggerData(t -> t\n .scheduledTime(DateTime.of(\"now\"))\n .triggeredTime(DateTime.of(\"now\"))\n )\n);\n" + } + ], + "specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample2.yaml": [ + { + "language": "Python", + "code": "resp = client.watcher.execute_watch(\n id=\"my_watch\",\n action_modes={\n \"action1\": \"force_simulate\",\n \"action2\": \"skip\"\n },\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.watcher.executeWatch({\n id: \"my_watch\",\n action_modes: {\n action1: \"force_simulate\",\n action2: \"skip\",\n },\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.watcher().executeWatch(e -> e\n .actionModes(Map.of(\"action1\", ActionExecutionMode.ForceSimulate,\"action2\", ActionExecutionMode.Skip))\n .id(\"my_watch\")\n);\n" + } + ], + "specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample3.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"],\"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": "Java", + "code": "client.watcher().executeWatch(e -> e\n .watch(w -> w\n .actions(\"log_error\", a -> a\n .logging(l -> l\n .text(\"Found {{ctx.payload.hits.total}} errors in the logs\")\n )\n )\n .condition(c -> c\n .compare(NamedValue.of(\"ctx.payload.hits.total\",Pair.of(ConditionOp.Gt,FieldValue.of(0))))\n )\n .input(i -> i\n .search(s -> s\n .request(r -> r\n .body(b -> b\n .query(q -> q\n .match(m -> m\n .field(\"message\")\n .query(FieldValue.of(\"error\"))\n )\n )\n )\n .indices(\"logs\")\n )\n )\n )\n .trigger(t -> t\n .schedule(sc -> sc\n .interval(in -> in\n .time(\"10s\")\n )\n )\n )\n )\n);\n" + } + ], + "specification/watcher/start/examples/request/WatcherStartRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.watcher().start(s -> s);\n" + } + ], + "specification/watcher/query_watches/examples/request/WatcherQueryWatchesRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.watcher().queryWatches();\n" + } + ], + "specification/watcher/stop/examples/request/WatcherStopRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.watcher().stop(s -> s);\n" + } + ], + "specification/watcher/put_watch/examples/request/WatcherPutWatchRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\":{\"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": "Java", + "code": "client.watcher().putWatch(p -> p\n .actions(\"email_admin\", a -> a\n .email(e -> e\n .subject(\"404 recently encountered\")\n .to(\"admin@domain.host.com\")\n )\n )\n .condition(c -> c\n .compare(NamedValue.of(\"ctx.payload.hits.total\",Pair.of(ConditionOp.Gt,FieldValue.of(0))))\n )\n .id(\"my-watch\")\n .input(i -> i\n .search(s -> s\n .request(r -> r\n .body(b -> b\n .query(q -> q\n .bool(bo -> bo\n .filter(f -> f\n .range(ra -> ra\n .untyped(u -> u\n .field(\"@timestamp\")\n )\n )\n )\n .must(m -> m\n .match(ma -> ma\n .field(\"response\")\n .query(FieldValue.of(404))\n )\n )\n )\n )\n )\n .indices(\"logstash*\")\n )\n )\n )\n .trigger(t -> t\n .schedule(sc -> sc\n .cron(\"0 0/1 * * * ?\")\n )\n )\n);\n" + } + ], + "specification/watcher/get_watch/examples/request/GetWatchRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.watcher.get_watch(\n id=\"my_watch\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.watcher.getWatch({\n id: \"my_watch\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.watcher.get_watch(\n id: \"my_watch\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->watcher()->getWatch([\n \"id\" => \"my_watch\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/watch/my_watch\"" + }, + { + "language": "Java", + "code": "client.watcher().getWatch(g -> g\n .id(\"my_watch\")\n);\n" + } + ], + "specification/watcher/ack_watch/examples/request/WatcherAckWatchRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.watcher.ack_watch(\n watch_id=\"my_watch\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.watcher.ackWatch({\n watch_id: \"my_watch\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.watcher.ack_watch(\n watch_id: \"my_watch\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->watcher()->ackWatch([\n \"watch_id\" => \"my_watch\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/watch/my_watch/_ack\"" + }, + { + "language": "Java", + "code": "client.watcher().ackWatch(a -> a\n .watchId(\"my_watch\")\n);\n" + } + ], + "specification/watcher/delete_watch/examples/request/DeleteWatchRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.watcher.delete_watch(\n id=\"my_watch\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.watcher.deleteWatch({\n id: \"my_watch\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.watcher.delete_watch(\n id: \"my_watch\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->watcher()->deleteWatch([\n \"id\" => \"my_watch\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_watcher/watch/my_watch\"" + }, + { + "language": "Java", + "code": "client.watcher().deleteWatch(d -> d\n .id(\"my_watch\")\n);\n" + } + ], + "specification/watcher/stats/examples/request/WatcherStatsRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.watcher().stats(s -> s);\n" + } + ], + "specification/license/post/examples/request/PostLicenseRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.license().post(p -> p\n .licenses(l -> l\n .expiryDateInMillis(1914278399999L)\n .issueDateInMillis(1411948800000L)\n .issuedTo(\"issuedTo\")\n .issuer(\"issuer\")\n .maxNodes(1L)\n .signature(\"xx\")\n .type(LicenseType.Basic)\n .uid(\"893361dc-9749-4997-93cb-802e3d7fa4xx\")\n )\n);\n" + } + ], + "specification/license/delete/examples/request/LicenseDeleteExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.license().delete(d -> d);\n" + } + ], + "specification/license/get/examples/request/GetLicenseRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.license().get(g -> g);\n" + } + ], + "specification/license/get_trial_status/examples/request/GetTrialLicenseStatusRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.license().getTrialStatus();\n" + } + ], + "specification/license/post_start_trial/examples/request/StartTrialLicenseRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.license.post_start_trial(\n acknowledge=True,\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.license.postStartTrial({\n acknowledge: \"true\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.license.post_start_trial(\n acknowledge: \"true\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->license()->postStartTrial([\n \"acknowledge\" => \"true\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_license/start_trial?acknowledge=true\"" + }, + { + "language": "Java", + "code": "client.license().postStartTrial(p -> p\n .acknowledge(true)\n);\n" + } + ], + "specification/license/get_basic_status/examples/request/GetBasicLicenseStatusRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.license().getBasicStatus();\n" + } + ], + "specification/license/post_start_basic/examples/request/StartBasicLicenseRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.license.post_start_basic(\n acknowledge=True,\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.license.postStartBasic({\n acknowledge: \"true\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.license.post_start_basic(\n acknowledge: \"true\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->license()->postStartBasic([\n \"acknowledge\" => \"true\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_license/start_basic?acknowledge=true\"" + }, + { + "language": "Java", + "code": "client.license().postStartBasic(p -> p\n .acknowledge(true)\n);\n" + } + ], + "specification/logstash/get_pipeline/examples/request/LogstashGetPipelineRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.logstash.get_pipeline(\n id=\"my_pipeline\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.logstash.getPipeline({\n id: \"my_pipeline\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.logstash.get_pipeline(\n id: \"my_pipeline\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->logstash()->getPipeline([\n \"id\" => \"my_pipeline\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_logstash/pipeline/my_pipeline\"" + }, + { + "language": "Java", + "code": "client.logstash().getPipeline(g -> g\n .id(\"my_pipeline\")\n);\n" + } + ], + "specification/logstash/put_pipeline/examples/request/LogstashPutPipelineRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\":\"memory\",\"queue.max_bytes\":\"1gb\",\"queue.checkpoint.writes\":1024}}' \"$ELASTICSEARCH_URL/_logstash/pipeline/my_pipeline\"" + }, + { + "language": "Java", + "code": "client.logstash().putPipeline(p -> p\n .id(\"my_pipeline\")\n .pipeline(pi -> pi\n .description(\"Sample pipeline for illustration purposes\")\n .lastModified(DateTime.of(\"2021-01-02T02:50:51.250Z\"))\n .pipeline(\"input {}\\n filter { grok {} }\\n output {}\")\n .pipelineMetadata(pip -> pip\n .type(\"logstash_pipeline\")\n .version(\"1\")\n )\n .pipelineSettings(pip -> pip\n .pipelineWorkers(1)\n .pipelineBatchSize(125)\n .pipelineBatchDelay(50)\n .queueType(\"memory\")\n .queueMaxBytes(\"1gb\")\n .queueCheckpointWrites(1024)\n )\n .username(\"elastic\")\n )\n);\n" + } + ], + "specification/logstash/delete_pipeline/examples/request/LogstashDeletePipelineExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.logstash.delete_pipeline(\n id=\"my_pipeline\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.logstash.deletePipeline({\n id: \"my_pipeline\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.logstash.delete_pipeline(\n id: \"my_pipeline\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->logstash()->deletePipeline([\n \"id\" => \"my_pipeline\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_logstash/pipeline/my_pipeline\"" + }, + { + "language": "Java", + "code": "client.logstash().deletePipeline(d -> d\n .id(\"my_pipeline\")\n);\n" + } + ], + "specification/security/saml_complete_logout/examples/request/SamlCompleteLogoutRequestExample2.yaml": [ + { + "language": "Python", + "code": "resp = client.security.saml_complete_logout(\n realm=\"saml1\",\n ids=[\n \"_1c368075e0b3...\"\n ],\n content=\"PHNhbWxwOkxvZ291dFJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46...\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.samlCompleteLogout({\n realm: \"saml1\",\n ids: [\"_1c368075e0b3...\"],\n content: \"PHNhbWxwOkxvZ291dFJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46...\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.saml_complete_logout(\n body: {\n \"realm\": \"saml1\",\n \"ids\": [\n \"_1c368075e0b3...\"\n ],\n \"content\": \"PHNhbWxwOkxvZ291dFJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46...\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->samlCompleteLogout([\n \"body\" => [\n \"realm\" => \"saml1\",\n \"ids\" => array(\n \"_1c368075e0b3...\",\n ),\n \"content\" => \"PHNhbWxwOkxvZ291dFJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46...\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().samlCompleteLogout(s -> s\n .content(\"PHNhbWxwOkxvZ291dFJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46...\")\n .ids(\"_1c368075e0b3...\")\n .realm(\"saml1\")\n);\n" + } + ], + "specification/security/saml_complete_logout/examples/request/SamlCompleteLogoutRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=CuCmFn%2BLqnaZGZJqK...\"}' \"$ELASTICSEARCH_URL/_security/saml/complete_logout\"" + }, + { + "language": "Java", + "code": "client.security().samlCompleteLogout(s -> s\n .ids(\"_1c368075e0b3...\")\n .queryString(\"SAMLResponse=fZHLasMwEEVbfb1bf...&SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=CuCmFn%2BLqnaZGZJqK...\")\n .realm(\"saml1\")\n);\n" + } + ], + "specification/security/disable_user/examples/request/SecurityDisableUserExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.disable_user(\n username=\"jacknich\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.disableUser({\n username: \"jacknich\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.disable_user(\n username: \"jacknich\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->disableUser([\n \"username\" => \"jacknich\",\n]);" + }, + { + "language": "curl", + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/user/jacknich/_disable\"" + }, + { + "language": "Java", + "code": "client.security().disableUser(d -> d\n .username(\"jacknich\")\n);\n" + } + ], + "specification/security/update_settings/examples/request/SecurityUpdateSettingsRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"},\"security-profile\":{\"index.auto_expand_replicas\":\"0-all\"}}' \"$ELASTICSEARCH_URL/_security/settings\"" + }, + { + "language": "Java", + "code": "client.security().updateSettings(u -> u\n .security(s -> s)\n .securityProfile(s -> s)\n .securityTokens(s -> s)\n);\n" + } + ], + "specification/security/get_user_profile/examples/request/GetUserProfileRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.get_user_profile(\n uid=\"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.getUserProfile({\n uid: \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.get_user_profile(\n uid: \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->getUserProfile([\n \"uid\" => \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"" + }, + { + "language": "Java", + "code": "client.security().getUserProfile(g -> g\n .uid(\"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\")\n);\n" + } + ], + "specification/security/create_api_key/examples/request/SecurityCreateApiKeyRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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*\"],\"privileges\":[\"all\"]}]}},\"metadata\":{\"application\":\"my-application\",\"environment\":{\"level\":1,\"trusted\":true,\"tags\":[\"dev\",\"staging\"]}}}' \"$ELASTICSEARCH_URL/_security/api_key\"" + }, + { + "language": "Java", + "code": "client.security().createApiKey(c -> c\n .expiration(e -> e\n .time(\"1d\")\n )\n .metadata(Map.of(\"environment\", JsonData.fromJson(\"{\\\"level\\\":1,\\\"trusted\\\":true,\\\"tags\\\":[\\\"dev\\\",\\\"staging\\\"]}\"),\"application\", JsonData.fromJson(\"\\\"my-application\\\"\")))\n .name(\"my-api-key\")\n .roleDescriptors(Map.of(\"role-b\", RoleDescriptor.of(r -> r\n .cluster(\"all\")\n .indices(i -> i\n .names(\"index-b*\")\n .privileges(\"all\")\n )),\"role-a\", RoleDescriptor.of(r -> r\n .cluster(\"all\")\n .indices(i -> i\n .names(\"index-a*\")\n .privileges(\"read\")\n ))))\n);\n" + } + ], + "specification/security/get_privileges/examples/request/SecurityGetPrivilegesRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.get_privileges(\n application=\"myapp\",\n name=\"read\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.getPrivileges({\n application: \"myapp\",\n name: \"read\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.get_privileges(\n application: \"myapp\",\n name: \"read\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->getPrivileges([\n \"application\" => \"myapp\",\n \"name\" => \"read\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/privilege/myapp/read\"" + }, + { + "language": "Java", + "code": "client.security().getPrivileges(g -> g\n .application(\"myapp\")\n .name(\"read\")\n);\n" + } + ], + "specification/security/update_cross_cluster_api_key/examples/request/UpdateCrossClusterApiKeyRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.security().updateCrossClusterApiKey(u -> u\n .access(a -> a\n .replication(r -> r\n .names(\"archive\")\n )\n )\n .id(\"VuaCfGcBCdbkQm-e5aOx\")\n .metadata(\"application\", JsonData.fromJson(\"\\\"replication\\\"\"))\n);\n" + } + ], + "specification/security/get_settings/examples/request/SecurityGetSettingsExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().getSettings(g -> g);\n" + } + ], + "specification/security/get_builtin_privileges/examples/request/SecurityGetBuiltinPrivilegesRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().getBuiltinPrivileges();\n" + } + ], + "specification/security/has_privileges_user_profile/examples/request/HasPrivilegesUserProfileRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"]}],\"application\":[{\"application\":\"inventory_manager\",\"privileges\":[\"read\",\"data:write/inventory\"],\"resources\":[\"product/1852563\"]}]}}' \"$ELASTICSEARCH_URL/_security/profile/_has_privileges\"" + }, + { + "language": "Java", + "code": "client.security().hasPrivilegesUserProfile(h -> h\n .privileges(p -> p\n .application(a -> a\n .application(\"inventory_manager\")\n .privileges(List.of(\"read\",\"data:write/inventory\"))\n .resources(\"product/1852563\")\n )\n .cluster(List.of(\"monitor\",\"create_snapshot\",\"manage_ml\"))\n .index(List.of(IndexPrivilegesCheck.of(i -> i\n .names(List.of(\"suppliers\",\"products\"))\n .privileges(\"create_doc\")),IndexPrivilegesCheck.of(i -> i\n .names(\"inventory\")\n .privileges(List.of(\"read\",\"write\")))))\n )\n .uids(List.of(\"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0\",\"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1\",\"u_does-not-exist_0\"))\n);\n" + } + ], + "specification/security/clear_cached_roles/examples/request/SecurityClearCachedRolesExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.clear_cached_roles(\n name=\"my_admin_role\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.clearCachedRoles({\n name: \"my_admin_role\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.clear_cached_roles(\n name: \"my_admin_role\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->clearCachedRoles([\n \"name\" => \"my_admin_role\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/role/my_admin_role/_clear_cache\"" + }, + { + "language": "Java", + "code": "client.security().clearCachedRoles(c -> c\n .name(\"my_admin_role\")\n);\n" + } + ], + "specification/security/authenticate/examples/request/SecurityAuthenticateRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().authenticate();\n" + } + ], + "specification/security/activate_user_profile/examples/request/ActivateUserProfileRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.activate_user_profile(\n grant_type=\"password\",\n username=\"jacknich\",\n password=\"l0ng-r4nd0m-p@ssw0rd\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.activateUserProfile({\n grant_type: \"password\",\n username: \"jacknich\",\n password: \"l0ng-r4nd0m-p@ssw0rd\",\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "code": "$resp = $client->security()->activateUserProfile([\n \"body\" => [\n \"grant_type\" => \"password\",\n \"username\" => \"jacknich\",\n \"password\" => \"l0ng-r4nd0m-p@ssw0rd\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().activateUserProfile(a -> a\n .grantType(GrantType.Password)\n .password(\"l0ng-r4nd0m-p@ssw0rd\")\n .username(\"jacknich\")\n);\n" + } + ], + "specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample2.yaml": [ + { + "language": "Python", + "code": "resp = client.security.oidc_prepare_authentication(\n realm=\"oidc1\",\n state=\"lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO\",\n nonce=\"zOBXLJGUooRrbLbQk5YCcyC8AXw3iloynvluYhZ5\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.oidcPrepareAuthentication({\n realm: \"oidc1\",\n state: \"lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO\",\n nonce: \"zOBXLJGUooRrbLbQk5YCcyC8AXw3iloynvluYhZ5\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.oidc_prepare_authentication(\n body: {\n \"realm\": \"oidc1\",\n \"state\": \"lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO\",\n \"nonce\": \"zOBXLJGUooRrbLbQk5YCcyC8AXw3iloynvluYhZ5\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->oidcPrepareAuthentication([\n \"body\" => [\n \"realm\" => \"oidc1\",\n \"state\" => \"lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO\",\n \"nonce\" => \"zOBXLJGUooRrbLbQk5YCcyC8AXw3iloynvluYhZ5\",\n ],\n]);" + }, + { + "language": "curl", + "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": "Java", + "code": "client.security().oidcPrepareAuthentication(o -> o\n .nonce(\"zOBXLJGUooRrbLbQk5YCcyC8AXw3iloynvluYhZ5\")\n .realm(\"oidc1\")\n .state(\"lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO\")\n);\n" + } + ], + "specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample3.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.security().oidcPrepareAuthentication(o -> o\n .iss(\"http://127.0.0.1:8080\")\n .loginHint(\"this_is_an_opaque_string\")\n);\n" + } + ], + "specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.oidc_prepare_authentication(\n realm=\"oidc1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.oidcPrepareAuthentication({\n realm: \"oidc1\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.oidc_prepare_authentication(\n body: {\n \"realm\": \"oidc1\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->oidcPrepareAuthentication([\n \"body\" => [\n \"realm\" => \"oidc1\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().oidcPrepareAuthentication(o -> o\n .realm(\"oidc1\")\n);\n" + } + ], + "specification/security/has_privileges/examples/request/SecurityHasPrivilegesRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.security().hasPrivileges(h -> h\n .application(a -> a\n .application(\"inventory_manager\")\n .privileges(List.of(\"read\",\"data:write/inventory\"))\n .resources(\"product/1852563\")\n )\n .cluster(List.of(\"monitor\",\"manage\"))\n .index(List.of(IndexPrivilegesCheck.of(i -> i\n .names(List.of(\"suppliers\",\"products\"))\n .privileges(\"read\")),IndexPrivilegesCheck.of(i -> i\n .names(\"inventory\")\n .privileges(List.of(\"read\",\"write\")))))\n);\n" + } + ], + "specification/security/oidc_logout/examples/request/OidcLogoutRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.oidc_logout(\n token=\"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\n refresh_token=\"vLBPvmAB6KvwvJZr27cS\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.oidcLogout({\n token:\n \"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\n refresh_token: \"vLBPvmAB6KvwvJZr27cS\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.oidc_logout(\n body: {\n \"token\": \"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\n \"refresh_token\": \"vLBPvmAB6KvwvJZr27cS\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->oidcLogout([\n \"body\" => [\n \"token\" => \"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\n \"refresh_token\" => \"vLBPvmAB6KvwvJZr27cS\",\n ],\n]);" + }, + { + "language": "curl", + "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": "Java", + "code": "client.security().oidcLogout(o -> o\n .refreshToken(\"vLBPvmAB6KvwvJZr27cS\")\n .token(\"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\")\n);\n" + } + ], + "specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.invalidate_api_key(\n ids=[\n \"VuaCfGcBCdbkQm-e5aOx\"\n ],\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.invalidateApiKey({\n ids: [\"VuaCfGcBCdbkQm-e5aOx\"],\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.invalidate_api_key(\n body: {\n \"ids\": [\n \"VuaCfGcBCdbkQm-e5aOx\"\n ]\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->invalidateApiKey([\n \"body\" => [\n \"ids\" => array(\n \"VuaCfGcBCdbkQm-e5aOx\",\n ),\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().invalidateApiKey(i -> i\n .ids(\"VuaCfGcBCdbkQm-e5aOx\")\n);\n" + } + ], + "specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample6.yaml": [ + { + "language": "Python", + "code": "resp = client.security.invalidate_api_key(\n username=\"myuser\",\n realm_name=\"native1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.invalidateApiKey({\n username: \"myuser\",\n realm_name: \"native1\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.invalidate_api_key(\n body: {\n \"username\": \"myuser\",\n \"realm_name\": \"native1\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->invalidateApiKey([\n \"body\" => [\n \"username\" => \"myuser\",\n \"realm_name\" => \"native1\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().invalidateApiKey(i -> i\n .realmName(\"native1\")\n .username(\"myuser\")\n);\n" + } + ], + "specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample5.yaml": [ + { + "language": "Python", + "code": "resp = client.security.invalidate_api_key(\n ids=[\n \"VuaCfGcBCdbkQm-e5aOx\"\n ],\n owner=True,\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.invalidateApiKey({\n ids: [\"VuaCfGcBCdbkQm-e5aOx\"],\n owner: \"true\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.invalidate_api_key(\n body: {\n \"ids\": [\n \"VuaCfGcBCdbkQm-e5aOx\"\n ],\n \"owner\": \"true\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->invalidateApiKey([\n \"body\" => [\n \"ids\" => array(\n \"VuaCfGcBCdbkQm-e5aOx\",\n ),\n \"owner\" => \"true\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().invalidateApiKey(i -> i\n .ids(\"VuaCfGcBCdbkQm-e5aOx\")\n .owner(true)\n);\n" + } + ], + "specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample4.yaml": [ + { + "language": "Python", + "code": "resp = client.security.invalidate_api_key(\n username=\"myuser\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.invalidateApiKey({\n username: \"myuser\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.invalidate_api_key(\n body: {\n \"username\": \"myuser\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->invalidateApiKey([\n \"body\" => [\n \"username\" => \"myuser\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().invalidateApiKey(i -> i\n .username(\"myuser\")\n);\n" + } + ], + "specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample3.yaml": [ + { + "language": "Python", + "code": "resp = client.security.invalidate_api_key(\n realm_name=\"native1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.invalidateApiKey({\n realm_name: \"native1\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.invalidate_api_key(\n body: {\n \"realm_name\": \"native1\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->invalidateApiKey([\n \"body\" => [\n \"realm_name\" => \"native1\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().invalidateApiKey(i -> i\n .realmName(\"native1\")\n);\n" + } + ], + "specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample2.yaml": [ + { + "language": "Python", + "code": "resp = client.security.invalidate_api_key(\n name=\"my-api-key\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.invalidateApiKey({\n name: \"my-api-key\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.invalidate_api_key(\n body: {\n \"name\": \"my-api-key\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->invalidateApiKey([\n \"body\" => [\n \"name\" => \"my-api-key\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().invalidateApiKey(i -> i\n .name(\"my-api-key\")\n);\n" + } + ], + "specification/security/bulk_update_api_keys/examples/request/SecurityBulkUpdateApiKeysRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.security().bulkUpdateApiKeys(b -> b\n .expiration(e -> e\n .time(\"30d\")\n )\n .ids(List.of(\"VuaCfGcBCdbkQm-e5aOx\",\"H3_AhoIBA9hmeQJdg7ij\"))\n .metadata(\"environment\", JsonData.fromJson(\"{\\\"level\\\":2,\\\"trusted\\\":true,\\\"tags\\\":[\\\"production\\\"]}\"))\n .roleDescriptors(\"role-a\", r -> r\n .indices(i -> i\n .names(\"*\")\n .privileges(\"write\")\n )\n )\n);\n" + } + ], + "specification/security/bulk_update_api_keys/examples/request/SecurityBulkUpdateApiKeysRequestExample2.yaml": [ + { + "language": "Python", + "code": "resp = client.security.bulk_update_api_keys(\n ids=[\n \"VuaCfGcBCdbkQm-e5aOx\",\n \"H3_AhoIBA9hmeQJdg7ij\"\n ],\n role_descriptors={},\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.bulkUpdateApiKeys({\n ids: [\"VuaCfGcBCdbkQm-e5aOx\", \"H3_AhoIBA9hmeQJdg7ij\"],\n role_descriptors: {},\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.security().bulkUpdateApiKeys(b -> b\n .ids(List.of(\"VuaCfGcBCdbkQm-e5aOx\",\"H3_AhoIBA9hmeQJdg7ij\"))\n);\n" + } + ], + "specification/security/suggest_user_profiles/examples/request/SuggestUserProfilesRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"],\"labels\":{\"direction\":[\"north\",\"east\"]}}}' \"$ELASTICSEARCH_URL/_security/profile/_suggest\"" + }, + { + "language": "Java", + "code": "client.security().suggestUserProfiles(s -> s\n .hint(h -> h\n .uids(List.of(\"u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0\",\"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"))\n .labels(\"direction\", List.of(\"north\",\"east\"))\n )\n .name(\"jack\")\n);\n" + } + ], + "specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample3.yaml": [ + { + "language": "Python", + "code": "resp = client.security.query_api_keys(\n query={\n \"term\": {\n \"name\": {\n \"value\": \"application-key-1\"\n }\n }\n },\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.queryApiKeys({\n query: {\n term: {\n name: {\n value: \"application-key-1\",\n },\n },\n },\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "code": "$resp = $client->security()->queryApiKeys([\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"name\" => [\n \"value\" => \"application-key-1\",\n ],\n ],\n ],\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().queryApiKeys(q -> q\n .query(qu -> qu\n .term(t -> t\n .field(\"name\")\n .value(FieldValue.of(\"application-key-1\"))\n )\n )\n);\n" + } + ], + "specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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.environment\":\"production\"}}]}},\"from\":20,\"size\":10,\"sort\":[{\"creation\":{\"order\":\"desc\",\"format\":\"date_time\"}},\"name\"]}' \"$ELASTICSEARCH_URL/_security/_query/api_key\"" + }, + { + "language": "Java", + "code": "client.security().queryApiKeys(q -> q\n .from(20)\n .query(qu -> qu\n .bool(b -> b\n .filter(List.of(Query.of(que -> que\n .wildcard(w -> w\n .field(\"username\")\n .value(\"org-*-user\")\n )),Query.of(quer -> quer\n .term(t -> t\n .field(\"metadata.environment\")\n .value(FieldValue.of(\"production\"))\n ))))\n .must(List.of(Query.of(query -> query\n .prefix(p -> p\n .field(\"name\")\n .value(\"app1-key-\")\n )),Query.of(query1 -> query1\n .term(t -> t\n .field(\"invalidated\")\n .value(FieldValue.of(\"false\"))\n ))))\n .mustNot(m -> m\n .term(t -> t\n .field(\"name\")\n .value(FieldValue.of(\"app1-key-01\"))\n )\n )\n )\n )\n .size(10)\n .sort(List.of(SortOptions.of(s -> s\n .field(f -> f\n .field(\"creation\")\n .order(SortOrder.Desc)\n .format(\"date_time\")\n )),SortOptions.of(so -> so\n .field(f -> f\n .field(\"name\")\n ))))\n);\n" + } + ], + "specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "code": "const response = await client.security.queryApiKeys({\n with_limited_by: \"true\",\n query: {\n ids: {\n values: [\"VuaCfGcBCdbkQm-e5aOx\"],\n },\n },\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.security().queryApiKeys(q -> q\n .query(qu -> qu\n .ids(i -> i\n .values(\"VuaCfGcBCdbkQm-e5aOx\")\n )\n )\n .withLimitedBy(true)\n);\n" + } + ], + "specification/security/create_cross_cluster_api_key/examples/request/CreateCrossClusterApiKeyRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.security().createCrossClusterApiKey(c -> c\n .access(a -> a\n .replication(r -> r\n .names(\"archive*\")\n )\n .search(s -> s\n .names(\"logs*\")\n )\n )\n .expiration(e -> e\n .time(\"1d\")\n )\n .metadata(Map.of(\"environment\", JsonData.fromJson(\"{\\\"level\\\":1,\\\"trusted\\\":true,\\\"tags\\\":[\\\"dev\\\",\\\"staging\\\"]}\"),\"description\", JsonData.fromJson(\"\\\"phase one\\\"\")))\n .name(\"my-cross-cluster-api-key\")\n);\n" + } + ], + "specification/security/saml_authenticate/examples/request/SamlAuthenticateRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.saml_authenticate(\n content=\"PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....\",\n ids=[\n \"4fee3b046395c4e751011e97f8900b5273d56685\"\n ],\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.samlAuthenticate({\n content:\n \"PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....\",\n ids: [\"4fee3b046395c4e751011e97f8900b5273d56685\"],\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.saml_authenticate(\n body: {\n \"content\": \"PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....\",\n \"ids\": [\n \"4fee3b046395c4e751011e97f8900b5273d56685\"\n ]\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->samlAuthenticate([\n \"body\" => [\n \"content\" => \"PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....\",\n \"ids\" => array(\n \"4fee3b046395c4e751011e97f8900b5273d56685\",\n ),\n ],\n]);" + }, + { + "language": "curl", + "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": "Java", + "code": "client.security().samlAuthenticate(s -> s\n .content(\"PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....\")\n .ids(\"4fee3b046395c4e751011e97f8900b5273d56685\")\n);\n" + } + ], + "specification/security/change_password/examples/request/SecurityChangePasswordRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.change_password(\n username=\"jacknich\",\n password=\"new-test-password\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.changePassword({\n username: \"jacknich\",\n password: \"new-test-password\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.change_password(\n username: \"jacknich\",\n body: {\n \"password\": \"new-test-password\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->changePassword([\n \"username\" => \"jacknich\",\n \"body\" => [\n \"password\" => \"new-test-password\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().changePassword(c -> c\n .password(\"new-test-password\")\n .username(\"jacknich\")\n);\n" + } + ], + "specification/security/get_service_credentials/examples/request/GetServiceCredentialsRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.get_service_credentials(\n namespace=\"elastic\",\n service=\"fleet-server\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.getServiceCredentials({\n namespace: \"elastic\",\n service: \"fleet-server\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.get_service_credentials(\n namespace: \"elastic\",\n service: \"fleet-server\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->getServiceCredentials([\n \"namespace\" => \"elastic\",\n \"service\" => \"fleet-server\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/service/elastic/fleet-server/credential\"" + }, + { + "language": "Java", + "code": "client.security().getServiceCredentials(g -> g\n .namespace(\"elastic\")\n .service(\"fleet-server\")\n);\n" + } + ], + "specification/security/get_role_mapping/examples/request/SecurityGetRoleMappingRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.get_role_mapping(\n name=\"mapping1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.getRoleMapping({\n name: \"mapping1\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.get_role_mapping(\n name: \"mapping1\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->getRoleMapping([\n \"name\" => \"mapping1\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/role_mapping/mapping1\"" + }, + { + "language": "Java", + "code": "client.security().getRoleMapping(g -> g\n .name(\"mapping1\")\n);\n" + } + ], + "specification/security/disable_user_profile/examples/request/SecurityDisableUserProfileExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.disable_user_profile(\n uid=\"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.disableUserProfile({\n uid: \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.disable_user_profile(\n uid: \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->disableUserProfile([\n \"uid\" => \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0/_disable\"" + }, + { + "language": "Java", + "code": "client.security().disableUserProfile(d -> d\n .uid(\"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\")\n);\n" + } + ], + "specification/security/get_user_privileges/examples/request/SecurityGetUserPrivilegesRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().getUserPrivileges(g -> g);\n" + } + ], + "specification/security/query_role/examples/request/QueryRolesRequestExample2.yaml": [ + { + "language": "Python", + "code": "resp = client.security.query_role(\n query={\n \"match\": {\n \"description\": {\n \"query\": \"user access\"\n }\n }\n },\n size=1,\n)" + }, + { + "language": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.security().queryRole(q -> q\n .query(qu -> qu\n .match(m -> m\n .field(\"description\")\n .query(FieldValue.of(\"user access\"))\n )\n )\n .size(1)\n);\n" + } + ], + "specification/security/query_role/examples/request/QueryRolesRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.query_role(\n sort=[\n \"name\"\n ],\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.queryRole({\n sort: [\"name\"],\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.query_role(\n body: {\n \"sort\": [\n \"name\"\n ]\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->queryRole([\n \"body\" => [\n \"sort\" => array(\n \"name\",\n ),\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().queryRole(q -> q\n .sort(s -> s\n .field(f -> f\n .field(\"name\")\n )\n )\n);\n" + } + ], + "specification/security/delete_privileges/examples/request/SecurityDeletePrivilegesRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.delete_privileges(\n application=\"myapp\",\n name=\"read\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.deletePrivileges({\n application: \"myapp\",\n name: \"read\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.delete_privileges(\n application: \"myapp\",\n name: \"read\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->deletePrivileges([\n \"application\" => \"myapp\",\n \"name\" => \"read\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/privilege/myapp/read\"" + }, + { + "language": "Java", + "code": "client.security().deletePrivileges(d -> d\n .application(\"myapp\")\n .name(\"read\")\n);\n" + } + ], + "specification/security/clear_cached_privileges/examples/request/SecurityClearCachedPrivilegesExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.clear_cached_privileges(\n application=\"myapp\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.clearCachedPrivileges({\n application: \"myapp\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.clear_cached_privileges(\n application: \"myapp\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->clearCachedPrivileges([\n \"application\" => \"myapp\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/privilege/myapp/_clear_cache\"" + }, + { + "language": "Java", + "code": "client.security().clearCachedPrivileges(c -> c\n .application(\"myapp\")\n);\n" + } + ], + "specification/security/create_service_token/examples/request/CreateServiceTokenRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.create_service_token(\n namespace=\"elastic\",\n service=\"fleet-server\",\n name=\"token1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.createServiceToken({\n namespace: \"elastic\",\n service: \"fleet-server\",\n name: \"token1\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.create_service_token(\n namespace: \"elastic\",\n service: \"fleet-server\",\n name: \"token1\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->createServiceToken([\n \"namespace\" => \"elastic\",\n \"service\" => \"fleet-server\",\n \"name\" => \"token1\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/service/elastic/fleet-server/credential/token/token1\"" + }, + { + "language": "Java", + "code": "client.security().createServiceToken(c -> c\n .name(\"token1\")\n .namespace(\"elastic\")\n .service(\"fleet-server\")\n);\n" + } + ], + "specification/security/delete_user/examples/request/SecurityDeleteUserRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.delete_user(\n username=\"jacknich\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.deleteUser({\n username: \"jacknich\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.delete_user(\n username: \"jacknich\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->deleteUser([\n \"username\" => \"jacknich\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/user/jacknich\"" + }, + { + "language": "Java", + "code": "client.security().deleteUser(d -> d\n .username(\"jacknich\")\n);\n" + } + ], + "specification/security/clear_cached_realms/examples/request/SecurityClearCachedRealmsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.clear_cached_realms(\n realms=\"default_file\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.clearCachedRealms({\n realms: \"default_file\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.clear_cached_realms(\n realms: \"default_file\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->clearCachedRealms([\n \"realms\" => \"default_file\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/realm/default_file/_clear_cache\"" + }, + { + "language": "Java", + "code": "client.security().clearCachedRealms(c -> c\n .realms(\"default_file\")\n);\n" + } + ], + "specification/security/get_user/examples/request/SecurityGetUserRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.get_user(\n username=\"jacknich\",\n with_profile_uid=True,\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.getUser({\n username: \"jacknich\",\n with_profile_uid: \"true\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.get_user(\n username: \"jacknich\",\n with_profile_uid: \"true\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->getUser([\n \"username\" => \"jacknich\",\n \"with_profile_uid\" => \"true\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/user/jacknich?with_profile_uid=true\"" + }, + { + "language": "Java", + "code": "client.security().getUser(g -> g\n .username(\"jacknich\")\n .withProfileUid(true)\n);\n" + } + ], + "specification/security/update_user_profile_data/examples/request/UpdateUserProfileDataRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.security().updateUserProfileData(u -> u\n .data(\"app1\", JsonData.fromJson(\"{\\\"theme\\\":\\\"default\\\"}\"))\n .labels(\"direction\", JsonData.fromJson(\"\\\"east\\\"\"))\n .uid(\"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\")\n);\n" + } + ], + "specification/security/delegate_pki/examples/request/SecurityDelegatePkiRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "curl", + "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": "Java", + "code": "client.security().delegatePki(d -> d\n .x509CertificateChain(\"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" + } + ], + "specification/security/enable_user/examples/request/SecurityEnableUserExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.enable_user(\n username=\"logstash_system\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.enableUser({\n username: \"logstash_system\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.enable_user(\n username: \"logstash_system\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->enableUser([\n \"username\" => \"logstash_system\",\n]);" + }, + { + "language": "curl", + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/user/logstash_system/_enable\"" + }, + { + "language": "Java", + "code": "client.security().enableUser(e -> e\n .username(\"logstash_system\")\n);\n" + } + ], + "specification/security/put_user/examples/request/SecurityPutUserRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.security().putUser(p -> p\n .email(\"jacknich@example.com\")\n .fullName(\"Jack Nicholson\")\n .metadata(\"intelligence\", JsonData.fromJson(\"7\"))\n .password(\"l0ng-r4nd0m-p@ssw0rd\")\n .roles(List.of(\"admin\",\"other_role1\"))\n .username(\"jacknich\")\n);\n" + } + ], + "specification/security/clear_api_key_cache/examples/request/SecurityClearApiKeyCacheExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.clear_api_key_cache(\n ids=\"yVGMr3QByxdh1MSaicYx\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.clearApiKeyCache({\n ids: \"yVGMr3QByxdh1MSaicYx\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.clear_api_key_cache(\n ids: \"yVGMr3QByxdh1MSaicYx\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->clearApiKeyCache([\n \"ids\" => \"yVGMr3QByxdh1MSaicYx\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/api_key/yVGMr3QByxdh1MSaicYx/_clear_cache\"" + }, + { + "language": "Java", + "code": "client.security().clearApiKeyCache(c -> c\n .ids(\"yVGMr3QByxdh1MSaicYx\")\n);\n" + } + ], + "specification/security/get_api_key/examples/request/SecurityGetApiKeyRequestExample2.yaml": [ + { + "language": "Python", + "code": "resp = client.security.get_api_key(\n username=\"myuser\",\n realm_name=\"native1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.getApiKey({\n username: \"myuser\",\n realm_name: \"native1\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.get_api_key(\n username: \"myuser\",\n realm_name: \"native1\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->getApiKey([\n \"username\" => \"myuser\",\n \"realm_name\" => \"native1\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/api_key?username=myuser&realm_name=native1\"" + }, + { + "language": "Java", + "code": "client.security().getApiKey(g -> g\n .realmName(\"native1\")\n .username(\"myuser\")\n);\n" + } + ], + "specification/security/clear_cached_service_tokens/examples/request/SecurityClearCachedServiceTokensExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.clear_cached_service_tokens(\n namespace=\"elastic\",\n service=\"fleet-server\",\n name=\"token1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.clearCachedServiceTokens({\n namespace: \"elastic\",\n service: \"fleet-server\",\n name: \"token1\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.clear_cached_service_tokens(\n namespace: \"elastic\",\n service: \"fleet-server\",\n name: \"token1\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->clearCachedServiceTokens([\n \"namespace\" => \"elastic\",\n \"service\" => \"fleet-server\",\n \"name\" => \"token1\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/service/elastic/fleet-server/credential/token/token1/_clear_cache\"" + }, + { + "language": "Java", + "code": "client.security().clearCachedServiceTokens(c -> c\n .name(\"token1\")\n .namespace(\"elastic\")\n .service(\"fleet-server\")\n);\n" + } + ], + "specification/security/enable_user_profile/examples/request/SecurityEnableUserProfileExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.enable_user_profile(\n uid=\"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.enableUserProfile({\n uid: \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.enable_user_profile(\n uid: \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->enableUserProfile([\n \"uid\" => \"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0/_enable\"" + }, + { + "language": "Java", + "code": "client.security().enableUserProfile(e -> e\n .uid(\"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0\")\n);\n" + } + ], + "specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample7.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.security().putRoleMapping(p -> p\n .enabled(true)\n .name(\"mapping7\")\n .roles(\"ldap-example-user\")\n .rules(r -> r\n .all(List.of(RoleMappingRule.of(ro -> ro\n .field(NamedValue.of(\"dn\",List.of(FieldValue.of(\"*,ou=subtree,dc=example,dc=com\"))\n ))), RoleMappingRule.of(rol -> rol\n .field(NamedValue.of(\"realm.name\",List.of(FieldValue.of(\"ldap1\"))\n )))\n )\n )\n )\n);\n" + } + ], + "specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample6.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.security().putRoleMapping(p -> p\n .enabled(true)\n .name(\"mapping6\")\n .roleTemplates(r -> r\n .format(TemplateFormat.Json)\n .template(t -> t\n .source(s -> s\n .scriptString(\"{{#tojson}}groups{{/tojson}}\")\n )\n )\n )\n .rules(ru -> ru\n .field(NamedValue.of(\"realm.name\",List.of(FieldValue.of(\"saml1\"))))\n )\n);\n" + } + ], + "specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.security().putRoleMapping(p -> p\n .enabled(true)\n .metadata(\"version\", JsonData.fromJson(\"1\"))\n .name(\"mapping1\")\n .roles(\"user\")\n .rules(r -> r\n .field(NamedValue.of(\"username\",List.of(FieldValue.of(\"*\"))))\n )\n);\n" + } + ], + "specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample3.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.security().putRoleMapping(p -> p\n .enabled(true)\n .name(\"mapping3\")\n .roles(\"ldap-user\")\n .rules(r -> r\n .field(NamedValue.of(\"realm.name\",List.of(FieldValue.of(\"ldap1\"))))\n )\n);\n" + } + ], + "specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.security().putRoleMapping(p -> p\n .enabled(true)\n .name(\"mapping2\")\n .roles(List.of(\"user\",\"admin\"))\n .rules(r -> r\n .field(NamedValue.of(\"username\",List.of(FieldValue.of(\"esadmin01\"),FieldValue.of(\"esadmin02\"))))\n )\n);\n" + } + ], + "specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample9.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"}},{\"template\":{\"source\":\"_user_{{username}}\"}}],\"enabled\":true}' \"$ELASTICSEARCH_URL/_security/role_mapping/mapping9\"" + }, + { + "language": "Java", + "code": "client.security().putRoleMapping(p -> p\n .enabled(true)\n .name(\"mapping9\")\n .roleTemplates(List.of(RoleTemplate.of(r -> r\n .template(t -> t\n .source(s -> s\n .scriptString(\"saml_user\")\n )\n )),RoleTemplate.of(ro -> ro\n .template(t -> t\n .source(s -> s\n .scriptString(\"_user_{{username}}\")\n )\n ))))\n .rules(ru -> ru\n .field(NamedValue.of(\"realm.name\",List.of(FieldValue.of(\"cloud-saml\"))))\n )\n);\n" + } + ], + "specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample5.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.security().putRoleMapping(p -> p\n .enabled(true)\n .name(\"mapping5\")\n .roleTemplates(r -> r\n .format(TemplateFormat.Json)\n .template(t -> t\n .source(s -> s\n .scriptString(\"{{#tojson}}groups{{/tojson}}\")\n )\n )\n )\n .rules(ru -> ru\n .field(NamedValue.of(\"realm.name\",List.of(FieldValue.of(\"saml1\"))))\n )\n);\n" + } + ], + "specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample4.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.security().putRoleMapping(p -> p\n .enabled(true)\n .name(\"mapping4\")\n .roles(\"superuser\")\n .rules(r -> r\n .any(List.of(RoleMappingRule.of(ro -> ro\n .field(NamedValue.of(\"username\",List.of(FieldValue.of(\"esadmin\"))\n ))), RoleMappingRule.of(rol -> rol\n .field(NamedValue.of(\"groups\",List.of(FieldValue.of(\"cn=admins,dc=example,dc=com\"))\n )))\n )\n )\n )\n);\n" + } + ], + "specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample8.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"}},{\"except\":{\"field\":{\"metadata.terminated_date\":null}}}]}}' \"$ELASTICSEARCH_URL/_security/role_mapping/mapping8\"" + }, + { + "language": "Java", + "code": "client.security().putRoleMapping(p -> p\n .enabled(true)\n .name(\"mapping8\")\n .roles(\"superuser\")\n .rules(r -> r\n .all(List.of(RoleMappingRule.of(ro -> ro\n .any(List.of(RoleMappingRule.of(rol -> rol\n .field(NamedValue.of(\"dn\", List.of(FieldValue.of(\"*,ou=admin,\" +\n \"dc=example,dc=com\"))\n ))\n ), RoleMappingRule.of(role -> role\n .field(NamedValue.of(\"username\", List.of(FieldValue.of(\"es-admin\"),\n FieldValue.of(\"es-system\"))\n )))), RoleMappingRule.of(roleM -> roleM\n .field(NamedValue.of(\"groups\", List.of(FieldValue.of(\"cn=people,\" +\n \"dc=example,dc=com\"))\n )), RoleMappingRule.of(roleMa -> roleMa\n .except(e -> e\n .field(NamedValue.of(\"metadata.terminated_date\",\n List.of(FieldValue.of(null))\n )\n ))))\n )\n )\n )\n )\n )\n);\n" + } + ], + "specification/security/saml_prepare_authentication/examples/request/SamlPrepareAuthenticationRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.saml_prepare_authentication(\n realm=\"saml1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.samlPrepareAuthentication({\n realm: \"saml1\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.saml_prepare_authentication(\n body: {\n \"realm\": \"saml1\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->samlPrepareAuthentication([\n \"body\" => [\n \"realm\" => \"saml1\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().samlPrepareAuthentication(s -> s\n .realm(\"saml1\")\n);\n" + } + ], + "specification/security/saml_prepare_authentication/examples/request/SamlPrepareAuthenticationRequestExample2.yaml": [ + { + "language": "Python", + "code": "resp = client.security.saml_prepare_authentication(\n acs=\"https://kibana.org/api/security/saml/callback\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.samlPrepareAuthentication({\n acs: \"https://kibana.org/api/security/saml/callback\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.saml_prepare_authentication(\n body: {\n \"acs\": \"https://kibana.org/api/security/saml/callback\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->samlPrepareAuthentication([\n \"body\" => [\n \"acs\" => \"https://kibana.org/api/security/saml/callback\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().samlPrepareAuthentication(s -> s\n .acs(\"https://kibana.org/api/security/saml/callback\")\n);\n" + } + ], + "specification/security/saml_invalidate/examples/request/SamlInvalidateRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "curl", + "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": "Java", + "code": "client.security().samlInvalidate(s -> s\n .queryString(\"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" + } + ], + "specification/security/get_token/examples/request/GetUserAccessTokenRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.get_token(\n grant_type=\"client_credentials\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.getToken({\n grant_type: \"client_credentials\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.get_token(\n body: {\n \"grant_type\": \"client_credentials\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->getToken([\n \"body\" => [\n \"grant_type\" => \"client_credentials\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().getToken(g -> g\n .grantType(AccessTokenGrantType.ClientCredentials)\n);\n" + } + ], + "specification/security/get_token/examples/request/GetUserAccessTokenRequestExample2.yaml": [ + { + "language": "Python", + "code": "resp = client.security.get_token(\n grant_type=\"password\",\n username=\"test_admin\",\n password=\"x-pack-test-password\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.getToken({\n grant_type: \"password\",\n username: \"test_admin\",\n password: \"x-pack-test-password\",\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "code": "$resp = $client->security()->getToken([\n \"body\" => [\n \"grant_type\" => \"password\",\n \"username\" => \"test_admin\",\n \"password\" => \"x-pack-test-password\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().getToken(g -> g\n .grantType(AccessTokenGrantType.Password)\n .password(\"x-pack-test-password\")\n .username(\"test_admin\")\n);\n" + } + ], + "specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\":[\"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": "Java", + "code": "client.security().bulkPutRole(b -> b\n .roles(Map.of(\"my_admin_role\", RoleDescriptor.of(r -> r\n .cluster(\"all\")\n .indices(i -> i\n .fieldSecurity(f -> f\n .grant(List.of(\"title\",\"body\"))\n )\n .names(List.of(\"index1\",\"index2\"))\n .privileges(\"all\")\n .query(q -> q\n .match(m -> m\n .field(\"title\")\n .query(FieldValue.of(\"foo\"))\n )\n )\n )\n .applications(a -> a\n .application(\"myapp\")\n .privileges(List.of(\"admin\",\"read\"))\n .resources(\"*\")\n )\n .metadata(\"version\", JsonData.fromJson(\"1\"))\n .runAs(\"other_user\")),\"my_user_role\", RoleDescriptor.of(ro -> ro\n .cluster(\"all\")\n .indices(i -> i\n .fieldSecurity(f -> f\n .grant(List.of(\"title\",\"body\"))\n )\n .names(\"index1\")\n .privileges(\"read\")\n .query(q -> q\n .match(m -> m\n .field(\"title\")\n .query(FieldValue.of(\"foo\"))\n )\n )\n )\n .applications(a -> a\n .application(\"myapp\")\n .privileges(List.of(\"admin\",\"read\"))\n .resources(\"*\")\n )\n .metadata(\"version\", JsonData.fromJson(\"1\"))\n .runAs(\"other_user\"))))\n);\n" + } + ], + "specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample3.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\",\"view_index_metadata\"]}],\"remote_cluster\":[{\"clusters\":[\"my_remote\"],\"privileges\":[\"monitor_stats\"]}]}' \"$ELASTICSEARCH_URL/_security/role/only_remote_access_role\"" + }, + { + "language": "Java", + "code": "client.security().putRole(p -> p\n .name(\"only_remote_access_role\")\n .remoteCluster(r -> r\n .clusters(\"my_remote\")\n .privileges(RemoteClusterPrivilege.MonitorStats)\n )\n .remoteIndices(r -> r\n .clusters(\"my_remote\")\n .names(\"logs*\")\n .privileges(List.of(\"read\",\"read_cross_cluster\",\"view_index_metadata\"))\n )\n);\n" + } + ], + "specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"],\"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": "Java", + "code": "client.security().bulkPutRole(b -> b\n .roles(Map.of(\"my_admin_role\", RoleDescriptor.of(r -> r\n .cluster(\"bad_cluster_privilege\")\n .indices(i -> i\n .fieldSecurity(f -> f\n .grant(List.of(\"title\",\"body\"))\n )\n .names(List.of(\"index1\",\"index2\"))\n .privileges(\"all\")\n .query(q -> q\n .match(m -> m\n .field(\"title\")\n .query(FieldValue.of(\"foo\"))\n )\n )\n )\n .applications(a -> a\n .application(\"myapp\")\n .privileges(List.of(\"admin\",\"read\"))\n .resources(\"*\")\n )\n .metadata(\"version\", JsonData.fromJson(\"1\"))\n .runAs(\"other_user\")),\"my_user_role\", RoleDescriptor.of(ro -> ro\n .cluster(\"all\")\n .indices(i -> i\n .fieldSecurity(f -> f\n .grant(List.of(\"title\",\"body\"))\n )\n .names(\"index1\")\n .privileges(\"read\")\n .query(q -> q\n .match(m -> m\n .field(\"title\")\n .query(FieldValue.of(\"foo\"))\n )\n )\n )\n .applications(a -> a\n .application(\"myapp\")\n .privileges(List.of(\"admin\",\"read\"))\n .resources(\"*\")\n )\n .metadata(\"version\", JsonData.fromJson(\"1\"))\n .runAs(\"other_user\"))))\n);\n" + } + ], + "specification/security/get_role/examples/request/SecurityGetRoleRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.get_role(\n name=\"my_admin_role\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.getRole({\n name: \"my_admin_role\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.get_role(\n name: \"my_admin_role\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->getRole([\n \"name\" => \"my_admin_role\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/role/my_admin_role\"" + }, + { + "language": "Java", + "code": "client.security().getRole(g -> g\n .name(\"my_admin_role\")\n);\n" + } + ], + "specification/security/delete_role/examples/request/SecurityDeleteRoleRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.delete_role(\n name=\"my_admin_role\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.deleteRole({\n name: \"my_admin_role\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.delete_role(\n name: \"my_admin_role\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->deleteRole([\n \"name\" => \"my_admin_role\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/role/my_admin_role\"" + }, + { + "language": "Java", + "code": "client.security().deleteRole(d -> d\n .name(\"my_admin_role\")\n);\n" + } + ], + "specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample5.yaml": [ + { + "language": "Python", + "code": "resp = client.security.invalidate_token(\n username=\"myuser\",\n realm_name=\"saml1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.invalidateToken({\n username: \"myuser\",\n realm_name: \"saml1\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.invalidate_token(\n body: {\n \"username\": \"myuser\",\n \"realm_name\": \"saml1\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->invalidateToken([\n \"body\" => [\n \"username\" => \"myuser\",\n \"realm_name\" => \"saml1\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().invalidateToken(i -> i\n .realmName(\"saml1\")\n .username(\"myuser\")\n);\n" + } + ], + "specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample4.yaml": [ + { + "language": "Python", + "code": "resp = client.security.invalidate_token(\n username=\"myuser\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.invalidateToken({\n username: \"myuser\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.invalidate_token(\n body: {\n \"username\": \"myuser\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->invalidateToken([\n \"body\" => [\n \"username\" => \"myuser\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().invalidateToken(i -> i\n .username(\"myuser\")\n);\n" + } + ], + "specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample3.yaml": [ + { + "language": "Python", + "code": "resp = client.security.invalidate_token(\n realm_name=\"saml1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.invalidateToken({\n realm_name: \"saml1\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.invalidate_token(\n body: {\n \"realm_name\": \"saml1\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->invalidateToken([\n \"body\" => [\n \"realm_name\" => \"saml1\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().invalidateToken(i -> i\n .realmName(\"saml1\")\n);\n" + } + ], + "specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample2.yaml": [ + { + "language": "Python", + "code": "resp = client.security.invalidate_token(\n refresh_token=\"vLBPvmAB6KvwvJZr27cS\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.invalidateToken({\n refresh_token: \"vLBPvmAB6KvwvJZr27cS\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.invalidate_token(\n body: {\n \"refresh_token\": \"vLBPvmAB6KvwvJZr27cS\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->invalidateToken([\n \"body\" => [\n \"refresh_token\" => \"vLBPvmAB6KvwvJZr27cS\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().invalidateToken(i -> i\n .refreshToken(\"vLBPvmAB6KvwvJZr27cS\")\n);\n" + } + ], + "specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.invalidate_token(\n token=\"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.invalidateToken({\n token:\n \"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.invalidate_token(\n body: {\n \"token\": \"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->invalidateToken([\n \"body\" => [\n \"token\" => \"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().invalidateToken(i -> i\n .token(\"dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==\")\n);\n" + } + ], + "specification/security/query_user/examples/request/SecurityQueryUserRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\":[{\"wildcard\":{\"roles\":\"*other*\"}}]}},\"from\":1,\"size\":2,\"sort\":[{\"username\":{\"order\":\"desc\"}}]}' \"$ELASTICSEARCH_URL/_security/_query/user\"" + }, + { + "language": "Java", + "code": "client.security().queryUser(q -> q\n .from(1)\n .query(qu -> qu\n .bool(b -> b\n .filter(f -> f\n .wildcard(w -> w\n .field(\"roles\")\n .value(\"*other*\")\n )\n )\n .must(List.of(Query.of(que -> que\n .wildcard(w -> w\n .field(\"email\")\n .value(\"*example.com\")\n )),Query.of(quer -> quer\n .term(t -> t\n .field(\"enabled\")\n .value(FieldValue.of(true))\n ))))\n )\n )\n .size(2)\n .sort(s -> s\n .field(fi -> fi\n .field(\"username\")\n .order(SortOrder.Desc)\n )\n )\n);\n" + } + ], + "specification/security/query_user/examples/request/SecurityQueryUserRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.query_user(\n with_profile_uid=True,\n query={\n \"prefix\": {\n \"roles\": \"other\"\n }\n },\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.queryUser({\n with_profile_uid: \"true\",\n query: {\n prefix: {\n roles: \"other\",\n },\n },\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "code": "$resp = $client->security()->queryUser([\n \"with_profile_uid\" => \"true\",\n \"body\" => [\n \"query\" => [\n \"prefix\" => [\n \"roles\" => \"other\",\n ],\n ],\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().queryUser(q -> q\n .query(qu -> qu\n .prefix(p -> p\n .field(\"roles\")\n .value(\"other\")\n )\n )\n .withProfileUid(true)\n);\n" + } + ], + "specification/security/saml_service_provider_metadata/examples/request/SamlServiceProviderMetadataRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.update_user_profile_data(\n uid=\"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.updateUserProfileData({\n uid: \"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.update_user_profile_data(\n uid: \"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->updateUserProfileData([\n \"uid\" => \"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/profile/u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0/_data\"" + }, + { + "language": "Java", + "code": "client.security().updateUserProfileData(u -> u\n .uid(\"u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0\")\n);\n" + } + ], + "specification/security/update_api_key/examples/request/UpdateApiKeyRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.security().updateApiKey(u -> u\n .id(\"VuaCfGcBCdbkQm-e5aOx\")\n .metadata(\"environment\", JsonData.fromJson(\"{\\\"level\\\":2,\\\"trusted\\\":true,\\\"tags\\\":[\\\"production\\\"]}\"))\n .roleDescriptors(\"role-a\", r -> r\n .indices(i -> i\n .names(\"*\")\n .privileges(\"write\")\n )\n )\n);\n" + } + ], + "specification/security/update_api_key/examples/request/UpdateApiKeyRequestExample2.yaml": [ + { + "language": "Python", + "code": "resp = client.security.update_api_key(\n id=\"VuaCfGcBCdbkQm-e5aOx\",\n role_descriptors={},\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.updateApiKey({\n id: \"VuaCfGcBCdbkQm-e5aOx\",\n role_descriptors: {},\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.update_api_key(\n id: \"VuaCfGcBCdbkQm-e5aOx\",\n body: {\n \"role_descriptors\": {}\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->updateApiKey([\n \"id\" => \"VuaCfGcBCdbkQm-e5aOx\",\n \"body\" => [\n \"role_descriptors\" => new ArrayObject([]),\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().updateApiKey(u -> u\n .id(\"VuaCfGcBCdbkQm-e5aOx\")\n);\n" + } + ], + "specification/security/delete_service_token/examples/request/DeleteServiceTokenRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.delete_service_token(\n namespace=\"elastic\",\n service=\"fleet-server\",\n name=\"token42\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.deleteServiceToken({\n namespace: \"elastic\",\n service: \"fleet-server\",\n name: \"token42\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.delete_service_token(\n namespace: \"elastic\",\n service: \"fleet-server\",\n name: \"token42\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->deleteServiceToken([\n \"namespace\" => \"elastic\",\n \"service\" => \"fleet-server\",\n \"name\" => \"token42\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/service/elastic/fleet-server/credential/token/token42\"" + }, + { + "language": "Java", + "code": "client.security().deleteServiceToken(d -> d\n .name(\"token42\")\n .namespace(\"elastic\")\n .service(\"fleet-server\")\n);\n" + } + ], + "specification/security/saml_logout/examples/request/SamlLogoutRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.saml_logout(\n token=\"46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3\",\n refresh_token=\"mJdXLtmvTUSpoLwMvdBt_w\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.samlLogout({\n token: \"46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3\",\n refresh_token: \"mJdXLtmvTUSpoLwMvdBt_w\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.saml_logout(\n body: {\n \"token\": \"46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3\",\n \"refresh_token\": \"mJdXLtmvTUSpoLwMvdBt_w\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->samlLogout([\n \"body\" => [\n \"token\" => \"46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3\",\n \"refresh_token\" => \"mJdXLtmvTUSpoLwMvdBt_w\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().samlLogout(s -> s\n .refreshToken(\"mJdXLtmvTUSpoLwMvdBt_w\")\n .token(\"46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3\")\n);\n" + } + ], + "specification/security/oidc_authenticate/examples/request/OidcAuthenticateRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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=4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\"state\":\"4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\",\"nonce\":\"WaBPH0KqPVdG5HHdSxPRjfoZbXMCicm5v1OiAj0DUFM\",\"realm\":\"oidc1\"}' \"$ELASTICSEARCH_URL/_security/oidc/authenticate\"" + }, + { + "language": "Java", + "code": "client.security().oidcAuthenticate(o -> o\n .nonce(\"WaBPH0KqPVdG5HHdSxPRjfoZbXMCicm5v1OiAj0DUFM\")\n .realm(\"oidc1\")\n .redirectUri(\"https://oidc-kibana.elastic.co:5603/api/security/oidc/callback?code=jtI3Ntt8v3_XvcLzCFGq&state=4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\")\n .state(\"4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I\")\n);\n" + } + ], + "specification/security/grant_api_key/examples/request/SecurityGrantApiKeyRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\",\"api_key\":{\"name\":\"another-api-key\"}}' \"$ELASTICSEARCH_URL/_security/api_key/grant\"" + }, + { + "language": "Java", + "code": "client.security().grantApiKey(g -> g\n .apiKey(a -> a\n .name(\"another-api-key\")\n )\n .grantType(ApiKeyGrantType.Password)\n .password(\"x-pack-test-password\")\n .runAs(\"test_user\")\n .username(\"test_admin\")\n);\n" + } + ], + "specification/security/grant_api_key/examples/request/SecurityGrantApiKeyRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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-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": "Java", + "code": "client.security().grantApiKey(g -> g\n .apiKey(a -> a\n .name(\"my-api-key\")\n .expiration(e -> e\n .time(\"1d\")\n )\n .roleDescriptors(Map.of(\"role-b\", RoleDescriptor.of(r -> r\n .cluster(\"all\")\n .indices(i -> i\n .names(\"index-b*\")\n .privileges(\"all\")\n )),\"role-a\", RoleDescriptor.of(r -> r\n .cluster(\"all\")\n .indices(i -> i\n .names(\"index-a*\")\n .privileges(\"read\")\n ))))\n .metadata(Map.of(\"environment\", JsonData.fromJson(\"{\\\"level\\\":1,\\\"trusted\\\":true,\\\"tags\\\":[\\\"dev\\\",\\\"staging\\\"]}\"),\"application\", JsonData.fromJson(\"\\\"my-application\\\"\")))\n )\n .grantType(ApiKeyGrantType.Password)\n .password(\"x-pack-test-password\")\n .username(\"test_admin\")\n);\n" + } + ], + "specification/security/get_service_accounts/examples/request/GetServiceAccountsRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.get_service_accounts(\n namespace=\"elastic\",\n service=\"fleet-server\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.getServiceAccounts({\n namespace: \"elastic\",\n service: \"fleet-server\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.get_service_accounts(\n namespace: \"elastic\",\n service: \"fleet-server\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->getServiceAccounts([\n \"namespace\" => \"elastic\",\n \"service\" => \"fleet-server\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/service/elastic/fleet-server\"" + }, + { + "language": "Java", + "code": "client.security().getServiceAccounts(g -> g\n .namespace(\"elastic\")\n .service(\"fleet-server\")\n);\n" + } + ], + "specification/security/delete_role_mapping/examples/request/SecurityDeleteRoleMappingRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.delete_role_mapping(\n name=\"mapping1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.deleteRoleMapping({\n name: \"mapping1\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.delete_role_mapping(\n name: \"mapping1\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->deleteRoleMapping([\n \"name\" => \"mapping1\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_security/role_mapping/mapping1\"" + }, + { + "language": "Java", + "code": "client.security().deleteRoleMapping(d -> d\n .name(\"mapping1\")\n);\n" + } + ], + "specification/security/put_role/examples/request/SecurityPutRoleRequestExample3.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\",\"view_index_metadata\"]}],\"remote_cluster\":[{\"clusters\":[\"my_remote\"],\"privileges\":[\"monitor_stats\"]}]}' \"$ELASTICSEARCH_URL/_security/role/only_remote_access_role\"" + }, + { + "language": "Java", + "code": "client.security().putRole(p -> p\n .name(\"only_remote_access_role\")\n .remoteCluster(r -> r\n .clusters(\"my_remote\")\n .privileges(RemoteClusterPrivilege.MonitorStats)\n )\n .remoteIndices(r -> r\n .clusters(\"my_remote\")\n .names(\"logs*\")\n .privileges(List.of(\"read\",\"read_cross_cluster\",\"view_index_metadata\"))\n )\n);\n" + } + ], + "specification/security/put_role/examples/request/SecurityPutRoleRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.security().putRole(p -> p\n .cluster(\"cluster:monitor/main\")\n .indices(i -> i\n .names(\"test\")\n .privileges(List.of(\"read\",\"indices:admin/get\"))\n )\n .name(\"cli_or_drivers_minimal\")\n);\n" + } + ], + "specification/security/put_role/examples/request/SecurityPutRoleRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.security().putRole(p -> p\n .applications(a -> a\n .application(\"myapp\")\n .privileges(List.of(\"admin\",\"read\"))\n .resources(\"*\")\n )\n .cluster(\"all\")\n .description(\"Grants full access to all management features within the cluster.\")\n .indices(i -> i\n .fieldSecurity(f -> f\n .grant(List.of(\"title\",\"body\"))\n )\n .names(List.of(\"index1\",\"index2\"))\n .privileges(\"all\")\n .query(q -> q\n .match(m -> m\n .field(\"title\")\n .query(FieldValue.of(\"foo\"))\n )\n )\n )\n .metadata(\"version\", JsonData.fromJson(\"1\"))\n .name(\"my_admin_role\")\n .runAs(\"other_user\")\n);\n" + } + ], + "specification/security/bulk_delete_role/examples/request/SecurityBulkDeleteRoleRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.security.bulk_delete_role(\n names=[\n \"my_admin_role\",\n \"my_user_role\"\n ],\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.security.bulkDeleteRole({\n names: [\"my_admin_role\", \"my_user_role\"],\n});" + }, + { + "language": "Ruby", + "code": "response = client.security.bulk_delete_role(\n body: {\n \"names\": [\n \"my_admin_role\",\n \"my_user_role\"\n ]\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->security()->bulkDeleteRole([\n \"body\" => [\n \"names\" => array(\n \"my_admin_role\",\n \"my_user_role\",\n ),\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().bulkDeleteRole(b -> b\n .names(List.of(\"my_admin_role\",\"my_user_role\"))\n);\n" + } + ], + "specification/security/put_privileges/examples/request/SecurityPutPrivilegesRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.security().putPrivileges(p -> p\n .privileges(\"myapp\", \"read\", pr -> pr\n .actions(List.of(\"data:read/*\",\"action:login\"))\n .metadata(\"description\", JsonData.fromJson(\"\\\"Read access to myapp\\\"\"))\n )\n);\n" + } + ], + "specification/security/put_privileges/examples/request/SecurityPutPrivilegesRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.security().putPrivileges(p -> p\n .privileges(Map.of(\"app02\", \"all\", pr -> pr\n .actions(\"*\"),\"app01\", Map.of(\"read\", Actions.of(a -> a\n .actions(List.of(\"action:login\",\"data:read/*\"))),\"write\", Actions.of(a -> a\n .actions(List.of(\"action:login\",\"data:write/*\"))))))\n);\n" + } + ], + "specification/security/enroll_kibana/examples/request/EnrollKibanaRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.security().enrollKibana();\n" + } + ], + "specification/nodes/usage/examples/request/NodesUsageExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.nodes().usage(u -> u);\n" + } + ], + "specification/nodes/info/examples/request/NodesInfoExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.nodes.info(\n node_id=\"_all\",\n metric=\"jvm\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.nodes.info({\n node_id: \"_all\",\n metric: \"jvm\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.nodes.info(\n node_id: \"_all\",\n metric: \"jvm\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->nodes()->info([\n \"node_id\" => \"_all\",\n \"metric\" => \"jvm\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/_all/jvm\"" + }, + { + "language": "Java", + "code": "client.nodes().info(i -> i\n .metric(\"jvm\")\n .nodeId(\"_all\")\n);\n" + } + ], + "specification/nodes/hot_threads/examples/request/NodesHotThreadsExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.nodes().hotThreads(h -> h);\n" + } + ], + "specification/nodes/reload_secure_settings/examples/request/ReloadSecureSettingsRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.nodes.reload_secure_settings(\n secure_settings_password=\"keystore-password\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.nodes.reloadSecureSettings({\n secure_settings_password: \"keystore-password\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.nodes.reload_secure_settings(\n body: {\n \"secure_settings_password\": \"keystore-password\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->nodes()->reloadSecureSettings([\n \"body\" => [\n \"secure_settings_password\" => \"keystore-password\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.nodes().reloadSecureSettings(r -> r\n .secureSettingsPassword(\"keystore-password\")\n);\n" + } + ], + "specification/nodes/stats/examples/request/NodesStatsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.nodes.stats(\n metric=\"process\",\n filter_path=\"**.max_file_descriptors\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.nodes.stats({\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.nodes.stats(\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->nodes()->stats([\n \"metric\" => \"process\",\n \"filter_path\" => \"**.max_file_descriptors\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/stats/process?filter_path=**.max_file_descriptors\"" + }, + { + "language": "Java", + "code": "\n" + } + ], + "specification/ingest/get_pipeline/examples/request/IngestGetPipelineExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ingest.get_pipeline(\n id=\"my-pipeline-id\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ingest.getPipeline({\n id: \"my-pipeline-id\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ingest.get_pipeline(\n id: \"my-pipeline-id\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ingest()->getPipeline([\n \"id\" => \"my-pipeline-id\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ingest/pipeline/my-pipeline-id\"" + }, + { + "language": "Java", + "code": "client.ingest().getPipeline(g -> g\n .id(\"my-pipeline-id\")\n);\n" + } + ], + "specification/ingest/put_pipeline/examples/request/PutPipelineRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.ingest().putPipeline(p -> p\n .description(\"My optional pipeline description\")\n .id(\"my-pipeline-id\")\n .processors(pr -> pr\n .set(s -> s\n .field(\"my-keyword-field\")\n .value(JsonData.fromJson(\"\\\"foo\\\"\"))\n .description(\"My optional processor description\")\n )\n )\n);\n" + } + ], + "specification/ingest/put_pipeline/examples/request/PutPipelineRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.ingest().putPipeline(p -> p\n .meta(Map.of(\"serialization\", JsonData.fromJson(\"{\\\"class\\\":\\\"MyPipeline\\\",\\\"id\\\":10}\"),\"reason\", JsonData.fromJson(\"\\\"set my-keyword-field to foo\\\"\")))\n .description(\"My optional pipeline description\")\n .id(\"my-pipeline-id\")\n .processors(pr -> pr\n .set(s -> s\n .field(\"my-keyword-field\")\n .value(JsonData.fromJson(\"\\\"foo\\\"\"))\n .description(\"My optional processor description\")\n )\n )\n);\n" + } + ], + "specification/ingest/simulate/examples/request/SimulatePipelineRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"}}]},\"docs\":[{\"_index\":\"index\",\"_id\":\"id\",\"_source\":{\"foo\":\"bar\"}},{\"_index\":\"index\",\"_id\":\"id\",\"_source\":{\"foo\":\"rab\"}}]}' \"$ELASTICSEARCH_URL/_ingest/pipeline/_simulate\"" + }, + { + "language": "Java", + "code": "client.ingest().simulate(s -> s\n .docs(List.of(Document.of(d -> d\n .id(\"id\")\n .index(\"index\")\n .source(JsonData.fromJson(\"{\\\"foo\\\":\\\"bar\\\"}\"))),Document.of(d -> d\n .id(\"id\")\n .index(\"index\")\n .source(JsonData.fromJson(\"{\\\"foo\\\":\\\"rab\\\"}\")))))\n .pipeline(p -> p\n .description(\"_description\")\n .processors(pr -> pr\n .set(se -> se\n .field(\"field2\")\n .value(JsonData.fromJson(\"\\\"_value\\\"\"))\n )\n )\n )\n);\n" + } + ], + "specification/ingest/delete_pipeline/examples/request/IngestDeletePipelineExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ingest.delete_pipeline(\n id=\"my-pipeline-id\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ingest.deletePipeline({\n id: \"my-pipeline-id\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ingest.delete_pipeline(\n id: \"my-pipeline-id\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ingest()->deletePipeline([\n \"id\" => \"my-pipeline-id\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ingest/pipeline/my-pipeline-id\"" + }, + { + "language": "Java", + "code": "client.ingest().deletePipeline(d -> d\n .id(\"my-pipeline-id\")\n);\n" + } + ], + "specification/ingest/geo_ip_stats/examples/request/IngestGeoIpStatsExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.ingest().geoIpStats();\n" + } + ], + "specification/ingest/put_ip_location_database/examples/request/IngestPutIpLocationDatabaseExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.ingest().putIpLocationDatabase(p -> p\n .id(\"my-database-1\")\n .configuration(c -> c\n .maxmind(m -> m\n .accountId(\"1234567\")\n )\n .name(\"GeoIP2-Domain\")\n )\n);\n" + } + ], + "specification/ingest/delete_ip_location_database/examples/request/IngestDeleteIpLocationDatabaseExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ingest.delete_ip_location_database(\n id=\"my-database-id\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ingest.deleteIpLocationDatabase({\n id: \"my-database-id\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ingest.delete_ip_location_database(\n id: \"my-database-id\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ingest()->deleteIpLocationDatabase([\n \"id\" => \"my-database-id\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ingest/ip_location/database/my-database-id\"" + }, + { + "language": "Java", + "code": "client.ingest().deleteIpLocationDatabase(d -> d\n .id(\"my-database-id\")\n);\n" + } + ], + "specification/ingest/get_ip_location_database/examples/request/IngestGetIpLocationDatabaseExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ingest.get_ip_location_database(\n id=\"my-database-id\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ingest.getIpLocationDatabase({\n id: \"my-database-id\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ingest.get_ip_location_database(\n id: \"my-database-id\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ingest()->getIpLocationDatabase([\n \"id\" => \"my-database-id\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ingest/ip_location/database/my-database-id\"" + }, + { + "language": "Java", + "code": "client.ingest().getIpLocationDatabase(g -> g\n .id(\"my-database-id\")\n);\n" + } + ], + "specification/ingest/processor_grok/examples/request/IngestProcessorGrokExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.ingest().processorGrok();\n" + } + ], + "specification/simulate/ingest/examples/request/SimulateIngestRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.simulate().ingest(i -> i\n .docs(List.of(Document.of(d -> d\n .id(\"123\")\n .index(\"my-index\")\n .source(JsonData.fromJson(\"{\\\"foo\\\":\\\"bar\\\"}\"))),Document.of(d -> d\n .id(\"456\")\n .index(\"my-index\")\n .source(JsonData.fromJson(\"{\\\"foo\\\":\\\"rab\\\"}\")))))\n .pipelineSubstitutions(\"my-pipeline\", p -> p\n .processors(pr -> pr\n .uppercase(u -> u\n .field(\"foo\")\n )\n )\n )\n);\n" + } + ], + "specification/simulate/ingest/examples/request/SimulateIngestRequestExample3.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.simulate().ingest(i -> i\n .componentTemplateSubstitutions(\"my-mappings_template\", c -> c\n .template(t -> t\n .mappings(m -> m\n .dynamic(DynamicMapping.Strict)\n .properties(Map.of(\"bar\", Property.of(p -> p\n .keyword(k -> k\n )),\"foo\", Property.of(pr -> pr\n .keyword(k -> k\n ))))\n )\n )\n )\n .docs(List.of(Document.of(d -> d\n .id(\"123\")\n .index(\"my-index\")\n .source(JsonData.fromJson(\"{\\\"foo\\\":\\\"foo\\\"}\"))),Document.of(d -> d\n .id(\"456\")\n .index(\"my-index\")\n .source(JsonData.fromJson(\"{\\\"bar\\\":\\\"rab\\\"}\")))))\n);\n" + } + ], + "specification/simulate/ingest/examples/request/SimulateIngestRequestExample4.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\",\"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": "Java", + "code": "client.simulate().ingest(i -> i\n .componentTemplateSubstitutions(\"my-component-template\", c -> c\n .template(t -> t\n .settings(\"index\", s -> s\n .defaultPipeline(\"my-pipeline\")\n )\n .mappings(m -> m\n .dynamic(DynamicMapping.True)\n .properties(\"field3\", p -> p\n .keyword(k -> k)\n )\n )\n )\n )\n .docs(List.of(Document.of(d -> d\n .id(\"id\")\n .index(\"my-index\")\n .source(JsonData.fromJson(\"{\\\"foo\\\":\\\"bar\\\"}\"))),Document.of(d -> d\n .id(\"id\")\n .index(\"my-index\")\n .source(JsonData.fromJson(\"{\\\"foo\\\":\\\"rab\\\"}\")))))\n .indexTemplateSubstitutions(\"my-index-template\", in -> in\n .indexPatterns(\"my-index-*\")\n .composedOf(List.of(\"component_template_1\",\"component_template_2\"))\n )\n .mappingAddition(m -> m\n .dynamic(DynamicMapping.Strict)\n .properties(\"foo\", p -> p\n .keyword(k -> k)\n )\n )\n .pipelineSubstitutions(\"my-pipeline\", p -> p\n .processors(pr -> pr\n .set(s -> s\n .field(\"field3\")\n .value(JsonData.fromJson(\"\\\"value3\\\"\"))\n )\n )\n )\n);\n" + } + ], + "specification/simulate/ingest/examples/request/SimulateIngestRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.simulate().ingest(i -> i\n .docs(List.of(Document.of(d -> d\n .id(\"123\")\n .index(\"my-index\")\n .source(JsonData.fromJson(\"{\\\"foo\\\":\\\"bar\\\"}\"))),Document.of(d -> d\n .id(\"456\")\n .index(\"my-index\")\n .source(JsonData.fromJson(\"{\\\"foo\\\":\\\"rab\\\"}\")))))\n);\n" + } + ], + "specification/slm/get_stats/examples/request/GetSnapshotLifecycleManagementStatsRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.slm().getStats(g -> g);\n" + } + ], + "specification/slm/get_status/examples/request/GetSnapshotLifecycleManagementStatusRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.slm().getStatus(g -> g);\n" + } + ], + "specification/slm/delete_lifecycle/examples/request/SlmDeleteLifecycleExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.slm.delete_lifecycle(\n policy_id=\"daily-snapshots\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.slm.deleteLifecycle({\n policy_id: \"daily-snapshots\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.slm.delete_lifecycle(\n policy_id: \"daily-snapshots\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->slm()->deleteLifecycle([\n \"policy_id\" => \"daily-snapshots\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_slm/policy/daily-snapshots\"" + }, + { + "language": "Java", + "code": "client.slm().deleteLifecycle(d -> d\n .policyId(\"daily-snapshots\")\n);\n" + } + ], + "specification/slm/start/examples/request/StartSnapshotLifecycleManagementRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.slm().start(s -> s);\n" + } + ], + "specification/slm/get_lifecycle/examples/request/GetSnapshotLifecycleRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.slm.get_lifecycle(\n policy_id=\"daily-snapshots\",\n human=True,\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.slm.getLifecycle({\n policy_id: \"daily-snapshots\",\n human: \"true\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.slm.get_lifecycle(\n policy_id: \"daily-snapshots\",\n human: \"true\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->slm()->getLifecycle([\n \"policy_id\" => \"daily-snapshots\",\n \"human\" => \"true\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_slm/policy/daily-snapshots?human\"" + }, + { + "language": "Java", + "code": "\n" + } + ], + "specification/slm/put_lifecycle/examples/request/PutSnapshotLifecycleRequestExample1 copy.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"],\"ignore_unavailable\":false,\"include_global_state\":false},\"retention\":{\"expire_after\":\"30d\",\"min_count\":5,\"max_count\":50}}' \"$ELASTICSEARCH_URL/_slm/policy/daily-snapshots\"" + }, + { + "language": "Java", + "code": "client.slm().putLifecycle(p -> p\n .config(c -> c\n .ignoreUnavailable(false)\n .indices(List.of(\"data-*\",\"important\"))\n .includeGlobalState(false)\n )\n .name(\"\")\n .policyId(\"daily-snapshots\")\n .repository(\"my_repository\")\n .retention(r -> r\n .expireAfter(e -> e\n .time(\"30d\")\n )\n .maxCount(50)\n .minCount(5)\n )\n .schedule(\"0 30 1 * * ?\")\n);\n" + } + ], + "specification/slm/put_lifecycle/examples/request/PutSnapshotLifecycleRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.slm().putLifecycle(p -> p\n .config(c -> c\n .indices(List.of(\"data-*\",\"important\"))\n )\n .name(\"\")\n .policyId(\"hourly-snapshots\")\n .repository(\"my_repository\")\n .schedule(\"1h\")\n);\n" + } + ], + "specification/slm/execute_retention/examples/request/SlmExecuteRetentionExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.slm().executeRetention(e -> e);\n" + } + ], + "specification/slm/execute_lifecycle/examples/request/ExecuteSnapshotLifecycleRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.slm.execute_lifecycle(\n policy_id=\"daily-snapshots\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.slm.executeLifecycle({\n policy_id: \"daily-snapshots\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.slm.execute_lifecycle(\n policy_id: \"daily-snapshots\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->slm()->executeLifecycle([\n \"policy_id\" => \"daily-snapshots\",\n]);" + }, + { + "language": "curl", + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_slm/policy/daily-snapshots/_execute\"" + }, + { + "language": "Java", + "code": "client.slm().executeLifecycle(e -> e\n .policyId(\"daily-snapshots\")\n);\n" + } + ], + "specification/features/reset_features/examples/request/FeaturesResetFeaturesExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.features().resetFeatures(r -> r);\n" + } + ], + "specification/features/get_features/examples/request/FeaturesGetFeaturesExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.features().getFeatures(g -> g);\n" + } + ], + "specification/graph/explore/examples/request/GraphExploreRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\":[{\"field\":\"query.raw\"}]}}' \"$ELASTICSEARCH_URL/clicklogs/_graph/explore\"" + }, + { + "language": "Java", + "code": "client.graph().explore(e -> e\n .connections(c -> c\n .vertices(v -> v\n .field(\"query.raw\")\n )\n )\n .index(\"clicklogs\")\n .query(q -> q\n .match(m -> m\n .field(\"query.raw\")\n .query(FieldValue.of(\"midi\"))\n )\n )\n .vertices(v -> v\n .field(\"product\")\n )\n);\n" + } + ], + "specification/synonyms/get_synonym_rule/examples/request/SynonymRuleGetRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.synonyms.get_synonym_rule(\n set_id=\"my-synonyms-set\",\n rule_id=\"test-1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.synonyms.getSynonymRule({\n set_id: \"my-synonyms-set\",\n rule_id: \"test-1\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.synonyms.get_synonym_rule(\n set_id: \"my-synonyms-set\",\n rule_id: \"test-1\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->synonyms()->getSynonymRule([\n \"set_id\" => \"my-synonyms-set\",\n \"rule_id\" => \"test-1\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set/test-1\"" + }, + { + "language": "Java", + "code": "client.synonyms().getSynonymRule(g -> g\n .ruleId(\"test-1\")\n .setId(\"my-synonyms-set\")\n);\n" + } + ], + "specification/synonyms/put_synonym_rule/examples/request/SynonymRulePutRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.synonyms().putSynonymRule(p -> p\n .ruleId(\"test-1\")\n .setId(\"my-synonyms-set\")\n .synonyms(\"hello, hi, howdy\")\n);\n" + } + ], + "specification/synonyms/delete_synonym_rule/examples/request/SynonymRuleDeleteRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.synonyms.delete_synonym_rule(\n set_id=\"my-synonyms-set\",\n rule_id=\"test-1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.synonyms.deleteSynonymRule({\n set_id: \"my-synonyms-set\",\n rule_id: \"test-1\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.synonyms.delete_synonym_rule(\n set_id: \"my-synonyms-set\",\n rule_id: \"test-1\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->synonyms()->deleteSynonymRule([\n \"set_id\" => \"my-synonyms-set\",\n \"rule_id\" => \"test-1\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set/test-1\"" + }, + { + "language": "Java", + "code": "client.synonyms().deleteSynonymRule(d -> d\n .ruleId(\"test-1\")\n .setId(\"my-synonyms-set\")\n);\n" + } + ], + "specification/synonyms/delete_synonym/examples/request/SynonymsDeleteSynonymExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.synonyms.delete_synonym(\n id=\"my-synonyms-set\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.synonyms.deleteSynonym({\n id: \"my-synonyms-set\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.synonyms.delete_synonym(\n id: \"my-synonyms-set\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->synonyms()->deleteSynonym([\n \"id\" => \"my-synonyms-set\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set\"" + }, + { + "language": "Java", + "code": "client.synonyms().deleteSynonym(d -> d\n .id(\"my-synonyms-set\")\n);\n" + } + ], + "specification/synonyms/get_synonym/examples/request/SynonymsGetRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.synonyms.get_synonym(\n id=\"my-synonyms-set\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.synonyms.getSynonym({\n id: \"my-synonyms-set\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.synonyms.get_synonym(\n id: \"my-synonyms-set\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->synonyms()->getSynonym([\n \"id\" => \"my-synonyms-set\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set\"" + }, + { + "language": "Java", + "code": "client.synonyms().getSynonym(g -> g\n .id(\"my-synonyms-set\")\n);\n" + } + ], + "specification/synonyms/get_synonyms_sets/examples/request/SynonymsSetsGetRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.synonyms().getSynonymsSets(g -> g);\n" + } + ], + "specification/synonyms/put_synonym/examples/request/SynonymsPutRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.synonyms.put_synonym(\n id=\"my-synonyms-set\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.synonyms.putSynonym({\n id: \"my-synonyms-set\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.synonyms.put_synonym(\n id: \"my-synonyms-set\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->synonyms()->putSynonym([\n \"id\" => \"my-synonyms-set\",\n]);" + }, + { + "language": "curl", + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set\"" + } + ], + "specification/dangling_indices/list_dangling_indices/examples/request/DanglingIndicesListDanglingIndicesExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.danglingIndices().listDanglingIndices();\n" + } + ], + "specification/dangling_indices/delete_dangling_index/examples/request/DanglingIndicesDeleteDanglingIndexExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.dangling_indices.delete_dangling_index(\n index_uuid=\"\",\n accept_data_loss=True,\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.danglingIndices.deleteDanglingIndex({\n index_uuid: \"\",\n accept_data_loss: \"true\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.dangling_indices.delete_dangling_index(\n index_uuid: \"\",\n accept_data_loss: \"true\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->danglingIndices()->deleteDanglingIndex([\n \"index_uuid\" => \"\",\n \"accept_data_loss\" => \"true\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_dangling/?accept_data_loss=true\"" + }, + { + "language": "Java", + "code": "client.danglingIndices().deleteDanglingIndex(d -> d\n .acceptDataLoss(true)\n .indexUuid(\"\")\n);\n" + } + ], + "specification/dangling_indices/import_dangling_index/examples/request/ImportDanglingIndexRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.dangling_indices.import_dangling_index(\n index_uuid=\"zmM4e0JtBkeUjiHD-MihPQ\",\n accept_data_loss=True,\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.danglingIndices.importDanglingIndex({\n index_uuid: \"zmM4e0JtBkeUjiHD-MihPQ\",\n accept_data_loss: \"true\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.dangling_indices.import_dangling_index(\n index_uuid: \"zmM4e0JtBkeUjiHD-MihPQ\",\n accept_data_loss: \"true\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->danglingIndices()->importDanglingIndex([\n \"index_uuid\" => \"zmM4e0JtBkeUjiHD-MihPQ\",\n \"accept_data_loss\" => \"true\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_dangling/zmM4e0JtBkeUjiHD-MihPQ?accept_data_loss=true\"" + }, + { + "language": "Java", + "code": "client.danglingIndices().importDanglingIndex(i -> i\n .acceptDataLoss(true)\n .indexUuid(\"zmM4e0JtBkeUjiHD-MihPQ\")\n);\n" + } + ], + "specification/ml/forecast/examples/request/MlForecastExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.forecast(\n job_id=\"low_request_rate\",\n duration=\"10d\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.forecast({\n job_id: \"low_request_rate\",\n duration: \"10d\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.forecast(\n job_id: \"low_request_rate\",\n body: {\n \"duration\": \"10d\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->forecast([\n \"job_id\" => \"low_request_rate\",\n \"body\" => [\n \"duration\" => \"10d\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.ml().forecast(f -> f\n .duration(d -> d\n .time(\"10d\")\n )\n .jobId(\"low_request_rate\")\n);\n" + } + ], + "specification/ml/stop_data_frame_analytics/examples/request/MlStopDataFrameAnalyticsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.stop_data_frame_analytics(\n id=\"loganalytics\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.stopDataFrameAnalytics({\n id: \"loganalytics\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.stop_data_frame_analytics(\n id: \"loganalytics\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->stopDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics/_stop\"" + }, + { + "language": "Java", + "code": "client.ml().stopDataFrameAnalytics(s -> s\n .id(\"loganalytics\")\n);\n" + } + ], + "specification/ml/delete_model_snapshot/examples/request/MlDeleteModelSnapshotExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.delete_model_snapshot(\n job_id=\"farequote\",\n snapshot_id=\"1491948163\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.deleteModelSnapshot({\n job_id: \"farequote\",\n snapshot_id: 1491948163,\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.delete_model_snapshot(\n job_id: \"farequote\",\n snapshot_id: \"1491948163\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->deleteModelSnapshot([\n \"job_id\" => \"farequote\",\n \"snapshot_id\" => \"1491948163\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/farequote/model_snapshots/1491948163\"" + }, + { + "language": "Java", + "code": "client.ml().deleteModelSnapshot(d -> d\n .jobId(\"farequote\")\n .snapshotId(\"1491948163\")\n);\n" + } + ], + "specification/ml/get_datafeed_stats/examples/request/MlGetDatafeedStatsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.get_datafeed_stats(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.getDatafeedStats({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.get_datafeed_stats(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->getDatafeedStats([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales/_stats\"" + }, + { + "language": "Java", + "code": "client.ml().getDatafeedStats(g -> g\n .datafeedId(\"datafeed-high_sum_total_sales\")\n);\n" + } + ], + "specification/ml/delete_datafeed/examples/request/MlDeleteDatafeedExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.delete_datafeed(\n datafeed_id=\"datafeed-total-requests\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.deleteDatafeed({\n datafeed_id: \"datafeed-total-requests\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.delete_datafeed(\n datafeed_id: \"datafeed-total-requests\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->deleteDatafeed([\n \"datafeed_id\" => \"datafeed-total-requests\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-total-requests\"" + }, + { + "language": "Java", + "code": "client.ml().deleteDatafeed(d -> d\n .datafeedId(\"datafeed-total-requests\")\n);\n" + } + ], + "specification/ml/delete_calendar_job/examples/request/MlDeleteCalendarJobExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.delete_calendar_job(\n calendar_id=\"planned-outages\",\n job_id=\"total-requests\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.deleteCalendarJob({\n calendar_id: \"planned-outages\",\n job_id: \"total-requests\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.delete_calendar_job(\n calendar_id: \"planned-outages\",\n job_id: \"total-requests\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->deleteCalendarJob([\n \"calendar_id\" => \"planned-outages\",\n \"job_id\" => \"total-requests\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages/jobs/total-requests\"" + }, + { + "language": "Java", + "code": "client.ml().deleteCalendarJob(d -> d\n .calendarId(\"planned-outages\")\n .jobId(\"total-requests\")\n);\n" + } + ], + "specification/ml/get_datafeeds/examples/request/MlGetDatafeedsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.get_datafeeds(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.getDatafeeds({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.get_datafeeds(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->getDatafeeds([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales\"" + }, + { + "language": "Java", + "code": "client.ml().getDatafeeds(g -> g\n .datafeedId(\"datafeed-high_sum_total_sales\")\n);\n" + } + ], + "specification/ml/stop_trained_model_deployment/examples/request/MlStopTrainedModelDeploymentExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.stop_trained_model_deployment(\n model_id=\"my_model_for_search\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.stopTrainedModelDeployment({\n model_id: \"my_model_for_search\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.stop_trained_model_deployment(\n model_id: \"my_model_for_search\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->stopTrainedModelDeployment([\n \"model_id\" => \"my_model_for_search\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/my_model_for_search/deployment/_stop\"" + }, + { + "language": "Java", + "code": "client.ml().stopTrainedModelDeployment(s -> s\n .modelId(\"my_model_for_search\")\n);\n" + } + ], + "specification/ml/stop_datafeed/examples/request/MlStopDatafeedExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.stop_datafeed(\n datafeed_id=\"datafeed-low_request_rate\",\n timeout=\"30s\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.stopDatafeed({\n datafeed_id: \"datafeed-low_request_rate\",\n timeout: \"30s\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.stop_datafeed(\n datafeed_id: \"datafeed-low_request_rate\",\n body: {\n \"timeout\": \"30s\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->stopDatafeed([\n \"datafeed_id\" => \"datafeed-low_request_rate\",\n \"body\" => [\n \"timeout\" => \"30s\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.ml().stopDatafeed(s -> s\n .datafeedId(\"datafeed-low_request_rate\")\n .timeout(t -> t\n .time(\"30s\")\n )\n);\n" + } + ], + "specification/ml/get_calendar_events/examples/request/MlGetCalendarEventsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.get_calendar_events(\n calendar_id=\"planned-outages\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.getCalendarEvents({\n calendar_id: \"planned-outages\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.get_calendar_events(\n calendar_id: \"planned-outages\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->getCalendarEvents([\n \"calendar_id\" => \"planned-outages\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages/events\"" + }, + { + "language": "Java", + "code": "client.ml().getCalendarEvents(g -> g\n .calendarId(\"planned-outages\")\n);\n" + } + ], + "specification/ml/infer_trained_model/examples/request/MlInferTrainedModelExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.ml().inferTrainedModel(i -> i\n .docs(Map.of(\"text\", JsonData.fromJson(\"\\\"The fool doth think he is wise, but the wise man knows himself to be a fool.\\\"\")))\n .modelId(\"lang_ident_model_1\")\n);\n" + } + ], + "specification/ml/put_datafeed/examples/request/MlPutDatafeedExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "\n" + } + ], + "specification/ml/update_job/examples/request/MlUpdateJobExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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},\"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": "Java", + "code": "client.ml().updateJob(u -> u\n .backgroundPersistInterval(b -> b\n .time(\"2h\")\n )\n .description(\"An updated job\")\n .detectors(d -> d\n .detectorIndex(0)\n .description(\"An updated detector description\")\n )\n .groups(List.of(\"kibana_sample_data\",\"kibana_sample_web_logs\"))\n .jobId(\"low_request_rate\")\n .modelPlotConfig(m -> m\n .enabled(true)\n )\n .modelSnapshotRetentionDays(7L)\n .renormalizationWindowDays(30L)\n .resultsRetentionDays(60L)\n);\n" + } + ], + "specification/ml/upgrade_job_snapshot/examples/request/MlUpgradeJobSnapshotExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.ml().upgradeJobSnapshot(u -> u\n .jobId(\"low_request_rate\")\n .snapshotId(\"1828371\")\n .timeout(t -> t\n .offset(45)\n )\n .waitForCompletion(true)\n);\n" + } + ], + "specification/ml/get_jobs/examples/request/MlGetJobsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.get_jobs(\n job_id=\"high_sum_total_sales\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.getJobs({\n job_id: \"high_sum_total_sales\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.get_jobs(\n job_id: \"high_sum_total_sales\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->getJobs([\n \"job_id\" => \"high_sum_total_sales\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/high_sum_total_sales\"" + }, + { + "language": "Java", + "code": "client.ml().getJobs(g -> g\n .jobId(\"high_sum_total_sales\")\n);\n" + } + ], + "specification/ml/get_model_snapshot_upgrade_stats/examples/request/MlGetModelSnapshotUpgradeStatsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.get_model_snapshot_upgrade_stats(\n job_id=\"low_request_rate\",\n snapshot_id=\"_all\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.getModelSnapshotUpgradeStats({\n job_id: \"low_request_rate\",\n snapshot_id: \"_all\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.get_model_snapshot_upgrade_stats(\n job_id: \"low_request_rate\",\n snapshot_id: \"_all\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->getModelSnapshotUpgradeStats([\n \"job_id\" => \"low_request_rate\",\n \"snapshot_id\" => \"_all\",\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.ml().getModelSnapshotUpgradeStats(g -> g\n .jobId(\"low_request_rate\")\n .snapshotId(\"_all\")\n);\n" + } + ], + "specification/ml/update_model_snapshot/examples/request/MlUpdateModelSnapshotExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.ml().updateModelSnapshot(u -> u\n .description(\"Snapshot 1\")\n .jobId(\"it_ops_new_logs\")\n .retain(true)\n .snapshotId(\"1491852978\")\n);\n" + } + ], + "specification/ml/put_calendar_job/examples/request/MlPutCalendarJobExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.put_calendar_job(\n calendar_id=\"planned-outages\",\n job_id=\"total-requests\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.putCalendarJob({\n calendar_id: \"planned-outages\",\n job_id: \"total-requests\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.put_calendar_job(\n calendar_id: \"planned-outages\",\n job_id: \"total-requests\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->putCalendarJob([\n \"calendar_id\" => \"planned-outages\",\n \"job_id\" => \"total-requests\",\n]);" + }, + { + "language": "curl", + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages/jobs/total-requests\"" + }, + { + "language": "Java", + "code": "client.ml().putCalendarJob(p -> p\n .calendarId(\"planned-outages\")\n .jobId(\"total-requests\")\n);\n" + } + ], + "specification/ml/estimate_model_memory/examples/request/MlEstimateModelMemoryRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.ml().estimateModelMemory(e -> e\n .analysisConfig(a -> a\n .bucketSpan(b -> b\n .time(\"5m\")\n )\n .detectors(d -> d\n .byFieldName(\"status\")\n .fieldName(\"bytes\")\n .function(\"sum\")\n .partitionFieldName(\"app\")\n )\n .influencers(List.of(\"source_ip\",\"dest_ip\"))\n )\n .maxBucketCardinality(Map.of(\"dest_ip\", 30L,\"source_ip\", 300L))\n .overallCardinality(Map.of(\"app\", 50L,\"status\", 10L))\n);\n" + } + ], + "specification/ml/get_categories/examples/request/MlGetCategoriesExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.get_categories(\n job_id=\"esxi_log\",\n page={\n \"size\": 1\n },\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.getCategories({\n job_id: \"esxi_log\",\n page: {\n size: 1,\n },\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.get_categories(\n job_id: \"esxi_log\",\n body: {\n \"page\": {\n \"size\": 1\n }\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->getCategories([\n \"job_id\" => \"esxi_log\",\n \"body\" => [\n \"page\" => [\n \"size\" => 1,\n ],\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.ml().getCategories(g -> g\n .jobId(\"esxi_log\")\n .page(p -> p\n .size(1)\n )\n);\n" + } + ], + "specification/ml/post_calendar_events/examples/request/MlPostCalendarEventsExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.ml().postCalendarEvents(p -> p\n .calendarId(\"planned-outages\")\n .events(List.of(CalendarEvent.of(c -> c\n .description(\"event 1\")\n .endTime(DateTime.ofEpochMilli(1513728000000L))\n .startTime(DateTime.ofEpochMilli(1513641600000L))),CalendarEvent.of(c -> c\n .description(\"event 2\")\n .endTime(DateTime.ofEpochMilli(1513900800000L))\n .startTime(DateTime.ofEpochMilli(1513814400000L))),CalendarEvent.of(c -> c\n .description(\"event 3\")\n .endTime(DateTime.ofEpochMilli(1514246400000L))\n .startTime(DateTime.ofEpochMilli(1514160000000L)))))\n);\n" + } + ], + "specification/ml/update_datafeed/examples/request/MlUpdateDatafeedExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.update_datafeed(\n datafeed_id=\"datafeed-test-job\",\n query={\n \"term\": {\n \"geo.src\": \"US\"\n }\n },\n)" + }, + { + "language": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.ml().updateDatafeed(u -> u\n .datafeedId(\"datafeed-test-job\")\n .query(q -> q\n .term(t -> t\n .field(\"geo.src\")\n .value(FieldValue.of(\"US\"))\n )\n )\n);\n" + } + ], + "specification/ml/put_job/examples/request/MlPutJobRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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_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": "Java", + "code": "client.ml().putJob(p -> p\n .analysisConfig(a -> a\n .bucketSpan(b -> b\n .time(\"15m\")\n )\n .detectors(d -> d\n .detectorDescription(\"Sum of bytes\")\n .fieldName(\"bytes\")\n .function(\"sum\")\n )\n )\n .analysisLimits(an -> an\n .modelMemoryLimit(\"11MB\")\n )\n .dataDescription(d -> d\n .timeField(\"timestamp\")\n .timeFormat(\"epoch_ms\")\n )\n .datafeedConfig(d -> d\n .datafeedId(\"datafeed-test-job1\")\n .indices(\"kibana_sample_data_logs\")\n .query(q -> q\n .bool(b -> b\n .must(m -> m\n .matchAll(ma -> ma)\n )\n )\n )\n .runtimeMappings(\"hour_of_day\", r -> r\n .script(s -> s\n .source(so -> so\n .scriptString(\"emit(doc['timestamp'].value.getHour());\")\n )\n )\n .type(RuntimeFieldType.Long)\n )\n )\n .jobId(\"job-01\")\n .modelPlotConfig(m -> m\n .annotationsEnabled(true)\n .enabled(true)\n )\n .resultsIndexName(\"test-job1\")\n);\n" + } + ], + "specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample5.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\":{\"regression\":{\"actual_field\":\"price\",\"predicted_field\":\"ml.price_prediction\",\"metrics\":{\"r_squared\":{},\"mse\":{},\"msle\":{},\"huber\":{}}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/_evaluate\"" + }, + { + "language": "Java", + "code": "client.ml().evaluateDataFrame(e -> e\n .evaluation(ev -> ev\n .regression(r -> r\n .actualField(\"price\")\n .predictedField(\"ml.price_prediction\")\n .metrics(m -> m\n .msle(ms -> ms)\n .huber(h -> h)\n )\n )\n )\n .index(\"house_price_predictions\")\n .query(q -> q\n .term(t -> t\n .field(\"ml.is_training\")\n .value(FieldValue.of(true))\n )\n )\n);\n" + } + ], + "specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample4.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.ml().evaluateDataFrame(e -> e\n .evaluation(ev -> ev\n .regression(r -> r\n .actualField(\"price\")\n .predictedField(\"ml.price_prediction\")\n .metrics(m -> m\n .msle(ms -> ms\n .offset(10.0D)\n )\n .huber(h -> h\n .delta(1.5D)\n )\n )\n )\n )\n .index(\"house_price_predictions\")\n .query(q -> q\n .bool(b -> b\n .filter(f -> f\n .term(t -> t\n .field(\"ml.is_training\")\n .value(FieldValue.of(false))\n )\n )\n )\n )\n);\n" + } + ], + "specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample3.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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_probability_field\":\"ml.outlier_score\"}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/_evaluate\"" + }, + { + "language": "Java", + "code": "client.ml().evaluateDataFrame(e -> e\n .evaluation(ev -> ev\n .outlierDetection(o -> o\n .actualField(\"is_outlier\")\n .predictedProbabilityField(\"ml.outlier_score\")\n )\n )\n .index(\"my_analytics_dest_index\")\n);\n" + } + ], + "specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\":{\"auc_roc\":{\"class_name\":\"dog\"}}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/_evaluate\"" + }, + { + "language": "Java", + "code": "client.ml().evaluateDataFrame(e -> e\n .evaluation(ev -> ev\n .classification(c -> c\n .actualField(\"animal_class\")\n .metrics(m -> m\n .aucRoc(a -> a\n .className(\"dog\")\n )\n )\n )\n )\n .index(\"animal_classification\")\n);\n" + } + ], + "specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.ml().evaluateDataFrame(e -> e\n .evaluation(ev -> ev\n .classification(c -> c\n .actualField(\"animal_class\")\n .predictedField(\"ml.animal_class_prediction\")\n .metrics(m -> m)\n )\n )\n .index(\"animal_classification\")\n);\n" + } + ], + "specification/ml/delete_forecast/examples/request/MlDeleteForecastExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.delete_forecast(\n job_id=\"total-requests\",\n forecast_id=\"_all\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.deleteForecast({\n job_id: \"total-requests\",\n forecast_id: \"_all\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.delete_forecast(\n job_id: \"total-requests\",\n forecast_id: \"_all\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->deleteForecast([\n \"job_id\" => \"total-requests\",\n \"forecast_id\" => \"_all\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/total-requests/_forecast/_all\"" + }, + { + "language": "Java", + "code": "client.ml().deleteForecast(d -> d\n .forecastId(\"_all\")\n .jobId(\"total-requests\")\n);\n" + } + ], + "specification/ml/get_trained_models/examples/request/MlGetTrainedModelsExample1.yaml": [ + { + "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/\"" + }, + { + "language": "Java", + "code": "client.ml().getTrainedModels(g -> g);\n" + } + ], + "specification/ml/get_trained_models_stats/examples/request/MlGetTrainedModelsStatsExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.ml().getTrainedModelsStats(g -> g);\n" + } + ], + "specification/ml/get_influencers/examples/request/MlGetInfluencersExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.get_influencers(\n job_id=\"high_sum_total_sales\",\n sort=\"influencer_score\",\n desc=True,\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.getInfluencers({\n job_id: \"high_sum_total_sales\",\n sort: \"influencer_score\",\n desc: true,\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "code": "$resp = $client->ml()->getInfluencers([\n \"job_id\" => \"high_sum_total_sales\",\n \"body\" => [\n \"sort\" => \"influencer_score\",\n \"desc\" => true,\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.ml().getInfluencers(g -> g\n .jobId(\"high_sum_total_sales\")\n);\n" + } + ], + "specification/ml/reset_job/examples/request/MlResetJobExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.reset_job(\n job_id=\"total-requests\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.resetJob({\n job_id: \"total-requests\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.reset_job(\n job_id: \"total-requests\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->resetJob([\n \"job_id\" => \"total-requests\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/total-requests/_reset\"" + }, + { + "language": "Java", + "code": "client.ml().resetJob(r -> r\n .jobId(\"total-requests\")\n);\n" + } + ], + "specification/ml/get_data_frame_analytics_stats/examples/request/MlGetDataFrameAnalyticsStatsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.get_data_frame_analytics_stats(\n id=\"weblog-outliers\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.getDataFrameAnalyticsStats({\n id: \"weblog-outliers\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.get_data_frame_analytics_stats(\n id: \"weblog-outliers\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->getDataFrameAnalyticsStats([\n \"id\" => \"weblog-outliers\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/weblog-outliers/_stats\"" + }, + { + "language": "Java", + "code": "client.ml().getDataFrameAnalyticsStats(g -> g\n .id(\"weblog-outliers\")\n);\n" + } + ], + "specification/ml/put_calendar/examples/request/MlPutCalendarExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.put_calendar(\n calendar_id=\"planned-outages\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.putCalendar({\n calendar_id: \"planned-outages\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.put_calendar(\n calendar_id: \"planned-outages\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->putCalendar([\n \"calendar_id\" => \"planned-outages\",\n]);" + }, + { + "language": "curl", + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages\"" + }, + { + "language": "Java", + "code": "client.ml().putCalendar(p -> p\n .calendarId(\"planned-outages\")\n);\n" + } + ], + "specification/ml/delete_filter/examples/request/MlDeleteFilterExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.delete_filter(\n filter_id=\"safe_domains\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.deleteFilter({\n filter_id: \"safe_domains\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.delete_filter(\n filter_id: \"safe_domains\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->deleteFilter([\n \"filter_id\" => \"safe_domains\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/filters/safe_domains\"" + }, + { + "language": "Java", + "code": "client.ml().deleteFilter(d -> d\n .filterId(\"safe_domains\")\n);\n" + } + ], + "specification/ml/update_filter/examples/request/MlUpdateFilterExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.ml().updateFilter(u -> u\n .addItems(\"*.myorg.com\")\n .description(\"Updated list of domains\")\n .filterId(\"safe_domains\")\n .removeItems(\"wikipedia.org\")\n);\n" + } + ], + "specification/ml/delete_expired_data/examples/request/MlDeleteExpiredDataExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.delete_expired_data(\n timeout=\"1h\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.deleteExpiredData({\n timeout: \"1h\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.delete_expired_data(\n timeout: \"1h\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->deleteExpiredData([\n \"timeout\" => \"1h\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/_delete_expired_data?timeout=1h\"" + }, + { + "language": "Java", + "code": "client.ml().deleteExpiredData(d -> d\n .timeout(t -> t\n .offset(1)\n )\n);\n" + } + ], + "specification/ml/clear_trained_model_deployment_cache/examples/request/MlClearTrainedModelDeploymentCacheExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.clear_trained_model_deployment_cache(\n model_id=\"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.clearTrainedModelDeploymentCache({\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.clear_trained_model_deployment_cache(\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->clearTrainedModelDeploymentCache([\n \"model_id\" => \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.ml().clearTrainedModelDeploymentCache(c -> c\n .modelId(\"elastic__distilbert-base-uncased-finetuned-conll03-english\")\n);\n" + } + ], + "specification/ml/delete_calendar/examples/request/MlDeleteCalendarExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.delete_calendar(\n calendar_id=\"planned-outages\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.deleteCalendar({\n calendar_id: \"planned-outages\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.delete_calendar(\n calendar_id: \"planned-outages\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->deleteCalendar([\n \"calendar_id\" => \"planned-outages\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages\"" + }, + { + "language": "Java", + "code": "client.ml().deleteCalendar(d -> d\n .calendarId(\"planned-outages\")\n);\n" + } + ], + "specification/ml/get_filters/examples/request/MlGetFiltersExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.get_filters(\n filter_id=\"safe_domains\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.getFilters({\n filter_id: \"safe_domains\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.get_filters(\n filter_id: \"safe_domains\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->getFilters([\n \"filter_id\" => \"safe_domains\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/filters/safe_domains\"" + }, + { + "language": "Java", + "code": "client.ml().getFilters(g -> g\n .filterId(\"safe_domains\")\n);\n" + } + ], + "specification/ml/put_trained_model_alias/examples/request/MlPutTrainedModelAliasExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.put_trained_model_alias(\n model_id=\"flight-delay-prediction-1574775339910\",\n model_alias=\"flight_delay_model\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.putTrainedModelAlias({\n model_id: \"flight-delay-prediction-1574775339910\",\n model_alias: \"flight_delay_model\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.put_trained_model_alias(\n model_id: \"flight-delay-prediction-1574775339910\",\n model_alias: \"flight_delay_model\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->putTrainedModelAlias([\n \"model_id\" => \"flight-delay-prediction-1574775339910\",\n \"model_alias\" => \"flight_delay_model\",\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.ml().putTrainedModelAlias(p -> p\n .modelAlias(\"flight_delay_model\")\n .modelId(\"flight-delay-prediction-1574775339910\")\n);\n" + } + ], + "specification/ml/update_trained_model_deployment/examples/request/MlUpdateTrainedModelDeploymentExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "code": "const response = await client.ml.updateTrainedModelDeployment({\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n number_of_allocations: 4,\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.ml().updateTrainedModelDeployment(u -> u\n .modelId(\"elastic__distilbert-base-uncased-finetuned-conll03-english\")\n .numberOfAllocations(4)\n);\n" + } + ], + "specification/ml/info/examples/request/MlInfoExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.ml().info();\n" + } + ], + "specification/ml/delete_job/examples/request/MlDeleteJobExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.delete_job(\n job_id=\"total-requests\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.deleteJob({\n job_id: \"total-requests\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.delete_job(\n job_id: \"total-requests\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->deleteJob([\n \"job_id\" => \"total-requests\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/total-requests\"" + }, + { + "language": "Java", + "code": "client.ml().deleteJob(d -> d\n .jobId(\"total-requests\")\n);\n" + } + ], + "specification/ml/get_buckets/examples/request/MlGetBucketsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.get_buckets(\n job_id=\"low_request_rate\",\n anomaly_score=80,\n start=\"1454530200001\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.getBuckets({\n job_id: \"low_request_rate\",\n anomaly_score: 80,\n start: 1454530200001,\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.get_buckets(\n job_id: \"low_request_rate\",\n body: {\n \"anomaly_score\": 80,\n \"start\": \"1454530200001\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->getBuckets([\n \"job_id\" => \"low_request_rate\",\n \"body\" => [\n \"anomaly_score\" => 80,\n \"start\" => \"1454530200001\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.ml().getBuckets(g -> g\n .anomalyScore(80.0D)\n .jobId(\"low_request_rate\")\n .start(DateTime.of(\"1454530200001\"))\n);\n" + } + ], + "specification/ml/start_trained_model_deployment/examples/request/MlStartTrainedModelDeploymentExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "code": "$resp = $client->ml()->startTrainedModelDeployment([\n \"model_id\" => \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n \"wait_for\" => \"started\",\n \"timeout\" => \"1m\",\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.ml().startTrainedModelDeployment(s -> s\n .modelId(\"elastic__distilbert-base-uncased-finetuned-conll03-english\")\n .timeout(t -> t\n .offset(1)\n )\n .waitFor(DeploymentAllocationState.Started)\n);\n" + } + ], + "specification/ml/delete_calendar_event/examples/request/MlDeleteCalendarEventExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.delete_calendar_event(\n calendar_id=\"planned-outages\",\n event_id=\"LS8LJGEBMTCMA-qz49st\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.deleteCalendarEvent({\n calendar_id: \"planned-outages\",\n event_id: \"LS8LJGEBMTCMA-qz49st\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.delete_calendar_event(\n calendar_id: \"planned-outages\",\n event_id: \"LS8LJGEBMTCMA-qz49st\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->deleteCalendarEvent([\n \"calendar_id\" => \"planned-outages\",\n \"event_id\" => \"LS8LJGEBMTCMA-qz49st\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages/events/LS8LJGEBMTCMA-qz49st\"" + }, + { + "language": "Java", + "code": "client.ml().deleteCalendarEvent(d -> d\n .calendarId(\"planned-outages\")\n .eventId(\"LS8LJGEBMTCMA-qz49st\")\n);\n" + } + ], + "specification/ml/get_records/examples/request/MlGetRecordsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.get_records(\n job_id=\"low_request_rate\",\n sort=\"record_score\",\n desc=True,\n start=\"1454944100000\",\n)" + }, + { + "language": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.ml().getRecords(g -> g\n .desc(true)\n .jobId(\"low_request_rate\")\n .sort(\"record_score\")\n .start(DateTime.of(\"1454944100000\"))\n);\n" + } + ], + "specification/ml/get_memory_stats/examples/request/MlGetMemoryStatsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.get_memory_stats(\n human=True,\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.getMemoryStats({\n human: \"true\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.get_memory_stats(\n human: \"true\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->getMemoryStats([\n \"human\" => \"true\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/memory/_stats?human\"" + }, + { + "language": "Java", + "code": "\n" + } + ], + "specification/ml/start_datafeed/examples/request/MlStartDatafeedExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.start_datafeed(\n datafeed_id=\"datafeed-low_request_rate\",\n start=\"2019-04-07T18:22:16Z\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.startDatafeed({\n datafeed_id: \"datafeed-low_request_rate\",\n start: \"2019-04-07T18:22:16Z\",\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "code": "$resp = $client->ml()->startDatafeed([\n \"datafeed_id\" => \"datafeed-low_request_rate\",\n \"body\" => [\n \"start\" => \"2019-04-07T18:22:16Z\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.ml().startDatafeed(s -> s\n .datafeedId(\"datafeed-low_request_rate\")\n .start(DateTime.of(\"2019-04-07T18:22:16Z\"))\n);\n" + } + ], + "specification/ml/explain_data_frame_analytics/examples/request/MlExplainDataFrameAnalyticsRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.ml().explainDataFrameAnalytics(e -> e\n .analysis(a -> a\n .regression(r -> r\n .dependentVariable(\"price\")\n )\n )\n .source(s -> s\n .index(\"houses_sold_last_10_yrs\")\n )\n);\n" + } + ], + "specification/ml/flush_job/examples/request/MlFlushJobExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.flush_job(\n job_id=\"low_request_rate\",\n calc_interim=True,\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.flushJob({\n job_id: \"low_request_rate\",\n calc_interim: true,\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.flush_job(\n job_id: \"low_request_rate\",\n body: {\n \"calc_interim\": true\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->flushJob([\n \"job_id\" => \"low_request_rate\",\n \"body\" => [\n \"calc_interim\" => true,\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.ml().flushJob(f -> f\n .calcInterim(true)\n .jobId(\"low_request_rate\")\n);\n" + } + ], + "specification/ml/get_model_snapshots/examples/request/MlGetModelSnapshotsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.get_model_snapshots(\n job_id=\"high_sum_total_sales\",\n start=\"1575402236000\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.getModelSnapshots({\n job_id: \"high_sum_total_sales\",\n start: 1575402236000,\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.get_model_snapshots(\n job_id: \"high_sum_total_sales\",\n body: {\n \"start\": \"1575402236000\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->getModelSnapshots([\n \"job_id\" => \"high_sum_total_sales\",\n \"body\" => [\n \"start\" => \"1575402236000\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.ml().getModelSnapshots(g -> g\n .jobId(\"high_sum_total_sales\")\n .start(DateTime.of(\"1575402236000\"))\n);\n" + } + ], + "specification/ml/set_upgrade_mode/examples/request/MlSetUpgradeModeExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.set_upgrade_mode(\n enabled=True,\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.setUpgradeMode({\n enabled: \"true\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.set_upgrade_mode(\n enabled: \"true\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->setUpgradeMode([\n \"enabled\" => \"true\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/set_upgrade_mode?enabled=true\"" + }, + { + "language": "Java", + "code": "client.ml().setUpgradeMode(s -> s\n .enabled(true)\n);\n" + } + ], + "specification/ml/update_data_frame_analytics/examples/request/MlUpdateDataFrameAnalyticsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.update_data_frame_analytics(\n id=\"loganalytics\",\n model_memory_limit=\"200mb\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.updateDataFrameAnalytics({\n id: \"loganalytics\",\n model_memory_limit: \"200mb\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.update_data_frame_analytics(\n id: \"loganalytics\",\n body: {\n \"model_memory_limit\": \"200mb\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->updateDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n \"body\" => [\n \"model_memory_limit\" => \"200mb\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.ml().updateDataFrameAnalytics(u -> u\n .id(\"loganalytics\")\n .modelMemoryLimit(\"200mb\")\n);\n" + } + ], + "specification/ml/delete_trained_model/examples/request/MlDeleteTrainedModelExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.delete_trained_model(\n model_id=\"regression-job-one-1574775307356\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.deleteTrainedModel({\n model_id: \"regression-job-one-1574775307356\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.delete_trained_model(\n model_id: \"regression-job-one-1574775307356\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->deleteTrainedModel([\n \"model_id\" => \"regression-job-one-1574775307356\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/regression-job-one-1574775307356\"" + }, + { + "language": "Java", + "code": "client.ml().deleteTrainedModel(d -> d\n .modelId(\"regression-job-one-1574775307356\")\n);\n" + } + ], + "specification/ml/get_overall_buckets/examples/request/MlGetOverallBucketsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.get_overall_buckets(\n job_id=\"job-*\",\n overall_score=80,\n start=\"1403532000000\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.getOverallBuckets({\n job_id: \"job-*\",\n overall_score: 80,\n start: 1403532000000,\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.get_overall_buckets(\n job_id: \"job-*\",\n body: {\n \"overall_score\": 80,\n \"start\": \"1403532000000\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->getOverallBuckets([\n \"job_id\" => \"job-*\",\n \"body\" => [\n \"overall_score\" => 80,\n \"start\" => \"1403532000000\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.ml().getOverallBuckets(g -> g\n .jobId(\"job-*\")\n .overallScore(\"80\")\n .start(DateTime.of(\"1403532000000\"))\n);\n" + } + ], + "specification/ml/preview_datafeed/examples/request/MlPreviewDatafeedExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.preview_datafeed(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.previewDatafeed({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.preview_datafeed(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->previewDatafeed([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales/_preview\"" + }, + { + "language": "Java", + "code": "client.ml().previewDatafeed(p -> p\n .datafeedId(\"datafeed-high_sum_total_sales\")\n);\n" + } + ], + "specification/ml/put_trained_model_vocabulary/examples/request/MlPutTrainedModelVocabularyExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "code": "const response = await client.ml.putTrainedModelVocabulary({\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n vocabulary: [\"[PAD]\", \"[unused0]\"],\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.ml().putTrainedModelVocabulary(p -> p\n .modelId(\"elastic__distilbert-base-uncased-finetuned-conll03-english\")\n .vocabulary(List.of(\"[PAD]\",\"[unused0]\"))\n);\n" + } + ], + "specification/ml/get_data_frame_analytics/examples/request/MlGetDataFrameAnalyticsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.get_data_frame_analytics(\n id=\"loganalytics\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.getDataFrameAnalytics({\n id: \"loganalytics\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.get_data_frame_analytics(\n id: \"loganalytics\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->getDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics\"" + }, + { + "language": "Java", + "code": "client.ml().getDataFrameAnalytics(g -> g\n .id(\"loganalytics\")\n);\n" + } + ], + "specification/ml/delete_trained_model_alias/examples/request/MlDeleteTrainedModelAliasExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.delete_trained_model_alias(\n model_id=\"flight-delay-prediction-1574775339910\",\n model_alias=\"flight_delay_model\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.deleteTrainedModelAlias({\n model_id: \"flight-delay-prediction-1574775339910\",\n model_alias: \"flight_delay_model\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.delete_trained_model_alias(\n model_id: \"flight-delay-prediction-1574775339910\",\n model_alias: \"flight_delay_model\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->deleteTrainedModelAlias([\n \"model_id\" => \"flight-delay-prediction-1574775339910\",\n \"model_alias\" => \"flight_delay_model\",\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.ml().deleteTrainedModelAlias(d -> d\n .modelAlias(\"flight_delay_model\")\n .modelId(\"flight-delay-prediction-1574775339910\")\n);\n" + } + ], + "specification/ml/revert_model_snapshot/examples/request/MlRevertModelSnapshotExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.revert_model_snapshot(\n job_id=\"low_request_rate\",\n snapshot_id=\"1637092688\",\n delete_intervening_results=True,\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.revertModelSnapshot({\n job_id: \"low_request_rate\",\n snapshot_id: 1637092688,\n delete_intervening_results: true,\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.ml().revertModelSnapshot(r -> r\n .deleteInterveningResults(true)\n .jobId(\"low_request_rate\")\n .snapshotId(\"1637092688\")\n);\n" + } + ], + "specification/ml/close_job/examples/request/MlCloseJobExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.close_job(\n job_id=\"low_request_rate\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.closeJob({\n job_id: \"low_request_rate\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.close_job(\n job_id: \"low_request_rate\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->closeJob([\n \"job_id\" => \"low_request_rate\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_close\"" + }, + { + "language": "Java", + "code": "client.ml().closeJob(c -> c\n .jobId(\"low_request_rate\")\n);\n" + } + ], + "specification/ml/put_trained_model_definition_part/examples/request/MlPutTrainedModelDefinitionPartExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + } + ], + "specification/ml/put_data_frame_analytics/examples/request/MlPutDataFrameAnalyticsExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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_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": "Java", + "code": "client.ml().putDataFrameAnalytics(p -> p\n .analysis(a -> a\n .regression(r -> r\n .dependentVariable(\"FlightDelayMin\")\n .trainingPercent(\"90\")\n )\n )\n .analyzedFields(an -> an\n .excludes(\"FlightNum\")\n )\n .dest(d -> d\n .index(\"df-flight-delays\")\n .resultsField(\"ml-results\")\n )\n .id(\"model-flight-delays-pre\")\n .modelMemoryLimit(\"100mb\")\n .source(s -> s\n .index(\"kibana_sample_data_flights\")\n .query(q -> q\n .range(r -> r\n .untyped(u -> u\n .field(\"DistanceKilometers\")\n .gt(JsonData.fromJson(\"0\"))\n )\n )\n )\n .source(so -> so\n .excludes(List.of(\"FlightDelay\",\"FlightDelayType\"))\n )\n )\n);\n" + } + ], + "specification/ml/delete_data_frame_analytics/examples/request/MlDeleteDataFrameAnalyticsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.delete_data_frame_analytics(\n id=\"loganalytics\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.deleteDataFrameAnalytics({\n id: \"loganalytics\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.delete_data_frame_analytics(\n id: \"loganalytics\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->deleteDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics\"" + }, + { + "language": "Java", + "code": "client.ml().deleteDataFrameAnalytics(d -> d\n .id(\"loganalytics\")\n);\n" + } + ], + "specification/ml/preview_data_frame_analytics/examples/request/MlPreviewDataFrameAnalyticsExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.ml().previewDataFrameAnalytics(p -> p\n .config(c -> c\n .source(s -> s\n .index(\"houses_sold_last_10_yrs\")\n )\n .analysis(a -> a\n .regression(r -> r\n .dependentVariable(\"price\")\n )\n )\n )\n);\n" + } + ], + "specification/ml/put_filter/examples/request/MlPutFilterExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.ml().putFilter(p -> p\n .description(\"A list of safe domains\")\n .filterId(\"safe_domains\")\n .items(List.of(\"*.google.com\",\"wikipedia.org\"))\n);\n" + } + ], + "specification/ml/start_data_frame_analytics/examples/request/MlStartDataFrameAnalyticsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.start_data_frame_analytics(\n id=\"loganalytics\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.startDataFrameAnalytics({\n id: \"loganalytics\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.start_data_frame_analytics(\n id: \"loganalytics\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->startDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics/_start\"" + }, + { + "language": "Java", + "code": "client.ml().startDataFrameAnalytics(s -> s\n .id(\"loganalytics\")\n);\n" + } + ], + "specification/ml/get_calendars/examples/request/MlGetCalendarsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.get_calendars(\n calendar_id=\"planned-outages\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.getCalendars({\n calendar_id: \"planned-outages\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.get_calendars(\n calendar_id: \"planned-outages\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->getCalendars([\n \"calendar_id\" => \"planned-outages\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/calendars/planned-outages\"" + }, + { + "language": "Java", + "code": "client.ml().getCalendars(g -> g\n .calendarId(\"planned-outages\")\n);\n" + } + ], + "specification/ml/get_job_stats/examples/request/MlGetJobStatsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.get_job_stats(\n job_id=\"low_request_rate\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.getJobStats({\n job_id: \"low_request_rate\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.get_job_stats(\n job_id: \"low_request_rate\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->getJobStats([\n \"job_id\" => \"low_request_rate\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_stats\"" + }, + { + "language": "Java", + "code": "client.ml().getJobStats(g -> g\n .jobId(\"low_request_rate\")\n);\n" + } + ], + "specification/ml/open_job/examples/request/MlOpenJobRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ml.open_job(\n job_id=\"job-01\",\n timeout=\"35m\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ml.openJob({\n job_id: \"job-01\",\n timeout: \"35m\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ml.open_job(\n job_id: \"job-01\",\n body: {\n \"timeout\": \"35m\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ml()->openJob([\n \"job_id\" => \"job-01\",\n \"body\" => [\n \"timeout\" => \"35m\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.ml().openJob(o -> o\n .jobId(\"job-01\")\n .timeout(t -> t\n .time(\"35m\")\n )\n);\n" + } + ], + "specification/text_structure/test_grok_pattern/examples/request/TestGrokPatternRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.textStructure().testGrokPattern(t -> t\n .grokPattern(\"Hello %{WORD:first_name} %{WORD:last_name}\")\n .text(List.of(\"Hello John Doe\",\"this does not match\"))\n);\n" + } + ], + "specification/text_structure/find_structure/examples/request/FindStructureRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + } + ], + "specification/text_structure/find_field_structure/examples/request/FindFieldStructureRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.text_structure.find_field_structure(\n index=\"test-logs\",\n field=\"message\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.textStructure.findFieldStructure({\n index: \"test-logs\",\n field: \"message\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.text_structure.find_field_structure(\n index: \"test-logs\",\n field: \"message\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->textStructure()->findFieldStructure([\n \"index\" => \"test-logs\",\n \"field\" => \"message\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_text_structure/find_field_structure?index=test-logs&field=message\"" + }, + { + "language": "Java", + "code": "client.textStructure().findFieldStructure(f -> f\n .field(\"message\")\n .index(\"test-logs\")\n);\n" + } + ], + "specification/text_structure/find_message_structure/examples/request/FindMessageStructureRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.textStructure().findMessageStructure(f -> f\n .messages(List.of(\"[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 ...\"))\n);\n" + } + ], + "specification/rollup/get_rollup_index_caps/examples/request/GetRollupIndexCapabilitiesRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.rollup.get_rollup_index_caps(\n index=\"sensor_rollup\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.rollup.getRollupIndexCaps({\n index: \"sensor_rollup\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.rollup.get_rollup_index_caps(\n index: \"sensor_rollup\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->rollup()->getRollupIndexCaps([\n \"index\" => \"sensor_rollup\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/sensor_rollup/_rollup/data\"" + }, + { + "language": "Java", + "code": "client.rollup().getRollupIndexCaps(g -> g\n .index(\"sensor_rollup\")\n);\n" + } + ], + "specification/rollup/get_jobs/examples/request/GetRollupJobRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.rollup.get_jobs(\n id=\"sensor\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.rollup.getJobs({\n id: \"sensor\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.rollup.get_jobs(\n id: \"sensor\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->rollup()->getJobs([\n \"id\" => \"sensor\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_rollup/job/sensor\"" + }, + { + "language": "Java", + "code": "client.rollup().getJobs(g -> g\n .id(\"sensor\")\n);\n" + } + ], + "specification/rollup/stop_job/examples/request/RollupStopJobExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.rollup.stop_job(\n id=\"sensor\",\n wait_for_completion=True,\n timeout=\"10s\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.rollup.stopJob({\n id: \"sensor\",\n wait_for_completion: \"true\",\n timeout: \"10s\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.rollup.stop_job(\n id: \"sensor\",\n wait_for_completion: \"true\",\n timeout: \"10s\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->rollup()->stopJob([\n \"id\" => \"sensor\",\n \"wait_for_completion\" => \"true\",\n \"timeout\" => \"10s\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s\"" + }, + { + "language": "Java", + "code": "client.rollup().stopJob(s -> s\n .id(\"sensor\")\n .timeout(t -> t\n .offset(10)\n )\n .waitForCompletion(true)\n);\n" + } + ], + "specification/rollup/get_rollup_caps/examples/request/GetRollupCapabilitiesRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.rollup.get_rollup_caps(\n id=\"sensor-*\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.rollup.getRollupCaps({\n id: \"sensor-*\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.rollup.get_rollup_caps(\n id: \"sensor-*\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->rollup()->getRollupCaps([\n \"id\" => \"sensor-*\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_rollup/data/sensor-*\"" + }, + { + "language": "Java", + "code": "client.rollup().getRollupCaps(g -> g\n .id(\"sensor-*\")\n);\n" + } + ], + "specification/rollup/rollup_search/examples/request/RollupSearchRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.rollup().rollupSearch(r -> r\n .aggregations(\"max_temperature\", a -> a\n .max(m -> m\n .field(\"temperature\")\n )\n )\n .index(\"sensor_rollup\")\n .size(0)\n);\n" + } + ], + "specification/rollup/put_job/examples/request/CreateRollupJobRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.rollup().putJob(p -> p\n .cron(\"*/30 * * * * ?\")\n .groups(g -> g\n .dateHistogram(d -> d\n .delay(de -> de\n .time(\"7d\")\n )\n .field(\"timestamp\")\n .fixedInterval(f -> f\n .time(\"1h\")\n )\n )\n .terms(t -> t\n .fields(\"node\")\n )\n )\n .id(\"sensor\")\n .indexPattern(\"sensor-*\")\n .metrics(List.of(FieldMetric.of(f -> f\n .field(\"temperature\")\n .metrics(List.of(Metric.Min,Metric.Max,Metric.Sum))),FieldMetric.of(f -> f\n .field(\"voltage\")\n .metrics(Metric.Avg))))\n .pageSize(1000)\n .rollupIndex(\"sensor_rollup\")\n);\n" + } + ], + "specification/rollup/delete_job/examples/request/DeleteRollupJobRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.rollup.delete_job(\n id=\"sensor\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.rollup.deleteJob({\n id: \"sensor\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.rollup.delete_job(\n id: \"sensor\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->rollup()->deleteJob([\n \"id\" => \"sensor\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_rollup/job/sensor\"" + }, + { + "language": "Java", + "code": "client.rollup().deleteJob(d -> d\n .id(\"sensor\")\n);\n" + } + ], + "specification/rollup/start_job/examples/request/StartRollupJobRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.rollup.start_job(\n id=\"sensor\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.rollup.startJob({\n id: \"sensor\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.rollup.start_job(\n id: \"sensor\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->rollup()->startJob([\n \"id\" => \"sensor\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_rollup/job/sensor/_start\"" + }, + { + "language": "Java", + "code": "client.rollup().startJob(s -> s\n .id(\"sensor\")\n);\n" + } + ], + "specification/connector/update_service_type/examples/request/ConnectorUpdateServiceTypeRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.connector.update_service_type(\n connector_id=\"my-connector\",\n service_type=\"sharepoint_online\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.connector.updateServiceType({\n connector_id: \"my-connector\",\n service_type: \"sharepoint_online\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.connector.update_service_type(\n connector_id: \"my-connector\",\n body: {\n \"service_type\": \"sharepoint_online\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->connector()->updateServiceType([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"service_type\" => \"sharepoint_online\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.connector().updateServiceType(u -> u\n .connectorId(\"my-connector\")\n .serviceType(\"sharepoint_online\")\n);\n" + } + ], + "specification/connector/update_scheduling/examples/request/ConnectorUpdateSchedulingRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.connector().updateScheduling(u -> u\n .connectorId(\"my-connector\")\n .scheduling(s -> s\n .full(f -> f\n .enabled(true)\n .interval(\"0 10 0 * * ?\")\n )\n )\n);\n" + } + ], + "specification/connector/update_scheduling/examples/request/ConnectorUpdateSchedulingRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.connector().updateScheduling(u -> u\n .connectorId(\"my-connector\")\n .scheduling(s -> s\n .accessControl(a -> a\n .enabled(true)\n .interval(\"0 10 0 * * ?\")\n )\n .full(f -> f\n .enabled(true)\n .interval(\"0 20 0 * * ?\")\n )\n .incremental(i -> i\n .enabled(false)\n .interval(\"0 30 0 * * ?\")\n )\n )\n);\n" + } + ], + "specification/connector/update_pipeline/examples/request/ConnectorUpdatePipelineRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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_inference\":true}}' \"$ELASTICSEARCH_URL/_connector/my-connector/_pipeline\"" + }, + { + "language": "Java", + "code": "client.connector().updatePipeline(u -> u\n .connectorId(\"my-connector\")\n .pipeline(p -> p\n .extractBinaryContent(true)\n .name(\"my-connector-pipeline\")\n .reduceWhitespace(true)\n .runMlInference(true)\n )\n);\n" + } + ], + "specification/connector/sync_job_get/examples/request/ConnectorSyncJobGetExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.connector.sync_job_get(\n connector_sync_job_id=\"my-connector-sync-job\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.connector.syncJobGet({\n connector_sync_job_id: \"my-connector-sync-job\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.connector.sync_job_get(\n connector_sync_job_id: \"my-connector-sync-job\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->connector()->syncJobGet([\n \"connector_sync_job_id\" => \"my-connector-sync-job\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job\"" + }, + { + "language": "Java", + "code": "client.connector().syncJobGet(s -> s\n .connectorSyncJobId(\"my-connector-sync-job\")\n);\n" + } + ], + "specification/connector/sync_job_update_stats/examples/request/ConnectorSyncJobUpdateStatsExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.connector().syncJobUpdateStats(s -> s\n .connectorSyncJobId(\"my-connector-sync-job\")\n .deletedDocumentCount(10L)\n .indexedDocumentCount(20L)\n .indexedDocumentVolume(1000L)\n .lastSeen(l -> l\n .time(\"2023-01-02T10:00:00Z\")\n )\n .totalDocumentCount(2000)\n);\n" + } + ], + "specification/connector/sync_job_post/examples/request/SyncJobPostRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.connector.sync_job_post(\n id=\"connector-id\",\n job_type=\"full\",\n trigger_method=\"on_demand\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.connector.syncJobPost({\n id: \"connector-id\",\n job_type: \"full\",\n trigger_method: \"on_demand\",\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "code": "$resp = $client->connector()->syncJobPost([\n \"body\" => [\n \"id\" => \"connector-id\",\n \"job_type\" => \"full\",\n \"trigger_method\" => \"on_demand\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.connector().syncJobPost(s -> s\n .id(\"connector-id\")\n .jobType(SyncJobType.Full)\n .triggerMethod(SyncJobTriggerMethod.OnDemand)\n);\n" + } + ], + "specification/connector/delete/examples/request/ConnectorDeleteExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.connector.delete(\n connector_id=\"my-connector-id&delete_sync_jobs=true\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.connector.delete({\n connector_id: \"my-connector-id&delete_sync_jobs=true\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.connector.delete(\n connector_id: \"my-connector-id&delete_sync_jobs=true\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->connector()->delete([\n \"connector_id\" => \"my-connector-id&delete_sync_jobs=true\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/my-connector-id&delete_sync_jobs=true\"" + }, + { + "language": "Java", + "code": "client.connector().delete(d -> d\n .connectorId(\"my-connector-id&delete_sync_jobs=true\")\n);\n" + } + ], + "specification/connector/put/examples/request/ConnectorPutRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.connector().put(p -> p\n .connectorId(\"my-connector\")\n .description(\"My Connector to sync data to Elastic index from Google Drive\")\n .indexName(\"search-google-drive\")\n .language(\"english\")\n .name(\"My Connector\")\n .serviceType(\"google_drive\")\n);\n" + } + ], + "specification/connector/put/examples/request/ConnectorPutRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.connector().put(p -> p\n .connectorId(\"my-connector\")\n .indexName(\"search-google-drive\")\n .name(\"My Connector\")\n .serviceType(\"google_drive\")\n);\n" + } + ], + "specification/connector/update_features/examples/request/ConnectorUpdateFeaturesRequestExample2.yaml": [ + { + "language": "Python", + "code": "resp = client.connector.update_features(\n connector_id=\"my-connector\",\n features={\n \"document_level_security\": {\n \"enabled\": True\n }\n },\n)" + }, + { + "language": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.connector().updateFeatures(u -> u\n .connectorId(\"my-connector\")\n .features(f -> f\n .documentLevelSecurity(d -> d\n .enabled(true)\n )\n )\n);\n" + } + ], + "specification/connector/update_features/examples/request/ConnectorUpdateFeaturesRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\":{\"advanced\":{\"enabled\":false},\"basic\":{\"enabled\":true}}}}' \"$ELASTICSEARCH_URL/_connector/my-connector/_features\"" + }, + { + "language": "Java", + "code": "client.connector().updateFeatures(u -> u\n .connectorId(\"my-connector\")\n .features(f -> f\n .documentLevelSecurity(d -> d\n .enabled(true)\n )\n .incrementalSync(i -> i\n .enabled(true)\n )\n .syncRules(s -> s\n .advanced(a -> a\n .enabled(false)\n )\n .basic(b -> b\n .enabled(true)\n )\n )\n )\n);\n" + } + ], + "specification/connector/update_configuration/examples/request/ConnectorUpdateConfigurationRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.connector().updateConfiguration(u -> u\n .connectorId(\"my-spo-connector\")\n .values(Map.of(\"tenant_id\", JsonData.fromJson(\"\\\"my-tenant-id\\\"\"),\"tenant_name\", JsonData.fromJson(\"\\\"my-sharepoint-site\\\"\"),\"secret_value\", JsonData.fromJson(\"\\\"bar\\\"\"),\"client_id\", JsonData.fromJson(\"\\\"foo\\\"\"),\"site_collections\", JsonData.fromJson(\"\\\"*\\\"\")))\n);\n" + } + ], + "specification/connector/update_configuration/examples/request/ConnectorUpdateConfigurationRequestExample2.yaml": [ + { + "language": "Python", + "code": "resp = client.connector.update_configuration(\n connector_id=\"my-spo-connector\",\n values={\n \"secret_value\": \"foo-bar\"\n },\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.connector.updateConfiguration({\n connector_id: \"my-spo-connector\",\n values: {\n secret_value: \"foo-bar\",\n },\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "code": "$resp = $client->connector()->updateConfiguration([\n \"connector_id\" => \"my-spo-connector\",\n \"body\" => [\n \"values\" => [\n \"secret_value\" => \"foo-bar\",\n ],\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.connector().updateConfiguration(u -> u\n .connectorId(\"my-spo-connector\")\n .values(\"secret_value\", JsonData.fromJson(\"\\\"foo-bar\\\"\"))\n);\n" + } + ], + "specification/connector/sync_job_check_in/examples/request/ConnectorSyncJobCheckInExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.connector.sync_job_check_in(\n connector_sync_job_id=\"my-connector-sync-job\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.connector.syncJobCheckIn({\n connector_sync_job_id: \"my-connector-sync-job\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.connector.sync_job_check_in(\n connector_sync_job_id: \"my-connector-sync-job\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->connector()->syncJobCheckIn([\n \"connector_sync_job_id\" => \"my-connector-sync-job\",\n]);" + }, + { + "language": "curl", + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job/_check_in\"" + }, + { + "language": "Java", + "code": "client.connector().syncJobCheckIn(s -> s\n .connectorSyncJobId(\"my-connector-sync-job\")\n);\n" + } + ], + "specification/connector/get/examples/request/ConnectorGetExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.connector.get(\n connector_id=\"my-connector-id\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.connector.get({\n connector_id: \"my-connector-id\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.connector.get(\n connector_id: \"my-connector-id\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->connector()->get([\n \"connector_id\" => \"my-connector-id\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/my-connector-id\"" + }, + { + "language": "Java", + "code": "client.connector().get(g -> g\n .connectorId(\"my-connector-id\")\n);\n" + } + ], + "specification/connector/sync_job_error/examples/request/SyncJobErrorRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.connector.sync_job_error(\n connector_sync_job_id=\"my-connector-sync-job\",\n error=\"some-error\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.connector.syncJobError({\n connector_sync_job_id: \"my-connector-sync-job\",\n error: \"some-error\",\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "code": "$resp = $client->connector()->syncJobError([\n \"connector_sync_job_id\" => \"my-connector-sync-job\",\n \"body\" => [\n \"error\" => \"some-error\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.connector().syncJobError(s -> s\n .connectorSyncJobId(\"my-connector-sync-job\")\n .error(\"some-error\")\n);\n" + } + ], + "specification/connector/sync_job_claim/examples/request/ConnectorSyncJobClaimExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.connector.sync_job_claim(\n connector_sync_job_id=\"my-connector-sync-job-id\",\n worker_hostname=\"some-machine\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.connector.syncJobClaim({\n connector_sync_job_id: \"my-connector-sync-job-id\",\n worker_hostname: \"some-machine\",\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.connector().syncJobClaim(s -> s\n .connectorSyncJobId(\"my-connector-sync-job-id\")\n .workerHostname(\"some-machine\")\n);\n" + } + ], + "specification/connector/list/examples/request/ConnectorListExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.connector().list(l -> l);\n" + } + ], + "specification/connector/update_error/examples/request/ConnectorUpdateErrorRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.connector.update_error(\n connector_id=\"my-connector\",\n error=\"Houston, we have a problem!\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.connector.updateError({\n connector_id: \"my-connector\",\n error: \"Houston, we have a problem!\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.connector.update_error(\n connector_id: \"my-connector\",\n body: {\n \"error\": \"Houston, we have a problem!\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->connector()->updateError([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"error\" => \"Houston, we have a problem!\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.connector().updateError(u -> u\n .connectorId(\"my-connector\")\n .error(\"Houston, we have a problem!\")\n);\n" + } + ], + "specification/connector/sync_job_list/examples/request/ConnectorSyncJobListExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.connector.sync_job_list(\n connector_id=\"my-connector-id\",\n size=\"1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.connector.syncJobList({\n connector_id: \"my-connector-id\",\n size: 1,\n});" + }, + { + "language": "Ruby", + "code": "response = client.connector.sync_job_list(\n connector_id: \"my-connector-id\",\n size: \"1\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->connector()->syncJobList([\n \"connector_id\" => \"my-connector-id\",\n \"size\" => \"1\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/_sync_job?connector_id=my-connector-id&size=1\"" + }, + { + "language": "Java", + "code": "client.connector().syncJobList(s -> s\n .connectorId(\"my-connector-id\")\n .size(1)\n);\n" + } + ], + "specification/connector/update_index_name/examples/request/ConnectorUpdateIndexNameRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.connector.update_index_name(\n connector_id=\"my-connector\",\n index_name=\"data-from-my-google-drive\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.connector.updateIndexName({\n connector_id: \"my-connector\",\n index_name: \"data-from-my-google-drive\",\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "code": "$resp = $client->connector()->updateIndexName([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"index_name\" => \"data-from-my-google-drive\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.connector().updateIndexName(u -> u\n .connectorId(\"my-connector\")\n .indexName(\"data-from-my-google-drive\")\n);\n" + } + ], + "specification/connector/update_api_key_id/examples/request/ConnectorUpdateApiKeyIDRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.connector().updateApiKeyId(u -> u\n .apiKeyId(\"my-api-key-id\")\n .apiKeySecretId(\"my-connector-secret-id\")\n .connectorId(\"my-connector\")\n);\n" + } + ], + "specification/connector/check_in/examples/request/ConnectorCheckInExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.connector.check_in(\n connector_id=\"my-connector\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.connector.checkIn({\n connector_id: \"my-connector\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.connector.check_in(\n connector_id: \"my-connector\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->connector()->checkIn([\n \"connector_id\" => \"my-connector\",\n]);" + }, + { + "language": "curl", + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/my-connector/_check_in\"" + }, + { + "language": "Java", + "code": "client.connector().checkIn(c -> c\n .connectorId(\"my-connector\")\n);\n" + } + ], + "specification/connector/update_status/examples/request/ConnectorUpdateStatusRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.connector.update_status(\n connector_id=\"my-connector\",\n status=\"needs_configuration\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.connector.updateStatus({\n connector_id: \"my-connector\",\n status: \"needs_configuration\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.connector.update_status(\n connector_id: \"my-connector\",\n body: {\n \"status\": \"needs_configuration\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->connector()->updateStatus([\n \"connector_id\" => \"my-connector\",\n \"body\" => [\n \"status\" => \"needs_configuration\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.connector().updateStatus(u -> u\n .connectorId(\"my-connector\")\n .status(ConnectorStatus.NeedsConfiguration)\n);\n" + } + ], + "specification/connector/sync_job_cancel/examples/request/ConnectorSyncJobCancelExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.connector.sync_job_cancel(\n connector_sync_job_id=\"my-connector-sync-job-id\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.connector.syncJobCancel({\n connector_sync_job_id: \"my-connector-sync-job-id\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.connector.sync_job_cancel(\n connector_sync_job_id: \"my-connector-sync-job-id\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->connector()->syncJobCancel([\n \"connector_sync_job_id\" => \"my-connector-sync-job-id\",\n]);" + }, + { + "language": "curl", + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job-id/_cancel\"" + }, + { + "language": "Java", + "code": "client.connector().syncJobCancel(s -> s\n .connectorSyncJobId(\"my-connector-sync-job-id\")\n);\n" + } + ], + "specification/connector/sync_job_delete/examples/request/ConnectorSyncJobDeleteExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.connector.sync_job_delete(\n connector_sync_job_id=\"my-connector-sync-job-id\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.connector.syncJobDelete({\n connector_sync_job_id: \"my-connector-sync-job-id\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.connector.sync_job_delete(\n connector_sync_job_id: \"my-connector-sync-job-id\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->connector()->syncJobDelete([\n \"connector_sync_job_id\" => \"my-connector-sync-job-id\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_connector/_sync_job/my-connector-sync-job-id\"" + }, + { + "language": "Java", + "code": "client.connector().syncJobDelete(s -> s\n .connectorSyncJobId(\"my-connector-sync-job-id\")\n);\n" + } + ], + "specification/connector/update_name/examples/request/ConnectorUpdateNameRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.connector.update_name(\n connector_id=\"my-connector\",\n name=\"Custom connector\",\n description=\"This is my customized connector\",\n)" + }, + { + "language": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.connector().updateName(u -> u\n .connectorId(\"my-connector\")\n .description(\"This is my customized connector\")\n .name(\"Custom connector\")\n);\n" + } + ], + "specification/connector/last_sync/examples/request/ConnectorUpdateLastSyncRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\":\"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\"" + } + ], + "specification/connector/update_filtering/examples/request/ConnectorUpdateFilteringRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.connector().updateFiltering(u -> u\n .advancedSnippet(a -> a\n .value(JsonData.fromJson(\"[{\\\"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\\\"}]\"))\n )\n .connectorId(\"my-sql-connector\")\n);\n" + } + ], + "specification/connector/update_filtering/examples/request/ConnectorUpdateFilteringRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.connector().updateFiltering(u -> u\n .connectorId(\"my-g-drive-connector\")\n .rules(List.of(FilteringRule.of(f -> f\n .field(\"file_extension\")\n .id(\"exclude-txt-files\")\n .order(0)\n .policy(FilteringPolicy.Exclude)\n .rule(FilteringRuleRule.Equals)\n .value(\"txt\")),FilteringRule.of(f -> f\n .field(\"_\")\n .id(\"DEFAULT\")\n .order(1)\n .policy(FilteringPolicy.Include)\n .rule(FilteringRuleRule.Regex)\n .value(\".*\"))))\n);\n" + } + ], + "specification/inference/put_mistral/examples/request/PutMistralRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"mistral-embeddings-test\")\n .taskType(TaskType.TextEmbedding)\n .inferenceConfig(i -> i\n .service(\"mistral\")\n .serviceSettings(JsonData.fromJson(\"{\\\"api_key\\\":\\\"Mistral-API-Key\\\",\\\"model\\\":\\\"mistral-embed\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().chatCompletionUnified(c -> c\n .inferenceId(\"openai-completion\")\n .chatCompletionRequest(ch -> ch\n .messages(m -> m\n .content(co -> co\n .string(\"What is Elastic?\")\n )\n .role(\"user\")\n )\n .model(\"gpt-4o\")\n )\n);\n" + } + ], + "specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample3.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().chatCompletionUnified(c -> c\n .inferenceId(\"openai-completion\")\n .chatCompletionRequest(ch -> ch\n .messages(m -> m\n .content(co -> co\n .string(\"What's the price of a scarf?\")\n )\n .role(\"user\")\n )\n .toolChoice(t -> t\n .object(o -> o\n .type(\"function\")\n .function(f -> f\n .name(\"get_current_price\")\n )\n )\n )\n .tools(to -> to\n .type(\"function\")\n .function(f -> f\n .description(\"Get the current price of a item\")\n .name(\"get_current_price\")\n .parameters(JsonData.fromJson(\"{\\\"type\\\":\\\"object\\\",\\\"properties\\\":{\\\"item\\\":{\\\"id\\\":\\\"123\\\"}}}\"))\n )\n )\n )\n);\n" + } + ], + "specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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_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": "Java", + "code": "client.inference().chatCompletionUnified(c -> c\n .inferenceId(\"openai-completion\")\n .chatCompletionRequest(ch -> ch\n .messages(List.of(Message.of(m -> m\n .content(co -> co\n .string(\"Let's find out what the weather is\")\n )\n .role(\"assistant\")\n .toolCalls(t -> t\n .id(\"call_KcAjWtAww20AihPHphUh46Gd\")\n .function(f -> f\n .arguments(\"{\\\"location\\\":\\\"Boston, MA\\\"}\")\n .name(\"get_current_weather\")\n )\n .type(\"function\")\n )),Message.of(me -> me\n .content(co -> co\n .string(\"The weather is cold\")\n )\n .role(\"tool\")\n .toolCallId(\"call_KcAjWtAww20AihPHphUh46Gd\"))))\n )\n);\n" + } + ], + "specification/inference/text_embedding/examples/request/TextEmbeddingRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().textEmbedding(t -> t\n .inferenceId(\"my-cohere-endpoint\")\n .input(\"The sky above the port was the color of television tuned to a dead channel.\")\n .taskSettings(JsonData.fromJson(\"{\\\"input_type\\\":\\\"ingest\\\"}\"))\n);\n" + } + ], + "specification/inference/put_jinaai/examples/request/PutJinaAiRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"jinaai-embeddings\")\n .taskType(TaskType.TextEmbedding)\n .inferenceConfig(i -> i\n .service(\"jinaai\")\n .serviceSettings(JsonData.fromJson(\"{\\\"model_id\\\":\\\"jina-embeddings-v3\\\",\\\"api_key\\\":\\\"JinaAi-Api-key\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/put_jinaai/examples/request/PutJinaAiRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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-multilingual\"},\"task_settings\":{\"top_n\":10,\"return_documents\":true}}' \"$ELASTICSEARCH_URL/_inference/rerank/jinaai-rerank\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"jinaai-rerank\")\n .taskType(TaskType.Rerank)\n .inferenceConfig(i -> i\n .service(\"jinaai\")\n .serviceSettings(JsonData.fromJson(\"{\\\"api_key\\\":\\\"JinaAI-Api-key\\\",\\\"model_id\\\":\\\"jina-reranker-v2-base-multilingual\\\"}\"))\n .taskSettings(JsonData.fromJson(\"{\\\"top_n\\\":10,\\\"return_documents\\\":true}\"))\n )\n);\n" + } + ], + "specification/inference/update/examples/request/InferenceUpdateExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.inference.update(\n inference_id=\"my-inference-endpoint\",\n inference_config={\n \"service_settings\": {\n \"api_key\": \"\"\n }\n },\n)" + }, + { + "language": "JavaScript", + "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": "Ruby", + "code": "response = client.inference.update(\n inference_id: \"my-inference-endpoint\",\n body: {\n \"service_settings\": {\n \"api_key\": \"\"\n }\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->inference()->update([\n \"inference_id\" => \"my-inference-endpoint\",\n \"body\" => [\n \"service_settings\" => [\n \"api_key\" => \"\",\n ],\n ],\n]);" + }, + { + "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\"" + } + ], + "specification/inference/put_elser/examples/request/PutElserRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"my-elser-model\")\n .taskType(TaskType.SparseEmbedding)\n .inferenceConfig(i -> i\n .service(\"elser\")\n .serviceSettings(JsonData.fromJson(\"{\\\"num_allocations\\\":1,\\\"num_threads\\\":1}\"))\n )\n);\n" + } + ], + "specification/inference/put_elser/examples/request/PutElserRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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,\"max_number_of_allocations\":10},\"num_threads\":1}}' \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"my-elser-model\")\n .taskType(TaskType.SparseEmbedding)\n .inferenceConfig(i -> i\n .service(\"elser\")\n .serviceSettings(JsonData.fromJson(\"{\\\"adaptive_allocations\\\":{\\\"enabled\\\":true,\\\"min_number_of_allocations\\\":3,\\\"max_number_of_allocations\\\":10},\\\"num_threads\\\":1}\"))\n )\n);\n" + } + ], + "specification/inference/delete/examples/request/InferenceDeleteExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.inference.delete(\n task_type=\"sparse_embedding\",\n inference_id=\"my-elser-model\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.inference.delete({\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.inference.delete(\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->inference()->delete([\n \"task_type\" => \"sparse_embedding\",\n \"inference_id\" => \"my-elser-model\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"" + }, + { + "language": "Java", + "code": "client.inference().delete(d -> d\n .inferenceId(\"my-elser-model\")\n .taskType(TaskType.SparseEmbedding)\n);\n" + } + ], + "specification/inference/put_cohere/examples/request/PutCohereRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\",\"embedding_type\":\"byte\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/cohere-embeddings\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"cohere-embeddings\")\n .taskType(TaskType.TextEmbedding)\n .inferenceConfig(i -> i\n .service(\"cohere\")\n .serviceSettings(JsonData.fromJson(\"{\\\"api_key\\\":\\\"Cohere-Api-key\\\",\\\"model_id\\\":\\\"embed-english-light-v3.0\\\",\\\"embedding_type\\\":\\\"byte\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/put_cohere/examples/request/PutCohereRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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_settings\":{\"top_n\":10,\"return_documents\":true}}' \"$ELASTICSEARCH_URL/_inference/rerank/cohere-rerank\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"cohere-rerank\")\n .taskType(TaskType.Rerank)\n .inferenceConfig(i -> i\n .service(\"cohere\")\n .serviceSettings(JsonData.fromJson(\"{\\\"api_key\\\":\\\"Cohere-API-key\\\",\\\"model_id\\\":\\\"rerank-english-v3.0\\\"}\"))\n .taskSettings(JsonData.fromJson(\"{\\\"top_n\\\":10,\\\"return_documents\\\":true}\"))\n )\n);\n" + } + ], + "specification/inference/put_googleaistudio/examples/request/PutGoogleAiStudioRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"google_ai_studio_completion\")\n .taskType(TaskType.Completion)\n .inferenceConfig(i -> i\n .service(\"googleaistudio\")\n .serviceSettings(JsonData.fromJson(\"{\\\"api_key\\\":\\\"api-key\\\",\\\"model_id\\\":\\\"model-id\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/put/examples/request/InferencePutExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"my-rerank-model\")\n .taskType(TaskType.Rerank)\n .inferenceConfig(i -> i\n .service(\"cohere\")\n .serviceSettings(JsonData.fromJson(\"{\\\"model_id\\\":\\\"rerank-english-v3.0\\\",\\\"api_key\\\":\\\"{{COHERE_API_KEY}}\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/put_voyageai/examples/request/PutVoyageAIRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"voyageai-rerank\")\n .taskType(TaskType.Rerank)\n .inferenceConfig(i -> i\n .service(\"voyageai\")\n .serviceSettings(JsonData.fromJson(\"{\\\"model_id\\\":\\\"rerank-2\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/put_voyageai/examples/request/PutVoyageAIRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"openai-embeddings\")\n .taskType(TaskType.TextEmbedding)\n .inferenceConfig(i -> i\n .service(\"voyageai\")\n .serviceSettings(JsonData.fromJson(\"{\\\"model_id\\\":\\\"voyage-3-large\\\",\\\"dimensions\\\":512}\"))\n )\n);\n" + } + ], + "specification/inference/put_watsonx/examples/request/PutWatsonxRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"watsonx-embeddings\")\n .taskType(TaskType.TextEmbedding)\n .inferenceConfig(i -> i\n .service(\"watsonxai\")\n .serviceSettings(JsonData.fromJson(\"{\\\"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\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/completion/examples/request/CompletionRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.inference.completion(\n inference_id=\"openai_chat_completions\",\n input=\"What is Elastic?\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.inference.completion({\n inference_id: \"openai_chat_completions\",\n input: \"What is Elastic?\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.inference.completion(\n inference_id: \"openai_chat_completions\",\n body: {\n \"input\": \"What is Elastic?\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->inference()->completion([\n \"inference_id\" => \"openai_chat_completions\",\n \"body\" => [\n \"input\" => \"What is Elastic?\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.inference().completion(c -> c\n .inferenceId(\"openai_chat_completions\")\n .input(\"What is Elastic?\")\n);\n" + } + ], + "specification/inference/get/examples/request/InferenceGetExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.inference.get(\n task_type=\"sparse_embedding\",\n inference_id=\"my-elser-model\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.inference.get({\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.inference.get(\n task_type: \"sparse_embedding\",\n inference_id: \"my-elser-model\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->inference()->get([\n \"task_type\" => \"sparse_embedding\",\n \"inference_id\" => \"my-elser-model\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_inference/sparse_embedding/my-elser-model\"" + }, + { + "language": "Java", + "code": "client.inference().get(g -> g\n .inferenceId(\"my-elser-model\")\n .taskType(TaskType.SparseEmbedding)\n);\n" + } + ], + "specification/inference/put_anthropic/examples/request/PutAnthropicRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"anthropic_completion\")\n .taskType(TaskType.Completion)\n .inferenceConfig(i -> i\n .service(\"anthropic\")\n .serviceSettings(JsonData.fromJson(\"{\\\"api_key\\\":\\\"Anthropic-Api-Key\\\",\\\"model_id\\\":\\\"Model-ID\\\"}\"))\n .taskSettings(JsonData.fromJson(\"{\\\"max_tokens\\\":1024}\"))\n )\n);\n" + } + ], + "specification/inference/sparse_embedding/examples/request/SparseEmbeddingRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().sparseEmbedding(s -> s\n .inferenceId(\"my-elser-model\")\n .input(\"The sky above the port was the color of television tuned to a dead channel.\")\n);\n" + } + ], + "specification/inference/put_googlevertexai/examples/request/PutGoogleVertexAiRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\":\"project-id\"}}' \"$ELASTICSEARCH_URL/_inference/rerank/google_vertex_ai_rerank\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"google_vertex_ai_rerank\")\n .taskType(TaskType.Rerank)\n .inferenceConfig(i -> i\n .service(\"googlevertexai\")\n .serviceSettings(JsonData.fromJson(\"{\\\"service_account_json\\\":\\\"service-account-json\\\",\\\"project_id\\\":\\\"project-id\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/put_googlevertexai/examples/request/PutGoogleVertexAiRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"google_vertex_ai_embeddingss\")\n .taskType(TaskType.TextEmbedding)\n .inferenceConfig(i -> i\n .service(\"googlevertexai\")\n .serviceSettings(JsonData.fromJson(\"{\\\"service_account_json\\\":\\\"service-account-json\\\",\\\"model_id\\\":\\\"model-id\\\",\\\"location\\\":\\\"location\\\",\\\"project_id\\\":\\\"project-id\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/put_hugging_face/examples/request/PutHuggingFaceRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"hugging-face-embeddings\")\n .taskType(TaskType.TextEmbedding)\n .inferenceConfig(i -> i\n .service(\"hugging_face\")\n .serviceSettings(JsonData.fromJson(\"{\\\"api_key\\\":\\\"hugging-face-access-token\\\",\\\"url\\\":\\\"url-endpoint\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/put_hugging_face/examples/request/PutHuggingFaceRequestExample2.yaml": [ + { + "language": "Python", + "code": "resp = client.inference.put(\n task_type=\"rerank\",\n inference_id=\"hugging-face-rerank\",\n inference_config={\n \"service\": \"hugging_face\",\n \"service_settings\": {\n \"api_key\": \"hugging-face-access-token\",\n \"url\": \"url-endpoint\"\n },\n \"task_settings\": {\n \"return_documents\": True,\n \"top_n\": 3\n }\n },\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.inference.put({\n task_type: \"rerank\",\n inference_id: \"hugging-face-rerank\",\n inference_config: {\n service: \"hugging_face\",\n service_settings: {\n api_key: \"hugging-face-access-token\",\n url: \"url-endpoint\",\n },\n task_settings: {\n return_documents: true,\n top_n: 3,\n },\n },\n});" + }, + { + "language": "Ruby", + "code": "response = client.inference.put(\n task_type: \"rerank\",\n inference_id: \"hugging-face-rerank\",\n body: {\n \"service\": \"hugging_face\",\n \"service_settings\": {\n \"api_key\": \"hugging-face-access-token\",\n \"url\": \"url-endpoint\"\n },\n \"task_settings\": {\n \"return_documents\": true,\n \"top_n\": 3\n }\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->inference()->put([\n \"task_type\" => \"rerank\",\n \"inference_id\" => \"hugging-face-rerank\",\n \"body\" => [\n \"service\" => \"hugging_face\",\n \"service_settings\" => [\n \"api_key\" => \"hugging-face-access-token\",\n \"url\" => \"url-endpoint\",\n ],\n \"task_settings\" => [\n \"return_documents\" => true,\n \"top_n\" => 3,\n ],\n ],\n]);" + }, + { + "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\"},\"task_settings\":{\"return_documents\":true,\"top_n\":3}}' \"$ELASTICSEARCH_URL/_inference/rerank/hugging-face-rerank\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"hugging-face-rerank\")\n .taskType(TaskType.Rerank)\n .inferenceConfig(i -> i\n .service(\"hugging_face\")\n .serviceSettings(JsonData.fromJson(\"{\\\"api_key\\\":\\\"hugging-face-access-token\\\",\\\"url\\\":\\\"url-endpoint\\\"}\"))\n .taskSettings(JsonData.fromJson(\"{\\\"return_documents\\\":true,\\\"top_n\\\":3}\"))\n )\n);\n" + } + ], + "specification/inference/put_amazonbedrock/examples/request/PutAmazonBedrockRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\",\"region\":\"us-east-1\",\"provider\":\"amazontitan\",\"model\":\"amazon.titan-embed-text-v2:0\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/amazon_bedrock_embeddings\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"amazon_bedrock_embeddings\")\n .taskType(TaskType.TextEmbedding)\n .inferenceConfig(i -> i\n .service(\"amazonbedrock\")\n .serviceSettings(JsonData.fromJson(\"{\\\"access_key\\\":\\\"AWS-access-key\\\",\\\"secret_key\\\":\\\"AWS-secret-key\\\",\\\"region\\\":\\\"us-east-1\\\",\\\"provider\\\":\\\"amazontitan\\\",\\\"model\\\":\\\"amazon.titan-embed-text-v2:0\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/put_amazonbedrock/examples/request/PutAmazonBedrockRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"openai-completion\")\n .taskType(TaskType.Completion)\n .inferenceConfig(i -> i\n .service(\"openai\")\n .serviceSettings(JsonData.fromJson(\"{\\\"api_key\\\":\\\"OpenAI-API-Key\\\",\\\"model_id\\\":\\\"gpt-3.5-turbo\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/put_openai/examples/request/PutOpenAiRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\",\"region\":\"us-east-1\",\"provider\":\"amazontitan\",\"model\":\"amazon.titan-text-premier-v1:0\"}}' \"$ELASTICSEARCH_URL/_inference/completion/amazon_bedrock_completion\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"amazon_bedrock_completion\")\n .taskType(TaskType.Completion)\n .inferenceConfig(i -> i\n .service(\"amazonbedrock\")\n .serviceSettings(JsonData.fromJson(\"{\\\"access_key\\\":\\\"AWS-access-key\\\",\\\"secret_key\\\":\\\"AWS-secret-key\\\",\\\"region\\\":\\\"us-east-1\\\",\\\"provider\\\":\\\"amazontitan\\\",\\\"model\\\":\\\"amazon.titan-text-premier-v1:0\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/put_openai/examples/request/PutOpenAiRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\",\"dimensions\":128}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/openai-embeddings\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"openai-embeddings\")\n .taskType(TaskType.TextEmbedding)\n .inferenceConfig(i -> i\n .service(\"openai\")\n .serviceSettings(JsonData.fromJson(\"{\\\"api_key\\\":\\\"OpenAI-API-Key\\\",\\\"model_id\\\":\\\"text-embedding-3-small\\\",\\\"dimensions\\\":128}\"))\n )\n);\n" + } + ], + "specification/inference/rerank/examples/request/RerankRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().rerank(r -> r\n .inferenceId(\"cohere_rerank\")\n .input(List.of(\"luke\",\"like\",\"leia\",\"chewy\",\"r2d2\",\"star\",\"wars\"))\n .query(\"star wars main character\")\n);\n" + } + ], + "specification/inference/rerank/examples/request/RerankRequestExample2.yaml": [ + { + "language": "Python", + "code": "resp = client.inference.rerank(\n inference_id=\"bge-reranker-base-mkn\",\n input=[\n \"luke\",\n \"like\",\n \"leia\",\n \"chewy\",\n \"r2d2\",\n \"star\",\n \"wars\"\n ],\n query=\"star wars main character\",\n return_documents=False,\n top_n=2,\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.inference.rerank({\n inference_id: \"bge-reranker-base-mkn\",\n input: [\"luke\", \"like\", \"leia\", \"chewy\", \"r2d2\", \"star\", \"wars\"],\n query: \"star wars main character\",\n return_documents: false,\n top_n: 2,\n});" + }, + { + "language": "Ruby", + "code": "response = client.inference.rerank(\n inference_id: \"bge-reranker-base-mkn\",\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 \"return_documents\": false,\n \"top_n\": 2\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->inference()->rerank([\n \"inference_id\" => \"bge-reranker-base-mkn\",\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 \"return_documents\" => false,\n \"top_n\" => 2,\n ],\n]);" + }, + { + "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\",\"return_documents\":false,\"top_n\":2}' \"$ELASTICSEARCH_URL/_inference/rerank/bge-reranker-base-mkn\"" + }, + { + "language": "Java", + "code": "client.inference().rerank(r -> r\n .inferenceId(\"bge-reranker-base-mkn\")\n .input(List.of(\"luke\",\"like\",\"leia\",\"chewy\",\"r2d2\",\"star\",\"wars\"))\n .query(\"star wars main character\")\n);\n" + } + ], + "specification/inference/rerank/examples/request/RerankRequestExample3.yaml": [ + { + "language": "Python", + "code": "resp = client.inference.rerank(\n inference_id=\"bge-reranker-base-mkn\",\n input=[\n \"luke\",\n \"like\",\n \"leia\",\n \"chewy\",\n \"r2d2\",\n \"star\",\n \"wars\"\n ],\n query=\"star wars main character\",\n return_documents=True,\n top_n=3,\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.inference.rerank({\n inference_id: \"bge-reranker-base-mkn\",\n input: [\"luke\", \"like\", \"leia\", \"chewy\", \"r2d2\", \"star\", \"wars\"],\n query: \"star wars main character\",\n return_documents: true,\n top_n: 3,\n});" + }, + { + "language": "Ruby", + "code": "response = client.inference.rerank(\n inference_id: \"bge-reranker-base-mkn\",\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 \"return_documents\": true,\n \"top_n\": 3\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->inference()->rerank([\n \"inference_id\" => \"bge-reranker-base-mkn\",\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 \"return_documents\" => true,\n \"top_n\" => 3,\n ],\n]);" + }, + { + "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\",\"return_documents\":true,\"top_n\":3}' \"$ELASTICSEARCH_URL/_inference/rerank/bge-reranker-base-mkn\"" + }, + { + "language": "Java", + "code": "client.inference().rerank(r -> r\n .inferenceId(\"bge-reranker-base-mkn\")\n .input(List.of(\"luke\",\"like\",\"leia\",\"chewy\",\"r2d2\",\"star\",\"wars\"))\n .query(\"star wars main character\")\n);\n" + } + ], + "specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample4.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"alibabacloud_ai_search_embeddings\")\n .taskType(TaskType.TextEmbedding)\n .inferenceConfig(i -> i\n .service(\"alibabacloud-ai-search\")\n .serviceSettings(JsonData.fromJson(\"{\\\"api_key\\\":\\\"AlibabaCloud-API-Key\\\",\\\"service_id\\\":\\\"ops-text-embedding-001\\\",\\\"host\\\":\\\"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\\\",\\\"workspace\\\":\\\"default\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample3.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"alibabacloud_ai_search_sparse\")\n .taskType(TaskType.SparseEmbedding)\n .inferenceConfig(i -> i\n .service(\"alibabacloud-ai-search\")\n .serviceSettings(JsonData.fromJson(\"{\\\"api_key\\\":\\\"AlibabaCloud-API-Key\\\",\\\"service_id\\\":\\\"ops-text-sparse-embedding-001\\\",\\\"host\\\":\\\"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\\\",\\\"workspace\\\":\\\"default\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"alibabacloud_ai_search_rerank\")\n .taskType(TaskType.Rerank)\n .inferenceConfig(i -> i\n .service(\"alibabacloud-ai-search\")\n .serviceSettings(JsonData.fromJson(\"{\\\"api_key\\\":\\\"AlibabaCloud-API-Key\\\",\\\"service_id\\\":\\\"ops-bge-reranker-larger\\\",\\\"host\\\":\\\"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\\\",\\\"workspace\\\":\\\"default\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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.aliyuncs.com\",\"api_key\":\"AlibabaCloud-API-Key\",\"service_id\":\"ops-qwen-turbo\",\"workspace\":\"default\"}}' \"$ELASTICSEARCH_URL/_inference/completion/alibabacloud_ai_search_completion\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"alibabacloud_ai_search_completion\")\n .taskType(TaskType.Completion)\n .inferenceConfig(i -> i\n .service(\"alibabacloud-ai-search\")\n .serviceSettings(JsonData.fromJson(\"{\\\"host\\\":\\\"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\\\",\\\"api_key\\\":\\\"AlibabaCloud-API-Key\\\",\\\"service_id\\\":\\\"ops-qwen-turbo\\\",\\\"workspace\\\":\\\"default\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/put_azureopenai/examples/request/PutAzureOpenAiRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"azure_openai_embeddings\")\n .taskType(TaskType.TextEmbedding)\n .inferenceConfig(i -> i\n .service(\"azureopenai\")\n .serviceSettings(JsonData.fromJson(\"{\\\"api_key\\\":\\\"Api-Key\\\",\\\"resource_name\\\":\\\"Resource-name\\\",\\\"deployment_id\\\":\\\"Deployment-id\\\",\\\"api_version\\\":\\\"2024-02-01\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/put_azureopenai/examples/request/PutAzureOpenAiRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"azure_openai_completion\")\n .taskType(TaskType.Completion)\n .inferenceConfig(i -> i\n .service(\"azureopenai\")\n .serviceSettings(JsonData.fromJson(\"{\\\"api_key\\\":\\\"Api-Key\\\",\\\"resource_name\\\":\\\"Resource-name\\\",\\\"deployment_id\\\":\\\"Deployment-id\\\",\\\"api_version\\\":\\\"2024-02-01\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/stream_completion/examples/request/StreamInferenceRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.inference.stream_completion(\n inference_id=\"openai-completion\",\n input=\"What is Elastic?\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.inference.streamCompletion({\n inference_id: \"openai-completion\",\n input: \"What is Elastic?\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.inference.stream_completion(\n inference_id: \"openai-completion\",\n body: {\n \"input\": \"What is Elastic?\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->inference()->streamCompletion([\n \"inference_id\" => \"openai-completion\",\n \"body\" => [\n \"input\" => \"What is Elastic?\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.inference().streamCompletion(s -> s\n .inferenceId(\"openai-completion\")\n .input(\"What is Elastic?\")\n);\n" + } + ], + "specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample5.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"my-e5-model\")\n .taskType(TaskType.TextEmbedding)\n .inferenceConfig(i -> i\n .service(\"elasticsearch\")\n .serviceSettings(JsonData.fromJson(\"{\\\"adaptive_allocations\\\":{\\\"enabled\\\":true,\\\"min_number_of_allocations\\\":3,\\\"max_number_of_allocations\\\":10},\\\"num_threads\\\":1,\\\"model_id\\\":\\\".multilingual-e5-small\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample4.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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-L12-cos-v5\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/my-msmarco-minilm-model\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"my-msmarco-minilm-model\")\n .taskType(TaskType.TextEmbedding)\n .inferenceConfig(i -> i\n .service(\"elasticsearch\")\n .serviceSettings(JsonData.fromJson(\"{\\\"num_allocations\\\":1,\\\"num_threads\\\":1,\\\"model_id\\\":\\\"msmarco-MiniLM-L12-cos-v5\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample3.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"my-e5-model\")\n .taskType(TaskType.TextEmbedding)\n .inferenceConfig(i -> i\n .service(\"elasticsearch\")\n .serviceSettings(JsonData.fromJson(\"{\\\"num_allocations\\\":1,\\\"num_threads\\\":1,\\\"model_id\\\":\\\".multilingual-e5-small\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"my-elastic-rerank\")\n .taskType(TaskType.Rerank)\n .inferenceConfig(i -> i\n .service(\"elasticsearch\")\n .serviceSettings(JsonData.fromJson(\"{\\\"model_id\\\":\\\".rerank-v1\\\",\\\"num_threads\\\":1,\\\"adaptive_allocations\\\":{\\\"enabled\\\":true,\\\"min_number_of_allocations\\\":1,\\\"max_number_of_allocations\\\":4}}\"))\n )\n);\n" + } + ], + "specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"my-elser-model\")\n .taskType(TaskType.SparseEmbedding)\n .inferenceConfig(i -> i\n .service(\"elasticsearch\")\n .serviceSettings(JsonData.fromJson(\"{\\\"adaptive_allocations\\\":{\\\"enabled\\\":true,\\\"min_number_of_allocations\\\":1,\\\"max_number_of_allocations\\\":4},\\\"num_threads\\\":1,\\\"model_id\\\":\\\".elser_model_2\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample6.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"use_existing_deployment\")\n .taskType(TaskType.SparseEmbedding)\n .inferenceConfig(i -> i\n .service(\"elasticsearch\")\n .serviceSettings(JsonData.fromJson(\"{\\\"deployment_id\\\":\\\".elser_model_2\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/put_azureaistudio/examples/request/PutAzureAiStudioRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\",\"provider\":\"databricks\",\"endpoint_type\":\"realtime\"}}' \"$ELASTICSEARCH_URL/_inference/completion/azure_ai_studio_completion\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"azure_ai_studio_completion\")\n .taskType(TaskType.Completion)\n .inferenceConfig(i -> i\n .service(\"azureaistudio\")\n .serviceSettings(JsonData.fromJson(\"{\\\"api_key\\\":\\\"Azure-AI-Studio-API-key\\\",\\\"target\\\":\\\"Target-URI\\\",\\\"provider\\\":\\\"databricks\\\",\\\"endpoint_type\\\":\\\"realtime\\\"}\"))\n )\n);\n" + } + ], + "specification/inference/put_azureaistudio/examples/request/PutAzureAiStudioRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\",\"provider\":\"openai\",\"endpoint_type\":\"token\"}}' \"$ELASTICSEARCH_URL/_inference/text_embedding/azure_ai_studio_embeddings\"" + }, + { + "language": "Java", + "code": "client.inference().put(p -> p\n .inferenceId(\"azure_ai_studio_embeddings\")\n .taskType(TaskType.TextEmbedding)\n .inferenceConfig(i -> i\n .service(\"azureaistudio\")\n .serviceSettings(JsonData.fromJson(\"{\\\"api_key\\\":\\\"Azure-AI-Studio-API-key\\\",\\\"target\\\":\\\"Target-Uri\\\",\\\"provider\\\":\\\"openai\\\",\\\"endpoint_type\\\":\\\"token\\\"}\"))\n )\n);\n" + } + ], + "specification/query_rules/list_rulesets/examples/request/QueryRulesetListRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.query_rules.list_rulesets(\n from=\"0\",\n size=\"3\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.queryRules.listRulesets({\n from: 0,\n size: 3,\n});" + }, + { + "language": "Ruby", + "code": "response = client.query_rules.list_rulesets(\n from: \"0\",\n size: \"3\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->queryRules()->listRulesets([\n \"from\" => \"0\",\n \"size\" => \"3\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/?from=0&size=3\"" + }, + { + "language": "Java", + "code": "client.queryRules().listRulesets(l -> l\n .from(0)\n .size(3)\n);\n" + } + ], + "specification/query_rules/test/examples/request/QueryRulesetTestRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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_query\",\"values\":[\"rescue dogs\"]}],\"actions\":{\"docs\":[{\"_index\":\"index1\",\"_id\":\"id3\"},{\"_index\":\"index2\",\"_id\":\"id4\"}]}}]}' \"$ELASTICSEARCH_URL/_query_rules/my-ruleset\"" + }, + { + "language": "Java", + "code": "client.queryRules().putRuleset(p -> p\n .rules(List.of(QueryRule.queryRuleOf(q -> q\n .ruleId(\"my-rule1\")\n .type(QueryRuleType.Pinned)\n .criteria(List.of(QueryRuleCriteria.of(qu -> qu\n .type(QueryRuleCriteriaType.Contains)\n .metadata(\"user_query\")\n .values(List.of(JsonData.fromJson(\"\\\"pugs\\\"\"),JsonData.fromJson(\"\\\"puggles\\\"\")))),QueryRuleCriteria.of(qu -> qu\n .type(QueryRuleCriteriaType.Exact)\n .metadata(\"user_country\")\n .values(JsonData.fromJson(\"\\\"us\\\"\")))))\n .actions(a -> a\n .ids(List.of(\"id1\",\"id2\"))\n )),QueryRule.queryRuleOf(q -> q\n .ruleId(\"my-rule2\")\n .type(QueryRuleType.Pinned)\n .criteria(c -> c\n .type(QueryRuleCriteriaType.Fuzzy)\n .metadata(\"user_query\")\n .values(JsonData.fromJson(\"\\\"rescue dogs\\\"\"))\n )\n .actions(a -> a\n .docs(List.of(PinnedDoc.of(pi -> pi\n .id(\"id3\")\n .index(\"index1\")),PinnedDoc.of(pi -> pi\n .id(\"id4\")\n .index(\"index2\"))))\n ))))\n .rulesetId(\"my-ruleset\")\n);\n" + } + ], + "specification/query_rules/put_rule/examples/request/QueryRulePutRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.query_rules.test(\n ruleset_id=\"my-ruleset\",\n match_criteria={\n \"query_string\": \"puggles\"\n },\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.queryRules.test({\n ruleset_id: \"my-ruleset\",\n match_criteria: {\n query_string: \"puggles\",\n },\n});" + }, + { + "language": "Ruby", + "code": "response = client.query_rules.test(\n ruleset_id: \"my-ruleset\",\n body: {\n \"match_criteria\": {\n \"query_string\": \"puggles\"\n }\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->queryRules()->test([\n \"ruleset_id\" => \"my-ruleset\",\n \"body\" => [\n \"match_criteria\" => [\n \"query_string\" => \"puggles\",\n ],\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.queryRules().test(t -> t\n .matchCriteria(\"query_string\", JsonData.fromJson(\"\\\"puggles\\\"\"))\n .rulesetId(\"my-ruleset\")\n);\n" + } + ], + "specification/query_rules/delete_rule/examples/request/QueryRulesDeleteRuleExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.query_rules.delete_rule(\n ruleset_id=\"my-ruleset\",\n rule_id=\"my-rule1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.queryRules.deleteRule({\n ruleset_id: \"my-ruleset\",\n rule_id: \"my-rule1\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.query_rules.delete_rule(\n ruleset_id: \"my-ruleset\",\n rule_id: \"my-rule1\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->queryRules()->deleteRule([\n \"ruleset_id\" => \"my-ruleset\",\n \"rule_id\" => \"my-rule1\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/my-ruleset/_rule/my-rule1\"" + }, + { + "language": "Java", + "code": "client.queryRules().deleteRule(d -> d\n .ruleId(\"my-rule1\")\n .rulesetId(\"my-ruleset\")\n);\n" + } + ], + "specification/query_rules/get_rule/examples/request/QueryRuleGetRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.query_rules.get_rule(\n ruleset_id=\"my-ruleset\",\n rule_id=\"my-rule1\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.queryRules.getRule({\n ruleset_id: \"my-ruleset\",\n rule_id: \"my-rule1\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.query_rules.get_rule(\n ruleset_id: \"my-ruleset\",\n rule_id: \"my-rule1\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->queryRules()->getRule([\n \"ruleset_id\" => \"my-ruleset\",\n \"rule_id\" => \"my-rule1\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/my-ruleset/_rule/my-rule1\"" + }, + { + "language": "Java", + "code": "client.queryRules().getRule(g -> g\n .ruleId(\"my-rule1\")\n .rulesetId(\"my-ruleset\")\n);\n" + } + ], + "specification/query_rules/get_ruleset/examples/request/QueryRulesetGetRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.query_rules.get_ruleset(\n ruleset_id=\"my-ruleset\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.queryRules.getRuleset({\n ruleset_id: \"my-ruleset\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.query_rules.get_ruleset(\n ruleset_id: \"my-ruleset\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->queryRules()->getRuleset([\n \"ruleset_id\" => \"my-ruleset\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/my-ruleset/\"" + }, + { + "language": "Java", + "code": "client.queryRules().getRuleset(g -> g\n .rulesetId(\"my-ruleset\")\n);\n" + } + ], + "specification/query_rules/delete_ruleset/examples/request/QueryRulesDeleteRulesetExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.query_rules.delete_ruleset(\n ruleset_id=\"my-ruleset\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.queryRules.deleteRuleset({\n ruleset_id: \"my-ruleset\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.query_rules.delete_ruleset(\n ruleset_id: \"my-ruleset\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->queryRules()->deleteRuleset([\n \"ruleset_id\" => \"my-ruleset\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/my-ruleset/\"" + }, + { + "language": "Java", + "code": "client.queryRules().deleteRuleset(d -> d\n .rulesetId(\"my-ruleset\")\n);\n" + } + ], + "specification/query_rules/put_ruleset/examples/request/QueryRulesetPutRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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_query\",\"values\":[\"rescue dogs\"]}],\"actions\":{\"docs\":[{\"_index\":\"index1\",\"_id\":\"id3\"},{\"_index\":\"index2\",\"_id\":\"id4\"}]}}]}' \"$ELASTICSEARCH_URL/_query_rules/my-ruleset\"" + }, + { + "language": "Java", + "code": "client.queryRules().putRuleset(p -> p\n .rules(List.of(QueryRule.queryRuleOf(q -> q\n .ruleId(\"my-rule1\")\n .type(QueryRuleType.Pinned)\n .criteria(List.of(QueryRuleCriteria.of(qu -> qu\n .type(QueryRuleCriteriaType.Contains)\n .metadata(\"user_query\")\n .values(List.of(JsonData.fromJson(\"\\\"pugs\\\"\"),JsonData.fromJson(\"\\\"puggles\\\"\")))),QueryRuleCriteria.of(qu -> qu\n .type(QueryRuleCriteriaType.Exact)\n .metadata(\"user_country\")\n .values(JsonData.fromJson(\"\\\"us\\\"\")))))\n .actions(a -> a\n .ids(List.of(\"id1\",\"id2\"))\n )),QueryRule.queryRuleOf(q -> q\n .ruleId(\"my-rule2\")\n .type(QueryRuleType.Pinned)\n .criteria(c -> c\n .type(QueryRuleCriteriaType.Fuzzy)\n .metadata(\"user_query\")\n .values(JsonData.fromJson(\"\\\"rescue dogs\\\"\"))\n )\n .actions(a -> a\n .docs(List.of(PinnedDoc.of(pi -> pi\n .id(\"id3\")\n .index(\"index1\")),PinnedDoc.of(pi -> pi\n .id(\"id4\")\n .index(\"index2\"))))\n ))))\n .rulesetId(\"my-ruleset\")\n);\n" + } + ], + "specification/enrich/delete_policy/examples/request/EnrichDeletePolicyExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.enrich.delete_policy(\n name=\"my-policy\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.enrich.deletePolicy({\n name: \"my-policy\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.enrich.delete_policy(\n name: \"my-policy\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->enrich()->deletePolicy([\n \"name\" => \"my-policy\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_enrich/policy/my-policy\"" + }, + { + "language": "Java", + "code": "client.enrich().deletePolicy(d -> d\n .name(\"my-policy\")\n);\n" + } + ], + "specification/enrich/execute_policy/examples/request/EnrichExecutePolicyExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.enrich.execute_policy(\n name=\"my-policy\",\n wait_for_completion=False,\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.enrich.executePolicy({\n name: \"my-policy\",\n wait_for_completion: \"false\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.enrich.execute_policy(\n name: \"my-policy\",\n wait_for_completion: \"false\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->enrich()->executePolicy([\n \"name\" => \"my-policy\",\n \"wait_for_completion\" => \"false\",\n]);" + }, + { + "language": "curl", + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_enrich/policy/my-policy/_execute?wait_for_completion=false\"" + }, + { + "language": "Java", + "code": "client.enrich().executePolicy(e -> e\n .name(\"my-policy\")\n .waitForCompletion(false)\n);\n" + } + ], + "specification/enrich/get_policy/examples/request/EnrichGetPolicyExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.enrich.get_policy(\n name=\"my-policy\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.enrich.getPolicy({\n name: \"my-policy\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.enrich.get_policy(\n name: \"my-policy\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->enrich()->getPolicy([\n \"name\" => \"my-policy\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_enrich/policy/my-policy\"" + }, + { + "language": "Java", + "code": "client.enrich().getPolicy(g -> g\n .name(\"my-policy\")\n);\n" + } + ], + "specification/enrich/put_policy/examples/request/EnrichPutPolicyExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.enrich().putPolicy(p -> p\n .geoMatch(g -> g\n .enrichFields(List.of(\"location\",\"postal_code\"))\n .indices(\"postal_codes\")\n .matchField(\"location\")\n )\n .name(\"postal_policy\")\n);\n" + } + ], + "specification/enrich/stats/examples/request/EnrichStatsExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.enrich().stats(s -> s);\n" + } + ], + "specification/async_search/submit/examples/request/AsyncSearchSubmitRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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_interval\":\"1d\"}}}}' \"$ELASTICSEARCH_URL/sales*/_async_search?size=0\"" + }, + { + "language": "Java", + "code": "client.asyncSearch().submit(s -> s\n .aggregations(\"sale_date\", a -> a\n .dateHistogram(d -> d\n .calendarInterval(CalendarInterval.Day)\n .field(\"date\")\n )\n )\n .index(\"sales*\")\n .size(0)\n .sort(so -> so\n .field(f -> f\n .field(\"date\")\n .order(SortOrder.Asc)\n )\n )\n,Void.class);\n" + } + ], + "specification/async_search/delete/examples/request/AsyncSearchDeleteExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.async_search.delete(\n id=\"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.asyncSearch.delete({\n id: \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.async_search.delete(\n id: \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->asyncSearch()->delete([\n \"id\" => \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_async_search/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\"" + }, + { + "language": "Java", + "code": "client.asyncSearch().delete(d -> d\n .id(\"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\")\n);\n" + } + ], + "specification/async_search/get/examples/request/AsyncSearchGetRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.async_search.get(\n id=\"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.asyncSearch.get({\n id: \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.async_search.get(\n id: \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->asyncSearch()->get([\n \"id\" => \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_async_search/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\"" + }, + { + "language": "Java", + "code": "client.asyncSearch().get(g -> g\n .id(\"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\")\n);\n" + } + ], + "specification/async_search/status/examples/request/AsyncSearchStatusRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.async_search.status(\n id=\"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.asyncSearch.status({\n id: \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.async_search.status(\n id: \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->asyncSearch()->status([\n \"id\" => \"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_async_search/status/FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\"" + }, + { + "language": "Java", + "code": "client.asyncSearch().status(s -> s\n .id(\"FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=\")\n);\n" + } + ], + "specification/eql/get_status/examples/request/EqlGetStatusExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.eql.get_status(\n id=\"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.eql.getStatus({\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.eql.get_status(\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->eql()->getStatus([\n \"id\" => \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_eql/search/status/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\"" + }, + { + "language": "Java", + "code": "client.eql().getStatus(g -> g\n .id(\"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\")\n);\n" + } + ], + "specification/eql/delete/examples/request/EqlDeleteExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.eql.delete(\n id=\"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.eql.delete({\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.eql.delete(\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->eql()->delete([\n \"id\" => \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_eql/search/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\"" + }, + { + "language": "Java", + "code": "client.eql().delete(d -> d\n .id(\"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\")\n);\n" + } + ], + "specification/eql/get/examples/request/EqlGetExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.eql.get(\n id=\"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n wait_for_completion_timeout=\"2s\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.eql.get({\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n wait_for_completion_timeout: \"2s\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.eql.get(\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n wait_for_completion_timeout: \"2s\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->eql()->get([\n \"id\" => \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n \"wait_for_completion_timeout\" => \"2s\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_eql/search/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=?wait_for_completion_timeout=2s\"" + }, + { + "language": "Java", + "code": "client.eql().get(g -> g\n .id(\"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\")\n .waitForCompletionTimeout(w -> w\n .offset(2)\n )\n);\n" + } + ], + "specification/eql/search/examples/request/EqlSearchRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.eql().search(s -> s\n .index(\"my-data-stream\")\n .query(\" process where (process.name == \\\"cmd.exe\\\" and process.pid != 2013) \")\n);\n" + } + ], + "specification/eql/search/examples/request/EqlSearchRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.eql().search(s -> s\n .index(\"my-data-stream\")\n .query(\" sequence by process.pid [ file where file.name == \\\"cmd.exe\\\" and process.pid != 2013 ][ process where stringContains(process.executable, \\\"regsvr32\\\") ] \")\n);\n" + } + ], + "specification/esql/async_query_stop/examples/request/EsqlAsyncQueryStopExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.esql.async_query_stop(\n id=\"FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.esql.asyncQueryStop({\n id: \"FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.esql.async_query_stop(\n id: \"FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->esql()->asyncQueryStop([\n \"id\" => \"FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query/async/FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=/stop\"" + } + ], + "specification/esql/async_query/examples/request/AsyncQueryRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + } + ], + "specification/esql/async_query_get/examples/request/EsqlAsyncQueryGetExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.esql.async_query_get(\n id=\"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n wait_for_completion_timeout=\"30s\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.esql.asyncQueryGet({\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n wait_for_completion_timeout: \"30s\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.esql.async_query_get(\n id: \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n wait_for_completion_timeout: \"30s\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->esql()->asyncQueryGet([\n \"id\" => \"FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=\",\n \"wait_for_completion_timeout\" => \"30s\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query/async/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=?wait_for_completion_timeout=30s\"" + } + ], + "specification/esql/query/examples/request/QueryRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.esql().query(q -> q\n .includeCcsMetadata(true)\n .query(\" FROM library,remote-*:library | EVAL year = DATE_TRUNC(1 YEARS, release_date) | STATS MAX(page_count) BY year | SORT year | LIMIT 5 \")\n);\n" + } + ], + "specification/esql/async_query_delete/examples/request/EsqlAsyncQueryDeleteExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.esql.async_query_delete(\n id=\"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.esql.asyncQueryDelete({\n id: \"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.esql.async_query_delete(\n id: \"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->esql()->asyncQueryDelete([\n \"id\" => \"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query/async/FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\"" + } + ], + "specification/autoscaling/put_autoscaling_policy/examples/request/PutAutoscalingPolicyRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.autoscaling.put_autoscaling_policy(\n name=\"\",\n policy={\n \"roles\": [],\n \"deciders\": {\n \"fixed\": {}\n }\n },\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.autoscaling.putAutoscalingPolicy({\n name: \"\",\n policy: {\n roles: [],\n deciders: {\n fixed: {},\n },\n },\n});" + }, + { + "language": "Ruby", + "code": "response = client.autoscaling.put_autoscaling_policy(\n name: \"\",\n body: {\n \"roles\": [],\n \"deciders\": {\n \"fixed\": {}\n }\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->autoscaling()->putAutoscalingPolicy([\n \"name\" => \"\",\n \"body\" => [\n \"roles\" => array(\n ),\n \"deciders\" => [\n \"fixed\" => new ArrayObject([]),\n ],\n ],\n]);" + }, + { + "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/\"" + }, + { + "language": "Java", + "code": "client.autoscaling().putAutoscalingPolicy(p -> p\n .name(\"\")\n .policy(po -> po\n .deciders(\"fixed\", JsonData.fromJson(\"{}\"))\n )\n);\n" + } + ], + "specification/autoscaling/put_autoscaling_policy/examples/request/PutAutoscalingPolicyRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.autoscaling().putAutoscalingPolicy(p -> p\n .name(\"my_autoscaling_policy\")\n .policy(po -> po\n .roles(\"data_hot\")\n .deciders(\"fixed\", JsonData.fromJson(\"{}\"))\n )\n);\n" + } + ], + "specification/autoscaling/delete_autoscaling_policy/examples/request/DeleteAutoscalingPolicyRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.autoscaling.delete_autoscaling_policy(\n name=\"*\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.autoscaling.deleteAutoscalingPolicy({\n name: \"*\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.autoscaling.delete_autoscaling_policy(\n name: \"*\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->autoscaling()->deleteAutoscalingPolicy([\n \"name\" => \"*\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_autoscaling/policy/*\"" + }, + { + "language": "Java", + "code": "client.autoscaling().deleteAutoscalingPolicy(d -> d\n .name(\"*\")\n);\n" + } + ], + "specification/autoscaling/get_autoscaling_policy/examples/request/GetAutoscalingPolicyRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.autoscaling.get_autoscaling_policy(\n name=\"my_autoscaling_policy\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.autoscaling.getAutoscalingPolicy({\n name: \"my_autoscaling_policy\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.autoscaling.get_autoscaling_policy(\n name: \"my_autoscaling_policy\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->autoscaling()->getAutoscalingPolicy([\n \"name\" => \"my_autoscaling_policy\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_autoscaling/policy/my_autoscaling_policy\"" + }, + { + "language": "Java", + "code": "client.autoscaling().getAutoscalingPolicy(g -> g\n .name(\"my_autoscaling_policy\")\n);\n" + } + ], + "specification/autoscaling/get_autoscaling_capacity/examples/request/GetAutoscalingCapacityRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.autoscaling().getAutoscalingCapacity(g -> g);\n" + } + ], + "specification/search_application/render_query/examples/request/SearchApplicationsRenderQueryRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.searchApplication().renderQuery(r -> r\n .name(\"my-app\")\n .params(Map.of(\"text_fields\", JsonData.fromJson(\"[{\\\"name\\\":\\\"title\\\",\\\"boost\\\":5},{\\\"name\\\":\\\"description\\\",\\\"boost\\\":1}]\"),\"query_string\", JsonData.fromJson(\"\\\"my first query\\\"\")))\n);\n" + } + ], + "specification/search_application/delete/examples/request/SearchApplicationDeleteExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.search_application.delete(\n name=\"my-app\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.searchApplication.delete({\n name: \"my-app\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.search_application.delete(\n name: \"my-app\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->searchApplication()->delete([\n \"name\" => \"my-app\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/search_application/my-app/\"" + }, + { + "language": "Java", + "code": "client.searchApplication().delete(d -> d\n .name(\"my-app\")\n);\n" + } + ], + "specification/search_application/put/examples/request/SearchApplicationPutRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\":\"*\"}},\"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": "Java", + "code": "client.searchApplication().put(p -> p\n .name(\"my-app\")\n .searchApplication(s -> s\n .indices(List.of(\"index1\",\"index2\"))\n .template(t -> t\n .script(sc -> sc\n .source(so -> so\n .scriptTemplate(scr -> scr\n .query(q -> q\n .queryString(qu -> qu\n .defaultField(\"{{default_field}}\")\n .query(\"{{query_string}}\")\n )\n )\n )\n )\n .params(Map.of(\"default_field\", JsonData.fromJson(\"\\\"*\\\"\"),\"query_string\", JsonData.fromJson(\"\\\"*\\\"\")))\n )\n )\n )\n);\n" + } + ], + "specification/search_application/get/examples/request/SearchApplicationGetRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.search_application.get(\n name=\"my-app\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.searchApplication.get({\n name: \"my-app\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.search_application.get(\n name: \"my-app\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->searchApplication()->get([\n \"name\" => \"my-app\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/search_application/my-app/\"" + }, + { + "language": "Java", + "code": "client.searchApplication().get(g -> g\n .name(\"my-app\")\n);\n" + } + ], + "specification/search_application/post_behavioral_analytics_event/examples/request/BehavioralAnalyticsEventPostRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.searchApplication().postBehavioralAnalyticsEvent(p -> p\n .collectionName(\"my_analytics_collection\")\n .eventType(EventType.SearchClick)\n .payload(JsonData.fromJson(\"{\\\"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\\\"}}\"))\n);\n" + } + ], + "specification/search_application/get_behavioral_analytics/examples/request/BehavioralAnalyticsGetRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.search_application.get_behavioral_analytics(\n name=\"my*\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.searchApplication.getBehavioralAnalytics({\n name: \"my*\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.search_application.get_behavioral_analytics(\n name: \"my*\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->searchApplication()->getBehavioralAnalytics([\n \"name\" => \"my*\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/analytics/my*\"" + }, + { + "language": "Java", + "code": "client.searchApplication().getBehavioralAnalytics(g -> g\n .name(\"my*\")\n);\n" + } + ], + "specification/search_application/delete_behavioral_analytics/examples/request/SearchApplicationDeleteBehavioralAnalyticsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.search_application.delete_behavioral_analytics(\n name=\"my_analytics_collection\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.searchApplication.deleteBehavioralAnalytics({\n name: \"my_analytics_collection\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.search_application.delete_behavioral_analytics(\n name: \"my_analytics_collection\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->searchApplication()->deleteBehavioralAnalytics([\n \"name\" => \"my_analytics_collection\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/analytics/my_analytics_collection/\"" + }, + { + "language": "Java", + "code": "client.searchApplication().deleteBehavioralAnalytics(d -> d\n .name(\"my_analytics_collection\")\n);\n" + } + ], + "specification/search_application/put_behavioral_analytics/examples/request/SearchApplicationPutBehavioralAnalyticsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.search_application.put_behavioral_analytics(\n name=\"my_analytics_collection\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.searchApplication.putBehavioralAnalytics({\n name: \"my_analytics_collection\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.search_application.put_behavioral_analytics(\n name: \"my_analytics_collection\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->searchApplication()->putBehavioralAnalytics([\n \"name\" => \"my_analytics_collection\",\n]);" + }, + { + "language": "curl", + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/analytics/my_analytics_collection\"" + }, + { + "language": "Java", + "code": "client.searchApplication().putBehavioralAnalytics(p -> p\n .name(\"my_analytics_collection\")\n);\n" + } + ], + "specification/search_application/search/examples/request/SearchApplicationsSearchRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.searchApplication().search(s -> s\n .name(\"my-app\")\n .params(Map.of(\"text_fields\", JsonData.fromJson(\"[{\\\"name\\\":\\\"title\\\",\\\"boost\\\":5},{\\\"name\\\":\\\"description\\\",\\\"boost\\\":1}]\"),\"query_string\", JsonData.fromJson(\"\\\"my first query\\\"\")))\n);\n" + } + ], + "specification/search_application/list/examples/request/SearchApplicationsListRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.search_application.list(\n from=\"0\",\n size=\"3\",\n q=\"app*\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.searchApplication.list({\n from: 0,\n size: 3,\n q: \"app*\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.search_application.list(\n from: \"0\",\n size: \"3\",\n q: \"app*\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->searchApplication()->list([\n \"from\" => \"0\",\n \"size\" => \"3\",\n \"q\" => \"app*\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/search_application?from=0&size=3&q=app*\"" + }, + { + "language": "Java", + "code": "client.searchApplication().list(l -> l\n .from(0)\n .q(\"app*\")\n .size(3)\n);\n" + } + ], + "specification/migration/get_feature_upgrade_status/examples/request/GetFeatureUpgradeStatusRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.migration().getFeatureUpgradeStatus();\n" + } + ], + "specification/migration/post_feature_upgrade/examples/request/PostFeatureUpgradeRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.migration().postFeatureUpgrade();\n" + } + ], + "specification/migration/deprecations/examples/request/DeprecationInfoRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.migration().deprecations(d -> d);\n" + } + ], + "specification/transform/start_transform/examples/request/TransformStartTransformExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.transform.start_transform(\n transform_id=\"ecommerce-customer-transform\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.transform.startTransform({\n transform_id: \"ecommerce-customer-transform\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.transform.start_transform(\n transform_id: \"ecommerce-customer-transform\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->transform()->startTransform([\n \"transform_id\" => \"ecommerce-customer-transform\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/ecommerce-customer-transform/_start\"" + }, + { + "language": "Java", + "code": "client.transform().startTransform(s -> s\n .transformId(\"ecommerce-customer-transform\")\n);\n" + } + ], + "specification/transform/schedule_now_transform/examples/request/TransformScheduleNowTransformExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.transform.schedule_now_transform(\n transform_id=\"ecommerce_transform\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.transform.scheduleNowTransform({\n transform_id: \"ecommerce_transform\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.transform.schedule_now_transform(\n transform_id: \"ecommerce_transform\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->transform()->scheduleNowTransform([\n \"transform_id\" => \"ecommerce_transform\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/ecommerce_transform/_schedule_now\"" + }, + { + "language": "Java", + "code": "client.transform().scheduleNowTransform(s -> s\n .transformId(\"ecommerce_transform\")\n);\n" + } + ], + "specification/transform/get_transform/examples/request/TransformGetTransformExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.transform.get_transform(\n size=\"10\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.transform.getTransform({\n size: 10,\n});" + }, + { + "language": "Ruby", + "code": "response = client.transform.get_transform(\n size: \"10\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->transform()->getTransform([\n \"size\" => \"10\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform?size=10\"" + }, + { + "language": "Java", + "code": "client.transform().getTransform(g -> g\n .size(10)\n);\n" + } + ], + "specification/transform/upgrade_transforms/examples/request/TransformUpgradeTransformsExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.transform().upgradeTransforms(u -> u);\n" + } + ], + "specification/transform/preview_transform/examples/request/PreviewTransformRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\":\"customer_id\",\"missing_bucket\":true}}},\"aggregations\":{\"max_price\":{\"max\":{\"field\":\"taxful_total_price\"}}}}}' \"$ELASTICSEARCH_URL/_transform/_preview\"" + }, + { + "language": "Java", + "code": "client.transform().previewTransform(p -> p\n .pivot(pi -> pi\n .aggregations(\"max_price\", a -> a\n .max(m -> m\n .field(\"taxful_total_price\")\n )\n )\n .groupBy(\"customer_id\", g -> g\n .terms(t -> t\n .field(\"customer_id\")\n .missingBucket(true)\n )\n )\n )\n .source(s -> s\n .index(\"kibana_sample_data_ecommerce\")\n )\n);\n" + } + ], + "specification/transform/put_transform/examples/request/PutTransformRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.transform().putTransform(p -> p\n .description(\"Latest order for each customer\")\n .dest(d -> d\n .index(\"kibana_sample_data_ecommerce_transform2\")\n )\n .frequency(f -> f\n .time(\"5m\")\n )\n .latest(l -> l\n .sort(\"order_date\")\n .uniqueKey(\"customer_id\")\n )\n .source(s -> s\n .index(\"kibana_sample_data_ecommerce\")\n )\n .sync(s -> s\n .time(t -> t\n .delay(d -> d\n .time(\"60s\")\n )\n .field(\"order_date\")\n )\n )\n .transformId(\"ecommerce_transform2\")\n);\n" + } + ], + "specification/transform/put_transform/examples/request/PutTransformRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.transform().putTransform(p -> p\n .description(\"Maximum priced ecommerce data by customer_id in Asia\")\n .dest(d -> d\n .index(\"kibana_sample_data_ecommerce_transform1\")\n .pipeline(\"add_timestamp_pipeline\")\n )\n .frequency(f -> f\n .time(\"5m\")\n )\n .pivot(pi -> pi\n .aggregations(\"max_price\", a -> a\n .max(m -> m\n .field(\"taxful_total_price\")\n )\n )\n .groupBy(\"customer_id\", g -> g\n .terms(t -> t\n .field(\"customer_id\")\n .missingBucket(true)\n )\n )\n )\n .retentionPolicy(r -> r\n .time(t -> t\n .field(\"order_date\")\n .maxAge(m -> m\n .time(\"30d\")\n )\n )\n )\n .source(s -> s\n .index(\"kibana_sample_data_ecommerce\")\n .query(q -> q\n .term(te -> te\n .field(\"geoip.continent_name\")\n .value(FieldValue.of(\"Asia\"))\n )\n )\n )\n .sync(sy -> sy\n .time(ti -> ti\n .delay(d -> d\n .time(\"60s\")\n )\n .field(\"order_date\")\n )\n )\n .transformId(\"ecommerce_transform1\")\n);\n" + } + ], + "specification/transform/update_transform/examples/request/UpdateTransformRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.transform().updateTransform(u -> u\n .description(\"Maximum priced ecommerce data by customer_id in Asia\")\n .dest(d -> d\n .index(\"kibana_sample_data_ecommerce_transform1\")\n .pipeline(\"add_timestamp_pipeline\")\n )\n .frequency(f -> f\n .time(\"5m\")\n )\n .retentionPolicy(r -> r\n .time(t -> t\n .field(\"order_date\")\n .maxAge(m -> m\n .time(\"30d\")\n )\n )\n )\n .source(s -> s\n .index(\"kibana_sample_data_ecommerce\")\n .query(q -> q\n .term(te -> te\n .field(\"geoip.continent_name\")\n .value(FieldValue.of(\"Asia\"))\n )\n )\n )\n .sync(sy -> sy\n .time(ti -> ti\n .delay(d -> d\n .time(\"60s\")\n )\n .field(\"order_date\")\n )\n )\n .transformId(\"simple-kibana-ecomm-pivot\")\n);\n" + } + ], + "specification/transform/reset_transform/examples/request/TransformResetTransformExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.transform.reset_transform(\n transform_id=\"ecommerce_transform\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.transform.resetTransform({\n transform_id: \"ecommerce_transform\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.transform.reset_transform(\n transform_id: \"ecommerce_transform\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->transform()->resetTransform([\n \"transform_id\" => \"ecommerce_transform\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/ecommerce_transform/_reset\"" + }, + { + "language": "Java", + "code": "client.transform().resetTransform(r -> r\n .transformId(\"ecommerce_transform\")\n);\n" + } + ], + "specification/transform/stop_transform/examples/request/TransformStopTransformExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.transform.stop_transform(\n transform_id=\"ecommerce_transform\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.transform.stopTransform({\n transform_id: \"ecommerce_transform\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.transform.stop_transform(\n transform_id: \"ecommerce_transform\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->transform()->stopTransform([\n \"transform_id\" => \"ecommerce_transform\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/ecommerce_transform/_stop\"" + }, + { + "language": "Java", + "code": "client.transform().stopTransform(s -> s\n .transformId(\"ecommerce_transform\")\n);\n" + } + ], + "specification/transform/get_transform_stats/examples/request/TransformGetTransformStatsExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.transform.get_transform_stats(\n transform_id=\"ecommerce-customer-transform\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.transform.getTransformStats({\n transform_id: \"ecommerce-customer-transform\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.transform.get_transform_stats(\n transform_id: \"ecommerce-customer-transform\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->transform()->getTransformStats([\n \"transform_id\" => \"ecommerce-customer-transform\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/ecommerce-customer-transform/_stats\"" + }, + { + "language": "Java", + "code": "client.transform().getTransformStats(g -> g\n .transformId(\"ecommerce-customer-transform\")\n);\n" + } + ], + "specification/transform/delete_transform/examples/request/TransformDeleteTransformExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.transform.delete_transform(\n transform_id=\"ecommerce_transform\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.transform.deleteTransform({\n transform_id: \"ecommerce_transform\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.transform.delete_transform(\n transform_id: \"ecommerce_transform\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->transform()->deleteTransform([\n \"transform_id\" => \"ecommerce_transform\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_transform/ecommerce_transform\"" + }, + { + "language": "Java", + "code": "client.transform().deleteTransform(d -> d\n .transformId(\"ecommerce_transform\")\n);\n" + } + ], + "specification/ccr/forget_follower/examples/request/ForgetFollowerIndexRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ccr.forget_follower(\n index=\"\",\n follower_cluster=\"\",\n follower_index=\"\",\n follower_index_uuid=\"\",\n leader_remote_cluster=\"\",\n)" + }, + { + "language": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.ccr().forgetFollower(f -> f\n .followerCluster(\"\")\n .followerIndex(\"\")\n .followerIndexUuid(\"\")\n .index(\"\")\n .leaderRemoteCluster(\"\")\n);\n" + } + ], + "specification/ccr/delete_auto_follow_pattern/examples/request/DeleteAutoFollowPatternRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ccr.delete_auto_follow_pattern(\n name=\"my_auto_follow_pattern\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ccr.deleteAutoFollowPattern({\n name: \"my_auto_follow_pattern\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ccr.delete_auto_follow_pattern(\n name: \"my_auto_follow_pattern\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ccr()->deleteAutoFollowPattern([\n \"name\" => \"my_auto_follow_pattern\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ccr/auto_follow/my_auto_follow_pattern\"" + }, + { + "language": "Java", + "code": "client.ccr().deleteAutoFollowPattern(d -> d\n .name(\"my_auto_follow_pattern\")\n);\n" + } + ], + "specification/ccr/resume_auto_follow_pattern/examples/request/ResumeAutoFollowPatternRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ccr.resume_auto_follow_pattern(\n name=\"my_auto_follow_pattern\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ccr.resumeAutoFollowPattern({\n name: \"my_auto_follow_pattern\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ccr.resume_auto_follow_pattern(\n name: \"my_auto_follow_pattern\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ccr()->resumeAutoFollowPattern([\n \"name\" => \"my_auto_follow_pattern\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ccr/auto_follow/my_auto_follow_pattern/resume\"" + }, + { + "language": "Java", + "code": "client.ccr().resumeAutoFollowPattern(r -> r\n .name(\"my_auto_follow_pattern\")\n);\n" + } + ], + "specification/ccr/pause_follow/examples/request/PauseFollowIndexRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ccr.pause_follow(\n index=\"follower_index\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ccr.pauseFollow({\n index: \"follower_index\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ccr.pause_follow(\n index: \"follower_index\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ccr()->pauseFollow([\n \"index\" => \"follower_index\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/follower_index/_ccr/pause_follow\"" + }, + { + "language": "Java", + "code": "client.ccr().pauseFollow(p -> p\n .index(\"follower_index\")\n);\n" + } + ], + "specification/ccr/follow/examples/request/CreateFollowIndexRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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_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": "Java", + "code": "client.ccr().follow(f -> f\n .index(\"follower_index\")\n .leaderIndex(\"leader_index\")\n .maxOutstandingReadRequests(16L)\n .maxOutstandingWriteRequests(8)\n .maxReadRequestOperationCount(1024)\n .maxReadRequestSize(\"1024k\")\n .maxRetryDelay(m -> m\n .time(\"10s\")\n )\n .maxWriteBufferCount(512)\n .maxWriteBufferSize(\"512k\")\n .maxWriteRequestOperationCount(32768)\n .maxWriteRequestSize(\"16k\")\n .readPollTimeout(r -> r\n .time(\"30s\")\n )\n .remoteCluster(\"remote_cluster\")\n .settings(s -> s\n .otherSettings(\"index.number_of_replicas\", JsonData.fromJson(\"0\"))\n )\n .waitForActiveShards(w -> w\n .count(1)\n )\n);\n" + } + ], + "specification/ccr/get_auto_follow_pattern/examples/request/GetAutoFollowPatternRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ccr.get_auto_follow_pattern(\n name=\"my_auto_follow_pattern\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ccr.getAutoFollowPattern({\n name: \"my_auto_follow_pattern\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ccr.get_auto_follow_pattern(\n name: \"my_auto_follow_pattern\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ccr()->getAutoFollowPattern([\n \"name\" => \"my_auto_follow_pattern\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ccr/auto_follow/my_auto_follow_pattern\"" + }, + { + "language": "Java", + "code": "client.ccr().getAutoFollowPattern(g -> g\n .name(\"my_auto_follow_pattern\")\n);\n" + } + ], + "specification/ccr/put_auto_follow_pattern/examples/request/PutAutoFollowPatternRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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_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": "Java", + "code": "client.ccr().putAutoFollowPattern(p -> p\n .followIndexPattern(\"{{leader_index}}-follower\")\n .leaderIndexPatterns(\"leader_index*\")\n .maxOutstandingReadRequests(16)\n .maxOutstandingWriteRequests(8)\n .maxReadRequestOperationCount(1024)\n .maxReadRequestSize(\"1024k\")\n .maxRetryDelay(m -> m\n .time(\"10s\")\n )\n .maxWriteBufferCount(512)\n .maxWriteBufferSize(\"512k\")\n .maxWriteRequestOperationCount(32768)\n .maxWriteRequestSize(\"16k\")\n .name(\"my_auto_follow_pattern\")\n .readPollTimeout(r -> r\n .time(\"30s\")\n )\n .remoteCluster(\"remote_cluster\")\n .settings(\"index.number_of_replicas\", JsonData.fromJson(\"0\"))\n);\n" + } + ], + "specification/ccr/follow_info/examples/request/FollowInfoRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ccr.follow_info(\n index=\"follower_index\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ccr.followInfo({\n index: \"follower_index\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ccr.follow_info(\n index: \"follower_index\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ccr()->followInfo([\n \"index\" => \"follower_index\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/follower_index/_ccr/info\"" + }, + { + "language": "Java", + "code": "client.ccr().followInfo(f -> f\n .index(\"follower_index\")\n);\n" + } + ], + "specification/ccr/unfollow/examples/request/UnfollowIndexRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ccr.unfollow(\n index=\"follower_index\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ccr.unfollow({\n index: \"follower_index\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ccr.unfollow(\n index: \"follower_index\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ccr()->unfollow([\n \"index\" => \"follower_index\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/follower_index/_ccr/unfollow\"" + }, + { + "language": "Java", + "code": "client.ccr().unfollow(u -> u\n .index(\"follower_index\")\n);\n" + } + ], + "specification/ccr/resume_follow/examples/request/ResumeFollowIndexRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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_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": "Java", + "code": "client.ccr().resumeFollow(r -> r\n .index(\"follower_index\")\n .maxOutstandingReadRequests(16L)\n .maxOutstandingWriteRequests(8L)\n .maxReadRequestOperationCount(1024L)\n .maxReadRequestSize(\"1024k\")\n .maxRetryDelay(m -> m\n .time(\"10s\")\n )\n .maxWriteBufferCount(512L)\n .maxWriteBufferSize(\"512k\")\n .maxWriteRequestOperationCount(32768L)\n .maxWriteRequestSize(\"16k\")\n .readPollTimeout(re -> re\n .time(\"30s\")\n )\n);\n" + } + ], + "specification/ccr/follow_stats/examples/request/FollowIndexStatsRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ccr.follow_stats(\n index=\"follower_index\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ccr.followStats({\n index: \"follower_index\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ccr.follow_stats(\n index: \"follower_index\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ccr()->followStats([\n \"index\" => \"follower_index\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/follower_index/_ccr/stats\"" + }, + { + "language": "Java", + "code": "client.ccr().followStats(f -> f\n .index(\"follower_index\")\n);\n" + } + ], + "specification/ccr/stats/examples/request/CcrStatsRequestExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.ccr().stats(s -> s);\n" + } + ], + "specification/ccr/pause_auto_follow_pattern/examples/request/PauseAutoFollowPatternRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ccr.pause_auto_follow_pattern(\n name=\"my_auto_follow_pattern\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ccr.pauseAutoFollowPattern({\n name: \"my_auto_follow_pattern\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ccr.pause_auto_follow_pattern(\n name: \"my_auto_follow_pattern\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ccr()->pauseAutoFollowPattern([\n \"name\" => \"my_auto_follow_pattern\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ccr/auto_follow/my_auto_follow_pattern/pause\"" + }, + { + "language": "Java", + "code": "client.ccr().pauseAutoFollowPattern(p -> p\n .name(\"my_auto_follow_pattern\")\n);\n" + } + ], + "specification/ilm/get_status/examples/request/IlmGetStatusExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.ilm().getStatus();\n" + } + ], + "specification/ilm/move_to_step/examples/request/MoveToStepRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\",\"action\":\"forcemerge\",\"name\":\"forcemerge\"}}' \"$ELASTICSEARCH_URL/_ilm/move/my-index-000001\"" + }, + { + "language": "Java", + "code": "client.ilm().moveToStep(m -> m\n .currentStep(c -> c\n .action(\"complete\")\n .name(\"complete\")\n .phase(\"new\")\n )\n .index(\"my-index-000001\")\n .nextStep(n -> n\n .action(\"forcemerge\")\n .name(\"forcemerge\")\n .phase(\"warm\")\n )\n);\n" + } + ], + "specification/ilm/move_to_step/examples/request/MoveToStepRequestExample2.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.ilm().moveToStep(m -> m\n .currentStep(c -> c\n .action(\"complete\")\n .name(\"complete\")\n .phase(\"hot\")\n )\n .index(\"my-index-000001\")\n .nextStep(n -> n\n .phase(\"warm\")\n )\n);\n" + } + ], + "specification/ilm/migrate_to_data_tiers/examples/request/MigrateToDataTiersRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ilm.migrate_to_data_tiers(\n legacy_template_to_delete=\"global-template\",\n node_attribute=\"custom_attribute_name\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ilm.migrateToDataTiers({\n legacy_template_to_delete: \"global-template\",\n node_attribute: \"custom_attribute_name\",\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "code": "$resp = $client->ilm()->migrateToDataTiers([\n \"body\" => [\n \"legacy_template_to_delete\" => \"global-template\",\n \"node_attribute\" => \"custom_attribute_name\",\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.ilm().migrateToDataTiers(m -> m\n .legacyTemplateToDelete(\"global-template\")\n .nodeAttribute(\"custom_attribute_name\")\n);\n" + } + ], + "specification/ilm/retry/examples/request/IlmRetryExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ilm.retry(\n index=\"my-index-000001\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ilm.retry({\n index: \"my-index-000001\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ilm.retry(\n index: \"my-index-000001\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ilm()->retry([\n \"index\" => \"my-index-000001\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_ilm/retry\"" + }, + { + "language": "Java", + "code": "client.ilm().retry(r -> r\n .index(\"my-index-000001\")\n);\n" + } + ], + "specification/ilm/delete_lifecycle/examples/request/IlmDeleteLifecycleExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ilm.delete_lifecycle(\n name=\"my_policy\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ilm.deleteLifecycle({\n name: \"my_policy\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ilm.delete_lifecycle(\n policy: \"my_policy\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ilm()->deleteLifecycle([\n \"policy\" => \"my_policy\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ilm/policy/my_policy\"" + }, + { + "language": "Java", + "code": "client.ilm().deleteLifecycle(d -> d\n .name(\"my_policy\")\n);\n" + } + ], + "specification/ilm/start/examples/request/IlmStartExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.ilm().start(s -> s);\n" + } + ], + "specification/ilm/explain_lifecycle/examples/request/IlmExplainLifecycleExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ilm.explain_lifecycle(\n index=\".ds-timeseries-*\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ilm.explainLifecycle({\n index: \".ds-timeseries-*\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ilm.explain_lifecycle(\n index: \".ds-timeseries-*\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ilm()->explainLifecycle([\n \"index\" => \".ds-timeseries-*\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/.ds-timeseries-*/_ilm/explain\"" + }, + { + "language": "Java", + "code": "client.ilm().explainLifecycle(e -> e\n .index(\".ds-timeseries-*\")\n);\n" + } + ], + "specification/ilm/stop/examples/request/IlmStopExample1.yaml": [ + { + "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\"" + }, + { + "language": "Java", + "code": "client.ilm().stop(s -> s);\n" + } + ], + "specification/ilm/remove_policy/examples/request/IlmRemovePolicyExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ilm.remove_policy(\n index=\"logs-my_app-default\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ilm.removePolicy({\n index: \"logs-my_app-default\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ilm.remove_policy(\n index: \"logs-my_app-default\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ilm()->removePolicy([\n \"index\" => \"logs-my_app-default\",\n]);" + }, + { + "language": "curl", + "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/logs-my_app-default/_ilm/remove\"" + }, + { + "language": "Java", + "code": "client.ilm().removePolicy(r -> r\n .index(\"logs-my_app-default\")\n);\n" + } + ], + "specification/ilm/get_lifecycle/examples/request/IlmGetLifecycleExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.ilm.get_lifecycle(\n name=\"my_policy\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.ilm.getLifecycle({\n name: \"my_policy\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.ilm.get_lifecycle(\n policy: \"my_policy\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->ilm()->getLifecycle([\n \"policy\" => \"my_policy\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ilm/policy/my_policy\"" + }, + { + "language": "Java", + "code": "client.ilm().getLifecycle(g -> g\n .name(\"my_policy\")\n);\n" + } + ], + "specification/ilm/put_lifecycle/examples/request/PutLifecycleRequestExample1.yaml": [ + { + "language": "Python", + "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": "JavaScript", + "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": "Ruby", + "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": "PHP", + "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": "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\",\"actions\":{\"forcemerge\":{\"max_num_segments\":1}}},\"delete\":{\"min_age\":\"30d\",\"actions\":{\"delete\":{}}}}}}' \"$ELASTICSEARCH_URL/_ilm/policy/my_policy\"" + }, + { + "language": "Java", + "code": "client.ilm().putLifecycle(p -> p\n .name(\"my_policy\")\n .policy(po -> po\n .phases(ph -> ph\n .delete(d -> d\n .actions(a -> a\n .delete(de -> de)\n )\n .minAge(m -> m\n .time(\"30d\")\n )\n )\n .warm(w -> w\n .actions(a -> a\n .forcemerge(f -> f\n .maxNumSegments(1)\n )\n )\n .minAge(m -> m\n .time(\"10d\")\n )\n )\n )\n .meta(Map.of(\"description\", JsonData.fromJson(\"\\\"used for nginx log\\\"\"),\"project\", JsonData.fromJson(\"{\\\"name\\\":\\\"myProject\\\",\\\"department\\\":\\\"myDepartment\\\"}\")))\n )\n);\n" + } + ], + "specification/sql/delete_async/examples/request/SqlDeleteAsyncExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.sql.delete_async(\n id=\"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.sql.deleteAsync({\n id: \"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.sql.delete_async(\n id: \"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->sql()->deleteAsync([\n \"id\" => \"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\",\n]);" + }, + { + "language": "curl", + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_sql/async/delete/FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\"" + }, + { + "language": "Java", + "code": "client.sql().deleteAsync(d -> d\n .id(\"FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=\")\n);\n" + } + ], + "specification/sql/translate/examples/request/TranslateSqlRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.sql.translate(\n query=\"SELECT * FROM library ORDER BY page_count DESC\",\n fetch_size=10,\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.sql.translate({\n query: \"SELECT * FROM library ORDER BY page_count DESC\",\n fetch_size: 10,\n});" + }, + { + "language": "Ruby", + "code": "response = client.sql.translate(\n body: {\n \"query\": \"SELECT * FROM library ORDER BY page_count DESC\",\n \"fetch_size\": 10\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->sql()->translate([\n \"body\" => [\n \"query\" => \"SELECT * FROM library ORDER BY page_count DESC\",\n \"fetch_size\" => 10,\n ],\n]);" + }, + { + "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\"" + }, + { + "language": "Java", + "code": "client.sql().translate(t -> t\n .fetchSize(10)\n .query(\"SELECT * FROM library ORDER BY page_count DESC\")\n);\n" + } + ], + "specification/sql/clear_cursor/examples/request/ClearSqlCursorRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.sql.clear_cursor(\n cursor=\"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.sql.clearCursor({\n cursor:\n \"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.sql.clear_cursor(\n body: {\n \"cursor\": \"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\"\n }\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->sql()->clearCursor([\n \"body\" => [\n \"cursor\" => \"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\",\n ],\n]);" + }, + { + "language": "curl", + "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": "Java", + "code": "client.sql().clearCursor(c -> c\n .cursor(\"sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=\")\n);\n" + } + ], + "specification/sql/get_async/examples/request/SqlGetAsyncExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.sql.get_async(\n id=\"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n wait_for_completion_timeout=\"2s\",\n format=\"json\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.sql.getAsync({\n id: \"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n wait_for_completion_timeout: \"2s\",\n format: \"json\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.sql.get_async(\n id: \"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n wait_for_completion_timeout: \"2s\",\n format: \"json\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->sql()->getAsync([\n \"id\" => \"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n \"wait_for_completion_timeout\" => \"2s\",\n \"format\" => \"json\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_sql/async/FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=?wait_for_completion_timeout=2s&format=json\"" + }, + { + "language": "Java", + "code": "client.sql().getAsync(g -> g\n .format(\"json\")\n .id(\"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\")\n .waitForCompletionTimeout(w -> w\n .offset(2)\n )\n);\n" + } + ], + "specification/sql/get_async_status/examples/request/SqlGetAsyncStatusExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.sql.get_async_status(\n id=\"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.sql.getAsyncStatus({\n id: \"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n});" + }, + { + "language": "Ruby", + "code": "response = client.sql.get_async_status(\n id: \"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\"\n)" + }, + { + "language": "PHP", + "code": "$resp = $client->sql()->getAsyncStatus([\n \"id\" => \"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\",\n]);" + }, + { + "language": "curl", + "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_sql/async/status/FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\"" + }, + { + "language": "Java", + "code": "client.sql().getAsyncStatus(g -> g\n .id(\"FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=\")\n);\n" + } + ], + "specification/sql/query/examples/request/QuerySqlRequestExample1.yaml": [ + { + "language": "Python", + "code": "resp = client.sql.query(\n format=\"txt\",\n query=\"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\",\n)" + }, + { + "language": "JavaScript", + "code": "const response = await client.sql.query({\n format: \"txt\",\n query: \"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\",\n});" + }, + { + "language": "Ruby", + "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": "PHP", + "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": "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\"" + }, + { + "language": "Java", + "code": "client.sql().query(q -> q\n .format(SqlFormat.Txt)\n .query(\"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\")\n);\n" + } + ] +} \ No newline at end of file diff --git a/output/schema/schema.json b/output/schema/schema.json index 1329099dd2..305dd65aba 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -154519,6 +154519,28 @@ "description": "Get data stream mappings.\n\nGet mapping information for one or more data streams.", "examples": { "IndicesGetDataStreamMappingsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.get_data_stream_mappings(\n name=\"my-data-stream\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.getDataStreamMappings({\n name: \"my-data-stream\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.get_data_stream_mappings(\n name: \"my-data-stream\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->getDataStreamMappings([\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/_mappings\"", + "language": "curl" + } + ], "method_request": "GET /_data_stream/my-data-stream/_mappings", "summary": "Gets the mappings for a data stream", "type": "request" @@ -157218,6 +157240,28 @@ "description": "Update data stream mappings.\n\nThis API can be used to override mappings on specific data streams. These overrides will take precedence over what\nis specified in the template that the data stream matches. The mapping change is only applied to new write indices\nthat are created during rollover after this API is called. No indices are changed by this API.", "examples": { "IndicesPutDataStreamMappingsRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.put_data_stream_mappings(\n name=\"my-data-stream\",\n mappings={\n \"properties\": {\n \"field1\": {\n \"type\": \"ip\"\n },\n \"field3\": {\n \"type\": \"text\"\n }\n }\n },\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.putDataStreamMappings({\n name: \"my-data-stream\",\n mappings: {\n properties: {\n field1: {\n type: \"ip\",\n },\n field3: {\n type: \"text\",\n },\n },\n },\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.put_data_stream_mappings(\n name: \"my-data-stream\",\n body: {\n \"properties\": {\n \"field1\": {\n \"type\": \"ip\"\n },\n \"field3\": {\n \"type\": \"text\"\n }\n }\n }\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->putDataStreamMappings([\n \"name\" => \"my-data-stream\",\n \"body\" => [\n \"properties\" => [\n \"field1\" => [\n \"type\" => \"ip\",\n ],\n \"field3\" => [\n \"type\" => \"text\",\n ],\n ],\n ],\n]);", + "language": "PHP" + }, + { + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"properties\":{\"field1\":{\"type\":\"ip\"},\"field3\":{\"type\":\"text\"}}}' \"$ELASTICSEARCH_URL/_data_stream/my-data-stream/_mappings\"", + "language": "curl" + } + ], "description": "This is a request to add or modify two fields in a mapping on a data stream.\n", "method_request": "PUT /_data_stream/my-data-stream/_mappings", "summary": "Change a data stream mapping", diff --git a/specification/_global/bulk/examples/request/BulkRequestExample1.yaml b/specification/_global/bulk/examples/request/BulkRequestExample1.yaml index 47da76d1f9..9e7b8d46f4 100644 --- a/specification/_global/bulk/examples/request/BulkRequestExample1.yaml +++ b/specification/_global/bulk/examples/request/BulkRequestExample1.yaml @@ -15,174 +15,3 @@ 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 804a7660ce..21a50ef6c8 100644 --- a/specification/_global/bulk/examples/request/BulkRequestExample2.yaml +++ b/specification/_global/bulk/examples/request/BulkRequestExample2.yaml @@ -25,309 +25,3 @@ 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 f8bbcb0027..bd9961f252 100644 --- a/specification/_global/bulk/examples/request/BulkRequestExample3.yaml +++ b/specification/_global/bulk/examples/request/BulkRequestExample3.yaml @@ -14,158 +14,3 @@ 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 c48b2791ab..7514b67bfe 100644 --- a/specification/_global/bulk/examples/request/BulkRequestExample4.yaml +++ b/specification/_global/bulk/examples/request/BulkRequestExample4.yaml @@ -14,143 +14,3 @@ value: { "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 eb61339204..7991e9565d 100644 --- a/specification/_global/clear_scroll/examples/request/ClearScrollRequestExample1.yaml +++ b/specification/_global/clear_scroll/examples/request/ClearScrollRequestExample1.yaml @@ -6,37 +6,3 @@ 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"' - - language: Java - code: | - client.clearScroll(c -> c - .scrollId("DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==") - ); 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 cc0a4eb39c..0ecd43ce36 100644 --- a/specification/_global/close_point_in_time/examples/request/ClosePointInTimeRequestExample1.yaml +++ b/specification/_global/close_point_in_time/examples/request/ClosePointInTimeRequestExample1.yaml @@ -6,38 +6,3 @@ 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\"" - - language: Java - code: > - client.closePointInTime(c -> c - .id("46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==") - ); diff --git a/specification/_global/count/examples/request/CountRequestExample1.yaml b/specification/_global/count/examples/request/CountRequestExample1.yaml index 857e40f5b4..390a86af46 100644 --- a/specification/_global/count/examples/request/CountRequestExample1.yaml +++ b/specification/_global/count/examples/request/CountRequestExample1.yaml @@ -10,63 +10,3 @@ 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"' - - language: Java - code: | - client.count(c -> c - .index("my-index-000001") - .query(q -> q - .term(t -> t - .field("user.id") - .value(FieldValue.of("kimchy")) - ) - ) - ); diff --git a/specification/_global/create/examples/request/CreateRequestExample1.yaml b/specification/_global/create/examples/request/CreateRequestExample1.yaml index dfde37d20a..ea371cb4ba 100644 --- a/specification/_global/create/examples/request/CreateRequestExample1.yaml +++ b/specification/_global/create/examples/request/CreateRequestExample1.yaml @@ -11,68 +11,3 @@ 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"' - - language: Java - code: > - client.create(c -> c - .id("1") - .index("my-index-000001") - .document(JsonData.fromJson("{\"@timestamp\":\"2099-11-15T13:12:00\",\"message\":\"GET /search HTTP/1.1 200 1070000\",\"user\":{\"id\":\"kimchy\"}}")) - ); diff --git a/specification/_global/delete/examples/request/DeleteRequestExample1.yaml b/specification/_global/delete/examples/request/DeleteRequestExample1.yaml index b0ab79db88..2b4da466ae 100644 --- a/specification/_global/delete/examples/request/DeleteRequestExample1.yaml +++ b/specification/_global/delete/examples/request/DeleteRequestExample1.yaml @@ -1,34 +1 @@ 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"' - - language: Java - code: | - client.delete(d -> d - .id("1") - .index("my-index-000001") - ); diff --git a/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample1.yaml b/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample1.yaml index c250ea4e0f..24be0c7559 100644 --- a/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample1.yaml +++ b/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample1.yaml @@ -8,52 +8,3 @@ 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"' - - language: Java - code: | - client.deleteByQuery(d -> d - .index(List.of("my-index-000001","my-index-000002")) - .query(q -> q - .matchAll(m -> m) - ) - ); diff --git a/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample2.yaml b/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample2.yaml index fd9b0117ca..8a90734e19 100644 --- a/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample2.yaml +++ b/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample2.yaml @@ -11,68 +11,3 @@ 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"' - - language: Java - code: | - client.deleteByQuery(d -> d - .index("my-index-000001") - .maxDocs(1L) - .query(q -> q - .term(t -> t - .field("user.id") - .value(FieldValue.of("kimchy")) - ) - ) - ); diff --git a/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample3.yaml b/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample3.yaml index 14d9a2e78c..f1b1f48a55 100644 --- a/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample3.yaml +++ b/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample3.yaml @@ -17,94 +17,3 @@ 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"' - - language: Java - code: | - client.deleteByQuery(d -> d - .index("my-index-000001") - .query(q -> q - .range(r -> r - .untyped(u -> u - .field("http.response.bytes") - .lt(JsonData.fromJson("2000000")) - ) - ) - ) - .slice(s -> s - .id("0") - .max(2) - ) - ); diff --git a/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample4.yaml b/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample4.yaml index 3515eee83d..f579a4b761 100644 --- a/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample4.yaml +++ b/specification/_global/delete_by_query/examples/request/DeleteByQueryRequestExample4.yaml @@ -14,86 +14,3 @@ 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"' - - language: Java - code: | - client.deleteByQuery(d -> d - .index("my-index-000001") - .query(q -> q - .range(r -> r - .untyped(u -> u - .field("http.response.bytes") - .lt(JsonData.fromJson("2000000")) - ) - ) - ) - .refresh(true) - .slices(s -> s - .value(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 eda73fba47..8de0dd841e 100644 --- a/specification/_global/delete_by_query_rethrottle/examples/request/DeleteByQueryRethrottleRequestExample1.yaml +++ b/specification/_global/delete_by_query_rethrottle/examples/request/DeleteByQueryRethrottleRequestExample1.yaml @@ -1,35 +1 @@ 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"' - - language: Java - code: | - client.deleteByQueryRethrottle(d -> d - .requestsPerSecond(-1.0F) - .taskId("r1A2WoRbTwKZ516z6NEs5A:36619") - ); diff --git a/specification/_global/delete_script/examples/request/DeleteScriptRequestExample1.yaml b/specification/_global/delete_script/examples/request/DeleteScriptRequestExample1.yaml index b3c9e105cf..ac34bada0e 100644 --- a/specification/_global/delete_script/examples/request/DeleteScriptRequestExample1.yaml +++ b/specification/_global/delete_script/examples/request/DeleteScriptRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.deleteScript(d -> d - .id("my-search-template") - ); diff --git a/specification/_global/exists/examples/request/DocumentExistsRequestExample1.yaml b/specification/_global/exists/examples/request/DocumentExistsRequestExample1.yaml index dd2cca32d4..78295be42a 100644 --- a/specification/_global/exists/examples/request/DocumentExistsRequestExample1.yaml +++ b/specification/_global/exists/examples/request/DocumentExistsRequestExample1.yaml @@ -1,34 +1 @@ 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"' - - language: Java - code: | - client.exists(e -> e - .id("0") - .index("my-index-000001") - ); diff --git a/specification/_global/exists_source/examples/request/ExistsSourceRequestExample1.yaml b/specification/_global/exists_source/examples/request/ExistsSourceRequestExample1.yaml index 5e759ef9d5..3a5a843b8c 100644 --- a/specification/_global/exists_source/examples/request/ExistsSourceRequestExample1.yaml +++ b/specification/_global/exists_source/examples/request/ExistsSourceRequestExample1.yaml @@ -1,34 +1 @@ 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"' - - language: Java - code: | - client.existsSource(e -> e - .id("1") - .index("my-index-000001") - ); diff --git a/specification/_global/explain/examples/request/ExplainRequestExample1.yaml b/specification/_global/explain/examples/request/ExplainRequestExample1.yaml index 5ffef69b50..1c7991892c 100644 --- a/specification/_global/explain/examples/request/ExplainRequestExample1.yaml +++ b/specification/_global/explain/examples/request/ExplainRequestExample1.yaml @@ -10,68 +10,3 @@ 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"' - - language: Java - code: | - client.explain(e -> e - .id("0") - .index("my-index-000001") - .query(q -> q - .match(m -> m - .field("message") - .query(FieldValue.of("elasticsearch")) - ) - ) - ); diff --git a/specification/_global/field_caps/examples/request/FieldCapabilitiesRequestExample1.yaml b/specification/_global/field_caps/examples/request/FieldCapabilitiesRequestExample1.yaml index af2097ff7e..d67e145aea 100644 --- a/specification/_global/field_caps/examples/request/FieldCapabilitiesRequestExample1.yaml +++ b/specification/_global/field_caps/examples/request/FieldCapabilitiesRequestExample1.yaml @@ -14,65 +14,3 @@ 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 fe75965b61..22ed571367 100644 --- a/specification/_global/get/examples/request/GetRequestExample2.yaml +++ b/specification/_global/get/examples/request/GetRequestExample2.yaml @@ -1,33 +1 @@ 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 e135beaf68..60d3bb295d 100644 --- a/specification/_global/get_script/examples/request/GetScriptRequestExample1.yaml +++ b/specification/_global/get_script/examples/request/GetScriptRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.getScript(g -> g - .id("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 e141bee6a7..a0715429dd 100644 --- a/specification/_global/get_script_context/examples/request/GetScriptContextRequestExample1.yaml +++ b/specification/_global/get_script_context/examples/request/GetScriptContextRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.getScriptContext(); diff --git a/specification/_global/get_script_languages/examples/request/GetScriptLanguagesRequestExample1.yaml b/specification/_global/get_script_languages/examples/request/GetScriptLanguagesRequestExample1.yaml index a8193bbfb3..3db7b33d30 100644 --- a/specification/_global/get_script_languages/examples/request/GetScriptLanguagesRequestExample1.yaml +++ b/specification/_global/get_script_languages/examples/request/GetScriptLanguagesRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.getScriptLanguages(); diff --git a/specification/_global/get_source/examples/request/GetSourceRequestExample1.yaml b/specification/_global/get_source/examples/request/GetSourceRequestExample1.yaml index 6470ad8596..dca7123365 100644 --- a/specification/_global/get_source/examples/request/GetSourceRequestExample1.yaml +++ b/specification/_global/get_source/examples/request/GetSourceRequestExample1.yaml @@ -1,34 +1 @@ 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"' - - language: Java - code: | - client.getSource(g -> g - .id("1") - .index("my-index-000001") - ); diff --git a/specification/_global/health_report/examples/request/HealthReportRequestExample1.yaml b/specification/_global/health_report/examples/request/HealthReportRequestExample1.yaml index e1eac5c51b..a64e53a03b 100644 --- a/specification/_global/health_report/examples/request/HealthReportRequestExample1.yaml +++ b/specification/_global/health_report/examples/request/HealthReportRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.healthReport(h -> h); diff --git a/specification/_global/index/examples/request/IndexRequestExample1.yaml b/specification/_global/index/examples/request/IndexRequestExample1.yaml index 75c40c0d48..8af2d206e0 100644 --- a/specification/_global/index/examples/request/IndexRequestExample1.yaml +++ b/specification/_global/index/examples/request/IndexRequestExample1.yaml @@ -12,63 +12,3 @@ 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/"' - - language: Java - code: > - client.index(i -> i - .index("my-index-000001") - .document(JsonData.fromJson("{\"@timestamp\":\"2099-11-15T13:12:00\",\"message\":\"GET /search HTTP/1.1 200 1070000\",\"user\":{\"id\":\"kimchy\"}}")) - ); diff --git a/specification/_global/index/examples/request/IndexRequestExample2.yaml b/specification/_global/index/examples/request/IndexRequestExample2.yaml index dacad5caad..a3a5c9aea9 100644 --- a/specification/_global/index/examples/request/IndexRequestExample2.yaml +++ b/specification/_global/index/examples/request/IndexRequestExample2.yaml @@ -11,68 +11,3 @@ 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"' - - language: Java - code: > - client.index(i -> i - .id("1") - .index("my-index-000001") - .document(JsonData.fromJson("{\"@timestamp\":\"2099-11-15T13:12:00\",\"message\":\"GET /search HTTP/1.1 200 1070000\",\"user\":{\"id\":\"kimchy\"}}")) - ); diff --git a/specification/_global/info/examples/request/RootNodeInfoRequestExample1.yaml b/specification/_global/info/examples/request/RootNodeInfoRequestExample1.yaml index daeaea8b37..54a75d703d 100644 --- a/specification/_global/info/examples/request/RootNodeInfoRequestExample1.yaml +++ b/specification/_global/info/examples/request/RootNodeInfoRequestExample1.yaml @@ -1,15 +1 @@ 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/"' - - language: Java - code: | - client.info(); diff --git a/specification/_global/mget/examples/request/MultiGetRequestExample1.yaml b/specification/_global/mget/examples/request/MultiGetRequestExample1.yaml index d69aebb34f..92e0eda23f 100644 --- a/specification/_global/mget/examples/request/MultiGetRequestExample1.yaml +++ b/specification/_global/mget/examples/request/MultiGetRequestExample1.yaml @@ -15,72 +15,3 @@ 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"' - - language: Java - code: | - client.mget(m -> m - .docs(List.of(MultiGetOperation.of(mu -> mu - .id("1")),MultiGetOperation.of(mu -> mu - .id("2")))) - .index("my-index-000001") - ); diff --git a/specification/_global/mget/examples/request/MultiGetRequestExample2.yaml b/specification/_global/mget/examples/request/MultiGetRequestExample2.yaml index f269d68104..b451db0c6e 100644 --- a/specification/_global/mget/examples/request/MultiGetRequestExample2.yaml +++ b/specification/_global/mget/examples/request/MultiGetRequestExample2.yaml @@ -27,131 +27,3 @@ 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 142f19c386..ca0669252f 100644 --- a/specification/_global/mget/examples/request/MultiGetRequestExample3.yaml +++ b/specification/_global/mget/examples/request/MultiGetRequestExample3.yaml @@ -18,106 +18,3 @@ 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\"" - - language: Java - code: | - client.mget(m -> m - .docs(List.of(MultiGetOperation.of(mu -> mu - .id("1") - .index("test") - .storedFields(List.of("field1","field2"))),MultiGetOperation.of(mu -> mu - .id("2") - .index("test") - .storedFields(List.of("field3","field4"))))) - ); diff --git a/specification/_global/mget/examples/request/MultiGetRequestExample4.yaml b/specification/_global/mget/examples/request/MultiGetRequestExample4.yaml index 44e02b0357..0edef6e706 100644 --- a/specification/_global/mget/examples/request/MultiGetRequestExample4.yaml +++ b/specification/_global/mget/examples/request/MultiGetRequestExample4.yaml @@ -19,88 +19,3 @@ 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"' - - language: Java - code: | - client.mget(m -> m - .docs(List.of(MultiGetOperation.of(mu -> mu - .id("1") - .index("test") - .routing("key2")),MultiGetOperation.of(mu -> mu - .id("2") - .index("test")))) - .routing("key1") - ); diff --git a/specification/_global/msearch/examples/request/MsearchRequestExample1.yaml b/specification/_global/msearch/examples/request/MsearchRequestExample1.yaml index 60711ea29d..076400983b 100644 --- a/specification/_global/msearch/examples/request/MsearchRequestExample1.yaml +++ b/specification/_global/msearch/examples/request/MsearchRequestExample1.yaml @@ -5,101 +5,3 @@ 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 ef7f6d6b3a..c033a2f7e3 100644 --- a/specification/_global/msearch_template/examples/request/MultiSearchTemplateRequestExample1.yaml +++ b/specification/_global/msearch_template/examples/request/MultiSearchTemplateRequestExample1.yaml @@ -7,102 +7,3 @@ 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 6f4b325a4f..489b8f0de5 100644 --- a/specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample1.yaml +++ b/specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample1.yaml @@ -19,89 +19,3 @@ 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"' - - language: Java - code: | - client.mtermvectors(m -> m - .docs(List.of(MultiTermVectorsOperation.of(mu -> mu - .id("2") - .fields("message") - .termStatistics(true)),MultiTermVectorsOperation.of(mu -> mu - .id("1")))) - .index("my-index-000001") - ); diff --git a/specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample2.yaml b/specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample2.yaml index 64eb906f4c..d835a75334 100644 --- a/specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample2.yaml +++ b/specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample2.yaml @@ -12,66 +12,3 @@ 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"' - - language: Java - code: | - client.mtermvectors(m -> m - .ids(List.of("1","2")) - .index("my-index-000001") - ); diff --git a/specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample3.yaml b/specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample3.yaml index 4e3612f7c2..e847939ae2 100644 --- a/specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample3.yaml +++ b/specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample3.yaml @@ -21,94 +21,3 @@ 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"' - - language: Java - code: | - client.mtermvectors(m -> m - .docs(List.of(MultiTermVectorsOperation.of(mu -> mu - .index("my-index-000001") - .doc(JsonData.fromJson("{\"message\":\"test test test\"}"))),MultiTermVectorsOperation.of(mu -> mu - .index("my-index-000001") - .doc(JsonData.fromJson("{\"message\":\"Another test ...\"}"))))) - ); 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 f000fffea0..63fef57765 100644 --- a/specification/_global/open_point_in_time/examples/request/OpenPointInTimeRequestExample1.yaml +++ b/specification/_global/open_point_in_time/examples/request/OpenPointInTimeRequestExample1.yaml @@ -1,42 +1 @@ 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"' - - language: Java - code: | - client.openPointInTime(o -> o - .allowPartialSearchResults(true) - .index("my-index-000001") - .keepAlive(k -> k - .offset(1) - ) - ); diff --git a/specification/_global/put_script/examples/request/PutScriptRequestExample1.yaml b/specification/_global/put_script/examples/request/PutScriptRequestExample1.yaml index 3d59b1b3c9..7594d7b27a 100644 --- a/specification/_global/put_script/examples/request/PutScriptRequestExample1.yaml +++ b/specification/_global/put_script/examples/request/PutScriptRequestExample1.yaml @@ -18,81 +18,3 @@ 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 c4d8c7a5d0..9f80712c88 100644 --- a/specification/_global/put_script/examples/request/PutScriptRequestExample2.yaml +++ b/specification/_global/put_script/examples/request/PutScriptRequestExample2.yaml @@ -10,60 +10,3 @@ 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"' - - language: Java - code: | - client.putScript(p -> p - .id("my-stored-script") - .script(s -> s - .lang("painless") - .source(so -> so - .scriptString("Math.log(_score * 2) + params['my_modifier']") - ) - ) - ); diff --git a/specification/_global/rank_eval/examples/request/RankEvalRequestExample1.yaml b/specification/_global/rank_eval/examples/request/RankEvalRequestExample1.yaml index 8878cb87dc..cf30d4a6fa 100644 --- a/specification/_global/rank_eval/examples/request/RankEvalRequestExample1.yaml +++ b/specification/_global/rank_eval/examples/request/RankEvalRequestExample1.yaml @@ -16,127 +16,3 @@ 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\"" - - language: Java - code: | - client.rankEval(r -> r - .index("my-index-000001") - .metric(m -> m - .precision(p -> p - .ignoreUnlabeled(false) - .relevantRatingThreshold(1) - .k(20) - ) - ) - .requests(re -> re - .id("JFK query") - .request(req -> req - .query(q -> q - .matchAll(m -> m) - ) - ) - ) - ); diff --git a/specification/_global/reindex/examples/request/ReindexRequestExample1.yaml b/specification/_global/reindex/examples/request/ReindexRequestExample1.yaml index bc006d2fa5..4456124cae 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample1.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample1.yaml @@ -13,72 +13,3 @@ 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"' - - language: Java - code: | - client.reindex(r -> r - .dest(d -> d - .index("my-new-index-000002") - ) - .source(s -> s - .index(List.of("my-index-000001","my-index-000002")) - ) - ); diff --git a/specification/_global/reindex/examples/request/ReindexRequestExample10.yaml b/specification/_global/reindex/examples/request/ReindexRequestExample10.yaml index dbeaea2d47..f2e274f0d6 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample10.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample10.yaml @@ -28,71 +28,3 @@ value: "{ \ } }" -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 d0f57bd8e8..d08ec8df85 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample11.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample11.yaml @@ -33,81 +33,3 @@ value: "{ \ } }" -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 66e980472b..fd38422ab8 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample12.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample12.yaml @@ -28,75 +28,3 @@ value: "{ \ } }" -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 d0bd227d8d..68eb3d7d9d 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample13.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample13.yaml @@ -38,94 +38,3 @@ value: "{ \ } }" -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 4287b24477..8cdfdf17ca 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample2.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample2.yaml @@ -16,69 +16,3 @@ 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 9d7d697f53..9a2efee58c 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample3.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample3.yaml @@ -19,61 +19,3 @@ value: "{ \ } }" -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 cf9ac7468e..352a408fcc 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample4.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample4.yaml @@ -32,77 +32,3 @@ value: "{ \ } }" -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 4bf87ee51f..e9771c1851 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample5.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample5.yaml @@ -19,57 +19,3 @@ value: "{ \ } }" -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 bffcabbf6b..04ec93ae90 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample6.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample6.yaml @@ -29,73 +29,3 @@ value: "{ \ } }" -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 bf5afbe09d..f0e0bb4112 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample7.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample7.yaml @@ -21,57 +21,3 @@ value: "{ \ } }" -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 549eb679e0..5f0f344273 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample8.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample8.yaml @@ -21,66 +21,3 @@ value: "{ \ } }" -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 a45b9f8dfc..c291005070 100644 --- a/specification/_global/reindex/examples/request/ReindexRequestExample9.yaml +++ b/specification/_global/reindex/examples/request/ReindexRequestExample9.yaml @@ -25,65 +25,3 @@ value: "{ \ } }" -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 a96d2256a6..c4361e9be7 100644 --- a/specification/_global/reindex_rethrottle/examples/request/ReindexRethrottleRequestExample1.yaml +++ b/specification/_global/reindex_rethrottle/examples/request/ReindexRethrottleRequestExample1.yaml @@ -1,35 +1 @@ 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"' - - language: Java - code: | - client.reindexRethrottle(r -> r - .requestsPerSecond(-1.0F) - .taskId("r1A2WoRbTwKZ516z6NEs5A:36619") - ); diff --git a/specification/_global/render_search_template/examples/request/RenderSearchTemplateRequestExample1.yaml b/specification/_global/render_search_template/examples/request/RenderSearchTemplateRequestExample1.yaml index 2bc4fc4563..7c3e4bee47 100644 --- a/specification/_global/render_search_template/examples/request/RenderSearchTemplateRequestExample1.yaml +++ b/specification/_global/render_search_template/examples/request/RenderSearchTemplateRequestExample1.yaml @@ -11,59 +11,3 @@ 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"' - - language: Java - code: > - client.renderSearchTemplate(r -> r - .id("my-search-template") - .params(Map.of("size", JsonData.fromJson("10"),"from", JsonData.fromJson("20"),"query_string", JsonData.fromJson("\"hello world\""))) - ); diff --git a/specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample1.yaml b/specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample1.yaml index e7bf179e06..858e6e8d68 100644 --- a/specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample1.yaml +++ b/specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample1.yaml @@ -15,67 +15,3 @@ 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"' - - language: Java - code: | - client.scriptsPainlessExecute(s -> s - .script(sc -> sc - .source(so -> so - .scriptString("params.count / params.total") - ) - .params(Map.of("total", JsonData.fromJson("1000"),"count", JsonData.fromJson("100"))) - ) - ); diff --git a/specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample2.yaml b/specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample2.yaml index c4f1b12dca..305555b86a 100644 --- a/specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample2.yaml +++ b/specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample2.yaml @@ -21,97 +21,3 @@ 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\"" - - language: Java - code: | - client.scriptsPainlessExecute(s -> s - .context(PainlessContext.Filter) - .contextSetup(c -> c - .document(JsonData.fromJson("{\"field\":\"four\"}")) - .index("my-index-000001") - ) - .script(sc -> sc - .source(so -> so - .scriptString("doc['field'].value.length() <= params.max_length") - ) - .params("max_length", JsonData.fromJson("4")) - ) - ); diff --git a/specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample3.yaml b/specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample3.yaml index 1b1b434a86..0d588427df 100644 --- a/specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample3.yaml +++ b/specification/_global/scripts_painless_execute/examples/request/ExecutePainlessScriptRequestExample3.yaml @@ -20,97 +20,3 @@ 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\"" - - language: Java - code: | - client.scriptsPainlessExecute(s -> s - .context(PainlessContext.Score) - .contextSetup(c -> c - .document(JsonData.fromJson("{\"rank\":4}")) - .index("my-index-000001") - ) - .script(sc -> sc - .source(so -> so - .scriptString("doc['rank'].value / params.max_rank") - ) - .params("max_rank", JsonData.fromJson("5")) - ) - ); diff --git a/specification/_global/scroll/examples/request/ScrollRequestExample1.yaml b/specification/_global/scroll/examples/request/ScrollRequestExample1.yaml index 81f2a228bc..04f3ff98b3 100644 --- a/specification/_global/scroll/examples/request/ScrollRequestExample1.yaml +++ b/specification/_global/scroll/examples/request/ScrollRequestExample1.yaml @@ -6,37 +6,3 @@ 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"' - - language: Java - code: | - client.scroll(s -> s - .scrollId("DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==") - ); diff --git a/specification/_global/search/examples/request/SearchRequestExample1.yaml b/specification/_global/search/examples/request/SearchRequestExample1.yaml index 5558342c91..f3867f117d 100644 --- a/specification/_global/search/examples/request/SearchRequestExample1.yaml +++ b/specification/_global/search/examples/request/SearchRequestExample1.yaml @@ -11,73 +11,3 @@ 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"' - - language: Java - code: | - client.search(s -> s - .from(40) - .index("my-index-000001") - .query(q -> q - .term(t -> t - .field("user.id") - .value(FieldValue.of("kimchy")) - ) - ) - .size(20) - ,Void.class); diff --git a/specification/_global/search/examples/request/SearchRequestExample2.yaml b/specification/_global/search/examples/request/SearchRequestExample2.yaml index 908f395ec4..0bf1202a6c 100644 --- a/specification/_global/search/examples/request/SearchRequestExample2.yaml +++ b/specification/_global/search/examples/request/SearchRequestExample2.yaml @@ -18,87 +18,3 @@ 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\"" - - language: Java - code: > - client.search(s -> s - .pit(p -> p - .id("46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==") - .keepAlive(k -> k - .time("1m") - ) - ) - .query(q -> q - .match(m -> m - .field("title") - .query(FieldValue.of("elasticsearch")) - ) - ) - .size(100) - ,Void.class); diff --git a/specification/_global/search/examples/request/SearchRequestExample3.yaml b/specification/_global/search/examples/request/SearchRequestExample3.yaml index ea1ad63dff..a01afc41ea 100644 --- a/specification/_global/search/examples/request/SearchRequestExample3.yaml +++ b/specification/_global/search/examples/request/SearchRequestExample3.yaml @@ -21,95 +21,3 @@ 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\"" - - language: Java - code: > - client.search(s -> s - .pit(p -> p - .id("46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==") - ) - .query(q -> q - .match(m -> m - .field("message") - .query(FieldValue.of("foo")) - ) - ) - .slice(sl -> sl - .id("0") - .max(2) - ) - ,Void.class); diff --git a/specification/_global/search_mvt/examples/request/SearchMvtRequestExample1.yaml b/specification/_global/search_mvt/examples/request/SearchMvtRequestExample1.yaml index 394cd80465..2a99efde62 100644 --- a/specification/_global/search_mvt/examples/request/SearchMvtRequestExample1.yaml +++ b/specification/_global/search_mvt/examples/request/SearchMvtRequestExample1.yaml @@ -35,159 +35,3 @@ 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 2c3ea338f1..efa6600543 100644 --- a/specification/_global/search_shards/examples/request/SearchShardsRequestExample1.yaml +++ b/specification/_global/search_shards/examples/request/SearchShardsRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.searchShards(s -> s - .index("my-index-000001") - ); diff --git a/specification/_global/search_template/examples/request/SearchTemplateRequestExample1.yaml b/specification/_global/search_template/examples/request/SearchTemplateRequestExample1.yaml index 74894235f6..000c63b523 100644 --- a/specification/_global/search_template/examples/request/SearchTemplateRequestExample1.yaml +++ b/specification/_global/search_template/examples/request/SearchTemplateRequestExample1.yaml @@ -12,64 +12,3 @@ 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"' - - language: Java - code: > - client.searchTemplate(s -> s - .id("my-search-template") - .index("my-index") - .params(Map.of("size", JsonData.fromJson("10"),"from", JsonData.fromJson("0"),"query_string", JsonData.fromJson("\"hello world\""))) - ); diff --git a/specification/_global/terms_enum/examples/request/TermsEnumRequestExample1.yaml b/specification/_global/terms_enum/examples/request/TermsEnumRequestExample1.yaml index 8172e843c4..9c854e9b29 100644 --- a/specification/_global/terms_enum/examples/request/TermsEnumRequestExample1.yaml +++ b/specification/_global/terms_enum/examples/request/TermsEnumRequestExample1.yaml @@ -7,47 +7,3 @@ 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"' - - language: Java - code: | - client.termsEnum(t -> t - .field("tags") - .index("stackoverflow") - .string("kiba") - ); diff --git a/specification/_global/termvectors/examples/request/TermVectorsRequestExample1.yaml b/specification/_global/termvectors/examples/request/TermVectorsRequestExample1.yaml index c785494fd4..e5a266c352 100644 --- a/specification/_global/termvectors/examples/request/TermVectorsRequestExample1.yaml +++ b/specification/_global/termvectors/examples/request/TermVectorsRequestExample1.yaml @@ -12,79 +12,3 @@ 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\"" - - language: Java - code: | - client.termvectors(t -> t - .fieldStatistics(true) - .fields("text") - .id("1") - .index("my-index-000001") - .offsets(true) - .payloads(true) - .positions(true) - .termStatistics(true) - ); diff --git a/specification/_global/termvectors/examples/request/TermVectorsRequestExample2.yaml b/specification/_global/termvectors/examples/request/TermVectorsRequestExample2.yaml index 8476a9163e..3132621d11 100644 --- a/specification/_global/termvectors/examples/request/TermVectorsRequestExample2.yaml +++ b/specification/_global/termvectors/examples/request/TermVectorsRequestExample2.yaml @@ -15,80 +15,3 @@ 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"' - - language: Java - code: | - client.termvectors(t -> t - .doc(JsonData.fromJson("{\"fullname\":\"John Doe\",\"text\":\"test test test\"}")) - .fields("fullname") - .index("my-index-000001") - .perFieldAnalyzer("fullname", "keyword") - ); diff --git a/specification/_global/termvectors/examples/request/TermVectorsRequestExample3.yaml b/specification/_global/termvectors/examples/request/TermVectorsRequestExample3.yaml index 8361494d4c..9b21820f30 100644 --- a/specification/_global/termvectors/examples/request/TermVectorsRequestExample3.yaml +++ b/specification/_global/termvectors/examples/request/TermVectorsRequestExample3.yaml @@ -20,98 +20,3 @@ 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\"" - - language: Java - code: > - client.termvectors(t -> t - .doc(JsonData.fromJson("{\"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.\"}")) - .fieldStatistics(true) - .filter(f -> f - .maxNumTerms(3) - .minDocFreq(1) - .minTermFreq(1) - ) - .index("imdb") - .offsets(false) - .positions(false) - .termStatistics(true) - ); diff --git a/specification/_global/termvectors/examples/request/TermVectorsRequestExample4.yaml b/specification/_global/termvectors/examples/request/TermVectorsRequestExample4.yaml index dfb1044ffd..256065d910 100644 --- a/specification/_global/termvectors/examples/request/TermVectorsRequestExample4.yaml +++ b/specification/_global/termvectors/examples/request/TermVectorsRequestExample4.yaml @@ -13,77 +13,3 @@ 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\"" - - language: Java - code: | - client.termvectors(t -> t - .fieldStatistics(true) - .fields(List.of("text","some_field_without_term_vectors")) - .id("1") - .index("my-index-000001") - .offsets(true) - .positions(true) - .termStatistics(true) - ); diff --git a/specification/_global/termvectors/examples/request/TermVectorsRequestExample5.yaml b/specification/_global/termvectors/examples/request/TermVectorsRequestExample5.yaml index 6d23fc8c0e..24017d91d4 100644 --- a/specification/_global/termvectors/examples/request/TermVectorsRequestExample5.yaml +++ b/specification/_global/termvectors/examples/request/TermVectorsRequestExample5.yaml @@ -12,54 +12,3 @@ 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"' - - language: Java - code: | - client.termvectors(t -> t - .doc(JsonData.fromJson("{\"fullname\":\"John Doe\",\"text\":\"test test test\"}")) - .index("my-index-000001") - ); diff --git a/specification/_global/update/examples/request/UpdateRequestExample1.yaml b/specification/_global/update/examples/request/UpdateRequestExample1.yaml index eca74d0882..a4f76b600f 100644 --- a/specification/_global/update/examples/request/UpdateRequestExample1.yaml +++ b/specification/_global/update/examples/request/UpdateRequestExample1.yaml @@ -19,78 +19,3 @@ value: "{ \ } }" -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"' - - language: Java - code: | - client.update(u -> u - .id("1") - .index("test") - .script(s -> s - .source(so -> so - .scriptString("ctx._source.counter += params.count") - ) - .params("count", JsonData.fromJson("4")) - .lang("painless") - ) - ,Void.class); diff --git a/specification/_global/update/examples/request/UpdateRequestExample10.yaml b/specification/_global/update/examples/request/UpdateRequestExample10.yaml index 2a93bede15..705cfdc982 100644 --- a/specification/_global/update/examples/request/UpdateRequestExample10.yaml +++ b/specification/_global/update/examples/request/UpdateRequestExample10.yaml @@ -35,91 +35,3 @@ value: "{ \ \"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\"" - - language: Java - code: | - client.update(u -> u - .id("1") - .index("test") - .script(s -> s - .source(so -> so - .scriptString(" - if ( ctx.op == 'create' ) { - ctx._source.counter = params.count - } else { - ctx._source.counter += params.count - } - ") - ) - .params("count", JsonData.fromJson("4")) - ) - .scriptedUpsert(true) - .upsert(JsonData.fromJson("{}")) - ,Void.class); diff --git a/specification/_global/update/examples/request/UpdateRequestExample11.yaml b/specification/_global/update/examples/request/UpdateRequestExample11.yaml index d901d30edb..98e3a9d014 100644 --- a/specification/_global/update/examples/request/UpdateRequestExample11.yaml +++ b/specification/_global/update/examples/request/UpdateRequestExample11.yaml @@ -15,60 +15,3 @@ value: "{ \ \"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"' - - language: Java - code: | - client.update(u -> u - .doc(JsonData.fromJson("{\"name\":\"new_name\"}")) - .docAsUpsert(true) - .id("1") - .index("test") - ,Void.class); diff --git a/specification/_global/update/examples/request/UpdateRequestExample2.yaml b/specification/_global/update/examples/request/UpdateRequestExample2.yaml index 5d6f23bee4..9b9ec2badf 100644 --- a/specification/_global/update/examples/request/UpdateRequestExample2.yaml +++ b/specification/_global/update/examples/request/UpdateRequestExample2.yaml @@ -21,78 +21,3 @@ value: "{ \ } }" -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"' - - language: Java - code: | - client.update(u -> u - .id("1") - .index("test") - .script(s -> s - .source(so -> so - .scriptString("ctx._source.tags.add(params.tag)") - ) - .params("tag", JsonData.fromJson("\"blue\"")) - .lang("painless") - ) - ,Void.class); diff --git a/specification/_global/update/examples/request/UpdateRequestExample3.yaml b/specification/_global/update/examples/request/UpdateRequestExample3.yaml index 4c472064d9..efdf66cc84 100644 --- a/specification/_global/update/examples/request/UpdateRequestExample3.yaml +++ b/specification/_global/update/examples/request/UpdateRequestExample3.yaml @@ -22,80 +22,3 @@ value: "{ \ } }" -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"' - - language: Java - code: > - client.update(u -> u - .id("1") - .index("test") - .script(s -> s - .source(so -> so - .scriptString("if (ctx._source.tags.contains(params.tag)) { ctx._source.tags.remove(ctx._source.tags.indexOf(params.tag)) }") - ) - .params("tag", JsonData.fromJson("\"blue\"")) - .lang("painless") - ) - ,Void.class); diff --git a/specification/_global/update/examples/request/UpdateRequestExample4.yaml b/specification/_global/update/examples/request/UpdateRequestExample4.yaml index 0c165775d7..ccca0de1e5 100644 --- a/specification/_global/update/examples/request/UpdateRequestExample4.yaml +++ b/specification/_global/update/examples/request/UpdateRequestExample4.yaml @@ -8,51 +8,3 @@ 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"' - - language: Java - code: | - client.update(u -> u - .id("1") - .index("test") - .script(s -> s - .source(so -> so - .scriptString("ctx._source.new_field = 'value_of_new_field'") - ) - ) - ,Void.class); diff --git a/specification/_global/update/examples/request/UpdateRequestExample5.yaml b/specification/_global/update/examples/request/UpdateRequestExample5.yaml index 70aa4f8ee4..bc095d458c 100644 --- a/specification/_global/update/examples/request/UpdateRequestExample5.yaml +++ b/specification/_global/update/examples/request/UpdateRequestExample5.yaml @@ -8,51 +8,3 @@ 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"' - - language: Java - code: | - client.update(u -> u - .id("1") - .index("test") - .script(s -> s - .source(so -> so - .scriptString("ctx._source.remove('new_field')") - ) - ) - ,Void.class); diff --git a/specification/_global/update/examples/request/UpdateRequestExample6.yaml b/specification/_global/update/examples/request/UpdateRequestExample6.yaml index a727d9890f..288070fb42 100644 --- a/specification/_global/update/examples/request/UpdateRequestExample6.yaml +++ b/specification/_global/update/examples/request/UpdateRequestExample6.yaml @@ -8,52 +8,3 @@ 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"' - - language: Java - code: | - client.update(u -> u - .id("1") - .index("test") - .script(s -> s - .source(so -> so - .scriptString("ctx._source['my-object'].remove('my-subfield')") - ) - ) - ,Void.class); diff --git a/specification/_global/update/examples/request/UpdateRequestExample7.yaml b/specification/_global/update/examples/request/UpdateRequestExample7.yaml index a84eec3085..b12298e454 100644 --- a/specification/_global/update/examples/request/UpdateRequestExample7.yaml +++ b/specification/_global/update/examples/request/UpdateRequestExample7.yaml @@ -21,79 +21,3 @@ value: "{ \ } }" -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"' - - language: Java - code: | - client.update(u -> u - .id("1") - .index("test") - .script(s -> s - .source(so -> so - .scriptString("if (ctx._source.tags.contains(params.tag)) { ctx.op = 'delete' } else { ctx.op = 'noop' }") - ) - .params("tag", JsonData.fromJson("\"green\"")) - .lang("painless") - ) - ,Void.class); diff --git a/specification/_global/update/examples/request/UpdateRequestExample8.yaml b/specification/_global/update/examples/request/UpdateRequestExample8.yaml index f73a3b61d5..4463caf2ad 100644 --- a/specification/_global/update/examples/request/UpdateRequestExample8.yaml +++ b/specification/_global/update/examples/request/UpdateRequestExample8.yaml @@ -12,55 +12,3 @@ value: "{ \ } }" -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"' - - language: Java - code: | - client.update(u -> u - .doc(JsonData.fromJson("{\"name\":\"new_name\"}")) - .id("1") - .index("test") - ,Void.class); diff --git a/specification/_global/update/examples/request/UpdateRequestExample9.yaml b/specification/_global/update/examples/request/UpdateRequestExample9.yaml index 88f95caacb..76736b2de3 100644 --- a/specification/_global/update/examples/request/UpdateRequestExample9.yaml +++ b/specification/_global/update/examples/request/UpdateRequestExample9.yaml @@ -27,92 +27,3 @@ value: "{ \ } }" -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"' - - language: Java - code: | - client.update(u -> u - .id("1") - .index("test") - .script(s -> s - .source(so -> so - .scriptString("ctx._source.counter += params.count") - ) - .params("count", JsonData.fromJson("4")) - .lang("painless") - ) - .upsert(JsonData.fromJson("{\"counter\":1}")) - ,Void.class); diff --git a/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample1.yaml b/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample1.yaml index 1bf4b580a8..3d864d1006 100644 --- a/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample1.yaml +++ b/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample1.yaml @@ -11,68 +11,3 @@ 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"' - - language: Java - code: | - client.updateByQuery(u -> u - .conflicts(Conflicts.Proceed) - .index("my-index-000001") - .query(q -> q - .term(t -> t - .field("user.id") - .value(FieldValue.of("kimchy")) - ) - ) - ); diff --git a/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample2.yaml b/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample2.yaml index 41c70ff5b6..46825511c6 100644 --- a/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample2.yaml +++ b/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample2.yaml @@ -16,86 +16,3 @@ 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"' - - language: Java - code: | - client.updateByQuery(u -> u - .index("my-index-000001") - .query(q -> q - .term(t -> t - .field("user.id") - .value(FieldValue.of("kimchy")) - ) - ) - .script(s -> s - .source(so -> so - .scriptString("ctx._source.count++") - ) - .lang("painless") - ) - ); diff --git a/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample3.yaml b/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample3.yaml index de1b720510..fd12db2380 100644 --- a/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample3.yaml +++ b/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample3.yaml @@ -14,75 +14,3 @@ 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"' - - language: Java - code: | - client.updateByQuery(u -> u - .index("my-index-000001") - .script(s -> s - .source(so -> so - .scriptString("ctx._source['extra'] = 'test'") - ) - ) - .slice(sl -> sl - .id("0") - .max(2) - ) - ); diff --git a/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample4.yaml b/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample4.yaml index 04df2d56e6..13224609f3 100644 --- a/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample4.yaml +++ b/specification/_global/update_by_query/examples/request/UpdateByQueryRequestExample4.yaml @@ -10,67 +10,3 @@ 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"' - - language: Java - code: | - client.updateByQuery(u -> u - .index("my-index-000001") - .refresh(true) - .script(s -> s - .source(so -> so - .scriptString("ctx._source['extra'] = 'test'") - ) - ) - .slices(sl -> sl - .value(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 41401d5e45..aaddc459f9 100644 --- a/specification/_global/update_by_query_rethrottle/examples/request/UpdateByQueryRethrottleRequestExample1.yaml +++ b/specification/_global/update_by_query_rethrottle/examples/request/UpdateByQueryRethrottleRequestExample1.yaml @@ -1,35 +1 @@ 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"' - - language: Java - code: | - client.updateByQueryRethrottle(u -> u - .requestsPerSecond(-1.0F) - .taskId("r1A2WoRbTwKZ516z6NEs5A:36619") - ); diff --git a/specification/async_search/delete/examples/request/AsyncSearchDeleteExample1.yaml b/specification/async_search/delete/examples/request/AsyncSearchDeleteExample1.yaml index 4e3da24646..3ff283d560 100644 --- a/specification/async_search/delete/examples/request/AsyncSearchDeleteExample1.yaml +++ b/specification/async_search/delete/examples/request/AsyncSearchDeleteExample1.yaml @@ -1,30 +1 @@ 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="' - - language: Java - code: | - client.asyncSearch().delete(d -> d - .id("FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=") - ); diff --git a/specification/async_search/get/examples/request/AsyncSearchGetRequestExample1.yaml b/specification/async_search/get/examples/request/AsyncSearchGetRequestExample1.yaml index d4a63fb3cf..89b9287b68 100644 --- a/specification/async_search/get/examples/request/AsyncSearchGetRequestExample1.yaml +++ b/specification/async_search/get/examples/request/AsyncSearchGetRequestExample1.yaml @@ -1,30 +1 @@ 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="' - - language: Java - code: | - client.asyncSearch().get(g -> g - .id("FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=") - ); diff --git a/specification/async_search/status/examples/request/AsyncSearchStatusRequestExample1.yaml b/specification/async_search/status/examples/request/AsyncSearchStatusRequestExample1.yaml index 7e57391a4e..d62c737ab6 100644 --- a/specification/async_search/status/examples/request/AsyncSearchStatusRequestExample1.yaml +++ b/specification/async_search/status/examples/request/AsyncSearchStatusRequestExample1.yaml @@ -1,30 +1 @@ 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="' - - language: Java - code: | - client.asyncSearch().status(s -> s - .id("FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=") - ); diff --git a/specification/async_search/submit/examples/request/AsyncSearchSubmitRequestExample1.yaml b/specification/async_search/submit/examples/request/AsyncSearchSubmitRequestExample1.yaml index 1555e90d1c..cc9da45f2a 100644 --- a/specification/async_search/submit/examples/request/AsyncSearchSubmitRequestExample1.yaml +++ b/specification/async_search/submit/examples/request/AsyncSearchSubmitRequestExample1.yaml @@ -29,115 +29,3 @@ value: "{ \ } }" -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\"" - - language: Java - code: | - client.asyncSearch().submit(s -> s - .aggregations("sale_date", a -> a - .dateHistogram(d -> d - .calendarInterval(CalendarInterval.Day) - .field("date") - ) - ) - .index("sales*") - .size(0) - .sort(so -> so - .field(f -> f - .field("date") - .order(SortOrder.Asc) - ) - ) - ,Void.class); diff --git a/specification/autoscaling/delete_autoscaling_policy/examples/request/DeleteAutoscalingPolicyRequestExample1.yaml b/specification/autoscaling/delete_autoscaling_policy/examples/request/DeleteAutoscalingPolicyRequestExample1.yaml index 6f094d8737..ad73243750 100644 --- a/specification/autoscaling/delete_autoscaling_policy/examples/request/DeleteAutoscalingPolicyRequestExample1.yaml +++ b/specification/autoscaling/delete_autoscaling_policy/examples/request/DeleteAutoscalingPolicyRequestExample1.yaml @@ -1,29 +1 @@ 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/*"' - - language: Java - code: | - client.autoscaling().deleteAutoscalingPolicy(d -> d - .name("*") - ); diff --git a/specification/autoscaling/get_autoscaling_capacity/examples/request/GetAutoscalingCapacityRequestExample1.yaml b/specification/autoscaling/get_autoscaling_capacity/examples/request/GetAutoscalingCapacityRequestExample1.yaml index f15ffe3e92..3abcc14ffe 100644 --- a/specification/autoscaling/get_autoscaling_capacity/examples/request/GetAutoscalingCapacityRequestExample1.yaml +++ b/specification/autoscaling/get_autoscaling_capacity/examples/request/GetAutoscalingCapacityRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.autoscaling().getAutoscalingCapacity(g -> g); diff --git a/specification/autoscaling/get_autoscaling_policy/examples/request/GetAutoscalingPolicyRequestExample1.yaml b/specification/autoscaling/get_autoscaling_policy/examples/request/GetAutoscalingPolicyRequestExample1.yaml index 87d4d76fbb..83b137b46d 100644 --- a/specification/autoscaling/get_autoscaling_policy/examples/request/GetAutoscalingPolicyRequestExample1.yaml +++ b/specification/autoscaling/get_autoscaling_policy/examples/request/GetAutoscalingPolicyRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.autoscaling().getAutoscalingPolicy(g -> g - .name("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 cdf73773cf..7e5828a7af 100644 --- a/specification/autoscaling/put_autoscaling_policy/examples/request/PutAutoscalingPolicyRequestExample1.yaml +++ b/specification/autoscaling/put_autoscaling_policy/examples/request/PutAutoscalingPolicyRequestExample1.yaml @@ -15,61 +15,3 @@ value: "{ \ } }" -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/"' - - language: Java - code: | - client.autoscaling().putAutoscalingPolicy(p -> p - .name("") - .policy(po -> po - .deciders("fixed", JsonData.fromJson("{}")) - ) - ); diff --git a/specification/autoscaling/put_autoscaling_policy/examples/request/PutAutoscalingPolicyRequestExample2.yaml b/specification/autoscaling/put_autoscaling_policy/examples/request/PutAutoscalingPolicyRequestExample2.yaml index 307246008a..745fe40d27 100644 --- a/specification/autoscaling/put_autoscaling_policy/examples/request/PutAutoscalingPolicyRequestExample2.yaml +++ b/specification/autoscaling/put_autoscaling_policy/examples/request/PutAutoscalingPolicyRequestExample2.yaml @@ -17,67 +17,3 @@ value: "{ \ } }" -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"' - - language: Java - code: | - client.autoscaling().putAutoscalingPolicy(p -> p - .name("my_autoscaling_policy") - .policy(po -> po - .roles("data_hot") - .deciders("fixed", JsonData.fromJson("{}")) - ) - ); diff --git a/specification/cat/aliases/examples/request/CatAliasesRequestExample1.yaml b/specification/cat/aliases/examples/request/CatAliasesRequestExample1.yaml index c2644b3287..e74bd1e9f8 100644 --- a/specification/cat/aliases/examples/request/CatAliasesRequestExample1.yaml +++ b/specification/cat/aliases/examples/request/CatAliasesRequestExample1.yaml @@ -1,31 +1 @@ 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"' - - language: Java - code: | - client.cat().aliases(); diff --git a/specification/cat/allocation/examples/request/CatAllocationRequestExample1.yaml b/specification/cat/allocation/examples/request/CatAllocationRequestExample1.yaml index efa0210977..aaa367a7da 100644 --- a/specification/cat/allocation/examples/request/CatAllocationRequestExample1.yaml +++ b/specification/cat/allocation/examples/request/CatAllocationRequestExample1.yaml @@ -1,31 +1 @@ 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"' - - language: Java - code: | - client.cat().allocation(); diff --git a/specification/cat/component_templates/examples/request/CatComponentTemplatesRequestExample1.yaml b/specification/cat/component_templates/examples/request/CatComponentTemplatesRequestExample1.yaml index 5c915001b0..495d410df0 100644 --- a/specification/cat/component_templates/examples/request/CatComponentTemplatesRequestExample1.yaml +++ b/specification/cat/component_templates/examples/request/CatComponentTemplatesRequestExample1.yaml @@ -1,40 +1 @@ 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"' - - language: Java - code: | - client.cat().componentTemplates(); diff --git a/specification/cat/count/examples/request/CatCountRequestExample1.yaml b/specification/cat/count/examples/request/CatCountRequestExample1.yaml index 4b9417aefd..60f5075a99 100644 --- a/specification/cat/count/examples/request/CatCountRequestExample1.yaml +++ b/specification/cat/count/examples/request/CatCountRequestExample1.yaml @@ -1,35 +1 @@ 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"' - - language: Java - code: | - client.cat().count(); diff --git a/specification/cat/fielddata/examples/request/CatFielddataRequestExample1.yaml b/specification/cat/fielddata/examples/request/CatFielddataRequestExample1.yaml index 81ae892ce5..5394203473 100644 --- a/specification/cat/fielddata/examples/request/CatFielddataRequestExample1.yaml +++ b/specification/cat/fielddata/examples/request/CatFielddataRequestExample1.yaml @@ -1,35 +1 @@ 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"' - - language: Java - code: | - client.cat().fielddata(); diff --git a/specification/cat/health/examples/request/CatHealthRequestExample1.yaml b/specification/cat/health/examples/request/CatHealthRequestExample1.yaml index 3f54cd484f..2c6c0610a6 100644 --- a/specification/cat/health/examples/request/CatHealthRequestExample1.yaml +++ b/specification/cat/health/examples/request/CatHealthRequestExample1.yaml @@ -1,31 +1 @@ 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"' - - language: Java - code: | - client.cat().health(); diff --git a/specification/cat/indices/examples/request/CatIndicesRequestExample1.yaml b/specification/cat/indices/examples/request/CatIndicesRequestExample1.yaml index 5934f98f58..523656aac9 100644 --- a/specification/cat/indices/examples/request/CatIndicesRequestExample1.yaml +++ b/specification/cat/indices/examples/request/CatIndicesRequestExample1.yaml @@ -1,40 +1 @@ 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"' - - language: Java - code: | - client.cat().indices(); diff --git a/specification/cat/master/examples/request/CatMasterRequestExample1.yaml b/specification/cat/master/examples/request/CatMasterRequestExample1.yaml index 8b2bba5afe..acbdcbf9b2 100644 --- a/specification/cat/master/examples/request/CatMasterRequestExample1.yaml +++ b/specification/cat/master/examples/request/CatMasterRequestExample1.yaml @@ -1,31 +1 @@ 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"' - - language: Java - code: | - client.cat().master(); 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 b1a41228f4..9ea5e61f8b 100644 --- a/specification/cat/ml_data_frame_analytics/examples/request/CatDataframeanalyticsRequestExample1.yaml +++ b/specification/cat/ml_data_frame_analytics/examples/request/CatDataframeanalyticsRequestExample1.yaml @@ -1,31 +1 @@ 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"' - - language: Java - code: | - client.cat().mlDataFrameAnalytics(); diff --git a/specification/cat/ml_datafeeds/examples/request/CatDatafeedsRequestExample1.yaml b/specification/cat/ml_datafeeds/examples/request/CatDatafeedsRequestExample1.yaml index 3196d11788..33cc34fb9f 100644 --- a/specification/cat/ml_datafeeds/examples/request/CatDatafeedsRequestExample1.yaml +++ b/specification/cat/ml_datafeeds/examples/request/CatDatafeedsRequestExample1.yaml @@ -1,31 +1 @@ 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"' - - language: Java - code: | - client.cat().mlDatafeeds(); diff --git a/specification/cat/ml_jobs/examples/request/CatJobsRequestExample1.yaml b/specification/cat/ml_jobs/examples/request/CatJobsRequestExample1.yaml index 2ccf72d1c5..3b72c00db8 100644 --- a/specification/cat/ml_jobs/examples/request/CatJobsRequestExample1.yaml +++ b/specification/cat/ml_jobs/examples/request/CatJobsRequestExample1.yaml @@ -1,36 +1 @@ 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"' - - language: Java - code: | - client.cat().mlJobs(); diff --git a/specification/cat/ml_trained_models/examples/request/CatTrainedModelsRequestExample1.yaml b/specification/cat/ml_trained_models/examples/request/CatTrainedModelsRequestExample1.yaml index 092023b08e..8c8e3cd670 100644 --- a/specification/cat/ml_trained_models/examples/request/CatTrainedModelsRequestExample1.yaml +++ b/specification/cat/ml_trained_models/examples/request/CatTrainedModelsRequestExample1.yaml @@ -1,31 +1 @@ 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"' - - language: Java - code: | - client.cat().mlTrainedModels(); diff --git a/specification/cat/nodeattrs/examples/request/CatNodeAttributesRequestExample1.yaml b/specification/cat/nodeattrs/examples/request/CatNodeAttributesRequestExample1.yaml index 2ce5d90458..2b5cf70c7a 100644 --- a/specification/cat/nodeattrs/examples/request/CatNodeAttributesRequestExample1.yaml +++ b/specification/cat/nodeattrs/examples/request/CatNodeAttributesRequestExample1.yaml @@ -1,31 +1 @@ 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"' - - language: Java - code: | - client.cat().nodeattrs(); diff --git a/specification/cat/nodes/examples/request/CatNodesRequestExample2.yaml b/specification/cat/nodes/examples/request/CatNodesRequestExample2.yaml index 5c436967da..d3f9a54521 100644 --- a/specification/cat/nodes/examples/request/CatNodesRequestExample2.yaml +++ b/specification/cat/nodes/examples/request/CatNodesRequestExample2.yaml @@ -1,35 +1 @@ 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"' - - language: Java - code: | - client.cat().nodes(); diff --git a/specification/cat/pending_tasks/examples/request/CatPendingTasksRequestExample1.yaml b/specification/cat/pending_tasks/examples/request/CatPendingTasksRequestExample1.yaml index 609fc1fd30..74c11769eb 100644 --- a/specification/cat/pending_tasks/examples/request/CatPendingTasksRequestExample1.yaml +++ b/specification/cat/pending_tasks/examples/request/CatPendingTasksRequestExample1.yaml @@ -1,32 +1 @@ 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"' - - language: Java - code: | - client.cat().pendingTasks(); diff --git a/specification/cat/plugins/examples/request/CatPluginsRequestExample1.yaml b/specification/cat/plugins/examples/request/CatPluginsRequestExample1.yaml index d9ea551db5..92f220096b 100644 --- a/specification/cat/plugins/examples/request/CatPluginsRequestExample1.yaml +++ b/specification/cat/plugins/examples/request/CatPluginsRequestExample1.yaml @@ -1,40 +1 @@ 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"' - - language: Java - code: | - client.cat().plugins(); diff --git a/specification/cat/recovery/examples/request/CatRecoveryRequestExample1.yaml b/specification/cat/recovery/examples/request/CatRecoveryRequestExample1.yaml index 5e0826bffb..f2294cb1bd 100644 --- a/specification/cat/recovery/examples/request/CatRecoveryRequestExample1.yaml +++ b/specification/cat/recovery/examples/request/CatRecoveryRequestExample1.yaml @@ -1,31 +1 @@ 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"' - - language: Java - code: | - client.cat().recovery(); diff --git a/specification/cat/repositories/examples/request/CatRepositoriesRequestExample1.yaml b/specification/cat/repositories/examples/request/CatRepositoriesRequestExample1.yaml index 72ea6d7560..7ed353b671 100644 --- a/specification/cat/repositories/examples/request/CatRepositoriesRequestExample1.yaml +++ b/specification/cat/repositories/examples/request/CatRepositoriesRequestExample1.yaml @@ -1,31 +1 @@ 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"' - - language: Java - code: | - client.cat().repositories(); diff --git a/specification/cat/segments/examples/request/CatSegmentsRequestExample1.yaml b/specification/cat/segments/examples/request/CatSegmentsRequestExample1.yaml index ad082cb170..36610bf7fe 100644 --- a/specification/cat/segments/examples/request/CatSegmentsRequestExample1.yaml +++ b/specification/cat/segments/examples/request/CatSegmentsRequestExample1.yaml @@ -1,31 +1 @@ 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"' - - language: Java - code: | - client.cat().segments(); diff --git a/specification/cat/shards/examples/request/CatShardsRequestExample1.yaml b/specification/cat/shards/examples/request/CatShardsRequestExample1.yaml index 8f2e6d0b31..a4c20ed991 100644 --- a/specification/cat/shards/examples/request/CatShardsRequestExample1.yaml +++ b/specification/cat/shards/examples/request/CatShardsRequestExample1.yaml @@ -1,27 +1 @@ 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"' - - language: Java - code: | - client.cat().shards(); diff --git a/specification/cat/snapshots/examples/request/CatSnapshotsRequestExample1.yaml b/specification/cat/snapshots/examples/request/CatSnapshotsRequestExample1.yaml index dae40f5b60..94228f6cc8 100644 --- a/specification/cat/snapshots/examples/request/CatSnapshotsRequestExample1.yaml +++ b/specification/cat/snapshots/examples/request/CatSnapshotsRequestExample1.yaml @@ -1,39 +1 @@ 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"' - - language: Java - code: | - client.cat().snapshots(); diff --git a/specification/cat/tasks/examples/request/CatTasksRequestExample1.yaml b/specification/cat/tasks/examples/request/CatTasksRequestExample1.yaml index 793bc61b23..83f20212f5 100644 --- a/specification/cat/tasks/examples/request/CatTasksRequestExample1.yaml +++ b/specification/cat/tasks/examples/request/CatTasksRequestExample1.yaml @@ -1,31 +1 @@ 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"' - - language: Java - code: | - client.cat().tasks(); diff --git a/specification/cat/templates/examples/request/CatTemplatesRequestExample1.yaml b/specification/cat/templates/examples/request/CatTemplatesRequestExample1.yaml index 98986a03be..3a7fdc9a20 100644 --- a/specification/cat/templates/examples/request/CatTemplatesRequestExample1.yaml +++ b/specification/cat/templates/examples/request/CatTemplatesRequestExample1.yaml @@ -1,40 +1 @@ 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"' - - language: Java - code: | - client.cat().templates(); diff --git a/specification/cat/thread_pool/examples/request/CatThreadPoolRequestExample1.yaml b/specification/cat/thread_pool/examples/request/CatThreadPoolRequestExample1.yaml index 6dd9fb57cd..385f4f68ac 100644 --- a/specification/cat/thread_pool/examples/request/CatThreadPoolRequestExample1.yaml +++ b/specification/cat/thread_pool/examples/request/CatThreadPoolRequestExample1.yaml @@ -1,27 +1 @@ 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"' - - language: Java - code: | - client.cat().threadPool(); diff --git a/specification/cat/transforms/examples/request/CatTransformsRequestExample1.yaml b/specification/cat/transforms/examples/request/CatTransformsRequestExample1.yaml index c5cb85163d..f71dc917dd 100644 --- a/specification/cat/transforms/examples/request/CatTransformsRequestExample1.yaml +++ b/specification/cat/transforms/examples/request/CatTransformsRequestExample1.yaml @@ -1,31 +1 @@ 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"' - - language: Java - code: | - client.cat().transforms(); 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 a2fe3a0052..186e1b5ebb 100644 --- a/specification/ccr/delete_auto_follow_pattern/examples/request/DeleteAutoFollowPatternRequestExample1.yaml +++ b/specification/ccr/delete_auto_follow_pattern/examples/request/DeleteAutoFollowPatternRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ccr().deleteAutoFollowPattern(d -> d - .name("my_auto_follow_pattern") - ); diff --git a/specification/ccr/follow/examples/request/CreateFollowIndexRequestExample1.yaml b/specification/ccr/follow/examples/request/CreateFollowIndexRequestExample1.yaml index 3b29670ab6..a1ff270865 100644 --- a/specification/ccr/follow/examples/request/CreateFollowIndexRequestExample1.yaml +++ b/specification/ccr/follow/examples/request/CreateFollowIndexRequestExample1.yaml @@ -20,127 +20,3 @@ 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\"" - - language: Java - code: | - client.ccr().follow(f -> f - .index("follower_index") - .leaderIndex("leader_index") - .maxOutstandingReadRequests(16L) - .maxOutstandingWriteRequests(8) - .maxReadRequestOperationCount(1024) - .maxReadRequestSize("1024k") - .maxRetryDelay(m -> m - .time("10s") - ) - .maxWriteBufferCount(512) - .maxWriteBufferSize("512k") - .maxWriteRequestOperationCount(32768) - .maxWriteRequestSize("16k") - .readPollTimeout(r -> r - .time("30s") - ) - .remoteCluster("remote_cluster") - .settings(s -> s - .otherSettings("index.number_of_replicas", JsonData.fromJson("0")) - ) - .waitForActiveShards(w -> w - .count(1) - ) - ); diff --git a/specification/ccr/follow_info/examples/request/FollowInfoRequestExample1.yaml b/specification/ccr/follow_info/examples/request/FollowInfoRequestExample1.yaml index 80b7896018..6df3adb0f3 100644 --- a/specification/ccr/follow_info/examples/request/FollowInfoRequestExample1.yaml +++ b/specification/ccr/follow_info/examples/request/FollowInfoRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ccr().followInfo(f -> f - .index("follower_index") - ); diff --git a/specification/ccr/follow_stats/examples/request/FollowIndexStatsRequestExample1.yaml b/specification/ccr/follow_stats/examples/request/FollowIndexStatsRequestExample1.yaml index 8db1dc74a7..adb3832fb4 100644 --- a/specification/ccr/follow_stats/examples/request/FollowIndexStatsRequestExample1.yaml +++ b/specification/ccr/follow_stats/examples/request/FollowIndexStatsRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ccr().followStats(f -> f - .index("follower_index") - ); diff --git a/specification/ccr/forget_follower/examples/request/ForgetFollowerIndexRequestExample1.yaml b/specification/ccr/forget_follower/examples/request/ForgetFollowerIndexRequestExample1.yaml index 7d61cd79e5..ccd31d30c2 100644 --- a/specification/ccr/forget_follower/examples/request/ForgetFollowerIndexRequestExample1.yaml +++ b/specification/ccr/forget_follower/examples/request/ForgetFollowerIndexRequestExample1.yaml @@ -13,58 +13,3 @@ value: "{ \ \"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\"" - - language: Java - code: | - client.ccr().forgetFollower(f -> f - .followerCluster("") - .followerIndex("") - .followerIndexUuid("") - .index("") - .leaderRemoteCluster("") - ); 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 d126f18128..caaaa7c13d 100644 --- a/specification/ccr/get_auto_follow_pattern/examples/request/GetAutoFollowPatternRequestExample1.yaml +++ b/specification/ccr/get_auto_follow_pattern/examples/request/GetAutoFollowPatternRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ccr().getAutoFollowPattern(g -> g - .name("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 82db91f81c..b820410932 100644 --- a/specification/ccr/pause_auto_follow_pattern/examples/request/PauseAutoFollowPatternRequestExample1.yaml +++ b/specification/ccr/pause_auto_follow_pattern/examples/request/PauseAutoFollowPatternRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ccr().pauseAutoFollowPattern(p -> p - .name("my_auto_follow_pattern") - ); diff --git a/specification/ccr/pause_follow/examples/request/PauseFollowIndexRequestExample1.yaml b/specification/ccr/pause_follow/examples/request/PauseFollowIndexRequestExample1.yaml index 5decf80b2e..b072e5ee6a 100644 --- a/specification/ccr/pause_follow/examples/request/PauseFollowIndexRequestExample1.yaml +++ b/specification/ccr/pause_follow/examples/request/PauseFollowIndexRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ccr().pauseFollow(p -> p - .index("follower_index") - ); 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 f36dc32b60..6d5cb8e09d 100644 --- a/specification/ccr/put_auto_follow_pattern/examples/request/PutAutoFollowPatternRequestExample1.yaml +++ b/specification/ccr/put_auto_follow_pattern/examples/request/PutAutoFollowPatternRequestExample1.yaml @@ -44,129 +44,3 @@ value: "{ \ \"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\"" - - language: Java - code: | - client.ccr().putAutoFollowPattern(p -> p - .followIndexPattern("{{leader_index}}-follower") - .leaderIndexPatterns("leader_index*") - .maxOutstandingReadRequests(16) - .maxOutstandingWriteRequests(8) - .maxReadRequestOperationCount(1024) - .maxReadRequestSize("1024k") - .maxRetryDelay(m -> m - .time("10s") - ) - .maxWriteBufferCount(512) - .maxWriteBufferSize("512k") - .maxWriteRequestOperationCount(32768) - .maxWriteRequestSize("16k") - .name("my_auto_follow_pattern") - .readPollTimeout(r -> r - .time("30s") - ) - .remoteCluster("remote_cluster") - .settings("index.number_of_replicas", JsonData.fromJson("0")) - ); 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 0997854418..9a06b480ab 100644 --- a/specification/ccr/resume_auto_follow_pattern/examples/request/ResumeAutoFollowPatternRequestExample1.yaml +++ b/specification/ccr/resume_auto_follow_pattern/examples/request/ResumeAutoFollowPatternRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ccr().resumeAutoFollowPattern(r -> r - .name("my_auto_follow_pattern") - ); diff --git a/specification/ccr/resume_follow/examples/request/ResumeFollowIndexRequestExample1.yaml b/specification/ccr/resume_follow/examples/request/ResumeFollowIndexRequestExample1.yaml index e936715283..2af6e225b5 100644 --- a/specification/ccr/resume_follow/examples/request/ResumeFollowIndexRequestExample1.yaml +++ b/specification/ccr/resume_follow/examples/request/ResumeFollowIndexRequestExample1.yaml @@ -15,94 +15,3 @@ 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\"" - - language: Java - code: | - client.ccr().resumeFollow(r -> r - .index("follower_index") - .maxOutstandingReadRequests(16L) - .maxOutstandingWriteRequests(8L) - .maxReadRequestOperationCount(1024L) - .maxReadRequestSize("1024k") - .maxRetryDelay(m -> m - .time("10s") - ) - .maxWriteBufferCount(512L) - .maxWriteBufferSize("512k") - .maxWriteRequestOperationCount(32768L) - .maxWriteRequestSize("16k") - .readPollTimeout(re -> re - .time("30s") - ) - ); diff --git a/specification/ccr/stats/examples/request/CcrStatsRequestExample1.yaml b/specification/ccr/stats/examples/request/CcrStatsRequestExample1.yaml index 86e1e570fe..b046eaf51b 100644 --- a/specification/ccr/stats/examples/request/CcrStatsRequestExample1.yaml +++ b/specification/ccr/stats/examples/request/CcrStatsRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.ccr().stats(s -> s); diff --git a/specification/ccr/unfollow/examples/request/UnfollowIndexRequestExample1.yaml b/specification/ccr/unfollow/examples/request/UnfollowIndexRequestExample1.yaml index f18fb1b572..6258df4485 100644 --- a/specification/ccr/unfollow/examples/request/UnfollowIndexRequestExample1.yaml +++ b/specification/ccr/unfollow/examples/request/UnfollowIndexRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ccr().unfollow(u -> u - .index("follower_index") - ); diff --git a/specification/cluster/allocation_explain/examples/request/ClusterAllocationExplainRequestExample1.yaml b/specification/cluster/allocation_explain/examples/request/ClusterAllocationExplainRequestExample1.yaml index ef53821360..c3ef492eb9 100644 --- a/specification/cluster/allocation_explain/examples/request/ClusterAllocationExplainRequestExample1.yaml +++ b/specification/cluster/allocation_explain/examples/request/ClusterAllocationExplainRequestExample1.yaml @@ -9,53 +9,3 @@ 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"' - - language: Java - code: | - client.cluster().allocationExplain(a -> a - .currentNode("my-node") - .index("my-index-000001") - .primary(false) - .shard(0) - ); diff --git a/specification/cluster/delete_component_template/examples/request/ClusterDeleteComponentTemplateExample1.yaml b/specification/cluster/delete_component_template/examples/request/ClusterDeleteComponentTemplateExample1.yaml index f91d8553cd..c8910cf9f2 100644 --- a/specification/cluster/delete_component_template/examples/request/ClusterDeleteComponentTemplateExample1.yaml +++ b/specification/cluster/delete_component_template/examples/request/ClusterDeleteComponentTemplateExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.cluster().deleteComponentTemplate(d -> d - .name("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 1a1d3b2a26..e02a3625a8 100644 --- a/specification/cluster/get_component_template/examples/request/ClusterGetComponentTemplateExample1.yaml +++ b/specification/cluster/get_component_template/examples/request/ClusterGetComponentTemplateExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.cluster().getComponentTemplate(g -> g - .name("template_1") - ); diff --git a/specification/cluster/get_settings/examples/request/ClusterGetSettingsExample1.yaml b/specification/cluster/get_settings/examples/request/ClusterGetSettingsExample1.yaml index 1eb833d002..8b8cd59ecc 100644 --- a/specification/cluster/get_settings/examples/request/ClusterGetSettingsExample1.yaml +++ b/specification/cluster/get_settings/examples/request/ClusterGetSettingsExample1.yaml @@ -1,27 +1 @@ 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"' - - language: Java - code: "\n" diff --git a/specification/cluster/health/examples/request/ClusterHealthRequestExample1.yaml b/specification/cluster/health/examples/request/ClusterHealthRequestExample1.yaml index 41f150af6f..4852a044ab 100644 --- a/specification/cluster/health/examples/request/ClusterHealthRequestExample1.yaml +++ b/specification/cluster/health/examples/request/ClusterHealthRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.cluster().health(h -> h); diff --git a/specification/cluster/info/examples/request/ClusterInfoExample1.yaml b/specification/cluster/info/examples/request/ClusterInfoExample1.yaml index 3a1743a778..c2742b05e4 100644 --- a/specification/cluster/info/examples/request/ClusterInfoExample1.yaml +++ b/specification/cluster/info/examples/request/ClusterInfoExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.cluster().info(i -> i - .target("_all") - ); diff --git a/specification/cluster/pending_tasks/examples/request/ClusterPendingTasksExample1.yaml b/specification/cluster/pending_tasks/examples/request/ClusterPendingTasksExample1.yaml index 2f04fc1aa5..1217dc2640 100644 --- a/specification/cluster/pending_tasks/examples/request/ClusterPendingTasksExample1.yaml +++ b/specification/cluster/pending_tasks/examples/request/ClusterPendingTasksExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.cluster().pendingTasks(p -> p); diff --git a/specification/cluster/put_component_template/examples/request/ClusterPutComponentTemplateRequestExample1.yaml b/specification/cluster/put_component_template/examples/request/ClusterPutComponentTemplateRequestExample1.yaml index 99b8ee65d7..1e8407935b 100644 --- a/specification/cluster/put_component_template/examples/request/ClusterPutComponentTemplateRequestExample1.yaml +++ b/specification/cluster/put_component_template/examples/request/ClusterPutComponentTemplateRequestExample1.yaml @@ -15,106 +15,3 @@ 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 e7371f5c64..7a07b27bf7 100644 --- a/specification/cluster/put_component_template/examples/request/ClusterPutComponentTemplateRequestExample2.yaml +++ b/specification/cluster/put_component_template/examples/request/ClusterPutComponentTemplateRequestExample2.yaml @@ -16,97 +16,3 @@ 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 f8e67f57e5..fe855ff11d 100644 --- a/specification/cluster/put_settings/examples/request/ClusterPutSettingsRequestExample1.yaml +++ b/specification/cluster/put_settings/examples/request/ClusterPutSettingsRequestExample1.yaml @@ -8,45 +8,3 @@ 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"' - - language: Java - code: | - client.cluster().putSettings(p -> p - .persistent("indices.recovery.max_bytes_per_sec", JsonData.fromJson("\"50mb\"")) - ); diff --git a/specification/cluster/put_settings/examples/request/ClusterPutSettingsRequestExample2.yaml b/specification/cluster/put_settings/examples/request/ClusterPutSettingsRequestExample2.yaml index 425860b2fb..c76d67ba7d 100644 --- a/specification/cluster/put_settings/examples/request/ClusterPutSettingsRequestExample2.yaml +++ b/specification/cluster/put_settings/examples/request/ClusterPutSettingsRequestExample2.yaml @@ -13,46 +13,3 @@ 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"' - - language: Java - code: | - client.cluster().putSettings(p -> p - .persistent("action.auto_create_index", JsonData.fromJson("\"my-index-000001,index10,-index1*,+ind*\"")) - ); diff --git a/specification/cluster/remote_info/examples/request/ClusterRemoteInfoExample1.yaml b/specification/cluster/remote_info/examples/request/ClusterRemoteInfoExample1.yaml index 8512892d65..989596ba8f 100644 --- a/specification/cluster/remote_info/examples/request/ClusterRemoteInfoExample1.yaml +++ b/specification/cluster/remote_info/examples/request/ClusterRemoteInfoExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.cluster().remoteInfo(); diff --git a/specification/cluster/reroute/examples/request/ClusterRerouteRequestExample1.yaml b/specification/cluster/reroute/examples/request/ClusterRerouteRequestExample1.yaml index fcbc8a511d..1d9b402115 100644 --- a/specification/cluster/reroute/examples/request/ClusterRerouteRequestExample1.yaml +++ b/specification/cluster/reroute/examples/request/ClusterRerouteRequestExample1.yaml @@ -19,101 +19,3 @@ 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 07e1a52727..51c4ecac5f 100644 --- a/specification/cluster/state/examples/request/ClusterStateExample1.yaml +++ b/specification/cluster/state/examples/request/ClusterStateExample1.yaml @@ -1,27 +1 @@ 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"' - - language: Java - code: "\n" diff --git a/specification/cluster/stats/examples/request/ClusterStatsExample1.yaml b/specification/cluster/stats/examples/request/ClusterStatsExample1.yaml index ecac7caa71..94af04f32c 100644 --- a/specification/cluster/stats/examples/request/ClusterStatsExample1.yaml +++ b/specification/cluster/stats/examples/request/ClusterStatsExample1.yaml @@ -1,31 +1 @@ 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*"' - - language: Java - code: "\n" diff --git a/specification/connector/check_in/examples/request/ConnectorCheckInExample1.yaml b/specification/connector/check_in/examples/request/ConnectorCheckInExample1.yaml index d59b290297..2f97b859fb 100644 --- a/specification/connector/check_in/examples/request/ConnectorCheckInExample1.yaml +++ b/specification/connector/check_in/examples/request/ConnectorCheckInExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.connector().checkIn(c -> c - .connectorId("my-connector") - ); diff --git a/specification/connector/delete/examples/request/ConnectorDeleteExample1.yaml b/specification/connector/delete/examples/request/ConnectorDeleteExample1.yaml index dd538cd532..bc8099b358 100644 --- a/specification/connector/delete/examples/request/ConnectorDeleteExample1.yaml +++ b/specification/connector/delete/examples/request/ConnectorDeleteExample1.yaml @@ -1,30 +1 @@ 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"' - - language: Java - code: | - client.connector().delete(d -> d - .connectorId("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 0544a4d028..74c3c41c26 100644 --- a/specification/connector/get/examples/request/ConnectorGetExample1.yaml +++ b/specification/connector/get/examples/request/ConnectorGetExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.connector().get(g -> g - .connectorId("my-connector-id") - ); diff --git a/specification/connector/last_sync/examples/request/ConnectorUpdateLastSyncRequestExample1.yaml b/specification/connector/last_sync/examples/request/ConnectorUpdateLastSyncRequestExample1.yaml index 611f461feb..030bc2c34f 100644 --- a/specification/connector/last_sync/examples/request/ConnectorUpdateLastSyncRequestExample1.yaml +++ b/specification/connector/last_sync/examples/request/ConnectorUpdateLastSyncRequestExample1.yaml @@ -25,94 +25,3 @@ value: "{ \ \"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 3225fec5b4..322ca96846 100644 --- a/specification/connector/list/examples/request/ConnectorListExample1.yaml +++ b/specification/connector/list/examples/request/ConnectorListExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.connector().list(l -> l); diff --git a/specification/connector/put/examples/request/ConnectorPutRequestExample1.yaml b/specification/connector/put/examples/request/ConnectorPutRequestExample1.yaml index 79b38e6aee..beecca0fdf 100644 --- a/specification/connector/put/examples/request/ConnectorPutRequestExample1.yaml +++ b/specification/connector/put/examples/request/ConnectorPutRequestExample1.yaml @@ -11,53 +11,3 @@ value: "{ \ \"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"' - - language: Java - code: | - client.connector().put(p -> p - .connectorId("my-connector") - .indexName("search-google-drive") - .name("My Connector") - .serviceType("google_drive") - ); diff --git a/specification/connector/put/examples/request/ConnectorPutRequestExample2.yaml b/specification/connector/put/examples/request/ConnectorPutRequestExample2.yaml index fa4d100138..d79b7a545d 100644 --- a/specification/connector/put/examples/request/ConnectorPutRequestExample2.yaml +++ b/specification/connector/put/examples/request/ConnectorPutRequestExample2.yaml @@ -15,64 +15,3 @@ value: "{ \ \"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"' - - language: Java - code: | - client.connector().put(p -> p - .connectorId("my-connector") - .description("My Connector to sync data to Elastic index from Google Drive") - .indexName("search-google-drive") - .language("english") - .name("My Connector") - .serviceType("google_drive") - ); diff --git a/specification/connector/sync_job_cancel/examples/request/ConnectorSyncJobCancelExample1.yaml b/specification/connector/sync_job_cancel/examples/request/ConnectorSyncJobCancelExample1.yaml index 269b148b8d..37099d856b 100644 --- a/specification/connector/sync_job_cancel/examples/request/ConnectorSyncJobCancelExample1.yaml +++ b/specification/connector/sync_job_cancel/examples/request/ConnectorSyncJobCancelExample1.yaml @@ -1,30 +1 @@ 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"' - - language: Java - code: | - client.connector().syncJobCancel(s -> s - .connectorSyncJobId("my-connector-sync-job-id") - ); 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 a456522b3d..7400453c39 100644 --- a/specification/connector/sync_job_check_in/examples/request/ConnectorSyncJobCheckInExample1.yaml +++ b/specification/connector/sync_job_check_in/examples/request/ConnectorSyncJobCheckInExample1.yaml @@ -1,30 +1 @@ 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"' - - language: Java - code: | - client.connector().syncJobCheckIn(s -> s - .connectorSyncJobId("my-connector-sync-job") - ); diff --git a/specification/connector/sync_job_claim/examples/request/ConnectorSyncJobClaimExample1.yaml b/specification/connector/sync_job_claim/examples/request/ConnectorSyncJobClaimExample1.yaml index 531af2b4c5..f5d51efb6d 100644 --- a/specification/connector/sync_job_claim/examples/request/ConnectorSyncJobClaimExample1.yaml +++ b/specification/connector/sync_job_claim/examples/request/ConnectorSyncJobClaimExample1.yaml @@ -4,42 +4,3 @@ 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"' - - language: Java - code: | - client.connector().syncJobClaim(s -> s - .connectorSyncJobId("my-connector-sync-job-id") - .workerHostname("some-machine") - ); diff --git a/specification/connector/sync_job_delete/examples/request/ConnectorSyncJobDeleteExample1.yaml b/specification/connector/sync_job_delete/examples/request/ConnectorSyncJobDeleteExample1.yaml index 952eb3e2c7..f4e670b918 100644 --- a/specification/connector/sync_job_delete/examples/request/ConnectorSyncJobDeleteExample1.yaml +++ b/specification/connector/sync_job_delete/examples/request/ConnectorSyncJobDeleteExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.connector().syncJobDelete(s -> s - .connectorSyncJobId("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 65530cbcdd..6af2adb0c0 100644 --- a/specification/connector/sync_job_error/examples/request/SyncJobErrorRequestExample1.yaml +++ b/specification/connector/sync_job_error/examples/request/SyncJobErrorRequestExample1.yaml @@ -3,42 +3,3 @@ 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"' - - language: Java - code: | - client.connector().syncJobError(s -> s - .connectorSyncJobId("my-connector-sync-job") - .error("some-error") - ); diff --git a/specification/connector/sync_job_get/examples/request/ConnectorSyncJobGetExample1.yaml b/specification/connector/sync_job_get/examples/request/ConnectorSyncJobGetExample1.yaml index 7084d0c930..f6a2b86568 100644 --- a/specification/connector/sync_job_get/examples/request/ConnectorSyncJobGetExample1.yaml +++ b/specification/connector/sync_job_get/examples/request/ConnectorSyncJobGetExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.connector().syncJobGet(s -> s - .connectorSyncJobId("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 6fcca5322d..6be6de9fff 100644 --- a/specification/connector/sync_job_list/examples/request/ConnectorSyncJobListExample1.yaml +++ b/specification/connector/sync_job_list/examples/request/ConnectorSyncJobListExample1.yaml @@ -1,35 +1 @@ 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"' - - language: Java - code: | - client.connector().syncJobList(s -> s - .connectorId("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 3a0b1e24f2..ad93bfe751 100644 --- a/specification/connector/sync_job_post/examples/request/SyncJobPostRequestExample1.yaml +++ b/specification/connector/sync_job_post/examples/request/SyncJobPostRequestExample1.yaml @@ -11,48 +11,3 @@ value: "{ \ \"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"' - - language: Java - code: | - client.connector().syncJobPost(s -> s - .id("connector-id") - .jobType(SyncJobType.Full) - .triggerMethod(SyncJobTriggerMethod.OnDemand) - ); 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 1aeb2cc7cf..f7b467b6fc 100644 --- a/specification/connector/sync_job_update_stats/examples/request/ConnectorSyncJobUpdateStatsExample1.yaml +++ b/specification/connector/sync_job_update_stats/examples/request/ConnectorSyncJobUpdateStatsExample1.yaml @@ -8,65 +8,3 @@ 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\"" - - language: Java - code: | - client.connector().syncJobUpdateStats(s -> s - .connectorSyncJobId("my-connector-sync-job") - .deletedDocumentCount(10L) - .indexedDocumentCount(20L) - .indexedDocumentVolume(1000L) - .lastSeen(l -> l - .time("2023-01-02T10:00:00Z") - ) - .totalDocumentCount(2000) - ); 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 cf7e344ccd..1c2e32039e 100644 --- a/specification/connector/update_api_key_id/examples/request/ConnectorUpdateApiKeyIDRequestExample1.yaml +++ b/specification/connector/update_api_key_id/examples/request/ConnectorUpdateApiKeyIDRequestExample1.yaml @@ -9,48 +9,3 @@ value: "{ \ \"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"' - - language: Java - code: | - client.connector().updateApiKeyId(u -> u - .apiKeyId("my-api-key-id") - .apiKeySecretId("my-connector-secret-id") - .connectorId("my-connector") - ); diff --git a/specification/connector/update_configuration/examples/request/ConnectorUpdateConfigurationRequestExample1.yaml b/specification/connector/update_configuration/examples/request/ConnectorUpdateConfigurationRequestExample1.yaml index e1007a7bc3..42bbdd5f8e 100644 --- a/specification/connector/update_configuration/examples/request/ConnectorUpdateConfigurationRequestExample1.yaml +++ b/specification/connector/update_configuration/examples/request/ConnectorUpdateConfigurationRequestExample1.yaml @@ -19,67 +19,3 @@ value: "{ \ } }" -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\"" - - language: Java - code: > - client.connector().updateConfiguration(u -> u - .connectorId("my-spo-connector") - .values(Map.of("tenant_id", JsonData.fromJson("\"my-tenant-id\""),"tenant_name", JsonData.fromJson("\"my-sharepoint-site\""),"secret_value", JsonData.fromJson("\"bar\""),"client_id", JsonData.fromJson("\"foo\""),"site_collections", JsonData.fromJson("\"*\""))) - ); diff --git a/specification/connector/update_configuration/examples/request/ConnectorUpdateConfigurationRequestExample2.yaml b/specification/connector/update_configuration/examples/request/ConnectorUpdateConfigurationRequestExample2.yaml index 9adf886424..f1aa1cc874 100644 --- a/specification/connector/update_configuration/examples/request/ConnectorUpdateConfigurationRequestExample2.yaml +++ b/specification/connector/update_configuration/examples/request/ConnectorUpdateConfigurationRequestExample2.yaml @@ -11,50 +11,3 @@ value: "{ \ } }" -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"' - - language: Java - code: | - client.connector().updateConfiguration(u -> u - .connectorId("my-spo-connector") - .values("secret_value", JsonData.fromJson("\"foo-bar\"")) - ); diff --git a/specification/connector/update_error/examples/request/ConnectorUpdateErrorRequestExample1.yaml b/specification/connector/update_error/examples/request/ConnectorUpdateErrorRequestExample1.yaml index 19e5e83857..ae0718fea7 100644 --- a/specification/connector/update_error/examples/request/ConnectorUpdateErrorRequestExample1.yaml +++ b/specification/connector/update_error/examples/request/ConnectorUpdateErrorRequestExample1.yaml @@ -7,42 +7,3 @@ 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"' - - language: Java - code: | - client.connector().updateError(u -> u - .connectorId("my-connector") - .error("Houston, we have a problem!") - ); diff --git a/specification/connector/update_features/examples/request/ConnectorUpdateFeaturesRequestExample1.yaml b/specification/connector/update_features/examples/request/ConnectorUpdateFeaturesRequestExample1.yaml index fafb30cb3c..d113aaef53 100644 --- a/specification/connector/update_features/examples/request/ConnectorUpdateFeaturesRequestExample1.yaml +++ b/specification/connector/update_features/examples/request/ConnectorUpdateFeaturesRequestExample1.yaml @@ -37,118 +37,3 @@ value: "{ \ } }" -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\"" - - language: Java - code: | - client.connector().updateFeatures(u -> u - .connectorId("my-connector") - .features(f -> f - .documentLevelSecurity(d -> d - .enabled(true) - ) - .incrementalSync(i -> i - .enabled(true) - ) - .syncRules(s -> s - .advanced(a -> a - .enabled(false) - ) - .basic(b -> b - .enabled(true) - ) - ) - ) - ); diff --git a/specification/connector/update_features/examples/request/ConnectorUpdateFeaturesRequestExample2.yaml b/specification/connector/update_features/examples/request/ConnectorUpdateFeaturesRequestExample2.yaml index 66f2e9c3a7..117720576b 100644 --- a/specification/connector/update_features/examples/request/ConnectorUpdateFeaturesRequestExample2.yaml +++ b/specification/connector/update_features/examples/request/ConnectorUpdateFeaturesRequestExample2.yaml @@ -15,62 +15,3 @@ value: "{ \ } }" -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"' - - language: Java - code: | - client.connector().updateFeatures(u -> u - .connectorId("my-connector") - .features(f -> f - .documentLevelSecurity(d -> d - .enabled(true) - ) - ) - ); diff --git a/specification/connector/update_filtering/examples/request/ConnectorUpdateFilteringRequestExample1.yaml b/specification/connector/update_filtering/examples/request/ConnectorUpdateFilteringRequestExample1.yaml index 1bb11f2ef6..862ee33f84 100644 --- a/specification/connector/update_filtering/examples/request/ConnectorUpdateFilteringRequestExample1.yaml +++ b/specification/connector/update_filtering/examples/request/ConnectorUpdateFilteringRequestExample1.yaml @@ -41,124 +41,3 @@ 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\"" - - language: Java - code: | - client.connector().updateFiltering(u -> u - .connectorId("my-g-drive-connector") - .rules(List.of(FilteringRule.of(f -> f - .field("file_extension") - .id("exclude-txt-files") - .order(0) - .policy(FilteringPolicy.Exclude) - .rule(FilteringRuleRule.Equals) - .value("txt")),FilteringRule.of(f -> f - .field("_") - .id("DEFAULT") - .order(1) - .policy(FilteringPolicy.Include) - .rule(FilteringRuleRule.Regex) - .value(".*")))) - ); diff --git a/specification/connector/update_filtering/examples/request/ConnectorUpdateFilteringRequestExample2.yaml b/specification/connector/update_filtering/examples/request/ConnectorUpdateFilteringRequestExample2.yaml index b2bd1f3e60..1fe3089778 100644 --- a/specification/connector/update_filtering/examples/request/ConnectorUpdateFilteringRequestExample2.yaml +++ b/specification/connector/update_filtering/examples/request/ConnectorUpdateFilteringRequestExample2.yaml @@ -23,84 +23,3 @@ value: "{ \ } }" -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"' - - language: Java - code: > - client.connector().updateFiltering(u -> u - .advancedSnippet(a -> a - .value(JsonData.fromJson("[{\"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\"}]")) - ) - .connectorId("my-sql-connector") - ); diff --git a/specification/connector/update_index_name/examples/request/ConnectorUpdateIndexNameRequestExample1.yaml b/specification/connector/update_index_name/examples/request/ConnectorUpdateIndexNameRequestExample1.yaml index fc72b4dbc4..797ea0b786 100644 --- a/specification/connector/update_index_name/examples/request/ConnectorUpdateIndexNameRequestExample1.yaml +++ b/specification/connector/update_index_name/examples/request/ConnectorUpdateIndexNameRequestExample1.yaml @@ -7,42 +7,3 @@ 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"' - - language: Java - code: | - client.connector().updateIndexName(u -> u - .connectorId("my-connector") - .indexName("data-from-my-google-drive") - ); diff --git a/specification/connector/update_name/examples/request/ConnectorUpdateNameRequestExample1.yaml b/specification/connector/update_name/examples/request/ConnectorUpdateNameRequestExample1.yaml index eeca2c6fe7..d3656fc5f8 100644 --- a/specification/connector/update_name/examples/request/ConnectorUpdateNameRequestExample1.yaml +++ b/specification/connector/update_name/examples/request/ConnectorUpdateNameRequestExample1.yaml @@ -9,47 +9,3 @@ value: "{ \ \"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"' - - language: Java - code: | - client.connector().updateName(u -> u - .connectorId("my-connector") - .description("This is my customized connector") - .name("Custom connector") - ); diff --git a/specification/connector/update_pipeline/examples/request/ConnectorUpdatePipelineRequestExample1.yaml b/specification/connector/update_pipeline/examples/request/ConnectorUpdatePipelineRequestExample1.yaml index 75c4242316..550d2e016d 100644 --- a/specification/connector/update_pipeline/examples/request/ConnectorUpdatePipelineRequestExample1.yaml +++ b/specification/connector/update_pipeline/examples/request/ConnectorUpdatePipelineRequestExample1.yaml @@ -17,68 +17,3 @@ value: "{ \ } }" -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\"" - - language: Java - code: | - client.connector().updatePipeline(u -> u - .connectorId("my-connector") - .pipeline(p -> p - .extractBinaryContent(true) - .name("my-connector-pipeline") - .reduceWhitespace(true) - .runMlInference(true) - ) - ); diff --git a/specification/connector/update_scheduling/examples/request/ConnectorUpdateSchedulingRequestExample1.yaml b/specification/connector/update_scheduling/examples/request/ConnectorUpdateSchedulingRequestExample1.yaml index 952fc05f55..42be05152e 100644 --- a/specification/connector/update_scheduling/examples/request/ConnectorUpdateSchedulingRequestExample1.yaml +++ b/specification/connector/update_scheduling/examples/request/ConnectorUpdateSchedulingRequestExample1.yaml @@ -33,109 +33,3 @@ value: "{ \ } }" -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"' - - language: Java - code: | - client.connector().updateScheduling(u -> u - .connectorId("my-connector") - .scheduling(s -> s - .accessControl(a -> a - .enabled(true) - .interval("0 10 0 * * ?") - ) - .full(f -> f - .enabled(true) - .interval("0 20 0 * * ?") - ) - .incremental(i -> i - .enabled(false) - .interval("0 30 0 * * ?") - ) - ) - ); diff --git a/specification/connector/update_scheduling/examples/request/ConnectorUpdateSchedulingRequestExample2.yaml b/specification/connector/update_scheduling/examples/request/ConnectorUpdateSchedulingRequestExample2.yaml index 5a50723d02..26967d5089 100644 --- a/specification/connector/update_scheduling/examples/request/ConnectorUpdateSchedulingRequestExample2.yaml +++ b/specification/connector/update_scheduling/examples/request/ConnectorUpdateSchedulingRequestExample2.yaml @@ -17,68 +17,3 @@ value: "{ \ } }" -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"' - - language: Java - code: | - client.connector().updateScheduling(u -> u - .connectorId("my-connector") - .scheduling(s -> s - .full(f -> f - .enabled(true) - .interval("0 10 0 * * ?") - ) - ) - ); diff --git a/specification/connector/update_service_type/examples/request/ConnectorUpdateServiceTypeRequestExample1.yaml b/specification/connector/update_service_type/examples/request/ConnectorUpdateServiceTypeRequestExample1.yaml index d741fb57a2..9a5e065f56 100644 --- a/specification/connector/update_service_type/examples/request/ConnectorUpdateServiceTypeRequestExample1.yaml +++ b/specification/connector/update_service_type/examples/request/ConnectorUpdateServiceTypeRequestExample1.yaml @@ -7,42 +7,3 @@ 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"' - - language: Java - code: | - client.connector().updateServiceType(u -> u - .connectorId("my-connector") - .serviceType("sharepoint_online") - ); diff --git a/specification/connector/update_status/examples/request/ConnectorUpdateStatusRequestExample1.yaml b/specification/connector/update_status/examples/request/ConnectorUpdateStatusRequestExample1.yaml index cffd08e00e..8f119c15f5 100644 --- a/specification/connector/update_status/examples/request/ConnectorUpdateStatusRequestExample1.yaml +++ b/specification/connector/update_status/examples/request/ConnectorUpdateStatusRequestExample1.yaml @@ -7,42 +7,3 @@ 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"' - - language: Java - code: | - client.connector().updateStatus(u -> u - .connectorId("my-connector") - .status(ConnectorStatus.NeedsConfiguration) - ); 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 7eed98bdd5..5458a595a5 100644 --- a/specification/dangling_indices/delete_dangling_index/examples/request/DanglingIndicesDeleteDanglingIndexExample1.yaml +++ b/specification/dangling_indices/delete_dangling_index/examples/request/DanglingIndicesDeleteDanglingIndexExample1.yaml @@ -1,34 +1 @@ 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"' - - language: Java - code: | - client.danglingIndices().deleteDanglingIndex(d -> d - .acceptDataLoss(true) - .indexUuid("") - ); 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 73a0e80570..51333864c2 100644 --- a/specification/dangling_indices/import_dangling_index/examples/request/ImportDanglingIndexRequestExample1.yaml +++ b/specification/dangling_indices/import_dangling_index/examples/request/ImportDanglingIndexRequestExample1.yaml @@ -1,35 +1 @@ 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"' - - language: Java - code: | - client.danglingIndices().importDanglingIndex(i -> i - .acceptDataLoss(true) - .indexUuid("zmM4e0JtBkeUjiHD-MihPQ") - ); 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 58e266cc48..ec6b553ed9 100644 --- a/specification/dangling_indices/list_dangling_indices/examples/request/DanglingIndicesListDanglingIndicesExample1.yaml +++ b/specification/dangling_indices/list_dangling_indices/examples/request/DanglingIndicesListDanglingIndicesExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.danglingIndices().listDanglingIndices(); diff --git a/specification/enrich/delete_policy/examples/request/EnrichDeletePolicyExample1.yaml b/specification/enrich/delete_policy/examples/request/EnrichDeletePolicyExample1.yaml index 9e4c2bd34d..f34d633b31 100644 --- a/specification/enrich/delete_policy/examples/request/EnrichDeletePolicyExample1.yaml +++ b/specification/enrich/delete_policy/examples/request/EnrichDeletePolicyExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.enrich().deletePolicy(d -> d - .name("my-policy") - ); diff --git a/specification/enrich/execute_policy/examples/request/EnrichExecutePolicyExample1.yaml b/specification/enrich/execute_policy/examples/request/EnrichExecutePolicyExample1.yaml index f40627c600..f811b235f4 100644 --- a/specification/enrich/execute_policy/examples/request/EnrichExecutePolicyExample1.yaml +++ b/specification/enrich/execute_policy/examples/request/EnrichExecutePolicyExample1.yaml @@ -1,35 +1 @@ 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"' - - language: Java - code: | - client.enrich().executePolicy(e -> e - .name("my-policy") - .waitForCompletion(false) - ); diff --git a/specification/enrich/get_policy/examples/request/EnrichGetPolicyExample1.yaml b/specification/enrich/get_policy/examples/request/EnrichGetPolicyExample1.yaml index 6b65081130..7ecb3d3281 100644 --- a/specification/enrich/get_policy/examples/request/EnrichGetPolicyExample1.yaml +++ b/specification/enrich/get_policy/examples/request/EnrichGetPolicyExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.enrich().getPolicy(g -> g - .name("my-policy") - ); diff --git a/specification/enrich/put_policy/examples/request/EnrichPutPolicyExample1.yaml b/specification/enrich/put_policy/examples/request/EnrichPutPolicyExample1.yaml index ff7e6174e3..fc117616b3 100644 --- a/specification/enrich/put_policy/examples/request/EnrichPutPolicyExample1.yaml +++ b/specification/enrich/put_policy/examples/request/EnrichPutPolicyExample1.yaml @@ -8,72 +8,3 @@ 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"' - - language: Java - code: | - client.enrich().putPolicy(p -> p - .geoMatch(g -> g - .enrichFields(List.of("location","postal_code")) - .indices("postal_codes") - .matchField("location") - ) - .name("postal_policy") - ); diff --git a/specification/enrich/stats/examples/request/EnrichStatsExample1.yaml b/specification/enrich/stats/examples/request/EnrichStatsExample1.yaml index 2140bee357..a6b11becca 100644 --- a/specification/enrich/stats/examples/request/EnrichStatsExample1.yaml +++ b/specification/enrich/stats/examples/request/EnrichStatsExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.enrich().stats(s -> s); diff --git a/specification/eql/delete/examples/request/EqlDeleteExample1.yaml b/specification/eql/delete/examples/request/EqlDeleteExample1.yaml index f5ca2d035c..6e3e4941c1 100644 --- a/specification/eql/delete/examples/request/EqlDeleteExample1.yaml +++ b/specification/eql/delete/examples/request/EqlDeleteExample1.yaml @@ -1,30 +1 @@ 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="' - - language: Java - code: | - client.eql().delete(d -> d - .id("FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=") - ); diff --git a/specification/eql/get/examples/request/EqlGetExample1.yaml b/specification/eql/get/examples/request/EqlGetExample1.yaml index 05c5ee4fa7..64c2684d90 100644 --- a/specification/eql/get/examples/request/EqlGetExample1.yaml +++ b/specification/eql/get/examples/request/EqlGetExample1.yaml @@ -1,37 +1 @@ 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"' - - language: Java - code: | - client.eql().get(g -> g - .id("FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=") - .waitForCompletionTimeout(w -> w - .offset(2) - ) - ); diff --git a/specification/eql/get_status/examples/request/EqlGetStatusExample1.yaml b/specification/eql/get_status/examples/request/EqlGetStatusExample1.yaml index fdb02017f1..05d571aa8c 100644 --- a/specification/eql/get_status/examples/request/EqlGetStatusExample1.yaml +++ b/specification/eql/get_status/examples/request/EqlGetStatusExample1.yaml @@ -1,30 +1 @@ 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="' - - language: Java - code: | - client.eql().getStatus(g -> g - .id("FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=") - ); diff --git a/specification/eql/search/examples/request/EqlSearchRequestExample1.yaml b/specification/eql/search/examples/request/EqlSearchRequestExample1.yaml index 88b92c515e..3650b8fb95 100644 --- a/specification/eql/search/examples/request/EqlSearchRequestExample1.yaml +++ b/specification/eql/search/examples/request/EqlSearchRequestExample1.yaml @@ -10,44 +10,3 @@ 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\"" - - language: Java - code: | - client.eql().search(s -> s - .index("my-data-stream") - .query(" process where (process.name == \"cmd.exe\" and process.pid != 2013) ") - ); diff --git a/specification/eql/search/examples/request/EqlSearchRequestExample2.yaml b/specification/eql/search/examples/request/EqlSearchRequestExample2.yaml index ecc5f9052c..cf9c74778c 100644 --- a/specification/eql/search/examples/request/EqlSearchRequestExample2.yaml +++ b/specification/eql/search/examples/request/EqlSearchRequestExample2.yaml @@ -14,45 +14,3 @@ 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\"" - - language: Java - code: > - client.eql().search(s -> s - .index("my-data-stream") - .query(" sequence by process.pid [ file where file.name == \"cmd.exe\" and process.pid != 2013 ][ process where stringContains(process.executable, \"regsvr32\") ] ") - ); diff --git a/specification/esql/async_query/examples/request/AsyncQueryRequestExample1.yaml b/specification/esql/async_query/examples/request/AsyncQueryRequestExample1.yaml index c36096a74a..263114a0b4 100644 --- a/specification/esql/async_query/examples/request/AsyncQueryRequestExample1.yaml +++ b/specification/esql/async_query/examples/request/AsyncQueryRequestExample1.yaml @@ -14,43 +14,3 @@ 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 45f05b8bdd..0c630eee05 100644 --- a/specification/esql/async_query_delete/examples/request/EsqlAsyncQueryDeleteExample1.yaml +++ b/specification/esql/async_query_delete/examples/request/EsqlAsyncQueryDeleteExample1.yaml @@ -1,25 +1 @@ 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 85b1c99547..7a69a2399a 100644 --- a/specification/esql/async_query_get/examples/request/EsqlAsyncQueryGetExample1.yaml +++ b/specification/esql/async_query_get/examples/request/EsqlAsyncQueryGetExample1.yaml @@ -1,29 +1 @@ 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 ee66b7e73b..775da781ae 100644 --- a/specification/esql/async_query_stop/examples/request/EsqlAsyncQueryStopExample1.yaml +++ b/specification/esql/async_query_stop/examples/request/EsqlAsyncQueryStopExample1.yaml @@ -1,25 +1 @@ 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 681a7b933b..be5b71f199 100644 --- a/specification/esql/query/examples/request/QueryRequestExample1.yaml +++ b/specification/esql/query/examples/request/QueryRequestExample1.yaml @@ -13,44 +13,3 @@ 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\"" - - language: Java - code: > - client.esql().query(q -> q - .includeCcsMetadata(true) - .query(" FROM library,remote-*:library | EVAL year = DATE_TRUNC(1 YEARS, release_date) | STATS MAX(page_count) BY year | SORT year | LIMIT 5 ") - ); diff --git a/specification/features/get_features/examples/request/FeaturesGetFeaturesExample1.yaml b/specification/features/get_features/examples/request/FeaturesGetFeaturesExample1.yaml index 889bca2126..509f354389 100644 --- a/specification/features/get_features/examples/request/FeaturesGetFeaturesExample1.yaml +++ b/specification/features/get_features/examples/request/FeaturesGetFeaturesExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.features().getFeatures(g -> g); diff --git a/specification/features/reset_features/examples/request/FeaturesResetFeaturesExample1.yaml b/specification/features/reset_features/examples/request/FeaturesResetFeaturesExample1.yaml index a3d904d097..0d7baa04ab 100644 --- a/specification/features/reset_features/examples/request/FeaturesResetFeaturesExample1.yaml +++ b/specification/features/reset_features/examples/request/FeaturesResetFeaturesExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.features().resetFeatures(r -> r); diff --git a/specification/graph/explore/examples/request/GraphExploreRequestExample1.yaml b/specification/graph/explore/examples/request/GraphExploreRequestExample1.yaml index d1a020261a..fbe1ccabda 100644 --- a/specification/graph/explore/examples/request/GraphExploreRequestExample1.yaml +++ b/specification/graph/explore/examples/request/GraphExploreRequestExample1.yaml @@ -27,120 +27,3 @@ 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\"" - - language: Java - code: | - client.graph().explore(e -> e - .connections(c -> c - .vertices(v -> v - .field("query.raw") - ) - ) - .index("clicklogs") - .query(q -> q - .match(m -> m - .field("query.raw") - .query(FieldValue.of("midi")) - ) - ) - .vertices(v -> v - .field("product") - ) - ); diff --git a/specification/ilm/delete_lifecycle/examples/request/IlmDeleteLifecycleExample1.yaml b/specification/ilm/delete_lifecycle/examples/request/IlmDeleteLifecycleExample1.yaml index 4b9972d511..2e2a308346 100644 --- a/specification/ilm/delete_lifecycle/examples/request/IlmDeleteLifecycleExample1.yaml +++ b/specification/ilm/delete_lifecycle/examples/request/IlmDeleteLifecycleExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ilm().deleteLifecycle(d -> d - .name("my_policy") - ); diff --git a/specification/ilm/explain_lifecycle/examples/request/IlmExplainLifecycleExample1.yaml b/specification/ilm/explain_lifecycle/examples/request/IlmExplainLifecycleExample1.yaml index 557b998508..e695acaecd 100644 --- a/specification/ilm/explain_lifecycle/examples/request/IlmExplainLifecycleExample1.yaml +++ b/specification/ilm/explain_lifecycle/examples/request/IlmExplainLifecycleExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ilm().explainLifecycle(e -> e - .index(".ds-timeseries-*") - ); diff --git a/specification/ilm/get_lifecycle/examples/request/IlmGetLifecycleExample1.yaml b/specification/ilm/get_lifecycle/examples/request/IlmGetLifecycleExample1.yaml index 3edcdf6b96..cebf89a7ab 100644 --- a/specification/ilm/get_lifecycle/examples/request/IlmGetLifecycleExample1.yaml +++ b/specification/ilm/get_lifecycle/examples/request/IlmGetLifecycleExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ilm().getLifecycle(g -> g - .name("my_policy") - ); diff --git a/specification/ilm/get_status/examples/request/IlmGetStatusExample1.yaml b/specification/ilm/get_status/examples/request/IlmGetStatusExample1.yaml index 1ac252a399..04047c6804 100644 --- a/specification/ilm/get_status/examples/request/IlmGetStatusExample1.yaml +++ b/specification/ilm/get_status/examples/request/IlmGetStatusExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.ilm().getStatus(); 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 ae0c5ca0af..73933ef884 100644 --- a/specification/ilm/migrate_to_data_tiers/examples/request/MigrateToDataTiersRequestExample1.yaml +++ b/specification/ilm/migrate_to_data_tiers/examples/request/MigrateToDataTiersRequestExample1.yaml @@ -10,43 +10,3 @@ 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"' - - language: Java - code: | - client.ilm().migrateToDataTiers(m -> m - .legacyTemplateToDelete("global-template") - .nodeAttribute("custom_attribute_name") - ); diff --git a/specification/ilm/move_to_step/examples/request/MoveToStepRequestExample1.yaml b/specification/ilm/move_to_step/examples/request/MoveToStepRequestExample1.yaml index c6e2d4a9dc..b45cfd721e 100644 --- a/specification/ilm/move_to_step/examples/request/MoveToStepRequestExample1.yaml +++ b/specification/ilm/move_to_step/examples/request/MoveToStepRequestExample1.yaml @@ -16,88 +16,3 @@ 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\"" - - language: Java - code: | - client.ilm().moveToStep(m -> m - .currentStep(c -> c - .action("complete") - .name("complete") - .phase("new") - ) - .index("my-index-000001") - .nextStep(n -> n - .action("forcemerge") - .name("forcemerge") - .phase("warm") - ) - ); diff --git a/specification/ilm/move_to_step/examples/request/MoveToStepRequestExample2.yaml b/specification/ilm/move_to_step/examples/request/MoveToStepRequestExample2.yaml index faee76fbf0..a2f6b5c1ab 100644 --- a/specification/ilm/move_to_step/examples/request/MoveToStepRequestExample2.yaml +++ b/specification/ilm/move_to_step/examples/request/MoveToStepRequestExample2.yaml @@ -14,78 +14,3 @@ 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"' - - language: Java - code: | - client.ilm().moveToStep(m -> m - .currentStep(c -> c - .action("complete") - .name("complete") - .phase("hot") - ) - .index("my-index-000001") - .nextStep(n -> n - .phase("warm") - ) - ); diff --git a/specification/ilm/put_lifecycle/examples/request/PutLifecycleRequestExample1.yaml b/specification/ilm/put_lifecycle/examples/request/PutLifecycleRequestExample1.yaml index 644db6fda3..b703c86d37 100644 --- a/specification/ilm/put_lifecycle/examples/request/PutLifecycleRequestExample1.yaml +++ b/specification/ilm/put_lifecycle/examples/request/PutLifecycleRequestExample1.yaml @@ -31,163 +31,3 @@ 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\"" - - language: Java - code: > - client.ilm().putLifecycle(p -> p - .name("my_policy") - .policy(po -> po - .phases(ph -> ph - .delete(d -> d - .actions(a -> a - .delete(de -> de) - ) - .minAge(m -> m - .time("30d") - ) - ) - .warm(w -> w - .actions(a -> a - .forcemerge(f -> f - .maxNumSegments(1) - ) - ) - .minAge(m -> m - .time("10d") - ) - ) - ) - .meta(Map.of("description", JsonData.fromJson("\"used for nginx log\""),"project", JsonData.fromJson("{\"name\":\"myProject\",\"department\":\"myDepartment\"}"))) - ) - ); diff --git a/specification/ilm/remove_policy/examples/request/IlmRemovePolicyExample1.yaml b/specification/ilm/remove_policy/examples/request/IlmRemovePolicyExample1.yaml index 0b11ffa213..360fb2c26e 100644 --- a/specification/ilm/remove_policy/examples/request/IlmRemovePolicyExample1.yaml +++ b/specification/ilm/remove_policy/examples/request/IlmRemovePolicyExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ilm().removePolicy(r -> r - .index("logs-my_app-default") - ); diff --git a/specification/ilm/retry/examples/request/IlmRetryExample1.yaml b/specification/ilm/retry/examples/request/IlmRetryExample1.yaml index 29d2f46f7f..103ab9f387 100644 --- a/specification/ilm/retry/examples/request/IlmRetryExample1.yaml +++ b/specification/ilm/retry/examples/request/IlmRetryExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ilm().retry(r -> r - .index("my-index-000001") - ); diff --git a/specification/ilm/start/examples/request/IlmStartExample1.yaml b/specification/ilm/start/examples/request/IlmStartExample1.yaml index 6d60168689..2a48463c8a 100644 --- a/specification/ilm/start/examples/request/IlmStartExample1.yaml +++ b/specification/ilm/start/examples/request/IlmStartExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.ilm().start(s -> s); diff --git a/specification/ilm/stop/examples/request/IlmStopExample1.yaml b/specification/ilm/stop/examples/request/IlmStopExample1.yaml index a6e9d761ea..b3476798bb 100644 --- a/specification/ilm/stop/examples/request/IlmStopExample1.yaml +++ b/specification/ilm/stop/examples/request/IlmStopExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.ilm().stop(s -> s); diff --git a/specification/indices/add_block/examples/request/IndicesAddBlockRequestExample1.yaml b/specification/indices/add_block/examples/request/IndicesAddBlockRequestExample1.yaml index 36d131f1c3..7cda8f1073 100644 --- a/specification/indices/add_block/examples/request/IndicesAddBlockRequestExample1.yaml +++ b/specification/indices/add_block/examples/request/IndicesAddBlockRequestExample1.yaml @@ -1,34 +1 @@ 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"' - - language: Java - code: | - client.indices().addBlock(a -> a - .block(IndicesBlockOptions.Write) - .index("my-index-000001") - ); diff --git a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample1.yaml b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample1.yaml index bce311aa10..c2fca2f8db 100644 --- a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample1.yaml +++ b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample1.yaml @@ -5,42 +5,3 @@ 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"' - - language: Java - code: | - client.indices().analyze(a -> a - .analyzer("standard") - .text("this is a test") - ); diff --git a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample2.yaml b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample2.yaml index ba3a163205..06a2afc3a7 100644 --- a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample2.yaml +++ b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample2.yaml @@ -7,51 +7,3 @@ 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"' - - language: Java - code: | - client.indices().analyze(a -> a - .analyzer("standard") - .text(List.of("this is a test","the second text")) - ); diff --git a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample3.yaml b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample3.yaml index f354394e81..1baa348d90 100644 --- a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample3.yaml +++ b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample3.yaml @@ -11,71 +11,3 @@ 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"' - - language: Java - code: | - client.indices().analyze(a -> a - .charFilter(c -> c - .name("html_strip") - ) - .filter(f -> f - .name("lowercase") - ) - .text("this is a test") - .tokenizer(t -> t - .name("keyword") - ) - ); diff --git a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample4.yaml b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample4.yaml index 12f0104485..ecbe8c8886 100644 --- a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample4.yaml +++ b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample4.yaml @@ -12,93 +12,3 @@ 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\"" - - language: Java - code: | - client.indices().analyze(a -> a - .filter(List.of(TokenFilter.of(t -> t - .name("lowercase" - )),TokenFilter.of(to -> to - .definition(d -> d - .stop(s -> s - .stopwords(List.of("a","is","this")) - ) - )))) - .text("this is a test") - .tokenizer(tok -> tok - .name("whitespace") - ) - ); diff --git a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample5.yaml b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample5.yaml index d07ecda06b..369f01379b 100644 --- a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample5.yaml +++ b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample5.yaml @@ -7,47 +7,3 @@ description: 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"' - - language: Java - code: | - client.indices().analyze(a -> a - .field("obj1.field1") - .index("analyze_sample") - .text("this is a test") - ); diff --git a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample6.yaml b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample6.yaml index 97b79a4021..496be085dc 100644 --- a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample6.yaml +++ b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample6.yaml @@ -7,47 +7,3 @@ description: 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"' - - language: Java - code: | - client.indices().analyze(a -> a - .index("analyze_sample") - .normalizer("my_normalizer") - .text("BaR") - ); diff --git a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample7.yaml b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample7.yaml index e84e9134f2..22230dedaa 100644 --- a/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample7.yaml +++ b/specification/indices/analyze/examples/request/indicesAnalyzeRequestExample7.yaml @@ -13,74 +13,3 @@ 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"' - - language: Java - code: | - client.indices().analyze(a -> a - .attributes("keyword") - .explain(true) - .filter(f -> f - .name("snowball") - ) - .text("detailed output") - .tokenizer(t -> t - .name("standard") - ) - ); diff --git a/specification/indices/cancel_migrate_reindex/examples/request/IndicesCancelMigrateReindexExample1.yaml b/specification/indices/cancel_migrate_reindex/examples/request/IndicesCancelMigrateReindexExample1.yaml index 82ff4ca99a..fa90c32d41 100644 --- a/specification/indices/cancel_migrate_reindex/examples/request/IndicesCancelMigrateReindexExample1.yaml +++ b/specification/indices/cancel_migrate_reindex/examples/request/IndicesCancelMigrateReindexExample1.yaml @@ -1,36 +1 @@ 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"' - - language: Java - code: | - client.indices().cancelMigrateReindex(c -> c - .index("my-data-stream") - ); diff --git a/specification/indices/clear_cache/examples/request/IndicesClearCacheExample1.yaml b/specification/indices/clear_cache/examples/request/IndicesClearCacheExample1.yaml index d89adee41d..6248e9eaea 100644 --- a/specification/indices/clear_cache/examples/request/IndicesClearCacheExample1.yaml +++ b/specification/indices/clear_cache/examples/request/IndicesClearCacheExample1.yaml @@ -1,35 +1 @@ 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"' - - language: Java - code: | - client.indices().clearCache(c -> c - .index(List.of("my-index-000001","my-index-000002")) - .request(true) - ); diff --git a/specification/indices/clone/examples/request/indicesCloneRequestExample1.yaml b/specification/indices/clone/examples/request/indicesCloneRequestExample1.yaml index dbc22b29cf..69aac20311 100644 --- a/specification/indices/clone/examples/request/indicesCloneRequestExample1.yaml +++ b/specification/indices/clone/examples/request/indicesCloneRequestExample1.yaml @@ -19,69 +19,3 @@ value: "{ \ } }" -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"' - - language: Java - code: | - client.indices().clone(c -> c - .aliases("my_search_indices", a -> a) - .index("my_source_index") - .settings("index.number_of_shards", JsonData.fromJson("5")) - .target("my_target_index") - ); diff --git a/specification/indices/close/examples/request/CloseIndexRequestExample1.yaml b/specification/indices/close/examples/request/CloseIndexRequestExample1.yaml index b5a6c3af96..aad5f50445 100644 --- a/specification/indices/close/examples/request/CloseIndexRequestExample1.yaml +++ b/specification/indices/close/examples/request/CloseIndexRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.indices().close(c -> c - .index("my-index-00001") - ); diff --git a/specification/indices/create/examples/request/indicesCreateRequestExample1.yaml b/specification/indices/create/examples/request/indicesCreateRequestExample1.yaml index daea57ccd7..e479499a52 100644 --- a/specification/indices/create/examples/request/indicesCreateRequestExample1.yaml +++ b/specification/indices/create/examples/request/indicesCreateRequestExample1.yaml @@ -13,57 +13,3 @@ value: "{ \ } }" -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"' - - language: Java - code: | - client.indices().create(c -> c - .index("my-index-000001") - .settings(s -> s - .numberOfShards("3") - .numberOfReplicas("2") - ) - ); diff --git a/specification/indices/create/examples/request/indicesCreateRequestExample2.yaml b/specification/indices/create/examples/request/indicesCreateRequestExample2.yaml index 685dafdca4..e8cd838108 100644 --- a/specification/indices/create/examples/request/indicesCreateRequestExample2.yaml +++ b/specification/indices/create/examples/request/indicesCreateRequestExample2.yaml @@ -21,86 +21,3 @@ value: "{ \ } }" -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"' - - language: Java - code: | - client.indices().create(c -> c - .index("test") - .mappings(m -> m - .properties("field1", p -> p - .text(t -> t) - ) - ) - .settings(s -> s - .numberOfShards("1") - ) - ); diff --git a/specification/indices/create/examples/request/indicesCreateRequestExample3.yaml b/specification/indices/create/examples/request/indicesCreateRequestExample3.yaml index a94e8e9f7d..3d588cf227 100644 --- a/specification/indices/create/examples/request/indicesCreateRequestExample3.yaml +++ b/specification/indices/create/examples/request/indicesCreateRequestExample3.yaml @@ -11,90 +11,3 @@ 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"' - - language: Java - code: | - client.indices().create(c -> c - .aliases(Map.of("alias_2", Alias.of(a -> a - .filter(f -> f - .term(t -> t - .field("user.id") - .value(FieldValue.of("kimchy")) - ) - ) - .routing("shard-1")),"alias_1", Alias.of(al -> al))) - .index("test") - ); diff --git a/specification/indices/create_data_stream/examples/request/IndicesCreateDataStreamExample1.yaml b/specification/indices/create_data_stream/examples/request/IndicesCreateDataStreamExample1.yaml index 362a407597..581ceabf98 100644 --- a/specification/indices/create_data_stream/examples/request/IndicesCreateDataStreamExample1.yaml +++ b/specification/indices/create_data_stream/examples/request/IndicesCreateDataStreamExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.indices().createDataStream(c -> c - .name("logs-foo-bar") - ); diff --git a/specification/indices/create_from/examples/request/IndicesCreateFromExample1.yaml b/specification/indices/create_from/examples/request/IndicesCreateFromExample1.yaml index 9c5b8594fd..b8785032b0 100644 --- a/specification/indices/create_from/examples/request/IndicesCreateFromExample1.yaml +++ b/specification/indices/create_from/examples/request/IndicesCreateFromExample1.yaml @@ -1,38 +1 @@ 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"' - - language: Java - code: | - client.indices().createFrom(c -> c - .dest("my-new-index") - .source("my-index") - .createFrom(cr -> cr) - ); diff --git a/specification/indices/data_streams_stats/examples/request/indicesDataStreamStatsExampleRequest1.yaml b/specification/indices/data_streams_stats/examples/request/indicesDataStreamStatsExampleRequest1.yaml index cfb4c81934..70600dc850 100644 --- a/specification/indices/data_streams_stats/examples/request/indicesDataStreamStatsExampleRequest1.yaml +++ b/specification/indices/data_streams_stats/examples/request/indicesDataStreamStatsExampleRequest1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.indices().dataStreamsStats(d -> d - .name("my-index-000001") - ); diff --git a/specification/indices/delete/examples/request/IndicesDeleteExample1.yaml b/specification/indices/delete/examples/request/IndicesDeleteExample1.yaml index 2efde91aea..10949f3df6 100644 --- a/specification/indices/delete/examples/request/IndicesDeleteExample1.yaml +++ b/specification/indices/delete/examples/request/IndicesDeleteExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.indices().delete(d -> d - .index("books") - ); diff --git a/specification/indices/delete_alias/examples/request/IndicesDeleteAliasExample1.yaml b/specification/indices/delete_alias/examples/request/IndicesDeleteAliasExample1.yaml index 324267982c..09bcefe59f 100644 --- a/specification/indices/delete_alias/examples/request/IndicesDeleteAliasExample1.yaml +++ b/specification/indices/delete_alias/examples/request/IndicesDeleteAliasExample1.yaml @@ -1,34 +1 @@ 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"' - - language: Java - code: | - client.indices().deleteAlias(d -> d - .index("my-data-stream") - .name("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 214e4d8f28..8674ec5b56 100644 --- a/specification/indices/delete_data_lifecycle/examples/request/IndicesDeleteDataLifecycleExample1.yaml +++ b/specification/indices/delete_data_lifecycle/examples/request/IndicesDeleteDataLifecycleExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.indices().deleteDataLifecycle(d -> d - .name("my-data-stream") - ); diff --git a/specification/indices/delete_data_stream/examples/request/IndicesDeleteDataStreamExample1.yaml b/specification/indices/delete_data_stream/examples/request/IndicesDeleteDataStreamExample1.yaml index 4f0ec82e65..67ee24ecc2 100644 --- a/specification/indices/delete_data_stream/examples/request/IndicesDeleteDataStreamExample1.yaml +++ b/specification/indices/delete_data_stream/examples/request/IndicesDeleteDataStreamExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.indices().deleteDataStream(d -> d - .name("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 06e38bf583..06c8075f21 100644 --- a/specification/indices/delete_index_template/examples/request/IndicesDeleteIndexTemplateExample1.yaml +++ b/specification/indices/delete_index_template/examples/request/IndicesDeleteIndexTemplateExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.indices().deleteIndexTemplate(d -> d - .name("my-index-template") - ); diff --git a/specification/indices/delete_template/examples/request/IndicesDeleteTemplateExample1.yaml b/specification/indices/delete_template/examples/request/IndicesDeleteTemplateExample1.yaml index 5c8c54e4c2..70d02b2038 100644 --- a/specification/indices/delete_template/examples/request/IndicesDeleteTemplateExample1.yaml +++ b/specification/indices/delete_template/examples/request/IndicesDeleteTemplateExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.indices().deleteTemplate(d -> d - .name(".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 ced06c4ac5..acfe6b7fc1 100644 --- a/specification/indices/disk_usage/examples/request/IndicesDiskUsageExample1.yaml +++ b/specification/indices/disk_usage/examples/request/IndicesDiskUsageExample1.yaml @@ -1,35 +1 @@ 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"' - - language: Java - code: | - client.indices().diskUsage(d -> d - .index("my-index-000001") - .runExpensiveTasks(true) - ); diff --git a/specification/indices/downsample/examples/request/DownsampleRequestExample1.yaml b/specification/indices/downsample/examples/request/DownsampleRequestExample1.yaml index 68faedbe78..dd2031ab8d 100644 --- a/specification/indices/downsample/examples/request/DownsampleRequestExample1.yaml +++ b/specification/indices/downsample/examples/request/DownsampleRequestExample1.yaml @@ -4,55 +4,3 @@ 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"' - - language: Java - code: | - client.indices().downsample(d -> d - .index("my-time-series-index") - .targetIndex("my-downsampled-time-series-index") - .config(c -> c - .fixedInterval(f -> f - .time("1d") - ) - ) - ); diff --git a/specification/indices/exists/examples/request/IndicesExistsExample1.yaml b/specification/indices/exists/examples/request/IndicesExistsExample1.yaml index 3057e6e4ef..9e86eecb0d 100644 --- a/specification/indices/exists/examples/request/IndicesExistsExample1.yaml +++ b/specification/indices/exists/examples/request/IndicesExistsExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.indices().exists(e -> e - .index("my-data-stream") - ); diff --git a/specification/indices/exists_alias/examples/request/IndicesExistsAliasExample1.yaml b/specification/indices/exists_alias/examples/request/IndicesExistsAliasExample1.yaml index 588a651b36..f12774b2bc 100644 --- a/specification/indices/exists_alias/examples/request/IndicesExistsAliasExample1.yaml +++ b/specification/indices/exists_alias/examples/request/IndicesExistsAliasExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.indices().existsAlias(e -> e - .name("my-alias") - ); diff --git a/specification/indices/exists_template/examples/request/IndicesExistsTemplateExample1.yaml b/specification/indices/exists_template/examples/request/IndicesExistsTemplateExample1.yaml index d6e6c4ec97..43c13cd1f2 100644 --- a/specification/indices/exists_template/examples/request/IndicesExistsTemplateExample1.yaml +++ b/specification/indices/exists_template/examples/request/IndicesExistsTemplateExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.indices().existsTemplate(e -> e - .name("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 70edef69ba..06607d1df9 100644 --- a/specification/indices/explain_data_lifecycle/examples/request/IndicesExplainDataLifecycleRequestExample1.yaml +++ b/specification/indices/explain_data_lifecycle/examples/request/IndicesExplainDataLifecycleRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.indices().explainDataLifecycle(e -> e - .index(".ds-metrics-2023.03.22-000001") - ); diff --git a/specification/indices/field_usage_stats/examples/request/indicesFieldUsageStatsRequestExample1.yaml b/specification/indices/field_usage_stats/examples/request/indicesFieldUsageStatsRequestExample1.yaml index c78280cf5d..d12dd51252 100644 --- a/specification/indices/field_usage_stats/examples/request/indicesFieldUsageStatsRequestExample1.yaml +++ b/specification/indices/field_usage_stats/examples/request/indicesFieldUsageStatsRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.indices().fieldUsageStats(f -> f - .index("my-index-000001") - ); diff --git a/specification/indices/flush/examples/request/IndicesFlushExample1.yaml b/specification/indices/flush/examples/request/IndicesFlushExample1.yaml index 940efa87b2..b468f6de6a 100644 --- a/specification/indices/flush/examples/request/IndicesFlushExample1.yaml +++ b/specification/indices/flush/examples/request/IndicesFlushExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.indices().flush(f -> f); diff --git a/specification/indices/forcemerge/examples/request/IndicesForcemergeExample1.yaml b/specification/indices/forcemerge/examples/request/IndicesForcemergeExample1.yaml index 71d8738284..e98db0f9f9 100644 --- a/specification/indices/forcemerge/examples/request/IndicesForcemergeExample1.yaml +++ b/specification/indices/forcemerge/examples/request/IndicesForcemergeExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.indices().forcemerge(f -> f - .index("my-index-000001") - ); diff --git a/specification/indices/get/examples/request/IndicesGetExample1.yaml b/specification/indices/get/examples/request/IndicesGetExample1.yaml index b8ba008109..c39e42ebae 100644 --- a/specification/indices/get/examples/request/IndicesGetExample1.yaml +++ b/specification/indices/get/examples/request/IndicesGetExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.indices().get(g -> g - .index("my-index-000001") - ); diff --git a/specification/indices/get_alias/examples/request/IndicesGetAliasExample1.yaml b/specification/indices/get_alias/examples/request/IndicesGetAliasExample1.yaml index 9cca21eb0a..b66ab2688d 100644 --- a/specification/indices/get_alias/examples/request/IndicesGetAliasExample1.yaml +++ b/specification/indices/get_alias/examples/request/IndicesGetAliasExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.indices().getAlias(g -> g); diff --git a/specification/indices/get_data_lifecycle/examples/request/IndicesGetDataLifecycleRequestExample1.yaml b/specification/indices/get_data_lifecycle/examples/request/IndicesGetDataLifecycleRequestExample1.yaml index 14e2e03e9b..042401e844 100644 --- a/specification/indices/get_data_lifecycle/examples/request/IndicesGetDataLifecycleRequestExample1.yaml +++ b/specification/indices/get_data_lifecycle/examples/request/IndicesGetDataLifecycleRequestExample1.yaml @@ -1,34 +1 @@ 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"' - - language: Java - code: "\n" 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 afda1ba46b..b88c7221f5 100644 --- a/specification/indices/get_data_lifecycle_stats/examples/request/IndicesGetDataLifecycleStatsRequestExample1.yaml +++ b/specification/indices/get_data_lifecycle_stats/examples/request/IndicesGetDataLifecycleStatsRequestExample1.yaml @@ -1,31 +1 @@ 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"' - - language: Java - code: | - client.indices().getDataLifecycleStats(); diff --git a/specification/indices/get_data_stream/examples/request/IndicesGetDataStreamExample1.yaml b/specification/indices/get_data_stream/examples/request/IndicesGetDataStreamExample1.yaml index b916d55d00..495dc0a360 100644 --- a/specification/indices/get_data_stream/examples/request/IndicesGetDataStreamExample1.yaml +++ b/specification/indices/get_data_stream/examples/request/IndicesGetDataStreamExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.indices().getDataStream(g -> g - .name("my-data-stream") - ); diff --git a/specification/indices/get_data_stream_settings/examples/request/IndicesGetDataStreamSettingsRequestExample1.yaml b/specification/indices/get_data_stream_settings/examples/request/IndicesGetDataStreamSettingsRequestExample1.yaml index dc73154c8f..851227fe07 100644 --- a/specification/indices/get_data_stream_settings/examples/request/IndicesGetDataStreamSettingsRequestExample1.yaml +++ b/specification/indices/get_data_stream_settings/examples/request/IndicesGetDataStreamSettingsRequestExample1.yaml @@ -1,24 +1 @@ method_request: GET /_data_stream/my-data-stream/_settings -alternatives: - - language: Python - code: |- - resp = client.indices.get_data_stream_settings( - name="my-data-stream", - ) - - language: JavaScript - code: |- - const response = await client.indices.getDataStreamSettings({ - name: "my-data-stream", - }); - - language: Ruby - code: |- - response = client.indices.get_data_stream_settings( - name: "my-data-stream" - ) - - language: PHP - code: |- - $resp = $client->indices()->getDataStreamSettings([ - "name" => "my-data-stream", - ]); - - language: curl - code: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_data_stream/my-data-stream/_settings"' diff --git a/specification/indices/get_field_mapping/examples/request/indicesGetFieldMappingRequestExample1.yaml b/specification/indices/get_field_mapping/examples/request/indicesGetFieldMappingRequestExample1.yaml index a32f9f8faa..0b53a8f71e 100644 --- a/specification/indices/get_field_mapping/examples/request/indicesGetFieldMappingRequestExample1.yaml +++ b/specification/indices/get_field_mapping/examples/request/indicesGetFieldMappingRequestExample1.yaml @@ -1,34 +1 @@ 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"' - - language: Java - code: | - client.indices().getFieldMapping(g -> g - .fields("title") - .index("publications") - ); diff --git a/specification/indices/get_index_template/examples/request/IndicesGetIndexTemplateExample1.yaml b/specification/indices/get_index_template/examples/request/IndicesGetIndexTemplateExample1.yaml index efa291e026..7da08c271e 100644 --- a/specification/indices/get_index_template/examples/request/IndicesGetIndexTemplateExample1.yaml +++ b/specification/indices/get_index_template/examples/request/IndicesGetIndexTemplateExample1.yaml @@ -1,33 +1,2 @@ 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"' - - language: Java - code: "\n" diff --git a/specification/indices/get_mapping/examples/request/IndicesGetMappingExample1.yaml b/specification/indices/get_mapping/examples/request/IndicesGetMappingExample1.yaml index 358862d9dd..11e3f68060 100644 --- a/specification/indices/get_mapping/examples/request/IndicesGetMappingExample1.yaml +++ b/specification/indices/get_mapping/examples/request/IndicesGetMappingExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.indices().getMapping(g -> g - .index("books") - ); 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 6448a60755..49dec01b92 100644 --- a/specification/indices/get_migrate_reindex_status/examples/request/IndicesGetMigrateReindexStatusExample1.yaml +++ b/specification/indices/get_migrate_reindex_status/examples/request/IndicesGetMigrateReindexStatusExample1.yaml @@ -1,36 +1 @@ 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"' - - language: Java - code: | - client.indices().getMigrateReindexStatus(g -> g - .index("my-data-stream") - ); diff --git a/specification/indices/get_settings/examples/request/IndicesGetSettingsExample1.yaml b/specification/indices/get_settings/examples/request/IndicesGetSettingsExample1.yaml index 3dcc2c10fd..758c778a74 100644 --- a/specification/indices/get_settings/examples/request/IndicesGetSettingsExample1.yaml +++ b/specification/indices/get_settings/examples/request/IndicesGetSettingsExample1.yaml @@ -1,33 +1 @@ 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 2c322ad186..56ea37d583 100644 --- a/specification/indices/get_template/examples/request/IndicesGetTemplateExample1.yaml +++ b/specification/indices/get_template/examples/request/IndicesGetTemplateExample1.yaml @@ -1,29 +1 @@ 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-*"' - - language: Java - code: | - client.indices().getTemplate(g -> g - .name(".monitoring-*") - ); diff --git a/specification/indices/migrate_reindex/examples/request/IndicesMigrateReindexExample1.yaml b/specification/indices/migrate_reindex/examples/request/IndicesMigrateReindexExample1.yaml index 7de2544472..348eb287e2 100644 --- a/specification/indices/migrate_reindex/examples/request/IndicesMigrateReindexExample1.yaml +++ b/specification/indices/migrate_reindex/examples/request/IndicesMigrateReindexExample1.yaml @@ -7,75 +7,3 @@ 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"' - - language: Java - code: | - client.indices().migrateReindex(m -> m - .reindex(r -> r - .mode(ModeEnum.Upgrade) - .source(s -> s - .index("my-data-stream") - ) - ) - ); 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 1a3c470182..27260c12a3 100644 --- a/specification/indices/migrate_to_data_stream/examples/request/IndicesMigrateToDataStreamExample1.yaml +++ b/specification/indices/migrate_to_data_stream/examples/request/IndicesMigrateToDataStreamExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.indices().migrateToDataStream(m -> m - .name("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 85ff71c813..d8778d8f14 100644 --- a/specification/indices/modify_data_stream/examples/request/IndicesModifyDataStreamExample1.yaml +++ b/specification/indices/modify_data_stream/examples/request/IndicesModifyDataStreamExample1.yaml @@ -17,99 +17,3 @@ 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\"" - - language: Java - code: | - client.indices().modifyDataStream(m -> m - .actions(List.of(Action.of(a -> a - .removeBackingIndex(r -> r - .dataStream("my-data-stream") - .index(".ds-my-data-stream-2023.07.26-000001") - )),Action.of(ac -> ac - .addBackingIndex(ad -> ad - .dataStream("my-data-stream") - .index(".ds-my-data-stream-2023.07.26-000001-downsample") - )))) - ); diff --git a/specification/indices/open/examples/request/IndicesOpenExample1.yaml b/specification/indices/open/examples/request/IndicesOpenExample1.yaml index 059e3e98d9..d201e97a27 100644 --- a/specification/indices/open/examples/request/IndicesOpenExample1.yaml +++ b/specification/indices/open/examples/request/IndicesOpenExample1.yaml @@ -1,29 +1 @@ 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/"' - - language: Java - code: | - client.indices().open(o -> o - .index(".ds-my-data-stream-2099.03.07-000001") - ); diff --git a/specification/indices/promote_data_stream/examples/request/IndicesPromoteDataStreamExample1.yaml b/specification/indices/promote_data_stream/examples/request/IndicesPromoteDataStreamExample1.yaml index bc45cf8e8c..dc8d38ea6c 100644 --- a/specification/indices/promote_data_stream/examples/request/IndicesPromoteDataStreamExample1.yaml +++ b/specification/indices/promote_data_stream/examples/request/IndicesPromoteDataStreamExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.indices().promoteDataStream(p -> p - .name("my-data-stream") - ); diff --git a/specification/indices/put_alias/examples/request/indicesPutAliasRequestExample1.yaml b/specification/indices/put_alias/examples/request/indicesPutAliasRequestExample1.yaml index 3f56492043..0fb6621d7c 100644 --- a/specification/indices/put_alias/examples/request/indicesPutAliasRequestExample1.yaml +++ b/specification/indices/put_alias/examples/request/indicesPutAliasRequestExample1.yaml @@ -21,70 +21,3 @@ value: "{ \ ] }" -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"' - - language: Java - code: | - client.indices().updateAliases(u -> u - .actions(a -> a - .add(ad -> ad - .alias("my-alias") - .index("my-data-stream") - ) - ) - ); diff --git a/specification/indices/put_data_lifecycle/examples/request/IndicesPutDataLifecycleRequestExample1.yaml b/specification/indices/put_data_lifecycle/examples/request/IndicesPutDataLifecycleRequestExample1.yaml index bafd45e7bf..19c498df7d 100644 --- a/specification/indices/put_data_lifecycle/examples/request/IndicesPutDataLifecycleRequestExample1.yaml +++ b/specification/indices/put_data_lifecycle/examples/request/IndicesPutDataLifecycleRequestExample1.yaml @@ -3,44 +3,3 @@ 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"' - - language: Java - code: | - client.indices().putDataLifecycle(p -> p - .dataRetention(d -> d - .time("7d") - ) - .name("my-data-stream") - ); diff --git a/specification/indices/put_data_lifecycle/examples/request/IndicesPutDataLifecycleRequestExample2.yaml b/specification/indices/put_data_lifecycle/examples/request/IndicesPutDataLifecycleRequestExample2.yaml index c3b5d682de..2eeba4ab5d 100644 --- a/specification/indices/put_data_lifecycle/examples/request/IndicesPutDataLifecycleRequestExample2.yaml +++ b/specification/indices/put_data_lifecycle/examples/request/IndicesPutDataLifecycleRequestExample2.yaml @@ -25,73 +25,3 @@ value: "{ \ ] }" -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_data_stream_settings/examples/request/IndicesPutDataStreamSettingsRequestExample1.yaml b/specification/indices/put_data_stream_settings/examples/request/IndicesPutDataStreamSettingsRequestExample1.yaml index c562b355b5..cb15d12db5 100644 --- a/specification/indices/put_data_stream_settings/examples/request/IndicesPutDataStreamSettingsRequestExample1.yaml +++ b/specification/indices/put_data_stream_settings/examples/request/IndicesPutDataStreamSettingsRequestExample1.yaml @@ -8,45 +8,3 @@ value: |- "index.lifecycle.name" : "new-test-policy", "index.number_of_shards": 11 } -alternatives: - - language: Python - code: |- - resp = client.indices.put_data_stream_settings( - name="my-data-stream", - settings={ - "index.lifecycle.name": "new-test-policy", - "index.number_of_shards": 11 - }, - ) - - language: JavaScript - code: |- - const response = await client.indices.putDataStreamSettings({ - name: "my-data-stream", - settings: { - "index.lifecycle.name": "new-test-policy", - "index.number_of_shards": 11, - }, - }); - - language: Ruby - code: |- - response = client.indices.put_data_stream_settings( - name: "my-data-stream", - body: { - "index.lifecycle.name": "new-test-policy", - "index.number_of_shards": 11 - } - ) - - language: PHP - code: |- - $resp = $client->indices()->putDataStreamSettings([ - "name" => "my-data-stream", - "body" => [ - "index.lifecycle.name" => "new-test-policy", - "index.number_of_shards" => 11, - ], - ]); - - language: curl - code: - 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d - ''{"index.lifecycle.name":"new-test-policy","index.number_of_shards":11}'' - "$ELASTICSEARCH_URL/_data_stream/my-data-stream/_settings"' diff --git a/specification/indices/put_index_template/examples/request/IndicesPutIndexTemplateRequestExample1.yaml b/specification/indices/put_index_template/examples/request/IndicesPutIndexTemplateRequestExample1.yaml index 8984b78c2d..6001213aa8 100644 --- a/specification/indices/put_index_template/examples/request/IndicesPutIndexTemplateRequestExample1.yaml +++ b/specification/indices/put_index_template/examples/request/IndicesPutIndexTemplateRequestExample1.yaml @@ -19,79 +19,3 @@ value: "{ \ } }" -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"' - - language: Java - code: | - client.indices().putIndexTemplate(p -> p - .indexPatterns("template*") - .name("template_1") - .priority(1L) - .template(t -> t - .settings(s -> s - .numberOfShards("2") - ) - ) - ); diff --git a/specification/indices/put_index_template/examples/request/IndicesPutIndexTemplateRequestExample2.yaml b/specification/indices/put_index_template/examples/request/IndicesPutIndexTemplateRequestExample2.yaml index c23468d3b8..74589b4026 100644 --- a/specification/indices/put_index_template/examples/request/IndicesPutIndexTemplateRequestExample2.yaml +++ b/specification/indices/put_index_template/examples/request/IndicesPutIndexTemplateRequestExample2.yaml @@ -18,131 +18,3 @@ 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\"" - - language: Java - code: | - client.indices().putIndexTemplate(p -> p - .indexPatterns("template*") - .name("template_1") - .template(t -> t - .aliases(Map.of("alias1", Alias.of(a -> a),"{index}-alias", Alias.of(a -> a),"alias2", Alias.of(a -> a - .filter(f -> f - .term(te -> te - .field("user.id") - .value(FieldValue.of("kimchy")) - ) - ) - .routing("shard-1")))) - .settings(s -> s - .numberOfShards("1") - ) - ) - ); diff --git a/specification/indices/put_mapping/examples/request/indicesPutMappingRequestExample1.yaml b/specification/indices/put_mapping/examples/request/indicesPutMappingRequestExample1.yaml index 1b239296ca..ca5fd1863f 100644 --- a/specification/indices/put_mapping/examples/request/indicesPutMappingRequestExample1.yaml +++ b/specification/indices/put_mapping/examples/request/indicesPutMappingRequestExample1.yaml @@ -11,81 +11,3 @@ 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"' - - language: Java - code: | - client.indices().putMapping(p -> p - .index("my-index-000001") - .properties("user", pr -> pr - .object(o -> o - .properties("name", pro -> pro - .keyword(k -> k) - ) - ) - ) - ); diff --git a/specification/indices/put_settings/examples/request/IndicesPutSettingsRequestExample1.yaml b/specification/indices/put_settings/examples/request/IndicesPutSettingsRequestExample1.yaml index 082ca28c1e..26e5716f40 100644 --- a/specification/indices/put_settings/examples/request/IndicesPutSettingsRequestExample1.yaml +++ b/specification/indices/put_settings/examples/request/IndicesPutSettingsRequestExample1.yaml @@ -11,58 +11,3 @@ value: "{ \ } }" -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"' - - language: Java - code: | - client.indices().putSettings(p -> p - .index("my-index-000001") - .settings(s -> s - .index(i -> i - .numberOfReplicas("2") - ) - ) - ); diff --git a/specification/indices/put_settings/examples/request/indicesPutSettingsRequestExample2.yaml b/specification/indices/put_settings/examples/request/indicesPutSettingsRequestExample2.yaml index d97da57d14..60eb2cf50b 100644 --- a/specification/indices/put_settings/examples/request/indicesPutSettingsRequestExample2.yaml +++ b/specification/indices/put_settings/examples/request/indicesPutSettingsRequestExample2.yaml @@ -11,48 +11,3 @@ value: "{ \ } }" -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 d4b59359ca..5932ae38a2 100644 --- a/specification/indices/put_settings/examples/request/indicesPutSettingsRequestExample3.yaml +++ b/specification/indices/put_settings/examples/request/indicesPutSettingsRequestExample3.yaml @@ -15,69 +15,3 @@ value: |- } } } -alternatives: - - language: Python - code: |- - resp = client.indices.put_settings( - index="my-index-000001", - settings={ - "analysis": { - "analyzer": { - "content": { - "type": "custom", - "tokenizer": "whitespace" - } - } - } - }, - ) - - language: JavaScript - code: |- - const response = await client.indices.putSettings({ - index: "my-index-000001", - settings: { - analysis: { - analyzer: { - content: { - type: "custom", - tokenizer: "whitespace", - }, - }, - }, - }, - }); - - language: Ruby - code: |- - response = client.indices.put_settings( - index: "my-index-000001", - body: { - "analysis": { - "analyzer": { - "content": { - "type": "custom", - "tokenizer": "whitespace" - } - } - } - } - ) - - language: PHP - code: |- - $resp = $client->indices()->putSettings([ - "index" => "my-index-000001", - "body" => [ - "analysis" => [ - "analyzer" => [ - "content" => [ - "type" => "custom", - "tokenizer" => "whitespace", - ], - ], - ], - ], - ]); - - language: curl - code: - 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d - ''{"analysis":{"analyzer":{"content":{"type":"custom","tokenizer":"whitespace"}}}}'' - "$ELASTICSEARCH_URL/my-index-000001/_settings"' diff --git a/specification/indices/put_template/examples/request/indicesPutTemplateRequestExample1.yaml b/specification/indices/put_template/examples/request/indicesPutTemplateRequestExample1.yaml index 1f62c97126..227c451388 100644 --- a/specification/indices/put_template/examples/request/indicesPutTemplateRequestExample1.yaml +++ b/specification/indices/put_template/examples/request/indicesPutTemplateRequestExample1.yaml @@ -17,129 +17,3 @@ 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\"" - - language: Java - code: | - client.indices().putTemplate(p -> p - .indexPatterns(List.of("te*","bar*")) - .mappings(m -> m - .source(s -> s - .enabled(false) - ) - ) - .name("template_1") - .settings(s -> s - .numberOfShards("1") - ) - ); diff --git a/specification/indices/put_template/examples/request/indicesPutTemplateRequestExample2.yaml b/specification/indices/put_template/examples/request/indicesPutTemplateRequestExample2.yaml index d94b4e4df4..6c474d894d 100644 --- a/specification/indices/put_template/examples/request/indicesPutTemplateRequestExample2.yaml +++ b/specification/indices/put_template/examples/request/indicesPutTemplateRequestExample2.yaml @@ -17,120 +17,3 @@ 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\"" - - language: Java - code: | - client.indices().putTemplate(p -> p - .aliases(Map.of("alias1", Alias.of(a -> a),"{index}-alias", Alias.of(a -> a),"alias2", Alias.of(a -> a - .filter(f -> f - .term(t -> t - .field("user.id") - .value(FieldValue.of("kimchy")) - ) - ) - .routing("shard-1")))) - .indexPatterns("te*") - .name("template_1") - .settings(s -> s - .numberOfShards("1") - ) - ); diff --git a/specification/indices/recovery/examples/request/indicesRecoveryRequestExample1.yaml b/specification/indices/recovery/examples/request/indicesRecoveryRequestExample1.yaml index 65a02b3976..f615441005 100644 --- a/specification/indices/recovery/examples/request/indicesRecoveryRequestExample1.yaml +++ b/specification/indices/recovery/examples/request/indicesRecoveryRequestExample1.yaml @@ -1,26 +1 @@ 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"' - - language: Java - code: "\n" diff --git a/specification/indices/refresh/examples/request/IndicesRefreshExample1.yaml b/specification/indices/refresh/examples/request/IndicesRefreshExample1.yaml index 6bf8e51e55..6a13bc240a 100644 --- a/specification/indices/refresh/examples/request/IndicesRefreshExample1.yaml +++ b/specification/indices/refresh/examples/request/IndicesRefreshExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.indices().refresh(r -> r); diff --git a/specification/indices/reload_search_analyzers/examples/request/ReloadSearchAnalyzersRequestExample1.yaml b/specification/indices/reload_search_analyzers/examples/request/ReloadSearchAnalyzersRequestExample1.yaml index 5221f4b7de..0c9fb35bf3 100644 --- a/specification/indices/reload_search_analyzers/examples/request/ReloadSearchAnalyzersRequestExample1.yaml +++ b/specification/indices/reload_search_analyzers/examples/request/ReloadSearchAnalyzersRequestExample1.yaml @@ -13,66 +13,3 @@ 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/remove_block/examples/request/IndicesRemoveBlockRequestExample1.yaml b/specification/indices/remove_block/examples/request/IndicesRemoveBlockRequestExample1.yaml index d68070eadd..84ce6ae400 100644 --- a/specification/indices/remove_block/examples/request/IndicesRemoveBlockRequestExample1.yaml +++ b/specification/indices/remove_block/examples/request/IndicesRemoveBlockRequestExample1.yaml @@ -1,34 +1 @@ method_request: DELETE /my-index-000001/_block/write -alternatives: - - language: Python - code: |- - resp = client.indices.remove_block( - index="my-index-000001", - block="write", - ) - - language: JavaScript - code: |- - const response = await client.indices.removeBlock({ - index: "my-index-000001", - block: "write", - }); - - language: Ruby - code: |- - response = client.indices.remove_block( - index: "my-index-000001", - block: "write" - ) - - language: PHP - code: |- - $resp = $client->indices()->removeBlock([ - "index" => "my-index-000001", - "block" => "write", - ]); - - language: curl - code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index-000001/_block/write"' - - language: Java - code: | - client.indices().removeBlock(a -> a - .block(IndicesBlockOptions.Write) - .index("my-index-000001") - ); diff --git a/specification/indices/resolve_cluster/examples/request/ResolveClusterRequestExample2.yaml b/specification/indices/resolve_cluster/examples/request/ResolveClusterRequestExample2.yaml index cc59dab2b7..510c17feda 100644 --- a/specification/indices/resolve_cluster/examples/request/ResolveClusterRequestExample2.yaml +++ b/specification/indices/resolve_cluster/examples/request/ResolveClusterRequestExample2.yaml @@ -1,42 +1 @@ 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"' - - language: Java - code: | - client.indices().resolveCluster(r -> r - .ignoreUnavailable(false) - .name(List.of("not-present","clust*:my-index*","oldcluster:*")) - .timeout(t -> t - .offset(5) - ) - ); diff --git a/specification/indices/resolve_index/examples/request/ResolveIndexRequestExample1.yaml b/specification/indices/resolve_index/examples/request/ResolveIndexRequestExample1.yaml index 146550944a..1e0f7249b7 100644 --- a/specification/indices/resolve_index/examples/request/ResolveIndexRequestExample1.yaml +++ b/specification/indices/resolve_index/examples/request/ResolveIndexRequestExample1.yaml @@ -1,29 +1 @@ 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 33cdf9e178..2c639926b2 100644 --- a/specification/indices/rollover/examples/request/indicesRolloverRequestExample1.yaml +++ b/specification/indices/rollover/examples/request/indicesRolloverRequestExample1.yaml @@ -17,70 +17,3 @@ value: "{ \ } }" -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\"" - - language: Java - code: | - client.indices().rollover(r -> r - .alias("my-data-stream") - .conditions(c -> c - .maxAge(m -> m - .time("7d") - ) - .maxDocs(1000L) - .maxPrimaryShardSize("50gb") - .maxPrimaryShardDocs(2000L) - ) - ); diff --git a/specification/indices/segments/examples/request/IndicesSegmentsExample1.yaml b/specification/indices/segments/examples/request/IndicesSegmentsExample1.yaml index e5db498865..9e791d430d 100644 --- a/specification/indices/segments/examples/request/IndicesSegmentsExample1.yaml +++ b/specification/indices/segments/examples/request/IndicesSegmentsExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.indices().segments(s -> s - .index("my-index-000001") - ); diff --git a/specification/indices/shard_stores/examples/request/indicesShardStoresRequestExample1.yaml b/specification/indices/shard_stores/examples/request/indicesShardStoresRequestExample1.yaml index 700f9a8c25..7a44a1977f 100644 --- a/specification/indices/shard_stores/examples/request/indicesShardStoresRequestExample1.yaml +++ b/specification/indices/shard_stores/examples/request/indicesShardStoresRequestExample1.yaml @@ -1,24 +1 @@ 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 dfe39fe6c3..8d07911972 100644 --- a/specification/indices/shrink/examples/request/indicesShrinkRequestExample1.yaml +++ b/specification/indices/shrink/examples/request/indicesShrinkRequestExample1.yaml @@ -13,60 +13,3 @@ value: "{ \ } }" -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"' - - language: Java - code: > - client.indices().shrink(s -> s - .index("my_source_index") - .settings(Map.of("index.blocks.write", JsonData.fromJson("null"),"index.routing.allocation.require._name", JsonData.fromJson("null"))) - .target("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 3fa8a53a8f..4f244ee05b 100644 --- a/specification/indices/simulate_index_template/examples/request/indicesSimulateIndexTemplateRequestExample1.yaml +++ b/specification/indices/simulate_index_template/examples/request/indicesSimulateIndexTemplateRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.indices().simulateIndexTemplate(s -> s - .name("my-index-000001") - ); diff --git a/specification/indices/simulate_template/examples/request/indicesSimulateTemplateRequestExample1.yaml b/specification/indices/simulate_template/examples/request/indicesSimulateTemplateRequestExample1.yaml index ac154b1942..65784c41f3 100644 --- a/specification/indices/simulate_template/examples/request/indicesSimulateTemplateRequestExample1.yaml +++ b/specification/indices/simulate_template/examples/request/indicesSimulateTemplateRequestExample1.yaml @@ -23,85 +23,3 @@ value: "{ \ } }" -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\"" - - language: Java - code: | - client.indices().simulateTemplate(s -> s - .composedOf("ct2") - .indexPatterns("my-index-*") - .priority(10L) - .template(t -> t - .settings(se -> se - .otherSettings("index.number_of_replicas", JsonData.fromJson("1")) - ) - ) - ); diff --git a/specification/indices/split/examples/request/indicesSplitRequestExample1.yaml b/specification/indices/split/examples/request/indicesSplitRequestExample1.yaml index 61d97c6294..9689f1b5cc 100644 --- a/specification/indices/split/examples/request/indicesSplitRequestExample1.yaml +++ b/specification/indices/split/examples/request/indicesSplitRequestExample1.yaml @@ -11,55 +11,3 @@ value: "{ \ } }" -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"' - - language: Java - code: | - client.indices().split(s -> s - .index("my-index-000001") - .settings("index.number_of_shards", JsonData.fromJson("2")) - .target("split-my-index-000001") - ); diff --git a/specification/indices/stats/examples/request/IndicesStatsExample1.yaml b/specification/indices/stats/examples/request/IndicesStatsExample1.yaml index f76ab1df78..da2206189b 100644 --- a/specification/indices/stats/examples/request/IndicesStatsExample1.yaml +++ b/specification/indices/stats/examples/request/IndicesStatsExample1.yaml @@ -1,35 +1 @@ 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"' - - language: Java - code: "\n" diff --git a/specification/indices/update_aliases/examples/request/IndicesUpdateAliasesExample1.yaml b/specification/indices/update_aliases/examples/request/IndicesUpdateAliasesExample1.yaml index c559e5c57b..05f25dd467 100644 --- a/specification/indices/update_aliases/examples/request/IndicesUpdateAliasesExample1.yaml +++ b/specification/indices/update_aliases/examples/request/IndicesUpdateAliasesExample1.yaml @@ -11,70 +11,3 @@ 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"' - - language: Java - code: | - client.indices().updateAliases(u -> u - .actions(a -> a - .add(ad -> ad - .alias("logs") - .index("logs-nginx.access-prod") - ) - ) - ); diff --git a/specification/indices/validate_query/examples/request/IndicesValidateQueryExample1.yaml b/specification/indices/validate_query/examples/request/IndicesValidateQueryExample1.yaml index 5a543b84ea..54accf2b70 100644 --- a/specification/indices/validate_query/examples/request/IndicesValidateQueryExample1.yaml +++ b/specification/indices/validate_query/examples/request/IndicesValidateQueryExample1.yaml @@ -1,34 +1 @@ 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"' - - language: Java - code: | - client.indices().validateQuery(v -> v - .index("my-index-000001") - .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 a123173746..a7261b2f4a 100644 --- a/specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample1.yaml +++ b/specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample1.yaml @@ -14,79 +14,3 @@ 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"' - - language: Java - code: | - client.inference().chatCompletionUnified(c -> c - .inferenceId("openai-completion") - .chatCompletionRequest(ch -> ch - .messages(m -> m - .content(co -> co - .string("What is Elastic?") - ) - .role("user") - ) - .model("gpt-4o") - ) - ); diff --git a/specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample2.yaml b/specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample2.yaml index 2f2fe48817..c41702003e 100644 --- a/specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample2.yaml +++ b/specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample2.yaml @@ -28,149 +28,3 @@ 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\"" - - language: Java - code: | - client.inference().chatCompletionUnified(c -> c - .inferenceId("openai-completion") - .chatCompletionRequest(ch -> ch - .messages(List.of(Message.of(m -> m - .content(co -> co - .string("Let's find out what the weather is") - ) - .role("assistant") - .toolCalls(t -> t - .id("call_KcAjWtAww20AihPHphUh46Gd") - .function(f -> f - .arguments("{\"location\":\"Boston, MA\"}") - .name("get_current_weather") - ) - .type("function") - )),Message.of(me -> me - .content(co -> co - .string("The weather is cold") - ) - .role("tool") - .toolCallId("call_KcAjWtAww20AihPHphUh46Gd")))) - ) - ); diff --git a/specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample3.yaml b/specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample3.yaml index 67aa38cd50..6e429ddd75 100644 --- a/specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample3.yaml +++ b/specification/inference/chat_completion_unified/examples/request/PostChatCompletionRequestExample3.yaml @@ -41,206 +41,3 @@ 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\"" - - language: Java - code: | - client.inference().chatCompletionUnified(c -> c - .inferenceId("openai-completion") - .chatCompletionRequest(ch -> ch - .messages(m -> m - .content(co -> co - .string("What's the price of a scarf?") - ) - .role("user") - ) - .toolChoice(t -> t - .object(o -> o - .type("function") - .function(f -> f - .name("get_current_price") - ) - ) - ) - .tools(to -> to - .type("function") - .function(f -> f - .description("Get the current price of a item") - .name("get_current_price") - .parameters(JsonData.fromJson("{\"type\":\"object\",\"properties\":{\"item\":{\"id\":\"123\"}}}")) - ) - ) - ) - ); diff --git a/specification/inference/completion/examples/request/CompletionRequestExample1.yaml b/specification/inference/completion/examples/request/CompletionRequestExample1.yaml index 2b001f3cb3..ac5dd76499 100644 --- a/specification/inference/completion/examples/request/CompletionRequestExample1.yaml +++ b/specification/inference/completion/examples/request/CompletionRequestExample1.yaml @@ -6,42 +6,3 @@ 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"' - - language: Java - code: | - client.inference().completion(c -> c - .inferenceId("openai_chat_completions") - .input("What is Elastic?") - ); diff --git a/specification/inference/delete/examples/request/InferenceDeleteExample1.yaml b/specification/inference/delete/examples/request/InferenceDeleteExample1.yaml index d564f5d781..862899b533 100644 --- a/specification/inference/delete/examples/request/InferenceDeleteExample1.yaml +++ b/specification/inference/delete/examples/request/InferenceDeleteExample1.yaml @@ -1,34 +1 @@ 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"' - - language: Java - code: | - client.inference().delete(d -> d - .inferenceId("my-elser-model") - .taskType(TaskType.SparseEmbedding) - ); diff --git a/specification/inference/get/examples/request/InferenceGetExample1.yaml b/specification/inference/get/examples/request/InferenceGetExample1.yaml index 119fddbce6..de31182d50 100644 --- a/specification/inference/get/examples/request/InferenceGetExample1.yaml +++ b/specification/inference/get/examples/request/InferenceGetExample1.yaml @@ -1,34 +1 @@ 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"' - - language: Java - code: | - client.inference().get(g -> g - .inferenceId("my-elser-model") - .taskType(TaskType.SparseEmbedding) - ); diff --git a/specification/inference/put/examples/request/InferencePutExample1.yaml b/specification/inference/put/examples/request/InferencePutExample1.yaml index 5b6236368e..c83f09194e 100644 --- a/specification/inference/put/examples/request/InferencePutExample1.yaml +++ b/specification/inference/put/examples/request/InferencePutExample1.yaml @@ -8,71 +8,3 @@ 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"' - - language: Java - code: | - client.inference().put(p -> p - .inferenceId("my-rerank-model") - .taskType(TaskType.Rerank) - .inferenceConfig(i -> i - .service("cohere") - .serviceSettings(JsonData.fromJson("{\"model_id\":\"rerank-english-v3.0\",\"api_key\":\"{{COHERE_API_KEY}}\"}")) - ) - ); diff --git a/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample1.yaml b/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample1.yaml index 5685eae079..4017d885b7 100644 --- a/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample1.yaml +++ b/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample1.yaml @@ -12,80 +12,3 @@ 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\"" - - language: Java - code: > - client.inference().put(p -> p - .inferenceId("alibabacloud_ai_search_completion") - .taskType(TaskType.Completion) - .inferenceConfig(i -> i - .service("alibabacloud-ai-search") - .serviceSettings(JsonData.fromJson("{\"host\":\"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\"api_key\":\"AlibabaCloud-API-Key\",\"service_id\":\"ops-qwen-turbo\",\"workspace\":\"default\"}")) - ) - ); diff --git a/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample2.yaml b/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample2.yaml index 583471ff3c..d18f3f263c 100644 --- a/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample2.yaml +++ b/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample2.yaml @@ -12,80 +12,3 @@ 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\"" - - language: Java - code: > - client.inference().put(p -> p - .inferenceId("alibabacloud_ai_search_rerank") - .taskType(TaskType.Rerank) - .inferenceConfig(i -> i - .service("alibabacloud-ai-search") - .serviceSettings(JsonData.fromJson("{\"api_key\":\"AlibabaCloud-API-Key\",\"service_id\":\"ops-bge-reranker-larger\",\"host\":\"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\"workspace\":\"default\"}")) - ) - ); diff --git a/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample3.yaml b/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample3.yaml index 8a1d027bb5..9a19ef8fa1 100644 --- a/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample3.yaml +++ b/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample3.yaml @@ -14,80 +14,3 @@ 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\"" - - language: Java - code: > - client.inference().put(p -> p - .inferenceId("alibabacloud_ai_search_sparse") - .taskType(TaskType.SparseEmbedding) - .inferenceConfig(i -> i - .service("alibabacloud-ai-search") - .serviceSettings(JsonData.fromJson("{\"api_key\":\"AlibabaCloud-API-Key\",\"service_id\":\"ops-text-sparse-embedding-001\",\"host\":\"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\"workspace\":\"default\"}")) - ) - ); diff --git a/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample4.yaml b/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample4.yaml index c0ee46957e..9e8710a7c7 100644 --- a/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample4.yaml +++ b/specification/inference/put_alibabacloud/examples/request/PutAlibabaCloudRequestExample4.yaml @@ -14,80 +14,3 @@ 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\"" - - language: Java - code: > - client.inference().put(p -> p - .inferenceId("alibabacloud_ai_search_embeddings") - .taskType(TaskType.TextEmbedding) - .inferenceConfig(i -> i - .service("alibabacloud-ai-search") - .serviceSettings(JsonData.fromJson("{\"api_key\":\"AlibabaCloud-API-Key\",\"service_id\":\"ops-text-embedding-001\",\"host\":\"default-j01.platform-cn-shanghai.opensearch.aliyuncs.com\",\"workspace\":\"default\"}")) - ) - ); diff --git a/specification/inference/put_amazonbedrock/examples/request/PutAmazonBedrockRequestExample1.yaml b/specification/inference/put_amazonbedrock/examples/request/PutAmazonBedrockRequestExample1.yaml index 6a335421df..ee1b144b94 100644 --- a/specification/inference/put_amazonbedrock/examples/request/PutAmazonBedrockRequestExample1.yaml +++ b/specification/inference/put_amazonbedrock/examples/request/PutAmazonBedrockRequestExample1.yaml @@ -13,84 +13,3 @@ 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\"" - - language: Java - code: > - client.inference().put(p -> p - .inferenceId("amazon_bedrock_embeddings") - .taskType(TaskType.TextEmbedding) - .inferenceConfig(i -> i - .service("amazonbedrock") - .serviceSettings(JsonData.fromJson("{\"access_key\":\"AWS-access-key\",\"secret_key\":\"AWS-secret-key\",\"region\":\"us-east-1\",\"provider\":\"amazontitan\",\"model\":\"amazon.titan-embed-text-v2:0\"}")) - ) - ); diff --git a/specification/inference/put_amazonbedrock/examples/request/PutAmazonBedrockRequestExample2.yaml b/specification/inference/put_amazonbedrock/examples/request/PutAmazonBedrockRequestExample2.yaml index 75cc653d9d..336aa336c4 100644 --- a/specification/inference/put_amazonbedrock/examples/request/PutAmazonBedrockRequestExample2.yaml +++ b/specification/inference/put_amazonbedrock/examples/request/PutAmazonBedrockRequestExample2.yaml @@ -10,71 +10,3 @@ 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"' - - language: Java - code: | - client.inference().put(p -> p - .inferenceId("openai-completion") - .taskType(TaskType.Completion) - .inferenceConfig(i -> i - .service("openai") - .serviceSettings(JsonData.fromJson("{\"api_key\":\"OpenAI-API-Key\",\"model_id\":\"gpt-3.5-turbo\"}")) - ) - ); diff --git a/specification/inference/put_anthropic/examples/request/PutAnthropicRequestExample1.yaml b/specification/inference/put_anthropic/examples/request/PutAnthropicRequestExample1.yaml index c043af4ba3..a5dad49066 100644 --- a/specification/inference/put_anthropic/examples/request/PutAnthropicRequestExample1.yaml +++ b/specification/inference/put_anthropic/examples/request/PutAnthropicRequestExample1.yaml @@ -13,84 +13,3 @@ 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\"" - - language: Java - code: | - client.inference().put(p -> p - .inferenceId("anthropic_completion") - .taskType(TaskType.Completion) - .inferenceConfig(i -> i - .service("anthropic") - .serviceSettings(JsonData.fromJson("{\"api_key\":\"Anthropic-Api-Key\",\"model_id\":\"Model-ID\"}")) - .taskSettings(JsonData.fromJson("{\"max_tokens\":1024}")) - ) - ); diff --git a/specification/inference/put_azureaistudio/examples/request/PutAzureAiStudioRequestExample1.yaml b/specification/inference/put_azureaistudio/examples/request/PutAzureAiStudioRequestExample1.yaml index 699cee5878..b5e10fbe70 100644 --- a/specification/inference/put_azureaistudio/examples/request/PutAzureAiStudioRequestExample1.yaml +++ b/specification/inference/put_azureaistudio/examples/request/PutAzureAiStudioRequestExample1.yaml @@ -14,79 +14,3 @@ 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\"" - - language: Java - code: > - client.inference().put(p -> p - .inferenceId("azure_ai_studio_embeddings") - .taskType(TaskType.TextEmbedding) - .inferenceConfig(i -> i - .service("azureaistudio") - .serviceSettings(JsonData.fromJson("{\"api_key\":\"Azure-AI-Studio-API-key\",\"target\":\"Target-Uri\",\"provider\":\"openai\",\"endpoint_type\":\"token\"}")) - ) - ); diff --git a/specification/inference/put_azureaistudio/examples/request/PutAzureAiStudioRequestExample2.yaml b/specification/inference/put_azureaistudio/examples/request/PutAzureAiStudioRequestExample2.yaml index 73720b0f3c..a76c643459 100644 --- a/specification/inference/put_azureaistudio/examples/request/PutAzureAiStudioRequestExample2.yaml +++ b/specification/inference/put_azureaistudio/examples/request/PutAzureAiStudioRequestExample2.yaml @@ -12,80 +12,3 @@ 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\"" - - language: Java - code: > - client.inference().put(p -> p - .inferenceId("azure_ai_studio_completion") - .taskType(TaskType.Completion) - .inferenceConfig(i -> i - .service("azureaistudio") - .serviceSettings(JsonData.fromJson("{\"api_key\":\"Azure-AI-Studio-API-key\",\"target\":\"Target-URI\",\"provider\":\"databricks\",\"endpoint_type\":\"realtime\"}")) - ) - ); diff --git a/specification/inference/put_azureopenai/examples/request/PutAzureOpenAiRequestExample1.yaml b/specification/inference/put_azureopenai/examples/request/PutAzureOpenAiRequestExample1.yaml index 6392cc20cf..fd1f0dcad2 100644 --- a/specification/inference/put_azureopenai/examples/request/PutAzureOpenAiRequestExample1.yaml +++ b/specification/inference/put_azureopenai/examples/request/PutAzureOpenAiRequestExample1.yaml @@ -14,80 +14,3 @@ 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\"" - - language: Java - code: > - client.inference().put(p -> p - .inferenceId("azure_openai_embeddings") - .taskType(TaskType.TextEmbedding) - .inferenceConfig(i -> i - .service("azureopenai") - .serviceSettings(JsonData.fromJson("{\"api_key\":\"Api-Key\",\"resource_name\":\"Resource-name\",\"deployment_id\":\"Deployment-id\",\"api_version\":\"2024-02-01\"}")) - ) - ); diff --git a/specification/inference/put_azureopenai/examples/request/PutAzureOpenAiRequestExample2.yaml b/specification/inference/put_azureopenai/examples/request/PutAzureOpenAiRequestExample2.yaml index 48e09cff9c..552769a778 100644 --- a/specification/inference/put_azureopenai/examples/request/PutAzureOpenAiRequestExample2.yaml +++ b/specification/inference/put_azureopenai/examples/request/PutAzureOpenAiRequestExample2.yaml @@ -12,79 +12,3 @@ 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\"" - - language: Java - code: > - client.inference().put(p -> p - .inferenceId("azure_openai_completion") - .taskType(TaskType.Completion) - .inferenceConfig(i -> i - .service("azureopenai") - .serviceSettings(JsonData.fromJson("{\"api_key\":\"Api-Key\",\"resource_name\":\"Resource-name\",\"deployment_id\":\"Deployment-id\",\"api_version\":\"2024-02-01\"}")) - ) - ); diff --git a/specification/inference/put_cohere/examples/request/PutCohereRequestExample1.yaml b/specification/inference/put_cohere/examples/request/PutCohereRequestExample1.yaml index 7a63fdf6e0..354199916e 100644 --- a/specification/inference/put_cohere/examples/request/PutCohereRequestExample1.yaml +++ b/specification/inference/put_cohere/examples/request/PutCohereRequestExample1.yaml @@ -11,75 +11,3 @@ 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\"" - - language: Java - code: > - client.inference().put(p -> p - .inferenceId("cohere-embeddings") - .taskType(TaskType.TextEmbedding) - .inferenceConfig(i -> i - .service("cohere") - .serviceSettings(JsonData.fromJson("{\"api_key\":\"Cohere-Api-key\",\"model_id\":\"embed-english-light-v3.0\",\"embedding_type\":\"byte\"}")) - ) - ); diff --git a/specification/inference/put_cohere/examples/request/PutCohereRequestExample2.yaml b/specification/inference/put_cohere/examples/request/PutCohereRequestExample2.yaml index 0c7368cb88..85d67c6525 100644 --- a/specification/inference/put_cohere/examples/request/PutCohereRequestExample2.yaml +++ b/specification/inference/put_cohere/examples/request/PutCohereRequestExample2.yaml @@ -14,88 +14,3 @@ 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\"" - - language: Java - code: | - client.inference().put(p -> p - .inferenceId("cohere-rerank") - .taskType(TaskType.Rerank) - .inferenceConfig(i -> i - .service("cohere") - .serviceSettings(JsonData.fromJson("{\"api_key\":\"Cohere-API-key\",\"model_id\":\"rerank-english-v3.0\"}")) - .taskSettings(JsonData.fromJson("{\"top_n\":10,\"return_documents\":true}")) - ) - ); diff --git a/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample1.yaml b/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample1.yaml index 27f182e68b..c7e98c5e4d 100644 --- a/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample1.yaml +++ b/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample1.yaml @@ -18,92 +18,3 @@ 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\"" - - language: Java - code: > - client.inference().put(p -> p - .inferenceId("my-elser-model") - .taskType(TaskType.SparseEmbedding) - .inferenceConfig(i -> i - .service("elasticsearch") - .serviceSettings(JsonData.fromJson("{\"adaptive_allocations\":{\"enabled\":true,\"min_number_of_allocations\":1,\"max_number_of_allocations\":4},\"num_threads\":1,\"model_id\":\".elser_model_2\"}")) - ) - ); diff --git a/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample2.yaml b/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample2.yaml index ecf4f0933e..c6e9f656dc 100644 --- a/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample2.yaml +++ b/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample2.yaml @@ -19,92 +19,3 @@ 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\"" - - language: Java - code: > - client.inference().put(p -> p - .inferenceId("my-elastic-rerank") - .taskType(TaskType.Rerank) - .inferenceConfig(i -> i - .service("elasticsearch") - .serviceSettings(JsonData.fromJson("{\"model_id\":\".rerank-v1\",\"num_threads\":1,\"adaptive_allocations\":{\"enabled\":true,\"min_number_of_allocations\":1,\"max_number_of_allocations\":4}}")) - ) - ); diff --git a/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample3.yaml b/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample3.yaml index ebd2646814..f89dbb1c2a 100644 --- a/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample3.yaml +++ b/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample3.yaml @@ -14,75 +14,3 @@ 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\"" - - language: Java - code: > - client.inference().put(p -> p - .inferenceId("my-e5-model") - .taskType(TaskType.TextEmbedding) - .inferenceConfig(i -> i - .service("elasticsearch") - .serviceSettings(JsonData.fromJson("{\"num_allocations\":1,\"num_threads\":1,\"model_id\":\".multilingual-e5-small\"}")) - ) - ); diff --git a/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample4.yaml b/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample4.yaml index 1a8b93bcff..c8aee77c08 100644 --- a/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample4.yaml +++ b/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample4.yaml @@ -13,75 +13,3 @@ 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\"" - - language: Java - code: > - client.inference().put(p -> p - .inferenceId("my-msmarco-minilm-model") - .taskType(TaskType.TextEmbedding) - .inferenceConfig(i -> i - .service("elasticsearch") - .serviceSettings(JsonData.fromJson("{\"num_allocations\":1,\"num_threads\":1,\"model_id\":\"msmarco-MiniLM-L12-cos-v5\"}")) - ) - ); diff --git a/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample5.yaml b/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample5.yaml index d1cae4c160..7c80117d4c 100644 --- a/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample5.yaml +++ b/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample5.yaml @@ -18,92 +18,3 @@ 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\"" - - language: Java - code: > - client.inference().put(p -> p - .inferenceId("my-e5-model") - .taskType(TaskType.TextEmbedding) - .inferenceConfig(i -> i - .service("elasticsearch") - .serviceSettings(JsonData.fromJson("{\"adaptive_allocations\":{\"enabled\":true,\"min_number_of_allocations\":3,\"max_number_of_allocations\":10},\"num_threads\":1,\"model_id\":\".multilingual-e5-small\"}")) - ) - ); diff --git a/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample6.yaml b/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample6.yaml index 6b0f9e515d..a13f5ee178 100644 --- a/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample6.yaml +++ b/specification/inference/put_elasticsearch/examples/request/PutElasticsearchRequestExample6.yaml @@ -11,67 +11,3 @@ 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"' - - language: Java - code: | - client.inference().put(p -> p - .inferenceId("use_existing_deployment") - .taskType(TaskType.SparseEmbedding) - .inferenceConfig(i -> i - .service("elasticsearch") - .serviceSettings(JsonData.fromJson("{\"deployment_id\":\".elser_model_2\"}")) - ) - ); diff --git a/specification/inference/put_elser/examples/request/PutElserRequestExample1.yaml b/specification/inference/put_elser/examples/request/PutElserRequestExample1.yaml index 8f3cc47569..1927bb0211 100644 --- a/specification/inference/put_elser/examples/request/PutElserRequestExample1.yaml +++ b/specification/inference/put_elser/examples/request/PutElserRequestExample1.yaml @@ -12,71 +12,3 @@ 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"' - - language: Java - code: | - client.inference().put(p -> p - .inferenceId("my-elser-model") - .taskType(TaskType.SparseEmbedding) - .inferenceConfig(i -> i - .service("elser") - .serviceSettings(JsonData.fromJson("{\"num_allocations\":1,\"num_threads\":1}")) - ) - ); diff --git a/specification/inference/put_elser/examples/request/PutElserRequestExample2.yaml b/specification/inference/put_elser/examples/request/PutElserRequestExample2.yaml index 20975ba3ad..9a7f4c03d0 100644 --- a/specification/inference/put_elser/examples/request/PutElserRequestExample2.yaml +++ b/specification/inference/put_elser/examples/request/PutElserRequestExample2.yaml @@ -17,87 +17,3 @@ 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\"" - - language: Java - code: > - client.inference().put(p -> p - .inferenceId("my-elser-model") - .taskType(TaskType.SparseEmbedding) - .inferenceConfig(i -> i - .service("elser") - .serviceSettings(JsonData.fromJson("{\"adaptive_allocations\":{\"enabled\":true,\"min_number_of_allocations\":3,\"max_number_of_allocations\":10},\"num_threads\":1}")) - ) - ); diff --git a/specification/inference/put_googleaistudio/examples/request/PutGoogleAiStudioRequestExample1.yaml b/specification/inference/put_googleaistudio/examples/request/PutGoogleAiStudioRequestExample1.yaml index 32f130ab9b..3b5b79bb64 100644 --- a/specification/inference/put_googleaistudio/examples/request/PutGoogleAiStudioRequestExample1.yaml +++ b/specification/inference/put_googleaistudio/examples/request/PutGoogleAiStudioRequestExample1.yaml @@ -10,71 +10,3 @@ 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"' - - language: Java - code: | - client.inference().put(p -> p - .inferenceId("google_ai_studio_completion") - .taskType(TaskType.Completion) - .inferenceConfig(i -> i - .service("googleaistudio") - .serviceSettings(JsonData.fromJson("{\"api_key\":\"api-key\",\"model_id\":\"model-id\"}")) - ) - ); diff --git a/specification/inference/put_googlevertexai/examples/request/PutGoogleVertexAiRequestExample1.yaml b/specification/inference/put_googlevertexai/examples/request/PutGoogleVertexAiRequestExample1.yaml index b6eba7c454..9df3634e3f 100644 --- a/specification/inference/put_googlevertexai/examples/request/PutGoogleVertexAiRequestExample1.yaml +++ b/specification/inference/put_googlevertexai/examples/request/PutGoogleVertexAiRequestExample1.yaml @@ -14,80 +14,3 @@ 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\"" - - language: Java - code: > - client.inference().put(p -> p - .inferenceId("google_vertex_ai_embeddingss") - .taskType(TaskType.TextEmbedding) - .inferenceConfig(i -> i - .service("googlevertexai") - .serviceSettings(JsonData.fromJson("{\"service_account_json\":\"service-account-json\",\"model_id\":\"model-id\",\"location\":\"location\",\"project_id\":\"project-id\"}")) - ) - ); diff --git a/specification/inference/put_googlevertexai/examples/request/PutGoogleVertexAiRequestExample2.yaml b/specification/inference/put_googlevertexai/examples/request/PutGoogleVertexAiRequestExample2.yaml index d1e18f9b1e..a8d2ed5806 100644 --- a/specification/inference/put_googlevertexai/examples/request/PutGoogleVertexAiRequestExample2.yaml +++ b/specification/inference/put_googlevertexai/examples/request/PutGoogleVertexAiRequestExample2.yaml @@ -10,71 +10,3 @@ 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\"" - - language: Java - code: > - client.inference().put(p -> p - .inferenceId("google_vertex_ai_rerank") - .taskType(TaskType.Rerank) - .inferenceConfig(i -> i - .service("googlevertexai") - .serviceSettings(JsonData.fromJson("{\"service_account_json\":\"service-account-json\",\"project_id\":\"project-id\"}")) - ) - ); diff --git a/specification/inference/put_hugging_face/examples/request/PutHuggingFaceRequestExample1.yaml b/specification/inference/put_hugging_face/examples/request/PutHuggingFaceRequestExample1.yaml index 2d4d81269d..aff674f7fc 100644 --- a/specification/inference/put_hugging_face/examples/request/PutHuggingFaceRequestExample1.yaml +++ b/specification/inference/put_hugging_face/examples/request/PutHuggingFaceRequestExample1.yaml @@ -12,71 +12,3 @@ 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"' - - language: Java - code: | - client.inference().put(p -> p - .inferenceId("hugging-face-embeddings") - .taskType(TaskType.TextEmbedding) - .inferenceConfig(i -> i - .service("hugging_face") - .serviceSettings(JsonData.fromJson("{\"api_key\":\"hugging-face-access-token\",\"url\":\"url-endpoint\"}")) - ) - ); diff --git a/specification/inference/put_hugging_face/examples/request/PutHuggingFaceRequestExample2.yaml b/specification/inference/put_hugging_face/examples/request/PutHuggingFaceRequestExample2.yaml index e6f830d821..cb5354b87f 100644 --- a/specification/inference/put_hugging_face/examples/request/PutHuggingFaceRequestExample2.yaml +++ b/specification/inference/put_hugging_face/examples/request/PutHuggingFaceRequestExample2.yaml @@ -14,88 +14,3 @@ value: |- "top_n": 3 } } -alternatives: - - language: Python - code: |- - resp = client.inference.put( - task_type="rerank", - inference_id="hugging-face-rerank", - inference_config={ - "service": "hugging_face", - "service_settings": { - "api_key": "hugging-face-access-token", - "url": "url-endpoint" - }, - "task_settings": { - "return_documents": True, - "top_n": 3 - } - }, - ) - - language: JavaScript - code: |- - const response = await client.inference.put({ - task_type: "rerank", - inference_id: "hugging-face-rerank", - inference_config: { - service: "hugging_face", - service_settings: { - api_key: "hugging-face-access-token", - url: "url-endpoint", - }, - task_settings: { - return_documents: true, - top_n: 3, - }, - }, - }); - - language: Ruby - code: |- - response = client.inference.put( - task_type: "rerank", - inference_id: "hugging-face-rerank", - body: { - "service": "hugging_face", - "service_settings": { - "api_key": "hugging-face-access-token", - "url": "url-endpoint" - }, - "task_settings": { - "return_documents": true, - "top_n": 3 - } - } - ) - - language: PHP - code: |- - $resp = $client->inference()->put([ - "task_type" => "rerank", - "inference_id" => "hugging-face-rerank", - "body" => [ - "service" => "hugging_face", - "service_settings" => [ - "api_key" => "hugging-face-access-token", - "url" => "url-endpoint", - ], - "task_settings" => [ - "return_documents" => true, - "top_n" => 3, - ], - ], - ]); - - 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\"},\"ta\ - sk_settings\":{\"return_documents\":true,\"top_n\":3}}' \"$ELASTICSEARCH_URL/_inference/rerank/hugging-face-rerank\"" - - language: Java - code: | - client.inference().put(p -> p - .inferenceId("hugging-face-rerank") - .taskType(TaskType.Rerank) - .inferenceConfig(i -> i - .service("hugging_face") - .serviceSettings(JsonData.fromJson("{\"api_key\":\"hugging-face-access-token\",\"url\":\"url-endpoint\"}")) - .taskSettings(JsonData.fromJson("{\"return_documents\":true,\"top_n\":3}")) - ) - ); diff --git a/specification/inference/put_jinaai/examples/request/PutJinaAiRequestExample1.yaml b/specification/inference/put_jinaai/examples/request/PutJinaAiRequestExample1.yaml index 01a6f1221e..e574f680da 100644 --- a/specification/inference/put_jinaai/examples/request/PutJinaAiRequestExample1.yaml +++ b/specification/inference/put_jinaai/examples/request/PutJinaAiRequestExample1.yaml @@ -12,71 +12,3 @@ 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"' - - language: Java - code: | - client.inference().put(p -> p - .inferenceId("jinaai-embeddings") - .taskType(TaskType.TextEmbedding) - .inferenceConfig(i -> i - .service("jinaai") - .serviceSettings(JsonData.fromJson("{\"model_id\":\"jina-embeddings-v3\",\"api_key\":\"JinaAi-Api-key\"}")) - ) - ); diff --git a/specification/inference/put_jinaai/examples/request/PutJinaAiRequestExample2.yaml b/specification/inference/put_jinaai/examples/request/PutJinaAiRequestExample2.yaml index a638f53a0d..d48c6a76d2 100644 --- a/specification/inference/put_jinaai/examples/request/PutJinaAiRequestExample2.yaml +++ b/specification/inference/put_jinaai/examples/request/PutJinaAiRequestExample2.yaml @@ -14,88 +14,3 @@ 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\"" - - language: Java - code: > - client.inference().put(p -> p - .inferenceId("jinaai-rerank") - .taskType(TaskType.Rerank) - .inferenceConfig(i -> i - .service("jinaai") - .serviceSettings(JsonData.fromJson("{\"api_key\":\"JinaAI-Api-key\",\"model_id\":\"jina-reranker-v2-base-multilingual\"}")) - .taskSettings(JsonData.fromJson("{\"top_n\":10,\"return_documents\":true}")) - ) - ); diff --git a/specification/inference/put_mistral/examples/request/PutMistralRequestExample1.yaml b/specification/inference/put_mistral/examples/request/PutMistralRequestExample1.yaml index 29e006a4f3..c0424aa193 100644 --- a/specification/inference/put_mistral/examples/request/PutMistralRequestExample1.yaml +++ b/specification/inference/put_mistral/examples/request/PutMistralRequestExample1.yaml @@ -12,71 +12,3 @@ 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"' - - language: Java - code: | - client.inference().put(p -> p - .inferenceId("mistral-embeddings-test") - .taskType(TaskType.TextEmbedding) - .inferenceConfig(i -> i - .service("mistral") - .serviceSettings(JsonData.fromJson("{\"api_key\":\"Mistral-API-Key\",\"model\":\"mistral-embed\"}")) - ) - ); diff --git a/specification/inference/put_openai/examples/request/PutOpenAiRequestExample1.yaml b/specification/inference/put_openai/examples/request/PutOpenAiRequestExample1.yaml index c57ae807fa..1b9b7c11b7 100644 --- a/specification/inference/put_openai/examples/request/PutOpenAiRequestExample1.yaml +++ b/specification/inference/put_openai/examples/request/PutOpenAiRequestExample1.yaml @@ -13,75 +13,3 @@ 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\"" - - language: Java - code: > - client.inference().put(p -> p - .inferenceId("openai-embeddings") - .taskType(TaskType.TextEmbedding) - .inferenceConfig(i -> i - .service("openai") - .serviceSettings(JsonData.fromJson("{\"api_key\":\"OpenAI-API-Key\",\"model_id\":\"text-embedding-3-small\",\"dimensions\":128}")) - ) - ); diff --git a/specification/inference/put_openai/examples/request/PutOpenAiRequestExample2.yaml b/specification/inference/put_openai/examples/request/PutOpenAiRequestExample2.yaml index c40aaeb571..81bbd193f7 100644 --- a/specification/inference/put_openai/examples/request/PutOpenAiRequestExample2.yaml +++ b/specification/inference/put_openai/examples/request/PutOpenAiRequestExample2.yaml @@ -13,84 +13,3 @@ 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\"" - - language: Java - code: > - client.inference().put(p -> p - .inferenceId("amazon_bedrock_completion") - .taskType(TaskType.Completion) - .inferenceConfig(i -> i - .service("amazonbedrock") - .serviceSettings(JsonData.fromJson("{\"access_key\":\"AWS-access-key\",\"secret_key\":\"AWS-secret-key\",\"region\":\"us-east-1\",\"provider\":\"amazontitan\",\"model\":\"amazon.titan-text-premier-v1:0\"}")) - ) - ); diff --git a/specification/inference/put_voyageai/examples/request/PutVoyageAIRequestExample1.yaml b/specification/inference/put_voyageai/examples/request/PutVoyageAIRequestExample1.yaml index fe2ccf9b0b..7f889ec4bd 100644 --- a/specification/inference/put_voyageai/examples/request/PutVoyageAIRequestExample1.yaml +++ b/specification/inference/put_voyageai/examples/request/PutVoyageAIRequestExample1.yaml @@ -12,71 +12,3 @@ 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"' - - language: Java - code: | - client.inference().put(p -> p - .inferenceId("openai-embeddings") - .taskType(TaskType.TextEmbedding) - .inferenceConfig(i -> i - .service("voyageai") - .serviceSettings(JsonData.fromJson("{\"model_id\":\"voyage-3-large\",\"dimensions\":512}")) - ) - ); diff --git a/specification/inference/put_voyageai/examples/request/PutVoyageAIRequestExample2.yaml b/specification/inference/put_voyageai/examples/request/PutVoyageAIRequestExample2.yaml index 66f6dcc496..976d13478f 100644 --- a/specification/inference/put_voyageai/examples/request/PutVoyageAIRequestExample2.yaml +++ b/specification/inference/put_voyageai/examples/request/PutVoyageAIRequestExample2.yaml @@ -9,67 +9,3 @@ 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"' - - language: Java - code: | - client.inference().put(p -> p - .inferenceId("voyageai-rerank") - .taskType(TaskType.Rerank) - .inferenceConfig(i -> i - .service("voyageai") - .serviceSettings(JsonData.fromJson("{\"model_id\":\"rerank-2\"}")) - ) - ); diff --git a/specification/inference/put_watsonx/examples/request/PutWatsonxRequestExample1.yaml b/specification/inference/put_watsonx/examples/request/PutWatsonxRequestExample1.yaml index ff714c44f5..a488512a57 100644 --- a/specification/inference/put_watsonx/examples/request/PutWatsonxRequestExample1.yaml +++ b/specification/inference/put_watsonx/examples/request/PutWatsonxRequestExample1.yaml @@ -13,84 +13,3 @@ 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\"" - - language: Java - code: > - client.inference().put(p -> p - .inferenceId("watsonx-embeddings") - .taskType(TaskType.TextEmbedding) - .inferenceConfig(i -> i - .service("watsonxai") - .serviceSettings(JsonData.fromJson("{\"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\"}")) - ) - ); diff --git a/specification/inference/rerank/examples/request/RerankRequestExample1.yaml b/specification/inference/rerank/examples/request/RerankRequestExample1.yaml index 1440c6f642..56c359a99f 100644 --- a/specification/inference/rerank/examples/request/RerankRequestExample1.yaml +++ b/specification/inference/rerank/examples/request/RerankRequestExample1.yaml @@ -7,72 +7,3 @@ 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"' - - language: Java - code: | - client.inference().rerank(r -> r - .inferenceId("cohere_rerank") - .input(List.of("luke","like","leia","chewy","r2d2","star","wars")) - .query("star wars main character") - ); diff --git a/specification/inference/rerank/examples/request/RerankRequestExample2.yaml b/specification/inference/rerank/examples/request/RerankRequestExample2.yaml index 24b48b96ab..faa519fb78 100644 --- a/specification/inference/rerank/examples/request/RerankRequestExample2.yaml +++ b/specification/inference/rerank/examples/request/RerankRequestExample2.yaml @@ -9,80 +9,3 @@ value: |- "return_documents": false, "top_n": 2 } -alternatives: - - language: Python - code: |- - resp = client.inference.rerank( - inference_id="bge-reranker-base-mkn", - input=[ - "luke", - "like", - "leia", - "chewy", - "r2d2", - "star", - "wars" - ], - query="star wars main character", - return_documents=False, - top_n=2, - ) - - language: JavaScript - code: |- - const response = await client.inference.rerank({ - inference_id: "bge-reranker-base-mkn", - input: ["luke", "like", "leia", "chewy", "r2d2", "star", "wars"], - query: "star wars main character", - return_documents: false, - top_n: 2, - }); - - language: Ruby - code: |- - response = client.inference.rerank( - inference_id: "bge-reranker-base-mkn", - body: { - "input": [ - "luke", - "like", - "leia", - "chewy", - "r2d2", - "star", - "wars" - ], - "query": "star wars main character", - "return_documents": false, - "top_n": 2 - } - ) - - language: PHP - code: |- - $resp = $client->inference()->rerank([ - "inference_id" => "bge-reranker-base-mkn", - "body" => [ - "input" => array( - "luke", - "like", - "leia", - "chewy", - "r2d2", - "star", - "wars", - ), - "query" => "star wars main character", - "return_documents" => false, - "top_n" => 2, - ], - ]); - - 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","return_documents":false,"top_n":2}'' "$ELASTICSEARCH_URL/_inference/rerank/bge-reranker-base-mkn"' - - language: Java - code: | - client.inference().rerank(r -> r - .inferenceId("bge-reranker-base-mkn") - .input(List.of("luke","like","leia","chewy","r2d2","star","wars")) - .query("star wars main character") - ); diff --git a/specification/inference/rerank/examples/request/RerankRequestExample3.yaml b/specification/inference/rerank/examples/request/RerankRequestExample3.yaml index 3e351a9863..9e17241d7e 100644 --- a/specification/inference/rerank/examples/request/RerankRequestExample3.yaml +++ b/specification/inference/rerank/examples/request/RerankRequestExample3.yaml @@ -9,80 +9,3 @@ value: |- "return_documents": true, "top_n": 3 } -alternatives: - - language: Python - code: |- - resp = client.inference.rerank( - inference_id="bge-reranker-base-mkn", - input=[ - "luke", - "like", - "leia", - "chewy", - "r2d2", - "star", - "wars" - ], - query="star wars main character", - return_documents=True, - top_n=3, - ) - - language: JavaScript - code: |- - const response = await client.inference.rerank({ - inference_id: "bge-reranker-base-mkn", - input: ["luke", "like", "leia", "chewy", "r2d2", "star", "wars"], - query: "star wars main character", - return_documents: true, - top_n: 3, - }); - - language: Ruby - code: |- - response = client.inference.rerank( - inference_id: "bge-reranker-base-mkn", - body: { - "input": [ - "luke", - "like", - "leia", - "chewy", - "r2d2", - "star", - "wars" - ], - "query": "star wars main character", - "return_documents": true, - "top_n": 3 - } - ) - - language: PHP - code: |- - $resp = $client->inference()->rerank([ - "inference_id" => "bge-reranker-base-mkn", - "body" => [ - "input" => array( - "luke", - "like", - "leia", - "chewy", - "r2d2", - "star", - "wars", - ), - "query" => "star wars main character", - "return_documents" => true, - "top_n" => 3, - ], - ]); - - 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","return_documents":true,"top_n":3}'' "$ELASTICSEARCH_URL/_inference/rerank/bge-reranker-base-mkn"' - - language: Java - code: | - client.inference().rerank(r -> r - .inferenceId("bge-reranker-base-mkn") - .input(List.of("luke","like","leia","chewy","r2d2","star","wars")) - .query("star wars main character") - ); diff --git a/specification/inference/sparse_embedding/examples/request/SparseEmbeddingRequestExample1.yaml b/specification/inference/sparse_embedding/examples/request/SparseEmbeddingRequestExample1.yaml index 9c8d16876b..78b349a14e 100644 --- a/specification/inference/sparse_embedding/examples/request/SparseEmbeddingRequestExample1.yaml +++ b/specification/inference/sparse_embedding/examples/request/SparseEmbeddingRequestExample1.yaml @@ -6,44 +6,3 @@ 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"' - - language: Java - code: | - client.inference().sparseEmbedding(s -> s - .inferenceId("my-elser-model") - .input("The sky above the port was the color of television tuned to a dead channel.") - ); diff --git a/specification/inference/stream_completion/examples/request/StreamInferenceRequestExample1.yaml b/specification/inference/stream_completion/examples/request/StreamInferenceRequestExample1.yaml index 3a63b05227..3066f6f95e 100644 --- a/specification/inference/stream_completion/examples/request/StreamInferenceRequestExample1.yaml +++ b/specification/inference/stream_completion/examples/request/StreamInferenceRequestExample1.yaml @@ -4,42 +4,3 @@ 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"' - - language: Java - code: | - client.inference().streamCompletion(s -> s - .inferenceId("openai-completion") - .input("What is Elastic?") - ); diff --git a/specification/inference/text_embedding/examples/request/TextEmbeddingRequestExample1.yaml b/specification/inference/text_embedding/examples/request/TextEmbeddingRequestExample1.yaml index 94df7931ef..6ad435dfd2 100644 --- a/specification/inference/text_embedding/examples/request/TextEmbeddingRequestExample1.yaml +++ b/specification/inference/text_embedding/examples/request/TextEmbeddingRequestExample1.yaml @@ -11,57 +11,3 @@ 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"' - - language: Java - code: | - client.inference().textEmbedding(t -> t - .inferenceId("my-cohere-endpoint") - .input("The sky above the port was the color of television tuned to a dead channel.") - .taskSettings(JsonData.fromJson("{\"input_type\":\"ingest\"}")) - ); diff --git a/specification/inference/update/examples/request/InferenceUpdateExample1.yaml b/specification/inference/update/examples/request/InferenceUpdateExample1.yaml index a5c242ae29..f986bcb01d 100644 --- a/specification/inference/update/examples/request/InferenceUpdateExample1.yaml +++ b/specification/inference/update/examples/request/InferenceUpdateExample1.yaml @@ -6,48 +6,3 @@ 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 7833a861f8..fcf2258725 100644 --- a/specification/ingest/delete_ip_location_database/examples/request/IngestDeleteIpLocationDatabaseExample1.yaml +++ b/specification/ingest/delete_ip_location_database/examples/request/IngestDeleteIpLocationDatabaseExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ingest().deleteIpLocationDatabase(d -> d - .id("my-database-id") - ); diff --git a/specification/ingest/delete_pipeline/examples/request/IngestDeletePipelineExample1.yaml b/specification/ingest/delete_pipeline/examples/request/IngestDeletePipelineExample1.yaml index 44a8d29b1d..6474f66e49 100644 --- a/specification/ingest/delete_pipeline/examples/request/IngestDeletePipelineExample1.yaml +++ b/specification/ingest/delete_pipeline/examples/request/IngestDeletePipelineExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ingest().deletePipeline(d -> d - .id("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 86786c7345..00e03c8138 100644 --- a/specification/ingest/geo_ip_stats/examples/request/IngestGeoIpStatsExample1.yaml +++ b/specification/ingest/geo_ip_stats/examples/request/IngestGeoIpStatsExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.ingest().geoIpStats(); 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 f98b84a82b..f266e00c60 100644 --- a/specification/ingest/get_ip_location_database/examples/request/IngestGetIpLocationDatabaseExample1.yaml +++ b/specification/ingest/get_ip_location_database/examples/request/IngestGetIpLocationDatabaseExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ingest().getIpLocationDatabase(g -> g - .id("my-database-id") - ); diff --git a/specification/ingest/get_pipeline/examples/request/IngestGetPipelineExample1.yaml b/specification/ingest/get_pipeline/examples/request/IngestGetPipelineExample1.yaml index c6f7c83427..34a3eaeb9e 100644 --- a/specification/ingest/get_pipeline/examples/request/IngestGetPipelineExample1.yaml +++ b/specification/ingest/get_pipeline/examples/request/IngestGetPipelineExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ingest().getPipeline(g -> g - .id("my-pipeline-id") - ); diff --git a/specification/ingest/processor_grok/examples/request/IngestProcessorGrokExample1.yaml b/specification/ingest/processor_grok/examples/request/IngestProcessorGrokExample1.yaml index 10bd4e6426..2ca8dd7a47 100644 --- a/specification/ingest/processor_grok/examples/request/IngestProcessorGrokExample1.yaml +++ b/specification/ingest/processor_grok/examples/request/IngestProcessorGrokExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.ingest().processorGrok(); 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 d18ae2ff8e..6656b88411 100644 --- a/specification/ingest/put_ip_location_database/examples/request/IngestPutIpLocationDatabaseExample1.yaml +++ b/specification/ingest/put_ip_location_database/examples/request/IngestPutIpLocationDatabaseExample1.yaml @@ -7,64 +7,3 @@ 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"' - - language: Java - code: | - client.ingest().putIpLocationDatabase(p -> p - .id("my-database-1") - .configuration(c -> c - .maxmind(m -> m - .accountId("1234567") - ) - .name("GeoIP2-Domain") - ) - ); diff --git a/specification/ingest/put_pipeline/examples/request/PutPipelineRequestExample1.yaml b/specification/ingest/put_pipeline/examples/request/PutPipelineRequestExample1.yaml index 644076d96a..88f232b0a0 100644 --- a/specification/ingest/put_pipeline/examples/request/PutPipelineRequestExample1.yaml +++ b/specification/ingest/put_pipeline/examples/request/PutPipelineRequestExample1.yaml @@ -25,86 +25,3 @@ value: "{ \ ] }" -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"' - - language: Java - code: | - client.ingest().putPipeline(p -> p - .description("My optional pipeline description") - .id("my-pipeline-id") - .processors(pr -> pr - .set(s -> s - .field("my-keyword-field") - .value(JsonData.fromJson("\"foo\"")) - .description("My optional processor description") - ) - ) - ); diff --git a/specification/ingest/put_pipeline/examples/request/PutPipelineRequestExample2.yaml b/specification/ingest/put_pipeline/examples/request/PutPipelineRequestExample2.yaml index a8d421929f..bdb4831c2d 100644 --- a/specification/ingest/put_pipeline/examples/request/PutPipelineRequestExample2.yaml +++ b/specification/ingest/put_pipeline/examples/request/PutPipelineRequestExample2.yaml @@ -39,116 +39,3 @@ value: "{ \ } }" -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"' - - language: Java - code: > - client.ingest().putPipeline(p -> p - .meta(Map.of("serialization", JsonData.fromJson("{\"class\":\"MyPipeline\",\"id\":10}"),"reason", JsonData.fromJson("\"set my-keyword-field to foo\""))) - .description("My optional pipeline description") - .id("my-pipeline-id") - .processors(pr -> pr - .set(s -> s - .field("my-keyword-field") - .value(JsonData.fromJson("\"foo\"")) - .description("My optional processor description") - ) - ) - ); diff --git a/specification/ingest/simulate/examples/request/SimulatePipelineRequestExample1.yaml b/specification/ingest/simulate/examples/request/SimulatePipelineRequestExample1.yaml index 2bd4e4feb7..9cb6f563a1 100644 --- a/specification/ingest/simulate/examples/request/SimulatePipelineRequestExample1.yaml +++ b/specification/ingest/simulate/examples/request/SimulatePipelineRequestExample1.yaml @@ -61,158 +61,3 @@ value: "{ \ ] }" -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\"" - - language: Java - code: | - client.ingest().simulate(s -> s - .docs(List.of(Document.of(d -> d - .id("id") - .index("index") - .source(JsonData.fromJson("{\"foo\":\"bar\"}"))),Document.of(d -> d - .id("id") - .index("index") - .source(JsonData.fromJson("{\"foo\":\"rab\"}"))))) - .pipeline(p -> p - .description("_description") - .processors(pr -> pr - .set(se -> se - .field("field2") - .value(JsonData.fromJson("\"_value\"")) - ) - ) - ) - ); diff --git a/specification/license/delete/examples/request/LicenseDeleteExample1.yaml b/specification/license/delete/examples/request/LicenseDeleteExample1.yaml index ce4cb5d47e..9051d299cd 100644 --- a/specification/license/delete/examples/request/LicenseDeleteExample1.yaml +++ b/specification/license/delete/examples/request/LicenseDeleteExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.license().delete(d -> d); diff --git a/specification/license/get/examples/request/GetLicenseRequestExample1.yaml b/specification/license/get/examples/request/GetLicenseRequestExample1.yaml index 51d9b71891..a05a5fbabe 100644 --- a/specification/license/get/examples/request/GetLicenseRequestExample1.yaml +++ b/specification/license/get/examples/request/GetLicenseRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.license().get(g -> g); diff --git a/specification/license/get_basic_status/examples/request/GetBasicLicenseStatusRequestExample1.yaml b/specification/license/get_basic_status/examples/request/GetBasicLicenseStatusRequestExample1.yaml index 0b808c7452..5b13e6709d 100644 --- a/specification/license/get_basic_status/examples/request/GetBasicLicenseStatusRequestExample1.yaml +++ b/specification/license/get_basic_status/examples/request/GetBasicLicenseStatusRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.license().getBasicStatus(); diff --git a/specification/license/get_trial_status/examples/request/GetTrialLicenseStatusRequestExample1.yaml b/specification/license/get_trial_status/examples/request/GetTrialLicenseStatusRequestExample1.yaml index f21cbefa7f..b43a0b4c02 100644 --- a/specification/license/get_trial_status/examples/request/GetTrialLicenseStatusRequestExample1.yaml +++ b/specification/license/get_trial_status/examples/request/GetTrialLicenseStatusRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.license().getTrialStatus(); diff --git a/specification/license/post/examples/request/PostLicenseRequestExample1.yaml b/specification/license/post/examples/request/PostLicenseRequestExample1.yaml index df722c316b..e7e31c1089 100644 --- a/specification/license/post/examples/request/PostLicenseRequestExample1.yaml +++ b/specification/license/post/examples/request/PostLicenseRequestExample1.yaml @@ -31,92 +31,3 @@ value: "{ \ ] }" -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\"" - - language: Java - code: | - client.license().post(p -> p - .licenses(l -> l - .expiryDateInMillis(1914278399999L) - .issueDateInMillis(1411948800000L) - .issuedTo("issuedTo") - .issuer("issuer") - .maxNodes(1L) - .signature("xx") - .type(LicenseType.Basic) - .uid("893361dc-9749-4997-93cb-802e3d7fa4xx") - ) - ); diff --git a/specification/license/post_start_basic/examples/request/StartBasicLicenseRequestExample1.yaml b/specification/license/post_start_basic/examples/request/StartBasicLicenseRequestExample1.yaml index a0149dd9c2..1da320bc31 100644 --- a/specification/license/post_start_basic/examples/request/StartBasicLicenseRequestExample1.yaml +++ b/specification/license/post_start_basic/examples/request/StartBasicLicenseRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.license().postStartBasic(p -> p - .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 f1b78f3017..684e3ce68a 100644 --- a/specification/license/post_start_trial/examples/request/StartTrialLicenseRequestExample1.yaml +++ b/specification/license/post_start_trial/examples/request/StartTrialLicenseRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.license().postStartTrial(p -> p - .acknowledge(true) - ); diff --git a/specification/logstash/delete_pipeline/examples/request/LogstashDeletePipelineExample1.yaml b/specification/logstash/delete_pipeline/examples/request/LogstashDeletePipelineExample1.yaml index db91116ca7..f3bd2e9aa7 100644 --- a/specification/logstash/delete_pipeline/examples/request/LogstashDeletePipelineExample1.yaml +++ b/specification/logstash/delete_pipeline/examples/request/LogstashDeletePipelineExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.logstash().deletePipeline(d -> d - .id("my_pipeline") - ); diff --git a/specification/logstash/get_pipeline/examples/request/LogstashGetPipelineRequestExample1.yaml b/specification/logstash/get_pipeline/examples/request/LogstashGetPipelineRequestExample1.yaml index 2bb607e259..6e566ef39d 100644 --- a/specification/logstash/get_pipeline/examples/request/LogstashGetPipelineRequestExample1.yaml +++ b/specification/logstash/get_pipeline/examples/request/LogstashGetPipelineRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.logstash().getPipeline(g -> g - .id("my_pipeline") - ); diff --git a/specification/logstash/put_pipeline/examples/request/LogstashPutPipelineRequestExample1.yaml b/specification/logstash/put_pipeline/examples/request/LogstashPutPipelineRequestExample1.yaml index 8ddf57fdd6..bebc71ab8f 100644 --- a/specification/logstash/put_pipeline/examples/request/LogstashPutPipelineRequestExample1.yaml +++ b/specification/logstash/put_pipeline/examples/request/LogstashPutPipelineRequestExample1.yaml @@ -17,127 +17,3 @@ 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\"" - - language: Java - code: | - client.logstash().putPipeline(p -> p - .id("my_pipeline") - .pipeline(pi -> pi - .description("Sample pipeline for illustration purposes") - .lastModified(DateTime.of("2021-01-02T02:50:51.250Z")) - .pipeline("input {}\n filter { grok {} }\n output {}") - .pipelineMetadata(pip -> pip - .type("logstash_pipeline") - .version("1") - ) - .pipelineSettings(pip -> pip - .pipelineWorkers(1) - .pipelineBatchSize(125) - .pipelineBatchDelay(50) - .queueType("memory") - .queueMaxBytes("1gb") - .queueCheckpointWrites(1024) - ) - .username("elastic") - ) - ); diff --git a/specification/migration/deprecations/examples/request/DeprecationInfoRequestExample1.yaml b/specification/migration/deprecations/examples/request/DeprecationInfoRequestExample1.yaml index 27c0809baf..e096e74803 100644 --- a/specification/migration/deprecations/examples/request/DeprecationInfoRequestExample1.yaml +++ b/specification/migration/deprecations/examples/request/DeprecationInfoRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.migration().deprecations(d -> d); 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 062461451d..2bd680e656 100644 --- a/specification/migration/get_feature_upgrade_status/examples/request/GetFeatureUpgradeStatusRequestExample1.yaml +++ b/specification/migration/get_feature_upgrade_status/examples/request/GetFeatureUpgradeStatusRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.migration().getFeatureUpgradeStatus(); diff --git a/specification/migration/post_feature_upgrade/examples/request/PostFeatureUpgradeRequestExample1.yaml b/specification/migration/post_feature_upgrade/examples/request/PostFeatureUpgradeRequestExample1.yaml index 1e875c2860..c77bc6e0ff 100644 --- a/specification/migration/post_feature_upgrade/examples/request/PostFeatureUpgradeRequestExample1.yaml +++ b/specification/migration/post_feature_upgrade/examples/request/PostFeatureUpgradeRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.migration().postFeatureUpgrade(); 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 0ace54f7d1..0417377ba9 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,30 +1 @@ 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"' - - language: Java - code: | - client.ml().clearTrainedModelDeploymentCache(c -> c - .modelId("elastic__distilbert-base-uncased-finetuned-conll03-english") - ); diff --git a/specification/ml/close_job/examples/request/MlCloseJobExample1.yaml b/specification/ml/close_job/examples/request/MlCloseJobExample1.yaml index 5635df9f63..ff006ad930 100644 --- a/specification/ml/close_job/examples/request/MlCloseJobExample1.yaml +++ b/specification/ml/close_job/examples/request/MlCloseJobExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ml().closeJob(c -> c - .jobId("low_request_rate") - ); diff --git a/specification/ml/delete_calendar/examples/request/MlDeleteCalendarExample1.yaml b/specification/ml/delete_calendar/examples/request/MlDeleteCalendarExample1.yaml index 37638332d8..cdd6642c4d 100644 --- a/specification/ml/delete_calendar/examples/request/MlDeleteCalendarExample1.yaml +++ b/specification/ml/delete_calendar/examples/request/MlDeleteCalendarExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ml().deleteCalendar(d -> d - .calendarId("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 d7a10a804e..03e0bc1377 100644 --- a/specification/ml/delete_calendar_event/examples/request/MlDeleteCalendarEventExample1.yaml +++ b/specification/ml/delete_calendar_event/examples/request/MlDeleteCalendarEventExample1.yaml @@ -1,35 +1 @@ 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"' - - language: Java - code: | - client.ml().deleteCalendarEvent(d -> d - .calendarId("planned-outages") - .eventId("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 266af51ca1..f42515b459 100644 --- a/specification/ml/delete_calendar_job/examples/request/MlDeleteCalendarJobExample1.yaml +++ b/specification/ml/delete_calendar_job/examples/request/MlDeleteCalendarJobExample1.yaml @@ -1,35 +1 @@ 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"' - - language: Java - code: | - client.ml().deleteCalendarJob(d -> d - .calendarId("planned-outages") - .jobId("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 459170e7df..1e7f8c41fb 100644 --- a/specification/ml/delete_data_frame_analytics/examples/request/MlDeleteDataFrameAnalyticsExample1.yaml +++ b/specification/ml/delete_data_frame_analytics/examples/request/MlDeleteDataFrameAnalyticsExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ml().deleteDataFrameAnalytics(d -> d - .id("loganalytics") - ); diff --git a/specification/ml/delete_datafeed/examples/request/MlDeleteDatafeedExample1.yaml b/specification/ml/delete_datafeed/examples/request/MlDeleteDatafeedExample1.yaml index 78477fc74b..86cb00fa59 100644 --- a/specification/ml/delete_datafeed/examples/request/MlDeleteDatafeedExample1.yaml +++ b/specification/ml/delete_datafeed/examples/request/MlDeleteDatafeedExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ml().deleteDatafeed(d -> d - .datafeedId("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 9fc52963d8..2effc4042c 100644 --- a/specification/ml/delete_expired_data/examples/request/MlDeleteExpiredDataExample1.yaml +++ b/specification/ml/delete_expired_data/examples/request/MlDeleteExpiredDataExample1.yaml @@ -1,31 +1 @@ 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"' - - language: Java - code: | - client.ml().deleteExpiredData(d -> d - .timeout(t -> t - .offset(1) - ) - ); diff --git a/specification/ml/delete_filter/examples/request/MlDeleteFilterExample1.yaml b/specification/ml/delete_filter/examples/request/MlDeleteFilterExample1.yaml index 924e3c2703..8a61ae8bdd 100644 --- a/specification/ml/delete_filter/examples/request/MlDeleteFilterExample1.yaml +++ b/specification/ml/delete_filter/examples/request/MlDeleteFilterExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ml().deleteFilter(d -> d - .filterId("safe_domains") - ); diff --git a/specification/ml/delete_forecast/examples/request/MlDeleteForecastExample1.yaml b/specification/ml/delete_forecast/examples/request/MlDeleteForecastExample1.yaml index 255ae060a5..b8069fc90f 100644 --- a/specification/ml/delete_forecast/examples/request/MlDeleteForecastExample1.yaml +++ b/specification/ml/delete_forecast/examples/request/MlDeleteForecastExample1.yaml @@ -1,35 +1 @@ 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"' - - language: Java - code: | - client.ml().deleteForecast(d -> d - .forecastId("_all") - .jobId("total-requests") - ); diff --git a/specification/ml/delete_job/examples/request/MlDeleteJobExample1.yaml b/specification/ml/delete_job/examples/request/MlDeleteJobExample1.yaml index 24a5c26e29..a996042090 100644 --- a/specification/ml/delete_job/examples/request/MlDeleteJobExample1.yaml +++ b/specification/ml/delete_job/examples/request/MlDeleteJobExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ml().deleteJob(d -> d - .jobId("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 889597603d..36617a5bc6 100644 --- a/specification/ml/delete_model_snapshot/examples/request/MlDeleteModelSnapshotExample1.yaml +++ b/specification/ml/delete_model_snapshot/examples/request/MlDeleteModelSnapshotExample1.yaml @@ -1,35 +1 @@ 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"' - - language: Java - code: | - client.ml().deleteModelSnapshot(d -> d - .jobId("farequote") - .snapshotId("1491948163") - ); diff --git a/specification/ml/delete_trained_model/examples/request/MlDeleteTrainedModelExample1.yaml b/specification/ml/delete_trained_model/examples/request/MlDeleteTrainedModelExample1.yaml index 5045f8e890..36f643b4da 100644 --- a/specification/ml/delete_trained_model/examples/request/MlDeleteTrainedModelExample1.yaml +++ b/specification/ml/delete_trained_model/examples/request/MlDeleteTrainedModelExample1.yaml @@ -1,30 +1 @@ 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"' - - language: Java - code: | - client.ml().deleteTrainedModel(d -> d - .modelId("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 0b0664e5ec..cfba1b00b5 100644 --- a/specification/ml/delete_trained_model_alias/examples/request/MlDeleteTrainedModelAliasExample1.yaml +++ b/specification/ml/delete_trained_model_alias/examples/request/MlDeleteTrainedModelAliasExample1.yaml @@ -1,35 +1 @@ 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"' - - language: Java - code: | - client.ml().deleteTrainedModelAlias(d -> d - .modelAlias("flight_delay_model") - .modelId("flight-delay-prediction-1574775339910") - ); diff --git a/specification/ml/estimate_model_memory/examples/request/MlEstimateModelMemoryRequestExample1.yaml b/specification/ml/estimate_model_memory/examples/request/MlEstimateModelMemoryRequestExample1.yaml index f081dad394..a0a7ef0c3e 100644 --- a/specification/ml/estimate_model_memory/examples/request/MlEstimateModelMemoryRequestExample1.yaml +++ b/specification/ml/estimate_model_memory/examples/request/MlEstimateModelMemoryRequestExample1.yaml @@ -21,138 +21,3 @@ 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\"" - - language: Java - code: | - client.ml().estimateModelMemory(e -> e - .analysisConfig(a -> a - .bucketSpan(b -> b - .time("5m") - ) - .detectors(d -> d - .byFieldName("status") - .fieldName("bytes") - .function("sum") - .partitionFieldName("app") - ) - .influencers(List.of("source_ip","dest_ip")) - ) - .maxBucketCardinality(Map.of("dest_ip", 30L,"source_ip", 300L)) - .overallCardinality(Map.of("app", 50L,"status", 10L)) - ); diff --git a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample1.yaml b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample1.yaml index 9e3a7d62c8..64c2ab60f7 100644 --- a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample1.yaml +++ b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample1.yaml @@ -12,82 +12,3 @@ 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\"" - - language: Java - code: | - client.ml().evaluateDataFrame(e -> e - .evaluation(ev -> ev - .classification(c -> c - .actualField("animal_class") - .predictedField("ml.animal_class_prediction") - .metrics(m -> m) - ) - ) - .index("animal_classification") - ); diff --git a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample2.yaml b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample2.yaml index e72b5a8216..75e8de5129 100644 --- a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample2.yaml +++ b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample2.yaml @@ -14,88 +14,3 @@ 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\"" - - language: Java - code: | - client.ml().evaluateDataFrame(e -> e - .evaluation(ev -> ev - .classification(c -> c - .actualField("animal_class") - .metrics(m -> m - .aucRoc(a -> a - .className("dog") - ) - ) - ) - ) - .index("animal_classification") - ); diff --git a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample3.yaml b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample3.yaml index cc6dbd8ef3..4ff41e2545 100644 --- a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample3.yaml +++ b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample3.yaml @@ -9,68 +9,3 @@ 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\"" - - language: Java - code: | - client.ml().evaluateDataFrame(e -> e - .evaluation(ev -> ev - .outlierDetection(o -> o - .actualField("is_outlier") - .predictedProbabilityField("ml.outlier_score") - ) - ) - .index("my_analytics_dest_index") - ); diff --git a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample4.yaml b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample4.yaml index 622823476d..1dc1c71b2f 100644 --- a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample4.yaml +++ b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample4.yaml @@ -23,171 +23,3 @@ 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\"" - - language: Java - code: | - client.ml().evaluateDataFrame(e -> e - .evaluation(ev -> ev - .regression(r -> r - .actualField("price") - .predictedField("ml.price_prediction") - .metrics(m -> m - .msle(ms -> ms - .offset(10.0D) - ) - .huber(h -> h - .delta(1.5D) - ) - ) - ) - ) - .index("house_price_predictions") - .query(q -> q - .bool(b -> b - .filter(f -> f - .term(t -> t - .field("ml.is_training") - .value(FieldValue.of(false)) - ) - ) - ) - ) - ); diff --git a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample5.yaml b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample5.yaml index 41e76dd6fc..8ffb999c10 100644 --- a/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample5.yaml +++ b/specification/ml/evaluate_data_frame/examples/request/MlEvaluateDataFrameRequestExample5.yaml @@ -20,131 +20,3 @@ 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\"" - - language: Java - code: | - client.ml().evaluateDataFrame(e -> e - .evaluation(ev -> ev - .regression(r -> r - .actualField("price") - .predictedField("ml.price_prediction") - .metrics(m -> m - .msle(ms -> ms) - .huber(h -> h) - ) - ) - ) - .index("house_price_predictions") - .query(q -> q - .term(t -> t - .field("ml.is_training") - .value(FieldValue.of(true)) - ) - ) - ); 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 674937a17e..fb1f81f76e 100644 --- a/specification/ml/explain_data_frame_analytics/examples/request/MlExplainDataFrameAnalyticsRequestExample1.yaml +++ b/specification/ml/explain_data_frame_analytics/examples/request/MlExplainDataFrameAnalyticsRequestExample1.yaml @@ -8,73 +8,3 @@ 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"' - - language: Java - code: | - client.ml().explainDataFrameAnalytics(e -> e - .analysis(a -> a - .regression(r -> r - .dependentVariable("price") - ) - ) - .source(s -> s - .index("houses_sold_last_10_yrs") - ) - ); diff --git a/specification/ml/flush_job/examples/request/MlFlushJobExample1.yaml b/specification/ml/flush_job/examples/request/MlFlushJobExample1.yaml index 076e3e7793..21e1dbd2b6 100644 --- a/specification/ml/flush_job/examples/request/MlFlushJobExample1.yaml +++ b/specification/ml/flush_job/examples/request/MlFlushJobExample1.yaml @@ -4,42 +4,3 @@ 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"' - - language: Java - code: | - client.ml().flushJob(f -> f - .calcInterim(true) - .jobId("low_request_rate") - ); diff --git a/specification/ml/forecast/examples/request/MlForecastExample1.yaml b/specification/ml/forecast/examples/request/MlForecastExample1.yaml index 281e668467..2e2dc3dc63 100644 --- a/specification/ml/forecast/examples/request/MlForecastExample1.yaml +++ b/specification/ml/forecast/examples/request/MlForecastExample1.yaml @@ -4,44 +4,3 @@ 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"' - - language: Java - code: | - client.ml().forecast(f -> f - .duration(d -> d - .time("10d") - ) - .jobId("low_request_rate") - ); diff --git a/specification/ml/get_buckets/examples/request/MlGetBucketsExample1.yaml b/specification/ml/get_buckets/examples/request/MlGetBucketsExample1.yaml index 01f7964a94..85002c44c3 100644 --- a/specification/ml/get_buckets/examples/request/MlGetBucketsExample1.yaml +++ b/specification/ml/get_buckets/examples/request/MlGetBucketsExample1.yaml @@ -5,48 +5,3 @@ 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"' - - language: Java - code: | - client.ml().getBuckets(g -> g - .anomalyScore(80.0D) - .jobId("low_request_rate") - .start(DateTime.of("1454530200001")) - ); diff --git a/specification/ml/get_calendar_events/examples/request/MlGetCalendarEventsExample1.yaml b/specification/ml/get_calendar_events/examples/request/MlGetCalendarEventsExample1.yaml index 903d37f89f..2271588bc5 100644 --- a/specification/ml/get_calendar_events/examples/request/MlGetCalendarEventsExample1.yaml +++ b/specification/ml/get_calendar_events/examples/request/MlGetCalendarEventsExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ml().getCalendarEvents(g -> g - .calendarId("planned-outages") - ); diff --git a/specification/ml/get_calendars/examples/request/MlGetCalendarsExample1.yaml b/specification/ml/get_calendars/examples/request/MlGetCalendarsExample1.yaml index 7031b45741..7964e0844d 100644 --- a/specification/ml/get_calendars/examples/request/MlGetCalendarsExample1.yaml +++ b/specification/ml/get_calendars/examples/request/MlGetCalendarsExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ml().getCalendars(g -> g - .calendarId("planned-outages") - ); diff --git a/specification/ml/get_categories/examples/request/MlGetCategoriesExample1.yaml b/specification/ml/get_categories/examples/request/MlGetCategoriesExample1.yaml index 3184834163..31dd82d9fa 100644 --- a/specification/ml/get_categories/examples/request/MlGetCategoriesExample1.yaml +++ b/specification/ml/get_categories/examples/request/MlGetCategoriesExample1.yaml @@ -6,52 +6,3 @@ 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"' - - language: Java - code: | - client.ml().getCategories(g -> g - .jobId("esxi_log") - .page(p -> p - .size(1) - ) - ); 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 6ae5827ffe..d87c068be6 100644 --- a/specification/ml/get_data_frame_analytics/examples/request/MlGetDataFrameAnalyticsExample1.yaml +++ b/specification/ml/get_data_frame_analytics/examples/request/MlGetDataFrameAnalyticsExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ml().getDataFrameAnalytics(g -> g - .id("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 2b46e403eb..bfab4a796b 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,29 +1 @@ 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"' - - language: Java - code: | - client.ml().getDataFrameAnalyticsStats(g -> g - .id("weblog-outliers") - ); diff --git a/specification/ml/get_datafeed_stats/examples/request/MlGetDatafeedStatsExample1.yaml b/specification/ml/get_datafeed_stats/examples/request/MlGetDatafeedStatsExample1.yaml index b7cf20132a..4022e01353 100644 --- a/specification/ml/get_datafeed_stats/examples/request/MlGetDatafeedStatsExample1.yaml +++ b/specification/ml/get_datafeed_stats/examples/request/MlGetDatafeedStatsExample1.yaml @@ -1,30 +1 @@ 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"' - - language: Java - code: | - client.ml().getDatafeedStats(g -> g - .datafeedId("datafeed-high_sum_total_sales") - ); diff --git a/specification/ml/get_datafeeds/examples/request/MlGetDatafeedsExample1.yaml b/specification/ml/get_datafeeds/examples/request/MlGetDatafeedsExample1.yaml index 4a1037d315..bd31d72579 100644 --- a/specification/ml/get_datafeeds/examples/request/MlGetDatafeedsExample1.yaml +++ b/specification/ml/get_datafeeds/examples/request/MlGetDatafeedsExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ml().getDatafeeds(g -> g - .datafeedId("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 624a3d092f..41c8454cc2 100644 --- a/specification/ml/get_filters/examples/request/MlGetFiltersExample1.yaml +++ b/specification/ml/get_filters/examples/request/MlGetFiltersExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ml().getFilters(g -> g - .filterId("safe_domains") - ); diff --git a/specification/ml/get_influencers/examples/request/MlGetInfluencersExample1.yaml b/specification/ml/get_influencers/examples/request/MlGetInfluencersExample1.yaml index 5d36ade4ba..0bb4c9f2b1 100644 --- a/specification/ml/get_influencers/examples/request/MlGetInfluencersExample1.yaml +++ b/specification/ml/get_influencers/examples/request/MlGetInfluencersExample1.yaml @@ -5,46 +5,3 @@ 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"' - - language: Java - code: | - client.ml().getInfluencers(g -> g - .jobId("high_sum_total_sales") - ); diff --git a/specification/ml/get_job_stats/examples/request/MlGetJobStatsExample1.yaml b/specification/ml/get_job_stats/examples/request/MlGetJobStatsExample1.yaml index 07381729d9..992d5eb383 100644 --- a/specification/ml/get_job_stats/examples/request/MlGetJobStatsExample1.yaml +++ b/specification/ml/get_job_stats/examples/request/MlGetJobStatsExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ml().getJobStats(g -> g - .jobId("low_request_rate") - ); diff --git a/specification/ml/get_jobs/examples/request/MlGetJobsExample1.yaml b/specification/ml/get_jobs/examples/request/MlGetJobsExample1.yaml index b6d456970d..5edb88e3ff 100644 --- a/specification/ml/get_jobs/examples/request/MlGetJobsExample1.yaml +++ b/specification/ml/get_jobs/examples/request/MlGetJobsExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ml().getJobs(g -> g - .jobId("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 f2b94df12c..d96eea698e 100644 --- a/specification/ml/get_memory_stats/examples/request/MlGetMemoryStatsExample1.yaml +++ b/specification/ml/get_memory_stats/examples/request/MlGetMemoryStatsExample1.yaml @@ -1,26 +1 @@ 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"' - - language: Java - code: "\n" 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 c43070df50..42473e9e83 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,35 +1 @@ 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"' - - language: Java - code: | - client.ml().getModelSnapshotUpgradeStats(g -> g - .jobId("low_request_rate") - .snapshotId("_all") - ); diff --git a/specification/ml/get_model_snapshots/examples/request/MlGetModelSnapshotsExample1.yaml b/specification/ml/get_model_snapshots/examples/request/MlGetModelSnapshotsExample1.yaml index d7fb910aa2..5d9f0959b4 100644 --- a/specification/ml/get_model_snapshots/examples/request/MlGetModelSnapshotsExample1.yaml +++ b/specification/ml/get_model_snapshots/examples/request/MlGetModelSnapshotsExample1.yaml @@ -4,42 +4,3 @@ 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"' - - language: Java - code: | - client.ml().getModelSnapshots(g -> g - .jobId("high_sum_total_sales") - .start(DateTime.of("1575402236000")) - ); diff --git a/specification/ml/get_overall_buckets/examples/request/MlGetOverallBucketsExample1.yaml b/specification/ml/get_overall_buckets/examples/request/MlGetOverallBucketsExample1.yaml index 3fdb7c7946..3fd53f76b4 100644 --- a/specification/ml/get_overall_buckets/examples/request/MlGetOverallBucketsExample1.yaml +++ b/specification/ml/get_overall_buckets/examples/request/MlGetOverallBucketsExample1.yaml @@ -5,48 +5,3 @@ 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"' - - language: Java - code: | - client.ml().getOverallBuckets(g -> g - .jobId("job-*") - .overallScore("80") - .start(DateTime.of("1403532000000")) - ); diff --git a/specification/ml/get_records/examples/request/MlGetRecordsExample1.yaml b/specification/ml/get_records/examples/request/MlGetRecordsExample1.yaml index 53aae1ce53..78968584d7 100644 --- a/specification/ml/get_records/examples/request/MlGetRecordsExample1.yaml +++ b/specification/ml/get_records/examples/request/MlGetRecordsExample1.yaml @@ -6,53 +6,3 @@ 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"' - - language: Java - code: | - client.ml().getRecords(g -> g - .desc(true) - .jobId("low_request_rate") - .sort("record_score") - .start(DateTime.of("1454944100000")) - ); diff --git a/specification/ml/get_trained_models/examples/request/MlGetTrainedModelsExample1.yaml b/specification/ml/get_trained_models/examples/request/MlGetTrainedModelsExample1.yaml index f28c5c3cae..6de7522ab6 100644 --- a/specification/ml/get_trained_models/examples/request/MlGetTrainedModelsExample1.yaml +++ b/specification/ml/get_trained_models/examples/request/MlGetTrainedModelsExample1.yaml @@ -1,15 +1 @@ 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/"' - - language: Java - code: | - client.ml().getTrainedModels(g -> g); 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 e2fe9f1bff..f0367abf92 100644 --- a/specification/ml/get_trained_models_stats/examples/request/MlGetTrainedModelsStatsExample1.yaml +++ b/specification/ml/get_trained_models_stats/examples/request/MlGetTrainedModelsStatsExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.ml().getTrainedModelsStats(g -> g); diff --git a/specification/ml/infer_trained_model/examples/request/MlInferTrainedModelExample1.yaml b/specification/ml/infer_trained_model/examples/request/MlInferTrainedModelExample1.yaml index 2d671a7d2f..1688659f03 100644 --- a/specification/ml/infer_trained_model/examples/request/MlInferTrainedModelExample1.yaml +++ b/specification/ml/infer_trained_model/examples/request/MlInferTrainedModelExample1.yaml @@ -4,59 +4,3 @@ 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"' - - language: Java - code: > - client.ml().inferTrainedModel(i -> i - .docs(Map.of("text", JsonData.fromJson("\"The fool doth think he is wise, but the wise man knows himself to be a fool.\""))) - .modelId("lang_ident_model_1") - ); diff --git a/specification/ml/info/examples/request/MlInfoExample1.yaml b/specification/ml/info/examples/request/MlInfoExample1.yaml index 7ed33a8249..a32dec1f8d 100644 --- a/specification/ml/info/examples/request/MlInfoExample1.yaml +++ b/specification/ml/info/examples/request/MlInfoExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.ml().info(); diff --git a/specification/ml/open_job/examples/request/MlOpenJobRequestExample1.yaml b/specification/ml/open_job/examples/request/MlOpenJobRequestExample1.yaml index 2dcf513e30..7423e886be 100644 --- a/specification/ml/open_job/examples/request/MlOpenJobRequestExample1.yaml +++ b/specification/ml/open_job/examples/request/MlOpenJobRequestExample1.yaml @@ -4,44 +4,3 @@ description: > 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"' - - language: Java - code: | - client.ml().openJob(o -> o - .jobId("job-01") - .timeout(t -> t - .time("35m") - ) - ); diff --git a/specification/ml/post_calendar_events/examples/request/MlPostCalendarEventsExample1.yaml b/specification/ml/post_calendar_events/examples/request/MlPostCalendarEventsExample1.yaml index c01e4e4753..9235c4c7d8 100644 --- a/specification/ml/post_calendar_events/examples/request/MlPostCalendarEventsExample1.yaml +++ b/specification/ml/post_calendar_events/examples/request/MlPostCalendarEventsExample1.yaml @@ -8,117 +8,3 @@ 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"' - - language: Java - code: | - client.ml().postCalendarEvents(p -> p - .calendarId("planned-outages") - .events(List.of(CalendarEvent.of(c -> c - .description("event 1") - .endTime(DateTime.ofEpochMilli(1513728000000L)) - .startTime(DateTime.ofEpochMilli(1513641600000L))),CalendarEvent.of(c -> c - .description("event 2") - .endTime(DateTime.ofEpochMilli(1513900800000L)) - .startTime(DateTime.ofEpochMilli(1513814400000L))),CalendarEvent.of(c -> c - .description("event 3") - .endTime(DateTime.ofEpochMilli(1514246400000L)) - .startTime(DateTime.ofEpochMilli(1514160000000L))))) - ); 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 535e9c5a29..cd481962f9 100644 --- a/specification/ml/preview_data_frame_analytics/examples/request/MlPreviewDataFrameAnalyticsExample1.yaml +++ b/specification/ml/preview_data_frame_analytics/examples/request/MlPreviewDataFrameAnalyticsExample1.yaml @@ -13,83 +13,3 @@ 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\"" - - language: Java - code: | - client.ml().previewDataFrameAnalytics(p -> p - .config(c -> c - .source(s -> s - .index("houses_sold_last_10_yrs") - ) - .analysis(a -> a - .regression(r -> r - .dependentVariable("price") - ) - ) - ) - ); diff --git a/specification/ml/preview_datafeed/examples/request/MlPreviewDatafeedExample1.yaml b/specification/ml/preview_datafeed/examples/request/MlPreviewDatafeedExample1.yaml index 27b7fa8c00..59b54791fa 100644 --- a/specification/ml/preview_datafeed/examples/request/MlPreviewDatafeedExample1.yaml +++ b/specification/ml/preview_datafeed/examples/request/MlPreviewDatafeedExample1.yaml @@ -1,30 +1 @@ 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"' - - language: Java - code: | - client.ml().previewDatafeed(p -> p - .datafeedId("datafeed-high_sum_total_sales") - ); diff --git a/specification/ml/put_calendar/examples/request/MlPutCalendarExample1.yaml b/specification/ml/put_calendar/examples/request/MlPutCalendarExample1.yaml index b2cdb84a0e..a566a5aaca 100644 --- a/specification/ml/put_calendar/examples/request/MlPutCalendarExample1.yaml +++ b/specification/ml/put_calendar/examples/request/MlPutCalendarExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ml().putCalendar(p -> p - .calendarId("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 76c7799291..d380156208 100644 --- a/specification/ml/put_calendar_job/examples/request/MlPutCalendarJobExample1.yaml +++ b/specification/ml/put_calendar_job/examples/request/MlPutCalendarJobExample1.yaml @@ -1,35 +1 @@ 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"' - - language: Java - code: | - client.ml().putCalendarJob(p -> p - .calendarId("planned-outages") - .jobId("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 a6de4ea357..266d059d4c 100644 --- a/specification/ml/put_data_frame_analytics/examples/request/MlPutDataFrameAnalyticsExample1.yaml +++ b/specification/ml/put_data_frame_analytics/examples/request/MlPutDataFrameAnalyticsExample1.yaml @@ -39,208 +39,3 @@ 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\"" - - language: Java - code: | - client.ml().putDataFrameAnalytics(p -> p - .analysis(a -> a - .regression(r -> r - .dependentVariable("FlightDelayMin") - .trainingPercent("90") - ) - ) - .analyzedFields(an -> an - .excludes("FlightNum") - ) - .dest(d -> d - .index("df-flight-delays") - .resultsField("ml-results") - ) - .id("model-flight-delays-pre") - .modelMemoryLimit("100mb") - .source(s -> s - .index("kibana_sample_data_flights") - .query(q -> q - .range(r -> r - .untyped(u -> u - .field("DistanceKilometers") - .gt(JsonData.fromJson("0")) - ) - ) - ) - .source(so -> so - .excludes(List.of("FlightDelay","FlightDelayType")) - ) - ) - ); diff --git a/specification/ml/put_datafeed/examples/request/MlPutDatafeedExample1.yaml b/specification/ml/put_datafeed/examples/request/MlPutDatafeedExample1.yaml index 200ffb07fb..8dcb37a8b2 100644 --- a/specification/ml/put_datafeed/examples/request/MlPutDatafeedExample1.yaml +++ b/specification/ml/put_datafeed/examples/request/MlPutDatafeedExample1.yaml @@ -16,89 +16,3 @@ 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"' - - language: Java - code: "\n" diff --git a/specification/ml/put_filter/examples/request/MlPutFilterExample1.yaml b/specification/ml/put_filter/examples/request/MlPutFilterExample1.yaml index babb5c8d0e..36a56f9989 100644 --- a/specification/ml/put_filter/examples/request/MlPutFilterExample1.yaml +++ b/specification/ml/put_filter/examples/request/MlPutFilterExample1.yaml @@ -5,56 +5,3 @@ 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"' - - language: Java - code: | - client.ml().putFilter(p -> p - .description("A list of safe domains") - .filterId("safe_domains") - .items(List.of("*.google.com","wikipedia.org")) - ); diff --git a/specification/ml/put_job/examples/request/MlPutJobRequestExample1.yaml b/specification/ml/put_job/examples/request/MlPutJobRequestExample1.yaml index 6286e08954..8de6bccc91 100644 --- a/specification/ml/put_job/examples/request/MlPutJobRequestExample1.yaml +++ b/specification/ml/put_job/examples/request/MlPutJobRequestExample1.yaml @@ -30,262 +30,3 @@ 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\"" - - language: Java - code: | - client.ml().putJob(p -> p - .analysisConfig(a -> a - .bucketSpan(b -> b - .time("15m") - ) - .detectors(d -> d - .detectorDescription("Sum of bytes") - .fieldName("bytes") - .function("sum") - ) - ) - .analysisLimits(an -> an - .modelMemoryLimit("11MB") - ) - .dataDescription(d -> d - .timeField("timestamp") - .timeFormat("epoch_ms") - ) - .datafeedConfig(d -> d - .datafeedId("datafeed-test-job1") - .indices("kibana_sample_data_logs") - .query(q -> q - .bool(b -> b - .must(m -> m - .matchAll(ma -> ma) - ) - ) - ) - .runtimeMappings("hour_of_day", r -> r - .script(s -> s - .source(so -> so - .scriptString("emit(doc['timestamp'].value.getHour());") - ) - ) - .type(RuntimeFieldType.Long) - ) - ) - .jobId("job-01") - .modelPlotConfig(m -> m - .annotationsEnabled(true) - .enabled(true) - ) - .resultsIndexName("test-job1") - ); 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 2f4ef07310..50b8336929 100644 --- a/specification/ml/put_trained_model_alias/examples/request/MlPutTrainedModelAliasExample1.yaml +++ b/specification/ml/put_trained_model_alias/examples/request/MlPutTrainedModelAliasExample1.yaml @@ -1,35 +1 @@ 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"' - - language: Java - code: | - client.ml().putTrainedModelAlias(p -> p - .modelAlias("flight_delay_model") - .modelId("flight-delay-prediction-1574775339910") - ); 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 d9868bc8d4..e3ee1da7db 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,49 +6,3 @@ 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 2b49aef59c..8dc57715c9 100644 --- a/specification/ml/put_trained_model_vocabulary/examples/request/MlPutTrainedModelVocabularyExample1.yaml +++ b/specification/ml/put_trained_model_vocabulary/examples/request/MlPutTrainedModelVocabularyExample1.yaml @@ -7,52 +7,3 @@ value: |- "[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"' - - language: Java - code: | - client.ml().putTrainedModelVocabulary(p -> p - .modelId("elastic__distilbert-base-uncased-finetuned-conll03-english") - .vocabulary(List.of("[PAD]","[unused0]")) - ); diff --git a/specification/ml/reset_job/examples/request/MlResetJobExample1.yaml b/specification/ml/reset_job/examples/request/MlResetJobExample1.yaml index 3cf918505d..60909463d9 100644 --- a/specification/ml/reset_job/examples/request/MlResetJobExample1.yaml +++ b/specification/ml/reset_job/examples/request/MlResetJobExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ml().resetJob(r -> r - .jobId("total-requests") - ); diff --git a/specification/ml/revert_model_snapshot/examples/request/MlRevertModelSnapshotExample1.yaml b/specification/ml/revert_model_snapshot/examples/request/MlRevertModelSnapshotExample1.yaml index 42625ed27c..be5b441ba5 100644 --- a/specification/ml/revert_model_snapshot/examples/request/MlRevertModelSnapshotExample1.yaml +++ b/specification/ml/revert_model_snapshot/examples/request/MlRevertModelSnapshotExample1.yaml @@ -4,48 +4,3 @@ 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"' - - language: Java - code: | - client.ml().revertModelSnapshot(r -> r - .deleteInterveningResults(true) - .jobId("low_request_rate") - .snapshotId("1637092688") - ); diff --git a/specification/ml/set_upgrade_mode/examples/request/MlSetUpgradeModeExample1.yaml b/specification/ml/set_upgrade_mode/examples/request/MlSetUpgradeModeExample1.yaml index 1c1ccf52e9..e17ca2f2a5 100644 --- a/specification/ml/set_upgrade_mode/examples/request/MlSetUpgradeModeExample1.yaml +++ b/specification/ml/set_upgrade_mode/examples/request/MlSetUpgradeModeExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ml().setUpgradeMode(s -> s - .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 afddbc3879..74653e7a8b 100644 --- a/specification/ml/start_data_frame_analytics/examples/request/MlStartDataFrameAnalyticsExample1.yaml +++ b/specification/ml/start_data_frame_analytics/examples/request/MlStartDataFrameAnalyticsExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ml().startDataFrameAnalytics(s -> s - .id("loganalytics") - ); diff --git a/specification/ml/start_datafeed/examples/request/MlStartDatafeedExample1.yaml b/specification/ml/start_datafeed/examples/request/MlStartDatafeedExample1.yaml index 5300ae37df..561f5e64cc 100644 --- a/specification/ml/start_datafeed/examples/request/MlStartDatafeedExample1.yaml +++ b/specification/ml/start_datafeed/examples/request/MlStartDatafeedExample1.yaml @@ -4,42 +4,3 @@ 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"' - - language: Java - code: | - client.ml().startDatafeed(s -> s - .datafeedId("datafeed-low_request_rate") - .start(DateTime.of("2019-04-07T18:22:16Z")) - ); 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 332e4d4f05..bde8ed0c79 100644 --- a/specification/ml/start_trained_model_deployment/examples/request/MlStartTrainedModelDeploymentExample1.yaml +++ b/specification/ml/start_trained_model_deployment/examples/request/MlStartTrainedModelDeploymentExample1.yaml @@ -1,42 +1 @@ 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"' - - language: Java - code: | - client.ml().startTrainedModelDeployment(s -> s - .modelId("elastic__distilbert-base-uncased-finetuned-conll03-english") - .timeout(t -> t - .offset(1) - ) - .waitFor(DeploymentAllocationState.Started) - ); 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 b590e4da49..819d809f82 100644 --- a/specification/ml/stop_data_frame_analytics/examples/request/MlStopDataFrameAnalyticsExample1.yaml +++ b/specification/ml/stop_data_frame_analytics/examples/request/MlStopDataFrameAnalyticsExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.ml().stopDataFrameAnalytics(s -> s - .id("loganalytics") - ); diff --git a/specification/ml/stop_datafeed/examples/request/MlStopDatafeedExample1.yaml b/specification/ml/stop_datafeed/examples/request/MlStopDatafeedExample1.yaml index 66212f8738..e13b090a8a 100644 --- a/specification/ml/stop_datafeed/examples/request/MlStopDatafeedExample1.yaml +++ b/specification/ml/stop_datafeed/examples/request/MlStopDatafeedExample1.yaml @@ -4,44 +4,3 @@ 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"' - - language: Java - code: | - client.ml().stopDatafeed(s -> s - .datafeedId("datafeed-low_request_rate") - .timeout(t -> t - .time("30s") - ) - ); 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 1aa14e12e8..74d933d369 100644 --- a/specification/ml/stop_trained_model_deployment/examples/request/MlStopTrainedModelDeploymentExample1.yaml +++ b/specification/ml/stop_trained_model_deployment/examples/request/MlStopTrainedModelDeploymentExample1.yaml @@ -1,30 +1 @@ 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"' - - language: Java - code: | - client.ml().stopTrainedModelDeployment(s -> s - .modelId("my_model_for_search") - ); 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 ad7cb389ae..9820aa0787 100644 --- a/specification/ml/update_data_frame_analytics/examples/request/MlUpdateDataFrameAnalyticsExample1.yaml +++ b/specification/ml/update_data_frame_analytics/examples/request/MlUpdateDataFrameAnalyticsExample1.yaml @@ -4,42 +4,3 @@ 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"' - - language: Java - code: | - client.ml().updateDataFrameAnalytics(u -> u - .id("loganalytics") - .modelMemoryLimit("200mb") - ); diff --git a/specification/ml/update_datafeed/examples/request/MlUpdateDatafeedExample1.yaml b/specification/ml/update_datafeed/examples/request/MlUpdateDatafeedExample1.yaml index 8e9675a6ab..5d50e3fdba 100644 --- a/specification/ml/update_datafeed/examples/request/MlUpdateDatafeedExample1.yaml +++ b/specification/ml/update_datafeed/examples/request/MlUpdateDatafeedExample1.yaml @@ -8,63 +8,3 @@ 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"' - - language: Java - code: | - client.ml().updateDatafeed(u -> u - .datafeedId("datafeed-test-job") - .query(q -> q - .term(t -> t - .field("geo.src") - .value(FieldValue.of("US")) - ) - ) - ); diff --git a/specification/ml/update_filter/examples/request/MlUpdateFilterExample1.yaml b/specification/ml/update_filter/examples/request/MlUpdateFilterExample1.yaml index da6e3bc182..1bb685211b 100644 --- a/specification/ml/update_filter/examples/request/MlUpdateFilterExample1.yaml +++ b/specification/ml/update_filter/examples/request/MlUpdateFilterExample1.yaml @@ -6,65 +6,3 @@ 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"' - - language: Java - code: | - client.ml().updateFilter(u -> u - .addItems("*.myorg.com") - .description("Updated list of domains") - .filterId("safe_domains") - .removeItems("wikipedia.org") - ); diff --git a/specification/ml/update_job/examples/request/MlUpdateJobExample1.yaml b/specification/ml/update_job/examples/request/MlUpdateJobExample1.yaml index eb917fb367..8d8a616b0a 100644 --- a/specification/ml/update_job/examples/request/MlUpdateJobExample1.yaml +++ b/specification/ml/update_job/examples/request/MlUpdateJobExample1.yaml @@ -16,116 +16,3 @@ 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\"" - - language: Java - code: | - client.ml().updateJob(u -> u - .backgroundPersistInterval(b -> b - .time("2h") - ) - .description("An updated job") - .detectors(d -> d - .detectorIndex(0) - .description("An updated detector description") - ) - .groups(List.of("kibana_sample_data","kibana_sample_web_logs")) - .jobId("low_request_rate") - .modelPlotConfig(m -> m - .enabled(true) - ) - .modelSnapshotRetentionDays(7L) - .renormalizationWindowDays(30L) - .resultsRetentionDays(60L) - ); diff --git a/specification/ml/update_model_snapshot/examples/request/MlUpdateModelSnapshotExample1.yaml b/specification/ml/update_model_snapshot/examples/request/MlUpdateModelSnapshotExample1.yaml index 86cf128655..2659e93d4b 100644 --- a/specification/ml/update_model_snapshot/examples/request/MlUpdateModelSnapshotExample1.yaml +++ b/specification/ml/update_model_snapshot/examples/request/MlUpdateModelSnapshotExample1.yaml @@ -6,53 +6,3 @@ 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"' - - language: Java - code: | - client.ml().updateModelSnapshot(u -> u - .description("Snapshot 1") - .jobId("it_ops_new_logs") - .retain(true) - .snapshotId("1491852978") - ); 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 f8f9d1b3fd..f26d17b778 100644 --- a/specification/ml/update_trained_model_deployment/examples/request/MlUpdateTrainedModelDeploymentExample1.yaml +++ b/specification/ml/update_trained_model_deployment/examples/request/MlUpdateTrainedModelDeploymentExample1.yaml @@ -5,43 +5,3 @@ 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"' - - language: Java - code: | - client.ml().updateTrainedModelDeployment(u -> u - .modelId("elastic__distilbert-base-uncased-finetuned-conll03-english") - .numberOfAllocations(4) - ); diff --git a/specification/ml/upgrade_job_snapshot/examples/request/MlUpgradeJobSnapshotExample1.yaml b/specification/ml/upgrade_job_snapshot/examples/request/MlUpgradeJobSnapshotExample1.yaml index 0943d9e2b9..e7d136c0c7 100644 --- a/specification/ml/upgrade_job_snapshot/examples/request/MlUpgradeJobSnapshotExample1.yaml +++ b/specification/ml/upgrade_job_snapshot/examples/request/MlUpgradeJobSnapshotExample1.yaml @@ -1,47 +1 @@ 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"' - - language: Java - code: | - client.ml().upgradeJobSnapshot(u -> u - .jobId("low_request_rate") - .snapshotId("1828371") - .timeout(t -> t - .offset(45) - ) - .waitForCompletion(true) - ); diff --git a/specification/nodes/hot_threads/examples/request/NodesHotThreadsExample1.yaml b/specification/nodes/hot_threads/examples/request/NodesHotThreadsExample1.yaml index ea6d3cf6fe..376e42d32d 100644 --- a/specification/nodes/hot_threads/examples/request/NodesHotThreadsExample1.yaml +++ b/specification/nodes/hot_threads/examples/request/NodesHotThreadsExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.nodes().hotThreads(h -> h); diff --git a/specification/nodes/info/examples/request/NodesInfoExample1.yaml b/specification/nodes/info/examples/request/NodesInfoExample1.yaml index 618a6bfe97..9f78ea319c 100644 --- a/specification/nodes/info/examples/request/NodesInfoExample1.yaml +++ b/specification/nodes/info/examples/request/NodesInfoExample1.yaml @@ -1,34 +1 @@ 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"' - - language: Java - code: | - client.nodes().info(i -> i - .metric("jvm") - .nodeId("_all") - ); diff --git a/specification/nodes/reload_secure_settings/examples/request/ReloadSecureSettingsRequestExample1.yaml b/specification/nodes/reload_secure_settings/examples/request/ReloadSecureSettingsRequestExample1.yaml index cb82ededbe..17901ecfb4 100644 --- a/specification/nodes/reload_secure_settings/examples/request/ReloadSecureSettingsRequestExample1.yaml +++ b/specification/nodes/reload_secure_settings/examples/request/ReloadSecureSettingsRequestExample1.yaml @@ -6,37 +6,3 @@ 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"' - - language: Java - code: | - client.nodes().reloadSecureSettings(r -> r - .secureSettingsPassword("keystore-password") - ); diff --git a/specification/nodes/stats/examples/request/NodesStatsExample1.yaml b/specification/nodes/stats/examples/request/NodesStatsExample1.yaml index 678c6053bf..530ddd65ef 100644 --- a/specification/nodes/stats/examples/request/NodesStatsExample1.yaml +++ b/specification/nodes/stats/examples/request/NodesStatsExample1.yaml @@ -1,31 +1 @@ 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"' - - language: Java - code: "\n" diff --git a/specification/nodes/usage/examples/request/NodesUsageExample1.yaml b/specification/nodes/usage/examples/request/NodesUsageExample1.yaml index a1be84482f..6c9b6fc2bc 100644 --- a/specification/nodes/usage/examples/request/NodesUsageExample1.yaml +++ b/specification/nodes/usage/examples/request/NodesUsageExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.nodes().usage(u -> u); diff --git a/specification/query_rules/delete_rule/examples/request/QueryRulesDeleteRuleExample1.yaml b/specification/query_rules/delete_rule/examples/request/QueryRulesDeleteRuleExample1.yaml index 85a1fe1235..65711f5067 100644 --- a/specification/query_rules/delete_rule/examples/request/QueryRulesDeleteRuleExample1.yaml +++ b/specification/query_rules/delete_rule/examples/request/QueryRulesDeleteRuleExample1.yaml @@ -1,34 +1 @@ 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"' - - language: Java - code: | - client.queryRules().deleteRule(d -> d - .ruleId("my-rule1") - .rulesetId("my-ruleset") - ); diff --git a/specification/query_rules/delete_ruleset/examples/request/QueryRulesDeleteRulesetExample1.yaml b/specification/query_rules/delete_ruleset/examples/request/QueryRulesDeleteRulesetExample1.yaml index 02998b8918..60b70ddf05 100644 --- a/specification/query_rules/delete_ruleset/examples/request/QueryRulesDeleteRulesetExample1.yaml +++ b/specification/query_rules/delete_ruleset/examples/request/QueryRulesDeleteRulesetExample1.yaml @@ -1,29 +1 @@ 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/"' - - language: Java - code: | - client.queryRules().deleteRuleset(d -> d - .rulesetId("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 e7fa0f3fa2..3cf7b6f67a 100644 --- a/specification/query_rules/get_rule/examples/request/QueryRuleGetRequestExample1.yaml +++ b/specification/query_rules/get_rule/examples/request/QueryRuleGetRequestExample1.yaml @@ -1,34 +1 @@ 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"' - - language: Java - code: | - client.queryRules().getRule(g -> g - .ruleId("my-rule1") - .rulesetId("my-ruleset") - ); diff --git a/specification/query_rules/get_ruleset/examples/request/QueryRulesetGetRequestExample1.yaml b/specification/query_rules/get_ruleset/examples/request/QueryRulesetGetRequestExample1.yaml index ca8b7a8e48..f22fa12d34 100644 --- a/specification/query_rules/get_ruleset/examples/request/QueryRulesetGetRequestExample1.yaml +++ b/specification/query_rules/get_ruleset/examples/request/QueryRulesetGetRequestExample1.yaml @@ -1,29 +1 @@ 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/"' - - language: Java - code: | - client.queryRules().getRuleset(g -> g - .rulesetId("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 733fdaa65d..46e42c3046 100644 --- a/specification/query_rules/list_rulesets/examples/request/QueryRulesetListRequestExample1.yaml +++ b/specification/query_rules/list_rulesets/examples/request/QueryRulesetListRequestExample1.yaml @@ -1,34 +1 @@ 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"' - - language: Java - code: | - client.queryRules().listRulesets(l -> l - .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 4bdec267fb..beacbae1be 100644 --- a/specification/query_rules/put_rule/examples/request/QueryRulePutRequestExample1.yaml +++ b/specification/query_rules/put_rule/examples/request/QueryRulePutRequestExample1.yaml @@ -6,50 +6,3 @@ description: > 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"' - - language: Java - code: | - client.queryRules().test(t -> t - .matchCriteria("query_string", JsonData.fromJson("\"puggles\"")) - .rulesetId("my-ruleset") - ); diff --git a/specification/query_rules/put_ruleset/examples/request/QueryRulesetPutRequestExample1.yaml b/specification/query_rules/put_ruleset/examples/request/QueryRulesetPutRequestExample1.yaml index 19dda02f03..a5524fb73f 100644 --- a/specification/query_rules/put_ruleset/examples/request/QueryRulesetPutRequestExample1.yaml +++ b/specification/query_rules/put_ruleset/examples/request/QueryRulesetPutRequestExample1.yaml @@ -103,275 +103,3 @@ value: "{ \ ] }" -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\"" - - language: Java - code: > - client.queryRules().putRuleset(p -> p - .rules(List.of(QueryRule.queryRuleOf(q -> q - .ruleId("my-rule1") - .type(QueryRuleType.Pinned) - .criteria(List.of(QueryRuleCriteria.of(qu -> qu - .type(QueryRuleCriteriaType.Contains) - .metadata("user_query") - .values(List.of(JsonData.fromJson("\"pugs\""),JsonData.fromJson("\"puggles\"")))),QueryRuleCriteria.of(qu -> qu - .type(QueryRuleCriteriaType.Exact) - .metadata("user_country") - .values(JsonData.fromJson("\"us\""))))) - .actions(a -> a - .ids(List.of("id1","id2")) - )),QueryRule.queryRuleOf(q -> q - .ruleId("my-rule2") - .type(QueryRuleType.Pinned) - .criteria(c -> c - .type(QueryRuleCriteriaType.Fuzzy) - .metadata("user_query") - .values(JsonData.fromJson("\"rescue dogs\"")) - ) - .actions(a -> a - .docs(List.of(PinnedDoc.of(pi -> pi - .id("id3") - .index("index1")),PinnedDoc.of(pi -> pi - .id("id4") - .index("index2")))) - )))) - .rulesetId("my-ruleset") - ); diff --git a/specification/query_rules/test/examples/request/QueryRulesetTestRequestExample1.yaml b/specification/query_rules/test/examples/request/QueryRulesetTestRequestExample1.yaml index 19dda02f03..a5524fb73f 100644 --- a/specification/query_rules/test/examples/request/QueryRulesetTestRequestExample1.yaml +++ b/specification/query_rules/test/examples/request/QueryRulesetTestRequestExample1.yaml @@ -103,275 +103,3 @@ value: "{ \ ] }" -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\"" - - language: Java - code: > - client.queryRules().putRuleset(p -> p - .rules(List.of(QueryRule.queryRuleOf(q -> q - .ruleId("my-rule1") - .type(QueryRuleType.Pinned) - .criteria(List.of(QueryRuleCriteria.of(qu -> qu - .type(QueryRuleCriteriaType.Contains) - .metadata("user_query") - .values(List.of(JsonData.fromJson("\"pugs\""),JsonData.fromJson("\"puggles\"")))),QueryRuleCriteria.of(qu -> qu - .type(QueryRuleCriteriaType.Exact) - .metadata("user_country") - .values(JsonData.fromJson("\"us\""))))) - .actions(a -> a - .ids(List.of("id1","id2")) - )),QueryRule.queryRuleOf(q -> q - .ruleId("my-rule2") - .type(QueryRuleType.Pinned) - .criteria(c -> c - .type(QueryRuleCriteriaType.Fuzzy) - .metadata("user_query") - .values(JsonData.fromJson("\"rescue dogs\"")) - ) - .actions(a -> a - .docs(List.of(PinnedDoc.of(pi -> pi - .id("id3") - .index("index1")),PinnedDoc.of(pi -> pi - .id("id4") - .index("index2")))) - )))) - .rulesetId("my-ruleset") - ); diff --git a/specification/rollup/delete_job/examples/request/DeleteRollupJobRequestExample1.yaml b/specification/rollup/delete_job/examples/request/DeleteRollupJobRequestExample1.yaml index 86869b1231..4e29cf1351 100644 --- a/specification/rollup/delete_job/examples/request/DeleteRollupJobRequestExample1.yaml +++ b/specification/rollup/delete_job/examples/request/DeleteRollupJobRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.rollup().deleteJob(d -> d - .id("sensor") - ); diff --git a/specification/rollup/get_jobs/examples/request/GetRollupJobRequestExample1.yaml b/specification/rollup/get_jobs/examples/request/GetRollupJobRequestExample1.yaml index ec266d8ddc..fc03b7a60e 100644 --- a/specification/rollup/get_jobs/examples/request/GetRollupJobRequestExample1.yaml +++ b/specification/rollup/get_jobs/examples/request/GetRollupJobRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.rollup().getJobs(g -> g - .id("sensor") - ); diff --git a/specification/rollup/get_rollup_caps/examples/request/GetRollupCapabilitiesRequestExample1.yaml b/specification/rollup/get_rollup_caps/examples/request/GetRollupCapabilitiesRequestExample1.yaml index 9fc0e320a2..2ddfc8ee9c 100644 --- a/specification/rollup/get_rollup_caps/examples/request/GetRollupCapabilitiesRequestExample1.yaml +++ b/specification/rollup/get_rollup_caps/examples/request/GetRollupCapabilitiesRequestExample1.yaml @@ -1,29 +1 @@ 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-*"' - - language: Java - code: | - client.rollup().getRollupCaps(g -> g - .id("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 7d4ab2ef6d..01b9d8fe31 100644 --- a/specification/rollup/get_rollup_index_caps/examples/request/GetRollupIndexCapabilitiesRequestExample1.yaml +++ b/specification/rollup/get_rollup_index_caps/examples/request/GetRollupIndexCapabilitiesRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.rollup().getRollupIndexCaps(g -> g - .index("sensor_rollup") - ); diff --git a/specification/rollup/put_job/examples/request/CreateRollupJobRequestExample1.yaml b/specification/rollup/put_job/examples/request/CreateRollupJobRequestExample1.yaml index ae074d9546..560413e6a9 100644 --- a/specification/rollup/put_job/examples/request/CreateRollupJobRequestExample1.yaml +++ b/specification/rollup/put_job/examples/request/CreateRollupJobRequestExample1.yaml @@ -57,183 +57,3 @@ value: "{ \ ] }" -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\"" - - language: Java - code: | - client.rollup().putJob(p -> p - .cron("*/30 * * * * ?") - .groups(g -> g - .dateHistogram(d -> d - .delay(de -> de - .time("7d") - ) - .field("timestamp") - .fixedInterval(f -> f - .time("1h") - ) - ) - .terms(t -> t - .fields("node") - ) - ) - .id("sensor") - .indexPattern("sensor-*") - .metrics(List.of(FieldMetric.of(f -> f - .field("temperature") - .metrics(List.of(Metric.Min,Metric.Max,Metric.Sum))),FieldMetric.of(f -> f - .field("voltage") - .metrics(Metric.Avg)))) - .pageSize(1000) - .rollupIndex("sensor_rollup") - ); diff --git a/specification/rollup/rollup_search/examples/request/RollupSearchRequestExample1.yaml b/specification/rollup/rollup_search/examples/request/RollupSearchRequestExample1.yaml index 75d049026f..eb955cd4a3 100644 --- a/specification/rollup/rollup_search/examples/request/RollupSearchRequestExample1.yaml +++ b/specification/rollup/rollup_search/examples/request/RollupSearchRequestExample1.yaml @@ -21,76 +21,3 @@ value: "{ \ } }" -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"' - - language: Java - code: | - client.rollup().rollupSearch(r -> r - .aggregations("max_temperature", a -> a - .max(m -> m - .field("temperature") - ) - ) - .index("sensor_rollup") - .size(0) - ); diff --git a/specification/rollup/start_job/examples/request/StartRollupJobRequestExample1.yaml b/specification/rollup/start_job/examples/request/StartRollupJobRequestExample1.yaml index dbbd33b121..8ddfdb7299 100644 --- a/specification/rollup/start_job/examples/request/StartRollupJobRequestExample1.yaml +++ b/specification/rollup/start_job/examples/request/StartRollupJobRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.rollup().startJob(s -> s - .id("sensor") - ); diff --git a/specification/rollup/stop_job/examples/request/RollupStopJobExample1.yaml b/specification/rollup/stop_job/examples/request/RollupStopJobExample1.yaml index bfb46170ef..40619f2064 100644 --- a/specification/rollup/stop_job/examples/request/RollupStopJobExample1.yaml +++ b/specification/rollup/stop_job/examples/request/RollupStopJobExample1.yaml @@ -1,42 +1 @@ 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"' - - language: Java - code: | - client.rollup().stopJob(s -> s - .id("sensor") - .timeout(t -> t - .offset(10) - ) - .waitForCompletion(true) - ); diff --git a/specification/search_application/delete/examples/request/SearchApplicationDeleteExample1.yaml b/specification/search_application/delete/examples/request/SearchApplicationDeleteExample1.yaml index f76ad9d5e4..7798b430d6 100644 --- a/specification/search_application/delete/examples/request/SearchApplicationDeleteExample1.yaml +++ b/specification/search_application/delete/examples/request/SearchApplicationDeleteExample1.yaml @@ -1,29 +1 @@ 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/"' - - language: Java - code: | - client.searchApplication().delete(d -> d - .name("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 3fb9ebf9d9..4e5eda09a5 100644 --- a/specification/search_application/delete_behavioral_analytics/examples/request/SearchApplicationDeleteBehavioralAnalyticsExample1.yaml +++ b/specification/search_application/delete_behavioral_analytics/examples/request/SearchApplicationDeleteBehavioralAnalyticsExample1.yaml @@ -1,30 +1 @@ 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/"' - - language: Java - code: | - client.searchApplication().deleteBehavioralAnalytics(d -> d - .name("my_analytics_collection") - ); diff --git a/specification/search_application/get/examples/request/SearchApplicationGetRequestExample1.yaml b/specification/search_application/get/examples/request/SearchApplicationGetRequestExample1.yaml index 45c3f339c6..3e3bbd8ce3 100644 --- a/specification/search_application/get/examples/request/SearchApplicationGetRequestExample1.yaml +++ b/specification/search_application/get/examples/request/SearchApplicationGetRequestExample1.yaml @@ -1,29 +1 @@ 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/"' - - language: Java - code: | - client.searchApplication().get(g -> g - .name("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 9c10b4b77c..072e6eb801 100644 --- a/specification/search_application/get_behavioral_analytics/examples/request/BehavioralAnalyticsGetRequestExample1.yaml +++ b/specification/search_application/get_behavioral_analytics/examples/request/BehavioralAnalyticsGetRequestExample1.yaml @@ -1,29 +1 @@ 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*"' - - language: Java - code: | - client.searchApplication().getBehavioralAnalytics(g -> g - .name("my*") - ); diff --git a/specification/search_application/list/examples/request/SearchApplicationsListRequestExample1.yaml b/specification/search_application/list/examples/request/SearchApplicationsListRequestExample1.yaml index c8594bc3d1..16096a75a2 100644 --- a/specification/search_application/list/examples/request/SearchApplicationsListRequestExample1.yaml +++ b/specification/search_application/list/examples/request/SearchApplicationsListRequestExample1.yaml @@ -1,40 +1 @@ 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*"' - - language: Java - code: | - client.searchApplication().list(l -> l - .from(0) - .q("app*") - .size(3) - ); 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 415f7b0d27..036bc78258 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 @@ -63,163 +63,3 @@ value: "{ \ } }" -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\"" - - language: Java - code: > - client.searchApplication().postBehavioralAnalyticsEvent(p -> p - .collectionName("my_analytics_collection") - .eventType(EventType.SearchClick) - .payload(JsonData.fromJson("{\"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\"}}")) - ); diff --git a/specification/search_application/put/examples/request/SearchApplicationPutRequestExample1.yaml b/specification/search_application/put/examples/request/SearchApplicationPutRequestExample1.yaml index 7e58ba7b02..6a5d5992f8 100644 --- a/specification/search_application/put/examples/request/SearchApplicationPutRequestExample1.yaml +++ b/specification/search_application/put/examples/request/SearchApplicationPutRequestExample1.yaml @@ -80,207 +80,3 @@ value: "{ \ } }" -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\"" - - language: Java - code: | - client.searchApplication().put(p -> p - .name("my-app") - .searchApplication(s -> s - .indices(List.of("index1","index2")) - .template(t -> t - .script(sc -> sc - .source(so -> so - .scriptTemplate(scr -> scr - .query(q -> q - .queryString(qu -> qu - .defaultField("{{default_field}}") - .query("{{query_string}}") - ) - ) - ) - ) - .params(Map.of("default_field", JsonData.fromJson("\"*\""),"query_string", JsonData.fromJson("\"*\""))) - ) - ) - ) - ); 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 60d6da4f34..4aaf67d23a 100644 --- a/specification/search_application/put_behavioral_analytics/examples/request/SearchApplicationPutBehavioralAnalyticsExample1.yaml +++ b/specification/search_application/put_behavioral_analytics/examples/request/SearchApplicationPutBehavioralAnalyticsExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.searchApplication().putBehavioralAnalytics(p -> p - .name("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 97426feaea..1a3ee03714 100644 --- a/specification/search_application/render_query/examples/request/SearchApplicationsRenderQueryRequestExample1.yaml +++ b/specification/search_application/render_query/examples/request/SearchApplicationsRenderQueryRequestExample1.yaml @@ -12,92 +12,3 @@ 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"' - - language: Java - code: > - client.searchApplication().renderQuery(r -> r - .name("my-app") - .params(Map.of("text_fields", JsonData.fromJson("[{\"name\":\"title\",\"boost\":5},{\"name\":\"description\",\"boost\":1}]"),"query_string", JsonData.fromJson("\"my first query\""))) - ); diff --git a/specification/search_application/search/examples/request/SearchApplicationsSearchRequestExample1.yaml b/specification/search_application/search/examples/request/SearchApplicationsSearchRequestExample1.yaml index 76d100b7b4..dbacffc671 100644 --- a/specification/search_application/search/examples/request/SearchApplicationsSearchRequestExample1.yaml +++ b/specification/search_application/search/examples/request/SearchApplicationsSearchRequestExample1.yaml @@ -21,92 +21,3 @@ value: "{ \ } }" -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"' - - language: Java - code: > - client.searchApplication().search(s -> s - .name("my-app") - .params(Map.of("text_fields", JsonData.fromJson("[{\"name\":\"title\",\"boost\":5},{\"name\":\"description\",\"boost\":1}]"),"query_string", JsonData.fromJson("\"my first query\""))) - ); diff --git a/specification/searchable_snapshots/cache_stats/examples/request/CacheStatsRequestExample1.yaml b/specification/searchable_snapshots/cache_stats/examples/request/CacheStatsRequestExample1.yaml index e7decf4f76..f42d35458a 100644 --- a/specification/searchable_snapshots/cache_stats/examples/request/CacheStatsRequestExample1.yaml +++ b/specification/searchable_snapshots/cache_stats/examples/request/CacheStatsRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.searchableSnapshots().cacheStats(c -> c); diff --git a/specification/searchable_snapshots/clear_cache/examples/request/SearchableSnapshotsClearCacheExample1.yaml b/specification/searchable_snapshots/clear_cache/examples/request/SearchableSnapshotsClearCacheExample1.yaml index e66a380c03..39b7c88abf 100644 --- a/specification/searchable_snapshots/clear_cache/examples/request/SearchableSnapshotsClearCacheExample1.yaml +++ b/specification/searchable_snapshots/clear_cache/examples/request/SearchableSnapshotsClearCacheExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.searchableSnapshots().clearCache(c -> c - .index("my-index") - ); diff --git a/specification/searchable_snapshots/mount/examples/request/SearchableSnapshotsMountSnapshotRequestExample1.yaml b/specification/searchable_snapshots/mount/examples/request/SearchableSnapshotsMountSnapshotRequestExample1.yaml index e87ec14a2c..cc79de9fce 100644 --- a/specification/searchable_snapshots/mount/examples/request/SearchableSnapshotsMountSnapshotRequestExample1.yaml +++ b/specification/searchable_snapshots/mount/examples/request/SearchableSnapshotsMountSnapshotRequestExample1.yaml @@ -19,82 +19,3 @@ value: "{ \ \"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\"" - - language: Java - code: | - client.searchableSnapshots().mount(m -> m - .ignoreIndexSettings("index.refresh_interval") - .index("my_docs") - .indexSettings("index.number_of_replicas", JsonData.fromJson("0")) - .renamedIndex("docs") - .repository("my_repository") - .snapshot("my_snapshot") - .waitForCompletion(true) - ); diff --git a/specification/searchable_snapshots/stats/examples/request/SearchableSnapshotsStatsExample1.yaml b/specification/searchable_snapshots/stats/examples/request/SearchableSnapshotsStatsExample1.yaml index 15b9363e97..b87278903e 100644 --- a/specification/searchable_snapshots/stats/examples/request/SearchableSnapshotsStatsExample1.yaml +++ b/specification/searchable_snapshots/stats/examples/request/SearchableSnapshotsStatsExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.searchableSnapshots().stats(s -> s - .index("my-index") - ); diff --git a/specification/security/activate_user_profile/examples/request/ActivateUserProfileRequestExample1.yaml b/specification/security/activate_user_profile/examples/request/ActivateUserProfileRequestExample1.yaml index f36dfcec8e..203118735a 100644 --- a/specification/security/activate_user_profile/examples/request/ActivateUserProfileRequestExample1.yaml +++ b/specification/security/activate_user_profile/examples/request/ActivateUserProfileRequestExample1.yaml @@ -9,48 +9,3 @@ 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"' - - language: Java - code: | - client.security().activateUserProfile(a -> a - .grantType(GrantType.Password) - .password("l0ng-r4nd0m-p@ssw0rd") - .username("jacknich") - ); diff --git a/specification/security/authenticate/examples/request/SecurityAuthenticateRequestExample1.yaml b/specification/security/authenticate/examples/request/SecurityAuthenticateRequestExample1.yaml index d5a3393892..ac8802f5a3 100644 --- a/specification/security/authenticate/examples/request/SecurityAuthenticateRequestExample1.yaml +++ b/specification/security/authenticate/examples/request/SecurityAuthenticateRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.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 d8914050e4..be41eb1684 100644 --- a/specification/security/bulk_delete_role/examples/request/SecurityBulkDeleteRoleRequestExample1.yaml +++ b/specification/security/bulk_delete_role/examples/request/SecurityBulkDeleteRoleRequestExample1.yaml @@ -7,46 +7,3 @@ 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"' - - language: Java - code: | - client.security().bulkDeleteRole(b -> b - .names(List.of("my_admin_role","my_user_role")) - ); diff --git a/specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample1.yaml b/specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample1.yaml index 13fb34b351..3e72b3ad2a 100644 --- a/specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample1.yaml +++ b/specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample1.yaml @@ -89,381 +89,3 @@ 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\"" - - language: Java - code: | - client.security().bulkPutRole(b -> b - .roles(Map.of("my_admin_role", RoleDescriptor.of(r -> r - .cluster("all") - .indices(i -> i - .fieldSecurity(f -> f - .grant(List.of("title","body")) - ) - .names(List.of("index1","index2")) - .privileges("all") - .query(q -> q - .match(m -> m - .field("title") - .query(FieldValue.of("foo")) - ) - ) - ) - .applications(a -> a - .application("myapp") - .privileges(List.of("admin","read")) - .resources("*") - ) - .metadata("version", JsonData.fromJson("1")) - .runAs("other_user")),"my_user_role", RoleDescriptor.of(ro -> ro - .cluster("all") - .indices(i -> i - .fieldSecurity(f -> f - .grant(List.of("title","body")) - ) - .names("index1") - .privileges("read") - .query(q -> q - .match(m -> m - .field("title") - .query(FieldValue.of("foo")) - ) - ) - ) - .applications(a -> a - .application("myapp") - .privileges(List.of("admin","read")) - .resources("*") - ) - .metadata("version", JsonData.fromJson("1")) - .runAs("other_user")))) - ); diff --git a/specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample2.yaml b/specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample2.yaml index c9900bd3f4..e45f838b2d 100644 --- a/specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample2.yaml +++ b/specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample2.yaml @@ -89,381 +89,3 @@ 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\"" - - language: Java - code: | - client.security().bulkPutRole(b -> b - .roles(Map.of("my_admin_role", RoleDescriptor.of(r -> r - .cluster("bad_cluster_privilege") - .indices(i -> i - .fieldSecurity(f -> f - .grant(List.of("title","body")) - ) - .names(List.of("index1","index2")) - .privileges("all") - .query(q -> q - .match(m -> m - .field("title") - .query(FieldValue.of("foo")) - ) - ) - ) - .applications(a -> a - .application("myapp") - .privileges(List.of("admin","read")) - .resources("*") - ) - .metadata("version", JsonData.fromJson("1")) - .runAs("other_user")),"my_user_role", RoleDescriptor.of(ro -> ro - .cluster("all") - .indices(i -> i - .fieldSecurity(f -> f - .grant(List.of("title","body")) - ) - .names("index1") - .privileges("read") - .query(q -> q - .match(m -> m - .field("title") - .query(FieldValue.of("foo")) - ) - ) - ) - .applications(a -> a - .application("myapp") - .privileges(List.of("admin","read")) - .resources("*") - ) - .metadata("version", JsonData.fromJson("1")) - .runAs("other_user")))) - ); diff --git a/specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample3.yaml b/specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample3.yaml index d9eb94eb0e..74ec03f870 100644 --- a/specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample3.yaml +++ b/specification/security/bulk_put_role/examples/request/SecurityBulkPutRoleRequestExample3.yaml @@ -20,136 +20,3 @@ 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\"" - - language: Java - code: | - client.security().putRole(p -> p - .name("only_remote_access_role") - .remoteCluster(r -> r - .clusters("my_remote") - .privileges(RemoteClusterPrivilege.MonitorStats) - ) - .remoteIndices(r -> r - .clusters("my_remote") - .names("logs*") - .privileges(List.of("read","read_cross_cluster","view_index_metadata")) - ) - ); 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 a8c91131a9..0bac538f41 100644 --- a/specification/security/bulk_update_api_keys/examples/request/SecurityBulkUpdateApiKeysRequestExample1.yaml +++ b/specification/security/bulk_update_api_keys/examples/request/SecurityBulkUpdateApiKeysRequestExample1.yaml @@ -21,148 +21,3 @@ 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\"" - - language: Java - code: | - client.security().bulkUpdateApiKeys(b -> b - .expiration(e -> e - .time("30d") - ) - .ids(List.of("VuaCfGcBCdbkQm-e5aOx","H3_AhoIBA9hmeQJdg7ij")) - .metadata("environment", JsonData.fromJson("{\"level\":2,\"trusted\":true,\"tags\":[\"production\"]}")) - .roleDescriptors("role-a", r -> r - .indices(i -> i - .names("*") - .privileges("write") - ) - ) - ); 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 2f37d7db5d..52284a6e11 100644 --- a/specification/security/bulk_update_api_keys/examples/request/SecurityBulkUpdateApiKeysRequestExample2.yaml +++ b/specification/security/bulk_update_api_keys/examples/request/SecurityBulkUpdateApiKeysRequestExample2.yaml @@ -8,51 +8,3 @@ 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"' - - language: Java - code: | - client.security().bulkUpdateApiKeys(b -> b - .ids(List.of("VuaCfGcBCdbkQm-e5aOx","H3_AhoIBA9hmeQJdg7ij")) - ); diff --git a/specification/security/change_password/examples/request/SecurityChangePasswordRequestExample1.yaml b/specification/security/change_password/examples/request/SecurityChangePasswordRequestExample1.yaml index 742dca7bba..2d593453db 100644 --- a/specification/security/change_password/examples/request/SecurityChangePasswordRequestExample1.yaml +++ b/specification/security/change_password/examples/request/SecurityChangePasswordRequestExample1.yaml @@ -7,42 +7,3 @@ 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"' - - language: Java - code: | - client.security().changePassword(c -> c - .password("new-test-password") - .username("jacknich") - ); 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 615cea1f15..19ca296a6b 100644 --- a/specification/security/clear_api_key_cache/examples/request/SecurityClearApiKeyCacheExample1.yaml +++ b/specification/security/clear_api_key_cache/examples/request/SecurityClearApiKeyCacheExample1.yaml @@ -1,30 +1 @@ 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"' - - language: Java - code: | - client.security().clearApiKeyCache(c -> c - .ids("yVGMr3QByxdh1MSaicYx") - ); diff --git a/specification/security/clear_cached_privileges/examples/request/SecurityClearCachedPrivilegesExample1.yaml b/specification/security/clear_cached_privileges/examples/request/SecurityClearCachedPrivilegesExample1.yaml index 90b5cfdddc..b824f2eb42 100644 --- a/specification/security/clear_cached_privileges/examples/request/SecurityClearCachedPrivilegesExample1.yaml +++ b/specification/security/clear_cached_privileges/examples/request/SecurityClearCachedPrivilegesExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.security().clearCachedPrivileges(c -> c - .application("myapp") - ); diff --git a/specification/security/clear_cached_realms/examples/request/SecurityClearCachedRealmsExample1.yaml b/specification/security/clear_cached_realms/examples/request/SecurityClearCachedRealmsExample1.yaml index 16855651ef..d47612457f 100644 --- a/specification/security/clear_cached_realms/examples/request/SecurityClearCachedRealmsExample1.yaml +++ b/specification/security/clear_cached_realms/examples/request/SecurityClearCachedRealmsExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.security().clearCachedRealms(c -> c - .realms("default_file") - ); diff --git a/specification/security/clear_cached_roles/examples/request/SecurityClearCachedRolesExample1.yaml b/specification/security/clear_cached_roles/examples/request/SecurityClearCachedRolesExample1.yaml index f0d251c0c0..d98c3ab756 100644 --- a/specification/security/clear_cached_roles/examples/request/SecurityClearCachedRolesExample1.yaml +++ b/specification/security/clear_cached_roles/examples/request/SecurityClearCachedRolesExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.security().clearCachedRoles(c -> c - .name("my_admin_role") - ); 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 d4f8b2cc28..717478f44a 100644 --- a/specification/security/clear_cached_service_tokens/examples/request/SecurityClearCachedServiceTokensExample1.yaml +++ b/specification/security/clear_cached_service_tokens/examples/request/SecurityClearCachedServiceTokensExample1.yaml @@ -1,40 +1 @@ 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"' - - language: Java - code: | - client.security().clearCachedServiceTokens(c -> c - .name("token1") - .namespace("elastic") - .service("fleet-server") - ); diff --git a/specification/security/create_api_key/examples/request/SecurityCreateApiKeyRequestExample1.yaml b/specification/security/create_api_key/examples/request/SecurityCreateApiKeyRequestExample1.yaml index 5a923a382b..875e2301c8 100644 --- a/specification/security/create_api_key/examples/request/SecurityCreateApiKeyRequestExample1.yaml +++ b/specification/security/create_api_key/examples/request/SecurityCreateApiKeyRequestExample1.yaml @@ -37,216 +37,3 @@ 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\"" - - language: Java - code: > - client.security().createApiKey(c -> c - .expiration(e -> e - .time("1d") - ) - .metadata(Map.of("environment", JsonData.fromJson("{\"level\":1,\"trusted\":true,\"tags\":[\"dev\",\"staging\"]}"),"application", JsonData.fromJson("\"my-application\""))) - .name("my-api-key") - .roleDescriptors(Map.of("role-b", RoleDescriptor.of(r -> r - .cluster("all") - .indices(i -> i - .names("index-b*") - .privileges("all") - )),"role-a", RoleDescriptor.of(r -> r - .cluster("all") - .indices(i -> i - .names("index-a*") - .privileges("read") - )))) - ); 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 703024bea3..49ca31a042 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,157 +28,3 @@ 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\"" - - language: Java - code: > - client.security().createCrossClusterApiKey(c -> c - .access(a -> a - .replication(r -> r - .names("archive*") - ) - .search(s -> s - .names("logs*") - ) - ) - .expiration(e -> e - .time("1d") - ) - .metadata(Map.of("environment", JsonData.fromJson("{\"level\":1,\"trusted\":true,\"tags\":[\"dev\",\"staging\"]}"),"description", JsonData.fromJson("\"phase one\""))) - .name("my-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 b32b52428b..a7e9b60c85 100644 --- a/specification/security/create_service_token/examples/request/CreateServiceTokenRequestExample1.yaml +++ b/specification/security/create_service_token/examples/request/CreateServiceTokenRequestExample1.yaml @@ -1,40 +1 @@ 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"' - - language: Java - code: | - client.security().createServiceToken(c -> c - .name("token1") - .namespace("elastic") - .service("fleet-server") - ); diff --git a/specification/security/delegate_pki/examples/request/SecurityDelegatePkiRequestExample1.yaml b/specification/security/delegate_pki/examples/request/SecurityDelegatePkiRequestExample1.yaml index f6e6fa973f..fced198508 100644 --- a/specification/security/delegate_pki/examples/request/SecurityDelegatePkiRequestExample1.yaml +++ b/specification/security/delegate_pki/examples/request/SecurityDelegatePkiRequestExample1.yaml @@ -18,81 +18,3 @@ value: "{ 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\"" - - language: Java - code: > - client.security().delegatePki(d -> d - .x509CertificateChain("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==") - ); diff --git a/specification/security/delete_privileges/examples/request/SecurityDeletePrivilegesRequestExample1.yaml b/specification/security/delete_privileges/examples/request/SecurityDeletePrivilegesRequestExample1.yaml index 164766b7ae..82493c1cf2 100644 --- a/specification/security/delete_privileges/examples/request/SecurityDeletePrivilegesRequestExample1.yaml +++ b/specification/security/delete_privileges/examples/request/SecurityDeletePrivilegesRequestExample1.yaml @@ -1,34 +1 @@ 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"' - - language: Java - code: | - client.security().deletePrivileges(d -> d - .application("myapp") - .name("read") - ); diff --git a/specification/security/delete_role/examples/request/SecurityDeleteRoleRequestExample1.yaml b/specification/security/delete_role/examples/request/SecurityDeleteRoleRequestExample1.yaml index 4c660873e3..2d33c5033a 100644 --- a/specification/security/delete_role/examples/request/SecurityDeleteRoleRequestExample1.yaml +++ b/specification/security/delete_role/examples/request/SecurityDeleteRoleRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.security().deleteRole(d -> d - .name("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 d868afbb0f..0844e2ce99 100644 --- a/specification/security/delete_role_mapping/examples/request/SecurityDeleteRoleMappingRequestExample1.yaml +++ b/specification/security/delete_role_mapping/examples/request/SecurityDeleteRoleMappingRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.security().deleteRoleMapping(d -> d - .name("mapping1") - ); diff --git a/specification/security/delete_service_token/examples/request/DeleteServiceTokenRequestExample1.yaml b/specification/security/delete_service_token/examples/request/DeleteServiceTokenRequestExample1.yaml index efcae991c9..e072e81aa8 100644 --- a/specification/security/delete_service_token/examples/request/DeleteServiceTokenRequestExample1.yaml +++ b/specification/security/delete_service_token/examples/request/DeleteServiceTokenRequestExample1.yaml @@ -1,40 +1 @@ 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"' - - language: Java - code: | - client.security().deleteServiceToken(d -> d - .name("token42") - .namespace("elastic") - .service("fleet-server") - ); diff --git a/specification/security/delete_user/examples/request/SecurityDeleteUserRequestExample1.yaml b/specification/security/delete_user/examples/request/SecurityDeleteUserRequestExample1.yaml index 83368844df..51f768bda3 100644 --- a/specification/security/delete_user/examples/request/SecurityDeleteUserRequestExample1.yaml +++ b/specification/security/delete_user/examples/request/SecurityDeleteUserRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.security().deleteUser(d -> d - .username("jacknich") - ); diff --git a/specification/security/disable_user/examples/request/SecurityDisableUserExample1.yaml b/specification/security/disable_user/examples/request/SecurityDisableUserExample1.yaml index 1677c68d01..9b277ada09 100644 --- a/specification/security/disable_user/examples/request/SecurityDisableUserExample1.yaml +++ b/specification/security/disable_user/examples/request/SecurityDisableUserExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.security().disableUser(d -> d - .username("jacknich") - ); diff --git a/specification/security/disable_user_profile/examples/request/SecurityDisableUserProfileExample1.yaml b/specification/security/disable_user_profile/examples/request/SecurityDisableUserProfileExample1.yaml index c98f6e4e96..5a913badc6 100644 --- a/specification/security/disable_user_profile/examples/request/SecurityDisableUserProfileExample1.yaml +++ b/specification/security/disable_user_profile/examples/request/SecurityDisableUserProfileExample1.yaml @@ -1,30 +1 @@ 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"' - - language: Java - code: | - client.security().disableUserProfile(d -> d - .uid("u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0") - ); diff --git a/specification/security/enable_user/examples/request/SecurityEnableUserExample1.yaml b/specification/security/enable_user/examples/request/SecurityEnableUserExample1.yaml index bf94a1ed6c..4e9a5b5a4b 100644 --- a/specification/security/enable_user/examples/request/SecurityEnableUserExample1.yaml +++ b/specification/security/enable_user/examples/request/SecurityEnableUserExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.security().enableUser(e -> e - .username("logstash_system") - ); diff --git a/specification/security/enable_user_profile/examples/request/SecurityEnableUserProfileExample1.yaml b/specification/security/enable_user_profile/examples/request/SecurityEnableUserProfileExample1.yaml index d85ffdb2cd..0eb63f53b1 100644 --- a/specification/security/enable_user_profile/examples/request/SecurityEnableUserProfileExample1.yaml +++ b/specification/security/enable_user_profile/examples/request/SecurityEnableUserProfileExample1.yaml @@ -1,30 +1 @@ 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"' - - language: Java - code: | - client.security().enableUserProfile(e -> e - .uid("u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0") - ); diff --git a/specification/security/enroll_kibana/examples/request/EnrollKibanaRequestExample1.yaml b/specification/security/enroll_kibana/examples/request/EnrollKibanaRequestExample1.yaml index e1c5a346f7..f9d13d8221 100644 --- a/specification/security/enroll_kibana/examples/request/EnrollKibanaRequestExample1.yaml +++ b/specification/security/enroll_kibana/examples/request/EnrollKibanaRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.security().enrollKibana(); diff --git a/specification/security/get_api_key/examples/request/SecurityGetApiKeyRequestExample2.yaml b/specification/security/get_api_key/examples/request/SecurityGetApiKeyRequestExample2.yaml index dec2ee0a15..d01a5d4562 100644 --- a/specification/security/get_api_key/examples/request/SecurityGetApiKeyRequestExample2.yaml +++ b/specification/security/get_api_key/examples/request/SecurityGetApiKeyRequestExample2.yaml @@ -1,35 +1 @@ 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"' - - language: Java - code: | - client.security().getApiKey(g -> g - .realmName("native1") - .username("myuser") - ); diff --git a/specification/security/get_builtin_privileges/examples/request/SecurityGetBuiltinPrivilegesRequestExample1.yaml b/specification/security/get_builtin_privileges/examples/request/SecurityGetBuiltinPrivilegesRequestExample1.yaml index 0b7e107530..f2787c15c6 100644 --- a/specification/security/get_builtin_privileges/examples/request/SecurityGetBuiltinPrivilegesRequestExample1.yaml +++ b/specification/security/get_builtin_privileges/examples/request/SecurityGetBuiltinPrivilegesRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.security().getBuiltinPrivileges(); diff --git a/specification/security/get_privileges/examples/request/SecurityGetPrivilegesRequestExample1.yaml b/specification/security/get_privileges/examples/request/SecurityGetPrivilegesRequestExample1.yaml index a5b4e53c35..e88cd1e08d 100644 --- a/specification/security/get_privileges/examples/request/SecurityGetPrivilegesRequestExample1.yaml +++ b/specification/security/get_privileges/examples/request/SecurityGetPrivilegesRequestExample1.yaml @@ -1,34 +1 @@ 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"' - - language: Java - code: | - client.security().getPrivileges(g -> g - .application("myapp") - .name("read") - ); diff --git a/specification/security/get_role/examples/request/SecurityGetRoleRequestExample1.yaml b/specification/security/get_role/examples/request/SecurityGetRoleRequestExample1.yaml index 7e80d08d53..49df6d76a6 100644 --- a/specification/security/get_role/examples/request/SecurityGetRoleRequestExample1.yaml +++ b/specification/security/get_role/examples/request/SecurityGetRoleRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.security().getRole(g -> g - .name("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 34ef6c9a40..49a6a976b2 100644 --- a/specification/security/get_role_mapping/examples/request/SecurityGetRoleMappingRequestExample1.yaml +++ b/specification/security/get_role_mapping/examples/request/SecurityGetRoleMappingRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.security().getRoleMapping(g -> g - .name("mapping1") - ); diff --git a/specification/security/get_service_accounts/examples/request/GetServiceAccountsRequestExample1.yaml b/specification/security/get_service_accounts/examples/request/GetServiceAccountsRequestExample1.yaml index 3622609813..93531186a5 100644 --- a/specification/security/get_service_accounts/examples/request/GetServiceAccountsRequestExample1.yaml +++ b/specification/security/get_service_accounts/examples/request/GetServiceAccountsRequestExample1.yaml @@ -1,34 +1 @@ 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"' - - language: Java - code: | - client.security().getServiceAccounts(g -> g - .namespace("elastic") - .service("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 9edb57a158..40c009c1a9 100644 --- a/specification/security/get_service_credentials/examples/request/GetServiceCredentialsRequestExample1.yaml +++ b/specification/security/get_service_credentials/examples/request/GetServiceCredentialsRequestExample1.yaml @@ -1,35 +1 @@ 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"' - - language: Java - code: | - client.security().getServiceCredentials(g -> g - .namespace("elastic") - .service("fleet-server") - ); diff --git a/specification/security/get_settings/examples/request/SecurityGetSettingsExample1.yaml b/specification/security/get_settings/examples/request/SecurityGetSettingsExample1.yaml index 83c295d324..db30177b6a 100644 --- a/specification/security/get_settings/examples/request/SecurityGetSettingsExample1.yaml +++ b/specification/security/get_settings/examples/request/SecurityGetSettingsExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.security().getSettings(g -> g); diff --git a/specification/security/get_token/examples/request/GetUserAccessTokenRequestExample1.yaml b/specification/security/get_token/examples/request/GetUserAccessTokenRequestExample1.yaml index ebb4b9f89a..f776ae108e 100644 --- a/specification/security/get_token/examples/request/GetUserAccessTokenRequestExample1.yaml +++ b/specification/security/get_token/examples/request/GetUserAccessTokenRequestExample1.yaml @@ -8,37 +8,3 @@ 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"' - - language: Java - code: | - client.security().getToken(g -> g - .grantType(AccessTokenGrantType.ClientCredentials) - ); diff --git a/specification/security/get_token/examples/request/GetUserAccessTokenRequestExample2.yaml b/specification/security/get_token/examples/request/GetUserAccessTokenRequestExample2.yaml index b33982cd33..d627cb6507 100644 --- a/specification/security/get_token/examples/request/GetUserAccessTokenRequestExample2.yaml +++ b/specification/security/get_token/examples/request/GetUserAccessTokenRequestExample2.yaml @@ -11,48 +11,3 @@ 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"' - - language: Java - code: | - client.security().getToken(g -> g - .grantType(AccessTokenGrantType.Password) - .password("x-pack-test-password") - .username("test_admin") - ); diff --git a/specification/security/get_user/examples/request/SecurityGetUserRequestExample1.yaml b/specification/security/get_user/examples/request/SecurityGetUserRequestExample1.yaml index d109f5799b..71eb4c9b92 100644 --- a/specification/security/get_user/examples/request/SecurityGetUserRequestExample1.yaml +++ b/specification/security/get_user/examples/request/SecurityGetUserRequestExample1.yaml @@ -1,34 +1 @@ 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"' - - language: Java - code: | - client.security().getUser(g -> g - .username("jacknich") - .withProfileUid(true) - ); diff --git a/specification/security/get_user_privileges/examples/request/SecurityGetUserPrivilegesRequestExample1.yaml b/specification/security/get_user_privileges/examples/request/SecurityGetUserPrivilegesRequestExample1.yaml index df1209dd40..d5b5273802 100644 --- a/specification/security/get_user_privileges/examples/request/SecurityGetUserPrivilegesRequestExample1.yaml +++ b/specification/security/get_user_privileges/examples/request/SecurityGetUserPrivilegesRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.security().getUserPrivileges(g -> g); diff --git a/specification/security/get_user_profile/examples/request/GetUserProfileRequestExample1.yaml b/specification/security/get_user_profile/examples/request/GetUserProfileRequestExample1.yaml index 9f13784e8e..2c54c0f69d 100644 --- a/specification/security/get_user_profile/examples/request/GetUserProfileRequestExample1.yaml +++ b/specification/security/get_user_profile/examples/request/GetUserProfileRequestExample1.yaml @@ -1,30 +1 @@ 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"' - - language: Java - code: | - client.security().getUserProfile(g -> g - .uid("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 b1e119fe2e..098e51e7d9 100644 --- a/specification/security/grant_api_key/examples/request/SecurityGrantApiKeyRequestExample1.yaml +++ b/specification/security/grant_api_key/examples/request/SecurityGrantApiKeyRequestExample1.yaml @@ -41,242 +41,3 @@ 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\"" - - language: Java - code: > - client.security().grantApiKey(g -> g - .apiKey(a -> a - .name("my-api-key") - .expiration(e -> e - .time("1d") - ) - .roleDescriptors(Map.of("role-b", RoleDescriptor.of(r -> r - .cluster("all") - .indices(i -> i - .names("index-b*") - .privileges("all") - )),"role-a", RoleDescriptor.of(r -> r - .cluster("all") - .indices(i -> i - .names("index-a*") - .privileges("read") - )))) - .metadata(Map.of("environment", JsonData.fromJson("{\"level\":1,\"trusted\":true,\"tags\":[\"dev\",\"staging\"]}"),"application", JsonData.fromJson("\"my-application\""))) - ) - .grantType(ApiKeyGrantType.Password) - .password("x-pack-test-password") - .username("test_admin") - ); diff --git a/specification/security/grant_api_key/examples/request/SecurityGrantApiKeyRequestExample2.yaml b/specification/security/grant_api_key/examples/request/SecurityGrantApiKeyRequestExample2.yaml index eb6ea7c222..87d0eb83c7 100644 --- a/specification/security/grant_api_key/examples/request/SecurityGrantApiKeyRequestExample2.yaml +++ b/specification/security/grant_api_key/examples/request/SecurityGrantApiKeyRequestExample2.yaml @@ -14,68 +14,3 @@ 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\"" - - language: Java - code: | - client.security().grantApiKey(g -> g - .apiKey(a -> a - .name("another-api-key") - ) - .grantType(ApiKeyGrantType.Password) - .password("x-pack-test-password") - .runAs("test_user") - .username("test_admin") - ); diff --git a/specification/security/has_privileges/examples/request/SecurityHasPrivilegesRequestExample1.yaml b/specification/security/has_privileges/examples/request/SecurityHasPrivilegesRequestExample1.yaml index ce8bcfc7a8..2dfde26ee4 100644 --- a/specification/security/has_privileges/examples/request/SecurityHasPrivilegesRequestExample1.yaml +++ b/specification/security/has_privileges/examples/request/SecurityHasPrivilegesRequestExample1.yaml @@ -25,172 +25,3 @@ 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\"" - - language: Java - code: | - client.security().hasPrivileges(h -> h - .application(a -> a - .application("inventory_manager") - .privileges(List.of("read","data:write/inventory")) - .resources("product/1852563") - ) - .cluster(List.of("monitor","manage")) - .index(List.of(IndexPrivilegesCheck.of(i -> i - .names(List.of("suppliers","products")) - .privileges("read")),IndexPrivilegesCheck.of(i -> i - .names("inventory") - .privileges(List.of("read","write"))))) - ); 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 ac947427f8..0b72ee49a1 100644 --- a/specification/security/has_privileges_user_profile/examples/request/HasPrivilegesUserProfileRequestExample1.yaml +++ b/specification/security/has_privileges_user_profile/examples/request/HasPrivilegesUserProfileRequestExample1.yaml @@ -32,207 +32,3 @@ 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\"" - - language: Java - code: > - client.security().hasPrivilegesUserProfile(h -> h - .privileges(p -> p - .application(a -> a - .application("inventory_manager") - .privileges(List.of("read","data:write/inventory")) - .resources("product/1852563") - ) - .cluster(List.of("monitor","create_snapshot","manage_ml")) - .index(List.of(IndexPrivilegesCheck.of(i -> i - .names(List.of("suppliers","products")) - .privileges("create_doc")),IndexPrivilegesCheck.of(i -> i - .names("inventory") - .privileges(List.of("read","write"))))) - ) - .uids(List.of("u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0","u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1","u_does-not-exist_0")) - ); diff --git a/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample1.yaml b/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample1.yaml index 876c5a2e1f..8178b35106 100644 --- a/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample1.yaml +++ b/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample1.yaml @@ -6,43 +6,3 @@ 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"' - - language: Java - code: | - client.security().invalidateApiKey(i -> i - .ids("VuaCfGcBCdbkQm-e5aOx") - ); diff --git a/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample2.yaml b/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample2.yaml index 38f30b5781..47d23583f6 100644 --- a/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample2.yaml +++ b/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample2.yaml @@ -6,37 +6,3 @@ 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"' - - language: Java - code: | - client.security().invalidateApiKey(i -> i - .name("my-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 e0a9f45d98..ec726f5570 100644 --- a/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample3.yaml +++ b/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample3.yaml @@ -6,37 +6,3 @@ 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"' - - language: Java - code: | - client.security().invalidateApiKey(i -> i - .realmName("native1") - ); diff --git a/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample4.yaml b/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample4.yaml index bf032bf505..fdfcf4f9d4 100644 --- a/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample4.yaml +++ b/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample4.yaml @@ -6,37 +6,3 @@ 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"' - - language: Java - code: | - client.security().invalidateApiKey(i -> i - .username("myuser") - ); diff --git a/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample5.yaml b/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample5.yaml index 59da02e605..58b4bc8490 100644 --- a/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample5.yaml +++ b/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample5.yaml @@ -7,48 +7,3 @@ 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"' - - language: Java - code: | - client.security().invalidateApiKey(i -> i - .ids("VuaCfGcBCdbkQm-e5aOx") - .owner(true) - ); diff --git a/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample6.yaml b/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample6.yaml index 4e1ca7a69b..e14be85655 100644 --- a/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample6.yaml +++ b/specification/security/invalidate_api_key/examples/request/SecurityInvalidateApiKeyRequestExample6.yaml @@ -7,42 +7,3 @@ 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"' - - language: Java - code: | - client.security().invalidateApiKey(i -> i - .realmName("native1") - .username("myuser") - ); diff --git a/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample1.yaml b/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample1.yaml index 03a3377aab..afba06ea7f 100644 --- a/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample1.yaml +++ b/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample1.yaml @@ -7,39 +7,3 @@ 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"' - - language: Java - code: | - client.security().invalidateToken(i -> i - .token("dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==") - ); diff --git a/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample2.yaml b/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample2.yaml index 4178e2ad85..e96cc83ecf 100644 --- a/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample2.yaml +++ b/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample2.yaml @@ -7,37 +7,3 @@ 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"' - - language: Java - code: | - client.security().invalidateToken(i -> i - .refreshToken("vLBPvmAB6KvwvJZr27cS") - ); diff --git a/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample3.yaml b/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample3.yaml index 56be7892b4..73f9627844 100644 --- a/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample3.yaml +++ b/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample3.yaml @@ -6,37 +6,3 @@ 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"' - - language: Java - code: | - client.security().invalidateToken(i -> i - .realmName("saml1") - ); diff --git a/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample4.yaml b/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample4.yaml index 394b3fe35b..176f328e65 100644 --- a/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample4.yaml +++ b/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample4.yaml @@ -6,37 +6,3 @@ 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"' - - language: Java - code: | - client.security().invalidateToken(i -> i - .username("myuser") - ); diff --git a/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample5.yaml b/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample5.yaml index 22096cc198..3941357e67 100644 --- a/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample5.yaml +++ b/specification/security/invalidate_token/examples/request/SecurityInvalidateTokenRequestExample5.yaml @@ -7,42 +7,3 @@ 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"' - - language: Java - code: | - client.security().invalidateToken(i -> i - .realmName("saml1") - .username("myuser") - ); diff --git a/specification/security/oidc_authenticate/examples/request/OidcAuthenticateRequestExample1.yaml b/specification/security/oidc_authenticate/examples/request/OidcAuthenticateRequestExample1.yaml index f992ece613..4bb5d4b600 100644 --- a/specification/security/oidc_authenticate/examples/request/OidcAuthenticateRequestExample1.yaml +++ b/specification/security/oidc_authenticate/examples/request/OidcAuthenticateRequestExample1.yaml @@ -12,55 +12,3 @@ 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\"" - - language: Java - code: > - client.security().oidcAuthenticate(o -> o - .nonce("WaBPH0KqPVdG5HHdSxPRjfoZbXMCicm5v1OiAj0DUFM") - .realm("oidc1") - .redirectUri("https://oidc-kibana.elastic.co:5603/api/security/oidc/callback?code=jtI3Ntt8v3_XvcLzCFGq&state=4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I") - .state("4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I") - ); diff --git a/specification/security/oidc_logout/examples/request/OidcLogoutRequestExample1.yaml b/specification/security/oidc_logout/examples/request/OidcLogoutRequestExample1.yaml index e845727c8e..f41ea4c820 100644 --- a/specification/security/oidc_logout/examples/request/OidcLogoutRequestExample1.yaml +++ b/specification/security/oidc_logout/examples/request/OidcLogoutRequestExample1.yaml @@ -7,44 +7,3 @@ 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\"" - - language: Java - code: | - client.security().oidcLogout(o -> o - .refreshToken("vLBPvmAB6KvwvJZr27cS") - .token("dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==") - ); diff --git a/specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample1.yaml b/specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample1.yaml index 9c23cb51f5..4f788b839c 100644 --- a/specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample1.yaml +++ b/specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample1.yaml @@ -7,37 +7,3 @@ 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"' - - language: Java - code: | - client.security().oidcPrepareAuthentication(o -> o - .realm("oidc1") - ); diff --git a/specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample2.yaml b/specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample2.yaml index e07f48c4ec..b84512551d 100644 --- a/specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample2.yaml +++ b/specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample2.yaml @@ -10,48 +10,3 @@ 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\"" - - language: Java - code: | - client.security().oidcPrepareAuthentication(o -> o - .nonce("zOBXLJGUooRrbLbQk5YCcyC8AXw3iloynvluYhZ5") - .realm("oidc1") - .state("lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO") - ); diff --git a/specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample3.yaml b/specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample3.yaml index 91b15b4f9d..9b0208d45d 100644 --- a/specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample3.yaml +++ b/specification/security/oidc_prepare_authentication/examples/request/OidcPrepareAuthenticationRequestExample3.yaml @@ -9,43 +9,3 @@ 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"' - - language: Java - code: | - client.security().oidcPrepareAuthentication(o -> o - .iss("http://127.0.0.1:8080") - .loginHint("this_is_an_opaque_string") - ); diff --git a/specification/security/put_privileges/examples/request/SecurityPutPrivilegesRequestExample1.yaml b/specification/security/put_privileges/examples/request/SecurityPutPrivilegesRequestExample1.yaml index 79ada2eea4..ff6678bd3d 100644 --- a/specification/security/put_privileges/examples/request/SecurityPutPrivilegesRequestExample1.yaml +++ b/specification/security/put_privileges/examples/request/SecurityPutPrivilegesRequestExample1.yaml @@ -19,82 +19,3 @@ 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"' - - language: Java - code: | - client.security().putPrivileges(p -> p - .privileges("myapp", "read", pr -> pr - .actions(List.of("data:read/*","action:login")) - .metadata("description", JsonData.fromJson("\"Read access to myapp\"")) - ) - ); diff --git a/specification/security/put_privileges/examples/request/SecurityPutPrivilegesRequestExample2.yaml b/specification/security/put_privileges/examples/request/SecurityPutPrivilegesRequestExample2.yaml index 647b36f6e6..50b41c054b 100644 --- a/specification/security/put_privileges/examples/request/SecurityPutPrivilegesRequestExample2.yaml +++ b/specification/security/put_privileges/examples/request/SecurityPutPrivilegesRequestExample2.yaml @@ -19,117 +19,3 @@ 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\"" - - language: Java - code: | - client.security().putPrivileges(p -> p - .privileges(Map.of("app02", "all", pr -> pr - .actions("*"),"app01", Map.of("read", Actions.of(a -> a - .actions(List.of("action:login","data:read/*"))),"write", Actions.of(a -> a - .actions(List.of("action:login","data:write/*")))))) - ); diff --git a/specification/security/put_role/examples/request/SecurityPutRoleRequestExample1.yaml b/specification/security/put_role/examples/request/SecurityPutRoleRequestExample1.yaml index 428adb69ab..3f54366fb4 100644 --- a/specification/security/put_role/examples/request/SecurityPutRoleRequestExample1.yaml +++ b/specification/security/put_role/examples/request/SecurityPutRoleRequestExample1.yaml @@ -28,207 +28,3 @@ 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\"" - - language: Java - code: | - client.security().putRole(p -> p - .applications(a -> a - .application("myapp") - .privileges(List.of("admin","read")) - .resources("*") - ) - .cluster("all") - .description("Grants full access to all management features within the cluster.") - .indices(i -> i - .fieldSecurity(f -> f - .grant(List.of("title","body")) - ) - .names(List.of("index1","index2")) - .privileges("all") - .query(q -> q - .match(m -> m - .field("title") - .query(FieldValue.of("foo")) - ) - ) - ) - .metadata("version", JsonData.fromJson("1")) - .name("my_admin_role") - .runAs("other_user") - ); diff --git a/specification/security/put_role/examples/request/SecurityPutRoleRequestExample2.yaml b/specification/security/put_role/examples/request/SecurityPutRoleRequestExample2.yaml index 2c278e2b53..531cb552ba 100644 --- a/specification/security/put_role/examples/request/SecurityPutRoleRequestExample2.yaml +++ b/specification/security/put_role/examples/request/SecurityPutRoleRequestExample2.yaml @@ -12,92 +12,3 @@ 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\"" - - language: Java - code: | - client.security().putRole(p -> p - .cluster("cluster:monitor/main") - .indices(i -> i - .names("test") - .privileges(List.of("read","indices:admin/get")) - ) - .name("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 d9eb94eb0e..74ec03f870 100644 --- a/specification/security/put_role/examples/request/SecurityPutRoleRequestExample3.yaml +++ b/specification/security/put_role/examples/request/SecurityPutRoleRequestExample3.yaml @@ -20,136 +20,3 @@ 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\"" - - language: Java - code: | - client.security().putRole(p -> p - .name("only_remote_access_role") - .remoteCluster(r -> r - .clusters("my_remote") - .privileges(RemoteClusterPrivilege.MonitorStats) - ) - .remoteIndices(r -> r - .clusters("my_remote") - .names("logs*") - .privileges(List.of("read","read_cross_cluster","view_index_metadata")) - ) - ); diff --git a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample1.yaml b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample1.yaml index fefeee3de3..1f3359b130 100644 --- a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample1.yaml +++ b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample1.yaml @@ -14,90 +14,3 @@ 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"' - - language: Java - code: | - client.security().putRoleMapping(p -> p - .enabled(true) - .metadata("version", JsonData.fromJson("1")) - .name("mapping1") - .roles("user") - .rules(r -> r - .field(NamedValue.of("username",List.of(FieldValue.of("*")))) - ) - ); diff --git a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample2.yaml b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample2.yaml index f8318bbac3..ab7b53ca08 100644 --- a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample2.yaml +++ b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample2.yaml @@ -11,89 +11,3 @@ 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"' - - language: Java - code: | - client.security().putRoleMapping(p -> p - .enabled(true) - .name("mapping2") - .roles(List.of("user","admin")) - .rules(r -> r - .field(NamedValue.of("username",List.of(FieldValue.of("esadmin01"),FieldValue.of("esadmin02")))) - ) - ); diff --git a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample3.yaml b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample3.yaml index a5c21b5cc5..8419cd938e 100644 --- a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample3.yaml +++ b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample3.yaml @@ -11,77 +11,3 @@ 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"' - - language: Java - code: | - client.security().putRoleMapping(p -> p - .enabled(true) - .name("mapping3") - .roles("ldap-user") - .rules(r -> r - .field(NamedValue.of("realm.name",List.of(FieldValue.of("ldap1")))) - ) - ); diff --git a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample4.yaml b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample4.yaml index d0986c0443..06b4d74c76 100644 --- a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample4.yaml +++ b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample4.yaml @@ -25,119 +25,3 @@ 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\"" - - language: Java - code: | - client.security().putRoleMapping(p -> p - .enabled(true) - .name("mapping4") - .roles("superuser") - .rules(r -> r - .any(List.of(RoleMappingRule.of(ro -> ro - .field(NamedValue.of("username",List.of(FieldValue.of("esadmin")) - ))), RoleMappingRule.of(rol -> rol - .field(NamedValue.of("groups",List.of(FieldValue.of("cn=admins,dc=example,dc=com")) - ))) - ) - ) - ) - ); diff --git a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample5.yaml b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample5.yaml index 461b2245f8..cf5b204804 100644 --- a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample5.yaml +++ b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample5.yaml @@ -17,106 +17,3 @@ 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\"" - - language: Java - code: | - client.security().putRoleMapping(p -> p - .enabled(true) - .name("mapping5") - .roleTemplates(r -> r - .format(TemplateFormat.Json) - .template(t -> t - .source(s -> s - .scriptString("{{#tojson}}groups{{/tojson}}") - ) - ) - ) - .rules(ru -> ru - .field(NamedValue.of("realm.name",List.of(FieldValue.of("saml1")))) - ) - ); diff --git a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample6.yaml b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample6.yaml index 22d2badaf5..7143d772ef 100644 --- a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample6.yaml +++ b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample6.yaml @@ -26,106 +26,3 @@ 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\"" - - language: Java - code: | - client.security().putRoleMapping(p -> p - .enabled(true) - .name("mapping6") - .roleTemplates(r -> r - .format(TemplateFormat.Json) - .template(t -> t - .source(s -> s - .scriptString("{{#tojson}}groups{{/tojson}}") - ) - ) - ) - .rules(ru -> ru - .field(NamedValue.of("realm.name",List.of(FieldValue.of("saml1")))) - ) - ); diff --git a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample7.yaml b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample7.yaml index 68065aad06..a553449400 100644 --- a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample7.yaml +++ b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample7.yaml @@ -14,119 +14,3 @@ 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\"" - - language: Java - code: | - client.security().putRoleMapping(p -> p - .enabled(true) - .name("mapping7") - .roles("ldap-example-user") - .rules(r -> r - .all(List.of(RoleMappingRule.of(ro -> ro - .field(NamedValue.of("dn",List.of(FieldValue.of("*,ou=subtree,dc=example,dc=com")) - ))), RoleMappingRule.of(rol -> rol - .field(NamedValue.of("realm.name",List.of(FieldValue.of("ldap1")) - ))) - ) - ) - ) - ); diff --git a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample8.yaml b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample8.yaml index b536b8f441..5c324a7972 100644 --- a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample8.yaml +++ b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample8.yaml @@ -41,207 +41,3 @@ 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\"" - - language: Java - code: | - client.security().putRoleMapping(p -> p - .enabled(true) - .name("mapping8") - .roles("superuser") - .rules(r -> r - .all(List.of(RoleMappingRule.of(ro -> ro - .any(List.of(RoleMappingRule.of(rol -> rol - .field(NamedValue.of("dn", List.of(FieldValue.of("*,ou=admin," + - "dc=example,dc=com")) - )) - ), RoleMappingRule.of(role -> role - .field(NamedValue.of("username", List.of(FieldValue.of("es-admin"), - FieldValue.of("es-system")) - )))), RoleMappingRule.of(roleM -> roleM - .field(NamedValue.of("groups", List.of(FieldValue.of("cn=people," + - "dc=example,dc=com")) - )), RoleMappingRule.of(roleMa -> roleMa - .except(e -> e - .field(NamedValue.of("metadata.terminated_date", - List.of(FieldValue.of(null)) - ) - )))) - ) - ) - ) - ) - ) - ); diff --git a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample9.yaml b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample9.yaml index d655b3e460..db32a00bf6 100644 --- a/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample9.yaml +++ b/specification/security/put_role_mapping/examples/request/SecurityPutRoleMappingRequestExample9.yaml @@ -15,125 +15,3 @@ 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\"" - - language: Java - code: | - client.security().putRoleMapping(p -> p - .enabled(true) - .name("mapping9") - .roleTemplates(List.of(RoleTemplate.of(r -> r - .template(t -> t - .source(s -> s - .scriptString("saml_user") - ) - )),RoleTemplate.of(ro -> ro - .template(t -> t - .source(s -> s - .scriptString("_user_{{username}}") - ) - )))) - .rules(ru -> ru - .field(NamedValue.of("realm.name",List.of(FieldValue.of("cloud-saml")))) - ) - ); diff --git a/specification/security/put_user/examples/request/SecurityPutUserRequestExample1.yaml b/specification/security/put_user/examples/request/SecurityPutUserRequestExample1.yaml index 32e52bf8d1..5d14f8d8ba 100644 --- a/specification/security/put_user/examples/request/SecurityPutUserRequestExample1.yaml +++ b/specification/security/put_user/examples/request/SecurityPutUserRequestExample1.yaml @@ -12,81 +12,3 @@ 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"' - - language: Java - code: | - client.security().putUser(p -> p - .email("jacknich@example.com") - .fullName("Jack Nicholson") - .metadata("intelligence", JsonData.fromJson("7")) - .password("l0ng-r4nd0m-p@ssw0rd") - .roles(List.of("admin","other_role1")) - .username("jacknich") - ); diff --git a/specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample1.yaml b/specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample1.yaml index 11ec85a421..8a41ec3283 100644 --- a/specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample1.yaml +++ b/specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample1.yaml @@ -12,69 +12,3 @@ 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"' - - language: Java - code: | - client.security().queryApiKeys(q -> q - .query(qu -> qu - .ids(i -> i - .values("VuaCfGcBCdbkQm-e5aOx") - ) - ) - .withLimitedBy(true) - ); diff --git a/specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample2.yaml b/specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample2.yaml index c593fb136d..95c96610a5 100644 --- a/specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample2.yaml +++ b/specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample2.yaml @@ -51,258 +51,3 @@ 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\"" - - language: Java - code: | - client.security().queryApiKeys(q -> q - .from(20) - .query(qu -> qu - .bool(b -> b - .filter(List.of(Query.of(que -> que - .wildcard(w -> w - .field("username") - .value("org-*-user") - )),Query.of(quer -> quer - .term(t -> t - .field("metadata.environment") - .value(FieldValue.of("production")) - )))) - .must(List.of(Query.of(query -> query - .prefix(p -> p - .field("name") - .value("app1-key-") - )),Query.of(query1 -> query1 - .term(t -> t - .field("invalidated") - .value(FieldValue.of("false")) - )))) - .mustNot(m -> m - .term(t -> t - .field("name") - .value(FieldValue.of("app1-key-01")) - ) - ) - ) - ) - .size(10) - .sort(List.of(SortOptions.of(s -> s - .field(f -> f - .field("creation") - .order(SortOrder.Desc) - .format("date_time") - )),SortOptions.of(so -> so - .field(f -> f - .field("name") - )))) - ); diff --git a/specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample3.yaml b/specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample3.yaml index 0040fb82a5..8e572b2192 100644 --- a/specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample3.yaml +++ b/specification/security/query_api_keys/examples/request/QueryApiKeysRequestExample3.yaml @@ -12,66 +12,3 @@ 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"' - - language: Java - code: | - client.security().queryApiKeys(q -> q - .query(qu -> qu - .term(t -> t - .field("name") - .value(FieldValue.of("application-key-1")) - ) - ) - ); diff --git a/specification/security/query_role/examples/request/QueryRolesRequestExample1.yaml b/specification/security/query_role/examples/request/QueryRolesRequestExample1.yaml index f2495e4fb9..922ce173cd 100644 --- a/specification/security/query_role/examples/request/QueryRolesRequestExample1.yaml +++ b/specification/security/query_role/examples/request/QueryRolesRequestExample1.yaml @@ -6,47 +6,3 @@ 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"' - - language: Java - code: | - client.security().queryRole(q -> q - .sort(s -> s - .field(f -> f - .field("name") - ) - ) - ); diff --git a/specification/security/query_role/examples/request/QueryRolesRequestExample2.yaml b/specification/security/query_role/examples/request/QueryRolesRequestExample2.yaml index d64d48d5c0..7e4a823d05 100644 --- a/specification/security/query_role/examples/request/QueryRolesRequestExample2.yaml +++ b/specification/security/query_role/examples/request/QueryRolesRequestExample2.yaml @@ -15,72 +15,3 @@ 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"' - - language: Java - code: | - client.security().queryRole(q -> q - .query(qu -> qu - .match(m -> m - .field("description") - .query(FieldValue.of("user access")) - ) - ) - .size(1) - ); diff --git a/specification/security/query_user/examples/request/SecurityQueryUserRequestExample1.yaml b/specification/security/query_user/examples/request/SecurityQueryUserRequestExample1.yaml index ac83a0f9a7..a55f4c79fc 100644 --- a/specification/security/query_user/examples/request/SecurityQueryUserRequestExample1.yaml +++ b/specification/security/query_user/examples/request/SecurityQueryUserRequestExample1.yaml @@ -12,63 +12,3 @@ 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"' - - language: Java - code: | - client.security().queryUser(q -> q - .query(qu -> qu - .prefix(p -> p - .field("roles") - .value("other") - ) - ) - .withProfileUid(true) - ); diff --git a/specification/security/query_user/examples/request/SecurityQueryUserRequestExample2.yaml b/specification/security/query_user/examples/request/SecurityQueryUserRequestExample2.yaml index 52eb6ce7ac..3f8c912928 100644 --- a/specification/security/query_user/examples/request/SecurityQueryUserRequestExample2.yaml +++ b/specification/security/query_user/examples/request/SecurityQueryUserRequestExample2.yaml @@ -37,189 +37,3 @@ 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\"" - - language: Java - code: | - client.security().queryUser(q -> q - .from(1) - .query(qu -> qu - .bool(b -> b - .filter(f -> f - .wildcard(w -> w - .field("roles") - .value("*other*") - ) - ) - .must(List.of(Query.of(que -> que - .wildcard(w -> w - .field("email") - .value("*example.com") - )),Query.of(quer -> quer - .term(t -> t - .field("enabled") - .value(FieldValue.of(true)) - )))) - ) - ) - .size(2) - .sort(s -> s - .field(fi -> fi - .field("username") - .order(SortOrder.Desc) - ) - ) - ); diff --git a/specification/security/saml_authenticate/examples/request/SamlAuthenticateRequestExample1.yaml b/specification/security/saml_authenticate/examples/request/SamlAuthenticateRequestExample1.yaml index e038bad142..b018b0b111 100644 --- a/specification/security/saml_authenticate/examples/request/SamlAuthenticateRequestExample1.yaml +++ b/specification/security/saml_authenticate/examples/request/SamlAuthenticateRequestExample1.yaml @@ -9,51 +9,3 @@ 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\"" - - language: Java - code: > - client.security().samlAuthenticate(s -> s - .content("PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....") - .ids("4fee3b046395c4e751011e97f8900b5273d56685") - ); diff --git a/specification/security/saml_complete_logout/examples/request/SamlCompleteLogoutRequestExample1.yaml b/specification/security/saml_complete_logout/examples/request/SamlCompleteLogoutRequestExample1.yaml index 0be3224f98..a82f894279 100644 --- a/specification/security/saml_complete_logout/examples/request/SamlCompleteLogoutRequestExample1.yaml +++ b/specification/security/saml_complete_logout/examples/request/SamlCompleteLogoutRequestExample1.yaml @@ -9,56 +9,3 @@ 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\"" - - language: Java - code: > - client.security().samlCompleteLogout(s -> s - .ids("_1c368075e0b3...") - .queryString("SAMLResponse=fZHLasMwEEVbfb1bf...&SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=CuCmFn%2BLqnaZGZJqK...") - .realm("saml1") - ); diff --git a/specification/security/saml_complete_logout/examples/request/SamlCompleteLogoutRequestExample2.yaml b/specification/security/saml_complete_logout/examples/request/SamlCompleteLogoutRequestExample2.yaml index ed2f2c0189..0e5aab05da 100644 --- a/specification/security/saml_complete_logout/examples/request/SamlCompleteLogoutRequestExample2.yaml +++ b/specification/security/saml_complete_logout/examples/request/SamlCompleteLogoutRequestExample2.yaml @@ -9,54 +9,3 @@ 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"' - - language: Java - code: | - client.security().samlCompleteLogout(s -> s - .content("PHNhbWxwOkxvZ291dFJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46...") - .ids("_1c368075e0b3...") - .realm("saml1") - ); diff --git a/specification/security/saml_invalidate/examples/request/SamlInvalidateRequestExample1.yaml b/specification/security/saml_invalidate/examples/request/SamlInvalidateRequestExample1.yaml index ce8506c932..2a254d1496 100644 --- a/specification/security/saml_invalidate/examples/request/SamlInvalidateRequestExample1.yaml +++ b/specification/security/saml_invalidate/examples/request/SamlInvalidateRequestExample1.yaml @@ -9,49 +9,3 @@ 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\"" - - language: Java - code: > - client.security().samlInvalidate(s -> s - .queryString("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") - ); diff --git a/specification/security/saml_logout/examples/request/SamlLogoutRequestExample1.yaml b/specification/security/saml_logout/examples/request/SamlLogoutRequestExample1.yaml index da5f7612a8..a759311d96 100644 --- a/specification/security/saml_logout/examples/request/SamlLogoutRequestExample1.yaml +++ b/specification/security/saml_logout/examples/request/SamlLogoutRequestExample1.yaml @@ -9,43 +9,3 @@ 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"' - - language: Java - code: | - client.security().samlLogout(s -> s - .refreshToken("mJdXLtmvTUSpoLwMvdBt_w") - .token("46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3") - ); diff --git a/specification/security/saml_prepare_authentication/examples/request/SamlPrepareAuthenticationRequestExample1.yaml b/specification/security/saml_prepare_authentication/examples/request/SamlPrepareAuthenticationRequestExample1.yaml index e96e9e97f6..04d4820ecf 100644 --- a/specification/security/saml_prepare_authentication/examples/request/SamlPrepareAuthenticationRequestExample1.yaml +++ b/specification/security/saml_prepare_authentication/examples/request/SamlPrepareAuthenticationRequestExample1.yaml @@ -7,37 +7,3 @@ 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"' - - language: Java - code: | - client.security().samlPrepareAuthentication(s -> s - .realm("saml1") - ); diff --git a/specification/security/saml_prepare_authentication/examples/request/SamlPrepareAuthenticationRequestExample2.yaml b/specification/security/saml_prepare_authentication/examples/request/SamlPrepareAuthenticationRequestExample2.yaml index cf65eaba71..721520c3ec 100644 --- a/specification/security/saml_prepare_authentication/examples/request/SamlPrepareAuthenticationRequestExample2.yaml +++ b/specification/security/saml_prepare_authentication/examples/request/SamlPrepareAuthenticationRequestExample2.yaml @@ -8,37 +8,3 @@ 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"' - - language: Java - code: | - client.security().samlPrepareAuthentication(s -> s - .acs("https://kibana.org/api/security/saml/callback") - ); 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 fece8d78cc..d19fa7f868 100644 --- a/specification/security/saml_service_provider_metadata/examples/request/SamlServiceProviderMetadataRequestExample1.yaml +++ b/specification/security/saml_service_provider_metadata/examples/request/SamlServiceProviderMetadataRequestExample1.yaml @@ -1,30 +1 @@ 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"' - - language: Java - code: | - client.security().updateUserProfileData(u -> u - .uid("u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0") - ); diff --git a/specification/security/suggest_user_profiles/examples/request/SuggestUserProfilesRequestExample1.yaml b/specification/security/suggest_user_profiles/examples/request/SuggestUserProfilesRequestExample1.yaml index 7f5a719312..ff5a8290bb 100644 --- a/specification/security/suggest_user_profiles/examples/request/SuggestUserProfilesRequestExample1.yaml +++ b/specification/security/suggest_user_profiles/examples/request/SuggestUserProfilesRequestExample1.yaml @@ -18,87 +18,3 @@ 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\"" - - language: Java - code: | - client.security().suggestUserProfiles(s -> s - .hint(h -> h - .uids(List.of("u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0","u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0")) - .labels("direction", List.of("north","east")) - ) - .name("jack") - ); diff --git a/specification/security/update_api_key/examples/request/UpdateApiKeyRequestExample1.yaml b/specification/security/update_api_key/examples/request/UpdateApiKeyRequestExample1.yaml index 0c485a87f3..f2fa4492bd 100644 --- a/specification/security/update_api_key/examples/request/UpdateApiKeyRequestExample1.yaml +++ b/specification/security/update_api_key/examples/request/UpdateApiKeyRequestExample1.yaml @@ -23,131 +23,3 @@ 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\"" - - language: Java - code: | - client.security().updateApiKey(u -> u - .id("VuaCfGcBCdbkQm-e5aOx") - .metadata("environment", JsonData.fromJson("{\"level\":2,\"trusted\":true,\"tags\":[\"production\"]}")) - .roleDescriptors("role-a", r -> r - .indices(i -> i - .names("*") - .privileges("write") - ) - ) - ); diff --git a/specification/security/update_api_key/examples/request/UpdateApiKeyRequestExample2.yaml b/specification/security/update_api_key/examples/request/UpdateApiKeyRequestExample2.yaml index c70a01f546..0bf7fd4922 100644 --- a/specification/security/update_api_key/examples/request/UpdateApiKeyRequestExample2.yaml +++ b/specification/security/update_api_key/examples/request/UpdateApiKeyRequestExample2.yaml @@ -8,41 +8,3 @@ 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"' - - language: Java - code: | - client.security().updateApiKey(u -> u - .id("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 02042fbef4..2928828495 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 @@ -17,90 +17,3 @@ 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"' - - language: Java - code: | - client.security().updateCrossClusterApiKey(u -> u - .access(a -> a - .replication(r -> r - .names("archive") - ) - ) - .id("VuaCfGcBCdbkQm-e5aOx") - .metadata("application", JsonData.fromJson("\"replication\"")) - ); diff --git a/specification/security/update_settings/examples/request/SecurityUpdateSettingsRequestExample1.yaml b/specification/security/update_settings/examples/request/SecurityUpdateSettingsRequestExample1.yaml index 5b0e1e14db..469d1ea0c9 100644 --- a/specification/security/update_settings/examples/request/SecurityUpdateSettingsRequestExample1.yaml +++ b/specification/security/update_settings/examples/request/SecurityUpdateSettingsRequestExample1.yaml @@ -14,72 +14,3 @@ 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\"" - - language: Java - code: | - client.security().updateSettings(u -> u - .security(s -> s) - .securityProfile(s -> s) - .securityTokens(s -> s) - ); 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 81d1a91ade..0cc16b17a0 100644 --- a/specification/security/update_user_profile_data/examples/request/UpdateUserProfileDataRequestExample1.yaml +++ b/specification/security/update_user_profile_data/examples/request/UpdateUserProfileDataRequestExample1.yaml @@ -15,72 +15,3 @@ 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"' - - language: Java - code: | - client.security().updateUserProfileData(u -> u - .data("app1", JsonData.fromJson("{\"theme\":\"default\"}")) - .labels("direction", JsonData.fromJson("\"east\"")) - .uid("u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0") - ); diff --git a/specification/shutdown/delete_node/examples/request/ShutdownDeleteNodeRequestExample1.yaml b/specification/shutdown/delete_node/examples/request/ShutdownDeleteNodeRequestExample1.yaml index c4524d927c..cb044b354d 100644 --- a/specification/shutdown/delete_node/examples/request/ShutdownDeleteNodeRequestExample1.yaml +++ b/specification/shutdown/delete_node/examples/request/ShutdownDeleteNodeRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.shutdown().deleteNode(d -> d - .nodeId("USpTGYaBSIKbgSUJR2Z9lg") - ); diff --git a/specification/shutdown/get_node/examples/request/ShutdownGetNodeRequestExample1.yaml b/specification/shutdown/get_node/examples/request/ShutdownGetNodeRequestExample1.yaml index a75490777c..0391f2dc2b 100644 --- a/specification/shutdown/get_node/examples/request/ShutdownGetNodeRequestExample1.yaml +++ b/specification/shutdown/get_node/examples/request/ShutdownGetNodeRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.shutdown().getNode(g -> g - .nodeId("USpTGYaBSIKbgSUJR2Z9lg") - ); diff --git a/specification/shutdown/put_node/examples/request/ShutdownPutNodeRequestExample1.yaml b/specification/shutdown/put_node/examples/request/ShutdownPutNodeRequestExample1.yaml index 7fb729e55e..529575b949 100644 --- a/specification/shutdown/put_node/examples/request/ShutdownPutNodeRequestExample1.yaml +++ b/specification/shutdown/put_node/examples/request/ShutdownPutNodeRequestExample1.yaml @@ -13,53 +13,3 @@ value: "{ \ \"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"' - - language: Java - code: | - client.shutdown().putNode(p -> p - .allocationDelay("20m") - .nodeId("USpTGYaBSIKbgSUJR2Z9lg") - .reason("Demonstrating how the node shutdown API works") - .type(Type.Restart) - ); diff --git a/specification/simulate/ingest/examples/request/SimulateIngestRequestExample1.yaml b/specification/simulate/ingest/examples/request/SimulateIngestRequestExample1.yaml index eed3a471cd..0140b08b47 100644 --- a/specification/simulate/ingest/examples/request/SimulateIngestRequestExample1.yaml +++ b/specification/simulate/ingest/examples/request/SimulateIngestRequestExample1.yaml @@ -15,104 +15,3 @@ 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\"" - - language: Java - code: | - client.simulate().ingest(i -> i - .docs(List.of(Document.of(d -> d - .id("123") - .index("my-index") - .source(JsonData.fromJson("{\"foo\":\"bar\"}"))),Document.of(d -> d - .id("456") - .index("my-index") - .source(JsonData.fromJson("{\"foo\":\"rab\"}"))))) - ); diff --git a/specification/simulate/ingest/examples/request/SimulateIngestRequestExample2.yaml b/specification/simulate/ingest/examples/request/SimulateIngestRequestExample2.yaml index 3aa330b5c5..6e95182822 100644 --- a/specification/simulate/ingest/examples/request/SimulateIngestRequestExample2.yaml +++ b/specification/simulate/ingest/examples/request/SimulateIngestRequestExample2.yaml @@ -21,156 +21,3 @@ 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\"" - - language: Java - code: | - client.simulate().ingest(i -> i - .docs(List.of(Document.of(d -> d - .id("123") - .index("my-index") - .source(JsonData.fromJson("{\"foo\":\"bar\"}"))),Document.of(d -> d - .id("456") - .index("my-index") - .source(JsonData.fromJson("{\"foo\":\"rab\"}"))))) - .pipelineSubstitutions("my-pipeline", p -> p - .processors(pr -> pr - .uppercase(u -> u - .field("foo") - ) - ) - ) - ); diff --git a/specification/simulate/ingest/examples/request/SimulateIngestRequestExample3.yaml b/specification/simulate/ingest/examples/request/SimulateIngestRequestExample3.yaml index b9f2b724a3..0b3081ff61 100644 --- a/specification/simulate/ingest/examples/request/SimulateIngestRequestExample3.yaml +++ b/specification/simulate/ingest/examples/request/SimulateIngestRequestExample3.yaml @@ -42,186 +42,3 @@ 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\"" - - language: Java - code: | - client.simulate().ingest(i -> i - .componentTemplateSubstitutions("my-mappings_template", c -> c - .template(t -> t - .mappings(m -> m - .dynamic(DynamicMapping.Strict) - .properties(Map.of("bar", Property.of(p -> p - .keyword(k -> k - )),"foo", Property.of(pr -> pr - .keyword(k -> k - )))) - ) - ) - ) - .docs(List.of(Document.of(d -> d - .id("123") - .index("my-index") - .source(JsonData.fromJson("{\"foo\":\"foo\"}"))),Document.of(d -> d - .id("456") - .index("my-index") - .source(JsonData.fromJson("{\"bar\":\"rab\"}"))))) - ); diff --git a/specification/simulate/ingest/examples/request/SimulateIngestRequestExample4.yaml b/specification/simulate/ingest/examples/request/SimulateIngestRequestExample4.yaml index 3bf9cf177e..3863b47248 100644 --- a/specification/simulate/ingest/examples/request/SimulateIngestRequestExample4.yaml +++ b/specification/simulate/ingest/examples/request/SimulateIngestRequestExample4.yaml @@ -43,335 +43,3 @@ 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\"" - - language: Java - code: | - client.simulate().ingest(i -> i - .componentTemplateSubstitutions("my-component-template", c -> c - .template(t -> t - .settings("index", s -> s - .defaultPipeline("my-pipeline") - ) - .mappings(m -> m - .dynamic(DynamicMapping.True) - .properties("field3", p -> p - .keyword(k -> k) - ) - ) - ) - ) - .docs(List.of(Document.of(d -> d - .id("id") - .index("my-index") - .source(JsonData.fromJson("{\"foo\":\"bar\"}"))),Document.of(d -> d - .id("id") - .index("my-index") - .source(JsonData.fromJson("{\"foo\":\"rab\"}"))))) - .indexTemplateSubstitutions("my-index-template", in -> in - .indexPatterns("my-index-*") - .composedOf(List.of("component_template_1","component_template_2")) - ) - .mappingAddition(m -> m - .dynamic(DynamicMapping.Strict) - .properties("foo", p -> p - .keyword(k -> k) - ) - ) - .pipelineSubstitutions("my-pipeline", p -> p - .processors(pr -> pr - .set(s -> s - .field("field3") - .value(JsonData.fromJson("\"value3\"")) - ) - ) - ) - ); diff --git a/specification/slm/delete_lifecycle/examples/request/SlmDeleteLifecycleExample1.yaml b/specification/slm/delete_lifecycle/examples/request/SlmDeleteLifecycleExample1.yaml index 7fde776d3b..b7692f83fb 100644 --- a/specification/slm/delete_lifecycle/examples/request/SlmDeleteLifecycleExample1.yaml +++ b/specification/slm/delete_lifecycle/examples/request/SlmDeleteLifecycleExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.slm().deleteLifecycle(d -> d - .policyId("daily-snapshots") - ); diff --git a/specification/slm/execute_lifecycle/examples/request/ExecuteSnapshotLifecycleRequestExample1.yaml b/specification/slm/execute_lifecycle/examples/request/ExecuteSnapshotLifecycleRequestExample1.yaml index 6c60f61e90..bea4f283d2 100644 --- a/specification/slm/execute_lifecycle/examples/request/ExecuteSnapshotLifecycleRequestExample1.yaml +++ b/specification/slm/execute_lifecycle/examples/request/ExecuteSnapshotLifecycleRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.slm().executeLifecycle(e -> e - .policyId("daily-snapshots") - ); diff --git a/specification/slm/execute_retention/examples/request/SlmExecuteRetentionExample1.yaml b/specification/slm/execute_retention/examples/request/SlmExecuteRetentionExample1.yaml index 2e98d83de3..baa2e6b8f1 100644 --- a/specification/slm/execute_retention/examples/request/SlmExecuteRetentionExample1.yaml +++ b/specification/slm/execute_retention/examples/request/SlmExecuteRetentionExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.slm().executeRetention(e -> e); diff --git a/specification/slm/get_lifecycle/examples/request/GetSnapshotLifecycleRequestExample1.yaml b/specification/slm/get_lifecycle/examples/request/GetSnapshotLifecycleRequestExample1.yaml index b0bf8ec330..9a1979971c 100644 --- a/specification/slm/get_lifecycle/examples/request/GetSnapshotLifecycleRequestExample1.yaml +++ b/specification/slm/get_lifecycle/examples/request/GetSnapshotLifecycleRequestExample1.yaml @@ -1,30 +1 @@ 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"' - - language: Java - code: "\n" diff --git a/specification/slm/get_stats/examples/request/GetSnapshotLifecycleManagementStatsRequestExample1.yaml b/specification/slm/get_stats/examples/request/GetSnapshotLifecycleManagementStatsRequestExample1.yaml index 4ee2c5db2b..bd0a032ae8 100644 --- a/specification/slm/get_stats/examples/request/GetSnapshotLifecycleManagementStatsRequestExample1.yaml +++ b/specification/slm/get_stats/examples/request/GetSnapshotLifecycleManagementStatsRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.slm().getStats(g -> g); diff --git a/specification/slm/get_status/examples/request/GetSnapshotLifecycleManagementStatusRequestExample1.yaml b/specification/slm/get_status/examples/request/GetSnapshotLifecycleManagementStatusRequestExample1.yaml index a6793b6e63..7a29eec0e2 100644 --- a/specification/slm/get_status/examples/request/GetSnapshotLifecycleManagementStatusRequestExample1.yaml +++ b/specification/slm/get_status/examples/request/GetSnapshotLifecycleManagementStatusRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.slm().getStatus(g -> g); diff --git a/specification/slm/put_lifecycle/examples/request/PutSnapshotLifecycleRequestExample1 copy.yaml b/specification/slm/put_lifecycle/examples/request/PutSnapshotLifecycleRequestExample1 copy.yaml index 168a3eb6c9..20d2ad4e72 100644 --- a/specification/slm/put_lifecycle/examples/request/PutSnapshotLifecycleRequestExample1 copy.yaml +++ b/specification/slm/put_lifecycle/examples/request/PutSnapshotLifecycleRequestExample1 copy.yaml @@ -34,116 +34,3 @@ value: "{ \ } }" -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\"" - - language: Java - code: | - client.slm().putLifecycle(p -> p - .config(c -> c - .ignoreUnavailable(false) - .indices(List.of("data-*","important")) - .includeGlobalState(false) - ) - .name("") - .policyId("daily-snapshots") - .repository("my_repository") - .retention(r -> r - .expireAfter(e -> e - .time("30d") - ) - .maxCount(50) - .minCount(5) - ) - .schedule("0 30 1 * * ?") - ); diff --git a/specification/slm/put_lifecycle/examples/request/PutSnapshotLifecycleRequestExample2.yaml b/specification/slm/put_lifecycle/examples/request/PutSnapshotLifecycleRequestExample2.yaml index 8614799892..7aca2769da 100644 --- a/specification/slm/put_lifecycle/examples/request/PutSnapshotLifecycleRequestExample2.yaml +++ b/specification/slm/put_lifecycle/examples/request/PutSnapshotLifecycleRequestExample2.yaml @@ -14,77 +14,3 @@ 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\"" - - language: Java - code: | - client.slm().putLifecycle(p -> p - .config(c -> c - .indices(List.of("data-*","important")) - ) - .name("") - .policyId("hourly-snapshots") - .repository("my_repository") - .schedule("1h") - ); diff --git a/specification/slm/start/examples/request/StartSnapshotLifecycleManagementRequestExample1.yaml b/specification/slm/start/examples/request/StartSnapshotLifecycleManagementRequestExample1.yaml index ac32aaca84..d492c9aeb5 100644 --- a/specification/slm/start/examples/request/StartSnapshotLifecycleManagementRequestExample1.yaml +++ b/specification/slm/start/examples/request/StartSnapshotLifecycleManagementRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.slm().start(s -> s); diff --git a/specification/snapshot/cleanup_repository/examples/request/SnapshotCleanupRepositoryRequestExample1.yaml b/specification/snapshot/cleanup_repository/examples/request/SnapshotCleanupRepositoryRequestExample1.yaml index afe718db0d..50442f35ae 100644 --- a/specification/snapshot/cleanup_repository/examples/request/SnapshotCleanupRepositoryRequestExample1.yaml +++ b/specification/snapshot/cleanup_repository/examples/request/SnapshotCleanupRepositoryRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.snapshot().cleanupRepository(c -> c - .name("my_repository") - ); diff --git a/specification/snapshot/clone/examples/request/SnapshotCloneRequestExample1.yaml b/specification/snapshot/clone/examples/request/SnapshotCloneRequestExample1.yaml index a9e23dd61a..229fe75fbd 100644 --- a/specification/snapshot/clone/examples/request/SnapshotCloneRequestExample1.yaml +++ b/specification/snapshot/clone/examples/request/SnapshotCloneRequestExample1.yaml @@ -9,52 +9,3 @@ 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"' - - language: Java - code: | - client.snapshot().clone(c -> c - .indices("index_a,index_b") - .repository("my_repository") - .snapshot("source_snapshot") - .targetSnapshot("target_snapshot") - ); diff --git a/specification/snapshot/create/examples/request/SnapshotCreateRequestExample1.yaml b/specification/snapshot/create/examples/request/SnapshotCreateRequestExample1.yaml index 78dd22decb..37eb858120 100644 --- a/specification/snapshot/create/examples/request/SnapshotCreateRequestExample1.yaml +++ b/specification/snapshot/create/examples/request/SnapshotCreateRequestExample1.yaml @@ -19,81 +19,3 @@ value: "{ \ } }" -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\"" - - language: Java - code: > - client.snapshot().create(c -> c - .ignoreUnavailable(true) - .includeGlobalState(false) - .indices("index_1,index_2") - .metadata(Map.of("taken_by", JsonData.fromJson("\"user123\""),"taken_because", JsonData.fromJson("\"backup before upgrading\""))) - .repository("my_repository") - .snapshot("snapshot_2") - .waitForCompletion(true) - ); diff --git a/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample1.yaml b/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample1.yaml index 70ea0d2093..4b785ad313 100644 --- a/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample1.yaml +++ b/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample1.yaml @@ -13,64 +13,3 @@ value: "{ \ } }" -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"' - - language: Java - code: | - client.snapshot().createRepository(c -> c - .name("my_repository") - .repository(r -> r - .fs(f -> f - .settings(s -> s - .location("my_backup_location") - ) - ) - ) - ); diff --git a/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample2.yaml b/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample2.yaml index 8aa32b79cc..06e68da335 100644 --- a/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample2.yaml +++ b/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample2.yaml @@ -13,64 +13,3 @@ value: "{ \ } }" -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"' - - language: Java - code: | - client.snapshot().createRepository(c -> c - .name("my_backup") - .repository(r -> r - .azure(a -> a - .settings(s -> s - .client("secondary") - ) - ) - ) - ); diff --git a/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample3.yaml b/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample3.yaml index 71ee4e27d4..296419e9a2 100644 --- a/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample3.yaml +++ b/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample3.yaml @@ -15,70 +15,3 @@ value: "{ \ } }" -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"' - - language: Java - code: | - client.snapshot().createRepository(c -> c - .name("my_gcs_repository") - .repository(r -> r - .gcs(g -> g - .settings(s -> s - .bucket("my_other_bucket") - .basePath("dev") - ) - ) - ) - ); diff --git a/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample4.yaml b/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample4.yaml index 9259b7de22..bd491f9d8e 100644 --- a/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample4.yaml +++ b/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample4.yaml @@ -13,64 +13,3 @@ value: "{ \ } }" -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"' - - language: Java - code: | - client.snapshot().createRepository(c -> c - .name("my_s3_repository") - .repository(r -> r - .s3(s -> s - .settings(se -> se - .bucket("my-bucket") - ) - ) - ) - ); diff --git a/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample5.yaml b/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample5.yaml index 6123067a49..0a6daff416 100644 --- a/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample5.yaml +++ b/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample5.yaml @@ -15,69 +15,3 @@ value: "{ \ } }" -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"' - - language: Java - code: | - client.snapshot().createRepository(c -> c - .name("my_src_only_repository") - .repository(r -> r - .source(s -> s - .settings(se -> se - .delegateType("fs") - ) - ) - ) - ); diff --git a/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample6.yaml b/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample6.yaml index 7fb8458cdf..b7f4212f28 100644 --- a/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample6.yaml +++ b/specification/snapshot/create_repository/examples/request/SnapshotCreateRepositoryRequestExample6.yaml @@ -13,65 +13,3 @@ value: "{ \ } }" -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"' - - language: Java - code: | - client.snapshot().createRepository(c -> c - .name("my_read_only_url_repository") - .repository(r -> r - .url(u -> u - .settings(s -> s - .url("file:/mount/backups/my_fs_backup_location") - ) - ) - ) - ); diff --git a/specification/snapshot/delete/examples/request/SnapshotDeleteRequestExample1.yaml b/specification/snapshot/delete/examples/request/SnapshotDeleteRequestExample1.yaml index f54f737c56..ae0b5b6df6 100644 --- a/specification/snapshot/delete/examples/request/SnapshotDeleteRequestExample1.yaml +++ b/specification/snapshot/delete/examples/request/SnapshotDeleteRequestExample1.yaml @@ -1,34 +1 @@ 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"' - - language: Java - code: | - client.snapshot().delete(d -> d - .repository("my_repository") - .snapshot("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 e1b9e9e10b..e60bd7a306 100644 --- a/specification/snapshot/delete_repository/examples/request/SnapshotDeleteRepositoryExample1.yaml +++ b/specification/snapshot/delete_repository/examples/request/SnapshotDeleteRepositoryExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.snapshot().deleteRepository(d -> d - .name("my_repository") - ); diff --git a/specification/snapshot/get/examples/request/SnapshotGetRequestExample1.yaml b/specification/snapshot/get/examples/request/SnapshotGetRequestExample1.yaml index c31dd442c2..18780bc2f9 100644 --- a/specification/snapshot/get/examples/request/SnapshotGetRequestExample1.yaml +++ b/specification/snapshot/get/examples/request/SnapshotGetRequestExample1.yaml @@ -1,45 +1 @@ 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"' - - language: Java - code: | - client.snapshot().get(g -> g - .fromSortValue("1577833200000") - .repository("my_repository") - .snapshot("snapshot_*") - .sort(SnapshotSort.StartTime) - ); diff --git a/specification/snapshot/get_repository/examples/request/SnapshotGetRepositoryRequestExample1.yaml b/specification/snapshot/get_repository/examples/request/SnapshotGetRepositoryRequestExample1.yaml index 2f35df5b8c..b327a9b4d9 100644 --- a/specification/snapshot/get_repository/examples/request/SnapshotGetRepositoryRequestExample1.yaml +++ b/specification/snapshot/get_repository/examples/request/SnapshotGetRepositoryRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.snapshot().getRepository(g -> g - .name("my_repository") - ); diff --git a/specification/snapshot/repository_analyze/examples/request/SnapshotRepositoryAnalyzeRequestExample1.yaml b/specification/snapshot/repository_analyze/examples/request/SnapshotRepositoryAnalyzeRequestExample1.yaml index bdf5060d92..d8348ca32b 100644 --- a/specification/snapshot/repository_analyze/examples/request/SnapshotRepositoryAnalyzeRequestExample1.yaml +++ b/specification/snapshot/repository_analyze/examples/request/SnapshotRepositoryAnalyzeRequestExample1.yaml @@ -2,49 +2,3 @@ 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"' - - language: Java - code: | - client.snapshot().repositoryAnalyze(r -> r - .blobCount(10) - .maxBlobSize("1mb") - .name("my_repository") - .timeout(t -> t - .offset(120) - ) - ); diff --git a/specification/snapshot/repository_verify_integrity/examples/request/SnapshotRepositoryVerifyIntegrityExample1.yaml b/specification/snapshot/repository_verify_integrity/examples/request/SnapshotRepositoryVerifyIntegrityExample1.yaml index 681217fdfb..615f0c9723 100644 --- a/specification/snapshot/repository_verify_integrity/examples/request/SnapshotRepositoryVerifyIntegrityExample1.yaml +++ b/specification/snapshot/repository_verify_integrity/examples/request/SnapshotRepositoryVerifyIntegrityExample1.yaml @@ -1,29 +1 @@ method_request: POST /_snapshot/my_repository/_verify_integrity -alternatives: - - language: Python - code: |- - resp = client.snapshot.repository_verify_integrity( - name="my_repository", - ) - - language: JavaScript - code: |- - const response = await client.snapshot.repositoryVerifyIntegrity({ - name: "my_repository", - }); - - language: Ruby - code: |- - response = client.snapshot.repository_verify_integrity( - repository: "my_repository" - ) - - language: PHP - code: |- - $resp = $client->snapshot()->repositoryVerifyIntegrity([ - "repository" => "my_repository", - ]); - - language: curl - code: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_snapshot/my_repository/_verify_integrity"' - - language: Java - code: | - client.snapshot().repositoryVerifyIntegrity(r -> r - .name("my_repository") - ); diff --git a/specification/snapshot/restore/examples/request/SnapshotRestoreRequestExample1.yaml b/specification/snapshot/restore/examples/request/SnapshotRestoreRequestExample1.yaml index ed016c71fc..e98f7bb0da 100644 --- a/specification/snapshot/restore/examples/request/SnapshotRestoreRequestExample1.yaml +++ b/specification/snapshot/restore/examples/request/SnapshotRestoreRequestExample1.yaml @@ -20,79 +20,3 @@ value: "{ \ \"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\"" - - language: Java - code: | - client.snapshot().restore(r -> r - .ignoreUnavailable(true) - .includeAliases(false) - .includeGlobalState(false) - .indices("index_1,index_2") - .renamePattern("index_(.+)") - .renameReplacement("restored_index_$1") - .repository("my_repository") - .snapshot("snapshot_2") - .waitForCompletion(true) - ); diff --git a/specification/snapshot/restore/examples/request/SnapshotRestoreRequestExample2.yaml b/specification/snapshot/restore/examples/request/SnapshotRestoreRequestExample2.yaml index d222394098..9e97f2187a 100644 --- a/specification/snapshot/restore/examples/request/SnapshotRestoreRequestExample2.yaml +++ b/specification/snapshot/restore/examples/request/SnapshotRestoreRequestExample2.yaml @@ -7,35 +7,3 @@ description: > # 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"' - - language: Java - code: | - client.cluster().putSettings(); diff --git a/specification/snapshot/status/examples/request/SnapshotStatusRequestExample1.yaml b/specification/snapshot/status/examples/request/SnapshotStatusRequestExample1.yaml index fedd0efb48..37d4c3b95d 100644 --- a/specification/snapshot/status/examples/request/SnapshotStatusRequestExample1.yaml +++ b/specification/snapshot/status/examples/request/SnapshotStatusRequestExample1.yaml @@ -1,34 +1 @@ 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"' - - language: Java - code: | - client.snapshot().status(s -> s - .repository("my_repository") - .snapshot("snapshot_2") - ); diff --git a/specification/snapshot/verify_repository/examples/request/SnapshotVerifyRepositoryExample1.yaml b/specification/snapshot/verify_repository/examples/request/SnapshotVerifyRepositoryExample1.yaml index c99f542fac..3ed8b23d23 100644 --- a/specification/snapshot/verify_repository/examples/request/SnapshotVerifyRepositoryExample1.yaml +++ b/specification/snapshot/verify_repository/examples/request/SnapshotVerifyRepositoryExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.snapshot().verifyRepository(v -> v - .name("my_unverified_backup") - ); diff --git a/specification/sql/clear_cursor/examples/request/ClearSqlCursorRequestExample1.yaml b/specification/sql/clear_cursor/examples/request/ClearSqlCursorRequestExample1.yaml index dfabd56618..98b8af7101 100644 --- a/specification/sql/clear_cursor/examples/request/ClearSqlCursorRequestExample1.yaml +++ b/specification/sql/clear_cursor/examples/request/ClearSqlCursorRequestExample1.yaml @@ -8,39 +8,3 @@ value: "{ \"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\"" - - language: Java - code: > - client.sql().clearCursor(c -> c - .cursor("sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=") - ); diff --git a/specification/sql/delete_async/examples/request/SqlDeleteAsyncExample1.yaml b/specification/sql/delete_async/examples/request/SqlDeleteAsyncExample1.yaml index e5e430e9a4..20507060b5 100644 --- a/specification/sql/delete_async/examples/request/SqlDeleteAsyncExample1.yaml +++ b/specification/sql/delete_async/examples/request/SqlDeleteAsyncExample1.yaml @@ -1,30 +1 @@ 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="' - - language: Java - code: | - client.sql().deleteAsync(d -> d - .id("FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=") - ); diff --git a/specification/sql/get_async/examples/request/SqlGetAsyncExample1.yaml b/specification/sql/get_async/examples/request/SqlGetAsyncExample1.yaml index 49326703a0..24bc18cf81 100644 --- a/specification/sql/get_async/examples/request/SqlGetAsyncExample1.yaml +++ b/specification/sql/get_async/examples/request/SqlGetAsyncExample1.yaml @@ -1,42 +1 @@ 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"' - - language: Java - code: | - client.sql().getAsync(g -> g - .format("json") - .id("FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=") - .waitForCompletionTimeout(w -> w - .offset(2) - ) - ); diff --git a/specification/sql/get_async_status/examples/request/SqlGetAsyncStatusExample1.yaml b/specification/sql/get_async_status/examples/request/SqlGetAsyncStatusExample1.yaml index b9f9f3efc4..26d6c9f359 100644 --- a/specification/sql/get_async_status/examples/request/SqlGetAsyncStatusExample1.yaml +++ b/specification/sql/get_async_status/examples/request/SqlGetAsyncStatusExample1.yaml @@ -1,30 +1 @@ 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="' - - language: Java - code: | - client.sql().getAsyncStatus(g -> g - .id("FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=") - ); diff --git a/specification/sql/query/examples/request/QuerySqlRequestExample1.yaml b/specification/sql/query/examples/request/QuerySqlRequestExample1.yaml index f44edbacb7..878db33a1b 100644 --- a/specification/sql/query/examples/request/QuerySqlRequestExample1.yaml +++ b/specification/sql/query/examples/request/QuerySqlRequestExample1.yaml @@ -7,42 +7,3 @@ 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"' - - language: Java - code: | - client.sql().query(q -> q - .format(SqlFormat.Txt) - .query("SELECT * FROM library ORDER BY page_count DESC LIMIT 5") - ); diff --git a/specification/sql/translate/examples/request/TranslateSqlRequestExample1.yaml b/specification/sql/translate/examples/request/TranslateSqlRequestExample1.yaml index 1c4df256a9..e056f35250 100644 --- a/specification/sql/translate/examples/request/TranslateSqlRequestExample1.yaml +++ b/specification/sql/translate/examples/request/TranslateSqlRequestExample1.yaml @@ -9,42 +9,3 @@ value: "{ \ \"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"' - - language: Java - code: | - client.sql().translate(t -> t - .fetchSize(10) - .query("SELECT * FROM library ORDER BY page_count DESC") - ); diff --git a/specification/ssl/certificates/examples/request/GetCertificatesRequestExample1.yaml b/specification/ssl/certificates/examples/request/GetCertificatesRequestExample1.yaml index 63f231f759..175c6df797 100644 --- a/specification/ssl/certificates/examples/request/GetCertificatesRequestExample1.yaml +++ b/specification/ssl/certificates/examples/request/GetCertificatesRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.ssl().certificates(); diff --git a/specification/synonyms/delete_synonym/examples/request/SynonymsDeleteSynonymExample1.yaml b/specification/synonyms/delete_synonym/examples/request/SynonymsDeleteSynonymExample1.yaml index 67fc631405..6950eb1400 100644 --- a/specification/synonyms/delete_synonym/examples/request/SynonymsDeleteSynonymExample1.yaml +++ b/specification/synonyms/delete_synonym/examples/request/SynonymsDeleteSynonymExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.synonyms().deleteSynonym(d -> d - .id("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 d30502fee9..c5704a7c19 100644 --- a/specification/synonyms/delete_synonym_rule/examples/request/SynonymRuleDeleteRequestExample1.yaml +++ b/specification/synonyms/delete_synonym_rule/examples/request/SynonymRuleDeleteRequestExample1.yaml @@ -1,34 +1 @@ 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"' - - language: Java - code: | - client.synonyms().deleteSynonymRule(d -> d - .ruleId("test-1") - .setId("my-synonyms-set") - ); diff --git a/specification/synonyms/get_synonym/examples/request/SynonymsGetRequestExample1.yaml b/specification/synonyms/get_synonym/examples/request/SynonymsGetRequestExample1.yaml index 58514bb163..384a86fcc2 100644 --- a/specification/synonyms/get_synonym/examples/request/SynonymsGetRequestExample1.yaml +++ b/specification/synonyms/get_synonym/examples/request/SynonymsGetRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.synonyms().getSynonym(g -> g - .id("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 803a858395..05284fc243 100644 --- a/specification/synonyms/get_synonym_rule/examples/request/SynonymRuleGetRequestExample1.yaml +++ b/specification/synonyms/get_synonym_rule/examples/request/SynonymRuleGetRequestExample1.yaml @@ -1,34 +1 @@ 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"' - - language: Java - code: | - client.synonyms().getSynonymRule(g -> g - .ruleId("test-1") - .setId("my-synonyms-set") - ); diff --git a/specification/synonyms/get_synonyms_sets/examples/request/SynonymsSetsGetRequestExample1.yaml b/specification/synonyms/get_synonyms_sets/examples/request/SynonymsSetsGetRequestExample1.yaml index 35ea609fad..0b019af6ed 100644 --- a/specification/synonyms/get_synonyms_sets/examples/request/SynonymsSetsGetRequestExample1.yaml +++ b/specification/synonyms/get_synonyms_sets/examples/request/SynonymsSetsGetRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.synonyms().getSynonymsSets(g -> g); diff --git a/specification/synonyms/put_synonym/examples/request/SynonymsPutRequestExample1.yaml b/specification/synonyms/put_synonym/examples/request/SynonymsPutRequestExample1.yaml index 62e162b3c3..333ab6f65f 100644 --- a/specification/synonyms/put_synonym/examples/request/SynonymsPutRequestExample1.yaml +++ b/specification/synonyms/put_synonym/examples/request/SynonymsPutRequestExample1.yaml @@ -1,24 +1 @@ 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 ce251be05c..560c2efa54 100644 --- a/specification/synonyms/put_synonym_rule/examples/request/SynonymRulePutRequestExample1.yaml +++ b/specification/synonyms/put_synonym_rule/examples/request/SynonymRulePutRequestExample1.yaml @@ -7,47 +7,3 @@ 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"' - - language: Java - code: | - client.synonyms().putSynonymRule(p -> p - .ruleId("test-1") - .setId("my-synonyms-set") - .synonyms("hello, hi, howdy") - ); diff --git a/specification/tasks/cancel/examples/request/TasksCancelExample1.yaml b/specification/tasks/cancel/examples/request/TasksCancelExample1.yaml index 862aee62b6..b286e870fa 100644 --- a/specification/tasks/cancel/examples/request/TasksCancelExample1.yaml +++ b/specification/tasks/cancel/examples/request/TasksCancelExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.tasks().cancel(c -> c - .taskId("") - ); diff --git a/specification/tasks/get/examples/request/GetTaskRequestExample2.yaml b/specification/tasks/get/examples/request/GetTaskRequestExample2.yaml index 2866cc7023..7e7484325d 100644 --- a/specification/tasks/get/examples/request/GetTaskRequestExample2.yaml +++ b/specification/tasks/get/examples/request/GetTaskRequestExample2.yaml @@ -1,28 +1 @@ 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 3caa781870..ece939dea9 100644 --- a/specification/tasks/list/examples/request/ListTasksRequestExample1.yaml +++ b/specification/tasks/list/examples/request/ListTasksRequestExample1.yaml @@ -1,28 +1 @@ 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 89268c1306..eaf803b14c 100644 --- a/specification/text_structure/find_field_structure/examples/request/FindFieldStructureRequestExample1.yaml +++ b/specification/text_structure/find_field_structure/examples/request/FindFieldStructureRequestExample1.yaml @@ -1,35 +1 @@ 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"' - - language: Java - code: | - client.textStructure().findFieldStructure(f -> f - .field("message") - .index("test-logs") - ); 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 847f6bbbd6..2a58beac60 100644 --- a/specification/text_structure/find_message_structure/examples/request/FindMessageStructureRequestExample1.yaml +++ b/specification/text_structure/find_message_structure/examples/request/FindMessageStructureRequestExample1.yaml @@ -59,151 +59,3 @@ value: "{ \ ] }" -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"' - - language: Java - code: > - client.textStructure().findMessageStructure(f -> f - .messages(List.of("[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 ...")) - ); diff --git a/specification/text_structure/find_structure/examples/request/FindStructureRequestExample1.yaml b/specification/text_structure/find_structure/examples/request/FindStructureRequestExample1.yaml index d0a26b42ec..df79f34de3 100644 --- a/specification/text_structure/find_structure/examples/request/FindStructureRequestExample1.yaml +++ b/specification/text_structure/find_structure/examples/request/FindStructureRequestExample1.yaml @@ -50,633 +50,3 @@ value: {"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}' -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 2d7ece0c5f..0285c46d0c 100644 --- a/specification/text_structure/test_grok_pattern/examples/request/TestGrokPatternRequestExample1.yaml +++ b/specification/text_structure/test_grok_pattern/examples/request/TestGrokPatternRequestExample1.yaml @@ -15,52 +15,3 @@ value: "{ \ ] }" -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"' - - language: Java - code: | - client.textStructure().testGrokPattern(t -> t - .grokPattern("Hello %{WORD:first_name} %{WORD:last_name}") - .text(List.of("Hello John Doe","this does not match")) - ); diff --git a/specification/transform/delete_transform/examples/request/TransformDeleteTransformExample1.yaml b/specification/transform/delete_transform/examples/request/TransformDeleteTransformExample1.yaml index 7bfbaa1817..fbce5ab4f5 100644 --- a/specification/transform/delete_transform/examples/request/TransformDeleteTransformExample1.yaml +++ b/specification/transform/delete_transform/examples/request/TransformDeleteTransformExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.transform().deleteTransform(d -> d - .transformId("ecommerce_transform") - ); diff --git a/specification/transform/get_transform/examples/request/TransformGetTransformExample1.yaml b/specification/transform/get_transform/examples/request/TransformGetTransformExample1.yaml index 47c7812f38..75e526a10e 100644 --- a/specification/transform/get_transform/examples/request/TransformGetTransformExample1.yaml +++ b/specification/transform/get_transform/examples/request/TransformGetTransformExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.transform().getTransform(g -> g - .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 88b220a2d4..a6416b60c4 100644 --- a/specification/transform/get_transform_stats/examples/request/TransformGetTransformStatsExample1.yaml +++ b/specification/transform/get_transform_stats/examples/request/TransformGetTransformStatsExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.transform().getTransformStats(g -> g - .transformId("ecommerce-customer-transform") - ); diff --git a/specification/transform/preview_transform/examples/request/PreviewTransformRequestExample1.yaml b/specification/transform/preview_transform/examples/request/PreviewTransformRequestExample1.yaml index fc9b79008a..010fd3e0d2 100644 --- a/specification/transform/preview_transform/examples/request/PreviewTransformRequestExample1.yaml +++ b/specification/transform/preview_transform/examples/request/PreviewTransformRequestExample1.yaml @@ -15,130 +15,3 @@ 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\"" - - language: Java - code: | - client.transform().previewTransform(p -> p - .pivot(pi -> pi - .aggregations("max_price", a -> a - .max(m -> m - .field("taxful_total_price") - ) - ) - .groupBy("customer_id", g -> g - .terms(t -> t - .field("customer_id") - .missingBucket(true) - ) - ) - ) - .source(s -> s - .index("kibana_sample_data_ecommerce") - ) - ); diff --git a/specification/transform/put_transform/examples/request/PutTransformRequestExample1.yaml b/specification/transform/put_transform/examples/request/PutTransformRequestExample1.yaml index 65b0fd8809..08f479163c 100644 --- a/specification/transform/put_transform/examples/request/PutTransformRequestExample1.yaml +++ b/specification/transform/put_transform/examples/request/PutTransformRequestExample1.yaml @@ -32,268 +32,3 @@ 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\"" - - language: Java - code: | - client.transform().putTransform(p -> p - .description("Maximum priced ecommerce data by customer_id in Asia") - .dest(d -> d - .index("kibana_sample_data_ecommerce_transform1") - .pipeline("add_timestamp_pipeline") - ) - .frequency(f -> f - .time("5m") - ) - .pivot(pi -> pi - .aggregations("max_price", a -> a - .max(m -> m - .field("taxful_total_price") - ) - ) - .groupBy("customer_id", g -> g - .terms(t -> t - .field("customer_id") - .missingBucket(true) - ) - ) - ) - .retentionPolicy(r -> r - .time(t -> t - .field("order_date") - .maxAge(m -> m - .time("30d") - ) - ) - ) - .source(s -> s - .index("kibana_sample_data_ecommerce") - .query(q -> q - .term(te -> te - .field("geoip.continent_name") - .value(FieldValue.of("Asia")) - ) - ) - ) - .sync(sy -> sy - .time(ti -> ti - .delay(d -> d - .time("60s") - ) - .field("order_date") - ) - ) - .transformId("ecommerce_transform1") - ); diff --git a/specification/transform/put_transform/examples/request/PutTransformRequestExample2.yaml b/specification/transform/put_transform/examples/request/PutTransformRequestExample2.yaml index d321bfbcd7..003891916d 100644 --- a/specification/transform/put_transform/examples/request/PutTransformRequestExample2.yaml +++ b/specification/transform/put_transform/examples/request/PutTransformRequestExample2.yaml @@ -17,140 +17,3 @@ 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\"" - - language: Java - code: | - client.transform().putTransform(p -> p - .description("Latest order for each customer") - .dest(d -> d - .index("kibana_sample_data_ecommerce_transform2") - ) - .frequency(f -> f - .time("5m") - ) - .latest(l -> l - .sort("order_date") - .uniqueKey("customer_id") - ) - .source(s -> s - .index("kibana_sample_data_ecommerce") - ) - .sync(s -> s - .time(t -> t - .delay(d -> d - .time("60s") - ) - .field("order_date") - ) - ) - .transformId("ecommerce_transform2") - ); diff --git a/specification/transform/reset_transform/examples/request/TransformResetTransformExample1.yaml b/specification/transform/reset_transform/examples/request/TransformResetTransformExample1.yaml index 919b242b5e..ca1bd4d181 100644 --- a/specification/transform/reset_transform/examples/request/TransformResetTransformExample1.yaml +++ b/specification/transform/reset_transform/examples/request/TransformResetTransformExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.transform().resetTransform(r -> r - .transformId("ecommerce_transform") - ); diff --git a/specification/transform/schedule_now_transform/examples/request/TransformScheduleNowTransformExample1.yaml b/specification/transform/schedule_now_transform/examples/request/TransformScheduleNowTransformExample1.yaml index 03a278ff66..2d90b03137 100644 --- a/specification/transform/schedule_now_transform/examples/request/TransformScheduleNowTransformExample1.yaml +++ b/specification/transform/schedule_now_transform/examples/request/TransformScheduleNowTransformExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.transform().scheduleNowTransform(s -> s - .transformId("ecommerce_transform") - ); diff --git a/specification/transform/start_transform/examples/request/TransformStartTransformExample1.yaml b/specification/transform/start_transform/examples/request/TransformStartTransformExample1.yaml index cf5b554606..18bafb90ed 100644 --- a/specification/transform/start_transform/examples/request/TransformStartTransformExample1.yaml +++ b/specification/transform/start_transform/examples/request/TransformStartTransformExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.transform().startTransform(s -> s - .transformId("ecommerce-customer-transform") - ); diff --git a/specification/transform/stop_transform/examples/request/TransformStopTransformExample1.yaml b/specification/transform/stop_transform/examples/request/TransformStopTransformExample1.yaml index 385efa4689..12dc9d32b9 100644 --- a/specification/transform/stop_transform/examples/request/TransformStopTransformExample1.yaml +++ b/specification/transform/stop_transform/examples/request/TransformStopTransformExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.transform().stopTransform(s -> s - .transformId("ecommerce_transform") - ); diff --git a/specification/transform/update_transform/examples/request/UpdateTransformRequestExample1.yaml b/specification/transform/update_transform/examples/request/UpdateTransformRequestExample1.yaml index c3ae5f363f..03d19e5da9 100644 --- a/specification/transform/update_transform/examples/request/UpdateTransformRequestExample1.yaml +++ b/specification/transform/update_transform/examples/request/UpdateTransformRequestExample1.yaml @@ -32,255 +32,3 @@ 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\"" - - language: Java - code: | - client.transform().updateTransform(u -> u - .description("Maximum priced ecommerce data by customer_id in Asia") - .dest(d -> d - .index("kibana_sample_data_ecommerce_transform1") - .pipeline("add_timestamp_pipeline") - ) - .frequency(f -> f - .time("5m") - ) - .retentionPolicy(r -> r - .time(t -> t - .field("order_date") - .maxAge(m -> m - .time("30d") - ) - ) - ) - .source(s -> s - .index("kibana_sample_data_ecommerce") - .query(q -> q - .term(te -> te - .field("geoip.continent_name") - .value(FieldValue.of("Asia")) - ) - ) - ) - .sync(sy -> sy - .time(ti -> ti - .delay(d -> d - .time("60s") - ) - .field("order_date") - ) - ) - .transformId("simple-kibana-ecomm-pivot") - ); diff --git a/specification/transform/upgrade_transforms/examples/request/TransformUpgradeTransformsExample1.yaml b/specification/transform/upgrade_transforms/examples/request/TransformUpgradeTransformsExample1.yaml index 892539710d..fdf4f3573b 100644 --- a/specification/transform/upgrade_transforms/examples/request/TransformUpgradeTransformsExample1.yaml +++ b/specification/transform/upgrade_transforms/examples/request/TransformUpgradeTransformsExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.transform().upgradeTransforms(u -> u); diff --git a/specification/watcher/ack_watch/examples/request/WatcherAckWatchRequestExample1.yaml b/specification/watcher/ack_watch/examples/request/WatcherAckWatchRequestExample1.yaml index 95f7eb9b5e..458d9b7f68 100644 --- a/specification/watcher/ack_watch/examples/request/WatcherAckWatchRequestExample1.yaml +++ b/specification/watcher/ack_watch/examples/request/WatcherAckWatchRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.watcher().ackWatch(a -> a - .watchId("my_watch") - ); diff --git a/specification/watcher/activate_watch/examples/request/WatcherActivateWatchExample1.yaml b/specification/watcher/activate_watch/examples/request/WatcherActivateWatchExample1.yaml index cdf1d281a5..902463d7c5 100644 --- a/specification/watcher/activate_watch/examples/request/WatcherActivateWatchExample1.yaml +++ b/specification/watcher/activate_watch/examples/request/WatcherActivateWatchExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.watcher().activateWatch(a -> a - .watchId("my_watch") - ); diff --git a/specification/watcher/deactivate_watch/examples/request/WatcherDeactivateWatchExample1.yaml b/specification/watcher/deactivate_watch/examples/request/WatcherDeactivateWatchExample1.yaml index 1310e48f45..1857a34e66 100644 --- a/specification/watcher/deactivate_watch/examples/request/WatcherDeactivateWatchExample1.yaml +++ b/specification/watcher/deactivate_watch/examples/request/WatcherDeactivateWatchExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.watcher().deactivateWatch(d -> d - .watchId("my_watch") - ); diff --git a/specification/watcher/delete_watch/examples/request/DeleteWatchRequestExample1.yaml b/specification/watcher/delete_watch/examples/request/DeleteWatchRequestExample1.yaml index f82fa983ee..af1cfc6370 100644 --- a/specification/watcher/delete_watch/examples/request/DeleteWatchRequestExample1.yaml +++ b/specification/watcher/delete_watch/examples/request/DeleteWatchRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.watcher().deleteWatch(d -> d - .id("my_watch") - ); diff --git a/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample1.yaml b/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample1.yaml index 14e4abe6a6..80f1b47916 100644 --- a/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample1.yaml +++ b/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample1.yaml @@ -21,95 +21,3 @@ 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\"" - - language: Java - code: | - client.watcher().executeWatch(e -> e - .actionModes("my-action", ActionExecutionMode.ForceSimulate) - .alternativeInput("foo", JsonData.fromJson("\"bar\"")) - .id("my_watch") - .ignoreCondition(true) - .recordExecution(true) - .triggerData(t -> t - .scheduledTime(DateTime.of("now")) - .triggeredTime(DateTime.of("now")) - ) - ); diff --git a/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample2.yaml b/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample2.yaml index e951d831e3..1de0d20d82 100644 --- a/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample2.yaml +++ b/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample2.yaml @@ -10,55 +10,3 @@ 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"' - - language: Java - code: | - client.watcher().executeWatch(e -> e - .actionModes(Map.of("action1", ActionExecutionMode.ForceSimulate,"action2", ActionExecutionMode.Skip)) - .id("my_watch") - ); diff --git a/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample3.yaml b/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample3.yaml index 01daac5faa..eca8437624 100644 --- a/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample3.yaml +++ b/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample3.yaml @@ -32,213 +32,3 @@ 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\"" - - language: Java - code: | - client.watcher().executeWatch(e -> e - .watch(w -> w - .actions("log_error", a -> a - .logging(l -> l - .text("Found {{ctx.payload.hits.total}} errors in the logs") - ) - ) - .condition(c -> c - .compare(NamedValue.of("ctx.payload.hits.total",Pair.of(ConditionOp.Gt,FieldValue.of(0)))) - ) - .input(i -> i - .search(s -> s - .request(r -> r - .body(b -> b - .query(q -> q - .match(m -> m - .field("message") - .query(FieldValue.of("error")) - ) - ) - ) - .indices("logs") - ) - ) - ) - .trigger(t -> t - .schedule(sc -> sc - .interval(in -> in - .time("10s") - ) - ) - ) - ) - ); diff --git a/specification/watcher/get_settings/examples/request/WatcherGetSettingsExample1.yaml b/specification/watcher/get_settings/examples/request/WatcherGetSettingsExample1.yaml index 253c170bb6..1ab70df900 100644 --- a/specification/watcher/get_settings/examples/request/WatcherGetSettingsExample1.yaml +++ b/specification/watcher/get_settings/examples/request/WatcherGetSettingsExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.watcher().getSettings(g -> g); diff --git a/specification/watcher/get_watch/examples/request/GetWatchRequestExample1.yaml b/specification/watcher/get_watch/examples/request/GetWatchRequestExample1.yaml index b0b3d735e6..6c9874e82e 100644 --- a/specification/watcher/get_watch/examples/request/GetWatchRequestExample1.yaml +++ b/specification/watcher/get_watch/examples/request/GetWatchRequestExample1.yaml @@ -1,29 +1 @@ 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"' - - language: Java - code: | - client.watcher().getWatch(g -> g - .id("my_watch") - ); diff --git a/specification/watcher/put_watch/examples/request/WatcherPutWatchRequestExample1.yaml b/specification/watcher/put_watch/examples/request/WatcherPutWatchRequestExample1.yaml index 57f497c379..bf755c50bc 100644 --- a/specification/watcher/put_watch/examples/request/WatcherPutWatchRequestExample1.yaml +++ b/specification/watcher/put_watch/examples/request/WatcherPutWatchRequestExample1.yaml @@ -50,272 +50,3 @@ 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\"" - - language: Java - code: | - client.watcher().putWatch(p -> p - .actions("email_admin", a -> a - .email(e -> e - .subject("404 recently encountered") - .to("admin@domain.host.com") - ) - ) - .condition(c -> c - .compare(NamedValue.of("ctx.payload.hits.total",Pair.of(ConditionOp.Gt,FieldValue.of(0)))) - ) - .id("my-watch") - .input(i -> i - .search(s -> s - .request(r -> r - .body(b -> b - .query(q -> q - .bool(bo -> bo - .filter(f -> f - .range(ra -> ra - .untyped(u -> u - .field("@timestamp") - ) - ) - ) - .must(m -> m - .match(ma -> ma - .field("response") - .query(FieldValue.of(404)) - ) - ) - ) - ) - ) - .indices("logstash*") - ) - ) - ) - .trigger(t -> t - .schedule(sc -> sc - .cron("0 0/1 * * * ?") - ) - ) - ); diff --git a/specification/watcher/query_watches/examples/request/WatcherQueryWatchesRequestExample1.yaml b/specification/watcher/query_watches/examples/request/WatcherQueryWatchesRequestExample1.yaml index 916f360cea..e3621c8fd9 100644 --- a/specification/watcher/query_watches/examples/request/WatcherQueryWatchesRequestExample1.yaml +++ b/specification/watcher/query_watches/examples/request/WatcherQueryWatchesRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.watcher().queryWatches(); diff --git a/specification/watcher/start/examples/request/WatcherStartRequestExample1.yaml b/specification/watcher/start/examples/request/WatcherStartRequestExample1.yaml index 73f9b5906b..460c900873 100644 --- a/specification/watcher/start/examples/request/WatcherStartRequestExample1.yaml +++ b/specification/watcher/start/examples/request/WatcherStartRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.watcher().start(s -> s); diff --git a/specification/watcher/stats/examples/request/WatcherStatsRequestExample1.yaml b/specification/watcher/stats/examples/request/WatcherStatsRequestExample1.yaml index 91054d83e2..ff8b145c37 100644 --- a/specification/watcher/stats/examples/request/WatcherStatsRequestExample1.yaml +++ b/specification/watcher/stats/examples/request/WatcherStatsRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.watcher().stats(s -> s); diff --git a/specification/watcher/stop/examples/request/WatcherStopRequestExample1.yaml b/specification/watcher/stop/examples/request/WatcherStopRequestExample1.yaml index 6b3e09209c..7bc9342704 100644 --- a/specification/watcher/stop/examples/request/WatcherStopRequestExample1.yaml +++ b/specification/watcher/stop/examples/request/WatcherStopRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.watcher().stop(s -> s); diff --git a/specification/watcher/update_settings/examples/request/WatcherUpdateSettingsRequestExample1.yaml b/specification/watcher/update_settings/examples/request/WatcherUpdateSettingsRequestExample1.yaml index 72bb3a01c2..ea2309603b 100644 --- a/specification/watcher/update_settings/examples/request/WatcherUpdateSettingsRequestExample1.yaml +++ b/specification/watcher/update_settings/examples/request/WatcherUpdateSettingsRequestExample1.yaml @@ -4,37 +4,3 @@ 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"' - - language: Java - code: | - client.watcher().updateSettings(u -> u - .indexAutoExpandReplicas("0-4") - ); diff --git a/specification/xpack/info/examples/request/XPackInfoRequestExample1.yaml b/specification/xpack/info/examples/request/XPackInfoRequestExample1.yaml index c4f5c76cff..5a9b53dc54 100644 --- a/specification/xpack/info/examples/request/XPackInfoRequestExample1.yaml +++ b/specification/xpack/info/examples/request/XPackInfoRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.xpack().info(i -> i); diff --git a/specification/xpack/usage/examples/request/XPackUsageRequestExample1.yaml b/specification/xpack/usage/examples/request/XPackUsageRequestExample1.yaml index 2d2f845070..7d5b9e797c 100644 --- a/specification/xpack/usage/examples/request/XPackUsageRequestExample1.yaml +++ b/specification/xpack/usage/examples/request/XPackUsageRequestExample1.yaml @@ -1,15 +1 @@ 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"' - - language: Java - code: | - client.xpack().usage(u -> u);