`.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "allow_no_match",
+ "description": "Specifies what to do when the request:\n\n1. Contains wildcard expressions and there are no jobs that match.\n2. Contains the `_all` string or no identifiers and there are no matches.\n3. Contains wildcard expressions and there are only partial matches.\n\nIf `true`, the request returns an empty `jobs` array when there are no\nmatches and the subset of results when there are partial matches. If this\nparameter is `false`, the request returns a `404` status code when there\nare no matches or only partial matches.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "bucket_span",
+ "description": "The span of the overall buckets. Must be greater or equal to the largest\nbucket span of the specified anomaly detection jobs, which is the default\nvalue.\n\nBy default, an overall bucket has a span equal to the largest bucket span\nof the specified anomaly detection jobs. To override that behavior, use\nthe optional `bucket_span` parameter.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "end",
+ "description": "Returns overall buckets with timestamps earlier than this time.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.DateTime"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "exclude_interim",
+ "description": "If `true`, the output excludes interim results.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "overall_score",
+ "description": "Returns overall buckets with overall scores greater than or equal to this\nvalue.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "start",
+ "description": "Returns overall buckets with timestamps after this time.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.DateTime"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "top_n",
+ "description": "The number of top anomaly detection job bucket scores to be used in the\n`overall_score` calculation.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "allow_no_match": {
+ "description": "Refer to the description for the `allow_no_match` query parameter.",
+ "default": true,
+ "type": "boolean"
+ },
+ "bucket_span": {
+ "description": "Refer to the description for the `bucket_span` query parameter.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Duration"
+ }
+ ]
+ },
+ "end": {
+ "description": "Refer to the description for the `end` query parameter.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.DateTime"
+ }
+ ]
+ },
+ "exclude_interim": {
+ "description": "Refer to the description for the `exclude_interim` query parameter.",
+ "default": false,
+ "type": "boolean"
+ },
+ "overall_score": {
+ "description": "Refer to the description for the `overall_score` query parameter.",
+ "type": "number"
+ },
+ "start": {
+ "description": "Refer to the description for the `start` query parameter.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.DateTime"
+ }
+ ]
+ },
+ "top_n": {
+ "description": "Refer to the description for the `top_n` query parameter.",
+ "default": 1.0,
+ "type": "number"
+ }
+ }
+ },
+ "examples": {
+ "MlGetOverallBucketsExample1": {
+ "description": "An example body for a `GET _ml/anomaly_detectors/job-*/results/overall_buckets` request.",
+ "value": "{\n \"overall_score\": 80,\n \"start\": \"1403532000000\"\n}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "count": {
+ "type": "number"
+ },
+ "overall_buckets": {
+ "description": "Array of overall bucket objects",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ml._types.OverallBucket"
+ }
+ }
+ },
+ "required": [
+ "count",
+ "overall_buckets"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 6.1.0",
+ "x-variations": [
+ "\n GET\n /_ml/anomaly_detectors/{job_id}/results/overall_buckets\n
\n ",
+ "\n POST\n /_ml/anomaly_detectors/{job_id}/results/overall_buckets\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor_ml`\n"
+ ],
+ "x-api": "get_overall_buckets.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _ml/anomaly_detectors/job-*/results/overall_buckets\n{\n \"overall_score\": 80,\n \"start\": \"1403532000000\"\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.get_overall_buckets(\n job_id=\"job-*\",\n overall_score=80,\n start=\"1403532000000\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.getOverallBuckets({\n job_id: \"job-*\",\n overall_score: 80,\n start: 1403532000000,\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.get_overall_buckets(\n job_id: \"job-*\",\n body: {\n \"overall_score\": 80,\n \"start\": \"1403532000000\"\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->getOverallBuckets([\n \"job_id\" => \"job-*\",\n \"body\" => [\n \"overall_score\" => 80,\n \"start\" => \"1403532000000\",\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"overall_score\":80,\"start\":\"1403532000000\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/job-*/results/overall_buckets\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().getOverallBuckets(g -> g\n .jobId(\"job-*\")\n .overallScore(80.0D)\n .start(DateTime.of(\"1403532000000\"))\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/anomaly_detectors/{job_id}/results/records": {
+ "get": {
+ "tags": [
+ "ml anomaly"
+ ],
+ "summary": "Get anomaly records for an anomaly detection job",
+ "description": "Records contain the detailed analytical results. They describe the anomalous\nactivity that has been identified in the input data based on the detector\nconfiguration.\nThere can be many anomaly records depending on the characteristics and size\nof the input data. In practice, there are often too many to be able to\nmanually process them. The machine learning features therefore perform a\nsophisticated aggregation of the anomaly records into buckets.\nThe number of record results depends on the number of anomalies found in each\nbucket, which relates to the number of time series being modeled and the\nnumber of detectors.",
+ "operationId": "ml-get-records",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "job_id",
+ "description": "Identifier for the anomaly detection job.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "desc",
+ "description": "If true, the results are sorted in descending order.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "end",
+ "description": "Returns records with timestamps earlier than this time. The default value\nmeans results are not limited to specific timestamps.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.DateTime"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "exclude_interim",
+ "description": "If `true`, the output excludes interim results.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "from",
+ "description": "Skips the specified number of records.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "record_score",
+ "description": "Returns records with anomaly scores greater or equal than this value.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "size",
+ "description": "Specifies the maximum number of records to obtain.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "sort",
+ "description": "Specifies the sort field for the requested records.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Field"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "start",
+ "description": "Returns records with timestamps after this time. The default value means\nresults are not limited to specific timestamps.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.DateTime"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "desc": {
+ "description": "Refer to the description for the `desc` query parameter.",
+ "default": false,
+ "type": "boolean"
+ },
+ "end": {
+ "description": "Refer to the description for the `end` query parameter.",
+ "default": "-1",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.DateTime"
+ }
+ ]
+ },
+ "exclude_interim": {
+ "description": "Refer to the description for the `exclude_interim` query parameter.",
+ "default": false,
+ "type": "boolean"
+ },
+ "page": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.Page"
+ }
+ ]
+ },
+ "record_score": {
+ "description": "Refer to the description for the `record_score` query parameter.",
+ "default": 0.0,
+ "type": "number"
+ },
+ "sort": {
+ "description": "Refer to the description for the `sort` query parameter.",
+ "default": "record_score",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Field"
+ }
+ ]
+ },
+ "start": {
+ "description": "Refer to the description for the `start` query parameter.",
+ "default": "-1",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.DateTime"
+ }
+ ]
+ }
+ }
+ },
+ "examples": {
+ "MlGetRecordsExample1": {
+ "description": "An example body for a `GET _ml/anomaly_detectors/low_request_rate/results/records` request.",
+ "value": "{\n \"sort\": \"record_score\",\n \"desc\": true,\n \"start\": \"1454944100000\"\n}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "count": {
+ "type": "number"
+ },
+ "records": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ml._types.Anomaly"
+ }
+ }
+ },
+ "required": [
+ "count",
+ "records"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 5.4.0",
+ "x-variations": [
+ "\n GET\n /_ml/anomaly_detectors/{job_id}/results/records\n
\n ",
+ "\n POST\n /_ml/anomaly_detectors/{job_id}/results/records\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor_ml`\n"
+ ],
+ "x-api": "get_records.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _ml/anomaly_detectors/low_request_rate/results/records\n{\n \"sort\": \"record_score\",\n \"desc\": true,\n \"start\": \"1454944100000\"\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.get_records(\n job_id=\"low_request_rate\",\n sort=\"record_score\",\n desc=True,\n start=\"1454944100000\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.getRecords({\n job_id: \"low_request_rate\",\n sort: \"record_score\",\n desc: true,\n start: 1454944100000,\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.get_records(\n job_id: \"low_request_rate\",\n body: {\n \"sort\": \"record_score\",\n \"desc\": true,\n \"start\": \"1454944100000\"\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->getRecords([\n \"job_id\" => \"low_request_rate\",\n \"body\" => [\n \"sort\" => \"record_score\",\n \"desc\" => true,\n \"start\" => \"1454944100000\",\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"sort\":\"record_score\",\"desc\":true,\"start\":\"1454944100000\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/results/records\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().getRecords(g -> g\n .desc(true)\n .jobId(\"low_request_rate\")\n .sort(\"record_score\")\n .start(DateTime.of(\"1454944100000\"))\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ },
+ "post": {
+ "tags": [
+ "ml anomaly"
+ ],
+ "summary": "Get anomaly records for an anomaly detection job",
+ "description": "Records contain the detailed analytical results. They describe the anomalous\nactivity that has been identified in the input data based on the detector\nconfiguration.\nThere can be many anomaly records depending on the characteristics and size\nof the input data. In practice, there are often too many to be able to\nmanually process them. The machine learning features therefore perform a\nsophisticated aggregation of the anomaly records into buckets.\nThe number of record results depends on the number of anomalies found in each\nbucket, which relates to the number of time series being modeled and the\nnumber of detectors.",
+ "operationId": "ml-get-records-1",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "job_id",
+ "description": "Identifier for the anomaly detection job.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "desc",
+ "description": "If true, the results are sorted in descending order.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "end",
+ "description": "Returns records with timestamps earlier than this time. The default value\nmeans results are not limited to specific timestamps.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.DateTime"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "exclude_interim",
+ "description": "If `true`, the output excludes interim results.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "from",
+ "description": "Skips the specified number of records.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "record_score",
+ "description": "Returns records with anomaly scores greater or equal than this value.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "size",
+ "description": "Specifies the maximum number of records to obtain.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "sort",
+ "description": "Specifies the sort field for the requested records.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Field"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "start",
+ "description": "Returns records with timestamps after this time. The default value means\nresults are not limited to specific timestamps.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.DateTime"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "desc": {
+ "description": "Refer to the description for the `desc` query parameter.",
+ "default": false,
+ "type": "boolean"
+ },
+ "end": {
+ "description": "Refer to the description for the `end` query parameter.",
+ "default": "-1",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.DateTime"
+ }
+ ]
+ },
+ "exclude_interim": {
+ "description": "Refer to the description for the `exclude_interim` query parameter.",
+ "default": false,
+ "type": "boolean"
+ },
+ "page": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.Page"
+ }
+ ]
+ },
+ "record_score": {
+ "description": "Refer to the description for the `record_score` query parameter.",
+ "default": 0.0,
+ "type": "number"
+ },
+ "sort": {
+ "description": "Refer to the description for the `sort` query parameter.",
+ "default": "record_score",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Field"
+ }
+ ]
+ },
+ "start": {
+ "description": "Refer to the description for the `start` query parameter.",
+ "default": "-1",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.DateTime"
+ }
+ ]
+ }
+ }
+ },
+ "examples": {
+ "MlGetRecordsExample1": {
+ "description": "An example body for a `GET _ml/anomaly_detectors/low_request_rate/results/records` request.",
+ "value": "{\n \"sort\": \"record_score\",\n \"desc\": true,\n \"start\": \"1454944100000\"\n}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "count": {
+ "type": "number"
+ },
+ "records": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ml._types.Anomaly"
+ }
+ }
+ },
+ "required": [
+ "count",
+ "records"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 5.4.0",
+ "x-variations": [
+ "\n GET\n /_ml/anomaly_detectors/{job_id}/results/records\n
\n ",
+ "\n POST\n /_ml/anomaly_detectors/{job_id}/results/records\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor_ml`\n"
+ ],
+ "x-api": "get_records.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _ml/anomaly_detectors/low_request_rate/results/records\n{\n \"sort\": \"record_score\",\n \"desc\": true,\n \"start\": \"1454944100000\"\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.get_records(\n job_id=\"low_request_rate\",\n sort=\"record_score\",\n desc=True,\n start=\"1454944100000\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.getRecords({\n job_id: \"low_request_rate\",\n sort: \"record_score\",\n desc: true,\n start: 1454944100000,\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.get_records(\n job_id: \"low_request_rate\",\n body: {\n \"sort\": \"record_score\",\n \"desc\": true,\n \"start\": \"1454944100000\"\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->getRecords([\n \"job_id\" => \"low_request_rate\",\n \"body\" => [\n \"sort\" => \"record_score\",\n \"desc\" => true,\n \"start\" => \"1454944100000\",\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"sort\":\"record_score\",\"desc\":true,\"start\":\"1454944100000\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/results/records\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().getRecords(g -> g\n .desc(true)\n .jobId(\"low_request_rate\")\n .sort(\"record_score\")\n .start(DateTime.of(\"1454944100000\"))\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/trained_models": {
+ "get": {
+ "tags": [
+ "ml trained model"
+ ],
+ "summary": "Get trained model configuration info",
+ "operationId": "ml-get-trained-models-1",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "allow_no_match",
+ "description": "Specifies what to do when the request:\n\n- Contains wildcard expressions and there are no models that match.\n- Contains the _all string or no identifiers and there are no matches.\n- Contains wildcard expressions and there are only partial matches.\n\nIf true, it returns an empty array when there are no matches and the\nsubset of results when there are partial matches.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "decompress_definition",
+ "description": "Specifies whether the included model definition should be returned as a\nJSON map (true) or in a custom compressed format (false).",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "exclude_generated",
+ "description": "Indicates if certain fields should be removed from the configuration on\nretrieval. This allows the configuration to be in an acceptable format to\nbe retrieved and then added to another cluster.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "from",
+ "description": "Skips the specified number of models.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "include",
+ "description": "A comma delimited string of optional fields to include in the response\nbody.\n\nSupported values include:\n - `definition`: Includes the model definition.\n - `feature_importance_baseline`: Includes the baseline for feature importance values.\n - `hyperparameters`: Includes the information about hyperparameters used to train the model.\nThis information consists of the value, the absolute and relative\nimportance of the hyperparameter as well as an indicator of whether it was\nspecified by the user or tuned during hyperparameter optimization.\n - `total_feature_importance`: Includes the total feature importance for the training data set. The\nbaseline and total feature importance values are returned in the metadata\nfield in the response body.\n - `definition_status`: Includes the model definition status.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/ml._types.Include"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "size",
+ "description": "Specifies the maximum number of models to obtain.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "tags",
+ "description": "A comma delimited string of tags. A trained model can have many tags, or\nnone. When supplied, only trained models that contain all the supplied\ntags are returned.",
+ "deprecated": false,
+ "schema": {
+ "oneOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ ]
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "count": {
+ "type": "number"
+ },
+ "trained_model_configs": {
+ "description": "An array of trained model resources, which are sorted by the model_id value in ascending order.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ml._types.TrainedModelConfig"
+ }
+ }
+ },
+ "required": [
+ "count",
+ "trained_model_configs"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 7.10.0",
+ "x-variations": [
+ "\n GET\n /_ml/trained_models\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor_ml`\n"
+ ],
+ "x-api": "get_trained_models.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _ml/trained_models/\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.get_trained_models()"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.getTrainedModels();"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.get_trained_models"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->getTrainedModels();"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().getTrainedModels(g -> g);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/trained_models/{model_id}/_stats": {
+ "get": {
+ "tags": [
+ "ml trained model"
+ ],
+ "summary": "Get trained models usage info",
+ "description": "You can get usage information for multiple trained\nmodels in a single API request by using a comma-separated list of model IDs or a wildcard expression.",
+ "operationId": "ml-get-trained-models-stats",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "model_id",
+ "description": "The unique identifier of the trained model or a model alias. It can be a\ncomma-separated list or a wildcard expression.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Ids"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "allow_no_match",
+ "description": "Specifies what to do when the request:\n\n- Contains wildcard expressions and there are no models that match.\n- Contains the _all string or no identifiers and there are no matches.\n- Contains wildcard expressions and there are only partial matches.\n\nIf true, it returns an empty array when there are no matches and the\nsubset of results when there are partial matches.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "from",
+ "description": "Skips the specified number of models.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "size",
+ "description": "Specifies the maximum number of models to obtain.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "count": {
+ "description": "The total number of trained model statistics that matched the requested ID patterns. Could be higher than the number of items in the trained_model_stats array as the size of the array is restricted by the supplied size parameter.",
+ "type": "number"
+ },
+ "trained_model_stats": {
+ "description": "An array of trained model statistics, which are sorted by the model_id value in ascending order.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ml._types.TrainedModelStats"
+ }
+ }
+ },
+ "required": [
+ "count",
+ "trained_model_stats"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 7.10.0",
+ "x-variations": [
+ "\n GET\n /_ml/trained_models/{model_id}/_stats\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor_ml`\n"
+ ],
+ "x-api": "get_trained_models_stats.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _ml/trained_models/_stats\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.get_trained_models_stats()"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.getTrainedModelsStats();"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.get_trained_models_stats"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->getTrainedModelsStats();"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/_stats\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().getTrainedModelsStats(g -> g);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/trained_models/_stats": {
+ "get": {
+ "tags": [
+ "ml trained model"
+ ],
+ "summary": "Get trained models usage info",
+ "description": "You can get usage information for multiple trained\nmodels in a single API request by using a comma-separated list of model IDs or a wildcard expression.",
+ "operationId": "ml-get-trained-models-stats-1",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "allow_no_match",
+ "description": "Specifies what to do when the request:\n\n- Contains wildcard expressions and there are no models that match.\n- Contains the _all string or no identifiers and there are no matches.\n- Contains wildcard expressions and there are only partial matches.\n\nIf true, it returns an empty array when there are no matches and the\nsubset of results when there are partial matches.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "from",
+ "description": "Skips the specified number of models.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "size",
+ "description": "Specifies the maximum number of models to obtain.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "count": {
+ "description": "The total number of trained model statistics that matched the requested ID patterns. Could be higher than the number of items in the trained_model_stats array as the size of the array is restricted by the supplied size parameter.",
+ "type": "number"
+ },
+ "trained_model_stats": {
+ "description": "An array of trained model statistics, which are sorted by the model_id value in ascending order.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ml._types.TrainedModelStats"
+ }
+ }
+ },
+ "required": [
+ "count",
+ "trained_model_stats"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 7.10.0",
+ "x-variations": [
+ "\n GET\n /_ml/trained_models/_stats\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor_ml`\n"
+ ],
+ "x-api": "get_trained_models_stats.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _ml/trained_models/_stats\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.get_trained_models_stats()"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.getTrainedModelsStats();"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.get_trained_models_stats"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->getTrainedModelsStats();"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/_stats\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().getTrainedModelsStats(g -> g);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/trained_models/{model_id}/_infer": {
+ "post": {
+ "tags": [
+ "ml trained model"
+ ],
+ "summary": "Evaluate a trained model",
+ "operationId": "ml-infer-trained-model",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "model_id",
+ "description": "The unique identifier of the trained model.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Controls the amount of time to wait for inference results.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "docs": {
+ "description": "An array of objects to pass to the model for inference. The objects should contain a fields matching your\nconfigured trained model input. Typically, for NLP models, the field name is `text_field`.\nCurrently, for NLP models, only a single value is allowed.",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "object"
+ }
+ }
+ },
+ "inference_config": {
+ "description": "The inference configuration updates to apply on the API call",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.InferenceConfigUpdateContainer"
+ }
+ ]
+ }
+ },
+ "required": [
+ "docs"
+ ]
+ },
+ "examples": {
+ "MlInferTrainedModelExample1": {
+ "description": "An example body for a `POST _ml/trained_models/lang_ident_model_1/_infer` request.",
+ "value": "{\n \"docs\":[{\"text\": \"The fool doth think he is wise, but the wise man knows himself to be a fool.\"}]\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "inference_results": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ml._types.InferenceResponseResult"
+ }
+ }
+ },
+ "required": [
+ "inference_results"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 8.3.0",
+ "x-variations": [
+ "\n POST\n /_ml/trained_models/{model_id}/_infer\n
\n "
+ ],
+ "x-api": "infer_trained_model.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _ml/trained_models/lang_ident_model_1/_infer\n{\n \"docs\":[{\"text\": \"The fool doth think he is wise, but the wise man knows himself to be a fool.\"}]\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.infer_trained_model(\n model_id=\"lang_ident_model_1\",\n docs=[\n {\n \"text\": \"The fool doth think he is wise, but the wise man knows himself to be a fool.\"\n }\n ],\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.inferTrainedModel({\n model_id: \"lang_ident_model_1\",\n docs: [\n {\n text: \"The fool doth think he is wise, but the wise man knows himself to be a fool.\",\n },\n ],\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.infer_trained_model(\n model_id: \"lang_ident_model_1\",\n body: {\n \"docs\": [\n {\n \"text\": \"The fool doth think he is wise, but the wise man knows himself to be a fool.\"\n }\n ]\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->inferTrainedModel([\n \"model_id\" => \"lang_ident_model_1\",\n \"body\" => [\n \"docs\" => array(\n [\n \"text\" => \"The fool doth think he is wise, but the wise man knows himself to be a fool.\",\n ],\n ),\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"text\":\"The fool doth think he is wise, but the wise man knows himself to be a fool.\"}]}' \"$ELASTICSEARCH_URL/_ml/trained_models/lang_ident_model_1/_infer\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/info": {
+ "get": {
+ "tags": [
+ "ml"
+ ],
+ "summary": "Get machine learning information",
+ "description": "Get defaults and limits used by machine learning.\nThis endpoint is designed to be used by a user interface that needs to fully\nunderstand machine learning configurations where some options are not\nspecified, meaning that the defaults should be used. This endpoint may be\nused to find out what those defaults are. It also provides information about\nthe maximum size of machine learning jobs that could run in the current\ncluster configuration.",
+ "operationId": "ml-info",
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "defaults": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml.info.Defaults"
+ }
+ ]
+ },
+ "limits": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml.info.Limits"
+ }
+ ]
+ },
+ "upgrade_mode": {
+ "type": "boolean"
+ },
+ "native_code": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml.info.NativeCode"
+ }
+ ]
+ }
+ },
+ "required": [
+ "defaults",
+ "limits",
+ "upgrade_mode",
+ "native_code"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 6.3.0",
+ "x-variations": [
+ "\n GET\n /_ml/info\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor_ml`\n"
+ ],
+ "x-api": "info.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _ml/info\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.info()"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.info();"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.info"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->info();"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/info\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().info();\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/anomaly_detectors/{job_id}/_open": {
+ "post": {
+ "tags": [
+ "ml anomaly"
+ ],
+ "summary": "Open anomaly detection jobs",
+ "description": "An anomaly detection job must be opened to be ready to receive and analyze\ndata. It can be opened and closed multiple times throughout its lifecycle.\nWhen you open a new job, it starts with an empty model.\nWhen you open an existing job, the most recent model state is automatically\nloaded. The job is ready to resume its analysis from where it left off, once\nnew data is received.",
+ "operationId": "ml-open-job",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "job_id",
+ "description": "Identifier for the anomaly detection job.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Controls the time to wait until a job has opened.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "timeout": {
+ "description": "Refer to the description for the `timeout` query parameter.",
+ "default": "30m",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Duration"
+ }
+ ]
+ }
+ }
+ },
+ "examples": {
+ "MlOpenJobRequestExample1": {
+ "description": "A request to open anomaly detection jobs. The timeout specifies to wait 35 minutes for the job to open.\n",
+ "value": "{\n \"timeout\": \"35m\"\n}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "opened": {
+ "type": "boolean"
+ },
+ "node": {
+ "description": "The ID of the node that the job was started on. In serverless this will be the \"serverless\".\nIf the job is allowed to open lazily and has not yet been assigned to a node, this value is an empty string.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.NodeId"
+ }
+ ]
+ }
+ },
+ "required": [
+ "opened",
+ "node"
+ ]
+ },
+ "examples": {
+ "MlOpenJobResponseExample1": {
+ "description": "A successful response when opening an anomaly detection job.",
+ "value": "{\n \"opened\": true,\n \"node\": \"node-1\"\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 5.4.0",
+ "x-variations": [
+ "\n POST\n /_ml/anomaly_detectors/{job_id}/_open\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_ml`\n"
+ ],
+ "x-api": "open_job.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST /_ml/anomaly_detectors/job-01/_open\n{\n \"timeout\": \"35m\"\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.open_job(\n job_id=\"job-01\",\n timeout=\"35m\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.openJob({\n job_id: \"job-01\",\n timeout: \"35m\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.open_job(\n job_id: \"job-01\",\n body: {\n \"timeout\": \"35m\"\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->openJob([\n \"job_id\" => \"job-01\",\n \"body\" => [\n \"timeout\" => \"35m\",\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"timeout\":\"35m\"}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/job-01/_open\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().openJob(o -> o\n .jobId(\"job-01\")\n .timeout(t -> t\n .time(\"35m\")\n )\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/anomaly_detectors/{job_id}/_data": {
+ "post": {
+ "tags": [
+ "ml anomaly"
+ ],
+ "summary": "Send data to an anomaly detection job for analysis",
+ "description": "IMPORTANT: For each job, data can be accepted from only a single connection at a time.\nIt is not currently possible to post data to multiple jobs using wildcards or a comma-separated list.",
+ "operationId": "ml-post-data",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "job_id",
+ "description": "Identifier for the anomaly detection job. The job must have a state of open to receive and process the data.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "reset_end",
+ "description": "Specifies the end of the bucket resetting range.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.DateTime"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "reset_start",
+ "description": "Specifies the start of the bucket resetting range.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.DateTime"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "object"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "job_id": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Id"
+ }
+ ]
+ },
+ "processed_record_count": {
+ "type": "number"
+ },
+ "processed_field_count": {
+ "type": "number"
+ },
+ "input_bytes": {
+ "type": "number"
+ },
+ "input_field_count": {
+ "type": "number"
+ },
+ "invalid_date_count": {
+ "type": "number"
+ },
+ "missing_field_count": {
+ "type": "number"
+ },
+ "out_of_order_timestamp_count": {
+ "type": "number"
+ },
+ "empty_bucket_count": {
+ "type": "number"
+ },
+ "sparse_bucket_count": {
+ "type": "number"
+ },
+ "bucket_count": {
+ "type": "number"
+ },
+ "earliest_record_timestamp": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.EpochTimeUnitMillis"
+ }
+ ]
+ },
+ "latest_record_timestamp": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.EpochTimeUnitMillis"
+ }
+ ]
+ },
+ "last_data_time": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.EpochTimeUnitMillis"
+ }
+ ]
+ },
+ "latest_empty_bucket_timestamp": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.EpochTimeUnitMillis"
+ }
+ ]
+ },
+ "latest_sparse_bucket_timestamp": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.EpochTimeUnitMillis"
+ }
+ ]
+ },
+ "input_record_count": {
+ "type": "number"
+ },
+ "log_time": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.EpochTimeUnitMillis"
+ }
+ ]
+ }
+ },
+ "required": [
+ "job_id",
+ "processed_record_count",
+ "processed_field_count",
+ "input_bytes",
+ "input_field_count",
+ "invalid_date_count",
+ "missing_field_count",
+ "out_of_order_timestamp_count",
+ "empty_bucket_count",
+ "sparse_bucket_count",
+ "bucket_count",
+ "input_record_count"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "deprecated": true,
+ "x-state": "Generally available; Added in 5.4.0",
+ "x-variations": [
+ "\n POST\n /_ml/anomaly_detectors/{job_id}/_data\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_ml`\n"
+ ],
+ "x-api": "post_data.ml",
+ "x-category": "ai/ml",
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/data_frame/analytics/_preview": {
+ "get": {
+ "tags": [
+ "ml data frame"
+ ],
+ "summary": "Preview features used by data frame analytics",
+ "description": "Preview the extracted features used by a data frame analytics config.",
+ "operationId": "ml-preview-data-frame-analytics",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "config": {
+ "description": "A data frame analytics config as described in create data frame analytics\njobs. Note that `id` and `dest` don’t need to be provided in the context of\nthis API.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml.preview_data_frame_analytics.DataframePreviewConfig"
+ }
+ ]
+ }
+ }
+ },
+ "examples": {
+ "MlPreviewDataFrameAnalyticsExample1": {
+ "description": "An example body for a `POST _ml/data_frame/analytics/_preview` request.",
+ "value": "{\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "feature_values": {
+ "description": "An array of objects that contain feature name and value pairs. The features have been processed and indicate what will be sent to the model for training.",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "required": [
+ "feature_values"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 7.13.0",
+ "x-variations": [
+ "\n GET\n /_ml/data_frame/analytics/_preview\n
\n ",
+ "\n POST\n /_ml/data_frame/analytics/_preview\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor_ml`\n"
+ ],
+ "x-api": "preview_data_frame_analytics.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _ml/data_frame/analytics/_preview\n{\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.preview_data_frame_analytics(\n config={\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.previewDataFrameAnalytics({\n config: {\n source: {\n index: \"houses_sold_last_10_yrs\",\n },\n analysis: {\n regression: {\n dependent_variable: \"price\",\n },\n },\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.preview_data_frame_analytics(\n body: {\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->previewDataFrameAnalytics([\n \"body\" => [\n \"config\" => [\n \"source\" => [\n \"index\" => \"houses_sold_last_10_yrs\",\n ],\n \"analysis\" => [\n \"regression\" => [\n \"dependent_variable\" => \"price\",\n ],\n ],\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"config\":{\"source\":{\"index\":\"houses_sold_last_10_yrs\"},\"analysis\":{\"regression\":{\"dependent_variable\":\"price\"}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/_preview\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ },
+ "post": {
+ "tags": [
+ "ml data frame"
+ ],
+ "summary": "Preview features used by data frame analytics",
+ "description": "Preview the extracted features used by a data frame analytics config.",
+ "operationId": "ml-preview-data-frame-analytics-1",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "config": {
+ "description": "A data frame analytics config as described in create data frame analytics\njobs. Note that `id` and `dest` don’t need to be provided in the context of\nthis API.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml.preview_data_frame_analytics.DataframePreviewConfig"
+ }
+ ]
+ }
+ }
+ },
+ "examples": {
+ "MlPreviewDataFrameAnalyticsExample1": {
+ "description": "An example body for a `POST _ml/data_frame/analytics/_preview` request.",
+ "value": "{\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "feature_values": {
+ "description": "An array of objects that contain feature name and value pairs. The features have been processed and indicate what will be sent to the model for training.",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "required": [
+ "feature_values"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 7.13.0",
+ "x-variations": [
+ "\n GET\n /_ml/data_frame/analytics/_preview\n
\n ",
+ "\n POST\n /_ml/data_frame/analytics/_preview\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor_ml`\n"
+ ],
+ "x-api": "preview_data_frame_analytics.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _ml/data_frame/analytics/_preview\n{\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.preview_data_frame_analytics(\n config={\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.previewDataFrameAnalytics({\n config: {\n source: {\n index: \"houses_sold_last_10_yrs\",\n },\n analysis: {\n regression: {\n dependent_variable: \"price\",\n },\n },\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.preview_data_frame_analytics(\n body: {\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->previewDataFrameAnalytics([\n \"body\" => [\n \"config\" => [\n \"source\" => [\n \"index\" => \"houses_sold_last_10_yrs\",\n ],\n \"analysis\" => [\n \"regression\" => [\n \"dependent_variable\" => \"price\",\n ],\n ],\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"config\":{\"source\":{\"index\":\"houses_sold_last_10_yrs\"},\"analysis\":{\"regression\":{\"dependent_variable\":\"price\"}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/_preview\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/data_frame/analytics/{id}/_preview": {
+ "get": {
+ "tags": [
+ "ml data frame"
+ ],
+ "summary": "Preview features used by data frame analytics",
+ "description": "Preview the extracted features used by a data frame analytics config.",
+ "operationId": "ml-preview-data-frame-analytics-2",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "id",
+ "description": "Identifier for the data frame analytics job.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "config": {
+ "description": "A data frame analytics config as described in create data frame analytics\njobs. Note that `id` and `dest` don’t need to be provided in the context of\nthis API.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml.preview_data_frame_analytics.DataframePreviewConfig"
+ }
+ ]
+ }
+ }
+ },
+ "examples": {
+ "MlPreviewDataFrameAnalyticsExample1": {
+ "description": "An example body for a `POST _ml/data_frame/analytics/_preview` request.",
+ "value": "{\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "feature_values": {
+ "description": "An array of objects that contain feature name and value pairs. The features have been processed and indicate what will be sent to the model for training.",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "required": [
+ "feature_values"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 7.13.0",
+ "x-variations": [
+ "\n GET\n /_ml/data_frame/analytics/{id}/_preview\n
\n ",
+ "\n POST\n /_ml/data_frame/analytics/{id}/_preview\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor_ml`\n"
+ ],
+ "x-api": "preview_data_frame_analytics.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _ml/data_frame/analytics/_preview\n{\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.preview_data_frame_analytics(\n config={\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.previewDataFrameAnalytics({\n config: {\n source: {\n index: \"houses_sold_last_10_yrs\",\n },\n analysis: {\n regression: {\n dependent_variable: \"price\",\n },\n },\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.preview_data_frame_analytics(\n body: {\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->previewDataFrameAnalytics([\n \"body\" => [\n \"config\" => [\n \"source\" => [\n \"index\" => \"houses_sold_last_10_yrs\",\n ],\n \"analysis\" => [\n \"regression\" => [\n \"dependent_variable\" => \"price\",\n ],\n ],\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"config\":{\"source\":{\"index\":\"houses_sold_last_10_yrs\"},\"analysis\":{\"regression\":{\"dependent_variable\":\"price\"}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/_preview\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ },
+ "post": {
+ "tags": [
+ "ml data frame"
+ ],
+ "summary": "Preview features used by data frame analytics",
+ "description": "Preview the extracted features used by a data frame analytics config.",
+ "operationId": "ml-preview-data-frame-analytics-3",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "id",
+ "description": "Identifier for the data frame analytics job.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "config": {
+ "description": "A data frame analytics config as described in create data frame analytics\njobs. Note that `id` and `dest` don’t need to be provided in the context of\nthis API.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml.preview_data_frame_analytics.DataframePreviewConfig"
+ }
+ ]
+ }
+ }
+ },
+ "examples": {
+ "MlPreviewDataFrameAnalyticsExample1": {
+ "description": "An example body for a `POST _ml/data_frame/analytics/_preview` request.",
+ "value": "{\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "feature_values": {
+ "description": "An array of objects that contain feature name and value pairs. The features have been processed and indicate what will be sent to the model for training.",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "required": [
+ "feature_values"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 7.13.0",
+ "x-variations": [
+ "\n GET\n /_ml/data_frame/analytics/{id}/_preview\n
\n ",
+ "\n POST\n /_ml/data_frame/analytics/{id}/_preview\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor_ml`\n"
+ ],
+ "x-api": "preview_data_frame_analytics.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _ml/data_frame/analytics/_preview\n{\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.preview_data_frame_analytics(\n config={\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.previewDataFrameAnalytics({\n config: {\n source: {\n index: \"houses_sold_last_10_yrs\",\n },\n analysis: {\n regression: {\n dependent_variable: \"price\",\n },\n },\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.preview_data_frame_analytics(\n body: {\n \"config\": {\n \"source\": {\n \"index\": \"houses_sold_last_10_yrs\"\n },\n \"analysis\": {\n \"regression\": {\n \"dependent_variable\": \"price\"\n }\n }\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->previewDataFrameAnalytics([\n \"body\" => [\n \"config\" => [\n \"source\" => [\n \"index\" => \"houses_sold_last_10_yrs\",\n ],\n \"analysis\" => [\n \"regression\" => [\n \"dependent_variable\" => \"price\",\n ],\n ],\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"config\":{\"source\":{\"index\":\"houses_sold_last_10_yrs\"},\"analysis\":{\"regression\":{\"dependent_variable\":\"price\"}}}}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/_preview\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/datafeeds/{datafeed_id}/_preview": {
+ "get": {
+ "tags": [
+ "ml anomaly"
+ ],
+ "summary": "Preview a datafeed",
+ "description": "This API returns the first \"page\" of search results from a datafeed.\nYou can preview an existing datafeed or provide configuration details for a datafeed\nand anomaly detection job in the API. The preview shows the structure of the data\nthat will be passed to the anomaly detection engine.\nIMPORTANT: When Elasticsearch security features are enabled, the preview uses the credentials of the user that\ncalled the API. However, when the datafeed starts it uses the roles of the last user that created or updated the\ndatafeed. To get a preview that accurately reflects the behavior of the datafeed, use the appropriate credentials.\nYou can also use secondary authorization headers to supply the credentials.",
+ "operationId": "ml-preview-datafeed",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "datafeed_id",
+ "description": "A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase\nalphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric\ncharacters. NOTE: If you use this path parameter, you cannot provide datafeed or anomaly detection job\nconfiguration details in the request body.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "start",
+ "description": "The start time from where the datafeed preview should begin",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.DateTime"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "end",
+ "description": "The end time when the datafeed preview should stop",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.DateTime"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "datafeed_config": {
+ "description": "The datafeed definition to preview.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.DatafeedConfig"
+ }
+ ]
+ },
+ "job_config": {
+ "description": "The configuration details for the anomaly detection job that is associated with the datafeed. If the\n`datafeed_config` object does not include a `job_id` that references an existing anomaly detection job, you must\nsupply this `job_config` object. If you include both a `job_id` and a `job_config`, the latter information is\nused. You cannot specify a `job_config` object unless you also supply a `datafeed_config` object.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.JobConfig"
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "object"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 5.4.0",
+ "x-variations": [
+ "\n GET\n /_ml/datafeeds/{datafeed_id}/_preview\n
\n ",
+ "\n POST\n /_ml/datafeeds/{datafeed_id}/_preview\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n",
+ "Cluster privileges: `manage_ml`\n"
+ ],
+ "x-api": "preview_datafeed.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _ml/datafeeds/datafeed-high_sum_total_sales/_preview\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.preview_datafeed(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.previewDatafeed({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.preview_datafeed(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->previewDatafeed([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales/_preview\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().previewDatafeed(p -> p\n .datafeedId(\"datafeed-high_sum_total_sales\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ },
+ "post": {
+ "tags": [
+ "ml anomaly"
+ ],
+ "summary": "Preview a datafeed",
+ "description": "This API returns the first \"page\" of search results from a datafeed.\nYou can preview an existing datafeed or provide configuration details for a datafeed\nand anomaly detection job in the API. The preview shows the structure of the data\nthat will be passed to the anomaly detection engine.\nIMPORTANT: When Elasticsearch security features are enabled, the preview uses the credentials of the user that\ncalled the API. However, when the datafeed starts it uses the roles of the last user that created or updated the\ndatafeed. To get a preview that accurately reflects the behavior of the datafeed, use the appropriate credentials.\nYou can also use secondary authorization headers to supply the credentials.",
+ "operationId": "ml-preview-datafeed-1",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "datafeed_id",
+ "description": "A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase\nalphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric\ncharacters. NOTE: If you use this path parameter, you cannot provide datafeed or anomaly detection job\nconfiguration details in the request body.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "start",
+ "description": "The start time from where the datafeed preview should begin",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.DateTime"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "end",
+ "description": "The end time when the datafeed preview should stop",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.DateTime"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "datafeed_config": {
+ "description": "The datafeed definition to preview.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.DatafeedConfig"
+ }
+ ]
+ },
+ "job_config": {
+ "description": "The configuration details for the anomaly detection job that is associated with the datafeed. If the\n`datafeed_config` object does not include a `job_id` that references an existing anomaly detection job, you must\nsupply this `job_config` object. If you include both a `job_id` and a `job_config`, the latter information is\nused. You cannot specify a `job_config` object unless you also supply a `datafeed_config` object.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.JobConfig"
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "object"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 5.4.0",
+ "x-variations": [
+ "\n GET\n /_ml/datafeeds/{datafeed_id}/_preview\n
\n ",
+ "\n POST\n /_ml/datafeeds/{datafeed_id}/_preview\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n",
+ "Cluster privileges: `manage_ml`\n"
+ ],
+ "x-api": "preview_datafeed.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _ml/datafeeds/datafeed-high_sum_total_sales/_preview\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.preview_datafeed(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.previewDatafeed({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.preview_datafeed(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->previewDatafeed([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales/_preview\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().previewDatafeed(p -> p\n .datafeedId(\"datafeed-high_sum_total_sales\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/datafeeds/_preview": {
+ "get": {
+ "tags": [
+ "ml anomaly"
+ ],
+ "summary": "Preview a datafeed",
+ "description": "This API returns the first \"page\" of search results from a datafeed.\nYou can preview an existing datafeed or provide configuration details for a datafeed\nand anomaly detection job in the API. The preview shows the structure of the data\nthat will be passed to the anomaly detection engine.\nIMPORTANT: When Elasticsearch security features are enabled, the preview uses the credentials of the user that\ncalled the API. However, when the datafeed starts it uses the roles of the last user that created or updated the\ndatafeed. To get a preview that accurately reflects the behavior of the datafeed, use the appropriate credentials.\nYou can also use secondary authorization headers to supply the credentials.",
+ "operationId": "ml-preview-datafeed-2",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "start",
+ "description": "The start time from where the datafeed preview should begin",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.DateTime"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "end",
+ "description": "The end time when the datafeed preview should stop",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.DateTime"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "datafeed_config": {
+ "description": "The datafeed definition to preview.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.DatafeedConfig"
+ }
+ ]
+ },
+ "job_config": {
+ "description": "The configuration details for the anomaly detection job that is associated with the datafeed. If the\n`datafeed_config` object does not include a `job_id` that references an existing anomaly detection job, you must\nsupply this `job_config` object. If you include both a `job_id` and a `job_config`, the latter information is\nused. You cannot specify a `job_config` object unless you also supply a `datafeed_config` object.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.JobConfig"
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "object"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 5.4.0",
+ "x-variations": [
+ "\n GET\n /_ml/datafeeds/_preview\n
\n ",
+ "\n POST\n /_ml/datafeeds/_preview\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n",
+ "Cluster privileges: `manage_ml`\n"
+ ],
+ "x-api": "preview_datafeed.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _ml/datafeeds/datafeed-high_sum_total_sales/_preview\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.preview_datafeed(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.previewDatafeed({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.preview_datafeed(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->previewDatafeed([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales/_preview\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().previewDatafeed(p -> p\n .datafeedId(\"datafeed-high_sum_total_sales\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ },
+ "post": {
+ "tags": [
+ "ml anomaly"
+ ],
+ "summary": "Preview a datafeed",
+ "description": "This API returns the first \"page\" of search results from a datafeed.\nYou can preview an existing datafeed or provide configuration details for a datafeed\nand anomaly detection job in the API. The preview shows the structure of the data\nthat will be passed to the anomaly detection engine.\nIMPORTANT: When Elasticsearch security features are enabled, the preview uses the credentials of the user that\ncalled the API. However, when the datafeed starts it uses the roles of the last user that created or updated the\ndatafeed. To get a preview that accurately reflects the behavior of the datafeed, use the appropriate credentials.\nYou can also use secondary authorization headers to supply the credentials.",
+ "operationId": "ml-preview-datafeed-3",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "start",
+ "description": "The start time from where the datafeed preview should begin",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.DateTime"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "end",
+ "description": "The end time when the datafeed preview should stop",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.DateTime"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "datafeed_config": {
+ "description": "The datafeed definition to preview.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.DatafeedConfig"
+ }
+ ]
+ },
+ "job_config": {
+ "description": "The configuration details for the anomaly detection job that is associated with the datafeed. If the\n`datafeed_config` object does not include a `job_id` that references an existing anomaly detection job, you must\nsupply this `job_config` object. If you include both a `job_id` and a `job_config`, the latter information is\nused. You cannot specify a `job_config` object unless you also supply a `datafeed_config` object.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.JobConfig"
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "object"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 5.4.0",
+ "x-variations": [
+ "\n GET\n /_ml/datafeeds/_preview\n
\n ",
+ "\n POST\n /_ml/datafeeds/_preview\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n",
+ "Cluster privileges: `manage_ml`\n"
+ ],
+ "x-api": "preview_datafeed.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _ml/datafeeds/datafeed-high_sum_total_sales/_preview\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.preview_datafeed(\n datafeed_id=\"datafeed-high_sum_total_sales\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.previewDatafeed({\n datafeed_id: \"datafeed-high_sum_total_sales\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.preview_datafeed(\n datafeed_id: \"datafeed-high_sum_total_sales\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->previewDatafeed([\n \"datafeed_id\" => \"datafeed-high_sum_total_sales\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-high_sum_total_sales/_preview\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().previewDatafeed(p -> p\n .datafeedId(\"datafeed-high_sum_total_sales\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/trained_models/{model_id}/definition/{part}": {
+ "put": {
+ "tags": [
+ "ml trained model"
+ ],
+ "summary": "Create part of a trained model definition",
+ "operationId": "ml-put-trained-model-definition-part",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "model_id",
+ "description": "The unique identifier of the trained model.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "path",
+ "name": "part",
+ "description": "The definition part number. When the definition is loaded for inference the definition parts are streamed in the\norder of their part number. The first part must be `0` and the final part must be `total_parts - 1`.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "simple"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "definition": {
+ "description": "The definition part for the model. Must be a base64 encoded string.",
+ "type": "string"
+ },
+ "total_definition_length": {
+ "description": "The total uncompressed definition length in bytes. Not base64 encoded.",
+ "type": "number"
+ },
+ "total_parts": {
+ "description": "The total number of parts that will be uploaded. Must be greater than 0.",
+ "type": "number"
+ }
+ },
+ "required": [
+ "definition",
+ "total_definition_length",
+ "total_parts"
+ ]
+ },
+ "examples": {
+ "MlPutTrainedModelDefinitionPartExample1": {
+ "description": "An example body for a `PUT _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/definition/0` request.",
+ "value": "{\n \"definition\": \"...\",\n \"total_definition_length\": 265632637,\n \"total_parts\": 64\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_types.AcknowledgedResponseBase"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 8.0.0",
+ "x-variations": [
+ "\n PUT\n /_ml/trained_models/{model_id}/definition/{part}\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_ml`\n"
+ ],
+ "x-api": "put_trained_model_definition_part.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "PUT _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/definition/0\n{\n \"definition\": \"...\",\n \"total_definition_length\": 265632637,\n \"total_parts\": 64\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.put_trained_model_definition_part(\n model_id=\"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n part=\"0\",\n definition=\"...\",\n total_definition_length=265632637,\n total_parts=64,\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.putTrainedModelDefinitionPart({\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n part: 0,\n definition: \"...\",\n total_definition_length: 265632637,\n total_parts: 64,\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.put_trained_model_definition_part(\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n part: \"0\",\n body: {\n \"definition\": \"...\",\n \"total_definition_length\": 265632637,\n \"total_parts\": 64\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->putTrainedModelDefinitionPart([\n \"model_id\" => \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n \"part\" => \"0\",\n \"body\" => [\n \"definition\" => \"...\",\n \"total_definition_length\" => 265632637,\n \"total_parts\" => 64,\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"definition\":\"...\",\"total_definition_length\":265632637,\"total_parts\":64}' \"$ELASTICSEARCH_URL/_ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/definition/0\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().putTrainedModelDefinitionPart(p -> p\n .definition(\"...\")\n .modelId(\"elastic__distilbert-base-uncased-finetuned-conll03-english\")\n .part(0)\n .totalDefinitionLength(265632637L)\n .totalParts(64)\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/trained_models/{model_id}/vocabulary": {
+ "put": {
+ "tags": [
+ "ml trained model"
+ ],
+ "summary": "Create a trained model vocabulary",
+ "description": "This API is supported only for natural language processing (NLP) models.\nThe vocabulary is stored in the index as described in `inference_config.*.vocabulary` of the trained model definition.",
+ "operationId": "ml-put-trained-model-vocabulary",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "model_id",
+ "description": "The unique identifier of the trained model.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "vocabulary": {
+ "description": "The model vocabulary, which must not be empty.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "merges": {
+ "description": "The optional model merges if required by the tokenizer.",
+ "x-state": "Generally available; Added in 8.2.0",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "scores": {
+ "description": "The optional vocabulary value scores if required by the tokenizer.",
+ "x-state": "Generally available; Added in 8.9.0",
+ "type": "array",
+ "items": {
+ "type": "number"
+ }
+ }
+ },
+ "required": [
+ "vocabulary"
+ ]
+ },
+ "examples": {
+ "MlPutTrainedModelVocabularyExample1": {
+ "description": "An example body for a `PUT _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/vocabulary` request.",
+ "value": "{\n \"vocabulary\": [\n \"[PAD]\",\n \"[unused0]\",\n ]\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_types.AcknowledgedResponseBase"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 8.0.0",
+ "x-variations": [
+ "\n PUT\n /_ml/trained_models/{model_id}/vocabulary\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_ml`\n"
+ ],
+ "x-api": "put_trained_model_vocabulary.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "PUT _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/vocabulary\n{\n \"vocabulary\": [\n \"[PAD]\",\n \"[unused0]\",\n ]\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.put_trained_model_vocabulary(\n model_id=\"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n vocabulary=[\n \"[PAD]\",\n \"[unused0]\"\n ],\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.putTrainedModelVocabulary({\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n vocabulary: [\"[PAD]\", \"[unused0]\"],\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.put_trained_model_vocabulary(\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n body: {\n \"vocabulary\": [\n \"[PAD]\",\n \"[unused0]\"\n ]\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->putTrainedModelVocabulary([\n \"model_id\" => \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n \"body\" => [\n \"vocabulary\" => array(\n \"[PAD]\",\n \"[unused0]\",\n ),\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"vocabulary\":[\"[PAD]\",\"[unused0]\"]}' \"$ELASTICSEARCH_URL/_ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/vocabulary\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().putTrainedModelVocabulary(p -> p\n .modelId(\"elastic__distilbert-base-uncased-finetuned-conll03-english\")\n .vocabulary(List.of(\"[PAD]\",\"[unused0]\"))\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/anomaly_detectors/{job_id}/_reset": {
+ "post": {
+ "tags": [
+ "ml anomaly"
+ ],
+ "summary": "Reset an anomaly detection job",
+ "description": "All model state and results are deleted. The job is ready to start over as if\nit had just been created.\nIt is not currently possible to reset multiple jobs using wildcards or a\ncomma separated list.",
+ "operationId": "ml-reset-job",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "job_id",
+ "description": "The ID of the job to reset.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "wait_for_completion",
+ "description": "Should this request wait until the operation has completed before\nreturning.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "delete_user_annotations",
+ "description": "Specifies whether annotations that have been added by the\nuser should be deleted along with any auto-generated annotations when the job is\nreset.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_types.AcknowledgedResponseBase"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 7.14.0",
+ "x-variations": [
+ "\n POST\n /_ml/anomaly_detectors/{job_id}/_reset\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_ml`\n"
+ ],
+ "x-api": "reset_job.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _ml/anomaly_detectors/total-requests/_reset\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.reset_job(\n job_id=\"total-requests\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.resetJob({\n job_id: \"total-requests\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.reset_job(\n job_id: \"total-requests\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->resetJob([\n \"job_id\" => \"total-requests\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/total-requests/_reset\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().resetJob(r -> r\n .jobId(\"total-requests\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_revert": {
+ "post": {
+ "tags": [
+ "ml anomaly"
+ ],
+ "summary": "Revert to a snapshot",
+ "description": "The machine learning features react quickly to anomalous input, learning new\nbehaviors in data. Highly anomalous input increases the variance in the\nmodels whilst the system learns whether this is a new step-change in behavior\nor a one-off event. In the case where this anomalous input is known to be a\none-off, then it might be appropriate to reset the model state to a time\nbefore this event. For example, you might consider reverting to a saved\nsnapshot after Black Friday or a critical system failure.",
+ "operationId": "ml-revert-model-snapshot",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "job_id",
+ "description": "Identifier for the anomaly detection job.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "path",
+ "name": "snapshot_id",
+ "description": "You can specify `empty` as the . Reverting to the empty\nsnapshot means the anomaly detection job starts learning a new model from\nscratch when it is started.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "delete_intervening_results",
+ "description": "If true, deletes the results in the time period between the latest\nresults and the time of the reverted snapshot. It also resets the model\nto accept records for this time period. If you choose not to delete\nintervening results when reverting a snapshot, the job will not accept\ninput data that is older than the current time. If you want to resend\ndata, then delete the intervening results.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "delete_intervening_results": {
+ "description": "Refer to the description for the `delete_intervening_results` query parameter.",
+ "default": false,
+ "type": "boolean"
+ }
+ }
+ },
+ "examples": {
+ "MlRevertModelSnapshotExample1": {
+ "description": "An example body for a `POST _ml/anomaly_detectors/low_request_rate/model_snapshots/1637092688/_revert` request.",
+ "value": "{\n \"delete_intervening_results\": true\n}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "model": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.ModelSnapshot"
+ }
+ ]
+ }
+ },
+ "required": [
+ "model"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 5.4.0",
+ "x-variations": [
+ "\n POST\n /_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_revert\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_ml`\n"
+ ],
+ "x-api": "revert_model_snapshot.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _ml/anomaly_detectors/low_request_rate/model_snapshots/1637092688/_revert\n{\n \"delete_intervening_results\": true\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.revert_model_snapshot(\n job_id=\"low_request_rate\",\n snapshot_id=\"1637092688\",\n delete_intervening_results=True,\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.revertModelSnapshot({\n job_id: \"low_request_rate\",\n snapshot_id: 1637092688,\n delete_intervening_results: true,\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.revert_model_snapshot(\n job_id: \"low_request_rate\",\n snapshot_id: \"1637092688\",\n body: {\n \"delete_intervening_results\": true\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->revertModelSnapshot([\n \"job_id\" => \"low_request_rate\",\n \"snapshot_id\" => \"1637092688\",\n \"body\" => [\n \"delete_intervening_results\" => true,\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"delete_intervening_results\":true}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/model_snapshots/1637092688/_revert\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().revertModelSnapshot(r -> r\n .deleteInterveningResults(true)\n .jobId(\"low_request_rate\")\n .snapshotId(\"1637092688\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/set_upgrade_mode": {
+ "post": {
+ "tags": [
+ "ml"
+ ],
+ "summary": "Set upgrade_mode for ML indices",
+ "description": "Sets a cluster wide upgrade_mode setting that prepares machine learning\nindices for an upgrade.\nWhen upgrading your cluster, in some circumstances you must restart your\nnodes and reindex your machine learning indices. In those circumstances,\nthere must be no machine learning jobs running. You can close the machine\nlearning jobs, do the upgrade, then open all the jobs again. Alternatively,\nyou can use this API to temporarily halt tasks associated with the jobs and\ndatafeeds and prevent new jobs from opening. You can also use this API\nduring upgrades that do not require you to reindex your machine learning\nindices, though stopping jobs is not a requirement in that case.\nYou can see the current value for the upgrade_mode setting by using the get\nmachine learning info API.",
+ "operationId": "ml-set-upgrade-mode",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "enabled",
+ "description": "When `true`, it enables `upgrade_mode` which temporarily halts all job\nand datafeed tasks and prohibits new job and datafeed tasks from\nstarting.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "The time to wait for the request to be completed.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_types.AcknowledgedResponseBase"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 6.7.0",
+ "x-variations": [
+ "\n POST\n /_ml/set_upgrade_mode\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_ml`\n"
+ ],
+ "x-api": "set_upgrade_mode.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _ml/set_upgrade_mode?enabled=true\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.set_upgrade_mode(\n enabled=True,\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.setUpgradeMode({\n enabled: \"true\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.set_upgrade_mode(\n enabled: \"true\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->setUpgradeMode([\n \"enabled\" => \"true\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/set_upgrade_mode?enabled=true\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().setUpgradeMode(s -> s\n .enabled(true)\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/data_frame/analytics/{id}/_start": {
+ "post": {
+ "tags": [
+ "ml data frame"
+ ],
+ "summary": "Start a data frame analytics job",
+ "description": "A data frame analytics job can be started and stopped multiple times\nthroughout its lifecycle.\nIf the destination index does not exist, it is created automatically the\nfirst time you start the data frame analytics job. The\n`index.number_of_shards` and `index.number_of_replicas` settings for the\ndestination index are copied from the source index. If there are multiple\nsource indices, the destination index copies the highest setting values. The\nmappings for the destination index are also copied from the source indices.\nIf there are any mapping conflicts, the job fails to start.\nIf the destination index exists, it is used as is. You can therefore set up\nthe destination index in advance with custom settings and mappings.",
+ "operationId": "ml-start-data-frame-analytics",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "id",
+ "description": "Identifier for the data frame analytics job. This identifier can contain\nlowercase alphanumeric characters (a-z and 0-9), hyphens, and\nunderscores. It must start and end with alphanumeric characters.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Controls the amount of time to wait until the data frame analytics job\nstarts.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "description": "If provided, must be the same identifier as in the path.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Id"
+ }
+ ]
+ },
+ "timeout": {
+ "description": "Controls the amount of time to wait until the data frame analytics job\nstarts.",
+ "default": "20s",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Duration"
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "acknowledged": {
+ "type": "boolean"
+ },
+ "node": {
+ "description": "The ID of the node that the job was started on. If the job is allowed to open lazily and has not yet been assigned to a node, this value is an empty string.\nThe node ID of the node the job has been assigned to, or\nan empty string if it hasn't been assigned to a node. In\nserverless if the job has been assigned to run then the\nnode ID will be \"serverless\".",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.NodeId"
+ }
+ ]
+ }
+ },
+ "required": [
+ "acknowledged",
+ "node"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 7.3.0",
+ "x-variations": [
+ "\n POST\n /_ml/data_frame/analytics/{id}/_start\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `create_index`,`index`,`manage`,`read`,`view_index_metadata`\n",
+ "Cluster privileges: `manage_ml`\n"
+ ],
+ "x-api": "start_data_frame_analytics.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _ml/data_frame/analytics/loganalytics/_start\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.start_data_frame_analytics(\n id=\"loganalytics\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.startDataFrameAnalytics({\n id: \"loganalytics\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.start_data_frame_analytics(\n id: \"loganalytics\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->startDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics/_start\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().startDataFrameAnalytics(s -> s\n .id(\"loganalytics\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/datafeeds/{datafeed_id}/_start": {
+ "post": {
+ "tags": [
+ "ml anomaly"
+ ],
+ "summary": "Start datafeeds",
+ "description": "A datafeed must be started in order to retrieve data from Elasticsearch. A datafeed can be started and stopped\nmultiple times throughout its lifecycle.\n\nBefore you can start a datafeed, the anomaly detection job must be open. Otherwise, an error occurs.\n\nIf you restart a stopped datafeed, it continues processing input data from the next millisecond after it was stopped.\nIf new data was indexed for that exact millisecond between stopping and starting, it will be ignored.\n\nWhen Elasticsearch security features are enabled, your datafeed remembers which roles the last user to create or\nupdate it had at the time of creation or update and runs the query using those same roles. If you provided secondary\nauthorization headers when you created or updated the datafeed, those credentials are used instead.",
+ "operationId": "ml-start-datafeed",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "datafeed_id",
+ "description": "A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase\nalphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric\ncharacters.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "end",
+ "description": "The time that the datafeed should end, which can be specified by using one of the following formats:\n\n* ISO 8601 format with milliseconds, for example `2017-01-22T06:00:00.000Z`\n* ISO 8601 format without milliseconds, for example `2017-01-22T06:00:00+00:00`\n* Milliseconds since the epoch, for example `1485061200000`\n\nDate-time arguments using either of the ISO 8601 formats must have a time zone designator, where `Z` is accepted\nas an abbreviation for UTC time. When a URL is expected (for example, in browsers), the `+` used in time zone\ndesignators must be encoded as `%2B`.\nThe end time value is exclusive. If you do not specify an end time, the datafeed\nruns continuously.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.DateTime"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "start",
+ "description": "The time that the datafeed should begin, which can be specified by using the same formats as the `end` parameter.\nThis value is inclusive.\nIf you do not specify a start time and the datafeed is associated with a new anomaly detection job, the analysis\nstarts from the earliest time for which data is available.\nIf you restart a stopped datafeed and specify a start value that is earlier than the timestamp of the latest\nprocessed record, the datafeed continues from 1 millisecond after the timestamp of the latest processed record.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.DateTime"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Specifies the amount of time to wait until a datafeed starts.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "end": {
+ "description": "Refer to the description for the `end` query parameter.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.DateTime"
+ }
+ ]
+ },
+ "start": {
+ "description": "Refer to the description for the `start` query parameter.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.DateTime"
+ }
+ ]
+ },
+ "timeout": {
+ "description": "Refer to the description for the `timeout` query parameter.",
+ "default": "20s",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Duration"
+ }
+ ]
+ }
+ }
+ },
+ "examples": {
+ "MlStartDatafeedExample1": {
+ "description": "An example body for a `POST _ml/datafeeds/datafeed-low_request_rate/_start` request.",
+ "value": "{\n \"start\": \"2019-04-07T18:22:16Z\"\n}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "node": {
+ "description": "The ID of the node that the job was started on. In serverless this will be the \"serverless\".\nIf the job is allowed to open lazily and has not yet been assigned to a node, this value is an empty string.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.NodeIds"
+ }
+ ]
+ },
+ "started": {
+ "description": "For a successful response, this value is always `true`. On failure, an exception is returned instead.",
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "node",
+ "started"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 5.5.0",
+ "x-variations": [
+ "\n POST\n /_ml/datafeeds/{datafeed_id}/_start\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_ml`\n"
+ ],
+ "x-api": "start_datafeed.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _ml/datafeeds/datafeed-low_request_rate/_start\n{\n \"start\": \"2019-04-07T18:22:16Z\"\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.start_datafeed(\n datafeed_id=\"datafeed-low_request_rate\",\n start=\"2019-04-07T18:22:16Z\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.startDatafeed({\n datafeed_id: \"datafeed-low_request_rate\",\n start: \"2019-04-07T18:22:16Z\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.start_datafeed(\n datafeed_id: \"datafeed-low_request_rate\",\n body: {\n \"start\": \"2019-04-07T18:22:16Z\"\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->startDatafeed([\n \"datafeed_id\" => \"datafeed-low_request_rate\",\n \"body\" => [\n \"start\" => \"2019-04-07T18:22:16Z\",\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"start\":\"2019-04-07T18:22:16Z\"}' \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-low_request_rate/_start\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().startDatafeed(s -> s\n .datafeedId(\"datafeed-low_request_rate\")\n .start(DateTime.of(\"2019-04-07T18:22:16Z\"))\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/trained_models/{model_id}/deployment/_start": {
+ "post": {
+ "tags": [
+ "ml trained model"
+ ],
+ "summary": "Start a trained model deployment",
+ "description": "It allocates the model to every machine learning node.",
+ "operationId": "ml-start-trained-model-deployment",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "model_id",
+ "description": "The unique identifier of the trained model. Currently, only PyTorch models are supported.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "cache_size",
+ "description": "The inference cache size (in memory outside the JVM heap) per node for the model.\nThe default value is the same size as the `model_size_bytes`. To disable the cache,\n`0b` can be provided.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.ByteSize"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "deployment_id",
+ "description": "A unique identifier for the deployment of the model.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "x-state": "Generally available; Added in 8.8.0",
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "number_of_allocations",
+ "description": "The number of model allocations on each node where the model is deployed.\nAll allocations on a node share the same copy of the model in memory but use\na separate set of threads to evaluate the model.\nIncreasing this value generally increases the throughput.\nIf this setting is greater than the number of hardware threads\nit will automatically be changed to a value less than the number of hardware threads.\nIf adaptive_allocations is enabled, do not set this value, because it’s automatically set.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "priority",
+ "description": "The deployment priority",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/ml._types.TrainingPriority"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "queue_capacity",
+ "description": "Specifies the number of inference requests that are allowed in the queue. After the number of requests exceeds\nthis value, new requests are rejected with a 429 error.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "threads_per_allocation",
+ "description": "Sets the number of threads used by each model allocation during inference. This generally increases\nthe inference speed. The inference process is a compute-bound process; any number\ngreater than the number of available hardware threads on the machine does not increase the\ninference speed. If this setting is greater than the number of hardware threads\nit will automatically be changed to a value less than the number of hardware threads.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Specifies the amount of time to wait for the model to deploy.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "wait_for",
+ "description": "Specifies the allocation status to wait for before returning.\n\nSupported values include:\n - `started`: The trained model is started on at least one node.\n - `starting`: Trained model deployment is starting but it is not yet deployed on any nodes.\n - `fully_allocated`: Trained model deployment has started on all valid nodes.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/ml._types.DeploymentAllocationState"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "adaptive_allocations": {
+ "description": "Adaptive allocations configuration. When enabled, the number of allocations\nis set based on the current load.\nIf adaptive_allocations is enabled, do not set the number of allocations manually.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.AdaptiveAllocationsSettings"
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "assignment": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.TrainedModelAssignment"
+ }
+ ]
+ }
+ },
+ "required": [
+ "assignment"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 8.0.0",
+ "x-variations": [
+ "\n POST\n /_ml/trained_models/{model_id}/deployment/_start\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_ml`\n"
+ ],
+ "x-api": "start_trained_model_deployment.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_start?wait_for=started&timeout=1m\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.start_trained_model_deployment(\n model_id=\"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n wait_for=\"started\",\n timeout=\"1m\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.startTrainedModelDeployment({\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n wait_for: \"started\",\n timeout: \"1m\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.start_trained_model_deployment(\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n wait_for: \"started\",\n timeout: \"1m\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->startTrainedModelDeployment([\n \"model_id\" => \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n \"wait_for\" => \"started\",\n \"timeout\" => \"1m\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_start?wait_for=started&timeout=1m\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/data_frame/analytics/{id}/_stop": {
+ "post": {
+ "tags": [
+ "ml data frame"
+ ],
+ "summary": "Stop data frame analytics jobs",
+ "description": "A data frame analytics job can be started and stopped multiple times\nthroughout its lifecycle.",
+ "operationId": "ml-stop-data-frame-analytics",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "id",
+ "description": "Identifier for the data frame analytics job. This identifier can contain\nlowercase alphanumeric characters (a-z and 0-9), hyphens, and\nunderscores. It must start and end with alphanumeric characters.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "allow_no_match",
+ "description": "Specifies what to do when the request:\n\n1. Contains wildcard expressions and there are no data frame analytics\njobs that match.\n2. Contains the _all string or no identifiers and there are no matches.\n3. Contains wildcard expressions and there are only partial matches.\n\nThe default value is true, which returns an empty data_frame_analytics\narray when there are no matches and the subset of results when there are\npartial matches. If this parameter is false, the request returns a 404\nstatus code when there are no matches or only partial matches.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "force",
+ "description": "If true, the data frame analytics job is stopped forcefully.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Controls the amount of time to wait until the data frame analytics job\nstops. Defaults to 20 seconds.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "description": "If provided, must be the same identifier as in the path.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Id"
+ }
+ ]
+ },
+ "allow_no_match": {
+ "description": "Specifies what to do when the request:\n\n1. Contains wildcard expressions and there are no data frame analytics\njobs that match.\n2. Contains the _all string or no identifiers and there are no matches.\n3. Contains wildcard expressions and there are only partial matches.\n\nThe default value is true, which returns an empty data_frame_analytics\narray when there are no matches and the subset of results when there are\npartial matches. If this parameter is false, the request returns a 404\nstatus code when there are no matches or only partial matches.",
+ "default": true,
+ "type": "boolean"
+ },
+ "force": {
+ "description": "If true, the data frame analytics job is stopped forcefully.",
+ "default": false,
+ "type": "boolean"
+ },
+ "timeout": {
+ "description": "Controls the amount of time to wait until the data frame analytics job\nstops. Defaults to 20 seconds.",
+ "default": "20s",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Duration"
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "stopped": {
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "stopped"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 7.3.0",
+ "x-variations": [
+ "\n POST\n /_ml/data_frame/analytics/{id}/_stop\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_ml`\n"
+ ],
+ "x-api": "stop_data_frame_analytics.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _ml/data_frame/analytics/loganalytics/_stop\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.stop_data_frame_analytics(\n id=\"loganalytics\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.stopDataFrameAnalytics({\n id: \"loganalytics\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.stop_data_frame_analytics(\n id: \"loganalytics\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->stopDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics/_stop\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().stopDataFrameAnalytics(s -> s\n .id(\"loganalytics\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/datafeeds/{datafeed_id}/_stop": {
+ "post": {
+ "tags": [
+ "ml anomaly"
+ ],
+ "summary": "Stop datafeeds",
+ "description": "A datafeed that is stopped ceases to retrieve data from Elasticsearch. A datafeed can be started and stopped\nmultiple times throughout its lifecycle.",
+ "operationId": "ml-stop-datafeed",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "datafeed_id",
+ "description": "Identifier for the datafeed. You can stop multiple datafeeds in a single API request by using a comma-separated\nlist of datafeeds or a wildcard expression. You can close all datafeeds by using `_all` or by specifying `*` as\nthe identifier.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "allow_no_match",
+ "description": "Specifies what to do when the request:\n\n* Contains wildcard expressions and there are no datafeeds that match.\n* Contains the `_all` string or no identifiers and there are no matches.\n* Contains wildcard expressions and there are only partial matches.\n\nIf `true`, the API returns an empty datafeeds array when there are no matches and the subset of results when\nthere are partial matches. If `false`, the API returns a 404 status code when there are no matches or only\npartial matches.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "force",
+ "description": "If `true`, the datafeed is stopped forcefully.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Specifies the amount of time to wait until a datafeed stops.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "close_job",
+ "description": "If `true` the job associated with the datafeed is closed.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "allow_no_match": {
+ "description": "Refer to the description for the `allow_no_match` query parameter.",
+ "default": true,
+ "type": "boolean"
+ },
+ "force": {
+ "description": "Refer to the description for the `force` query parameter.",
+ "default": false,
+ "type": "boolean"
+ },
+ "timeout": {
+ "description": "Refer to the description for the `timeout` query parameter.",
+ "default": "20s",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Duration"
+ }
+ ]
+ },
+ "close_job": {
+ "description": "Refer to the description for the `close_job` query parameter.",
+ "default": false,
+ "type": "boolean"
+ }
+ }
+ },
+ "examples": {
+ "MlStopDatafeedExample1": {
+ "description": "An example body for a `POST _ml/datafeeds/datafeed-low_request_rate/_stop` request.",
+ "value": "{\n \"timeout\": \"30s\"\n}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "stopped": {
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "stopped"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 5.4.0",
+ "x-variations": [
+ "\n POST\n /_ml/datafeeds/{datafeed_id}/_stop\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_ml`\n"
+ ],
+ "x-api": "stop_datafeed.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _ml/datafeeds/datafeed-low_request_rate/_stop\n{\n \"timeout\": \"30s\"\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.stop_datafeed(\n datafeed_id=\"datafeed-low_request_rate\",\n timeout=\"30s\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.stopDatafeed({\n datafeed_id: \"datafeed-low_request_rate\",\n timeout: \"30s\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.stop_datafeed(\n datafeed_id: \"datafeed-low_request_rate\",\n body: {\n \"timeout\": \"30s\"\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->stopDatafeed([\n \"datafeed_id\" => \"datafeed-low_request_rate\",\n \"body\" => [\n \"timeout\" => \"30s\",\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"timeout\":\"30s\"}' \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-low_request_rate/_stop\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().stopDatafeed(s -> s\n .datafeedId(\"datafeed-low_request_rate\")\n .timeout(t -> t\n .time(\"30s\")\n )\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/trained_models/{model_id}/deployment/_stop": {
+ "post": {
+ "tags": [
+ "ml trained model"
+ ],
+ "summary": "Stop a trained model deployment",
+ "operationId": "ml-stop-trained-model-deployment",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "model_id",
+ "description": "The unique identifier of the trained model.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "allow_no_match",
+ "description": "Specifies what to do when the request: contains wildcard expressions and there are no deployments that match;\ncontains the `_all` string or no identifiers and there are no matches; or contains wildcard expressions and\nthere are only partial matches. By default, it returns an empty array when there are no matches and the subset of results when there are partial matches.\nIf `false`, the request returns a 404 status code when there are no matches or only partial matches.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "force",
+ "description": "Forcefully stops the deployment, even if it is used by ingest pipelines. You can't use these pipelines until you\nrestart the model deployment.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "description": "If provided, must be the same identifier as in the path.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Id"
+ }
+ ]
+ },
+ "allow_no_match": {
+ "description": "Specifies what to do when the request: contains wildcard expressions and there are no deployments that match;\ncontains the `_all` string or no identifiers and there are no matches; or contains wildcard expressions and\nthere are only partial matches. By default, it returns an empty array when there are no matches and the subset of results when there are partial matches.\nIf `false`, the request returns a 404 status code when there are no matches or only partial matches.",
+ "default": true,
+ "type": "boolean"
+ },
+ "force": {
+ "description": "Forcefully stops the deployment, even if it is used by ingest pipelines. You can't use these pipelines until you\nrestart the model deployment.",
+ "default": false,
+ "type": "boolean"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "stopped": {
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "stopped"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 8.0.0",
+ "x-variations": [
+ "\n POST\n /_ml/trained_models/{model_id}/deployment/_stop\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_ml`\n"
+ ],
+ "x-api": "stop_trained_model_deployment.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _ml/trained_models/my_model_for_search/deployment/_stop\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.stop_trained_model_deployment(\n model_id=\"my_model_for_search\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.stopTrainedModelDeployment({\n model_id: \"my_model_for_search\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.stop_trained_model_deployment(\n model_id: \"my_model_for_search\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->stopTrainedModelDeployment([\n \"model_id\" => \"my_model_for_search\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/trained_models/my_model_for_search/deployment/_stop\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().stopTrainedModelDeployment(s -> s\n .modelId(\"my_model_for_search\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/data_frame/analytics/{id}/_update": {
+ "post": {
+ "tags": [
+ "ml data frame"
+ ],
+ "summary": "Update a data frame analytics job",
+ "operationId": "ml-update-data-frame-analytics",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "id",
+ "description": "Identifier for the data frame analytics job. This identifier can contain\nlowercase alphanumeric characters (a-z and 0-9), hyphens, and\nunderscores. It must start and end with alphanumeric characters.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "description": {
+ "description": "A description of the job.",
+ "type": "string"
+ },
+ "model_memory_limit": {
+ "description": "The approximate maximum amount of memory resources that are permitted for\nanalytical processing. If your `elasticsearch.yml` file contains an\n`xpack.ml.max_model_memory_limit` setting, an error occurs when you try\nto create data frame analytics jobs that have `model_memory_limit` values\ngreater than that setting.",
+ "default": "1gb",
+ "type": "string"
+ },
+ "max_num_threads": {
+ "description": "The maximum number of threads to be used by the analysis. Using more\nthreads may decrease the time necessary to complete the analysis at the\ncost of using more CPU. Note that the process may use additional threads\nfor operational functionality other than the analysis itself.",
+ "default": 1.0,
+ "type": "number"
+ },
+ "allow_lazy_start": {
+ "description": "Specifies whether this job can start when there is insufficient machine\nlearning node capacity for it to be immediately assigned to a node.",
+ "default": false,
+ "type": "boolean"
+ }
+ }
+ },
+ "examples": {
+ "MlUpdateDataFrameAnalyticsExample1": {
+ "description": "An example body for a `POST _ml/data_frame/analytics/loganalytics/_update` request.",
+ "value": "{\n \"model_memory_limit\": \"200mb\"\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "authorization": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.DataframeAnalyticsAuthorization"
+ }
+ ]
+ },
+ "allow_lazy_start": {
+ "type": "boolean"
+ },
+ "analysis": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.DataframeAnalysisContainer"
+ }
+ ]
+ },
+ "analyzed_fields": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.DataframeAnalysisAnalyzedFields"
+ }
+ ]
+ },
+ "create_time": {
+ "type": "number"
+ },
+ "description": {
+ "type": "string"
+ },
+ "dest": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.DataframeAnalyticsDestination"
+ }
+ ]
+ },
+ "id": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Id"
+ }
+ ]
+ },
+ "max_num_threads": {
+ "type": "number"
+ },
+ "model_memory_limit": {
+ "type": "string"
+ },
+ "source": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.DataframeAnalyticsSource"
+ }
+ ]
+ },
+ "version": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.VersionString"
+ }
+ ]
+ }
+ },
+ "required": [
+ "allow_lazy_start",
+ "analysis",
+ "create_time",
+ "dest",
+ "id",
+ "max_num_threads",
+ "model_memory_limit",
+ "source",
+ "version"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 7.3.0",
+ "x-variations": [
+ "\n POST\n /_ml/data_frame/analytics/{id}/_update\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`,`create_index`,`manage`,`index`,`view_index_metadata`\n",
+ "Cluster privileges: `manage_ml`\n"
+ ],
+ "x-api": "update_data_frame_analytics.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _ml/data_frame/analytics/loganalytics/_update\n{\n \"model_memory_limit\": \"200mb\"\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.update_data_frame_analytics(\n id=\"loganalytics\",\n model_memory_limit=\"200mb\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.updateDataFrameAnalytics({\n id: \"loganalytics\",\n model_memory_limit: \"200mb\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.update_data_frame_analytics(\n id: \"loganalytics\",\n body: {\n \"model_memory_limit\": \"200mb\"\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->updateDataFrameAnalytics([\n \"id\" => \"loganalytics\",\n \"body\" => [\n \"model_memory_limit\" => \"200mb\",\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"model_memory_limit\":\"200mb\"}' \"$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics/_update\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().updateDataFrameAnalytics(u -> u\n .id(\"loganalytics\")\n .modelMemoryLimit(\"200mb\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/datafeeds/{datafeed_id}/_update": {
+ "post": {
+ "tags": [
+ "ml anomaly"
+ ],
+ "summary": "Update a datafeed",
+ "description": "You must stop and start the datafeed for the changes to be applied.\nWhen Elasticsearch security features are enabled, your datafeed remembers which roles the user who updated it had at\nthe time of the update and runs the query using those same roles. If you provide secondary authorization headers,\nthose credentials are used instead.",
+ "operationId": "ml-update-datafeed",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "datafeed_id",
+ "description": "A numerical character string that uniquely identifies the datafeed.\nThis identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores.\nIt must start and end with alphanumeric characters.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "allow_no_indices",
+ "description": "If `true`, wildcard indices expressions that resolve into no concrete indices are ignored. This includes the\n`_all` string or when no indices are specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "expand_wildcards",
+ "description": "Type of index that wildcard patterns can match. If the request can target data streams, this argument determines\nwhether wildcard expressions match hidden data streams. Supports comma-separated values.\n\nSupported values include:\n - `all`: Match any data stream or index, including hidden ones.\n - `open`: Match open, non-hidden indices. Also matches any non-hidden data stream.\n - `closed`: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.\n - `hidden`: Match hidden data streams and hidden indices. Must be combined with `open`, `closed`, or `both`.\n - `none`: Wildcard expressions are not accepted.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.ExpandWildcards"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ignore_throttled",
+ "description": "If `true`, concrete, expanded or aliased indices are ignored when frozen.",
+ "deprecated": true,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ignore_unavailable",
+ "description": "If `true`, unavailable indices (missing or closed) are ignored.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "aggregations": {
+ "description": "If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only\nwith low cardinality data.",
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/_types.aggregations.AggregationContainer"
+ }
+ },
+ "chunking_config": {
+ "description": "Datafeeds might search over long time periods, for several months or years. This search is split into time\nchunks in order to ensure the load on Elasticsearch is managed. Chunking configuration controls how the size of\nthese time chunks are calculated; it is an advanced configuration option.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.ChunkingConfig"
+ }
+ ]
+ },
+ "delayed_data_check_config": {
+ "description": "Specifies whether the datafeed checks for missing data and the size of the window. The datafeed can optionally\nsearch over indices that have already been read in an effort to determine whether any data has subsequently been\nadded to the index. If missing data is found, it is a good indication that the `query_delay` is set too low and\nthe data is being indexed after the datafeed has passed that moment in time. This check runs only on real-time\ndatafeeds.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.DelayedDataCheckConfig"
+ }
+ ]
+ },
+ "frequency": {
+ "description": "The interval at which scheduled queries are made while the datafeed runs in real time. The default value is\neither the bucket span for short bucket spans, or, for longer bucket spans, a sensible fraction of the bucket\nspan. When `frequency` is shorter than the bucket span, interim results for the last (partial) bucket are\nwritten then eventually overwritten by the full bucket results. If the datafeed uses aggregations, this value\nmust be divisible by the interval of the date histogram aggregation.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Duration"
+ }
+ ]
+ },
+ "indices": {
+ "description": "An array of index names. Wildcards are supported. If any of the indices are in remote clusters, the machine\nlearning nodes must have the `remote_cluster_client` role.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "indices_options": {
+ "description": "Specifies index expansion options that are used during search.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.IndicesOptions"
+ }
+ ]
+ },
+ "job_id": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Id"
+ }
+ ]
+ },
+ "max_empty_searches": {
+ "description": "If a real-time datafeed has never seen any data (including during any initial training period), it automatically\nstops and closes the associated job after this many real-time searches return no documents. In other words,\nit stops after `frequency` times `max_empty_searches` of real-time operation. If not set, a datafeed with no\nend time that sees no data remains started until it is explicitly stopped. By default, it is not set.",
+ "type": "number"
+ },
+ "query": {
+ "description": "The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an\nElasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this\nobject is passed verbatim to Elasticsearch. Note that if you change the query, the analyzed data is also\nchanged. Therefore, the time required to learn might be long and the understandability of the results is\nunpredictable. If you want to make significant changes to the source data, it is recommended that you\nclone the job and datafeed and make the amendments in the clone. Let both run in parallel and close one\nwhen you are satisfied with the results of the job.",
+ "default": "{\"match_all\": {\"boost\": 1}}",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.query_dsl.QueryContainer"
+ }
+ ]
+ },
+ "query_delay": {
+ "description": "The number of seconds behind real time that data is queried. For example, if data from 10:04 a.m. might\nnot be searchable in Elasticsearch until 10:06 a.m., set this property to 120 seconds. The default\nvalue is randomly selected between `60s` and `120s`. This randomness improves the query performance\nwhen there are multiple jobs running on the same node.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Duration"
+ }
+ ]
+ },
+ "runtime_mappings": {
+ "description": "Specifies runtime fields for the datafeed search.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.mapping.RuntimeFields"
+ }
+ ]
+ },
+ "script_fields": {
+ "description": "Specifies scripts that evaluate custom expressions and returns script fields to the datafeed.\nThe detector configuration objects in a job can contain functions that use these script fields.",
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/_types.ScriptField"
+ }
+ },
+ "scroll_size": {
+ "description": "The size parameter that is used in Elasticsearch searches when the datafeed does not use aggregations.\nThe maximum value is the value of `index.max_result_window`.",
+ "default": 1000.0,
+ "type": "number"
+ }
+ }
+ },
+ "examples": {
+ "MlUpdateDatafeedExample1": {
+ "description": "An example body for a `POST _ml/datafeeds/datafeed-test-job/_update` request.",
+ "value": "{\n \"query\": {\n \"term\": {\n \"geo.src\": \"US\"\n }\n }\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "authorization": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.DatafeedAuthorization"
+ }
+ ]
+ },
+ "aggregations": {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/_types.aggregations.AggregationContainer"
+ }
+ },
+ "chunking_config": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.ChunkingConfig"
+ }
+ ]
+ },
+ "delayed_data_check_config": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.DelayedDataCheckConfig"
+ }
+ ]
+ },
+ "datafeed_id": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Id"
+ }
+ ]
+ },
+ "frequency": {
+ "description": "The interval at which scheduled queries are made while the datafeed runs in real time. The default value is either the bucket span for short bucket spans, or, for longer bucket spans, a sensible fraction of the bucket span. For example: `150s`. When `frequency` is shorter than the bucket span, interim results for the last (partial) bucket are written then eventually overwritten by the full bucket results. If the datafeed uses aggregations, this value must be divisible by the interval of the date histogram aggregation.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Duration"
+ }
+ ]
+ },
+ "indices": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "indices_options": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.IndicesOptions"
+ }
+ ]
+ },
+ "job_id": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Id"
+ }
+ ]
+ },
+ "max_empty_searches": {
+ "type": "number"
+ },
+ "query": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.query_dsl.QueryContainer"
+ }
+ ]
+ },
+ "query_delay": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Duration"
+ }
+ ]
+ },
+ "runtime_mappings": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.mapping.RuntimeFields"
+ }
+ ]
+ },
+ "script_fields": {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/_types.ScriptField"
+ }
+ },
+ "scroll_size": {
+ "type": "number"
+ }
+ },
+ "required": [
+ "chunking_config",
+ "datafeed_id",
+ "indices",
+ "job_id",
+ "query",
+ "query_delay",
+ "scroll_size"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 6.4.0",
+ "x-variations": [
+ "\n POST\n /_ml/datafeeds/{datafeed_id}/_update\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_ml`\n"
+ ],
+ "x-api": "update_datafeed.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _ml/datafeeds/datafeed-test-job/_update\n{\n \"query\": {\n \"term\": {\n \"geo.src\": \"US\"\n }\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.update_datafeed(\n datafeed_id=\"datafeed-test-job\",\n query={\n \"term\": {\n \"geo.src\": \"US\"\n }\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.updateDatafeed({\n datafeed_id: \"datafeed-test-job\",\n query: {\n term: {\n \"geo.src\": \"US\",\n },\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.update_datafeed(\n datafeed_id: \"datafeed-test-job\",\n body: {\n \"query\": {\n \"term\": {\n \"geo.src\": \"US\"\n }\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->updateDatafeed([\n \"datafeed_id\" => \"datafeed-test-job\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"geo.src\" => \"US\",\n ],\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"geo.src\":\"US\"}}}' \"$ELASTICSEARCH_URL/_ml/datafeeds/datafeed-test-job/_update\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/filters/{filter_id}/_update": {
+ "post": {
+ "tags": [
+ "ml anomaly"
+ ],
+ "summary": "Update a filter",
+ "description": "Updates the description of a filter, adds items, or removes items from the list.",
+ "operationId": "ml-update-filter",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "filter_id",
+ "description": "A string that uniquely identifies a filter.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "add_items": {
+ "description": "The items to add to the filter.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "description": {
+ "description": "A description for the filter.",
+ "type": "string"
+ },
+ "remove_items": {
+ "description": "The items to remove from the filter.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "examples": {
+ "MlUpdateFilterExample1": {
+ "description": "An example body for a `POST _ml/filters/safe_domains/_update` request.",
+ "value": "{\n \"description\": \"Updated list of domains\",\n \"add_items\": [\"*.myorg.com\"],\n \"remove_items\": [\"wikipedia.org\"]\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "description": {
+ "type": "string"
+ },
+ "filter_id": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Id"
+ }
+ ]
+ },
+ "items": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ "required": [
+ "description",
+ "filter_id",
+ "items"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 6.4.0",
+ "x-variations": [
+ "\n POST\n /_ml/filters/{filter_id}/_update\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_ml`\n"
+ ],
+ "x-api": "update_filter.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _ml/filters/safe_domains/_update\n{\n \"description\": \"Updated list of domains\",\n \"add_items\": [\"*.myorg.com\"],\n \"remove_items\": [\"wikipedia.org\"]\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.update_filter(\n filter_id=\"safe_domains\",\n description=\"Updated list of domains\",\n add_items=[\n \"*.myorg.com\"\n ],\n remove_items=[\n \"wikipedia.org\"\n ],\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.updateFilter({\n filter_id: \"safe_domains\",\n description: \"Updated list of domains\",\n add_items: [\"*.myorg.com\"],\n remove_items: [\"wikipedia.org\"],\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.update_filter(\n filter_id: \"safe_domains\",\n body: {\n \"description\": \"Updated list of domains\",\n \"add_items\": [\n \"*.myorg.com\"\n ],\n \"remove_items\": [\n \"wikipedia.org\"\n ]\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->updateFilter([\n \"filter_id\" => \"safe_domains\",\n \"body\" => [\n \"description\" => \"Updated list of domains\",\n \"add_items\" => array(\n \"*.myorg.com\",\n ),\n \"remove_items\" => array(\n \"wikipedia.org\",\n ),\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"Updated list of domains\",\"add_items\":[\"*.myorg.com\"],\"remove_items\":[\"wikipedia.org\"]}' \"$ELASTICSEARCH_URL/_ml/filters/safe_domains/_update\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/anomaly_detectors/{job_id}/_update": {
+ "post": {
+ "tags": [
+ "ml anomaly"
+ ],
+ "summary": "Update an anomaly detection job",
+ "description": "Updates certain properties of an anomaly detection job.",
+ "operationId": "ml-update-job",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "job_id",
+ "description": "Identifier for the job.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "allow_lazy_open": {
+ "description": "Advanced configuration option. Specifies whether this job can open when\nthere is insufficient machine learning node capacity for it to be\nimmediately assigned to a node. If `false` and a machine learning node\nwith capacity to run the job cannot immediately be found, the open\nanomaly detection jobs API returns an error. However, this is also\nsubject to the cluster-wide `xpack.ml.max_lazy_ml_nodes` setting. If this\noption is set to `true`, the open anomaly detection jobs API does not\nreturn an error and the job waits in the opening state until sufficient\nmachine learning node capacity is available.",
+ "default": false,
+ "type": "boolean"
+ },
+ "analysis_limits": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.AnalysisMemoryLimit"
+ }
+ ]
+ },
+ "background_persist_interval": {
+ "description": "Advanced configuration option. The time between each periodic persistence\nof the model.\nThe default value is a randomized value between 3 to 4 hours, which\navoids all jobs persisting at exactly the same time. The smallest allowed\nvalue is 1 hour.\nFor very large models (several GB), persistence could take 10-20 minutes,\nso do not set the value too low.\nIf the job is open when you make the update, you must stop the datafeed,\nclose the job, then reopen the job and restart the datafeed for the\nchanges to take effect.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Duration"
+ }
+ ]
+ },
+ "custom_settings": {
+ "description": "Advanced configuration option. Contains custom meta data about the job.\nFor example, it can contain custom URL information as shown in Adding\ncustom URLs to machine learning results.",
+ "type": "object",
+ "additionalProperties": {
+ "type": "object"
+ }
+ },
+ "categorization_filters": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "description": {
+ "description": "A description of the job.",
+ "type": "string"
+ },
+ "model_plot_config": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.ModelPlotConfig"
+ }
+ ]
+ },
+ "model_prune_window": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Duration"
+ }
+ ]
+ },
+ "daily_model_snapshot_retention_after_days": {
+ "description": "Advanced configuration option, which affects the automatic removal of old\nmodel snapshots for this job. It specifies a period of time (in days)\nafter which only the first snapshot per day is retained. This period is\nrelative to the timestamp of the most recent snapshot for this job. Valid\nvalues range from 0 to `model_snapshot_retention_days`. For jobs created\nbefore version 7.8.0, the default value matches\n`model_snapshot_retention_days`.",
+ "default": 1.0,
+ "type": "number"
+ },
+ "model_snapshot_retention_days": {
+ "description": "Advanced configuration option, which affects the automatic removal of old\nmodel snapshots for this job. It specifies the maximum period of time (in\ndays) that snapshots are retained. This period is relative to the\ntimestamp of the most recent snapshot for this job.",
+ "default": 10.0,
+ "type": "number"
+ },
+ "renormalization_window_days": {
+ "description": "Advanced configuration option. The period over which adjustments to the\nscore are applied, as new data is seen.",
+ "type": "number"
+ },
+ "results_retention_days": {
+ "description": "Advanced configuration option. The period of time (in days) that results\nare retained. Age is calculated relative to the timestamp of the latest\nbucket result. If this property has a non-null value, once per day at\n00:30 (server time), results that are the specified number of days older\nthan the latest bucket result are deleted from Elasticsearch. The default\nvalue is null, which means all results are retained.",
+ "type": "number"
+ },
+ "groups": {
+ "description": "A list of job groups. A job can belong to no groups or many.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "detectors": {
+ "description": "An array of detector update objects.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ml._types.DetectorUpdate"
+ }
+ },
+ "per_partition_categorization": {
+ "description": "Settings related to how categorization interacts with partition fields.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.PerPartitionCategorization"
+ }
+ ]
+ }
+ }
+ },
+ "examples": {
+ "MlUpdateJobExample1": {
+ "description": "An example body for a `POST _ml/anomaly_detectors/low_request_rate/_update` request.",
+ "value": "{\n \"description\":\"An updated job\",\n \"detectors\": {\n \"detector_index\": 0,\n \"description\": \"An updated detector description\"\n },\n \"groups\": [\"kibana_sample_data\",\"kibana_sample_web_logs\"],\n \"model_plot_config\": {\n \"enabled\": true\n },\n \"renormalization_window_days\": 30,\n \"background_persist_interval\": \"2h\",\n \"model_snapshot_retention_days\": 7,\n \"results_retention_days\": 60\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "allow_lazy_open": {
+ "type": "boolean"
+ },
+ "analysis_config": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.AnalysisConfigRead"
+ }
+ ]
+ },
+ "analysis_limits": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.AnalysisLimits"
+ }
+ ]
+ },
+ "background_persist_interval": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Duration"
+ }
+ ]
+ },
+ "create_time": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.EpochTimeUnitMillis"
+ }
+ ]
+ },
+ "finished_time": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.EpochTimeUnitMillis"
+ }
+ ]
+ },
+ "custom_settings": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "daily_model_snapshot_retention_after_days": {
+ "type": "number"
+ },
+ "data_description": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.DataDescription"
+ }
+ ]
+ },
+ "datafeed_config": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.Datafeed"
+ }
+ ]
+ },
+ "description": {
+ "type": "string"
+ },
+ "groups": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "job_id": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Id"
+ }
+ ]
+ },
+ "job_type": {
+ "type": "string"
+ },
+ "job_version": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.VersionString"
+ }
+ ]
+ },
+ "model_plot_config": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.ModelPlotConfig"
+ }
+ ]
+ },
+ "model_snapshot_id": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Id"
+ }
+ ]
+ },
+ "model_snapshot_retention_days": {
+ "type": "number"
+ },
+ "renormalization_window_days": {
+ "type": "number"
+ },
+ "results_index_name": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.IndexName"
+ }
+ ]
+ },
+ "results_retention_days": {
+ "type": "number"
+ }
+ },
+ "required": [
+ "allow_lazy_open",
+ "analysis_config",
+ "analysis_limits",
+ "create_time",
+ "daily_model_snapshot_retention_after_days",
+ "data_description",
+ "job_id",
+ "job_type",
+ "job_version",
+ "model_snapshot_retention_days",
+ "results_index_name"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 5.5.0",
+ "x-variations": [
+ "\n POST\n /_ml/anomaly_detectors/{job_id}/_update\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_ml`\n"
+ ],
+ "x-api": "update_job.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _ml/anomaly_detectors/low_request_rate/_update\n{\n \"description\":\"An updated job\",\n \"detectors\": {\n \"detector_index\": 0,\n \"description\": \"An updated detector description\"\n },\n \"groups\": [\"kibana_sample_data\",\"kibana_sample_web_logs\"],\n \"model_plot_config\": {\n \"enabled\": true\n },\n \"renormalization_window_days\": 30,\n \"background_persist_interval\": \"2h\",\n \"model_snapshot_retention_days\": 7,\n \"results_retention_days\": 60\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.update_job(\n job_id=\"low_request_rate\",\n description=\"An updated job\",\n detectors={\n \"detector_index\": 0,\n \"description\": \"An updated detector description\"\n },\n groups=[\n \"kibana_sample_data\",\n \"kibana_sample_web_logs\"\n ],\n model_plot_config={\n \"enabled\": True\n },\n renormalization_window_days=30,\n background_persist_interval=\"2h\",\n model_snapshot_retention_days=7,\n results_retention_days=60,\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.updateJob({\n job_id: \"low_request_rate\",\n description: \"An updated job\",\n detectors: {\n detector_index: 0,\n description: \"An updated detector description\",\n },\n groups: [\"kibana_sample_data\", \"kibana_sample_web_logs\"],\n model_plot_config: {\n enabled: true,\n },\n renormalization_window_days: 30,\n background_persist_interval: \"2h\",\n model_snapshot_retention_days: 7,\n results_retention_days: 60,\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.update_job(\n job_id: \"low_request_rate\",\n body: {\n \"description\": \"An updated job\",\n \"detectors\": {\n \"detector_index\": 0,\n \"description\": \"An updated detector description\"\n },\n \"groups\": [\n \"kibana_sample_data\",\n \"kibana_sample_web_logs\"\n ],\n \"model_plot_config\": {\n \"enabled\": true\n },\n \"renormalization_window_days\": 30,\n \"background_persist_interval\": \"2h\",\n \"model_snapshot_retention_days\": 7,\n \"results_retention_days\": 60\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->updateJob([\n \"job_id\" => \"low_request_rate\",\n \"body\" => [\n \"description\" => \"An updated job\",\n \"detectors\" => [\n \"detector_index\" => 0,\n \"description\" => \"An updated detector description\",\n ],\n \"groups\" => array(\n \"kibana_sample_data\",\n \"kibana_sample_web_logs\",\n ),\n \"model_plot_config\" => [\n \"enabled\" => true,\n ],\n \"renormalization_window_days\" => 30,\n \"background_persist_interval\" => \"2h\",\n \"model_snapshot_retention_days\" => 7,\n \"results_retention_days\" => 60,\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"An updated job\",\"detectors\":{\"detector_index\":0,\"description\":\"An updated detector description\"},\"groups\":[\"kibana_sample_data\",\"kibana_sample_web_logs\"],\"model_plot_config\":{\"enabled\":true},\"renormalization_window_days\":30,\"background_persist_interval\":\"2h\",\"model_snapshot_retention_days\":7,\"results_retention_days\":60}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_update\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_update": {
+ "post": {
+ "tags": [
+ "ml anomaly"
+ ],
+ "summary": "Update a snapshot",
+ "description": "Updates certain properties of a snapshot.",
+ "operationId": "ml-update-model-snapshot",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "job_id",
+ "description": "Identifier for the anomaly detection job.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "path",
+ "name": "snapshot_id",
+ "description": "Identifier for the model snapshot.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "description": {
+ "description": "A description of the model snapshot.",
+ "type": "string"
+ },
+ "retain": {
+ "description": "If `true`, this snapshot will not be deleted during automatic cleanup of\nsnapshots older than `model_snapshot_retention_days`. However, this\nsnapshot will be deleted when the job is deleted.",
+ "default": false,
+ "type": "boolean"
+ }
+ }
+ },
+ "examples": {
+ "MlUpdateModelSnapshotExample1": {
+ "description": "An example body for a `POST` request.",
+ "value": "_ml/anomaly_detectors/it_ops_new_logs/model_snapshots/1491852978/_update\n{\n \"description\": \"Snapshot 1\",\n \"retain\": true\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "acknowledged": {
+ "type": "boolean"
+ },
+ "model": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.ModelSnapshot"
+ }
+ ]
+ }
+ },
+ "required": [
+ "acknowledged",
+ "model"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 5.4.0",
+ "x-variations": [
+ "\n POST\n /_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_update\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_ml`\n"
+ ],
+ "x-api": "update_model_snapshot.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST\n_ml/anomaly_detectors/it_ops_new_logs/model_snapshots/1491852978/_update\n{\n \"description\": \"Snapshot 1\",\n \"retain\": true\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.update_model_snapshot(\n job_id=\"it_ops_new_logs\",\n snapshot_id=\"1491852978\",\n description=\"Snapshot 1\",\n retain=True,\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.updateModelSnapshot({\n job_id: \"it_ops_new_logs\",\n snapshot_id: 1491852978,\n description: \"Snapshot 1\",\n retain: true,\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.update_model_snapshot(\n job_id: \"it_ops_new_logs\",\n snapshot_id: \"1491852978\",\n body: {\n \"description\": \"Snapshot 1\",\n \"retain\": true\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->updateModelSnapshot([\n \"job_id\" => \"it_ops_new_logs\",\n \"snapshot_id\" => \"1491852978\",\n \"body\" => [\n \"description\" => \"Snapshot 1\",\n \"retain\" => true,\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"description\":\"Snapshot 1\",\"retain\":true}' \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/it_ops_new_logs/model_snapshots/1491852978/_update\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().updateModelSnapshot(u -> u\n .description(\"Snapshot 1\")\n .jobId(\"it_ops_new_logs\")\n .retain(true)\n .snapshotId(\"1491852978\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/trained_models/{model_id}/deployment/_update": {
+ "post": {
+ "tags": [
+ "ml trained model"
+ ],
+ "summary": "Update a trained model deployment",
+ "operationId": "ml-update-trained-model-deployment",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "model_id",
+ "description": "The unique identifier of the trained model. Currently, only PyTorch models are supported.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "number_of_allocations",
+ "description": "The number of model allocations on each node where the model is deployed.\nAll allocations on a node share the same copy of the model in memory but use\na separate set of threads to evaluate the model.\nIncreasing this value generally increases the throughput.\nIf this setting is greater than the number of hardware threads\nit will automatically be changed to a value less than the number of hardware threads.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "number_of_allocations": {
+ "description": "The number of model allocations on each node where the model is deployed.\nAll allocations on a node share the same copy of the model in memory but use\na separate set of threads to evaluate the model.\nIncreasing this value generally increases the throughput.\nIf this setting is greater than the number of hardware threads\nit will automatically be changed to a value less than the number of hardware threads.\nIf adaptive_allocations is enabled, do not set this value, because it’s automatically set.",
+ "default": 1.0,
+ "type": "number"
+ },
+ "adaptive_allocations": {
+ "description": "Adaptive allocations configuration. When enabled, the number of allocations\nis set based on the current load.\nIf adaptive_allocations is enabled, do not set the number of allocations manually.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.AdaptiveAllocationsSettings"
+ }
+ ]
+ }
+ }
+ },
+ "examples": {
+ "MlUpdateTrainedModelDeploymentExample1": {
+ "description": "An example body for a `POST _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_update` request.",
+ "value": "{\n \"number_of_allocations\": 4\n}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "assignment": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ml._types.TrainedModelAssignment"
+ }
+ ]
+ }
+ },
+ "required": [
+ "assignment"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 8.6.0",
+ "x-variations": [
+ "\n POST\n /_ml/trained_models/{model_id}/deployment/_update\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_ml`\n"
+ ],
+ "x-api": "update_trained_model_deployment.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_update\n{\n \"number_of_allocations\": 4\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.update_trained_model_deployment(\n model_id=\"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n number_of_allocations=4,\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.updateTrainedModelDeployment({\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n number_of_allocations: 4,\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.update_trained_model_deployment(\n model_id: \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n body: {\n \"number_of_allocations\": 4\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->updateTrainedModelDeployment([\n \"model_id\" => \"elastic__distilbert-base-uncased-finetuned-conll03-english\",\n \"body\" => [\n \"number_of_allocations\" => 4,\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"number_of_allocations\":4}' \"$ELASTICSEARCH_URL/_ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/deployment/_update\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.ml().updateTrainedModelDeployment(u -> u\n .modelId(\"elastic__distilbert-base-uncased-finetuned-conll03-english\")\n .numberOfAllocations(4)\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_upgrade": {
+ "post": {
+ "tags": [
+ "ml anomaly"
+ ],
+ "summary": "Upgrade a snapshot",
+ "description": "Upgrade an anomaly detection model snapshot to the latest major version.\nOver time, older snapshot formats are deprecated and removed. Anomaly\ndetection jobs support only snapshots that are from the current or previous\nmajor version.\nThis API provides a means to upgrade a snapshot to the current major version.\nThis aids in preparing the cluster for an upgrade to the next major version.\nOnly one snapshot per anomaly detection job can be upgraded at a time and the\nupgraded snapshot cannot be the current snapshot of the anomaly detection\njob.",
+ "operationId": "ml-upgrade-job-snapshot",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "job_id",
+ "description": "Identifier for the anomaly detection job.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "path",
+ "name": "snapshot_id",
+ "description": "A numerical character string that uniquely identifies the model snapshot.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "wait_for_completion",
+ "description": "When true, the API won’t respond until the upgrade is complete.\nOtherwise, it responds as soon as the upgrade task is assigned to a node.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Controls the time to wait for the request to complete.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "node": {
+ "description": "The ID of the node that the upgrade task was started on if it is still running. In serverless this will be the \"serverless\".",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.NodeId"
+ }
+ ]
+ },
+ "completed": {
+ "description": "When true, this means the task is complete. When false, it is still running.",
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "node",
+ "completed"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 5.4.0",
+ "x-variations": [
+ "\n POST\n /_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_upgrade\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_ml`\n"
+ ],
+ "x-api": "upgrade_job_snapshot.ml",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _ml/anomaly_detectors/low_request_rate/model_snapshots/1828371/_upgrade?timeout=45m&wait_for_completion=true\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.ml.upgrade_job_snapshot(\n job_id=\"low_request_rate\",\n snapshot_id=\"1828371\",\n timeout=\"45m\",\n wait_for_completion=True,\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.ml.upgradeJobSnapshot({\n job_id: \"low_request_rate\",\n snapshot_id: 1828371,\n timeout: \"45m\",\n wait_for_completion: \"true\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.ml.upgrade_job_snapshot(\n job_id: \"low_request_rate\",\n snapshot_id: \"1828371\",\n timeout: \"45m\",\n wait_for_completion: \"true\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->ml()->upgradeJobSnapshot([\n \"job_id\" => \"low_request_rate\",\n \"snapshot_id\" => \"1828371\",\n \"timeout\" => \"45m\",\n \"wait_for_completion\" => \"true\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/model_snapshots/1828371/_upgrade?timeout=45m&wait_for_completion=true\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch, Machine Learning",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_msearch": {
+ "get": {
+ "tags": [
+ "search"
+ ],
+ "summary": "Run multiple searches",
+ "description": "The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format.\nThe structure is as follows:\n\n```\nheader\\n\nbody\\n\nheader\\n\nbody\\n\n```\n\nThis structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node.\n\nIMPORTANT: The final line of data must end with a newline character `\\n`.\nEach newline character may be preceded by a carriage return `\\r`.\nWhen sending requests to this endpoint the `Content-Type` header should be set to `application/x-ndjson`.",
+ "operationId": "msearch",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "allow_no_indices",
+ "description": "If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ccs_minimize_roundtrips",
+ "description": "If true, network roundtrips between the coordinating node and remote clusters are minimized for cross-cluster search requests.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "expand_wildcards",
+ "description": "Type of index that wildcard expressions can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.\n\nSupported values include:\n - `all`: Match any data stream or index, including hidden ones.\n - `open`: Match open, non-hidden indices. Also matches any non-hidden data stream.\n - `closed`: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.\n - `hidden`: Match hidden data streams and hidden indices. Must be combined with `open`, `closed`, or `both`.\n - `none`: Wildcard expressions are not accepted.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.ExpandWildcards"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ignore_throttled",
+ "description": "If true, concrete, expanded or aliased indices are ignored when frozen.",
+ "deprecated": true,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ignore_unavailable",
+ "description": "If true, missing or closed indices are not included in the response.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "include_named_queries_score",
+ "description": "Indicates whether hit.matched_queries should be rendered as a map that includes\nthe name of the matched query associated with its score (true)\nor as an array containing the name of the matched queries (false)\nThis functionality reruns each named query on every hit in a search response.\nTypically, this adds a small overhead to a request.\nHowever, using computationally expensive named queries on a large number of hits may add significant overhead.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "index",
+ "description": "Comma-separated list of data streams, indices, and index aliases to use as default",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Indices"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "max_concurrent_searches",
+ "description": "Maximum number of concurrent searches the multi search API can execute.\nDefaults to `max(1, (# of data nodes * min(search thread pool size, 10)))`.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "max_concurrent_shard_requests",
+ "description": "Maximum number of concurrent shard requests that each sub-search request executes per node.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "pre_filter_shard_size",
+ "description": "Defines a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method i.e., if date filters are mandatory to match but the shard bounds and the query are disjoint.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "rest_total_hits_as_int",
+ "description": "If true, hits.total are returned as an integer in the response. Defaults to false, which returns an object.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "routing",
+ "description": "Custom routing value used to route search operations to a specific shard.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Routing"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "search_type",
+ "description": "Indicates whether global term and document frequencies should be used when scoring returned documents.\n\nSupported values include:\n - `query_then_fetch`: Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate.\n - `dfs_query_then_fetch`: Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.SearchType"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "typed_keys",
+ "description": "Specifies whether aggregation and suggester names should be prefixed by their respective types in the response.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_global.msearch.RequestItem"
+ }
+ },
+ "examples": {
+ "MsearchRequestExample1": {
+ "description": "An example body for a `GET my-index-000001/_msearch` request.",
+ "value": "{ }\n{\"query\" : {\"match\" : { \"message\": \"this is a test\"}}}\n{\"index\": \"my-index-000002\"}\n{\"query\" : {\"match_all\" : {}}}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_global.msearch.MultiSearchResult"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 1.3.0",
+ "x-variations": [
+ "\n GET\n /_msearch\n
\n ",
+ "\n POST\n /_msearch\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "msearch",
+ "x-category": "search",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET my-index-000001/_msearch\n{ }\n{\"query\" : {\"match\" : { \"message\": \"this is a test\"}}}\n{\"index\": \"my-index-000002\"}\n{\"query\" : {\"match_all\" : {}}}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.msearch(\n index=\"my-index-000001\",\n searches=[\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ],\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.msearch({\n index: \"my-index-000001\",\n searches: [\n {},\n {\n query: {\n match: {\n message: \"this is a test\",\n },\n },\n },\n {\n index: \"my-index-000002\",\n },\n {\n query: {\n match_all: {},\n },\n },\n ],\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.msearch(\n index: \"my-index-000001\",\n body: [\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ]\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->msearch([\n \"index\" => \"my-index-000001\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"query\" => [\n \"match\" => [\n \"message\" => \"this is a test\",\n ],\n ],\n ],\n [\n \"index\" => \"my-index-000002\",\n ],\n [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n ),\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/x-ndjson\" -d $'{}\\n{\"query\":{\"match\":{\"message\":\"this is a test\"}}}\\n{\"index\":\"my-index-000002\"}\\n{\"query\":{\"match_all\":{}}}\\n' \"$ELASTICSEARCH_URL/my-index-000001/_msearch\""
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "post": {
+ "tags": [
+ "search"
+ ],
+ "summary": "Run multiple searches",
+ "description": "The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format.\nThe structure is as follows:\n\n```\nheader\\n\nbody\\n\nheader\\n\nbody\\n\n```\n\nThis structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node.\n\nIMPORTANT: The final line of data must end with a newline character `\\n`.\nEach newline character may be preceded by a carriage return `\\r`.\nWhen sending requests to this endpoint the `Content-Type` header should be set to `application/x-ndjson`.",
+ "operationId": "msearch-1",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "allow_no_indices",
+ "description": "If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ccs_minimize_roundtrips",
+ "description": "If true, network roundtrips between the coordinating node and remote clusters are minimized for cross-cluster search requests.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "expand_wildcards",
+ "description": "Type of index that wildcard expressions can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.\n\nSupported values include:\n - `all`: Match any data stream or index, including hidden ones.\n - `open`: Match open, non-hidden indices. Also matches any non-hidden data stream.\n - `closed`: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.\n - `hidden`: Match hidden data streams and hidden indices. Must be combined with `open`, `closed`, or `both`.\n - `none`: Wildcard expressions are not accepted.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.ExpandWildcards"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ignore_throttled",
+ "description": "If true, concrete, expanded or aliased indices are ignored when frozen.",
+ "deprecated": true,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ignore_unavailable",
+ "description": "If true, missing or closed indices are not included in the response.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "include_named_queries_score",
+ "description": "Indicates whether hit.matched_queries should be rendered as a map that includes\nthe name of the matched query associated with its score (true)\nor as an array containing the name of the matched queries (false)\nThis functionality reruns each named query on every hit in a search response.\nTypically, this adds a small overhead to a request.\nHowever, using computationally expensive named queries on a large number of hits may add significant overhead.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "index",
+ "description": "Comma-separated list of data streams, indices, and index aliases to use as default",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Indices"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "max_concurrent_searches",
+ "description": "Maximum number of concurrent searches the multi search API can execute.\nDefaults to `max(1, (# of data nodes * min(search thread pool size, 10)))`.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "max_concurrent_shard_requests",
+ "description": "Maximum number of concurrent shard requests that each sub-search request executes per node.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "pre_filter_shard_size",
+ "description": "Defines a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method i.e., if date filters are mandatory to match but the shard bounds and the query are disjoint.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "rest_total_hits_as_int",
+ "description": "If true, hits.total are returned as an integer in the response. Defaults to false, which returns an object.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "routing",
+ "description": "Custom routing value used to route search operations to a specific shard.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Routing"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "search_type",
+ "description": "Indicates whether global term and document frequencies should be used when scoring returned documents.\n\nSupported values include:\n - `query_then_fetch`: Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate.\n - `dfs_query_then_fetch`: Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.SearchType"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "typed_keys",
+ "description": "Specifies whether aggregation and suggester names should be prefixed by their respective types in the response.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_global.msearch.RequestItem"
+ }
+ },
+ "examples": {
+ "MsearchRequestExample1": {
+ "description": "An example body for a `GET my-index-000001/_msearch` request.",
+ "value": "{ }\n{\"query\" : {\"match\" : { \"message\": \"this is a test\"}}}\n{\"index\": \"my-index-000002\"}\n{\"query\" : {\"match_all\" : {}}}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_global.msearch.MultiSearchResult"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 1.3.0",
+ "x-variations": [
+ "\n GET\n /_msearch\n
\n ",
+ "\n POST\n /_msearch\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "msearch",
+ "x-category": "search",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET my-index-000001/_msearch\n{ }\n{\"query\" : {\"match\" : { \"message\": \"this is a test\"}}}\n{\"index\": \"my-index-000002\"}\n{\"query\" : {\"match_all\" : {}}}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.msearch(\n index=\"my-index-000001\",\n searches=[\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ],\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.msearch({\n index: \"my-index-000001\",\n searches: [\n {},\n {\n query: {\n match: {\n message: \"this is a test\",\n },\n },\n },\n {\n index: \"my-index-000002\",\n },\n {\n query: {\n match_all: {},\n },\n },\n ],\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.msearch(\n index: \"my-index-000001\",\n body: [\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ]\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->msearch([\n \"index\" => \"my-index-000001\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"query\" => [\n \"match\" => [\n \"message\" => \"this is a test\",\n ],\n ],\n ],\n [\n \"index\" => \"my-index-000002\",\n ],\n [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n ),\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/x-ndjson\" -d $'{}\\n{\"query\":{\"match\":{\"message\":\"this is a test\"}}}\\n{\"index\":\"my-index-000002\"}\\n{\"query\":{\"match_all\":{}}}\\n' \"$ELASTICSEARCH_URL/my-index-000001/_msearch\""
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/{index}/_msearch": {
+ "get": {
+ "tags": [
+ "search"
+ ],
+ "summary": "Run multiple searches",
+ "description": "The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format.\nThe structure is as follows:\n\n```\nheader\\n\nbody\\n\nheader\\n\nbody\\n\n```\n\nThis structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node.\n\nIMPORTANT: The final line of data must end with a newline character `\\n`.\nEach newline character may be preceded by a carriage return `\\r`.\nWhen sending requests to this endpoint the `Content-Type` header should be set to `application/x-ndjson`.",
+ "operationId": "msearch-2",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "index",
+ "description": "Comma-separated list of data streams, indices, and index aliases to search.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Indices"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "allow_no_indices",
+ "description": "If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ccs_minimize_roundtrips",
+ "description": "If true, network roundtrips between the coordinating node and remote clusters are minimized for cross-cluster search requests.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "expand_wildcards",
+ "description": "Type of index that wildcard expressions can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.\n\nSupported values include:\n - `all`: Match any data stream or index, including hidden ones.\n - `open`: Match open, non-hidden indices. Also matches any non-hidden data stream.\n - `closed`: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.\n - `hidden`: Match hidden data streams and hidden indices. Must be combined with `open`, `closed`, or `both`.\n - `none`: Wildcard expressions are not accepted.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.ExpandWildcards"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ignore_throttled",
+ "description": "If true, concrete, expanded or aliased indices are ignored when frozen.",
+ "deprecated": true,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ignore_unavailable",
+ "description": "If true, missing or closed indices are not included in the response.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "include_named_queries_score",
+ "description": "Indicates whether hit.matched_queries should be rendered as a map that includes\nthe name of the matched query associated with its score (true)\nor as an array containing the name of the matched queries (false)\nThis functionality reruns each named query on every hit in a search response.\nTypically, this adds a small overhead to a request.\nHowever, using computationally expensive named queries on a large number of hits may add significant overhead.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "index",
+ "description": "Comma-separated list of data streams, indices, and index aliases to use as default",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Indices"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "max_concurrent_searches",
+ "description": "Maximum number of concurrent searches the multi search API can execute.\nDefaults to `max(1, (# of data nodes * min(search thread pool size, 10)))`.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "max_concurrent_shard_requests",
+ "description": "Maximum number of concurrent shard requests that each sub-search request executes per node.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "pre_filter_shard_size",
+ "description": "Defines a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method i.e., if date filters are mandatory to match but the shard bounds and the query are disjoint.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "rest_total_hits_as_int",
+ "description": "If true, hits.total are returned as an integer in the response. Defaults to false, which returns an object.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "routing",
+ "description": "Custom routing value used to route search operations to a specific shard.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Routing"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "search_type",
+ "description": "Indicates whether global term and document frequencies should be used when scoring returned documents.\n\nSupported values include:\n - `query_then_fetch`: Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate.\n - `dfs_query_then_fetch`: Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.SearchType"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "typed_keys",
+ "description": "Specifies whether aggregation and suggester names should be prefixed by their respective types in the response.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_global.msearch.RequestItem"
+ }
+ },
+ "examples": {
+ "MsearchRequestExample1": {
+ "description": "An example body for a `GET my-index-000001/_msearch` request.",
+ "value": "{ }\n{\"query\" : {\"match\" : { \"message\": \"this is a test\"}}}\n{\"index\": \"my-index-000002\"}\n{\"query\" : {\"match_all\" : {}}}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_global.msearch.MultiSearchResult"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 1.3.0",
+ "x-variations": [
+ "\n GET\n /{index}/_msearch\n
\n ",
+ "\n POST\n /{index}/_msearch\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "msearch",
+ "x-category": "search",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET my-index-000001/_msearch\n{ }\n{\"query\" : {\"match\" : { \"message\": \"this is a test\"}}}\n{\"index\": \"my-index-000002\"}\n{\"query\" : {\"match_all\" : {}}}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.msearch(\n index=\"my-index-000001\",\n searches=[\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ],\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.msearch({\n index: \"my-index-000001\",\n searches: [\n {},\n {\n query: {\n match: {\n message: \"this is a test\",\n },\n },\n },\n {\n index: \"my-index-000002\",\n },\n {\n query: {\n match_all: {},\n },\n },\n ],\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.msearch(\n index: \"my-index-000001\",\n body: [\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ]\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->msearch([\n \"index\" => \"my-index-000001\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"query\" => [\n \"match\" => [\n \"message\" => \"this is a test\",\n ],\n ],\n ],\n [\n \"index\" => \"my-index-000002\",\n ],\n [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n ),\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/x-ndjson\" -d $'{}\\n{\"query\":{\"match\":{\"message\":\"this is a test\"}}}\\n{\"index\":\"my-index-000002\"}\\n{\"query\":{\"match_all\":{}}}\\n' \"$ELASTICSEARCH_URL/my-index-000001/_msearch\""
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "post": {
+ "tags": [
+ "search"
+ ],
+ "summary": "Run multiple searches",
+ "description": "The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format.\nThe structure is as follows:\n\n```\nheader\\n\nbody\\n\nheader\\n\nbody\\n\n```\n\nThis structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node.\n\nIMPORTANT: The final line of data must end with a newline character `\\n`.\nEach newline character may be preceded by a carriage return `\\r`.\nWhen sending requests to this endpoint the `Content-Type` header should be set to `application/x-ndjson`.",
+ "operationId": "msearch-3",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "index",
+ "description": "Comma-separated list of data streams, indices, and index aliases to search.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Indices"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "allow_no_indices",
+ "description": "If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ccs_minimize_roundtrips",
+ "description": "If true, network roundtrips between the coordinating node and remote clusters are minimized for cross-cluster search requests.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "expand_wildcards",
+ "description": "Type of index that wildcard expressions can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.\n\nSupported values include:\n - `all`: Match any data stream or index, including hidden ones.\n - `open`: Match open, non-hidden indices. Also matches any non-hidden data stream.\n - `closed`: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.\n - `hidden`: Match hidden data streams and hidden indices. Must be combined with `open`, `closed`, or `both`.\n - `none`: Wildcard expressions are not accepted.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.ExpandWildcards"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ignore_throttled",
+ "description": "If true, concrete, expanded or aliased indices are ignored when frozen.",
+ "deprecated": true,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ignore_unavailable",
+ "description": "If true, missing or closed indices are not included in the response.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "include_named_queries_score",
+ "description": "Indicates whether hit.matched_queries should be rendered as a map that includes\nthe name of the matched query associated with its score (true)\nor as an array containing the name of the matched queries (false)\nThis functionality reruns each named query on every hit in a search response.\nTypically, this adds a small overhead to a request.\nHowever, using computationally expensive named queries on a large number of hits may add significant overhead.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "index",
+ "description": "Comma-separated list of data streams, indices, and index aliases to use as default",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Indices"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "max_concurrent_searches",
+ "description": "Maximum number of concurrent searches the multi search API can execute.\nDefaults to `max(1, (# of data nodes * min(search thread pool size, 10)))`.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "max_concurrent_shard_requests",
+ "description": "Maximum number of concurrent shard requests that each sub-search request executes per node.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "pre_filter_shard_size",
+ "description": "Defines a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method i.e., if date filters are mandatory to match but the shard bounds and the query are disjoint.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "rest_total_hits_as_int",
+ "description": "If true, hits.total are returned as an integer in the response. Defaults to false, which returns an object.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "routing",
+ "description": "Custom routing value used to route search operations to a specific shard.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Routing"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "search_type",
+ "description": "Indicates whether global term and document frequencies should be used when scoring returned documents.\n\nSupported values include:\n - `query_then_fetch`: Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate.\n - `dfs_query_then_fetch`: Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.SearchType"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "typed_keys",
+ "description": "Specifies whether aggregation and suggester names should be prefixed by their respective types in the response.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_global.msearch.RequestItem"
+ }
+ },
+ "examples": {
+ "MsearchRequestExample1": {
+ "description": "An example body for a `GET my-index-000001/_msearch` request.",
+ "value": "{ }\n{\"query\" : {\"match\" : { \"message\": \"this is a test\"}}}\n{\"index\": \"my-index-000002\"}\n{\"query\" : {\"match_all\" : {}}}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_global.msearch.MultiSearchResult"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 1.3.0",
+ "x-variations": [
+ "\n GET\n /{index}/_msearch\n
\n ",
+ "\n POST\n /{index}/_msearch\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "msearch",
+ "x-category": "search",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET my-index-000001/_msearch\n{ }\n{\"query\" : {\"match\" : { \"message\": \"this is a test\"}}}\n{\"index\": \"my-index-000002\"}\n{\"query\" : {\"match_all\" : {}}}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.msearch(\n index=\"my-index-000001\",\n searches=[\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ],\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.msearch({\n index: \"my-index-000001\",\n searches: [\n {},\n {\n query: {\n match: {\n message: \"this is a test\",\n },\n },\n },\n {\n index: \"my-index-000002\",\n },\n {\n query: {\n match_all: {},\n },\n },\n ],\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.msearch(\n index: \"my-index-000001\",\n body: [\n {},\n {\n \"query\": {\n \"match\": {\n \"message\": \"this is a test\"\n }\n }\n },\n {\n \"index\": \"my-index-000002\"\n },\n {\n \"query\": {\n \"match_all\": {}\n }\n }\n ]\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->msearch([\n \"index\" => \"my-index-000001\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"query\" => [\n \"match\" => [\n \"message\" => \"this is a test\",\n ],\n ],\n ],\n [\n \"index\" => \"my-index-000002\",\n ],\n [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n ),\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/x-ndjson\" -d $'{}\\n{\"query\":{\"match\":{\"message\":\"this is a test\"}}}\\n{\"index\":\"my-index-000002\"}\\n{\"query\":{\"match_all\":{}}}\\n' \"$ELASTICSEARCH_URL/my-index-000001/_msearch\""
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_msearch/template": {
+ "get": {
+ "tags": [
+ "search"
+ ],
+ "summary": "Run multiple templated searches",
+ "description": "Run multiple templated searches with a single request.\nIf you are providing a text file or text input to `curl`, use the `--data-binary` flag instead of `-d` to preserve newlines.\nFor example:\n\n```\n$ cat requests\n{ \"index\": \"my-index\" }\n{ \"id\": \"my-search-template\", \"params\": { \"query_string\": \"hello world\", \"from\": 0, \"size\": 10 }}\n{ \"index\": \"my-other-index\" }\n{ \"id\": \"my-other-search-template\", \"params\": { \"query_type\": \"match_all\" }}\n\n$ curl -H \"Content-Type: application/x-ndjson\" -XGET localhost:9200/_msearch/template --data-binary \"@requests\"; echo\n```",
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/solutions/search/search-templates",
+ "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/multi-search-template.html"
+ },
+ "operationId": "msearch-template",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "ccs_minimize_roundtrips",
+ "description": "If `true`, network round-trips are minimized for cross-cluster search requests.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "max_concurrent_searches",
+ "description": "The maximum number of concurrent searches the API can run.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "search_type",
+ "description": "The type of the search operation.\n\nSupported values include:\n - `query_then_fetch`: Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate.\n - `dfs_query_then_fetch`: Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.SearchType"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "rest_total_hits_as_int",
+ "description": "If `true`, the response returns `hits.total` as an integer.\nIf `false`, it returns `hits.total` as an object.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "typed_keys",
+ "description": "If `true`, the response prefixes aggregation and suggester names with their respective types.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_global.msearch_template.RequestItem"
+ }
+ },
+ "examples": {
+ "MultiSearchTemplateRequestExample1": {
+ "description": "Run `GET my-index/_msearch/template` to run multiple templated searches.",
+ "value": "{ }\n{ \"id\": \"my-search-template\", \"params\": { \"query_string\": \"hello world\", \"from\": 0, \"size\": 10 }}\n{ }\n{ \"id\": \"my-other-search-template\", \"params\": { \"query_type\": \"match_all\" }}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_global.msearch.MultiSearchResult"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 5.0.0",
+ "x-variations": [
+ "\n GET\n /_msearch/template\n
\n ",
+ "\n POST\n /_msearch/template\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "msearch_template",
+ "x-category": "search",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET my-index/_msearch/template\n{ }\n{ \"id\": \"my-search-template\", \"params\": { \"query_string\": \"hello world\", \"from\": 0, \"size\": 10 }}\n{ }\n{ \"id\": \"my-other-search-template\", \"params\": { \"query_type\": \"match_all\" }}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.msearch_template(\n index=\"my-index\",\n search_templates=[\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ],\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.msearchTemplate({\n index: \"my-index\",\n search_templates: [\n {},\n {\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 0,\n size: 10,\n },\n },\n {},\n {\n id: \"my-other-search-template\",\n params: {\n query_type: \"match_all\",\n },\n },\n ],\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.msearch_template(\n index: \"my-index\",\n body: [\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ]\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->msearchTemplate([\n \"index\" => \"my-index\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 0,\n \"size\" => 10,\n ],\n ],\n new ArrayObject([]),\n [\n \"id\" => \"my-other-search-template\",\n \"params\" => [\n \"query_type\" => \"match_all\",\n ],\n ],\n ),\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/x-ndjson\" -d $'{}\\n{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":0,\"size\":10}}\\n{}\\n{\"id\":\"my-other-search-template\",\"params\":{\"query_type\":\"match_all\"}}\\n' \"$ELASTICSEARCH_URL/my-index/_msearch/template\""
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "post": {
+ "tags": [
+ "search"
+ ],
+ "summary": "Run multiple templated searches",
+ "description": "Run multiple templated searches with a single request.\nIf you are providing a text file or text input to `curl`, use the `--data-binary` flag instead of `-d` to preserve newlines.\nFor example:\n\n```\n$ cat requests\n{ \"index\": \"my-index\" }\n{ \"id\": \"my-search-template\", \"params\": { \"query_string\": \"hello world\", \"from\": 0, \"size\": 10 }}\n{ \"index\": \"my-other-index\" }\n{ \"id\": \"my-other-search-template\", \"params\": { \"query_type\": \"match_all\" }}\n\n$ curl -H \"Content-Type: application/x-ndjson\" -XGET localhost:9200/_msearch/template --data-binary \"@requests\"; echo\n```",
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/solutions/search/search-templates",
+ "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/multi-search-template.html"
+ },
+ "operationId": "msearch-template-1",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "ccs_minimize_roundtrips",
+ "description": "If `true`, network round-trips are minimized for cross-cluster search requests.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "max_concurrent_searches",
+ "description": "The maximum number of concurrent searches the API can run.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "search_type",
+ "description": "The type of the search operation.\n\nSupported values include:\n - `query_then_fetch`: Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate.\n - `dfs_query_then_fetch`: Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.SearchType"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "rest_total_hits_as_int",
+ "description": "If `true`, the response returns `hits.total` as an integer.\nIf `false`, it returns `hits.total` as an object.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "typed_keys",
+ "description": "If `true`, the response prefixes aggregation and suggester names with their respective types.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_global.msearch_template.RequestItem"
+ }
+ },
+ "examples": {
+ "MultiSearchTemplateRequestExample1": {
+ "description": "Run `GET my-index/_msearch/template` to run multiple templated searches.",
+ "value": "{ }\n{ \"id\": \"my-search-template\", \"params\": { \"query_string\": \"hello world\", \"from\": 0, \"size\": 10 }}\n{ }\n{ \"id\": \"my-other-search-template\", \"params\": { \"query_type\": \"match_all\" }}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_global.msearch.MultiSearchResult"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 5.0.0",
+ "x-variations": [
+ "\n GET\n /_msearch/template\n
\n ",
+ "\n POST\n /_msearch/template\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "msearch_template",
+ "x-category": "search",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET my-index/_msearch/template\n{ }\n{ \"id\": \"my-search-template\", \"params\": { \"query_string\": \"hello world\", \"from\": 0, \"size\": 10 }}\n{ }\n{ \"id\": \"my-other-search-template\", \"params\": { \"query_type\": \"match_all\" }}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.msearch_template(\n index=\"my-index\",\n search_templates=[\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ],\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.msearchTemplate({\n index: \"my-index\",\n search_templates: [\n {},\n {\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 0,\n size: 10,\n },\n },\n {},\n {\n id: \"my-other-search-template\",\n params: {\n query_type: \"match_all\",\n },\n },\n ],\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.msearch_template(\n index: \"my-index\",\n body: [\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ]\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->msearchTemplate([\n \"index\" => \"my-index\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 0,\n \"size\" => 10,\n ],\n ],\n new ArrayObject([]),\n [\n \"id\" => \"my-other-search-template\",\n \"params\" => [\n \"query_type\" => \"match_all\",\n ],\n ],\n ),\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/x-ndjson\" -d $'{}\\n{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":0,\"size\":10}}\\n{}\\n{\"id\":\"my-other-search-template\",\"params\":{\"query_type\":\"match_all\"}}\\n' \"$ELASTICSEARCH_URL/my-index/_msearch/template\""
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/{index}/_msearch/template": {
+ "get": {
+ "tags": [
+ "search"
+ ],
+ "summary": "Run multiple templated searches",
+ "description": "Run multiple templated searches with a single request.\nIf you are providing a text file or text input to `curl`, use the `--data-binary` flag instead of `-d` to preserve newlines.\nFor example:\n\n```\n$ cat requests\n{ \"index\": \"my-index\" }\n{ \"id\": \"my-search-template\", \"params\": { \"query_string\": \"hello world\", \"from\": 0, \"size\": 10 }}\n{ \"index\": \"my-other-index\" }\n{ \"id\": \"my-other-search-template\", \"params\": { \"query_type\": \"match_all\" }}\n\n$ curl -H \"Content-Type: application/x-ndjson\" -XGET localhost:9200/_msearch/template --data-binary \"@requests\"; echo\n```",
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/solutions/search/search-templates",
+ "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/multi-search-template.html"
+ },
+ "operationId": "msearch-template-2",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "index",
+ "description": "A comma-separated list of data streams, indices, and aliases to search.\nIt supports wildcards (`*`).\nTo search all data streams and indices, omit this parameter or use `*`.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Indices"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "ccs_minimize_roundtrips",
+ "description": "If `true`, network round-trips are minimized for cross-cluster search requests.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "max_concurrent_searches",
+ "description": "The maximum number of concurrent searches the API can run.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "search_type",
+ "description": "The type of the search operation.\n\nSupported values include:\n - `query_then_fetch`: Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate.\n - `dfs_query_then_fetch`: Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.SearchType"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "rest_total_hits_as_int",
+ "description": "If `true`, the response returns `hits.total` as an integer.\nIf `false`, it returns `hits.total` as an object.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "typed_keys",
+ "description": "If `true`, the response prefixes aggregation and suggester names with their respective types.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_global.msearch_template.RequestItem"
+ }
+ },
+ "examples": {
+ "MultiSearchTemplateRequestExample1": {
+ "description": "Run `GET my-index/_msearch/template` to run multiple templated searches.",
+ "value": "{ }\n{ \"id\": \"my-search-template\", \"params\": { \"query_string\": \"hello world\", \"from\": 0, \"size\": 10 }}\n{ }\n{ \"id\": \"my-other-search-template\", \"params\": { \"query_type\": \"match_all\" }}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_global.msearch.MultiSearchResult"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 5.0.0",
+ "x-variations": [
+ "\n GET\n /{index}/_msearch/template\n
\n ",
+ "\n POST\n /{index}/_msearch/template\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "msearch_template",
+ "x-category": "search",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET my-index/_msearch/template\n{ }\n{ \"id\": \"my-search-template\", \"params\": { \"query_string\": \"hello world\", \"from\": 0, \"size\": 10 }}\n{ }\n{ \"id\": \"my-other-search-template\", \"params\": { \"query_type\": \"match_all\" }}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.msearch_template(\n index=\"my-index\",\n search_templates=[\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ],\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.msearchTemplate({\n index: \"my-index\",\n search_templates: [\n {},\n {\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 0,\n size: 10,\n },\n },\n {},\n {\n id: \"my-other-search-template\",\n params: {\n query_type: \"match_all\",\n },\n },\n ],\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.msearch_template(\n index: \"my-index\",\n body: [\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ]\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->msearchTemplate([\n \"index\" => \"my-index\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 0,\n \"size\" => 10,\n ],\n ],\n new ArrayObject([]),\n [\n \"id\" => \"my-other-search-template\",\n \"params\" => [\n \"query_type\" => \"match_all\",\n ],\n ],\n ),\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/x-ndjson\" -d $'{}\\n{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":0,\"size\":10}}\\n{}\\n{\"id\":\"my-other-search-template\",\"params\":{\"query_type\":\"match_all\"}}\\n' \"$ELASTICSEARCH_URL/my-index/_msearch/template\""
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "post": {
+ "tags": [
+ "search"
+ ],
+ "summary": "Run multiple templated searches",
+ "description": "Run multiple templated searches with a single request.\nIf you are providing a text file or text input to `curl`, use the `--data-binary` flag instead of `-d` to preserve newlines.\nFor example:\n\n```\n$ cat requests\n{ \"index\": \"my-index\" }\n{ \"id\": \"my-search-template\", \"params\": { \"query_string\": \"hello world\", \"from\": 0, \"size\": 10 }}\n{ \"index\": \"my-other-index\" }\n{ \"id\": \"my-other-search-template\", \"params\": { \"query_type\": \"match_all\" }}\n\n$ curl -H \"Content-Type: application/x-ndjson\" -XGET localhost:9200/_msearch/template --data-binary \"@requests\"; echo\n```",
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/solutions/search/search-templates",
+ "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/multi-search-template.html"
+ },
+ "operationId": "msearch-template-3",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "index",
+ "description": "A comma-separated list of data streams, indices, and aliases to search.\nIt supports wildcards (`*`).\nTo search all data streams and indices, omit this parameter or use `*`.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Indices"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "ccs_minimize_roundtrips",
+ "description": "If `true`, network round-trips are minimized for cross-cluster search requests.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "max_concurrent_searches",
+ "description": "The maximum number of concurrent searches the API can run.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "search_type",
+ "description": "The type of the search operation.\n\nSupported values include:\n - `query_then_fetch`: Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate.\n - `dfs_query_then_fetch`: Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.SearchType"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "rest_total_hits_as_int",
+ "description": "If `true`, the response returns `hits.total` as an integer.\nIf `false`, it returns `hits.total` as an object.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "typed_keys",
+ "description": "If `true`, the response prefixes aggregation and suggester names with their respective types.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_global.msearch_template.RequestItem"
+ }
+ },
+ "examples": {
+ "MultiSearchTemplateRequestExample1": {
+ "description": "Run `GET my-index/_msearch/template` to run multiple templated searches.",
+ "value": "{ }\n{ \"id\": \"my-search-template\", \"params\": { \"query_string\": \"hello world\", \"from\": 0, \"size\": 10 }}\n{ }\n{ \"id\": \"my-other-search-template\", \"params\": { \"query_type\": \"match_all\" }}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_global.msearch.MultiSearchResult"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 5.0.0",
+ "x-variations": [
+ "\n GET\n /{index}/_msearch/template\n
\n ",
+ "\n POST\n /{index}/_msearch/template\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "msearch_template",
+ "x-category": "search",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET my-index/_msearch/template\n{ }\n{ \"id\": \"my-search-template\", \"params\": { \"query_string\": \"hello world\", \"from\": 0, \"size\": 10 }}\n{ }\n{ \"id\": \"my-other-search-template\", \"params\": { \"query_type\": \"match_all\" }}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.msearch_template(\n index=\"my-index\",\n search_templates=[\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ],\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.msearchTemplate({\n index: \"my-index\",\n search_templates: [\n {},\n {\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 0,\n size: 10,\n },\n },\n {},\n {\n id: \"my-other-search-template\",\n params: {\n query_type: \"match_all\",\n },\n },\n ],\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.msearch_template(\n index: \"my-index\",\n body: [\n {},\n {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n },\n {},\n {\n \"id\": \"my-other-search-template\",\n \"params\": {\n \"query_type\": \"match_all\"\n }\n }\n ]\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->msearchTemplate([\n \"index\" => \"my-index\",\n \"body\" => array(\n new ArrayObject([]),\n [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 0,\n \"size\" => 10,\n ],\n ],\n new ArrayObject([]),\n [\n \"id\" => \"my-other-search-template\",\n \"params\" => [\n \"query_type\" => \"match_all\",\n ],\n ],\n ),\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/x-ndjson\" -d $'{}\\n{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":0,\"size\":10}}\\n{}\\n{\"id\":\"my-other-search-template\",\"params\":{\"query_type\":\"match_all\"}}\\n' \"$ELASTICSEARCH_URL/my-index/_msearch/template\""
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_mtermvectors": {
+ "get": {
+ "tags": [
+ "document"
+ ],
+ "summary": "Get multiple term vectors",
+ "description": "Get multiple term vectors with a single request.\nYou can specify existing documents by index and ID or provide artificial documents in the body of the request.\nYou can specify the index in the request body or request URI.\nThe response contains a `docs` array with all the fetched termvectors.\nEach element has the structure provided by the termvectors API.\n\n**Artificial documents**\n\nYou can also use `mtermvectors` to generate term vectors for artificial documents provided in the body of the request.\nThe mapping used is determined by the specified `_index`.",
+ "operationId": "mtermvectors",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "ids",
+ "description": "A comma-separated list of documents ids. You must define ids as parameter or set \"ids\" or \"docs\" in the request body",
+ "deprecated": false,
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_types.Id"
+ }
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "fields",
+ "description": "A comma-separated list or wildcard expressions of fields to include in the statistics.\nIt is used as the default list unless a specific field list is provided in the `completion_fields` or `fielddata_fields` parameters.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "field_statistics",
+ "description": "If `true`, the response includes the document count, sum of document frequencies, and sum of total term frequencies.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "offsets",
+ "description": "If `true`, the response includes term offsets.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "payloads",
+ "description": "If `true`, the response includes term payloads.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "positions",
+ "description": "If `true`, the response includes term positions.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "preference",
+ "description": "The node or shard the operation should be performed on.\nIt is random by default.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "realtime",
+ "description": "If true, the request is real-time as opposed to near-real-time.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "routing",
+ "description": "A custom value used to route operations to a specific shard.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Routing"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "term_statistics",
+ "description": "If true, the response includes term frequency and document frequency.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "version",
+ "description": "If `true`, returns the document version as part of a hit.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.VersionNumber"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "version_type",
+ "description": "The version type.\n\nSupported values include:\n - `internal`: Use internal versioning that starts at 1 and increments with each update or delete.\n - `external`: Only index the document if the specified version is strictly higher than the version of the stored document or if there is no existing document.\n - `external_gte`: Only index the document if the specified version is equal or higher than the version of the stored document or if there is no existing document.\nNOTE: The `external_gte` version type is meant for special use cases and should be used with care.\nIf used incorrectly, it can result in loss of data.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.VersionType"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "docs": {
+ "description": "An array of existing or artificial documents.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_global.mtermvectors.Operation"
+ }
+ },
+ "ids": {
+ "description": "A simplified syntax to specify documents by their ID if they're in the same index.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_types.Id"
+ }
+ }
+ }
+ },
+ "examples": {
+ "MultiTermVectorsRequestExample1": {
+ "summary": "Get multiple term vectors",
+ "description": "Run `POST /my-index-000001/_mtermvectors`. When you specify an index in the request URI, the index does not need to be specified for each documents in the request body.\n",
+ "value": "{\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n}"
+ },
+ "MultiTermVectorsRequestExample2": {
+ "summary": "Simplified syntax",
+ "description": "Run `POST /my-index-000001/_mtermvectors`. If all requested documents are in same index and the parameters are the same, you can use a simplified syntax.\n",
+ "value": "{\n \"ids\": [ \"1\", \"2\" ],\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n}"
+ },
+ "MultiTermVectorsRequestExample3": {
+ "summary": "Artificial documents",
+ "description": "Run `POST /_mtermvectors` to generate term vectors for artificial documents provided in the body of the request. The mapping used is determined by the specified `_index`.\n",
+ "value": "{\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}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "docs": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_global.mtermvectors.TermVectorsResult"
+ }
+ }
+ },
+ "required": [
+ "docs"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available",
+ "x-variations": [
+ "\n GET\n /_mtermvectors\n
\n ",
+ "\n POST\n /_mtermvectors\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "mtermvectors",
+ "x-category": "document management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST /my-index-000001/_mtermvectors\n{\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.mtermvectors(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": True\n },\n {\n \"_id\": \"1\"\n }\n ],\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.mtermvectors({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"2\",\n fields: [\"message\"],\n term_statistics: true,\n },\n {\n _id: \"1\",\n },\n ],\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.mtermvectors(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->mtermvectors([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"2\",\n \"fields\" => array(\n \"message\",\n ),\n \"term_statistics\" => true,\n ],\n [\n \"_id\" => \"1\",\n ],\n ),\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":\"2\",\"fields\":[\"message\"],\"term_statistics\":true},{\"_id\":\"1\"}]}' \"$ELASTICSEARCH_URL/my-index-000001/_mtermvectors\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.mtermvectors(m -> m\n .docs(List.of(MultiTermVectorsOperation.of(mu -> mu\n .id(\"2\")\n .fields(\"message\")\n .termStatistics(true)\n ),MultiTermVectorsOperation.of(mu -> mu\n .id(\"1\")\n )))\n .index(\"my-index-000001\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "post": {
+ "tags": [
+ "document"
+ ],
+ "summary": "Get multiple term vectors",
+ "description": "Get multiple term vectors with a single request.\nYou can specify existing documents by index and ID or provide artificial documents in the body of the request.\nYou can specify the index in the request body or request URI.\nThe response contains a `docs` array with all the fetched termvectors.\nEach element has the structure provided by the termvectors API.\n\n**Artificial documents**\n\nYou can also use `mtermvectors` to generate term vectors for artificial documents provided in the body of the request.\nThe mapping used is determined by the specified `_index`.",
+ "operationId": "mtermvectors-1",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "ids",
+ "description": "A comma-separated list of documents ids. You must define ids as parameter or set \"ids\" or \"docs\" in the request body",
+ "deprecated": false,
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_types.Id"
+ }
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "fields",
+ "description": "A comma-separated list or wildcard expressions of fields to include in the statistics.\nIt is used as the default list unless a specific field list is provided in the `completion_fields` or `fielddata_fields` parameters.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "field_statistics",
+ "description": "If `true`, the response includes the document count, sum of document frequencies, and sum of total term frequencies.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "offsets",
+ "description": "If `true`, the response includes term offsets.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "payloads",
+ "description": "If `true`, the response includes term payloads.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "positions",
+ "description": "If `true`, the response includes term positions.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "preference",
+ "description": "The node or shard the operation should be performed on.\nIt is random by default.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "realtime",
+ "description": "If true, the request is real-time as opposed to near-real-time.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "routing",
+ "description": "A custom value used to route operations to a specific shard.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Routing"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "term_statistics",
+ "description": "If true, the response includes term frequency and document frequency.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "version",
+ "description": "If `true`, returns the document version as part of a hit.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.VersionNumber"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "version_type",
+ "description": "The version type.\n\nSupported values include:\n - `internal`: Use internal versioning that starts at 1 and increments with each update or delete.\n - `external`: Only index the document if the specified version is strictly higher than the version of the stored document or if there is no existing document.\n - `external_gte`: Only index the document if the specified version is equal or higher than the version of the stored document or if there is no existing document.\nNOTE: The `external_gte` version type is meant for special use cases and should be used with care.\nIf used incorrectly, it can result in loss of data.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.VersionType"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "docs": {
+ "description": "An array of existing or artificial documents.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_global.mtermvectors.Operation"
+ }
+ },
+ "ids": {
+ "description": "A simplified syntax to specify documents by their ID if they're in the same index.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_types.Id"
+ }
+ }
+ }
+ },
+ "examples": {
+ "MultiTermVectorsRequestExample1": {
+ "summary": "Get multiple term vectors",
+ "description": "Run `POST /my-index-000001/_mtermvectors`. When you specify an index in the request URI, the index does not need to be specified for each documents in the request body.\n",
+ "value": "{\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n}"
+ },
+ "MultiTermVectorsRequestExample2": {
+ "summary": "Simplified syntax",
+ "description": "Run `POST /my-index-000001/_mtermvectors`. If all requested documents are in same index and the parameters are the same, you can use a simplified syntax.\n",
+ "value": "{\n \"ids\": [ \"1\", \"2\" ],\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n}"
+ },
+ "MultiTermVectorsRequestExample3": {
+ "summary": "Artificial documents",
+ "description": "Run `POST /_mtermvectors` to generate term vectors for artificial documents provided in the body of the request. The mapping used is determined by the specified `_index`.\n",
+ "value": "{\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}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "docs": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_global.mtermvectors.TermVectorsResult"
+ }
+ }
+ },
+ "required": [
+ "docs"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available",
+ "x-variations": [
+ "\n GET\n /_mtermvectors\n
\n ",
+ "\n POST\n /_mtermvectors\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "mtermvectors",
+ "x-category": "document management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST /my-index-000001/_mtermvectors\n{\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.mtermvectors(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": True\n },\n {\n \"_id\": \"1\"\n }\n ],\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.mtermvectors({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"2\",\n fields: [\"message\"],\n term_statistics: true,\n },\n {\n _id: \"1\",\n },\n ],\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.mtermvectors(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->mtermvectors([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"2\",\n \"fields\" => array(\n \"message\",\n ),\n \"term_statistics\" => true,\n ],\n [\n \"_id\" => \"1\",\n ],\n ),\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":\"2\",\"fields\":[\"message\"],\"term_statistics\":true},{\"_id\":\"1\"}]}' \"$ELASTICSEARCH_URL/my-index-000001/_mtermvectors\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.mtermvectors(m -> m\n .docs(List.of(MultiTermVectorsOperation.of(mu -> mu\n .id(\"2\")\n .fields(\"message\")\n .termStatistics(true)\n ),MultiTermVectorsOperation.of(mu -> mu\n .id(\"1\")\n )))\n .index(\"my-index-000001\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/{index}/_mtermvectors": {
+ "get": {
+ "tags": [
+ "document"
+ ],
+ "summary": "Get multiple term vectors",
+ "description": "Get multiple term vectors with a single request.\nYou can specify existing documents by index and ID or provide artificial documents in the body of the request.\nYou can specify the index in the request body or request URI.\nThe response contains a `docs` array with all the fetched termvectors.\nEach element has the structure provided by the termvectors API.\n\n**Artificial documents**\n\nYou can also use `mtermvectors` to generate term vectors for artificial documents provided in the body of the request.\nThe mapping used is determined by the specified `_index`.",
+ "operationId": "mtermvectors-2",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "index",
+ "description": "The name of the index that contains the documents.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.IndexName"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "ids",
+ "description": "A comma-separated list of documents ids. You must define ids as parameter or set \"ids\" or \"docs\" in the request body",
+ "deprecated": false,
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_types.Id"
+ }
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "fields",
+ "description": "A comma-separated list or wildcard expressions of fields to include in the statistics.\nIt is used as the default list unless a specific field list is provided in the `completion_fields` or `fielddata_fields` parameters.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "field_statistics",
+ "description": "If `true`, the response includes the document count, sum of document frequencies, and sum of total term frequencies.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "offsets",
+ "description": "If `true`, the response includes term offsets.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "payloads",
+ "description": "If `true`, the response includes term payloads.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "positions",
+ "description": "If `true`, the response includes term positions.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "preference",
+ "description": "The node or shard the operation should be performed on.\nIt is random by default.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "realtime",
+ "description": "If true, the request is real-time as opposed to near-real-time.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "routing",
+ "description": "A custom value used to route operations to a specific shard.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Routing"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "term_statistics",
+ "description": "If true, the response includes term frequency and document frequency.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "version",
+ "description": "If `true`, returns the document version as part of a hit.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.VersionNumber"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "version_type",
+ "description": "The version type.\n\nSupported values include:\n - `internal`: Use internal versioning that starts at 1 and increments with each update or delete.\n - `external`: Only index the document if the specified version is strictly higher than the version of the stored document or if there is no existing document.\n - `external_gte`: Only index the document if the specified version is equal or higher than the version of the stored document or if there is no existing document.\nNOTE: The `external_gte` version type is meant for special use cases and should be used with care.\nIf used incorrectly, it can result in loss of data.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.VersionType"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "docs": {
+ "description": "An array of existing or artificial documents.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_global.mtermvectors.Operation"
+ }
+ },
+ "ids": {
+ "description": "A simplified syntax to specify documents by their ID if they're in the same index.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_types.Id"
+ }
+ }
+ }
+ },
+ "examples": {
+ "MultiTermVectorsRequestExample1": {
+ "summary": "Get multiple term vectors",
+ "description": "Run `POST /my-index-000001/_mtermvectors`. When you specify an index in the request URI, the index does not need to be specified for each documents in the request body.\n",
+ "value": "{\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n}"
+ },
+ "MultiTermVectorsRequestExample2": {
+ "summary": "Simplified syntax",
+ "description": "Run `POST /my-index-000001/_mtermvectors`. If all requested documents are in same index and the parameters are the same, you can use a simplified syntax.\n",
+ "value": "{\n \"ids\": [ \"1\", \"2\" ],\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n}"
+ },
+ "MultiTermVectorsRequestExample3": {
+ "summary": "Artificial documents",
+ "description": "Run `POST /_mtermvectors` to generate term vectors for artificial documents provided in the body of the request. The mapping used is determined by the specified `_index`.\n",
+ "value": "{\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}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "docs": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_global.mtermvectors.TermVectorsResult"
+ }
+ }
+ },
+ "required": [
+ "docs"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available",
+ "x-variations": [
+ "\n GET\n /{index}/_mtermvectors\n
\n ",
+ "\n POST\n /{index}/_mtermvectors\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "mtermvectors",
+ "x-category": "document management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST /my-index-000001/_mtermvectors\n{\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.mtermvectors(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": True\n },\n {\n \"_id\": \"1\"\n }\n ],\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.mtermvectors({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"2\",\n fields: [\"message\"],\n term_statistics: true,\n },\n {\n _id: \"1\",\n },\n ],\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.mtermvectors(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->mtermvectors([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"2\",\n \"fields\" => array(\n \"message\",\n ),\n \"term_statistics\" => true,\n ],\n [\n \"_id\" => \"1\",\n ],\n ),\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":\"2\",\"fields\":[\"message\"],\"term_statistics\":true},{\"_id\":\"1\"}]}' \"$ELASTICSEARCH_URL/my-index-000001/_mtermvectors\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.mtermvectors(m -> m\n .docs(List.of(MultiTermVectorsOperation.of(mu -> mu\n .id(\"2\")\n .fields(\"message\")\n .termStatistics(true)\n ),MultiTermVectorsOperation.of(mu -> mu\n .id(\"1\")\n )))\n .index(\"my-index-000001\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "post": {
+ "tags": [
+ "document"
+ ],
+ "summary": "Get multiple term vectors",
+ "description": "Get multiple term vectors with a single request.\nYou can specify existing documents by index and ID or provide artificial documents in the body of the request.\nYou can specify the index in the request body or request URI.\nThe response contains a `docs` array with all the fetched termvectors.\nEach element has the structure provided by the termvectors API.\n\n**Artificial documents**\n\nYou can also use `mtermvectors` to generate term vectors for artificial documents provided in the body of the request.\nThe mapping used is determined by the specified `_index`.",
+ "operationId": "mtermvectors-3",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "index",
+ "description": "The name of the index that contains the documents.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.IndexName"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "ids",
+ "description": "A comma-separated list of documents ids. You must define ids as parameter or set \"ids\" or \"docs\" in the request body",
+ "deprecated": false,
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_types.Id"
+ }
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "fields",
+ "description": "A comma-separated list or wildcard expressions of fields to include in the statistics.\nIt is used as the default list unless a specific field list is provided in the `completion_fields` or `fielddata_fields` parameters.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "field_statistics",
+ "description": "If `true`, the response includes the document count, sum of document frequencies, and sum of total term frequencies.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "offsets",
+ "description": "If `true`, the response includes term offsets.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "payloads",
+ "description": "If `true`, the response includes term payloads.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "positions",
+ "description": "If `true`, the response includes term positions.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "preference",
+ "description": "The node or shard the operation should be performed on.\nIt is random by default.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "realtime",
+ "description": "If true, the request is real-time as opposed to near-real-time.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "routing",
+ "description": "A custom value used to route operations to a specific shard.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Routing"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "term_statistics",
+ "description": "If true, the response includes term frequency and document frequency.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "version",
+ "description": "If `true`, returns the document version as part of a hit.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.VersionNumber"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "version_type",
+ "description": "The version type.\n\nSupported values include:\n - `internal`: Use internal versioning that starts at 1 and increments with each update or delete.\n - `external`: Only index the document if the specified version is strictly higher than the version of the stored document or if there is no existing document.\n - `external_gte`: Only index the document if the specified version is equal or higher than the version of the stored document or if there is no existing document.\nNOTE: The `external_gte` version type is meant for special use cases and should be used with care.\nIf used incorrectly, it can result in loss of data.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.VersionType"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "docs": {
+ "description": "An array of existing or artificial documents.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_global.mtermvectors.Operation"
+ }
+ },
+ "ids": {
+ "description": "A simplified syntax to specify documents by their ID if they're in the same index.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_types.Id"
+ }
+ }
+ }
+ },
+ "examples": {
+ "MultiTermVectorsRequestExample1": {
+ "summary": "Get multiple term vectors",
+ "description": "Run `POST /my-index-000001/_mtermvectors`. When you specify an index in the request URI, the index does not need to be specified for each documents in the request body.\n",
+ "value": "{\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n}"
+ },
+ "MultiTermVectorsRequestExample2": {
+ "summary": "Simplified syntax",
+ "description": "Run `POST /my-index-000001/_mtermvectors`. If all requested documents are in same index and the parameters are the same, you can use a simplified syntax.\n",
+ "value": "{\n \"ids\": [ \"1\", \"2\" ],\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n}"
+ },
+ "MultiTermVectorsRequestExample3": {
+ "summary": "Artificial documents",
+ "description": "Run `POST /_mtermvectors` to generate term vectors for artificial documents provided in the body of the request. The mapping used is determined by the specified `_index`.\n",
+ "value": "{\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}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "docs": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_global.mtermvectors.TermVectorsResult"
+ }
+ }
+ },
+ "required": [
+ "docs"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available",
+ "x-variations": [
+ "\n GET\n /{index}/_mtermvectors\n
\n ",
+ "\n POST\n /{index}/_mtermvectors\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "mtermvectors",
+ "x-category": "document management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST /my-index-000001/_mtermvectors\n{\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.mtermvectors(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": True\n },\n {\n \"_id\": \"1\"\n }\n ],\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.mtermvectors({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"2\",\n fields: [\"message\"],\n term_statistics: true,\n },\n {\n _id: \"1\",\n },\n ],\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.mtermvectors(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"2\",\n \"fields\": [\n \"message\"\n ],\n \"term_statistics\": true\n },\n {\n \"_id\": \"1\"\n }\n ]\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->mtermvectors([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"2\",\n \"fields\" => array(\n \"message\",\n ),\n \"term_statistics\" => true,\n ],\n [\n \"_id\" => \"1\",\n ],\n ),\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"docs\":[{\"_id\":\"2\",\"fields\":[\"message\"],\"term_statistics\":true},{\"_id\":\"1\"}]}' \"$ELASTICSEARCH_URL/my-index-000001/_mtermvectors\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.mtermvectors(m -> m\n .docs(List.of(MultiTermVectorsOperation.of(mu -> mu\n .id(\"2\")\n .fields(\"message\")\n .termStatistics(true)\n ),MultiTermVectorsOperation.of(mu -> mu\n .id(\"1\")\n )))\n .index(\"my-index-000001\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_nodes/{node_id}/_repositories_metering/{max_archive_version}": {
+ "delete": {
+ "tags": [
+ "cluster"
+ ],
+ "summary": "Clear the archived repositories metering",
+ "description": "Clear the archived repositories metering information in the cluster.",
+ "operationId": "nodes-clear-repositories-metering-archive",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "node_id",
+ "description": "Comma-separated list of node IDs or names used to limit returned information.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.NodeIds"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "path",
+ "name": "max_archive_version",
+ "description": "Specifies the maximum `archive_version` to be cleared from the archive.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "simple"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/nodes.clear_repositories_metering_archive.ResponseBase"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Technical preview; Added in 7.16.0",
+ "x-variations": [
+ "\n DELETE\n /_nodes/{node_id}/_repositories_metering/{max_archive_version}\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor`,`manage`\n"
+ ],
+ "x-api": "clear_repositories_metering_archive.nodes",
+ "x-category": "unknown",
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_nodes/{node_id}/_repositories_metering": {
+ "get": {
+ "tags": [
+ "cluster"
+ ],
+ "summary": "Get cluster repositories metering",
+ "description": "Get repositories metering information for a cluster.\nThis API exposes monotonically non-decreasing counters and it is expected that clients would durably store the information needed to compute aggregations over a period of time.\nAdditionally, the information exposed by this API is volatile, meaning that it will not be present after node restarts.",
+ "operationId": "nodes-get-repositories-metering-info",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "node_id",
+ "description": "Comma-separated list of node IDs or names used to limit returned information.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.NodeIds"
+ },
+ "style": "simple"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/nodes.get_repositories_metering_info.ResponseBase"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Technical preview; Added in 7.16.0",
+ "x-variations": [
+ "\n GET\n /_nodes/{node_id}/_repositories_metering\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor`,`manage`\n"
+ ],
+ "x-api": "get_repositories_metering_info.nodes",
+ "x-category": "unknown",
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_nodes/hot_threads": {
+ "get": {
+ "tags": [
+ "cluster"
+ ],
+ "summary": "Get the hot threads for nodes",
+ "description": "Get a breakdown of the hot threads on each selected node in the cluster.\nThe output is plain text with a breakdown of the top hot threads for each node.",
+ "operationId": "nodes-hot-threads",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "ignore_idle_threads",
+ "description": "If true, known idle threads (e.g. waiting in a socket select, or to get\na task from an empty queue) are filtered out.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "interval",
+ "description": "The interval to do the second sampling of threads.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "snapshots",
+ "description": "Number of samples of thread stacktrace.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "threads",
+ "description": "Specifies the number of hot threads to provide information for.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Period to wait for a response. If no response is received\nbefore the timeout expires, the request fails and returns an error.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "type",
+ "description": "The type to sample.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.ThreadType"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "sort",
+ "description": "The sort order for 'cpu' type",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.ThreadType"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available",
+ "x-variations": [
+ "\n GET\n /_nodes/hot_threads\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor`,`manage`\n"
+ ],
+ "x-api": "hot_threads.nodes",
+ "x-category": "unknown",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET /_nodes/hot_threads\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.nodes.hot_threads()"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.nodes.hotThreads();"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.nodes.hot_threads"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->nodes()->hotThreads();"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/hot_threads\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.nodes().hotThreads(h -> h);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_nodes/{node_id}/hot_threads": {
+ "get": {
+ "tags": [
+ "cluster"
+ ],
+ "summary": "Get the hot threads for nodes",
+ "description": "Get a breakdown of the hot threads on each selected node in the cluster.\nThe output is plain text with a breakdown of the top hot threads for each node.",
+ "operationId": "nodes-hot-threads-1",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "node_id",
+ "description": "List of node IDs or names used to limit returned information.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.NodeIds"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "ignore_idle_threads",
+ "description": "If true, known idle threads (e.g. waiting in a socket select, or to get\na task from an empty queue) are filtered out.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "interval",
+ "description": "The interval to do the second sampling of threads.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "snapshots",
+ "description": "Number of samples of thread stacktrace.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "threads",
+ "description": "Specifies the number of hot threads to provide information for.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Period to wait for a response. If no response is received\nbefore the timeout expires, the request fails and returns an error.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "type",
+ "description": "The type to sample.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.ThreadType"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "sort",
+ "description": "The sort order for 'cpu' type",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.ThreadType"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available",
+ "x-variations": [
+ "\n GET\n /_nodes/{node_id}/hot_threads\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor`,`manage`\n"
+ ],
+ "x-api": "hot_threads.nodes",
+ "x-category": "unknown",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET /_nodes/hot_threads\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.nodes.hot_threads()"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.nodes.hotThreads();"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.nodes.hot_threads"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->nodes()->hotThreads();"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/hot_threads\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.nodes().hotThreads(h -> h);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_nodes": {
+ "get": {
+ "tags": [
+ "cluster"
+ ],
+ "summary": "Get node information",
+ "description": "By default, the API returns all attributes and core settings for cluster nodes.",
+ "operationId": "nodes-info",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "flat_settings",
+ "description": "If true, returns settings in flat format.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/nodes.info.ResponseBase"
+ },
+ "examples": {
+ "nodesInfoResponseExample1": {
+ "description": "An abbreviated response when requesting cluster nodes information.",
+ "value": "{\n \"_nodes\": {},\n \"cluster_name\": \"elasticsearch\",\n \"nodes\": {\n \"USpTGYaBSIKbgSUJR2Z9lg\": {\n \"name\": \"node-0\",\n \"transport_address\": \"192.168.17:9300\",\n \"host\": \"node-0.elastic.co\",\n \"ip\": \"192.168.17\",\n \"version\": \"{version}\",\n \"transport_version\": 100000298,\n \"index_version\": 100000074,\n \"component_versions\": {\n \"ml_config_version\": 100000162,\n \"transform_config_version\": 100000096\n },\n \"build_flavor\": \"default\",\n \"build_type\": \"{build_type}\",\n \"build_hash\": \"587409e\",\n \"roles\": [\n \"master\",\n \"data\",\n \"ingest\"\n ],\n \"attributes\": {},\n \"plugins\": [\n {\n \"name\": \"analysis-icu\",\n \"version\": \"{version}\",\n \"description\": \"The ICU Analysis plugin integrates Lucene ICU\n module into elasticsearch, adding ICU relates analysis components.\",\n \"classname\":\n \"org.elasticsearch.plugin.analysis.icu.AnalysisICUPlugin\",\n \"has_native_controller\": false\n }\n ],\n \"modules\": [\n {\n \"name\": \"lang-painless\",\n \"version\": \"{version}\",\n \"description\": \"An easy, safe and fast scripting language for\n Elasticsearch\",\n \"classname\": \"org.elasticsearch.painless.PainlessPlugin\",\n \"has_native_controller\": false\n }\n ]\n }\n }\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 1.3.0",
+ "x-variations": [
+ "\n GET\n /_nodes\n
\n "
+ ],
+ "x-api": "info.nodes",
+ "x-category": "unknown",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _nodes/_all/jvm\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.nodes.info(\n node_id=\"_all\",\n metric=\"jvm\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.nodes.info({\n node_id: \"_all\",\n metric: \"jvm\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.nodes.info(\n node_id: \"_all\",\n metric: \"jvm\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->nodes()->info([\n \"node_id\" => \"_all\",\n \"metric\" => \"jvm\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/_all/jvm\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.nodes().info(i -> i\n .metric(\"jvm\")\n .nodeId(\"_all\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_nodes/{node_id}": {
+ "get": {
+ "tags": [
+ "cluster"
+ ],
+ "summary": "Get node information",
+ "description": "By default, the API returns all attributes and core settings for cluster nodes.",
+ "operationId": "nodes-info-1",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "node_id",
+ "description": "Comma-separated list of node IDs or names used to limit returned information.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.NodeIds"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "flat_settings",
+ "description": "If true, returns settings in flat format.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/nodes.info.ResponseBase"
+ },
+ "examples": {
+ "nodesInfoResponseExample1": {
+ "description": "An abbreviated response when requesting cluster nodes information.",
+ "value": "{\n \"_nodes\": {},\n \"cluster_name\": \"elasticsearch\",\n \"nodes\": {\n \"USpTGYaBSIKbgSUJR2Z9lg\": {\n \"name\": \"node-0\",\n \"transport_address\": \"192.168.17:9300\",\n \"host\": \"node-0.elastic.co\",\n \"ip\": \"192.168.17\",\n \"version\": \"{version}\",\n \"transport_version\": 100000298,\n \"index_version\": 100000074,\n \"component_versions\": {\n \"ml_config_version\": 100000162,\n \"transform_config_version\": 100000096\n },\n \"build_flavor\": \"default\",\n \"build_type\": \"{build_type}\",\n \"build_hash\": \"587409e\",\n \"roles\": [\n \"master\",\n \"data\",\n \"ingest\"\n ],\n \"attributes\": {},\n \"plugins\": [\n {\n \"name\": \"analysis-icu\",\n \"version\": \"{version}\",\n \"description\": \"The ICU Analysis plugin integrates Lucene ICU\n module into elasticsearch, adding ICU relates analysis components.\",\n \"classname\":\n \"org.elasticsearch.plugin.analysis.icu.AnalysisICUPlugin\",\n \"has_native_controller\": false\n }\n ],\n \"modules\": [\n {\n \"name\": \"lang-painless\",\n \"version\": \"{version}\",\n \"description\": \"An easy, safe and fast scripting language for\n Elasticsearch\",\n \"classname\": \"org.elasticsearch.painless.PainlessPlugin\",\n \"has_native_controller\": false\n }\n ]\n }\n }\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 1.3.0",
+ "x-variations": [
+ "\n GET\n /_nodes/{node_id}\n
\n "
+ ],
+ "x-api": "info.nodes",
+ "x-category": "unknown",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _nodes/_all/jvm\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.nodes.info(\n node_id=\"_all\",\n metric=\"jvm\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.nodes.info({\n node_id: \"_all\",\n metric: \"jvm\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.nodes.info(\n node_id: \"_all\",\n metric: \"jvm\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->nodes()->info([\n \"node_id\" => \"_all\",\n \"metric\" => \"jvm\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/_all/jvm\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.nodes().info(i -> i\n .metric(\"jvm\")\n .nodeId(\"_all\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_nodes/{metric}": {
+ "get": {
+ "tags": [
+ "cluster"
+ ],
+ "summary": "Get node information",
+ "description": "By default, the API returns all attributes and core settings for cluster nodes.",
+ "operationId": "nodes-info-2",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "metric",
+ "description": "Limits the information returned to the specific metrics. Supports a comma-separated list, such as http,ingest.\n\nSupported values include: `_all`, `_none`, `settings`, `os`, `process`, `jvm`, `thread_pool`, `transport`, `http`, `remote_cluster_server`, `plugins`, `ingest`, `aggregations`, `indices`\n\n",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/nodes.info.NodesInfoMetrics"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "flat_settings",
+ "description": "If true, returns settings in flat format.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/nodes.info.ResponseBase"
+ },
+ "examples": {
+ "nodesInfoResponseExample1": {
+ "description": "An abbreviated response when requesting cluster nodes information.",
+ "value": "{\n \"_nodes\": {},\n \"cluster_name\": \"elasticsearch\",\n \"nodes\": {\n \"USpTGYaBSIKbgSUJR2Z9lg\": {\n \"name\": \"node-0\",\n \"transport_address\": \"192.168.17:9300\",\n \"host\": \"node-0.elastic.co\",\n \"ip\": \"192.168.17\",\n \"version\": \"{version}\",\n \"transport_version\": 100000298,\n \"index_version\": 100000074,\n \"component_versions\": {\n \"ml_config_version\": 100000162,\n \"transform_config_version\": 100000096\n },\n \"build_flavor\": \"default\",\n \"build_type\": \"{build_type}\",\n \"build_hash\": \"587409e\",\n \"roles\": [\n \"master\",\n \"data\",\n \"ingest\"\n ],\n \"attributes\": {},\n \"plugins\": [\n {\n \"name\": \"analysis-icu\",\n \"version\": \"{version}\",\n \"description\": \"The ICU Analysis plugin integrates Lucene ICU\n module into elasticsearch, adding ICU relates analysis components.\",\n \"classname\":\n \"org.elasticsearch.plugin.analysis.icu.AnalysisICUPlugin\",\n \"has_native_controller\": false\n }\n ],\n \"modules\": [\n {\n \"name\": \"lang-painless\",\n \"version\": \"{version}\",\n \"description\": \"An easy, safe and fast scripting language for\n Elasticsearch\",\n \"classname\": \"org.elasticsearch.painless.PainlessPlugin\",\n \"has_native_controller\": false\n }\n ]\n }\n }\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 1.3.0",
+ "x-variations": [
+ "\n GET\n /_nodes/{metric}\n
\n "
+ ],
+ "x-api": "info.nodes",
+ "x-category": "unknown",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _nodes/_all/jvm\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.nodes.info(\n node_id=\"_all\",\n metric=\"jvm\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.nodes.info({\n node_id: \"_all\",\n metric: \"jvm\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.nodes.info(\n node_id: \"_all\",\n metric: \"jvm\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->nodes()->info([\n \"node_id\" => \"_all\",\n \"metric\" => \"jvm\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/_all/jvm\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.nodes().info(i -> i\n .metric(\"jvm\")\n .nodeId(\"_all\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_nodes/{node_id}/{metric}": {
+ "get": {
+ "tags": [
+ "cluster"
+ ],
+ "summary": "Get node information",
+ "description": "By default, the API returns all attributes and core settings for cluster nodes.",
+ "operationId": "nodes-info-3",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "node_id",
+ "description": "Comma-separated list of node IDs or names used to limit returned information.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.NodeIds"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "path",
+ "name": "metric",
+ "description": "Limits the information returned to the specific metrics. Supports a comma-separated list, such as http,ingest.\n\nSupported values include: `_all`, `_none`, `settings`, `os`, `process`, `jvm`, `thread_pool`, `transport`, `http`, `remote_cluster_server`, `plugins`, `ingest`, `aggregations`, `indices`\n\n",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/nodes.info.NodesInfoMetrics"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "flat_settings",
+ "description": "If true, returns settings in flat format.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/nodes.info.ResponseBase"
+ },
+ "examples": {
+ "nodesInfoResponseExample1": {
+ "description": "An abbreviated response when requesting cluster nodes information.",
+ "value": "{\n \"_nodes\": {},\n \"cluster_name\": \"elasticsearch\",\n \"nodes\": {\n \"USpTGYaBSIKbgSUJR2Z9lg\": {\n \"name\": \"node-0\",\n \"transport_address\": \"192.168.17:9300\",\n \"host\": \"node-0.elastic.co\",\n \"ip\": \"192.168.17\",\n \"version\": \"{version}\",\n \"transport_version\": 100000298,\n \"index_version\": 100000074,\n \"component_versions\": {\n \"ml_config_version\": 100000162,\n \"transform_config_version\": 100000096\n },\n \"build_flavor\": \"default\",\n \"build_type\": \"{build_type}\",\n \"build_hash\": \"587409e\",\n \"roles\": [\n \"master\",\n \"data\",\n \"ingest\"\n ],\n \"attributes\": {},\n \"plugins\": [\n {\n \"name\": \"analysis-icu\",\n \"version\": \"{version}\",\n \"description\": \"The ICU Analysis plugin integrates Lucene ICU\n module into elasticsearch, adding ICU relates analysis components.\",\n \"classname\":\n \"org.elasticsearch.plugin.analysis.icu.AnalysisICUPlugin\",\n \"has_native_controller\": false\n }\n ],\n \"modules\": [\n {\n \"name\": \"lang-painless\",\n \"version\": \"{version}\",\n \"description\": \"An easy, safe and fast scripting language for\n Elasticsearch\",\n \"classname\": \"org.elasticsearch.painless.PainlessPlugin\",\n \"has_native_controller\": false\n }\n ]\n }\n }\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 1.3.0",
+ "x-variations": [
+ "\n GET\n /_nodes/{node_id}/{metric}\n
\n "
+ ],
+ "x-api": "info.nodes",
+ "x-category": "unknown",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _nodes/_all/jvm\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.nodes.info(\n node_id=\"_all\",\n metric=\"jvm\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.nodes.info({\n node_id: \"_all\",\n metric: \"jvm\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.nodes.info(\n node_id: \"_all\",\n metric: \"jvm\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->nodes()->info([\n \"node_id\" => \"_all\",\n \"metric\" => \"jvm\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/_all/jvm\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.nodes().info(i -> i\n .metric(\"jvm\")\n .nodeId(\"_all\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_nodes/reload_secure_settings": {
+ "post": {
+ "tags": [
+ "cluster"
+ ],
+ "summary": "Reload the keystore on nodes in the cluster",
+ "description": "Secure settings are stored in an on-disk keystore. Certain of these settings are reloadable.\nThat is, you can change them on disk and reload them without restarting any nodes in the cluster.\nWhen you have updated reloadable secure settings in your keystore, you can use this API to reload those settings on each node.\n\nWhen the Elasticsearch keystore is password protected and not simply obfuscated, you must provide the password for the keystore when you reload the secure settings.\nReloading the settings for the whole cluster assumes that the keystores for all nodes are protected with the same password; this method is allowed only when inter-node communications are encrypted.\nAlternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password.",
+ "operationId": "nodes-reload-secure-settings",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Period to wait for a response.\nIf no response is received before the timeout expires, the request fails and returns an error.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "secure_settings_password": {
+ "description": "The password for the Elasticsearch keystore.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Password"
+ }
+ ]
+ }
+ }
+ },
+ "examples": {
+ "ReloadSecureSettingsRequestExample1": {
+ "description": "Run `POST _nodes/reload_secure_settings` to reload the keystore on nodes in the cluster.",
+ "value": "{\n \"secure_settings_password\": \"keystore-password\"\n}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/nodes.reload_secure_settings.ResponseBase"
+ },
+ "examples": {
+ "ReloadSecureSettingsResponseExample1": {
+ "description": "A successful response when reloading keystore on nodes in your cluster.",
+ "value": "{\n \"_nodes\": {\n \"total\": 1,\n \"successful\": 1,\n \"failed\": 0\n },\n \"cluster_name\": \"my_cluster\",\n \"nodes\": {\n \"pQHNt5rXTTWNvUgOrdynKg\": {\n \"name\": \"node-0\",\n \"secure_setting_names\": [\n \"keystore.seed\",\n \"xpack.security.transport.ssl.keystore.secure_password\",\n \"xpack.security.transport.ssl.truststore.secure_password\"\n ],\n \"keystore_path\": \"/etc/elasticsearch/elasticsearch.keystore\",\n \"keystore_digest\": \"031757c262a50abe1b7e017230cdbab99c1be9fbd7116ff504b27a8787158f46\",\n \"keystore_last_modified_time\": \"2025-12-09T22:06:00.408Z\"\n }\n }\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 6.5.0",
+ "x-variations": [
+ "\n POST\n /_nodes/reload_secure_settings\n
\n "
+ ],
+ "x-api": "reload_secure_settings.nodes",
+ "x-category": "unknown",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _nodes/reload_secure_settings\n{\n \"secure_settings_password\": \"keystore-password\"\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.nodes.reload_secure_settings(\n secure_settings_password=\"keystore-password\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.nodes.reloadSecureSettings({\n secure_settings_password: \"keystore-password\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.nodes.reload_secure_settings(\n body: {\n \"secure_settings_password\": \"keystore-password\"\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->nodes()->reloadSecureSettings([\n \"body\" => [\n \"secure_settings_password\" => \"keystore-password\",\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"secure_settings_password\":\"keystore-password\"}' \"$ELASTICSEARCH_URL/_nodes/reload_secure_settings\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.nodes().reloadSecureSettings(r -> r\n .secureSettingsPassword(\"keystore-password\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_nodes/{node_id}/reload_secure_settings": {
+ "post": {
+ "tags": [
+ "cluster"
+ ],
+ "summary": "Reload the keystore on nodes in the cluster",
+ "description": "Secure settings are stored in an on-disk keystore. Certain of these settings are reloadable.\nThat is, you can change them on disk and reload them without restarting any nodes in the cluster.\nWhen you have updated reloadable secure settings in your keystore, you can use this API to reload those settings on each node.\n\nWhen the Elasticsearch keystore is password protected and not simply obfuscated, you must provide the password for the keystore when you reload the secure settings.\nReloading the settings for the whole cluster assumes that the keystores for all nodes are protected with the same password; this method is allowed only when inter-node communications are encrypted.\nAlternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password.",
+ "operationId": "nodes-reload-secure-settings-1",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "node_id",
+ "description": "The names of particular nodes in the cluster to target.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.NodeIds"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Period to wait for a response.\nIf no response is received before the timeout expires, the request fails and returns an error.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "secure_settings_password": {
+ "description": "The password for the Elasticsearch keystore.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Password"
+ }
+ ]
+ }
+ }
+ },
+ "examples": {
+ "ReloadSecureSettingsRequestExample1": {
+ "description": "Run `POST _nodes/reload_secure_settings` to reload the keystore on nodes in the cluster.",
+ "value": "{\n \"secure_settings_password\": \"keystore-password\"\n}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/nodes.reload_secure_settings.ResponseBase"
+ },
+ "examples": {
+ "ReloadSecureSettingsResponseExample1": {
+ "description": "A successful response when reloading keystore on nodes in your cluster.",
+ "value": "{\n \"_nodes\": {\n \"total\": 1,\n \"successful\": 1,\n \"failed\": 0\n },\n \"cluster_name\": \"my_cluster\",\n \"nodes\": {\n \"pQHNt5rXTTWNvUgOrdynKg\": {\n \"name\": \"node-0\",\n \"secure_setting_names\": [\n \"keystore.seed\",\n \"xpack.security.transport.ssl.keystore.secure_password\",\n \"xpack.security.transport.ssl.truststore.secure_password\"\n ],\n \"keystore_path\": \"/etc/elasticsearch/elasticsearch.keystore\",\n \"keystore_digest\": \"031757c262a50abe1b7e017230cdbab99c1be9fbd7116ff504b27a8787158f46\",\n \"keystore_last_modified_time\": \"2025-12-09T22:06:00.408Z\"\n }\n }\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 6.5.0",
+ "x-variations": [
+ "\n POST\n /_nodes/{node_id}/reload_secure_settings\n
\n "
+ ],
+ "x-api": "reload_secure_settings.nodes",
+ "x-category": "unknown",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _nodes/reload_secure_settings\n{\n \"secure_settings_password\": \"keystore-password\"\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.nodes.reload_secure_settings(\n secure_settings_password=\"keystore-password\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.nodes.reloadSecureSettings({\n secure_settings_password: \"keystore-password\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.nodes.reload_secure_settings(\n body: {\n \"secure_settings_password\": \"keystore-password\"\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->nodes()->reloadSecureSettings([\n \"body\" => [\n \"secure_settings_password\" => \"keystore-password\",\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"secure_settings_password\":\"keystore-password\"}' \"$ELASTICSEARCH_URL/_nodes/reload_secure_settings\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.nodes().reloadSecureSettings(r -> r\n .secureSettingsPassword(\"keystore-password\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_nodes/stats": {
+ "get": {
+ "tags": [
+ "cluster"
+ ],
+ "summary": "Get node statistics",
+ "description": "Get statistics for nodes in a cluster.\nBy default, all stats are returned. You can limit the returned information by using metrics.",
+ "operationId": "nodes-stats",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "completion_fields",
+ "description": "Comma-separated list or wildcard expressions of fields to include in fielddata and suggest statistics.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "fielddata_fields",
+ "description": "Comma-separated list or wildcard expressions of fields to include in fielddata statistics.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "fields",
+ "description": "Comma-separated list or wildcard expressions of fields to include in the statistics.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "groups",
+ "description": "Comma-separated list of search groups to include in the search statistics.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "include_segment_file_sizes",
+ "description": "If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested).",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "level",
+ "description": "Indicates whether statistics are aggregated at the node, indices, or shards level.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.NodeStatsLevel"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "types",
+ "description": "A comma-separated list of document types for the indexing index metric.",
+ "deprecated": false,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "include_unloaded_segments",
+ "description": "If `true`, the response includes information from segments that are not loaded into memory.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/nodes.stats.ResponseBase"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available",
+ "x-variations": [
+ "\n GET\n /_nodes/stats\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor`,`manage`\n"
+ ],
+ "x-api": "stats.nodes",
+ "x-category": "unknown",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _nodes/stats/process?filter_path=**.max_file_descriptors\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.nodes.stats(\n metric=\"process\",\n filter_path=\"**.max_file_descriptors\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.nodes.stats({\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.nodes.stats(\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->nodes()->stats([\n \"metric\" => \"process\",\n \"filter_path\" => \"**.max_file_descriptors\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/stats/process?filter_path=**.max_file_descriptors\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.nodes().stats(s -> s\n .metric(\"process\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_nodes/{node_id}/stats": {
+ "get": {
+ "tags": [
+ "cluster"
+ ],
+ "summary": "Get node statistics",
+ "description": "Get statistics for nodes in a cluster.\nBy default, all stats are returned. You can limit the returned information by using metrics.",
+ "operationId": "nodes-stats-1",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "node_id",
+ "description": "Comma-separated list of node IDs or names used to limit returned information.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.NodeIds"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "completion_fields",
+ "description": "Comma-separated list or wildcard expressions of fields to include in fielddata and suggest statistics.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "fielddata_fields",
+ "description": "Comma-separated list or wildcard expressions of fields to include in fielddata statistics.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "fields",
+ "description": "Comma-separated list or wildcard expressions of fields to include in the statistics.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "groups",
+ "description": "Comma-separated list of search groups to include in the search statistics.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "include_segment_file_sizes",
+ "description": "If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested).",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "level",
+ "description": "Indicates whether statistics are aggregated at the node, indices, or shards level.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.NodeStatsLevel"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "types",
+ "description": "A comma-separated list of document types for the indexing index metric.",
+ "deprecated": false,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "include_unloaded_segments",
+ "description": "If `true`, the response includes information from segments that are not loaded into memory.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/nodes.stats.ResponseBase"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available",
+ "x-variations": [
+ "\n GET\n /_nodes/{node_id}/stats\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor`,`manage`\n"
+ ],
+ "x-api": "stats.nodes",
+ "x-category": "unknown",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _nodes/stats/process?filter_path=**.max_file_descriptors\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.nodes.stats(\n metric=\"process\",\n filter_path=\"**.max_file_descriptors\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.nodes.stats({\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.nodes.stats(\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->nodes()->stats([\n \"metric\" => \"process\",\n \"filter_path\" => \"**.max_file_descriptors\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/stats/process?filter_path=**.max_file_descriptors\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.nodes().stats(s -> s\n .metric(\"process\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_nodes/stats/{metric}": {
+ "get": {
+ "tags": [
+ "cluster"
+ ],
+ "summary": "Get node statistics",
+ "description": "Get statistics for nodes in a cluster.\nBy default, all stats are returned. You can limit the returned information by using metrics.",
+ "operationId": "nodes-stats-2",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "metric",
+ "description": "Limits the information returned to the specific metrics.\n\nSupported values include: `_all`, `_none`, `indices`, `os`, `process`, `jvm`, `thread_pool`, `fs`, `transport`, `http`, `breaker`, `script`, `discovery`, `ingest`, `adaptive_selection`, `script_cache`, `indexing_pressure`, `repositories`, `allocations`\n\n",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/nodes.stats.NodeStatsMetrics"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "completion_fields",
+ "description": "Comma-separated list or wildcard expressions of fields to include in fielddata and suggest statistics.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "fielddata_fields",
+ "description": "Comma-separated list or wildcard expressions of fields to include in fielddata statistics.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "fields",
+ "description": "Comma-separated list or wildcard expressions of fields to include in the statistics.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "groups",
+ "description": "Comma-separated list of search groups to include in the search statistics.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "include_segment_file_sizes",
+ "description": "If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested).",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "level",
+ "description": "Indicates whether statistics are aggregated at the node, indices, or shards level.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.NodeStatsLevel"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "types",
+ "description": "A comma-separated list of document types for the indexing index metric.",
+ "deprecated": false,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "include_unloaded_segments",
+ "description": "If `true`, the response includes information from segments that are not loaded into memory.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/nodes.stats.ResponseBase"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available",
+ "x-variations": [
+ "\n GET\n /_nodes/stats/{metric}\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor`,`manage`\n"
+ ],
+ "x-api": "stats.nodes",
+ "x-category": "unknown",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _nodes/stats/process?filter_path=**.max_file_descriptors\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.nodes.stats(\n metric=\"process\",\n filter_path=\"**.max_file_descriptors\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.nodes.stats({\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.nodes.stats(\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->nodes()->stats([\n \"metric\" => \"process\",\n \"filter_path\" => \"**.max_file_descriptors\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/stats/process?filter_path=**.max_file_descriptors\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.nodes().stats(s -> s\n .metric(\"process\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_nodes/{node_id}/stats/{metric}": {
+ "get": {
+ "tags": [
+ "cluster"
+ ],
+ "summary": "Get node statistics",
+ "description": "Get statistics for nodes in a cluster.\nBy default, all stats are returned. You can limit the returned information by using metrics.",
+ "operationId": "nodes-stats-3",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "node_id",
+ "description": "Comma-separated list of node IDs or names used to limit returned information.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.NodeIds"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "path",
+ "name": "metric",
+ "description": "Limits the information returned to the specific metrics.\n\nSupported values include: `_all`, `_none`, `indices`, `os`, `process`, `jvm`, `thread_pool`, `fs`, `transport`, `http`, `breaker`, `script`, `discovery`, `ingest`, `adaptive_selection`, `script_cache`, `indexing_pressure`, `repositories`, `allocations`\n\n",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/nodes.stats.NodeStatsMetrics"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "completion_fields",
+ "description": "Comma-separated list or wildcard expressions of fields to include in fielddata and suggest statistics.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "fielddata_fields",
+ "description": "Comma-separated list or wildcard expressions of fields to include in fielddata statistics.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "fields",
+ "description": "Comma-separated list or wildcard expressions of fields to include in the statistics.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "groups",
+ "description": "Comma-separated list of search groups to include in the search statistics.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "include_segment_file_sizes",
+ "description": "If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested).",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "level",
+ "description": "Indicates whether statistics are aggregated at the node, indices, or shards level.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.NodeStatsLevel"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "types",
+ "description": "A comma-separated list of document types for the indexing index metric.",
+ "deprecated": false,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "include_unloaded_segments",
+ "description": "If `true`, the response includes information from segments that are not loaded into memory.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/nodes.stats.ResponseBase"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available",
+ "x-variations": [
+ "\n GET\n /_nodes/{node_id}/stats/{metric}\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor`,`manage`\n"
+ ],
+ "x-api": "stats.nodes",
+ "x-category": "unknown",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _nodes/stats/process?filter_path=**.max_file_descriptors\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.nodes.stats(\n metric=\"process\",\n filter_path=\"**.max_file_descriptors\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.nodes.stats({\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.nodes.stats(\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->nodes()->stats([\n \"metric\" => \"process\",\n \"filter_path\" => \"**.max_file_descriptors\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/stats/process?filter_path=**.max_file_descriptors\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.nodes().stats(s -> s\n .metric(\"process\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_nodes/stats/{metric}/{index_metric}": {
+ "get": {
+ "tags": [
+ "cluster"
+ ],
+ "summary": "Get node statistics",
+ "description": "Get statistics for nodes in a cluster.\nBy default, all stats are returned. You can limit the returned information by using metrics.",
+ "operationId": "nodes-stats-4",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "metric",
+ "description": "Limits the information returned to the specific metrics.\n\nSupported values include: `_all`, `_none`, `indices`, `os`, `process`, `jvm`, `thread_pool`, `fs`, `transport`, `http`, `breaker`, `script`, `discovery`, `ingest`, `adaptive_selection`, `script_cache`, `indexing_pressure`, `repositories`, `allocations`\n\n",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/nodes.stats.NodeStatsMetrics"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "path",
+ "name": "index_metric",
+ "description": "Limit the information returned for indices metric to the specific index metrics. It can be used only if indices (or all) metric is specified.\n\nSupported values include: `_all`, `store`, `indexing`, `get`, `search`, `merge`, `flush`, `refresh`, `query_cache`, `fielddata`, `docs`, `warmer`, `completion`, `segments`, `translog`, `request_cache`, `recovery`, `bulk`, `shard_stats`, `mappings`, `dense_vector`, `sparse_vector`\n\n",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.CommonStatsFlags"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "completion_fields",
+ "description": "Comma-separated list or wildcard expressions of fields to include in fielddata and suggest statistics.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "fielddata_fields",
+ "description": "Comma-separated list or wildcard expressions of fields to include in fielddata statistics.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "fields",
+ "description": "Comma-separated list or wildcard expressions of fields to include in the statistics.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "groups",
+ "description": "Comma-separated list of search groups to include in the search statistics.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "include_segment_file_sizes",
+ "description": "If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested).",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "level",
+ "description": "Indicates whether statistics are aggregated at the node, indices, or shards level.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.NodeStatsLevel"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "types",
+ "description": "A comma-separated list of document types for the indexing index metric.",
+ "deprecated": false,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "include_unloaded_segments",
+ "description": "If `true`, the response includes information from segments that are not loaded into memory.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/nodes.stats.ResponseBase"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available",
+ "x-variations": [
+ "\n GET\n /_nodes/stats/{metric}/{index_metric}\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor`,`manage`\n"
+ ],
+ "x-api": "stats.nodes",
+ "x-category": "unknown",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _nodes/stats/process?filter_path=**.max_file_descriptors\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.nodes.stats(\n metric=\"process\",\n filter_path=\"**.max_file_descriptors\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.nodes.stats({\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.nodes.stats(\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->nodes()->stats([\n \"metric\" => \"process\",\n \"filter_path\" => \"**.max_file_descriptors\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/stats/process?filter_path=**.max_file_descriptors\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.nodes().stats(s -> s\n .metric(\"process\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_nodes/{node_id}/stats/{metric}/{index_metric}": {
+ "get": {
+ "tags": [
+ "cluster"
+ ],
+ "summary": "Get node statistics",
+ "description": "Get statistics for nodes in a cluster.\nBy default, all stats are returned. You can limit the returned information by using metrics.",
+ "operationId": "nodes-stats-5",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "node_id",
+ "description": "Comma-separated list of node IDs or names used to limit returned information.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.NodeIds"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "path",
+ "name": "metric",
+ "description": "Limits the information returned to the specific metrics.\n\nSupported values include: `_all`, `_none`, `indices`, `os`, `process`, `jvm`, `thread_pool`, `fs`, `transport`, `http`, `breaker`, `script`, `discovery`, `ingest`, `adaptive_selection`, `script_cache`, `indexing_pressure`, `repositories`, `allocations`\n\n",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/nodes.stats.NodeStatsMetrics"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "path",
+ "name": "index_metric",
+ "description": "Limit the information returned for indices metric to the specific index metrics. It can be used only if indices (or all) metric is specified.\n\nSupported values include: `_all`, `store`, `indexing`, `get`, `search`, `merge`, `flush`, `refresh`, `query_cache`, `fielddata`, `docs`, `warmer`, `completion`, `segments`, `translog`, `request_cache`, `recovery`, `bulk`, `shard_stats`, `mappings`, `dense_vector`, `sparse_vector`\n\n",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.CommonStatsFlags"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "completion_fields",
+ "description": "Comma-separated list or wildcard expressions of fields to include in fielddata and suggest statistics.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "fielddata_fields",
+ "description": "Comma-separated list or wildcard expressions of fields to include in fielddata statistics.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "fields",
+ "description": "Comma-separated list or wildcard expressions of fields to include in the statistics.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "groups",
+ "description": "Comma-separated list of search groups to include in the search statistics.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "include_segment_file_sizes",
+ "description": "If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested).",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "level",
+ "description": "Indicates whether statistics are aggregated at the node, indices, or shards level.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.NodeStatsLevel"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "types",
+ "description": "A comma-separated list of document types for the indexing index metric.",
+ "deprecated": false,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "include_unloaded_segments",
+ "description": "If `true`, the response includes information from segments that are not loaded into memory.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/nodes.stats.ResponseBase"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available",
+ "x-variations": [
+ "\n GET\n /_nodes/{node_id}/stats/{metric}/{index_metric}\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor`,`manage`\n"
+ ],
+ "x-api": "stats.nodes",
+ "x-category": "unknown",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _nodes/stats/process?filter_path=**.max_file_descriptors\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.nodes.stats(\n metric=\"process\",\n filter_path=\"**.max_file_descriptors\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.nodes.stats({\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.nodes.stats(\n metric: \"process\",\n filter_path: \"**.max_file_descriptors\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->nodes()->stats([\n \"metric\" => \"process\",\n \"filter_path\" => \"**.max_file_descriptors\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/stats/process?filter_path=**.max_file_descriptors\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.nodes().stats(s -> s\n .metric(\"process\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_nodes/usage": {
+ "get": {
+ "tags": [
+ "cluster"
+ ],
+ "summary": "Get feature usage information",
+ "operationId": "nodes-usage",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Period to wait for a response.\nIf no response is received before the timeout expires, the request fails and returns an error.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/nodes.usage.ResponseBase"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 6.0.0",
+ "x-variations": [
+ "\n GET\n /_nodes/usage\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor`,`manage`\n"
+ ],
+ "x-api": "usage.nodes",
+ "x-category": "unknown",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _nodes/usage\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.nodes.usage()"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.nodes.usage();"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.nodes.usage"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->nodes()->usage();"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/usage\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.nodes().usage(u -> u);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_nodes/{node_id}/usage": {
+ "get": {
+ "tags": [
+ "cluster"
+ ],
+ "summary": "Get feature usage information",
+ "operationId": "nodes-usage-1",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "node_id",
+ "description": "A comma-separated list of node IDs or names to limit the returned information.\nUse `_local` to return information from the node you're connecting to, leave empty to get information from all nodes.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.NodeIds"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Period to wait for a response.\nIf no response is received before the timeout expires, the request fails and returns an error.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/nodes.usage.ResponseBase"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 6.0.0",
+ "x-variations": [
+ "\n GET\n /_nodes/{node_id}/usage\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor`,`manage`\n"
+ ],
+ "x-api": "usage.nodes",
+ "x-category": "unknown",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _nodes/usage\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.nodes.usage()"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.nodes.usage();"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.nodes.usage"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->nodes()->usage();"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/usage\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.nodes().usage(u -> u);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_nodes/usage/{metric}": {
+ "get": {
+ "tags": [
+ "cluster"
+ ],
+ "summary": "Get feature usage information",
+ "operationId": "nodes-usage-2",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "metric",
+ "description": "Limits the information returned to the specific metrics.\nA comma-separated list of the following options: `_all`, `rest_actions`, `aggregations`.\n\nSupported values include: `_all`, `rest_actions`, `aggregations`\n\n",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/nodes.usage.NodesUsageMetrics"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Period to wait for a response.\nIf no response is received before the timeout expires, the request fails and returns an error.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/nodes.usage.ResponseBase"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 6.0.0",
+ "x-variations": [
+ "\n GET\n /_nodes/usage/{metric}\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor`,`manage`\n"
+ ],
+ "x-api": "usage.nodes",
+ "x-category": "unknown",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _nodes/usage\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.nodes.usage()"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.nodes.usage();"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.nodes.usage"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->nodes()->usage();"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/usage\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.nodes().usage(u -> u);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_nodes/{node_id}/usage/{metric}": {
+ "get": {
+ "tags": [
+ "cluster"
+ ],
+ "summary": "Get feature usage information",
+ "operationId": "nodes-usage-3",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "node_id",
+ "description": "A comma-separated list of node IDs or names to limit the returned information.\nUse `_local` to return information from the node you're connecting to, leave empty to get information from all nodes.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.NodeIds"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "path",
+ "name": "metric",
+ "description": "Limits the information returned to the specific metrics.\nA comma-separated list of the following options: `_all`, `rest_actions`, `aggregations`.\n\nSupported values include: `_all`, `rest_actions`, `aggregations`\n\n",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/nodes.usage.NodesUsageMetrics"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "Period to wait for a response.\nIf no response is received before the timeout expires, the request fails and returns an error.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/nodes.usage.ResponseBase"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 6.0.0",
+ "x-variations": [
+ "\n GET\n /_nodes/{node_id}/usage/{metric}\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor`,`manage`\n"
+ ],
+ "x-api": "usage.nodes",
+ "x-category": "unknown",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _nodes/usage\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.nodes.usage()"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.nodes.usage();"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.nodes.usage"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->nodes()->usage();"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_nodes/usage\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.nodes().usage(u -> u);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/{index}/_pit": {
+ "post": {
+ "tags": [
+ "search"
+ ],
+ "summary": "Open a point in time",
+ "description": "A search request by default runs against the most recent visible data of the target indices,\nwhich is called point in time. Elasticsearch pit (point in time) is a lightweight view into the\nstate of the data as it existed when initiated. In some cases, it’s preferred to perform multiple\nsearch requests using the same point in time. For example, if refreshes happen between\n`search_after` requests, then the results of those requests might not be consistent as changes happening\nbetween searches are only visible to the more recent point in time.\n\nA point in time must be opened explicitly before being used in search requests.\n\nA subsequent search request with the `pit` parameter must not specify `index`, `routing`, or `preference` values as these parameters are copied from the point in time.\n\nJust like regular searches, you can use `from` and `size` to page through point in time search results, up to the first 10,000 hits.\nIf you want to retrieve more hits, use PIT with `search_after`.\n\nIMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request.\n\nWhen a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a `NoShardAvailableActionException` exception.\nTo get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime.\n\n**Keeping point in time alive**\n\nThe `keep_alive` parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time.\nThe value does not need to be long enough to process all data — it just needs to be long enough for the next request.\n\nNormally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments.\nOnce the smaller segments are no longer needed they are deleted.\nHowever, open point-in-times prevent the old segments from being deleted since they are still in use.\n\nTIP: Keeping older segments alive means that more disk space and file handles are needed.\nEnsure that you have configured your nodes to have ample free file handles.\n\nAdditionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request.\nEnsure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates.\nNote that a point-in-time doesn't prevent its associated indices from being deleted.\nYou can check how many point-in-times (that is, search contexts) are open with the nodes stats API.",
+ "operationId": "open-point-in-time",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "index",
+ "description": "A comma-separated list of index names to open point in time; use `_all` or empty string to perform the operation on all indices",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Indices"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "keep_alive",
+ "description": "Extend the length of time that the point in time persists.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ignore_unavailable",
+ "description": "If `false`, the request returns an error if it targets a missing or closed index.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "preference",
+ "description": "The node or shard the operation should be performed on.\nBy default, it is random.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "routing",
+ "description": "A custom value that is used to route operations to a specific shard.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Routing"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "expand_wildcards",
+ "description": "The type of index that wildcard patterns can match.\nIf the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.\nIt supports comma-separated values, such as `open,hidden`.\n\nSupported values include:\n - `all`: Match any data stream or index, including hidden ones.\n - `open`: Match open, non-hidden indices. Also matches any non-hidden data stream.\n - `closed`: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.\n - `hidden`: Match hidden data streams and hidden indices. Must be combined with `open`, `closed`, or `both`.\n - `none`: Wildcard expressions are not accepted.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.ExpandWildcards"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "allow_partial_search_results",
+ "description": "Indicates whether the point in time tolerates unavailable shards or shard failures when initially creating the PIT.\nIf `false`, creating a point in time request when a shard is missing or unavailable will throw an exception.\nIf `true`, the point in time will contain all the shards that are available at the time of the request.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "max_concurrent_shard_requests",
+ "description": "Maximum number of concurrent shard requests that each sub-search request executes per node.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "index_filter": {
+ "description": "Filter indices if the provided query rewrites to `match_none` on every shard.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.query_dsl.QueryContainer"
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "_shards": {
+ "description": "Shards used to create the PIT",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.ShardStatistics"
+ }
+ ]
+ },
+ "id": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Id"
+ }
+ ]
+ }
+ },
+ "required": [
+ "_shards",
+ "id"
+ ]
+ },
+ "examples": {
+ "OpenPointInTimeResponseExample1": {
+ "description": "A successful response from `POST /my-index-000001/_pit?keep_alive=1m&allow_partial_search_results=true`. It includes a summary of the total number of shards, as well as the number of successful shards when creating the PIT.\n",
+ "value": "{\n \"id\": \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA=\",\n \"_shards\": {\n \"total\": 10,\n \"successful\": 10,\n \"skipped\": 0,\n \"failed\": 0\n }\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 7.10.0",
+ "x-variations": [
+ "\n POST\n /{index}/_pit\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "open_point_in_time",
+ "x-category": "search",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST /my-index-000001/_pit?keep_alive=1m&allow_partial_search_results=true\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.open_point_in_time(\n index=\"my-index-000001\",\n keep_alive=\"1m\",\n allow_partial_search_results=True,\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.openPointInTime({\n index: \"my-index-000001\",\n keep_alive: \"1m\",\n allow_partial_search_results: \"true\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.open_point_in_time(\n index: \"my-index-000001\",\n keep_alive: \"1m\",\n allow_partial_search_results: \"true\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->openPointInTime([\n \"index\" => \"my-index-000001\",\n \"keep_alive\" => \"1m\",\n \"allow_partial_search_results\" => \"true\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_pit?keep_alive=1m&allow_partial_search_results=true\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.openPointInTime(o -> o\n .allowPartialSearchResults(true)\n .index(\"my-index-000001\")\n .keepAlive(k -> k\n .offset(1)\n )\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_scripts/{id}/{context}": {
+ "put": {
+ "tags": [
+ "script"
+ ],
+ "summary": "Create or update a script or search template",
+ "description": "Creates or updates a stored script or search template.",
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/solutions/search/search-templates",
+ "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/create-stored-script-api.html"
+ },
+ "operationId": "put-script-2",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "id",
+ "description": "The identifier for the stored script or search template.\nIt must be unique within the cluster.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "path",
+ "name": "context",
+ "description": "The context in which the script or search template should run.\nTo prevent errors, the API immediately compiles the script or template in this context.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Name"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "context",
+ "description": "The context in which the script or search template should run.\nTo prevent errors, the API immediately compiles the script or template in this context.\nIf you specify both this and the `` path parameter, the API uses the request path parameter.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Name"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "master_timeout",
+ "description": "The period to wait for a connection to the master node.\nIf no response is received before the timeout expires, the request fails and returns an error.\nIt can also be set to `-1` to indicate that the request should never timeout.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "The period to wait for a response.\nIf no response is received before the timeout expires, the request fails and returns an error.\nIt can also be set to `-1` to indicate that the request should never timeout.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "script": {
+ "description": "The script or search template, its parameters, and its language.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.StoredScript"
+ }
+ ]
+ }
+ },
+ "required": [
+ "script"
+ ]
+ },
+ "examples": {
+ "PutScriptRequestExample1": {
+ "summary": "Create a search template",
+ "description": "Run `PUT _scripts/my-search-template` to create a search template.\n",
+ "value": "{\n \"script\": {\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n }\n}"
+ },
+ "PutScriptRequestExample2": {
+ "summary": "Create a stored script",
+ "description": "Run `PUT _scripts/my-stored-script` to create a stored script.\n",
+ "value": "{\n \"script\": {\n \"lang\": \"painless\",\n \"source\": \"Math.log(_score * 2) + params['my_modifier']\"\n }\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_types.AcknowledgedResponseBase"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available",
+ "x-variations": [
+ "\n PUT\n /_scripts/{id}/{context}\n
\n ",
+ "\n POST\n /_scripts/{id}/{context}\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage`\n"
+ ],
+ "x-api": "put_script",
+ "x-category": "search",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "PUT _scripts/my-search-template\n{\n \"script\": {\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.put_script(\n id=\"my-search-template\",\n script={\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.putScript({\n id: \"my-search-template\",\n script: {\n lang: \"mustache\",\n source: {\n query: {\n match: {\n message: \"{{query_string}}\",\n },\n },\n from: \"{{from}}\",\n size: \"{{size}}\",\n },\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.put_script(\n id: \"my-search-template\",\n body: {\n \"script\": {\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->putScript([\n \"id\" => \"my-search-template\",\n \"body\" => [\n \"script\" => [\n \"lang\" => \"mustache\",\n \"source\" => [\n \"query\" => [\n \"match\" => [\n \"message\" => \"{{query_string}}\",\n ],\n ],\n \"from\" => \"{{from}}\",\n \"size\" => \"{{size}}\",\n ],\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"lang\":\"mustache\",\"source\":{\"query\":{\"match\":{\"message\":\"{{query_string}}\"}},\"from\":\"{{from}}\",\"size\":\"{{size}}\"}}}' \"$ELASTICSEARCH_URL/_scripts/my-search-template\""
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "post": {
+ "tags": [
+ "script"
+ ],
+ "summary": "Create or update a script or search template",
+ "description": "Creates or updates a stored script or search template.",
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/solutions/search/search-templates",
+ "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/create-stored-script-api.html"
+ },
+ "operationId": "put-script-3",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "id",
+ "description": "The identifier for the stored script or search template.\nIt must be unique within the cluster.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "path",
+ "name": "context",
+ "description": "The context in which the script or search template should run.\nTo prevent errors, the API immediately compiles the script or template in this context.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Name"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "context",
+ "description": "The context in which the script or search template should run.\nTo prevent errors, the API immediately compiles the script or template in this context.\nIf you specify both this and the `` path parameter, the API uses the request path parameter.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Name"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "master_timeout",
+ "description": "The period to wait for a connection to the master node.\nIf no response is received before the timeout expires, the request fails and returns an error.\nIt can also be set to `-1` to indicate that the request should never timeout.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "The period to wait for a response.\nIf no response is received before the timeout expires, the request fails and returns an error.\nIt can also be set to `-1` to indicate that the request should never timeout.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "script": {
+ "description": "The script or search template, its parameters, and its language.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.StoredScript"
+ }
+ ]
+ }
+ },
+ "required": [
+ "script"
+ ]
+ },
+ "examples": {
+ "PutScriptRequestExample1": {
+ "summary": "Create a search template",
+ "description": "Run `PUT _scripts/my-search-template` to create a search template.\n",
+ "value": "{\n \"script\": {\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n }\n}"
+ },
+ "PutScriptRequestExample2": {
+ "summary": "Create a stored script",
+ "description": "Run `PUT _scripts/my-stored-script` to create a stored script.\n",
+ "value": "{\n \"script\": {\n \"lang\": \"painless\",\n \"source\": \"Math.log(_score * 2) + params['my_modifier']\"\n }\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_types.AcknowledgedResponseBase"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available",
+ "x-variations": [
+ "\n PUT\n /_scripts/{id}/{context}\n
\n ",
+ "\n POST\n /_scripts/{id}/{context}\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage`\n"
+ ],
+ "x-api": "put_script",
+ "x-category": "search",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "PUT _scripts/my-search-template\n{\n \"script\": {\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.put_script(\n id=\"my-search-template\",\n script={\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.putScript({\n id: \"my-search-template\",\n script: {\n lang: \"mustache\",\n source: {\n query: {\n match: {\n message: \"{{query_string}}\",\n },\n },\n from: \"{{from}}\",\n size: \"{{size}}\",\n },\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.put_script(\n id: \"my-search-template\",\n body: {\n \"script\": {\n \"lang\": \"mustache\",\n \"source\": {\n \"query\": {\n \"match\": {\n \"message\": \"{{query_string}}\"\n }\n },\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->putScript([\n \"id\" => \"my-search-template\",\n \"body\" => [\n \"script\" => [\n \"lang\" => \"mustache\",\n \"source\" => [\n \"query\" => [\n \"match\" => [\n \"message\" => \"{{query_string}}\",\n ],\n ],\n \"from\" => \"{{from}}\",\n \"size\" => \"{{size}}\",\n ],\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"lang\":\"mustache\",\"source\":{\"query\":{\"match\":{\"message\":\"{{query_string}}\"}},\"from\":\"{{from}}\",\"size\":\"{{size}}\"}}}' \"$ELASTICSEARCH_URL/_scripts/my-search-template\""
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_query_rules/{ruleset_id}/_rule/{rule_id}": {
+ "get": {
+ "tags": [
+ "query_rules"
+ ],
+ "summary": "Get a query rule",
+ "description": "Get details about a query rule within a query ruleset.",
+ "externalDocs": {
+ "description": "See rules and rulesets in Query Rules UI",
+ "url": "https://www.elastic.co/docs/solutions/search/query-rules-ui#accessing-the-query-rules-ui",
+ "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/get-query-rule.html"
+ },
+ "operationId": "query-rules-get-rule",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "ruleset_id",
+ "description": "The unique identifier of the query ruleset containing the rule to retrieve",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "path",
+ "name": "rule_id",
+ "description": "The unique identifier of the query rule within the specified ruleset to retrieve",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/query_rules._types.QueryRule"
+ },
+ "examples": {
+ "QueryRuleGetResponseExample1": {
+ "description": "A successful response from `GET _query_rules/my-ruleset/_rule/my-rule1`.",
+ "value": "{\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"query_string\",\n \"values\": [\n \"pugs\",\n \"puggles\"\n ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 8.15.0",
+ "x-variations": [
+ "\n GET\n /_query_rules/{ruleset_id}/_rule/{rule_id}\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_search_query_rules`\n"
+ ],
+ "x-api": "get_rule.query_rules",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _query_rules/my-ruleset/_rule/my-rule1\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.query_rules.get_rule(\n ruleset_id=\"my-ruleset\",\n rule_id=\"my-rule1\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.queryRules.getRule({\n ruleset_id: \"my-ruleset\",\n rule_id: \"my-rule1\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.query_rules.get_rule(\n ruleset_id: \"my-ruleset\",\n rule_id: \"my-rule1\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->queryRules()->getRule([\n \"ruleset_id\" => \"my-ruleset\",\n \"rule_id\" => \"my-rule1\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/my-ruleset/_rule/my-rule1\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.queryRules().getRule(g -> g\n .ruleId(\"my-rule1\")\n .rulesetId(\"my-ruleset\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "put": {
+ "tags": [
+ "query_rules"
+ ],
+ "summary": "Create or update a query rule",
+ "description": "Create or update a query rule within a query ruleset.\n\nIMPORTANT: Due to limitations within pinned queries, you can only pin documents using ids or docs, but cannot use both in single rule.\nIt is advised to use one or the other in query rulesets, to avoid errors.\nAdditionally, pinned queries have a maximum limit of 100 pinned hits.\nIf multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset.",
+ "externalDocs": {
+ "description": "Edit rules and rulesets from the Query Rules UI",
+ "url": "https://www.elastic.co/docs/solutions/search/query-rules-ui#edit-a-rule",
+ "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/put-query-rule.html"
+ },
+ "operationId": "query-rules-put-rule",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "ruleset_id",
+ "description": "The unique identifier of the query ruleset containing the rule to be created or updated.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "path",
+ "name": "rule_id",
+ "description": "The unique identifier of the query rule within the specified ruleset to be created or updated.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "type": {
+ "description": "The type of rule.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/query_rules._types.QueryRuleType"
+ }
+ ]
+ },
+ "criteria": {
+ "description": "The criteria that must be met for the rule to be applied.\nIf multiple criteria are specified for a rule, all criteria must be met for the rule to be applied.",
+ "oneOf": [
+ {
+ "$ref": "#/components/schemas/query_rules._types.QueryRuleCriteria"
+ },
+ {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/query_rules._types.QueryRuleCriteria"
+ }
+ }
+ ]
+ },
+ "actions": {
+ "description": "The actions to take when the rule is matched.\nThe format of this action depends on the rule type.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/query_rules._types.QueryRuleActions"
+ }
+ ]
+ },
+ "priority": {
+ "type": "number"
+ }
+ },
+ "required": [
+ "type",
+ "criteria",
+ "actions"
+ ]
+ },
+ "examples": {
+ "QueryRulePutRequestExample1": {
+ "description": "Run `POST _query_rules/my-ruleset/_test` to test a ruleset. Provide the match criteria that you want to test against.\n",
+ "value": "{\n \"match_criteria\": {\n \"query_string\": \"puggles\"\n }\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "result": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Result"
+ }
+ ]
+ }
+ },
+ "required": [
+ "result"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 8.15.0",
+ "x-variations": [
+ "\n PUT\n /_query_rules/{ruleset_id}/_rule/{rule_id}\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_search_query_rules`\n"
+ ],
+ "x-api": "put_rule.query_rules",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _query_rules/my-ruleset/_test\n{\n \"match_criteria\": {\n \"query_string\": \"puggles\"\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.query_rules.test(\n ruleset_id=\"my-ruleset\",\n match_criteria={\n \"query_string\": \"puggles\"\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.queryRules.test({\n ruleset_id: \"my-ruleset\",\n match_criteria: {\n query_string: \"puggles\",\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.query_rules.test(\n ruleset_id: \"my-ruleset\",\n body: {\n \"match_criteria\": {\n \"query_string\": \"puggles\"\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->queryRules()->test([\n \"ruleset_id\" => \"my-ruleset\",\n \"body\" => [\n \"match_criteria\" => [\n \"query_string\" => \"puggles\",\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"match_criteria\":{\"query_string\":\"puggles\"}}' \"$ELASTICSEARCH_URL/_query_rules/my-ruleset/_test\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.queryRules().test(t -> t\n .matchCriteria(\"query_string\", JsonData.fromJson(\"\\\"puggles\\\"\"))\n .rulesetId(\"my-ruleset\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "delete": {
+ "tags": [
+ "query_rules"
+ ],
+ "summary": "Delete a query rule",
+ "description": "Delete a query rule within a query ruleset.\nThis is a destructive action that is only recoverable by re-adding the same rule with the create or update query rule API.",
+ "externalDocs": {
+ "description": "Delete a rule from the Query Rules UI",
+ "url": "https://www.elastic.co/docs/solutions/search/query-rules-ui#delete-a-rule",
+ "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/delete-query-rule.html"
+ },
+ "operationId": "query-rules-delete-rule",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "ruleset_id",
+ "description": "The unique identifier of the query ruleset containing the rule to delete",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "path",
+ "name": "rule_id",
+ "description": "The unique identifier of the query rule within the specified ruleset to delete",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_types.AcknowledgedResponseBase"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 8.15.0",
+ "x-variations": [
+ "\n DELETE\n /_query_rules/{ruleset_id}/_rule/{rule_id}\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_search_query_rules`\n"
+ ],
+ "x-api": "delete_rule.query_rules",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "DELETE _query_rules/my-ruleset/_rule/my-rule1\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.query_rules.delete_rule(\n ruleset_id=\"my-ruleset\",\n rule_id=\"my-rule1\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.queryRules.deleteRule({\n ruleset_id: \"my-ruleset\",\n rule_id: \"my-rule1\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.query_rules.delete_rule(\n ruleset_id: \"my-ruleset\",\n rule_id: \"my-rule1\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->queryRules()->deleteRule([\n \"ruleset_id\" => \"my-ruleset\",\n \"rule_id\" => \"my-rule1\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/my-ruleset/_rule/my-rule1\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.queryRules().deleteRule(d -> d\n .ruleId(\"my-rule1\")\n .rulesetId(\"my-ruleset\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_query_rules/{ruleset_id}": {
+ "get": {
+ "tags": [
+ "query_rules"
+ ],
+ "summary": "Get a query ruleset",
+ "description": "Get details about a query ruleset.",
+ "externalDocs": {
+ "description": "See rules and rulesets in Query Rules UI",
+ "url": "https://www.elastic.co/docs/solutions/search/query-rules-ui#accessing-the-query-rules-ui",
+ "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/get-query-ruleset.html"
+ },
+ "operationId": "query-rules-get-ruleset",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "ruleset_id",
+ "description": "The unique identifier of the query ruleset",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/query_rules._types.QueryRuleset"
+ },
+ "examples": {
+ "QueryRulesetGetResponseExample1": {
+ "description": "A successful response from `GET _query_rules/my-ruleset/`.",
+ "value": "{\n \"ruleset_id\": \"my-ruleset\",\n \"rules\": [\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"query_string\",\n \"values\": [ \"pugs\", \"puggles\" ]\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\": \"query_string\",\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}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 8.10.0",
+ "x-variations": [
+ "\n GET\n /_query_rules/{ruleset_id}\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_search_query_rules`\n"
+ ],
+ "x-api": "get_ruleset.query_rules",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _query_rules/my-ruleset/\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.query_rules.get_ruleset(\n ruleset_id=\"my-ruleset\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.queryRules.getRuleset({\n ruleset_id: \"my-ruleset\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.query_rules.get_ruleset(\n ruleset_id: \"my-ruleset\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->queryRules()->getRuleset([\n \"ruleset_id\" => \"my-ruleset\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/my-ruleset/\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.queryRules().getRuleset(g -> g\n .rulesetId(\"my-ruleset\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "put": {
+ "tags": [
+ "query_rules"
+ ],
+ "summary": "Create or update a query ruleset",
+ "description": "There is a limit of 100 rules per ruleset.\nThis limit can be increased by using the `xpack.applications.rules.max_rules_per_ruleset` cluster setting.\n\nIMPORTANT: Due to limitations within pinned queries, you can only select documents using `ids` or `docs`, but cannot use both in single rule.\nIt is advised to use one or the other in query rulesets, to avoid errors.\nAdditionally, pinned queries have a maximum limit of 100 pinned hits.\nIf multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset.",
+ "externalDocs": {
+ "description": "Edit rules and rulesets from the Query Rules UI",
+ "url": "https://www.elastic.co/docs/solutions/search/query-rules-ui#edit-a-rule",
+ "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/put-query-ruleset.html"
+ },
+ "operationId": "query-rules-put-ruleset",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "ruleset_id",
+ "description": "The unique identifier of the query ruleset to be created or updated.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "rules": {
+ "oneOf": [
+ {
+ "$ref": "#/components/schemas/query_rules._types.QueryRule"
+ },
+ {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/query_rules._types.QueryRule"
+ }
+ }
+ ]
+ }
+ },
+ "required": [
+ "rules"
+ ]
+ },
+ "examples": {
+ "QueryRulesetPutRequestExample1": {
+ "description": "Run `PUT _query_rules/my-ruleset` to create a new query ruleset. Two rules are associated with `my-ruleset`. `my-rule1` will pin documents with IDs `id1` and `id2` when `user_query` contains `pugs` or `puggles` and `user_country` exactly matches `us`. `my-rule2` will exclude documents from different specified indices with IDs `id3` and `id4` when the `query_string` fuzzily matches `rescue dogs`.\n",
+ "value": "{\n \"rules\": [\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [ \"pugs\", \"puggles\" ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [ \"us\" ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [ \"rescue dogs\" ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ]\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "result": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Result"
+ }
+ ]
+ }
+ },
+ "required": [
+ "result"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 8.10.0",
+ "x-variations": [
+ "\n PUT\n /_query_rules/{ruleset_id}\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_search_query_rules`\n"
+ ],
+ "x-api": "put_ruleset.query_rules",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "PUT _query_rules/my-ruleset\n{\n \"rules\": [\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [ \"pugs\", \"puggles\" ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [ \"us\" ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [ \"rescue dogs\" ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ]\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.query_rules.put_ruleset(\n ruleset_id=\"my-ruleset\",\n rules=[\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"pugs\",\n \"puggles\"\n ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [\n \"us\"\n ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"rescue dogs\"\n ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ],\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.queryRules.putRuleset({\n ruleset_id: \"my-ruleset\",\n rules: [\n {\n rule_id: \"my-rule1\",\n type: \"pinned\",\n criteria: [\n {\n type: \"contains\",\n metadata: \"user_query\",\n values: [\"pugs\", \"puggles\"],\n },\n {\n type: \"exact\",\n metadata: \"user_country\",\n values: [\"us\"],\n },\n ],\n actions: {\n ids: [\"id1\", \"id2\"],\n },\n },\n {\n rule_id: \"my-rule2\",\n type: \"pinned\",\n criteria: [\n {\n type: \"fuzzy\",\n metadata: \"user_query\",\n values: [\"rescue dogs\"],\n },\n ],\n actions: {\n docs: [\n {\n _index: \"index1\",\n _id: \"id3\",\n },\n {\n _index: \"index2\",\n _id: \"id4\",\n },\n ],\n },\n },\n ],\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.query_rules.put_ruleset(\n ruleset_id: \"my-ruleset\",\n body: {\n \"rules\": [\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"pugs\",\n \"puggles\"\n ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [\n \"us\"\n ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"rescue dogs\"\n ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ]\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->queryRules()->putRuleset([\n \"ruleset_id\" => \"my-ruleset\",\n \"body\" => [\n \"rules\" => array(\n [\n \"rule_id\" => \"my-rule1\",\n \"type\" => \"pinned\",\n \"criteria\" => array(\n [\n \"type\" => \"contains\",\n \"metadata\" => \"user_query\",\n \"values\" => array(\n \"pugs\",\n \"puggles\",\n ),\n ],\n [\n \"type\" => \"exact\",\n \"metadata\" => \"user_country\",\n \"values\" => array(\n \"us\",\n ),\n ],\n ),\n \"actions\" => [\n \"ids\" => array(\n \"id1\",\n \"id2\",\n ),\n ],\n ],\n [\n \"rule_id\" => \"my-rule2\",\n \"type\" => \"pinned\",\n \"criteria\" => array(\n [\n \"type\" => \"fuzzy\",\n \"metadata\" => \"user_query\",\n \"values\" => array(\n \"rescue dogs\",\n ),\n ],\n ),\n \"actions\" => [\n \"docs\" => array(\n [\n \"_index\" => \"index1\",\n \"_id\" => \"id3\",\n ],\n [\n \"_index\" => \"index2\",\n \"_id\" => \"id4\",\n ],\n ),\n ],\n ],\n ),\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"rules\":[{\"rule_id\":\"my-rule1\",\"type\":\"pinned\",\"criteria\":[{\"type\":\"contains\",\"metadata\":\"user_query\",\"values\":[\"pugs\",\"puggles\"]},{\"type\":\"exact\",\"metadata\":\"user_country\",\"values\":[\"us\"]}],\"actions\":{\"ids\":[\"id1\",\"id2\"]}},{\"rule_id\":\"my-rule2\",\"type\":\"pinned\",\"criteria\":[{\"type\":\"fuzzy\",\"metadata\":\"user_query\",\"values\":[\"rescue dogs\"]}],\"actions\":{\"docs\":[{\"_index\":\"index1\",\"_id\":\"id3\"},{\"_index\":\"index2\",\"_id\":\"id4\"}]}}]}' \"$ELASTICSEARCH_URL/_query_rules/my-ruleset\""
+ },
+ {
+ "lang": "Java",
+ "source": "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\\\"\")))\n ),QueryRuleCriteria.of(qu -> qu\n .type(QueryRuleCriteriaType.Exact)\n .metadata(\"user_country\")\n .values(JsonData.fromJson(\"\\\"us\\\"\"))\n )))\n .actions(a -> a\n .ids(List.of(\"id1\",\"id2\"))\n )\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\")\n ),PinnedDoc.of(pi -> pi\n .id(\"id4\")\n .index(\"index2\")\n )))\n )\n )))\n .rulesetId(\"my-ruleset\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "delete": {
+ "tags": [
+ "query_rules"
+ ],
+ "summary": "Delete a query ruleset",
+ "description": "Remove a query ruleset and its associated data.\nThis is a destructive action that is not recoverable.",
+ "externalDocs": {
+ "description": "Delete a ruleset from the Query Rules UI",
+ "url": "https://www.elastic.co/docs/solutions/search/query-rules-ui#delete-a-ruleset",
+ "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/delete-query-ruleset.html"
+ },
+ "operationId": "query-rules-delete-ruleset",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "ruleset_id",
+ "description": "The unique identifier of the query ruleset to delete",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_types.AcknowledgedResponseBase"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 8.10.0",
+ "x-variations": [
+ "\n DELETE\n /_query_rules/{ruleset_id}\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_search_query_rules`\n"
+ ],
+ "x-api": "delete_ruleset.query_rules",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "DELETE _query_rules/my-ruleset/\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.query_rules.delete_ruleset(\n ruleset_id=\"my-ruleset\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.queryRules.deleteRuleset({\n ruleset_id: \"my-ruleset\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.query_rules.delete_ruleset(\n ruleset_id: \"my-ruleset\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->queryRules()->deleteRuleset([\n \"ruleset_id\" => \"my-ruleset\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/my-ruleset/\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.queryRules().deleteRuleset(d -> d\n .rulesetId(\"my-ruleset\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_query_rules": {
+ "get": {
+ "tags": [
+ "query_rules"
+ ],
+ "summary": "Get all query rulesets",
+ "description": "Get summarized information about the query rulesets.",
+ "externalDocs": {
+ "description": "See rules and rulesets in Query Rules UI",
+ "url": "https://www.elastic.co/docs/solutions/search/query-rules-ui#accessing-the-query-rules-ui",
+ "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/list-query-rulesets.html"
+ },
+ "operationId": "query-rules-list-rulesets",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "from",
+ "description": "The offset from the first result to fetch.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "size",
+ "description": "The maximum number of results to retrieve.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "count": {
+ "type": "number"
+ },
+ "results": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/query_rules.list_rulesets.QueryRulesetListItem"
+ }
+ }
+ },
+ "required": [
+ "count",
+ "results"
+ ]
+ },
+ "examples": {
+ "QueryRulesetListResponseExample1": {
+ "description": "A successful response from `GET _query_rules/?from=0&size=3`.",
+ "value": "{\n \"count\": 3,\n \"results\": [\n {\n \"ruleset_id\": \"ruleset-1\",\n \"rule_total_count\": 1,\n \"rule_criteria_types_counts\": {\n \"exact\": 1\n }\n },\n {\n \"ruleset_id\": \"ruleset-2\",\n \"rule_total_count\": 2,\n \"rule_criteria_types_counts\": {\n \"exact\": 1,\n \"fuzzy\": 1\n }\n },\n {\n \"ruleset_id\": \"ruleset-3\",\n \"rule_total_count\": 3,\n \"rule_criteria_types_counts\": {\n \"exact\": 1,\n \"fuzzy\": 2\n }\n }\n ]\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 8.10.0",
+ "x-variations": [
+ "\n GET\n /_query_rules\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_search_query_rules`\n"
+ ],
+ "x-api": "list_rulesets.query_rules",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _query_rules/?from=0&size=3\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.query_rules.list_rulesets(\n from=\"0\",\n size=\"3\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.queryRules.listRulesets({\n from: 0,\n size: 3,\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.query_rules.list_rulesets(\n from: \"0\",\n size: \"3\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->queryRules()->listRulesets([\n \"from\" => \"0\",\n \"size\" => \"3\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_query_rules/?from=0&size=3\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.queryRules().listRulesets(l -> l\n .from(0)\n .size(3)\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_query_rules/{ruleset_id}/_test": {
+ "post": {
+ "tags": [
+ "query_rules"
+ ],
+ "summary": "Test a query ruleset",
+ "description": "Evaluate match criteria against a query ruleset to identify the rules that would match that criteria.",
+ "operationId": "query-rules-test",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "ruleset_id",
+ "description": "The unique identifier of the query ruleset to be created or updated",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "match_criteria": {
+ "description": "The match criteria to apply to rules in the given query ruleset.\nMatch criteria should match the keys defined in the `criteria.metadata` field of the rule.",
+ "type": "object",
+ "additionalProperties": {
+ "type": "object"
+ }
+ }
+ },
+ "required": [
+ "match_criteria"
+ ]
+ },
+ "examples": {
+ "QueryRulesetTestRequestExample1": {
+ "description": "Run `PUT _query_rules/my-ruleset` to create a new query ruleset. Two rules are associated with `my-ruleset`. `my-rule1` will pin documents with IDs `id1` and `id2` when `user_query` contains `pugs` or `puggles` and `user_country` exactly matches `us`. `my-rule2` will exclude documents from different specified indices with IDs `id3` and `id4` when the `query_string` fuzzily matches `rescue dogs`.\n",
+ "value": "{\n \"rules\": [\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [ \"pugs\", \"puggles\" ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [ \"us\" ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [ \"rescue dogs\" ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ]\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "total_matched_rules": {
+ "type": "number"
+ },
+ "matched_rules": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/query_rules.test.QueryRulesetMatchedRule"
+ }
+ }
+ },
+ "required": [
+ "total_matched_rules",
+ "matched_rules"
+ ]
+ },
+ "examples": {
+ "QueryRulesetTestResponseExample1": {
+ "description": "A successful response from `POST _query_rules/my-ruleset/_test`.",
+ "value": "{\n \"total_matched_rules\": 1,\n \"matched_rules\": [\n {\n \"ruleset_id\": \"my-ruleset\",\n \"rule_id\": \"my-rule1\"\n }\n ]\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 8.10.0",
+ "x-variations": [
+ "\n POST\n /_query_rules/{ruleset_id}/_test\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_search_query_rules`\n"
+ ],
+ "x-api": "test.query_rules",
+ "x-category": "ai/ml",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "PUT _query_rules/my-ruleset\n{\n \"rules\": [\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [ \"pugs\", \"puggles\" ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [ \"us\" ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [ \"rescue dogs\" ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ]\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.query_rules.put_ruleset(\n ruleset_id=\"my-ruleset\",\n rules=[\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"pugs\",\n \"puggles\"\n ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [\n \"us\"\n ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"rescue dogs\"\n ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ],\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.queryRules.putRuleset({\n ruleset_id: \"my-ruleset\",\n rules: [\n {\n rule_id: \"my-rule1\",\n type: \"pinned\",\n criteria: [\n {\n type: \"contains\",\n metadata: \"user_query\",\n values: [\"pugs\", \"puggles\"],\n },\n {\n type: \"exact\",\n metadata: \"user_country\",\n values: [\"us\"],\n },\n ],\n actions: {\n ids: [\"id1\", \"id2\"],\n },\n },\n {\n rule_id: \"my-rule2\",\n type: \"pinned\",\n criteria: [\n {\n type: \"fuzzy\",\n metadata: \"user_query\",\n values: [\"rescue dogs\"],\n },\n ],\n actions: {\n docs: [\n {\n _index: \"index1\",\n _id: \"id3\",\n },\n {\n _index: \"index2\",\n _id: \"id4\",\n },\n ],\n },\n },\n ],\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.query_rules.put_ruleset(\n ruleset_id: \"my-ruleset\",\n body: {\n \"rules\": [\n {\n \"rule_id\": \"my-rule1\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"contains\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"pugs\",\n \"puggles\"\n ]\n },\n {\n \"type\": \"exact\",\n \"metadata\": \"user_country\",\n \"values\": [\n \"us\"\n ]\n }\n ],\n \"actions\": {\n \"ids\": [\n \"id1\",\n \"id2\"\n ]\n }\n },\n {\n \"rule_id\": \"my-rule2\",\n \"type\": \"pinned\",\n \"criteria\": [\n {\n \"type\": \"fuzzy\",\n \"metadata\": \"user_query\",\n \"values\": [\n \"rescue dogs\"\n ]\n }\n ],\n \"actions\": {\n \"docs\": [\n {\n \"_index\": \"index1\",\n \"_id\": \"id3\"\n },\n {\n \"_index\": \"index2\",\n \"_id\": \"id4\"\n }\n ]\n }\n }\n ]\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->queryRules()->putRuleset([\n \"ruleset_id\" => \"my-ruleset\",\n \"body\" => [\n \"rules\" => array(\n [\n \"rule_id\" => \"my-rule1\",\n \"type\" => \"pinned\",\n \"criteria\" => array(\n [\n \"type\" => \"contains\",\n \"metadata\" => \"user_query\",\n \"values\" => array(\n \"pugs\",\n \"puggles\",\n ),\n ],\n [\n \"type\" => \"exact\",\n \"metadata\" => \"user_country\",\n \"values\" => array(\n \"us\",\n ),\n ],\n ),\n \"actions\" => [\n \"ids\" => array(\n \"id1\",\n \"id2\",\n ),\n ],\n ],\n [\n \"rule_id\" => \"my-rule2\",\n \"type\" => \"pinned\",\n \"criteria\" => array(\n [\n \"type\" => \"fuzzy\",\n \"metadata\" => \"user_query\",\n \"values\" => array(\n \"rescue dogs\",\n ),\n ],\n ),\n \"actions\" => [\n \"docs\" => array(\n [\n \"_index\" => \"index1\",\n \"_id\" => \"id3\",\n ],\n [\n \"_index\" => \"index2\",\n \"_id\" => \"id4\",\n ],\n ),\n ],\n ],\n ),\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"rules\":[{\"rule_id\":\"my-rule1\",\"type\":\"pinned\",\"criteria\":[{\"type\":\"contains\",\"metadata\":\"user_query\",\"values\":[\"pugs\",\"puggles\"]},{\"type\":\"exact\",\"metadata\":\"user_country\",\"values\":[\"us\"]}],\"actions\":{\"ids\":[\"id1\",\"id2\"]}},{\"rule_id\":\"my-rule2\",\"type\":\"pinned\",\"criteria\":[{\"type\":\"fuzzy\",\"metadata\":\"user_query\",\"values\":[\"rescue dogs\"]}],\"actions\":{\"docs\":[{\"_index\":\"index1\",\"_id\":\"id3\"},{\"_index\":\"index2\",\"_id\":\"id4\"}]}}]}' \"$ELASTICSEARCH_URL/_query_rules/my-ruleset\""
+ },
+ {
+ "lang": "Java",
+ "source": "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\\\"\")))\n ),QueryRuleCriteria.of(qu -> qu\n .type(QueryRuleCriteriaType.Exact)\n .metadata(\"user_country\")\n .values(JsonData.fromJson(\"\\\"us\\\"\"))\n )))\n .actions(a -> a\n .ids(List.of(\"id1\",\"id2\"))\n )\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\")\n ),PinnedDoc.of(pi -> pi\n .id(\"id4\")\n .index(\"index2\")\n )))\n )\n )))\n .rulesetId(\"my-ruleset\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_rank_eval": {
+ "get": {
+ "tags": [
+ "search"
+ ],
+ "summary": "Evaluate ranked search results",
+ "description": "Evaluate the quality of ranked search results over a set of typical search queries.",
+ "operationId": "rank-eval",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "allow_no_indices",
+ "description": "If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "expand_wildcards",
+ "description": "Whether to expand wildcard expression to concrete indices that are open, closed or both.\n\nSupported values include:\n - `all`: Match any data stream or index, including hidden ones.\n - `open`: Match open, non-hidden indices. Also matches any non-hidden data stream.\n - `closed`: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.\n - `hidden`: Match hidden data streams and hidden indices. Must be combined with `open`, `closed`, or `both`.\n - `none`: Wildcard expressions are not accepted.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.ExpandWildcards"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ignore_unavailable",
+ "description": "If `true`, missing or closed indices are not included in the response.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "search_type",
+ "description": "Search operation type\n\nSupported values include:\n - `query_then_fetch`: Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate.\n - `dfs_query_then_fetch`: Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.SearchType"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "requests": {
+ "description": "A set of typical search requests, together with their provided ratings.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_global.rank_eval.RankEvalRequestItem"
+ }
+ },
+ "metric": {
+ "description": "Definition of the evaluation metric to calculate.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.rank_eval.RankEvalMetric"
+ }
+ ]
+ }
+ },
+ "required": [
+ "requests"
+ ]
+ },
+ "examples": {
+ "RankEvalRequestExample1": {
+ "description": "An example body for a `GET /my-index-000001/_rank_eval` request.",
+ "value": "{\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": { \"query\": { \"match_all\": {} } },\n \"ratings\": []\n } ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "metric_score": {
+ "description": "The overall evaluation quality calculated by the defined metric",
+ "type": "number"
+ },
+ "details": {
+ "description": "The details section contains one entry for every query in the original requests section, keyed by the search request id",
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/_global.rank_eval.RankEvalMetricDetail"
+ }
+ },
+ "failures": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "object"
+ }
+ }
+ },
+ "required": [
+ "metric_score",
+ "details",
+ "failures"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 6.2.0",
+ "x-variations": [
+ "\n GET\n /_rank_eval\n
\n ",
+ "\n POST\n /_rank_eval\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "rank_eval",
+ "x-category": "search",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET /my-index-000001/_rank_eval\n{\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": { \"query\": { \"match_all\": {} } },\n \"ratings\": []\n } ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.rank_eval(\n index=\"my-index-000001\",\n requests=[\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n metric={\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": False\n }\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.rankEval({\n index: \"my-index-000001\",\n requests: [\n {\n id: \"JFK query\",\n request: {\n query: {\n match_all: {},\n },\n },\n ratings: [],\n },\n ],\n metric: {\n precision: {\n k: 20,\n relevant_rating_threshold: 1,\n ignore_unlabeled: false,\n },\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.rank_eval(\n index: \"my-index-000001\",\n body: {\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->rankEval([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"requests\" => array(\n [\n \"id\" => \"JFK query\",\n \"request\" => [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n \"ratings\" => array(\n ),\n ],\n ),\n \"metric\" => [\n \"precision\" => [\n \"k\" => 20,\n \"relevant_rating_threshold\" => 1,\n \"ignore_unlabeled\" => false,\n ],\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"requests\":[{\"id\":\"JFK query\",\"request\":{\"query\":{\"match_all\":{}}},\"ratings\":[]}],\"metric\":{\"precision\":{\"k\":20,\"relevant_rating_threshold\":1,\"ignore_unlabeled\":false}}}' \"$ELASTICSEARCH_URL/my-index-000001/_rank_eval\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "post": {
+ "tags": [
+ "search"
+ ],
+ "summary": "Evaluate ranked search results",
+ "description": "Evaluate the quality of ranked search results over a set of typical search queries.",
+ "operationId": "rank-eval-1",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "allow_no_indices",
+ "description": "If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "expand_wildcards",
+ "description": "Whether to expand wildcard expression to concrete indices that are open, closed or both.\n\nSupported values include:\n - `all`: Match any data stream or index, including hidden ones.\n - `open`: Match open, non-hidden indices. Also matches any non-hidden data stream.\n - `closed`: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.\n - `hidden`: Match hidden data streams and hidden indices. Must be combined with `open`, `closed`, or `both`.\n - `none`: Wildcard expressions are not accepted.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.ExpandWildcards"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ignore_unavailable",
+ "description": "If `true`, missing or closed indices are not included in the response.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "search_type",
+ "description": "Search operation type\n\nSupported values include:\n - `query_then_fetch`: Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate.\n - `dfs_query_then_fetch`: Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.SearchType"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "requests": {
+ "description": "A set of typical search requests, together with their provided ratings.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_global.rank_eval.RankEvalRequestItem"
+ }
+ },
+ "metric": {
+ "description": "Definition of the evaluation metric to calculate.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.rank_eval.RankEvalMetric"
+ }
+ ]
+ }
+ },
+ "required": [
+ "requests"
+ ]
+ },
+ "examples": {
+ "RankEvalRequestExample1": {
+ "description": "An example body for a `GET /my-index-000001/_rank_eval` request.",
+ "value": "{\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": { \"query\": { \"match_all\": {} } },\n \"ratings\": []\n } ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "metric_score": {
+ "description": "The overall evaluation quality calculated by the defined metric",
+ "type": "number"
+ },
+ "details": {
+ "description": "The details section contains one entry for every query in the original requests section, keyed by the search request id",
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/_global.rank_eval.RankEvalMetricDetail"
+ }
+ },
+ "failures": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "object"
+ }
+ }
+ },
+ "required": [
+ "metric_score",
+ "details",
+ "failures"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 6.2.0",
+ "x-variations": [
+ "\n GET\n /_rank_eval\n
\n ",
+ "\n POST\n /_rank_eval\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "rank_eval",
+ "x-category": "search",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET /my-index-000001/_rank_eval\n{\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": { \"query\": { \"match_all\": {} } },\n \"ratings\": []\n } ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.rank_eval(\n index=\"my-index-000001\",\n requests=[\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n metric={\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": False\n }\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.rankEval({\n index: \"my-index-000001\",\n requests: [\n {\n id: \"JFK query\",\n request: {\n query: {\n match_all: {},\n },\n },\n ratings: [],\n },\n ],\n metric: {\n precision: {\n k: 20,\n relevant_rating_threshold: 1,\n ignore_unlabeled: false,\n },\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.rank_eval(\n index: \"my-index-000001\",\n body: {\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->rankEval([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"requests\" => array(\n [\n \"id\" => \"JFK query\",\n \"request\" => [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n \"ratings\" => array(\n ),\n ],\n ),\n \"metric\" => [\n \"precision\" => [\n \"k\" => 20,\n \"relevant_rating_threshold\" => 1,\n \"ignore_unlabeled\" => false,\n ],\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"requests\":[{\"id\":\"JFK query\",\"request\":{\"query\":{\"match_all\":{}}},\"ratings\":[]}],\"metric\":{\"precision\":{\"k\":20,\"relevant_rating_threshold\":1,\"ignore_unlabeled\":false}}}' \"$ELASTICSEARCH_URL/my-index-000001/_rank_eval\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/{index}/_rank_eval": {
+ "get": {
+ "tags": [
+ "search"
+ ],
+ "summary": "Evaluate ranked search results",
+ "description": "Evaluate the quality of ranked search results over a set of typical search queries.",
+ "operationId": "rank-eval-2",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "index",
+ "description": "A comma-separated list of data streams, indices, and index aliases used to limit the request.\nWildcard (`*`) expressions are supported.\nTo target all data streams and indices in a cluster, omit this parameter or use `_all` or `*`.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Indices"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "allow_no_indices",
+ "description": "If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "expand_wildcards",
+ "description": "Whether to expand wildcard expression to concrete indices that are open, closed or both.\n\nSupported values include:\n - `all`: Match any data stream or index, including hidden ones.\n - `open`: Match open, non-hidden indices. Also matches any non-hidden data stream.\n - `closed`: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.\n - `hidden`: Match hidden data streams and hidden indices. Must be combined with `open`, `closed`, or `both`.\n - `none`: Wildcard expressions are not accepted.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.ExpandWildcards"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ignore_unavailable",
+ "description": "If `true`, missing or closed indices are not included in the response.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "search_type",
+ "description": "Search operation type\n\nSupported values include:\n - `query_then_fetch`: Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate.\n - `dfs_query_then_fetch`: Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.SearchType"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "requests": {
+ "description": "A set of typical search requests, together with their provided ratings.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_global.rank_eval.RankEvalRequestItem"
+ }
+ },
+ "metric": {
+ "description": "Definition of the evaluation metric to calculate.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.rank_eval.RankEvalMetric"
+ }
+ ]
+ }
+ },
+ "required": [
+ "requests"
+ ]
+ },
+ "examples": {
+ "RankEvalRequestExample1": {
+ "description": "An example body for a `GET /my-index-000001/_rank_eval` request.",
+ "value": "{\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": { \"query\": { \"match_all\": {} } },\n \"ratings\": []\n } ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "metric_score": {
+ "description": "The overall evaluation quality calculated by the defined metric",
+ "type": "number"
+ },
+ "details": {
+ "description": "The details section contains one entry for every query in the original requests section, keyed by the search request id",
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/_global.rank_eval.RankEvalMetricDetail"
+ }
+ },
+ "failures": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "object"
+ }
+ }
+ },
+ "required": [
+ "metric_score",
+ "details",
+ "failures"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 6.2.0",
+ "x-variations": [
+ "\n GET\n /{index}/_rank_eval\n
\n ",
+ "\n POST\n /{index}/_rank_eval\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "rank_eval",
+ "x-category": "search",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET /my-index-000001/_rank_eval\n{\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": { \"query\": { \"match_all\": {} } },\n \"ratings\": []\n } ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.rank_eval(\n index=\"my-index-000001\",\n requests=[\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n metric={\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": False\n }\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.rankEval({\n index: \"my-index-000001\",\n requests: [\n {\n id: \"JFK query\",\n request: {\n query: {\n match_all: {},\n },\n },\n ratings: [],\n },\n ],\n metric: {\n precision: {\n k: 20,\n relevant_rating_threshold: 1,\n ignore_unlabeled: false,\n },\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.rank_eval(\n index: \"my-index-000001\",\n body: {\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->rankEval([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"requests\" => array(\n [\n \"id\" => \"JFK query\",\n \"request\" => [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n \"ratings\" => array(\n ),\n ],\n ),\n \"metric\" => [\n \"precision\" => [\n \"k\" => 20,\n \"relevant_rating_threshold\" => 1,\n \"ignore_unlabeled\" => false,\n ],\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"requests\":[{\"id\":\"JFK query\",\"request\":{\"query\":{\"match_all\":{}}},\"ratings\":[]}],\"metric\":{\"precision\":{\"k\":20,\"relevant_rating_threshold\":1,\"ignore_unlabeled\":false}}}' \"$ELASTICSEARCH_URL/my-index-000001/_rank_eval\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "post": {
+ "tags": [
+ "search"
+ ],
+ "summary": "Evaluate ranked search results",
+ "description": "Evaluate the quality of ranked search results over a set of typical search queries.",
+ "operationId": "rank-eval-3",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "index",
+ "description": "A comma-separated list of data streams, indices, and index aliases used to limit the request.\nWildcard (`*`) expressions are supported.\nTo target all data streams and indices in a cluster, omit this parameter or use `_all` or `*`.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Indices"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "allow_no_indices",
+ "description": "If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "expand_wildcards",
+ "description": "Whether to expand wildcard expression to concrete indices that are open, closed or both.\n\nSupported values include:\n - `all`: Match any data stream or index, including hidden ones.\n - `open`: Match open, non-hidden indices. Also matches any non-hidden data stream.\n - `closed`: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.\n - `hidden`: Match hidden data streams and hidden indices. Must be combined with `open`, `closed`, or `both`.\n - `none`: Wildcard expressions are not accepted.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.ExpandWildcards"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ignore_unavailable",
+ "description": "If `true`, missing or closed indices are not included in the response.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "search_type",
+ "description": "Search operation type\n\nSupported values include:\n - `query_then_fetch`: Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate.\n - `dfs_query_then_fetch`: Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.SearchType"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "requests": {
+ "description": "A set of typical search requests, together with their provided ratings.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_global.rank_eval.RankEvalRequestItem"
+ }
+ },
+ "metric": {
+ "description": "Definition of the evaluation metric to calculate.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.rank_eval.RankEvalMetric"
+ }
+ ]
+ }
+ },
+ "required": [
+ "requests"
+ ]
+ },
+ "examples": {
+ "RankEvalRequestExample1": {
+ "description": "An example body for a `GET /my-index-000001/_rank_eval` request.",
+ "value": "{\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": { \"query\": { \"match_all\": {} } },\n \"ratings\": []\n } ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "metric_score": {
+ "description": "The overall evaluation quality calculated by the defined metric",
+ "type": "number"
+ },
+ "details": {
+ "description": "The details section contains one entry for every query in the original requests section, keyed by the search request id",
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/_global.rank_eval.RankEvalMetricDetail"
+ }
+ },
+ "failures": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "object"
+ }
+ }
+ },
+ "required": [
+ "metric_score",
+ "details",
+ "failures"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 6.2.0",
+ "x-variations": [
+ "\n GET\n /{index}/_rank_eval\n
\n ",
+ "\n POST\n /{index}/_rank_eval\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "rank_eval",
+ "x-category": "search",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET /my-index-000001/_rank_eval\n{\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": { \"query\": { \"match_all\": {} } },\n \"ratings\": []\n } ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.rank_eval(\n index=\"my-index-000001\",\n requests=[\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n metric={\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": False\n }\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.rankEval({\n index: \"my-index-000001\",\n requests: [\n {\n id: \"JFK query\",\n request: {\n query: {\n match_all: {},\n },\n },\n ratings: [],\n },\n ],\n metric: {\n precision: {\n k: 20,\n relevant_rating_threshold: 1,\n ignore_unlabeled: false,\n },\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.rank_eval(\n index: \"my-index-000001\",\n body: {\n \"requests\": [\n {\n \"id\": \"JFK query\",\n \"request\": {\n \"query\": {\n \"match_all\": {}\n }\n },\n \"ratings\": []\n }\n ],\n \"metric\": {\n \"precision\": {\n \"k\": 20,\n \"relevant_rating_threshold\": 1,\n \"ignore_unlabeled\": false\n }\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->rankEval([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"requests\" => array(\n [\n \"id\" => \"JFK query\",\n \"request\" => [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n \"ratings\" => array(\n ),\n ],\n ),\n \"metric\" => [\n \"precision\" => [\n \"k\" => 20,\n \"relevant_rating_threshold\" => 1,\n \"ignore_unlabeled\" => false,\n ],\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"requests\":[{\"id\":\"JFK query\",\"request\":{\"query\":{\"match_all\":{}}},\"ratings\":[]}],\"metric\":{\"precision\":{\"k\":20,\"relevant_rating_threshold\":1,\"ignore_unlabeled\":false}}}' \"$ELASTICSEARCH_URL/my-index-000001/_rank_eval\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_reindex": {
+ "post": {
+ "tags": [
+ "document"
+ ],
+ "summary": "Reindex documents",
+ "description": "Copy documents from a source to a destination.\nYou can copy all documents to the destination index or reindex a subset of the documents.\nThe source can be any existing index, alias, or data stream.\nThe destination must differ from the source.\nFor example, you cannot reindex a data stream into itself.\n\nIMPORTANT: Reindex requires `_source` to be enabled for all documents in the source.\nThe destination should be configured as wanted before calling the reindex API.\nReindex does not copy the settings from the source or its associated template.\nMappings, shard counts, and replicas, for example, must be configured ahead of time.\n\nIf the Elasticsearch security features are enabled, you must have the following security privileges:\n\n* The `read` index privilege for the source data stream, index, or alias.\n* The `write` index privilege for the destination data stream, index, or index alias.\n* To automatically create a data stream or index with a reindex API request, you must have the `auto_configure`, `create_index`, or `manage` index privilege for the destination data stream, index, or alias.\n* If reindexing from a remote cluster, the `source.remote.user` must have the `monitor` cluster privilege and the `read` index privilege for the source data stream, index, or alias.\n\nIf reindexing from a remote cluster into a cluster using Elastic Stack, you must explicitly allow the remote host using the `reindex.remote.whitelist` node setting on the destination cluster.\nIf reindexing from a remote cluster into an Elastic Cloud Serverless project, only remote hosts from Elastic Cloud Hosted are allowed.\nAutomatic data stream creation requires a matching index template with data stream enabled.\n\nThe `dest` element can be configured like the index API to control optimistic concurrency control.\nOmitting `version_type` or setting it to `internal` causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID.\n\nSetting `version_type` to `external` causes Elasticsearch to preserve the `version` from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source.\n\nSetting `op_type` to `create` causes the reindex API to create only missing documents in the destination.\nAll existing documents will cause a version conflict.\n\nIMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an `op_type` of `create`.\nA reindex can only add new documents to a destination data stream.\nIt cannot update existing documents in a destination data stream.\n\nBy default, version conflicts abort the reindex process.\nTo continue reindexing if there are conflicts, set the `conflicts` request body property to `proceed`.\nIn this case, the response includes a count of the version conflicts that were encountered.\nNote that the handling of other error types is unaffected by the `conflicts` property.\nAdditionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than `max_docs` until it has successfully indexed `max_docs` documents into the target or it has gone through every document in the source query.\n\nIt's recommended to reindex on indices with a green status. Reindexing can fail when a node shuts down or crashes.\n* When requested with `wait_for_completion=true` (default), the request fails if the node shuts down.\n* When requested with `wait_for_completion=false`, a task id is returned, for use with the task management APIs. The task may disappear or fail if the node shuts down.\nWhen retrying a failed reindex operation, it might be necessary to set `conflicts=proceed` or to first delete the partial destination index.\nAdditionally, dry runs, checking disk space, and fetching index recovery information can help address the root cause.\n\nRefer to the linked documentation for examples of how to reindex documents.",
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/reindex-indices",
+ "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/docs-reindex.html"
+ },
+ "operationId": "reindex",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "refresh",
+ "description": "If `true`, the request refreshes affected shards to make this operation visible to search.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "requests_per_second",
+ "description": "The throttle for this request in sub-requests per second.\nBy default, there is no throttle.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "scroll",
+ "description": "The period of time that a consistent view of the index should be maintained for scrolled search.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "slices",
+ "description": "The number of slices this task should be divided into.\nIt defaults to one slice, which means the task isn't sliced into subtasks.\n\nReindex supports sliced scroll to parallelize the reindexing process.\nThis parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts.\n\nNOTE: Reindexing from remote clusters does not support manual or automatic slicing.\n\nIf set to `auto`, Elasticsearch chooses the number of slices to use.\nThis setting will use one slice per shard, up to a certain limit.\nIf there are multiple sources, it will choose the number of slices based on the index or backing index with the smallest number of shards.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Slices"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "max_docs",
+ "description": "The maximum number of documents to reindex.\nBy default, all documents are reindexed.\nIf it is a value less then or equal to `scroll_size`, a scroll will not be used to retrieve the results for the operation.\n\nIf `conflicts` is set to `proceed`, the reindex operation could attempt to reindex more documents from the source than `max_docs` until it has successfully indexed `max_docs` documents into the target or it has gone through every document in the source query.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "The period each indexing waits for automatic index creation, dynamic mapping updates, and waiting for active shards.\nBy default, Elasticsearch waits for at least one minute before failing.\nThe actual wait time could be longer, particularly when multiple waits occur.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "wait_for_active_shards",
+ "description": "The number of shard copies that must be active before proceeding with the operation.\nSet it to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).\nThe default value is one, which means it waits for each primary shard to be active.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.WaitForActiveShards"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "wait_for_completion",
+ "description": "If `true`, the request blocks until the operation is complete.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "require_alias",
+ "description": "If `true`, the destination must be an index alias.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "conflicts": {
+ "description": "Indicates whether to continue reindexing even when there are conflicts.\n\nSupported values include:\n - `abort`: Stop reindexing if there are conflicts.\n - `proceed`: Continue reindexing even if there are conflicts.\n\n",
+ "default": "abort",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Conflicts"
+ }
+ ]
+ },
+ "dest": {
+ "description": "The destination you are copying to.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.reindex.Destination"
+ }
+ ]
+ },
+ "max_docs": {
+ "description": "The maximum number of documents to reindex.\nBy default, all documents are reindexed.\nIf it is a value less then or equal to `scroll_size`, a scroll will not be used to retrieve the results for the operation.\n\nIf `conflicts` is set to `proceed`, the reindex operation could attempt to reindex more documents from the source than `max_docs` until it has successfully indexed `max_docs` documents into the target or it has gone through every document in the source query.",
+ "type": "number"
+ },
+ "script": {
+ "description": "The script to run to update the document source or metadata when reindexing.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Script"
+ }
+ ]
+ },
+ "source": {
+ "description": "The source you are copying from.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.reindex.Source"
+ }
+ ]
+ }
+ },
+ "required": [
+ "dest",
+ "source"
+ ]
+ },
+ "examples": {
+ "ReindexRequestExample1": {
+ "summary": "Reindex multiple sources",
+ "description": "Run `POST _reindex` to reindex from multiple sources. The `index` attribute in source can be a list, which enables you to copy from lots of sources in one request. This example copies documents from the `my-index-000001` and `my-index-000002` indices.\n",
+ "value": "{\n \"source\": {\n \"index\": [\"my-index-000001\", \"my-index-000002\"]\n },\n \"dest\": {\n \"index\": \"my-new-index-000002\"\n }\n}"
+ },
+ "ReindexRequestExample10": {
+ "summary": "Reindex with Painless",
+ "description": "You can use Painless to reindex daily indices to apply a new template to the existing documents. The script extracts the date from the index name and creates a new index with `-1` appended. For example, all data from `metricbeat-2016.05.31` will be reindexed into `metricbeat-2016.05.31-1`.\n",
+ "value": "{\n \"source\": {\n \"index\": \"metricbeat-*\"\n },\n \"dest\": {\n \"index\": \"metricbeat\"\n },\n \"script\": {\n \"lang\": \"painless\",\n \"source\": \"ctx._index = 'metricbeat-' + (ctx._index.substring('metricbeat-'.length(), ctx._index.length())) + '-1'\"\n }\n}"
+ },
+ "ReindexRequestExample11": {
+ "summary": "Reindex a random subset",
+ "description": "Run `POST _reindex` to extract a random subset of the source for testing. You might need to adjust the `min_score` value depending on the relative amount of data extracted from source.\n",
+ "value": "{\n \"max_docs\": 10,\n \"source\": {\n \"index\": \"my-index-000001\",\n \"query\": {\n \"function_score\" : {\n \"random_score\" : {},\n \"min_score\" : 0.9\n }\n }\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n }\n}"
+ },
+ "ReindexRequestExample12": {
+ "summary": "Reindex modified documents",
+ "description": "Run `POST _reindex` to modify documents during reindexing. This example bumps the version of the source document.\n",
+ "value": "{\n \"source\": {\n \"index\": \"my-index-000001\"\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\",\n \"version_type\": \"external\"\n },\n \"script\": {\n \"source\": \"if (ctx._source.foo == 'bar') {ctx._version++; ctx._source.remove('foo')}\",\n \"lang\": \"painless\"\n }\n}"
+ },
+ "ReindexRequestExample13": {
+ "summary": "Reindex from remote on Elastic Cloud",
+ "description": "When using Elastic Cloud, you can run `POST _reindex` and authenticate against a remote cluster with an API key.\n",
+ "value": "{\n \"source\": {\n \"remote\": {\n \"host\": \"http://otherhost:9200\",\n \"username\": \"user\",\n \"password\": \"pass\"\n },\n \"index\": \"my-index-000001\",\n \"query\": {\n \"match\": {\n \"test\": \"data\"\n }\n }\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n }\n}"
+ },
+ "ReindexRequestExample2": {
+ "summary": "Manual slicing",
+ "description": "Run `POST _reindex` to slice a reindex request manually. Provide a slice ID and total number of slices to each request.\n",
+ "value": "{\n \"source\": {\n \"index\": \"my-index-000001\",\n \"slice\": {\n \"id\": 0,\n \"max\": 2\n }\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n }\n}"
+ },
+ "ReindexRequestExample3": {
+ "summary": "Automatic slicing",
+ "description": "Run `POST _reindex?slices=5&refresh` to automatically parallelize using sliced scroll to slice on `_id`. The `slices` parameter specifies the number of slices to use.\n",
+ "value": "{\n \"source\": {\n \"index\": \"my-index-000001\"\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n }\n}"
+ },
+ "ReindexRequestExample4": {
+ "summary": "Routing",
+ "description": "By default if reindex sees a document with routing then the routing is preserved unless it's changed by the script. You can set `routing` on the `dest` request to change this behavior. In this example, run `POST _reindex` to copy all documents from the `source` with the company name `cat` into the `dest` with routing set to `cat`.\n",
+ "value": "{\n \"source\": {\n \"index\": \"source\",\n \"query\": {\n \"match\": {\n \"company\": \"cat\"\n }\n }\n },\n \"dest\": {\n \"index\": \"dest\",\n \"routing\": \"=cat\"\n }\n}"
+ },
+ "ReindexRequestExample5": {
+ "summary": "Ingest pipelines",
+ "description": "Run `POST _reindex` and use the ingest pipelines feature.",
+ "value": "{\n \"source\": {\n \"index\": \"source\"\n },\n \"dest\": {\n \"index\": \"dest\",\n \"pipeline\": \"some_ingest_pipeline\"\n }\n}"
+ },
+ "ReindexRequestExample6": {
+ "summary": "Reindex with a query",
+ "description": "Run `POST _reindex` and add a query to the `source` to limit the documents to reindex. For example, this request copies documents into `my-new-index-000001` only if they have a `user.id` of `kimchy`.\n",
+ "value": "{\n \"source\": {\n \"index\": \"my-index-000001\",\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n }\n}"
+ },
+ "ReindexRequestExample7": {
+ "summary": "Reindex with max_docs",
+ "description": "You can limit the number of processed documents by setting `max_docs`. For example, run `POST _reindex` to copy a single document from `my-index-000001` to `my-new-index-000001`.\n",
+ "value": "{\n \"max_docs\": 1,\n \"source\": {\n \"index\": \"my-index-000001\"\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n }\n}"
+ },
+ "ReindexRequestExample8": {
+ "summary": "Reindex selected fields",
+ "description": "You can use source filtering to reindex a subset of the fields in the original documents. For example, run `POST _reindex` the reindex only the `user.id` and `_doc` fields of each document.\n",
+ "value": "{\n \"source\": {\n \"index\": \"my-index-000001\",\n \"_source\": [\"user.id\", \"_doc\"]\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n }\n}"
+ },
+ "ReindexRequestExample9": {
+ "summary": "Reindex new field names",
+ "description": "A reindex operation can build a copy of an index with renamed fields. If your index has documents with `text` and `flag` fields, you can change the latter field name to `tag` during the reindex.\n",
+ "value": "{\n \"source\": {\n \"index\": \"my-index-000001\"\n },\n \"dest\": {\n \"index\": \"my-new-index-000001\"\n },\n \"script\": {\n \"source\": \"ctx._source.tag = ctx._source.remove(\\\"flag\\\")\"\n }\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "batches": {
+ "description": "The number of scroll responses that were pulled back by the reindex.",
+ "type": "number"
+ },
+ "created": {
+ "description": "The number of documents that were successfully created.",
+ "type": "number"
+ },
+ "deleted": {
+ "description": "The number of documents that were successfully deleted.",
+ "type": "number"
+ },
+ "failures": {
+ "description": "If there were any unrecoverable errors during the process, it is an array of those failures.\nIf this array is not empty, the request ended because of those failures.\nReindex is implemented using batches and any failure causes the entire process to end but all failures in the current batch are collected into the array.\nYou can use the `conflicts` option to prevent the reindex from ending on version conflicts.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_types.BulkIndexByScrollFailure"
+ }
+ },
+ "noops": {
+ "description": "The number of documents that were ignored because the script used for the reindex returned a `noop` value for `ctx.op`.",
+ "type": "number"
+ },
+ "retries": {
+ "description": "The number of retries attempted by reindex.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Retries"
+ }
+ ]
+ },
+ "requests_per_second": {
+ "description": "The number of requests per second effectively run during the reindex.",
+ "type": "number"
+ },
+ "slice_id": {
+ "type": "number"
+ },
+ "slices": {
+ "description": "Status of each slice if the reindex was sliced",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_types.ReindexStatus"
+ }
+ },
+ "task": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.TaskId"
+ }
+ ]
+ },
+ "throttled_millis": {
+ "description": "The number of milliseconds the request slept to conform to `requests_per_second`.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.EpochTimeUnitMillis"
+ }
+ ]
+ },
+ "throttled_until_millis": {
+ "description": "This field should always be equal to zero in a reindex response.\nIt has meaning only when using the task API, where it indicates the next time (in milliseconds since epoch) that a throttled request will be run again in order to conform to `requests_per_second`.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.EpochTimeUnitMillis"
+ }
+ ]
+ },
+ "timed_out": {
+ "description": "If any of the requests that ran during the reindex timed out, it is `true`.",
+ "type": "boolean"
+ },
+ "took": {
+ "description": "The total milliseconds the entire operation took.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.DurationValueUnitMillis"
+ }
+ ]
+ },
+ "total": {
+ "description": "The number of documents that were successfully processed.",
+ "type": "number"
+ },
+ "updated": {
+ "description": "The number of documents that were successfully updated.\nThat is to say, a document with the same ID already existed before the reindex updated it.",
+ "type": "number"
+ },
+ "version_conflicts": {
+ "description": "The number of version conflicts that occurred.",
+ "type": "number"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 2.3.0",
+ "x-variations": [
+ "\n POST\n /_reindex\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`,`write`\n"
+ ],
+ "x-api": "reindex",
+ "x-category": "document management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _reindex\n{\n \"source\": {\n \"index\": [\"my-index-000001\", \"my-index-000002\"]\n },\n \"dest\": {\n \"index\": \"my-new-index-000002\"\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.reindex(\n source={\n \"index\": [\n \"my-index-000001\",\n \"my-index-000002\"\n ]\n },\n dest={\n \"index\": \"my-new-index-000002\"\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.reindex({\n source: {\n index: [\"my-index-000001\", \"my-index-000002\"],\n },\n dest: {\n index: \"my-new-index-000002\",\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.reindex(\n body: {\n \"source\": {\n \"index\": [\n \"my-index-000001\",\n \"my-index-000002\"\n ]\n },\n \"dest\": {\n \"index\": \"my-new-index-000002\"\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->reindex([\n \"body\" => [\n \"source\" => [\n \"index\" => array(\n \"my-index-000001\",\n \"my-index-000002\",\n ),\n ],\n \"dest\" => [\n \"index\" => \"my-new-index-000002\",\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"source\":{\"index\":[\"my-index-000001\",\"my-index-000002\"]},\"dest\":{\"index\":\"my-new-index-000002\"}}' \"$ELASTICSEARCH_URL/_reindex\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_reindex/{task_id}/_rethrottle": {
+ "post": {
+ "tags": [
+ "document"
+ ],
+ "summary": "Throttle a reindex operation",
+ "description": "Change the number of requests per second for a particular reindex operation.\nFor example:\n\n```\nPOST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1\n```\n\nRethrottling that speeds up the query takes effect immediately.\nRethrottling that slows down the query will take effect after completing the current batch.\nThis behavior prevents scroll timeouts.",
+ "operationId": "reindex-rethrottle",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "task_id",
+ "description": "The task identifier, which can be found by using the tasks API.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "requests_per_second",
+ "description": "The throttle for this request in sub-requests per second.\nIt can be either `-1` to turn off throttling or any decimal number like `1.7` or `12` to throttle to that level.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "nodes": {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/_global.reindex_rethrottle.ReindexNode"
+ }
+ }
+ },
+ "required": [
+ "nodes"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available; Added in 2.4.0",
+ "x-variations": [
+ "\n POST\n /_reindex/{task_id}/_rethrottle\n
\n "
+ ],
+ "x-api": "reindex_rethrottle",
+ "x-category": "document management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.reindex_rethrottle(\n task_id=\"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second=\"-1\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.reindexRethrottle({\n task_id: \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second: \"-1\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.reindex_rethrottle(\n task_id: \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second: \"-1\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->reindexRethrottle([\n \"task_id\" => \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n \"requests_per_second\" => \"-1\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.reindexRethrottle(r -> r\n .requestsPerSecond(-1.0F)\n .taskId(\"r1A2WoRbTwKZ516z6NEs5A:36619\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_render/template": {
+ "get": {
+ "tags": [
+ "search"
+ ],
+ "summary": "Render a search template",
+ "description": "Render a search template as a search request body.",
+ "operationId": "render-search-template",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "description": "The ID of the search template to render.\nIf no `source` is specified, this or the `` request path parameter is required.\nIf you specify both this parameter and the `` parameter, the API uses only ``.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Id"
+ }
+ ]
+ },
+ "file": {
+ "type": "string"
+ },
+ "params": {
+ "description": "Key-value pairs used to replace Mustache variables in the template.\nThe key is the variable name.\nThe value is the variable value.",
+ "type": "object",
+ "additionalProperties": {
+ "type": "object"
+ }
+ },
+ "source": {
+ "description": "An inline search template.\nIt supports the same parameters as the search API's request body.\nThese parameters also support Mustache variables.\nIf no `id` or `` is specified, this parameter is required.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.ScriptSource"
+ }
+ ]
+ }
+ }
+ },
+ "examples": {
+ "RenderSearchTemplateRequestExample1": {
+ "description": "Run `POST _render/template`",
+ "value": "{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "template_output": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "object"
+ }
+ }
+ },
+ "required": [
+ "template_output"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available",
+ "x-variations": [
+ "\n GET\n /_render/template\n
\n ",
+ "\n POST\n /_render/template\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "render_search_template",
+ "x-category": "search",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _render/template\n{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.render_search_template(\n id=\"my-search-template\",\n params={\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.renderSearchTemplate({\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 20,\n size: 10,\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.render_search_template(\n body: {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->renderSearchTemplate([\n \"body\" => [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 20,\n \"size\" => 10,\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":20,\"size\":10}}' \"$ELASTICSEARCH_URL/_render/template\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "post": {
+ "tags": [
+ "search"
+ ],
+ "summary": "Render a search template",
+ "description": "Render a search template as a search request body.",
+ "operationId": "render-search-template-1",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "description": "The ID of the search template to render.\nIf no `source` is specified, this or the `` request path parameter is required.\nIf you specify both this parameter and the `` parameter, the API uses only ``.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Id"
+ }
+ ]
+ },
+ "file": {
+ "type": "string"
+ },
+ "params": {
+ "description": "Key-value pairs used to replace Mustache variables in the template.\nThe key is the variable name.\nThe value is the variable value.",
+ "type": "object",
+ "additionalProperties": {
+ "type": "object"
+ }
+ },
+ "source": {
+ "description": "An inline search template.\nIt supports the same parameters as the search API's request body.\nThese parameters also support Mustache variables.\nIf no `id` or `` is specified, this parameter is required.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.ScriptSource"
+ }
+ ]
+ }
+ }
+ },
+ "examples": {
+ "RenderSearchTemplateRequestExample1": {
+ "description": "Run `POST _render/template`",
+ "value": "{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "template_output": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "object"
+ }
+ }
+ },
+ "required": [
+ "template_output"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available",
+ "x-variations": [
+ "\n GET\n /_render/template\n
\n ",
+ "\n POST\n /_render/template\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "render_search_template",
+ "x-category": "search",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _render/template\n{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.render_search_template(\n id=\"my-search-template\",\n params={\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.renderSearchTemplate({\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 20,\n size: 10,\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.render_search_template(\n body: {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->renderSearchTemplate([\n \"body\" => [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 20,\n \"size\" => 10,\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":20,\"size\":10}}' \"$ELASTICSEARCH_URL/_render/template\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_render/template/{id}": {
+ "get": {
+ "tags": [
+ "search"
+ ],
+ "summary": "Render a search template",
+ "description": "Render a search template as a search request body.",
+ "operationId": "render-search-template-2",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "id",
+ "description": "The ID of the search template to render.\nIf no `source` is specified, this or the `id` request body parameter is required.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "description": "The ID of the search template to render.\nIf no `source` is specified, this or the `` request path parameter is required.\nIf you specify both this parameter and the `` parameter, the API uses only ``.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Id"
+ }
+ ]
+ },
+ "file": {
+ "type": "string"
+ },
+ "params": {
+ "description": "Key-value pairs used to replace Mustache variables in the template.\nThe key is the variable name.\nThe value is the variable value.",
+ "type": "object",
+ "additionalProperties": {
+ "type": "object"
+ }
+ },
+ "source": {
+ "description": "An inline search template.\nIt supports the same parameters as the search API's request body.\nThese parameters also support Mustache variables.\nIf no `id` or `` is specified, this parameter is required.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.ScriptSource"
+ }
+ ]
+ }
+ }
+ },
+ "examples": {
+ "RenderSearchTemplateRequestExample1": {
+ "description": "Run `POST _render/template`",
+ "value": "{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "template_output": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "object"
+ }
+ }
+ },
+ "required": [
+ "template_output"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available",
+ "x-variations": [
+ "\n GET\n /_render/template/{id}\n
\n ",
+ "\n POST\n /_render/template/{id}\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "render_search_template",
+ "x-category": "search",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _render/template\n{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.render_search_template(\n id=\"my-search-template\",\n params={\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.renderSearchTemplate({\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 20,\n size: 10,\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.render_search_template(\n body: {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->renderSearchTemplate([\n \"body\" => [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 20,\n \"size\" => 10,\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":20,\"size\":10}}' \"$ELASTICSEARCH_URL/_render/template\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "post": {
+ "tags": [
+ "search"
+ ],
+ "summary": "Render a search template",
+ "description": "Render a search template as a search request body.",
+ "operationId": "render-search-template-3",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "id",
+ "description": "The ID of the search template to render.\nIf no `source` is specified, this or the `id` request body parameter is required.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "description": "The ID of the search template to render.\nIf no `source` is specified, this or the `` request path parameter is required.\nIf you specify both this parameter and the `` parameter, the API uses only ``.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Id"
+ }
+ ]
+ },
+ "file": {
+ "type": "string"
+ },
+ "params": {
+ "description": "Key-value pairs used to replace Mustache variables in the template.\nThe key is the variable name.\nThe value is the variable value.",
+ "type": "object",
+ "additionalProperties": {
+ "type": "object"
+ }
+ },
+ "source": {
+ "description": "An inline search template.\nIt supports the same parameters as the search API's request body.\nThese parameters also support Mustache variables.\nIf no `id` or `` is specified, this parameter is required.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.ScriptSource"
+ }
+ ]
+ }
+ }
+ },
+ "examples": {
+ "RenderSearchTemplateRequestExample1": {
+ "description": "Run `POST _render/template`",
+ "value": "{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "template_output": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "object"
+ }
+ }
+ },
+ "required": [
+ "template_output"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available",
+ "x-variations": [
+ "\n GET\n /_render/template/{id}\n
\n ",
+ "\n POST\n /_render/template/{id}\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "render_search_template",
+ "x-category": "search",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _render/template\n{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.render_search_template(\n id=\"my-search-template\",\n params={\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.renderSearchTemplate({\n id: \"my-search-template\",\n params: {\n query_string: \"hello world\",\n from: 20,\n size: 10,\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.render_search_template(\n body: {\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 20,\n \"size\": 10\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->renderSearchTemplate([\n \"body\" => [\n \"id\" => \"my-search-template\",\n \"params\" => [\n \"query_string\" => \"hello world\",\n \"from\" => 20,\n \"size\" => 10,\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"id\":\"my-search-template\",\"params\":{\"query_string\":\"hello world\",\"from\":20,\"size\":10}}' \"$ELASTICSEARCH_URL/_render/template\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_rollup/job/{id}": {
+ "get": {
+ "tags": [
+ "rollup"
+ ],
+ "summary": "Get rollup job information",
+ "description": "Get the configuration, stats, and status of rollup jobs.\n\nNOTE: This API returns only active (both `STARTED` and `STOPPED`) jobs.\nIf a job was created, ran for a while, then was deleted, the API does not return any details about it.\nFor details about a historical rollup job, the rollup capabilities API may be more useful.",
+ "operationId": "rollup-get-jobs",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "id",
+ "description": "Identifier for the rollup job.\nIf it is `_all` or omitted, the API returns all rollup jobs.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "jobs": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/rollup.get_jobs.RollupJob"
+ }
+ }
+ },
+ "required": [
+ "jobs"
+ ]
+ },
+ "examples": {
+ "GetRollupJobResponseExample1": {
+ "description": "A successful response from `GET _rollup/job/sensor`.",
+ "value": "{\n \"jobs\": [\n {\n \"config\": {\n \"id\": \"sensor\",\n \"index_pattern\": \"sensor-*\",\n \"rollup_index\": \"sensor_rollup\",\n \"cron\": \"*/30 * * * * ?\",\n \"groups\": {\n \"date_histogram\": {\n \"fixed_interval\": \"1h\",\n \"delay\": \"7d\",\n \"field\": \"timestamp\",\n \"time_zone\": \"UTC\"\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 \"timeout\": \"20s\",\n \"page_size\": 1000\n },\n \"status\": {\n \"job_state\": \"stopped\"\n },\n \"stats\": {\n \"pages_processed\": 0,\n \"documents_processed\": 0,\n \"rollups_indexed\": 0,\n \"trigger_count\": 0,\n \"index_failures\": 0,\n \"index_time_in_ms\": 0,\n \"index_total\": 0,\n \"search_failures\": 0,\n \"search_time_in_ms\": 0,\n \"search_total\": 0,\n \"processing_time_in_ms\": 0,\n \"processing_total\": 0\n }\n }\n ]\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "deprecated": true,
+ "x-state": "Technical preview; Added in 6.3.0",
+ "x-variations": [
+ "\n GET\n /_rollup/job/{id}\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor_rollup`\n"
+ ],
+ "x-api": "get_jobs.rollup",
+ "x-category": "management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _rollup/job/sensor\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.rollup.get_jobs(\n id=\"sensor\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.rollup.getJobs({\n id: \"sensor\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.rollup.get_jobs(\n id: \"sensor\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->rollup()->getJobs([\n \"id\" => \"sensor\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_rollup/job/sensor\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.rollup().getJobs(g -> g\n .id(\"sensor\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "put": {
+ "tags": [
+ "rollup"
+ ],
+ "summary": "Create a rollup job",
+ "description": "WARNING: From 8.15.0, calling this API in a cluster with no rollup usage will fail with a message about the deprecation and planned removal of rollup features. A cluster needs to contain either a rollup job or a rollup index in order for this API to be allowed to run.\n\nThe rollup job configuration contains all the details about how the job should run, when it indexes documents, and what future queries will be able to run against the rollup index.\n\nThere are three main sections to the job configuration: the logistical details about the job (for example, the cron schedule), the fields that are used for grouping, and what metrics to collect for each group.\n\nJobs are created in a `STOPPED` state. You can start them with the start rollup jobs API.",
+ "operationId": "rollup-put-job",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "id",
+ "description": "Identifier for the rollup job. This can be any alphanumeric string and uniquely identifies the\ndata that is associated with the rollup job. The ID is persistent; it is stored with the rolled\nup data. If you create a job, let it run for a while, then delete the job, the data that the job\nrolled up is still be associated with this job ID. You cannot create a new job with the same ID\nsince that could lead to problems with mismatched job configurations.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "cron": {
+ "description": "A cron string which defines the intervals when the rollup job should be executed. When the interval\ntriggers, the indexer attempts to rollup the data in the index pattern. The cron pattern is unrelated\nto the time interval of the data being rolled up. For example, you may wish to create hourly rollups\nof your document but to only run the indexer on a daily basis at midnight, as defined by the cron. The\ncron pattern is defined just like a Watcher cron schedule.",
+ "type": "string"
+ },
+ "groups": {
+ "description": "Defines the grouping fields and aggregations that are defined for this rollup job. These fields will then be\navailable later for aggregating into buckets. These aggs and fields can be used in any combination. Think of\nthe groups configuration as defining a set of tools that can later be used in aggregations to partition the\ndata. Unlike raw data, we have to think ahead to which fields and aggregations might be used. Rollups provide\nenough flexibility that you simply need to determine which fields are needed, not in what order they are needed.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/rollup._types.Groupings"
+ }
+ ]
+ },
+ "index_pattern": {
+ "description": "The index or index pattern to roll up. Supports wildcard-style patterns (`logstash-*`). The job attempts to\nrollup the entire index or index-pattern.",
+ "type": "string"
+ },
+ "metrics": {
+ "description": "Defines the metrics to collect for each grouping tuple. By default, only the doc_counts are collected for each\ngroup. To make rollup useful, you will often add metrics like averages, mins, maxes, etc. Metrics are defined\non a per-field basis and for each field you configure which metric should be collected.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/rollup._types.FieldMetric"
+ }
+ },
+ "page_size": {
+ "description": "The number of bucket results that are processed on each iteration of the rollup indexer. A larger value tends\nto execute faster, but requires more memory during processing. This value has no effect on how the data is\nrolled up; it is merely used for tweaking the speed or memory cost of the indexer.",
+ "type": "number"
+ },
+ "rollup_index": {
+ "description": "The index that contains the rollup results. The index can be shared with other rollup jobs. The data is stored so that it doesn’t interfere with unrelated jobs.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.IndexName"
+ }
+ ]
+ },
+ "timeout": {
+ "description": "Time to wait for the request to complete.",
+ "default": "20s",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Duration"
+ }
+ ]
+ },
+ "headers": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.HttpHeaders"
+ }
+ ]
+ }
+ },
+ "required": [
+ "cron",
+ "groups",
+ "index_pattern",
+ "page_size",
+ "rollup_index"
+ ]
+ },
+ "examples": {
+ "CreateRollupJobRequestExample1": {
+ "description": "Run `PUT _rollup/job/sensor` to create a rollup job that targets the `sensor-*` index pattern. This configuration enables date histograms to be used on the `timestamp` field and terms aggregations to be used on the `node` field. This configuration defines metrics over two fields: `temperature` and `voltage`. For the `temperature` field, it collects the `min`, `max`, and `sum` of the temperature. For `voltage`, it collects the `average`.\n",
+ "value": "{\n \"index_pattern\": \"sensor-*\",\n \"rollup_index\": \"sensor_rollup\",\n \"cron\": \"*/30 * * * * ?\",\n \"page_size\": 1000,\n \"groups\": {\n \"date_histogram\": {\n \"field\": \"timestamp\",\n \"fixed_interval\": \"1h\",\n \"delay\": \"7d\"\n },\n \"terms\": {\n \"fields\": [ \"node\" ]\n }\n },\n \"metrics\": [\n {\n \"field\": \"temperature\",\n \"metrics\": [ \"min\", \"max\", \"sum\" ]\n },\n {\n \"field\": \"voltage\",\n \"metrics\": [ \"avg\" ]\n }\n ]\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_types.AcknowledgedResponseBase"
+ },
+ "examples": {
+ "CreateRollupJobResponseExample1": {
+ "value": "{\n \"acknowledged\": true\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "deprecated": true,
+ "x-state": "Technical preview; Added in 6.3.0",
+ "x-variations": [
+ "\n PUT\n /_rollup/job/{id}\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage`,`manage_rollup`\n"
+ ],
+ "x-api": "put_job.rollup",
+ "x-category": "management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "PUT _rollup/job/sensor\n{\n \"index_pattern\": \"sensor-*\",\n \"rollup_index\": \"sensor_rollup\",\n \"cron\": \"*/30 * * * * ?\",\n \"page_size\": 1000,\n \"groups\": {\n \"date_histogram\": {\n \"field\": \"timestamp\",\n \"fixed_interval\": \"1h\",\n \"delay\": \"7d\"\n },\n \"terms\": {\n \"fields\": [ \"node\" ]\n }\n },\n \"metrics\": [\n {\n \"field\": \"temperature\",\n \"metrics\": [ \"min\", \"max\", \"sum\" ]\n },\n {\n \"field\": \"voltage\",\n \"metrics\": [ \"avg\" ]\n }\n ]\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.rollup.put_job(\n id=\"sensor\",\n index_pattern=\"sensor-*\",\n rollup_index=\"sensor_rollup\",\n cron=\"*/30 * * * * ?\",\n page_size=1000,\n groups={\n \"date_histogram\": {\n \"field\": \"timestamp\",\n \"fixed_interval\": \"1h\",\n \"delay\": \"7d\"\n },\n \"terms\": {\n \"fields\": [\n \"node\"\n ]\n }\n },\n metrics=[\n {\n \"field\": \"temperature\",\n \"metrics\": [\n \"min\",\n \"max\",\n \"sum\"\n ]\n },\n {\n \"field\": \"voltage\",\n \"metrics\": [\n \"avg\"\n ]\n }\n ],\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.rollup.putJob({\n id: \"sensor\",\n index_pattern: \"sensor-*\",\n rollup_index: \"sensor_rollup\",\n cron: \"*/30 * * * * ?\",\n page_size: 1000,\n groups: {\n date_histogram: {\n field: \"timestamp\",\n fixed_interval: \"1h\",\n delay: \"7d\",\n },\n terms: {\n fields: [\"node\"],\n },\n },\n metrics: [\n {\n field: \"temperature\",\n metrics: [\"min\", \"max\", \"sum\"],\n },\n {\n field: \"voltage\",\n metrics: [\"avg\"],\n },\n ],\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.rollup.put_job(\n id: \"sensor\",\n body: {\n \"index_pattern\": \"sensor-*\",\n \"rollup_index\": \"sensor_rollup\",\n \"cron\": \"*/30 * * * * ?\",\n \"page_size\": 1000,\n \"groups\": {\n \"date_histogram\": {\n \"field\": \"timestamp\",\n \"fixed_interval\": \"1h\",\n \"delay\": \"7d\"\n },\n \"terms\": {\n \"fields\": [\n \"node\"\n ]\n }\n },\n \"metrics\": [\n {\n \"field\": \"temperature\",\n \"metrics\": [\n \"min\",\n \"max\",\n \"sum\"\n ]\n },\n {\n \"field\": \"voltage\",\n \"metrics\": [\n \"avg\"\n ]\n }\n ]\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->rollup()->putJob([\n \"id\" => \"sensor\",\n \"body\" => [\n \"index_pattern\" => \"sensor-*\",\n \"rollup_index\" => \"sensor_rollup\",\n \"cron\" => \"*/30 * * * * ?\",\n \"page_size\" => 1000,\n \"groups\" => [\n \"date_histogram\" => [\n \"field\" => \"timestamp\",\n \"fixed_interval\" => \"1h\",\n \"delay\" => \"7d\",\n ],\n \"terms\" => [\n \"fields\" => array(\n \"node\",\n ),\n ],\n ],\n \"metrics\" => array(\n [\n \"field\" => \"temperature\",\n \"metrics\" => array(\n \"min\",\n \"max\",\n \"sum\",\n ),\n ],\n [\n \"field\" => \"voltage\",\n \"metrics\" => array(\n \"avg\",\n ),\n ],\n ),\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_pattern\":\"sensor-*\",\"rollup_index\":\"sensor_rollup\",\"cron\":\"*/30 * * * * ?\",\"page_size\":1000,\"groups\":{\"date_histogram\":{\"field\":\"timestamp\",\"fixed_interval\":\"1h\",\"delay\":\"7d\"},\"terms\":{\"fields\":[\"node\"]}},\"metrics\":[{\"field\":\"temperature\",\"metrics\":[\"min\",\"max\",\"sum\"]},{\"field\":\"voltage\",\"metrics\":[\"avg\"]}]}' \"$ELASTICSEARCH_URL/_rollup/job/sensor\""
+ },
+ {
+ "lang": "Java",
+ "source": "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))\n ),FieldMetric.of(f -> f\n .field(\"voltage\")\n .metrics(Metric.Avg)\n )))\n .pageSize(1000)\n .rollupIndex(\"sensor_rollup\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "delete": {
+ "tags": [
+ "rollup"
+ ],
+ "summary": "Delete a rollup job",
+ "description": "A job must be stopped before it can be deleted.\nIf you attempt to delete a started job, an error occurs.\nSimilarly, if you attempt to delete a nonexistent job, an exception occurs.\n\nIMPORTANT: When you delete a job, you remove only the process that is actively monitoring and rolling up data.\nThe API does not delete any previously rolled up data.\nThis is by design; a user may wish to roll up a static data set.\nBecause the data set is static, after it has been fully rolled up there is no need to keep the indexing rollup job around (as there will be no new data).\nThus the job can be deleted, leaving behind the rolled up data for analysis.\nIf you wish to also remove the rollup data and the rollup index contains the data for only a single job, you can delete the whole rollup index.\nIf the rollup index stores data from several jobs, you must issue a delete-by-query that targets the rollup job's identifier in the rollup index. For example:\n\n```\nPOST my_rollup_index/_delete_by_query\n{\n \"query\": {\n \"term\": {\n \"_rollup.id\": \"the_rollup_job_id\"\n }\n }\n}\n```",
+ "operationId": "rollup-delete-job",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "id",
+ "description": "Identifier for the job.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "acknowledged": {
+ "type": "boolean"
+ },
+ "task_failures": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_types.TaskFailure"
+ }
+ }
+ },
+ "required": [
+ "acknowledged"
+ ]
+ },
+ "examples": {
+ "DeleteRollupJobResponseExample1": {
+ "description": "A successful response from `DELETE _rollup/job/sensor`.",
+ "value": "{\n \"acknowledged\": true\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "deprecated": true,
+ "x-state": "Technical preview; Added in 6.3.0",
+ "x-variations": [
+ "\n DELETE\n /_rollup/job/{id}\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_rollup`\n"
+ ],
+ "x-api": "delete_job.rollup",
+ "x-category": "management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "DELETE _rollup/job/sensor\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.rollup.delete_job(\n id=\"sensor\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.rollup.deleteJob({\n id: \"sensor\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.rollup.delete_job(\n id: \"sensor\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->rollup()->deleteJob([\n \"id\" => \"sensor\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_rollup/job/sensor\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.rollup().deleteJob(d -> d\n .id(\"sensor\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_rollup/job": {
+ "get": {
+ "tags": [
+ "rollup"
+ ],
+ "summary": "Get rollup job information",
+ "description": "Get the configuration, stats, and status of rollup jobs.\n\nNOTE: This API returns only active (both `STARTED` and `STOPPED`) jobs.\nIf a job was created, ran for a while, then was deleted, the API does not return any details about it.\nFor details about a historical rollup job, the rollup capabilities API may be more useful.",
+ "operationId": "rollup-get-jobs-1",
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "jobs": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/rollup.get_jobs.RollupJob"
+ }
+ }
+ },
+ "required": [
+ "jobs"
+ ]
+ },
+ "examples": {
+ "GetRollupJobResponseExample1": {
+ "description": "A successful response from `GET _rollup/job/sensor`.",
+ "value": "{\n \"jobs\": [\n {\n \"config\": {\n \"id\": \"sensor\",\n \"index_pattern\": \"sensor-*\",\n \"rollup_index\": \"sensor_rollup\",\n \"cron\": \"*/30 * * * * ?\",\n \"groups\": {\n \"date_histogram\": {\n \"fixed_interval\": \"1h\",\n \"delay\": \"7d\",\n \"field\": \"timestamp\",\n \"time_zone\": \"UTC\"\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 \"timeout\": \"20s\",\n \"page_size\": 1000\n },\n \"status\": {\n \"job_state\": \"stopped\"\n },\n \"stats\": {\n \"pages_processed\": 0,\n \"documents_processed\": 0,\n \"rollups_indexed\": 0,\n \"trigger_count\": 0,\n \"index_failures\": 0,\n \"index_time_in_ms\": 0,\n \"index_total\": 0,\n \"search_failures\": 0,\n \"search_time_in_ms\": 0,\n \"search_total\": 0,\n \"processing_time_in_ms\": 0,\n \"processing_total\": 0\n }\n }\n ]\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "deprecated": true,
+ "x-state": "Technical preview; Added in 6.3.0",
+ "x-variations": [
+ "\n GET\n /_rollup/job\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor_rollup`\n"
+ ],
+ "x-api": "get_jobs.rollup",
+ "x-category": "management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _rollup/job/sensor\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.rollup.get_jobs(\n id=\"sensor\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.rollup.getJobs({\n id: \"sensor\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.rollup.get_jobs(\n id: \"sensor\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->rollup()->getJobs([\n \"id\" => \"sensor\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_rollup/job/sensor\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.rollup().getJobs(g -> g\n .id(\"sensor\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_rollup/data/{id}": {
+ "get": {
+ "tags": [
+ "rollup"
+ ],
+ "summary": "Get the rollup job capabilities",
+ "description": "Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern.\n\nThis API is useful because a rollup job is often configured to rollup only a subset of fields from the source index.\nFurthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration.\nThis API enables you to inspect an index and determine:\n\n1. Does this index have associated rollup data somewhere in the cluster?\n2. If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live?",
+ "operationId": "rollup-get-rollup-caps",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "id",
+ "description": "Index, indices or index-pattern to return rollup capabilities for.\n`_all` may be used to fetch rollup capabilities from all jobs.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/rollup.get_rollup_caps.RollupCapabilities"
+ }
+ },
+ "examples": {
+ "GetRollupCapabilitiesResponseExample1": {
+ "description": "A successful response from `GET _rollup/data/sensor-*` for a rollup job that targets the index pattern `sensor-*`. The response contains the rollup job ID, the index that holds the rolled data, and the index pattern that the job was targeting. It also shows a list of fields that contain data eligible for rollup searches. For example, you can use a `min`, `max`, or `sum` aggregation on the `temperature` field, but only a `date_histogram` on `timestamp`.\n",
+ "value": "{\n \"sensor-*\" : {\n \"rollup_jobs\" : [\n {\n \"job_id\" : \"sensor\",\n \"rollup_index\" : \"sensor_rollup\",\n \"index_pattern\" : \"sensor-*\",\n \"fields\" : {\n \"node\" : [\n {\n \"agg\" : \"terms\"\n }\n ],\n \"temperature\" : [\n {\n \"agg\" : \"min\"\n },\n {\n \"agg\" : \"max\"\n },\n {\n \"agg\" : \"sum\"\n }\n ],\n \"timestamp\" : [\n {\n \"agg\" : \"date_histogram\",\n \"time_zone\" : \"UTC\",\n \"fixed_interval\" : \"1h\",\n \"delay\": \"7d\"\n }\n ],\n \"voltage\" : [\n {\n \"agg\" : \"avg\"\n }\n ]\n }\n }\n ]\n }\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "deprecated": true,
+ "x-state": "Technical preview; Added in 6.3.0",
+ "x-variations": [
+ "\n GET\n /_rollup/data/{id}\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor_rollup`\n"
+ ],
+ "x-api": "get_rollup_caps.rollup",
+ "x-category": "management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _rollup/data/sensor-*\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.rollup.get_rollup_caps(\n id=\"sensor-*\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.rollup.getRollupCaps({\n id: \"sensor-*\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.rollup.get_rollup_caps(\n id: \"sensor-*\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->rollup()->getRollupCaps([\n \"id\" => \"sensor-*\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_rollup/data/sensor-*\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.rollup().getRollupCaps(g -> g\n .id(\"sensor-*\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_rollup/data": {
+ "get": {
+ "tags": [
+ "rollup"
+ ],
+ "summary": "Get the rollup job capabilities",
+ "description": "Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern.\n\nThis API is useful because a rollup job is often configured to rollup only a subset of fields from the source index.\nFurthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration.\nThis API enables you to inspect an index and determine:\n\n1. Does this index have associated rollup data somewhere in the cluster?\n2. If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live?",
+ "operationId": "rollup-get-rollup-caps-1",
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/rollup.get_rollup_caps.RollupCapabilities"
+ }
+ },
+ "examples": {
+ "GetRollupCapabilitiesResponseExample1": {
+ "description": "A successful response from `GET _rollup/data/sensor-*` for a rollup job that targets the index pattern `sensor-*`. The response contains the rollup job ID, the index that holds the rolled data, and the index pattern that the job was targeting. It also shows a list of fields that contain data eligible for rollup searches. For example, you can use a `min`, `max`, or `sum` aggregation on the `temperature` field, but only a `date_histogram` on `timestamp`.\n",
+ "value": "{\n \"sensor-*\" : {\n \"rollup_jobs\" : [\n {\n \"job_id\" : \"sensor\",\n \"rollup_index\" : \"sensor_rollup\",\n \"index_pattern\" : \"sensor-*\",\n \"fields\" : {\n \"node\" : [\n {\n \"agg\" : \"terms\"\n }\n ],\n \"temperature\" : [\n {\n \"agg\" : \"min\"\n },\n {\n \"agg\" : \"max\"\n },\n {\n \"agg\" : \"sum\"\n }\n ],\n \"timestamp\" : [\n {\n \"agg\" : \"date_histogram\",\n \"time_zone\" : \"UTC\",\n \"fixed_interval\" : \"1h\",\n \"delay\": \"7d\"\n }\n ],\n \"voltage\" : [\n {\n \"agg\" : \"avg\"\n }\n ]\n }\n }\n ]\n }\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "deprecated": true,
+ "x-state": "Technical preview; Added in 6.3.0",
+ "x-variations": [
+ "\n GET\n /_rollup/data\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `monitor_rollup`\n"
+ ],
+ "x-api": "get_rollup_caps.rollup",
+ "x-category": "management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _rollup/data/sensor-*\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.rollup.get_rollup_caps(\n id=\"sensor-*\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.rollup.getRollupCaps({\n id: \"sensor-*\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.rollup.get_rollup_caps(\n id: \"sensor-*\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->rollup()->getRollupCaps([\n \"id\" => \"sensor-*\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_rollup/data/sensor-*\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.rollup().getRollupCaps(g -> g\n .id(\"sensor-*\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/{index}/_rollup/data": {
+ "get": {
+ "tags": [
+ "rollup"
+ ],
+ "summary": "Get the rollup index capabilities",
+ "description": "Get the rollup capabilities of all jobs inside of a rollup index.\nA single rollup index may store the data for multiple rollup jobs and may have a variety of capabilities depending on those jobs. This API enables you to determine:\n\n* What jobs are stored in an index (or indices specified via a pattern)?\n* What target indices were rolled up, what fields were used in those rollups, and what aggregations can be performed on each job?",
+ "operationId": "rollup-get-rollup-index-caps",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "index",
+ "description": "Data stream or index to check for rollup capabilities.\nWildcard (`*`) expressions are supported.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Ids"
+ },
+ "style": "simple"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/rollup.get_rollup_index_caps.IndexCapabilities"
+ }
+ },
+ "examples": {
+ "GetRollupIndexCapabilitiesResponseExample1": {
+ "description": "A successful response from `GET /sensor_rollup/_rollup/data`. The response contains the rollup job ID, the index that holds the rolled data, and the index pattern that the job was targeting. It also shows a list of fields that contain data eligible for rollup searches. For example, you can use a `min`, `max`, or `sum` aggregation on the `temperature` field, but only a `date_histogram` on `timestamp`.\n",
+ "value": "{\n \"sensor_rollup\" : {\n \"rollup_jobs\" : [\n {\n \"job_id\" : \"sensor\",\n \"rollup_index\" : \"sensor_rollup\",\n \"index_pattern\" : \"sensor-*\",\n \"fields\" : {\n \"node\" : [\n {\n \"agg\" : \"terms\"\n }\n ],\n \"temperature\" : [\n {\n \"agg\" : \"min\"\n },\n {\n \"agg\" : \"max\"\n },\n {\n \"agg\" : \"sum\"\n }\n ],\n \"timestamp\" : [\n {\n \"agg\" : \"date_histogram\",\n \"time_zone\" : \"UTC\",\n \"fixed_interval\" : \"1h\",\n \"delay\": \"7d\"\n }\n ],\n \"voltage\" : [\n {\n \"agg\" : \"avg\"\n }\n ]\n }\n }\n ]\n }\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "deprecated": true,
+ "x-state": "Technical preview; Added in 6.4.0",
+ "x-variations": [
+ "\n GET\n /{index}/_rollup/data\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "get_rollup_index_caps.rollup",
+ "x-category": "management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET /sensor_rollup/_rollup/data\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.rollup.get_rollup_index_caps(\n index=\"sensor_rollup\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.rollup.getRollupIndexCaps({\n index: \"sensor_rollup\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.rollup.get_rollup_index_caps(\n index: \"sensor_rollup\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->rollup()->getRollupIndexCaps([\n \"index\" => \"sensor_rollup\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/sensor_rollup/_rollup/data\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.rollup().getRollupIndexCaps(g -> g\n .index(\"sensor_rollup\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/{index}/_rollup_search": {
+ "get": {
+ "tags": [
+ "rollup"
+ ],
+ "summary": "Search rolled-up data",
+ "description": "The rollup search endpoint is needed because, internally, rolled-up documents utilize a different document structure than the original data.\nIt rewrites standard Query DSL into a format that matches the rollup documents then takes the response and rewrites it back to what a client would expect given the original query.\n\nThe request body supports a subset of features from the regular search API.\nThe following functionality is not available:\n\n`size`: Because rollups work on pre-aggregated data, no search hits can be returned and so size must be set to zero or omitted entirely.\n`highlighter`, `suggestors`, `post_filter`, `profile`, `explain`: These are similarly disallowed.\n\nFor more detailed examples of using the rollup search API, including querying rolled-up data only or combining rolled-up and live data, refer to the External documentation.",
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/manage-data/lifecycle/rollup/getting-started-api#historical-only-search-example",
+ "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/rollup-search.html"
+ },
+ "operationId": "rollup-rollup-search",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "index",
+ "description": "A comma-separated list of data streams and indices used to limit the request.\nThis parameter has the following rules:\n\n* At least one data stream, index, or wildcard expression must be specified. This target can include a rollup or non-rollup index. For data streams, the stream's backing indices can only serve as non-rollup indices. Omitting the parameter or using `_all` are not permitted.\n* Multiple non-rollup indices may be specified.\n* Only one rollup index may be specified. If more than one are supplied, an exception occurs.\n* Wildcard expressions (`*`) may be used. If they match more than one rollup index, an exception occurs. However, you can use an expression to match multiple non-rollup indices or data streams.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Indices"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "rest_total_hits_as_int",
+ "description": "Indicates whether hits.total should be rendered as an integer or an object in the rest search response",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "typed_keys",
+ "description": "Specify whether aggregation and suggester names should be prefixed by their respective types in the response",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "aggregations": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/manage-data/lifecycle/rollup/rollup-aggregation-limitations"
+ },
+ "description": "Specifies aggregations.",
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/_types.aggregations.AggregationContainer"
+ }
+ },
+ "query": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/manage-data/lifecycle/rollup/rollup-search-limitations"
+ },
+ "description": "Specifies a DSL query that is subject to some limitations.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.query_dsl.QueryContainer"
+ }
+ ]
+ },
+ "size": {
+ "description": "Must be zero if set, as rollups work on pre-aggregated data.",
+ "type": "number"
+ }
+ }
+ },
+ "examples": {
+ "RollupSearchRequestExample1": {
+ "description": "Search rolled up data stored in `sensor_rollup` with `GET /sensor_rollup/_rollup_search`",
+ "value": "{\n \"size\": 0,\n \"aggregations\": {\n \"max_temperature\": {\n \"max\": {\n \"field\": \"temperature\"\n }\n }\n }\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "took": {
+ "type": "number"
+ },
+ "timed_out": {
+ "type": "boolean"
+ },
+ "terminated_early": {
+ "type": "boolean"
+ },
+ "_shards": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.ShardStatistics"
+ }
+ ]
+ },
+ "hits": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.HitsMetadata"
+ }
+ ]
+ },
+ "aggregations": {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/_types.aggregations.Aggregate"
+ }
+ }
+ },
+ "required": [
+ "took",
+ "timed_out",
+ "_shards",
+ "hits"
+ ]
+ },
+ "examples": {
+ "RollupSearchResponseExample1": {
+ "description": "An abbreviated response from `GET /sensor_rollup/_rollup_search` with a `max` aggregation on a `temperature` field. The response provides some metadata about the request (`took`, `_shards`), the search hits (which is always empty for rollup searches), and the aggregation response.\n",
+ "value": "{\n \"took\" : 102,\n \"timed_out\" : false,\n \"terminated_early\" : false,\n \"_shards\" : {} ,\n \"hits\" : {\n \"total\" : {\n \"value\": 0,\n \"relation\": \"eq\"\n },\n \"max_score\" : 0.0,\n \"hits\" : [ ]\n },\n \"aggregations\" : {\n \"max_temperature\" : {\n \"value\" : 202.0\n }\n }\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "deprecated": true,
+ "x-state": "Technical preview; Added in 6.3.0",
+ "x-variations": [
+ "\n GET\n /{index}/_rollup_search\n
\n ",
+ "\n POST\n /{index}/_rollup_search\n
\n "
+ ],
+ "x-api": "rollup_search.rollup",
+ "x-category": "management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET /sensor_rollup/_rollup_search\n{\n \"size\": 0,\n \"aggregations\": {\n \"max_temperature\": {\n \"max\": {\n \"field\": \"temperature\"\n }\n }\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.rollup.rollup_search(\n index=\"sensor_rollup\",\n size=0,\n aggregations={\n \"max_temperature\": {\n \"max\": {\n \"field\": \"temperature\"\n }\n }\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.rollup.rollupSearch({\n index: \"sensor_rollup\",\n size: 0,\n aggregations: {\n max_temperature: {\n max: {\n field: \"temperature\",\n },\n },\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.rollup.rollup_search(\n index: \"sensor_rollup\",\n body: {\n \"size\": 0,\n \"aggregations\": {\n \"max_temperature\": {\n \"max\": {\n \"field\": \"temperature\"\n }\n }\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->rollup()->rollupSearch([\n \"index\" => \"sensor_rollup\",\n \"body\" => [\n \"size\" => 0,\n \"aggregations\" => [\n \"max_temperature\" => [\n \"max\" => [\n \"field\" => \"temperature\",\n ],\n ],\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"size\":0,\"aggregations\":{\"max_temperature\":{\"max\":{\"field\":\"temperature\"}}}}' \"$ELASTICSEARCH_URL/sensor_rollup/_rollup_search\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "post": {
+ "tags": [
+ "rollup"
+ ],
+ "summary": "Search rolled-up data",
+ "description": "The rollup search endpoint is needed because, internally, rolled-up documents utilize a different document structure than the original data.\nIt rewrites standard Query DSL into a format that matches the rollup documents then takes the response and rewrites it back to what a client would expect given the original query.\n\nThe request body supports a subset of features from the regular search API.\nThe following functionality is not available:\n\n`size`: Because rollups work on pre-aggregated data, no search hits can be returned and so size must be set to zero or omitted entirely.\n`highlighter`, `suggestors`, `post_filter`, `profile`, `explain`: These are similarly disallowed.\n\nFor more detailed examples of using the rollup search API, including querying rolled-up data only or combining rolled-up and live data, refer to the External documentation.",
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/manage-data/lifecycle/rollup/getting-started-api#historical-only-search-example",
+ "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/rollup-search.html"
+ },
+ "operationId": "rollup-rollup-search-1",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "index",
+ "description": "A comma-separated list of data streams and indices used to limit the request.\nThis parameter has the following rules:\n\n* At least one data stream, index, or wildcard expression must be specified. This target can include a rollup or non-rollup index. For data streams, the stream's backing indices can only serve as non-rollup indices. Omitting the parameter or using `_all` are not permitted.\n* Multiple non-rollup indices may be specified.\n* Only one rollup index may be specified. If more than one are supplied, an exception occurs.\n* Wildcard expressions (`*`) may be used. If they match more than one rollup index, an exception occurs. However, you can use an expression to match multiple non-rollup indices or data streams.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Indices"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "rest_total_hits_as_int",
+ "description": "Indicates whether hits.total should be rendered as an integer or an object in the rest search response",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "typed_keys",
+ "description": "Specify whether aggregation and suggester names should be prefixed by their respective types in the response",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "aggregations": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/manage-data/lifecycle/rollup/rollup-aggregation-limitations"
+ },
+ "description": "Specifies aggregations.",
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/_types.aggregations.AggregationContainer"
+ }
+ },
+ "query": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/manage-data/lifecycle/rollup/rollup-search-limitations"
+ },
+ "description": "Specifies a DSL query that is subject to some limitations.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.query_dsl.QueryContainer"
+ }
+ ]
+ },
+ "size": {
+ "description": "Must be zero if set, as rollups work on pre-aggregated data.",
+ "type": "number"
+ }
+ }
+ },
+ "examples": {
+ "RollupSearchRequestExample1": {
+ "description": "Search rolled up data stored in `sensor_rollup` with `GET /sensor_rollup/_rollup_search`",
+ "value": "{\n \"size\": 0,\n \"aggregations\": {\n \"max_temperature\": {\n \"max\": {\n \"field\": \"temperature\"\n }\n }\n }\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "took": {
+ "type": "number"
+ },
+ "timed_out": {
+ "type": "boolean"
+ },
+ "terminated_early": {
+ "type": "boolean"
+ },
+ "_shards": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.ShardStatistics"
+ }
+ ]
+ },
+ "hits": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.HitsMetadata"
+ }
+ ]
+ },
+ "aggregations": {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/_types.aggregations.Aggregate"
+ }
+ }
+ },
+ "required": [
+ "took",
+ "timed_out",
+ "_shards",
+ "hits"
+ ]
+ },
+ "examples": {
+ "RollupSearchResponseExample1": {
+ "description": "An abbreviated response from `GET /sensor_rollup/_rollup_search` with a `max` aggregation on a `temperature` field. The response provides some metadata about the request (`took`, `_shards`), the search hits (which is always empty for rollup searches), and the aggregation response.\n",
+ "value": "{\n \"took\" : 102,\n \"timed_out\" : false,\n \"terminated_early\" : false,\n \"_shards\" : {} ,\n \"hits\" : {\n \"total\" : {\n \"value\": 0,\n \"relation\": \"eq\"\n },\n \"max_score\" : 0.0,\n \"hits\" : [ ]\n },\n \"aggregations\" : {\n \"max_temperature\" : {\n \"value\" : 202.0\n }\n }\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "deprecated": true,
+ "x-state": "Technical preview; Added in 6.3.0",
+ "x-variations": [
+ "\n GET\n /{index}/_rollup_search\n
\n ",
+ "\n POST\n /{index}/_rollup_search\n
\n "
+ ],
+ "x-api": "rollup_search.rollup",
+ "x-category": "management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET /sensor_rollup/_rollup_search\n{\n \"size\": 0,\n \"aggregations\": {\n \"max_temperature\": {\n \"max\": {\n \"field\": \"temperature\"\n }\n }\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.rollup.rollup_search(\n index=\"sensor_rollup\",\n size=0,\n aggregations={\n \"max_temperature\": {\n \"max\": {\n \"field\": \"temperature\"\n }\n }\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.rollup.rollupSearch({\n index: \"sensor_rollup\",\n size: 0,\n aggregations: {\n max_temperature: {\n max: {\n field: \"temperature\",\n },\n },\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.rollup.rollup_search(\n index: \"sensor_rollup\",\n body: {\n \"size\": 0,\n \"aggregations\": {\n \"max_temperature\": {\n \"max\": {\n \"field\": \"temperature\"\n }\n }\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->rollup()->rollupSearch([\n \"index\" => \"sensor_rollup\",\n \"body\" => [\n \"size\" => 0,\n \"aggregations\" => [\n \"max_temperature\" => [\n \"max\" => [\n \"field\" => \"temperature\",\n ],\n ],\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"size\":0,\"aggregations\":{\"max_temperature\":{\"max\":{\"field\":\"temperature\"}}}}' \"$ELASTICSEARCH_URL/sensor_rollup/_rollup_search\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_rollup/job/{id}/_start": {
+ "post": {
+ "tags": [
+ "rollup"
+ ],
+ "summary": "Start rollup jobs",
+ "description": "If you try to start a job that does not exist, an exception occurs.\nIf you try to start a job that is already started, nothing happens.",
+ "operationId": "rollup-start-job",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "id",
+ "description": "Identifier for the rollup job.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "started": {
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "started"
+ ]
+ },
+ "examples": {
+ "StartRollupJobResponseExample1": {
+ "description": "A successful response from `POST _rollup/job/sensor/_start`.",
+ "value": "{\n \"started\": true\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "deprecated": true,
+ "x-state": "Technical preview; Added in 6.3.0",
+ "x-variations": [
+ "\n POST\n /_rollup/job/{id}/_start\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_rollup`\n"
+ ],
+ "x-api": "start_job.rollup",
+ "x-category": "management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _rollup/job/sensor/_start\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.rollup.start_job(\n id=\"sensor\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.rollup.startJob({\n id: \"sensor\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.rollup.start_job(\n id: \"sensor\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->rollup()->startJob([\n \"id\" => \"sensor\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_rollup/job/sensor/_start\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.rollup().startJob(s -> s\n .id(\"sensor\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_rollup/job/{id}/_stop": {
+ "post": {
+ "tags": [
+ "rollup"
+ ],
+ "summary": "Stop rollup jobs",
+ "description": "If you try to stop a job that does not exist, an exception occurs.\nIf you try to stop a job that is already stopped, nothing happens.\n\nSince only a stopped job can be deleted, it can be useful to block the API until the indexer has fully stopped.\nThis is accomplished with the `wait_for_completion` query parameter, and optionally a timeout. For example:\n\n```\nPOST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s\n```\nThe parameter blocks the API call from returning until either the job has moved to STOPPED or the specified time has elapsed.\nIf the specified time elapses without the job moving to STOPPED, a timeout exception occurs.",
+ "operationId": "rollup-stop-job",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "id",
+ "description": "Identifier for the rollup job.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Id"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "If `wait_for_completion` is `true`, the API blocks for (at maximum) the specified duration while waiting for the job to stop.\nIf more than `timeout` time has passed, the API throws a timeout exception.\nNOTE: Even if a timeout occurs, the stop request is still processing and eventually moves the job to STOPPED.\nThe timeout simply means the API call itself timed out while waiting for the status change.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "wait_for_completion",
+ "description": "If set to `true`, causes the API to block until the indexer state completely stops.\nIf set to `false`, the API returns immediately and the indexer is stopped asynchronously in the background.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "stopped": {
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "stopped"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "deprecated": true,
+ "x-state": "Technical preview; Added in 6.3.0",
+ "x-variations": [
+ "\n POST\n /_rollup/job/{id}/_stop\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_rollup`\n"
+ ],
+ "x-api": "stop_job.rollup",
+ "x-category": "management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.rollup.stop_job(\n id=\"sensor\",\n wait_for_completion=True,\n timeout=\"10s\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.rollup.stopJob({\n id: \"sensor\",\n wait_for_completion: \"true\",\n timeout: \"10s\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.rollup.stop_job(\n id: \"sensor\",\n wait_for_completion: \"true\",\n timeout: \"10s\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->rollup()->stopJob([\n \"id\" => \"sensor\",\n \"wait_for_completion\" => \"true\",\n \"timeout\" => \"10s\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.rollup().stopJob(s -> s\n .id(\"sensor\")\n .timeout(t -> t\n .offset(10)\n )\n .waitForCompletion(true)\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_scripts/painless/_execute": {
+ "get": {
+ "tags": [
+ "script"
+ ],
+ "summary": "Run a script",
+ "description": "Runs a script and returns a result.\nUse this API to build and test scripts, such as when defining a script for a runtime field.\nThis API requires very few dependencies and is especially useful if you don't have permissions to write documents on a cluster.\n\nThe API uses several _contexts_, which control how scripts are run, what variables are available at runtime, and what the return type is.\n\nEach context requires a script, but additional parameters depend on the context you're using for that script.",
+ "operationId": "scripts-painless-execute",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "context": {
+ "description": "The context that the script should run in.\nNOTE: Result ordering in the field contexts is not guaranteed.\n\nSupported values include:\n - `painless_test`: The default context if no other context is specified.\n - `filter`: Treats scripts as if they were run inside a script query.\n - `score`: Treats scripts as if they were run inside a `script_score` function in a `function_score` query.\n - `boolean_field`: The context for boolean fields. The script returns a `true` or `false` response.\n - `date_field`: The context for date fields. `emit` takes a long value and the script returns a sorted list of dates.\n - `double_field`: The context for double numeric fields. The script returns a sorted list of double values.\n - `geo_point_field`: The context for geo-point fields. `emit` takes two double parameters, the latitude and longitude values, and the script returns an object in GeoJSON format containing the coordinates for the geo point.\n - `ip_field`: The context for `ip` fields. The script returns a sorted list of IP addresses.\n - `keyword_field`: The context for keyword fields. The script returns a sorted list of string values.\n - `long_field`: The context for long numeric fields. The script returns a sorted list of long values.\n - `composite_field`: The context for composite runtime fields. The script returns a map of values.\n\n",
+ "default": "painless_test",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.scripts_painless_execute.PainlessContext"
+ }
+ ]
+ },
+ "context_setup": {
+ "description": "Additional parameters for the `context`.\nNOTE: This parameter is required for all contexts except `painless_test`, which is the default if no value is provided for `context`.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.scripts_painless_execute.PainlessContextSetup"
+ }
+ ]
+ },
+ "script": {
+ "description": "The Painless script to run.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Script"
+ }
+ ]
+ }
+ }
+ },
+ "examples": {
+ "ExecutePainlessScriptRequestExample1": {
+ "summary": "Test context",
+ "description": "Run `POST /_scripts/painless/_execute`. The `painless_test` context is the default context. It runs scripts without additional parameters. The only variable that is available is `params`, which can be used to access user defined values. The result of the script is always converted to a string.\n",
+ "value": "{\n \"script\": {\n \"source\": \"params.count / params.total\",\n \"params\": {\n \"count\": 100.0,\n \"total\": 1000.0\n }\n }\n}"
+ },
+ "ExecutePainlessScriptRequestExample2": {
+ "summary": "Filter context",
+ "description": "Run `POST /_scripts/painless/_execute` with a `filter` context. It treats scripts as if they were run inside a script query. For testing purposes, a document must be provided so that it will be temporarily indexed in-memory and is accessible from the script. More precisely, the `_source`, stored fields, and doc values of such a document are available to the script being tested.\n",
+ "value": "{\n \"script\": {\n \"source\": \"doc['field'].value.length() <= params.max_length\",\n \"params\": {\n \"max_length\": 4\n }\n },\n \"context\": \"filter\",\n \"context_setup\": {\n \"index\": \"my-index-000001\",\n \"document\": {\n \"field\": \"four\"\n }\n }\n}"
+ },
+ "ExecutePainlessScriptRequestExample3": {
+ "summary": "Score context",
+ "description": "Run `POST /_scripts/painless/_execute` with a `score` context. It treats scripts as if they were run inside a `script_score` function in a `function_score` query.\n",
+ "value": "{\n \"script\": {\n \"source\": \"doc['rank'].value / params.max_rank\",\n \"params\": {\n \"max_rank\": 5.0\n }\n },\n \"context\": \"score\",\n \"context_setup\": {\n \"index\": \"my-index-000001\",\n \"document\": {\n \"rank\": 4\n }\n }\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "result": {
+ "type": "object"
+ }
+ },
+ "required": [
+ "result"
+ ]
+ },
+ "examples": {
+ "ExecutePainlessScriptResponseExample1": {
+ "summary": "Test context",
+ "description": "A successful response from `POST /_scripts/painless/_execute` with a `painless_test` context.",
+ "value": "{\n \"result\": \"0.1\"\n}"
+ },
+ "ExecutePainlessScriptResponseExample2": {
+ "summary": "Filter context",
+ "description": "A successful response from `POST /_scripts/painless/_execute` with a `filter` context.",
+ "value": "{\n \"result\": true\n}"
+ },
+ "ExecutePainlessScriptResponseExample3": {
+ "summary": "Score context",
+ "description": "A successful response from `POST /_scripts/painless/_execute` with a `score` context.",
+ "value": "{\n \"result\": 0.8\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Technical preview; Added in 6.3.0",
+ "x-variations": [
+ "\n GET\n /_scripts/painless/_execute\n
\n ",
+ "\n POST\n /_scripts/painless/_execute\n
\n "
+ ],
+ "x-api": "scripts_painless_execute",
+ "x-category": "unknown",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST /_scripts/painless/_execute\n{\n \"script\": {\n \"source\": \"params.count / params.total\",\n \"params\": {\n \"count\": 100.0,\n \"total\": 1000.0\n }\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.scripts_painless_execute(\n script={\n \"source\": \"params.count / params.total\",\n \"params\": {\n \"count\": 100,\n \"total\": 1000\n }\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.scriptsPainlessExecute({\n script: {\n source: \"params.count / params.total\",\n params: {\n count: 100,\n total: 1000,\n },\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.scripts_painless_execute(\n body: {\n \"script\": {\n \"source\": \"params.count / params.total\",\n \"params\": {\n \"count\": 100,\n \"total\": 1000\n }\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->scriptsPainlessExecute([\n \"body\" => [\n \"script\" => [\n \"source\" => \"params.count / params.total\",\n \"params\" => [\n \"count\" => 100,\n \"total\" => 1000,\n ],\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"source\":\"params.count / params.total\",\"params\":{\"count\":100,\"total\":1000}}}' \"$ELASTICSEARCH_URL/_scripts/painless/_execute\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "post": {
+ "tags": [
+ "script"
+ ],
+ "summary": "Run a script",
+ "description": "Runs a script and returns a result.\nUse this API to build and test scripts, such as when defining a script for a runtime field.\nThis API requires very few dependencies and is especially useful if you don't have permissions to write documents on a cluster.\n\nThe API uses several _contexts_, which control how scripts are run, what variables are available at runtime, and what the return type is.\n\nEach context requires a script, but additional parameters depend on the context you're using for that script.",
+ "operationId": "scripts-painless-execute-1",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "context": {
+ "description": "The context that the script should run in.\nNOTE: Result ordering in the field contexts is not guaranteed.\n\nSupported values include:\n - `painless_test`: The default context if no other context is specified.\n - `filter`: Treats scripts as if they were run inside a script query.\n - `score`: Treats scripts as if they were run inside a `script_score` function in a `function_score` query.\n - `boolean_field`: The context for boolean fields. The script returns a `true` or `false` response.\n - `date_field`: The context for date fields. `emit` takes a long value and the script returns a sorted list of dates.\n - `double_field`: The context for double numeric fields. The script returns a sorted list of double values.\n - `geo_point_field`: The context for geo-point fields. `emit` takes two double parameters, the latitude and longitude values, and the script returns an object in GeoJSON format containing the coordinates for the geo point.\n - `ip_field`: The context for `ip` fields. The script returns a sorted list of IP addresses.\n - `keyword_field`: The context for keyword fields. The script returns a sorted list of string values.\n - `long_field`: The context for long numeric fields. The script returns a sorted list of long values.\n - `composite_field`: The context for composite runtime fields. The script returns a map of values.\n\n",
+ "default": "painless_test",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.scripts_painless_execute.PainlessContext"
+ }
+ ]
+ },
+ "context_setup": {
+ "description": "Additional parameters for the `context`.\nNOTE: This parameter is required for all contexts except `painless_test`, which is the default if no value is provided for `context`.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.scripts_painless_execute.PainlessContextSetup"
+ }
+ ]
+ },
+ "script": {
+ "description": "The Painless script to run.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Script"
+ }
+ ]
+ }
+ }
+ },
+ "examples": {
+ "ExecutePainlessScriptRequestExample1": {
+ "summary": "Test context",
+ "description": "Run `POST /_scripts/painless/_execute`. The `painless_test` context is the default context. It runs scripts without additional parameters. The only variable that is available is `params`, which can be used to access user defined values. The result of the script is always converted to a string.\n",
+ "value": "{\n \"script\": {\n \"source\": \"params.count / params.total\",\n \"params\": {\n \"count\": 100.0,\n \"total\": 1000.0\n }\n }\n}"
+ },
+ "ExecutePainlessScriptRequestExample2": {
+ "summary": "Filter context",
+ "description": "Run `POST /_scripts/painless/_execute` with a `filter` context. It treats scripts as if they were run inside a script query. For testing purposes, a document must be provided so that it will be temporarily indexed in-memory and is accessible from the script. More precisely, the `_source`, stored fields, and doc values of such a document are available to the script being tested.\n",
+ "value": "{\n \"script\": {\n \"source\": \"doc['field'].value.length() <= params.max_length\",\n \"params\": {\n \"max_length\": 4\n }\n },\n \"context\": \"filter\",\n \"context_setup\": {\n \"index\": \"my-index-000001\",\n \"document\": {\n \"field\": \"four\"\n }\n }\n}"
+ },
+ "ExecutePainlessScriptRequestExample3": {
+ "summary": "Score context",
+ "description": "Run `POST /_scripts/painless/_execute` with a `score` context. It treats scripts as if they were run inside a `script_score` function in a `function_score` query.\n",
+ "value": "{\n \"script\": {\n \"source\": \"doc['rank'].value / params.max_rank\",\n \"params\": {\n \"max_rank\": 5.0\n }\n },\n \"context\": \"score\",\n \"context_setup\": {\n \"index\": \"my-index-000001\",\n \"document\": {\n \"rank\": 4\n }\n }\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "result": {
+ "type": "object"
+ }
+ },
+ "required": [
+ "result"
+ ]
+ },
+ "examples": {
+ "ExecutePainlessScriptResponseExample1": {
+ "summary": "Test context",
+ "description": "A successful response from `POST /_scripts/painless/_execute` with a `painless_test` context.",
+ "value": "{\n \"result\": \"0.1\"\n}"
+ },
+ "ExecutePainlessScriptResponseExample2": {
+ "summary": "Filter context",
+ "description": "A successful response from `POST /_scripts/painless/_execute` with a `filter` context.",
+ "value": "{\n \"result\": true\n}"
+ },
+ "ExecutePainlessScriptResponseExample3": {
+ "summary": "Score context",
+ "description": "A successful response from `POST /_scripts/painless/_execute` with a `score` context.",
+ "value": "{\n \"result\": 0.8\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Technical preview; Added in 6.3.0",
+ "x-variations": [
+ "\n GET\n /_scripts/painless/_execute\n
\n ",
+ "\n POST\n /_scripts/painless/_execute\n
\n "
+ ],
+ "x-api": "scripts_painless_execute",
+ "x-category": "unknown",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST /_scripts/painless/_execute\n{\n \"script\": {\n \"source\": \"params.count / params.total\",\n \"params\": {\n \"count\": 100.0,\n \"total\": 1000.0\n }\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.scripts_painless_execute(\n script={\n \"source\": \"params.count / params.total\",\n \"params\": {\n \"count\": 100,\n \"total\": 1000\n }\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.scriptsPainlessExecute({\n script: {\n source: \"params.count / params.total\",\n params: {\n count: 100,\n total: 1000,\n },\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.scripts_painless_execute(\n body: {\n \"script\": {\n \"source\": \"params.count / params.total\",\n \"params\": {\n \"count\": 100,\n \"total\": 1000\n }\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->scriptsPainlessExecute([\n \"body\" => [\n \"script\" => [\n \"source\" => \"params.count / params.total\",\n \"params\" => [\n \"count\" => 100,\n \"total\" => 1000,\n ],\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"script\":{\"source\":\"params.count / params.total\",\"params\":{\"count\":100,\"total\":1000}}}' \"$ELASTICSEARCH_URL/_scripts/painless/_execute\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_search": {
+ "get": {
+ "tags": [
+ "search"
+ ],
+ "summary": "Run a search",
+ "description": "Get search hits that match the query defined in the request.\nYou can provide search queries using the `q` query string parameter or the request body.\nIf both are specified, only the query parameter is used.\n\nIf the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges.\nTo search a point in time (PIT) for an alias, you must have the `read` index privilege for the alias's data streams or indices.\n\n**Search slicing**\n\nWhen paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the `slice` and `pit` properties.\nBy default the splitting is done first on the shards, then locally on each shard.\nThe local splitting partitions the shard into contiguous ranges based on Lucene document IDs.\n\nFor instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard.\n\nIMPORTANT: The same point-in-time ID should be used for all slices.\nIf different PIT IDs are used, slices can overlap and miss documents.\nThis situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index.",
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/deploy-manage/remote-clusters/remote-clusters-cert#remote-clusters-privileges-ccs",
+ "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/search-search.html"
+ },
+ "operationId": "search",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "allow_no_indices",
+ "description": "If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices.\nThis behavior applies even if the request targets other open indices.\nFor example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "allow_partial_search_results",
+ "description": "If `true` and there are shard request timeouts or shard failures, the request returns partial results.\nIf `false`, it returns an error with no partial results.\n\nTo override the default behavior, you can set the `search.default_allow_partial_results` cluster setting to `false`.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "analyzer",
+ "description": "The analyzer to use for the query string.\nThis parameter can be used only when the `q` query string parameter is specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "analyze_wildcard",
+ "description": "If `true`, wildcard and prefix queries are analyzed.\nThis parameter can be used only when the `q` query string parameter is specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "batched_reduce_size",
+ "description": "The number of shard results that should be reduced at once on the coordinating node.\nIf the potential number of shards in the request can be large, this value should be used as a protection mechanism to reduce the memory overhead per search request.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ccs_minimize_roundtrips",
+ "description": "If `true`, network round-trips between the coordinating node and the remote clusters are minimized when running cross-cluster search (CCS) requests.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "default_operator",
+ "description": "The default operator for the query string query: `and` or `or`.\nThis parameter can be used only when the `q` query string parameter is specified.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.query_dsl.Operator"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "df",
+ "description": "The field to use as a default when no field prefix is given in the query string.\nThis parameter can be used only when the `q` query string parameter is specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "docvalue_fields",
+ "description": "A comma-separated list of fields to return as the docvalue representation of a field for each hit.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "expand_wildcards",
+ "description": "The type of index that wildcard patterns can match.\nIf the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.\nIt supports comma-separated values such as `open,hidden`.\n\nSupported values include:\n - `all`: Match any data stream or index, including hidden ones.\n - `open`: Match open, non-hidden indices. Also matches any non-hidden data stream.\n - `closed`: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.\n - `hidden`: Match hidden data streams and hidden indices. Must be combined with `open`, `closed`, or `both`.\n - `none`: Wildcard expressions are not accepted.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.ExpandWildcards"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "explain",
+ "description": "If `true`, the request returns detailed information about score computation as part of a hit.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ignore_throttled",
+ "description": "If `true`, concrete, expanded or aliased indices will be ignored when frozen.",
+ "deprecated": true,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ignore_unavailable",
+ "description": "If `false`, the request returns an error if it targets a missing or closed index.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "include_named_queries_score",
+ "description": "If `true`, the response includes the score contribution from any named queries.\n\nThis functionality reruns each named query on every hit in a search response.\nTypically, this adds a small overhead to a request.\nHowever, using computationally expensive named queries on a large number of hits may add significant overhead.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "lenient",
+ "description": "If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored.\nThis parameter can be used only when the `q` query string parameter is specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "max_concurrent_shard_requests",
+ "description": "The number of concurrent shard requests per node that the search runs concurrently.\nThis value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "preference",
+ "description": "The nodes and shards used for the search.\nBy default, Elasticsearch selects from eligible nodes and shards using adaptive replica selection, accounting for allocation awareness.\nValid values are:\n\n* `_only_local` to run the search only on shards on the local node.\n* `_local` to, if possible, run the search on shards on the local node, or if not, select shards using the default method.\n* `_only_nodes:,` to run the search on only the specified nodes IDs. If suitable shards exist on more than one selected node, use shards on those nodes using the default method. If none of the specified nodes are available, select shards from any available node using the default method.\n* `_prefer_nodes:,` to if possible, run the search on the specified nodes IDs. If not, select shards using the default method.\n* `_shards:,` to run the search only on the specified shards. You can combine this value with other `preference` values. However, the `_shards` value must come first. For example: `_shards:2,3|_local`.\n* `` (any string that does not start with `_`) to route searches with the same `` to the same shards in the same order.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "pre_filter_shard_size",
+ "description": "A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold.\nThis filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method (if date filters are mandatory to match but the shard bounds and the query are disjoint).\nWhen unspecified, the pre-filter phase is executed if any of these conditions is met:\n\n* The request targets more than 128 shards.\n* The request targets one or more read-only index.\n* The primary sort of the query targets an indexed field.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "request_cache",
+ "description": "If `true`, the caching of search results is enabled for requests where `size` is `0`.\nIt defaults to index level settings.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "routing",
+ "description": "A custom value that is used to route operations to a specific shard.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Routing"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "scroll",
+ "description": "The period to retain the search context for scrolling.\nBy default, this value cannot exceed `1d` (24 hours).\nYou can change this limit by using the `search.max_keep_alive` cluster-level setting.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "search_type",
+ "description": "Indicates how distributed term frequencies are calculated for relevance scoring.\n\nSupported values include:\n - `query_then_fetch`: Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate.\n - `dfs_query_then_fetch`: Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.SearchType"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "stats",
+ "description": "Specific `tag` of the request for logging and statistical purposes.",
+ "deprecated": false,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "stored_fields",
+ "description": "A comma-separated list of stored fields to return as part of a hit.\nIf no fields are specified, no stored fields are included in the response.\nIf this field is specified, the `_source` parameter defaults to `false`.\nYou can pass `_source: true` to return both source fields and stored fields in the search response.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "suggest_field",
+ "description": "The field to use for suggestions.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Field"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "suggest_mode",
+ "description": "The suggest mode.\nThis parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified.\n\nSupported values include:\n - `missing`: Only generate suggestions for terms that are not in the shard.\n - `popular`: Only suggest terms that occur in more docs on the shard than the original term.\n - `always`: Suggest any matching suggestions based on terms in the suggest text.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.SuggestMode"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "suggest_size",
+ "description": "The number of suggestions to return.\nThis parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "suggest_text",
+ "description": "The source text for which the suggestions should be returned.\nThis parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "terminate_after",
+ "description": "The maximum number of documents to collect for each shard.\nIf a query reaches this limit, Elasticsearch terminates the query early.\nElasticsearch collects documents before sorting.\n\nIMPORTANT: Use with caution.\nElasticsearch applies this parameter to each shard handling the request.\nWhen possible, let Elasticsearch perform early termination automatically.\nAvoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers.\nIf set to `0` (default), the query does not terminate early.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "The period of time to wait for a response from each shard.\nIf no response is received before the timeout expires, the request fails and returns an error.\nIt defaults to no timeout.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "track_total_hits",
+ "description": "The number of hits matching the query to count accurately.\nIf `true`, the exact number of hits is returned at the cost of some performance.\nIf `false`, the response does not include the total number of hits matching the query.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_global.search._types.TrackHits"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "track_scores",
+ "description": "If `true`, the request calculates and returns document scores, even if the scores are not used for sorting.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "typed_keys",
+ "description": "If `true`, aggregation and suggester names are be prefixed by their respective types in the response.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "rest_total_hits_as_int",
+ "description": "Indicates whether `hits.total` should be rendered as an integer or an object in the rest search response.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "version",
+ "description": "If `true`, the request returns the document version as part of a hit.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "_source",
+ "description": "The source fields that are returned for matching documents.\nThese fields are returned in the `hits._source` property of the search response.\nValid values are:\n\n* `true` to return the entire document source.\n* `false` to not return the document source.\n* `` to return the source fields that are specified as a comma-separated list that supports wildcard (`*`) patterns.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_global.search._types.SourceConfigParam"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "_source_excludes",
+ "description": "A comma-separated list of source fields to exclude from the response.\nYou can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter.\nIf the `_source` parameter is `false`, this parameter is ignored.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "_source_exclude_vectors",
+ "description": "Whether vectors should be excluded from _source",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "x-state": "Generally available; Added in 9.2.0",
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "_source_includes",
+ "description": "A comma-separated list of source fields to include in the response.\nIf this parameter is specified, only these source fields are returned.\nYou can exclude fields from this subset using the `_source_excludes` query parameter.\nIf the `_source` parameter is `false`, this parameter is ignored.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "seq_no_primary_term",
+ "description": "If `true`, the request returns the sequence number and primary term of the last modification of each hit.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "q",
+ "description": "A query in the Lucene query string syntax.\nQuery parameter searches do not support the full Elasticsearch Query DSL but are handy for testing.\n\nIMPORTANT: This parameter overrides the query parameter in the request body.\nIf both parameters are specified, documents matching the query request body parameter are not returned.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "size",
+ "description": "The number of hits to return.\nBy default, you cannot page through more than 10,000 hits using the `from` and `size` parameters.\nTo page through more hits, use the `search_after` parameter.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "from",
+ "description": "The starting document offset, which must be non-negative.\nBy default, you cannot page through more than 10,000 hits using the `from` and `size` parameters.\nTo page through more hits, use the `search_after` parameter.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "sort",
+ "description": "A comma-separated list of `:` pairs.",
+ "deprecated": false,
+ "schema": {
+ "oneOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ ]
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "aggregations": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/explore-analyze/query-filter/aggregations"
+ },
+ "description": "Defines the aggregations that are run as part of the search request.",
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/_types.aggregations.AggregationContainer"
+ }
+ },
+ "collapse": {
+ "description": "Collapses search results the values of the specified field.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.FieldCollapse"
+ }
+ ]
+ },
+ "explain": {
+ "description": "If `true`, the request returns detailed information about score computation as part of a hit.",
+ "default": false,
+ "type": "boolean"
+ },
+ "ext": {
+ "description": "Configuration of search extensions defined by Elasticsearch plugins.",
+ "type": "object",
+ "additionalProperties": {
+ "type": "object"
+ }
+ },
+ "from": {
+ "description": "The starting document offset, which must be non-negative.\nBy default, you cannot page through more than 10,000 hits using the `from` and `size` parameters.\nTo page through more hits, use the `search_after` parameter.",
+ "default": 0.0,
+ "type": "number"
+ },
+ "highlight": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/highlighting"
+ },
+ "description": "Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.Highlight"
+ }
+ ]
+ },
+ "track_total_hits": {
+ "description": "Number of hits matching the query to count accurately.\nIf `true`, the exact number of hits is returned at the cost of some performance.\nIf `false`, the response does not include the total number of hits matching the query.",
+ "default": "10000",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.TrackHits"
+ }
+ ]
+ },
+ "indices_boost": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/explore-analyze/query-filter/languages/querydsl#relevance-scores"
+ },
+ "description": "Boost the `_score` of documents from specified indices.\nThe boost value is the factor by which scores are multiplied.\nA boost value greater than `1.0` increases the score.\nA boost value between `0` and `1.0` decreases the score.",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "number"
+ },
+ "minProperties": 1,
+ "maxProperties": 1
+ }
+ },
+ "docvalue_fields": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/retrieve-selected-fields#docvalue-fields"
+ },
+ "description": "An array of wildcard (`*`) field patterns.\nThe request returns doc values for field names matching these patterns in the `hits.fields` property of the response.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_types.query_dsl.FieldAndFormat"
+ }
+ },
+ "knn": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/solutions/search/vector/knn#approximate-knn"
+ },
+ "description": "The approximate kNN search to run.",
+ "x-state": "Generally available; Added in 8.4.0",
+ "oneOf": [
+ {
+ "$ref": "#/components/schemas/_types.KnnSearch"
+ },
+ {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_types.KnnSearch"
+ }
+ }
+ ]
+ },
+ "rank": {
+ "description": "The Reciprocal Rank Fusion (RRF) to use.",
+ "x-state": "Generally available; Added in 8.8.0",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.RankContainer"
+ }
+ ]
+ },
+ "min_score": {
+ "description": "The minimum `_score` for matching documents.\nDocuments with a lower `_score` are not included in search results and results collected by aggregations.",
+ "type": "number"
+ },
+ "post_filter": {
+ "description": "Use the `post_filter` parameter to filter search results.\nThe search hits are filtered after the aggregations are calculated.\nA post filter has no impact on the aggregation results.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.query_dsl.QueryContainer"
+ }
+ ]
+ },
+ "profile": {
+ "description": "Set to `true` to return detailed timing information about the execution of individual components in a search request.\nNOTE: This is a debugging tool and adds significant overhead to search execution.",
+ "default": false,
+ "type": "boolean"
+ },
+ "query": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/explore-analyze/query-filter/languages/querydsl"
+ },
+ "description": "The search definition using the Query DSL.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.query_dsl.QueryContainer"
+ }
+ ]
+ },
+ "rescore": {
+ "description": "Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the `query` and `post_filter` phases.",
+ "oneOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.Rescore"
+ },
+ {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_global.search._types.Rescore"
+ }
+ }
+ ]
+ },
+ "retriever": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/retrievers"
+ },
+ "description": "A retriever is a specification to describe top documents returned from a search.\nA retriever replaces other elements of the search API that also return top documents such as `query` and `knn`.",
+ "x-state": "Generally available; Added in 8.14.0",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.RetrieverContainer"
+ }
+ ]
+ },
+ "script_fields": {
+ "description": "Retrieve a script evaluation (based on different fields) for each hit.",
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/_types.ScriptField"
+ }
+ },
+ "search_after": {
+ "description": "Used to retrieve the next page of hits using a set of sort values from the previous page.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.SortResults"
+ }
+ ]
+ },
+ "size": {
+ "description": "The number of hits to return, which must not be negative.\nBy default, you cannot page through more than 10,000 hits using the `from` and `size` parameters.\nTo page through more hits, use the `search_after` property.",
+ "default": 10.0,
+ "type": "number"
+ },
+ "slice": {
+ "description": "Split a scrolled search into multiple slices that can be consumed independently.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.SlicedScroll"
+ }
+ ]
+ },
+ "sort": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/sort-search-results"
+ },
+ "description": "A comma-separated list of : pairs.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Sort"
+ }
+ ]
+ },
+ "_source": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/retrieve-selected-fields#source-filtering"
+ },
+ "description": "The source fields that are returned for matching documents.\nThese fields are returned in the `hits._source` property of the search response.\nIf the `stored_fields` property is specified, the `_source` property defaults to `false`.\nOtherwise, it defaults to `true`.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.SourceConfig"
+ }
+ ]
+ },
+ "fields": {
+ "description": "An array of wildcard (`*`) field patterns.\nThe request returns values for field names matching these patterns in the `hits.fields` property of the response.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_types.query_dsl.FieldAndFormat"
+ }
+ },
+ "suggest": {
+ "description": "Defines a suggester that provides similar looking terms based on a provided text.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.Suggester"
+ }
+ ]
+ },
+ "terminate_after": {
+ "description": "The maximum number of documents to collect for each shard.\nIf a query reaches this limit, Elasticsearch terminates the query early.\nElasticsearch collects documents before sorting.\n\nIMPORTANT: Use with caution.\nElasticsearch applies this property to each shard handling the request.\nWhen possible, let Elasticsearch perform early termination automatically.\nAvoid specifying this property for requests that target data streams with backing indices across multiple data tiers.\n\nIf set to `0` (default), the query does not terminate early.",
+ "default": 0.0,
+ "type": "number"
+ },
+ "timeout": {
+ "description": "The period of time to wait for a response from each shard.\nIf no response is received before the timeout expires, the request fails and returns an error.\nDefaults to no timeout.",
+ "type": "string"
+ },
+ "track_scores": {
+ "description": "If `true`, calculate and return document scores, even if the scores are not used for sorting.",
+ "default": false,
+ "type": "boolean"
+ },
+ "version": {
+ "description": "If `true`, the request returns the document version as part of a hit.",
+ "default": false,
+ "type": "boolean"
+ },
+ "seq_no_primary_term": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/optimistic-concurrency-control"
+ },
+ "description": "If `true`, the request returns sequence number and primary term of the last modification of each hit.",
+ "type": "boolean"
+ },
+ "stored_fields": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/retrieve-selected-fields#stored-fields"
+ },
+ "description": "A comma-separated list of stored fields to return as part of a hit.\nIf no fields are specified, no stored fields are included in the response.\nIf this field is specified, the `_source` property defaults to `false`.\nYou can pass `_source: true` to return both source fields and stored fields in the search response.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Fields"
+ }
+ ]
+ },
+ "pit": {
+ "description": "Limit the search to a point in time (PIT).\nIf you provide a PIT, you cannot specify an `` in the request path.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.PointInTimeReference"
+ }
+ ]
+ },
+ "runtime_mappings": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/manage-data/data-store/mapping/define-runtime-fields-in-search-request"
+ },
+ "description": "One or more runtime fields in the search request.\nThese fields take precedence over mapped fields with the same name.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.mapping.RuntimeFields"
+ }
+ ]
+ },
+ "stats": {
+ "description": "The stats groups to associate with the search.\nEach group maintains a statistics aggregation for its associated searches.\nYou can retrieve these stats using the indices stats API.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "examples": {
+ "SearchRequestExample1": {
+ "summary": "A simple term search",
+ "description": "Run `GET /my-index-000001/_search?from=40&size=20` to run a search.\n",
+ "value": "{\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n}"
+ },
+ "SearchRequestExample2": {
+ "summary": "A point in time search",
+ "description": "Run `POST /_search` to run a point in time search. The `id` parameter tells Elasticsearch to run the request using contexts from this open point in time. The `keep_alive` parameter tells Elasticsearch how long it should extend the time to live of the point in time.\n",
+ "value": "{\n \"size\": 100, \n \"query\": {\n \"match\" : {\n \"title\" : \"elasticsearch\"\n }\n },\n \"pit\": {\n \"id\": \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\", \n \"keep_alive\": \"1m\" \n }\n}"
+ },
+ "SearchRequestExample3": {
+ "summary": "Search slicing",
+ "description": "When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently. The result from running the first `GET /_search` request returns documents belonging to the first slice (`id: 0`). If you run a second request with `id` set to `1', it returns documents in the second slice. Since the maximum number of slices is set to `2`, the union of the results is equivalent to the results of a point-in-time search without slicing.\n",
+ "value": "{\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}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_global.search.ResponseBody"
+ },
+ "examples": {
+ "SearchResponseExample1": {
+ "description": "An abbreviated response from `GET /my-index-000001/_search?from=40&size=20` with a simple term query.\n",
+ "value": "{\n \"took\": 5,\n \"timed_out\": false,\n \"_shards\": {\n \"total\": 1,\n \"successful\": 1,\n \"skipped\": 0,\n \"failed\": 0\n },\n \"hits\": {\n \"total\": {\n \"value\": 20,\n \"relation\": \"eq\"\n },\n \"max_score\": 1.3862942,\n \"hits\": [\n {\n \"_index\": \"my-index-000001\",\n \"_id\": \"0\",\n \"_score\": 1.3862942,\n \"_source\": {\n \"@timestamp\": \"2099-11-15T14:12:12\",\n \"http\": {\n \"request\": {\n \"method\": \"get\"\n },\n \"response\": {\n \"status_code\": 200,\n \"bytes\": 1070000\n },\n \"version\": \"1.1\"\n },\n \"source\": {\n \"ip\": \"127.0.0.1\"\n },\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n }\n }\n ]\n }\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available",
+ "x-variations": [
+ "\n GET\n /_search\n
\n ",
+ "\n POST\n /_search\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "search",
+ "x-category": "search",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET /my-index-000001/_search?from=40&size=20\n{\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.search(\n index=\"my-index-000001\",\n from=\"40\",\n size=\"20\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.search({\n index: \"my-index-000001\",\n from: 40,\n size: 20,\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.search(\n index: \"my-index-000001\",\n from: \"40\",\n size: \"20\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->search([\n \"index\" => \"my-index-000001\",\n \"from\" => \"40\",\n \"size\" => \"20\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_search?from=40&size=20\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "post": {
+ "tags": [
+ "search"
+ ],
+ "summary": "Run a search",
+ "description": "Get search hits that match the query defined in the request.\nYou can provide search queries using the `q` query string parameter or the request body.\nIf both are specified, only the query parameter is used.\n\nIf the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges.\nTo search a point in time (PIT) for an alias, you must have the `read` index privilege for the alias's data streams or indices.\n\n**Search slicing**\n\nWhen paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the `slice` and `pit` properties.\nBy default the splitting is done first on the shards, then locally on each shard.\nThe local splitting partitions the shard into contiguous ranges based on Lucene document IDs.\n\nFor instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard.\n\nIMPORTANT: The same point-in-time ID should be used for all slices.\nIf different PIT IDs are used, slices can overlap and miss documents.\nThis situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index.",
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/deploy-manage/remote-clusters/remote-clusters-cert#remote-clusters-privileges-ccs",
+ "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/search-search.html"
+ },
+ "operationId": "search-1",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "allow_no_indices",
+ "description": "If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices.\nThis behavior applies even if the request targets other open indices.\nFor example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "allow_partial_search_results",
+ "description": "If `true` and there are shard request timeouts or shard failures, the request returns partial results.\nIf `false`, it returns an error with no partial results.\n\nTo override the default behavior, you can set the `search.default_allow_partial_results` cluster setting to `false`.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "analyzer",
+ "description": "The analyzer to use for the query string.\nThis parameter can be used only when the `q` query string parameter is specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "analyze_wildcard",
+ "description": "If `true`, wildcard and prefix queries are analyzed.\nThis parameter can be used only when the `q` query string parameter is specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "batched_reduce_size",
+ "description": "The number of shard results that should be reduced at once on the coordinating node.\nIf the potential number of shards in the request can be large, this value should be used as a protection mechanism to reduce the memory overhead per search request.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ccs_minimize_roundtrips",
+ "description": "If `true`, network round-trips between the coordinating node and the remote clusters are minimized when running cross-cluster search (CCS) requests.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "default_operator",
+ "description": "The default operator for the query string query: `and` or `or`.\nThis parameter can be used only when the `q` query string parameter is specified.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.query_dsl.Operator"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "df",
+ "description": "The field to use as a default when no field prefix is given in the query string.\nThis parameter can be used only when the `q` query string parameter is specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "docvalue_fields",
+ "description": "A comma-separated list of fields to return as the docvalue representation of a field for each hit.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "expand_wildcards",
+ "description": "The type of index that wildcard patterns can match.\nIf the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.\nIt supports comma-separated values such as `open,hidden`.\n\nSupported values include:\n - `all`: Match any data stream or index, including hidden ones.\n - `open`: Match open, non-hidden indices. Also matches any non-hidden data stream.\n - `closed`: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.\n - `hidden`: Match hidden data streams and hidden indices. Must be combined with `open`, `closed`, or `both`.\n - `none`: Wildcard expressions are not accepted.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.ExpandWildcards"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "explain",
+ "description": "If `true`, the request returns detailed information about score computation as part of a hit.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ignore_throttled",
+ "description": "If `true`, concrete, expanded or aliased indices will be ignored when frozen.",
+ "deprecated": true,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ignore_unavailable",
+ "description": "If `false`, the request returns an error if it targets a missing or closed index.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "include_named_queries_score",
+ "description": "If `true`, the response includes the score contribution from any named queries.\n\nThis functionality reruns each named query on every hit in a search response.\nTypically, this adds a small overhead to a request.\nHowever, using computationally expensive named queries on a large number of hits may add significant overhead.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "lenient",
+ "description": "If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored.\nThis parameter can be used only when the `q` query string parameter is specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "max_concurrent_shard_requests",
+ "description": "The number of concurrent shard requests per node that the search runs concurrently.\nThis value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "preference",
+ "description": "The nodes and shards used for the search.\nBy default, Elasticsearch selects from eligible nodes and shards using adaptive replica selection, accounting for allocation awareness.\nValid values are:\n\n* `_only_local` to run the search only on shards on the local node.\n* `_local` to, if possible, run the search on shards on the local node, or if not, select shards using the default method.\n* `_only_nodes:,` to run the search on only the specified nodes IDs. If suitable shards exist on more than one selected node, use shards on those nodes using the default method. If none of the specified nodes are available, select shards from any available node using the default method.\n* `_prefer_nodes:,` to if possible, run the search on the specified nodes IDs. If not, select shards using the default method.\n* `_shards:,` to run the search only on the specified shards. You can combine this value with other `preference` values. However, the `_shards` value must come first. For example: `_shards:2,3|_local`.\n* `` (any string that does not start with `_`) to route searches with the same `` to the same shards in the same order.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "pre_filter_shard_size",
+ "description": "A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold.\nThis filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method (if date filters are mandatory to match but the shard bounds and the query are disjoint).\nWhen unspecified, the pre-filter phase is executed if any of these conditions is met:\n\n* The request targets more than 128 shards.\n* The request targets one or more read-only index.\n* The primary sort of the query targets an indexed field.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "request_cache",
+ "description": "If `true`, the caching of search results is enabled for requests where `size` is `0`.\nIt defaults to index level settings.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "routing",
+ "description": "A custom value that is used to route operations to a specific shard.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Routing"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "scroll",
+ "description": "The period to retain the search context for scrolling.\nBy default, this value cannot exceed `1d` (24 hours).\nYou can change this limit by using the `search.max_keep_alive` cluster-level setting.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "search_type",
+ "description": "Indicates how distributed term frequencies are calculated for relevance scoring.\n\nSupported values include:\n - `query_then_fetch`: Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate.\n - `dfs_query_then_fetch`: Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.SearchType"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "stats",
+ "description": "Specific `tag` of the request for logging and statistical purposes.",
+ "deprecated": false,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "stored_fields",
+ "description": "A comma-separated list of stored fields to return as part of a hit.\nIf no fields are specified, no stored fields are included in the response.\nIf this field is specified, the `_source` parameter defaults to `false`.\nYou can pass `_source: true` to return both source fields and stored fields in the search response.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "suggest_field",
+ "description": "The field to use for suggestions.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Field"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "suggest_mode",
+ "description": "The suggest mode.\nThis parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified.\n\nSupported values include:\n - `missing`: Only generate suggestions for terms that are not in the shard.\n - `popular`: Only suggest terms that occur in more docs on the shard than the original term.\n - `always`: Suggest any matching suggestions based on terms in the suggest text.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.SuggestMode"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "suggest_size",
+ "description": "The number of suggestions to return.\nThis parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "suggest_text",
+ "description": "The source text for which the suggestions should be returned.\nThis parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "terminate_after",
+ "description": "The maximum number of documents to collect for each shard.\nIf a query reaches this limit, Elasticsearch terminates the query early.\nElasticsearch collects documents before sorting.\n\nIMPORTANT: Use with caution.\nElasticsearch applies this parameter to each shard handling the request.\nWhen possible, let Elasticsearch perform early termination automatically.\nAvoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers.\nIf set to `0` (default), the query does not terminate early.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "The period of time to wait for a response from each shard.\nIf no response is received before the timeout expires, the request fails and returns an error.\nIt defaults to no timeout.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "track_total_hits",
+ "description": "The number of hits matching the query to count accurately.\nIf `true`, the exact number of hits is returned at the cost of some performance.\nIf `false`, the response does not include the total number of hits matching the query.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_global.search._types.TrackHits"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "track_scores",
+ "description": "If `true`, the request calculates and returns document scores, even if the scores are not used for sorting.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "typed_keys",
+ "description": "If `true`, aggregation and suggester names are be prefixed by their respective types in the response.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "rest_total_hits_as_int",
+ "description": "Indicates whether `hits.total` should be rendered as an integer or an object in the rest search response.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "version",
+ "description": "If `true`, the request returns the document version as part of a hit.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "_source",
+ "description": "The source fields that are returned for matching documents.\nThese fields are returned in the `hits._source` property of the search response.\nValid values are:\n\n* `true` to return the entire document source.\n* `false` to not return the document source.\n* `` to return the source fields that are specified as a comma-separated list that supports wildcard (`*`) patterns.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_global.search._types.SourceConfigParam"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "_source_excludes",
+ "description": "A comma-separated list of source fields to exclude from the response.\nYou can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter.\nIf the `_source` parameter is `false`, this parameter is ignored.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "_source_exclude_vectors",
+ "description": "Whether vectors should be excluded from _source",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "x-state": "Generally available; Added in 9.2.0",
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "_source_includes",
+ "description": "A comma-separated list of source fields to include in the response.\nIf this parameter is specified, only these source fields are returned.\nYou can exclude fields from this subset using the `_source_excludes` query parameter.\nIf the `_source` parameter is `false`, this parameter is ignored.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "seq_no_primary_term",
+ "description": "If `true`, the request returns the sequence number and primary term of the last modification of each hit.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "q",
+ "description": "A query in the Lucene query string syntax.\nQuery parameter searches do not support the full Elasticsearch Query DSL but are handy for testing.\n\nIMPORTANT: This parameter overrides the query parameter in the request body.\nIf both parameters are specified, documents matching the query request body parameter are not returned.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "size",
+ "description": "The number of hits to return.\nBy default, you cannot page through more than 10,000 hits using the `from` and `size` parameters.\nTo page through more hits, use the `search_after` parameter.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "from",
+ "description": "The starting document offset, which must be non-negative.\nBy default, you cannot page through more than 10,000 hits using the `from` and `size` parameters.\nTo page through more hits, use the `search_after` parameter.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "sort",
+ "description": "A comma-separated list of `:` pairs.",
+ "deprecated": false,
+ "schema": {
+ "oneOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ ]
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "aggregations": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/explore-analyze/query-filter/aggregations"
+ },
+ "description": "Defines the aggregations that are run as part of the search request.",
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/_types.aggregations.AggregationContainer"
+ }
+ },
+ "collapse": {
+ "description": "Collapses search results the values of the specified field.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.FieldCollapse"
+ }
+ ]
+ },
+ "explain": {
+ "description": "If `true`, the request returns detailed information about score computation as part of a hit.",
+ "default": false,
+ "type": "boolean"
+ },
+ "ext": {
+ "description": "Configuration of search extensions defined by Elasticsearch plugins.",
+ "type": "object",
+ "additionalProperties": {
+ "type": "object"
+ }
+ },
+ "from": {
+ "description": "The starting document offset, which must be non-negative.\nBy default, you cannot page through more than 10,000 hits using the `from` and `size` parameters.\nTo page through more hits, use the `search_after` parameter.",
+ "default": 0.0,
+ "type": "number"
+ },
+ "highlight": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/highlighting"
+ },
+ "description": "Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.Highlight"
+ }
+ ]
+ },
+ "track_total_hits": {
+ "description": "Number of hits matching the query to count accurately.\nIf `true`, the exact number of hits is returned at the cost of some performance.\nIf `false`, the response does not include the total number of hits matching the query.",
+ "default": "10000",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.TrackHits"
+ }
+ ]
+ },
+ "indices_boost": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/explore-analyze/query-filter/languages/querydsl#relevance-scores"
+ },
+ "description": "Boost the `_score` of documents from specified indices.\nThe boost value is the factor by which scores are multiplied.\nA boost value greater than `1.0` increases the score.\nA boost value between `0` and `1.0` decreases the score.",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "number"
+ },
+ "minProperties": 1,
+ "maxProperties": 1
+ }
+ },
+ "docvalue_fields": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/retrieve-selected-fields#docvalue-fields"
+ },
+ "description": "An array of wildcard (`*`) field patterns.\nThe request returns doc values for field names matching these patterns in the `hits.fields` property of the response.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_types.query_dsl.FieldAndFormat"
+ }
+ },
+ "knn": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/solutions/search/vector/knn#approximate-knn"
+ },
+ "description": "The approximate kNN search to run.",
+ "x-state": "Generally available; Added in 8.4.0",
+ "oneOf": [
+ {
+ "$ref": "#/components/schemas/_types.KnnSearch"
+ },
+ {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_types.KnnSearch"
+ }
+ }
+ ]
+ },
+ "rank": {
+ "description": "The Reciprocal Rank Fusion (RRF) to use.",
+ "x-state": "Generally available; Added in 8.8.0",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.RankContainer"
+ }
+ ]
+ },
+ "min_score": {
+ "description": "The minimum `_score` for matching documents.\nDocuments with a lower `_score` are not included in search results and results collected by aggregations.",
+ "type": "number"
+ },
+ "post_filter": {
+ "description": "Use the `post_filter` parameter to filter search results.\nThe search hits are filtered after the aggregations are calculated.\nA post filter has no impact on the aggregation results.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.query_dsl.QueryContainer"
+ }
+ ]
+ },
+ "profile": {
+ "description": "Set to `true` to return detailed timing information about the execution of individual components in a search request.\nNOTE: This is a debugging tool and adds significant overhead to search execution.",
+ "default": false,
+ "type": "boolean"
+ },
+ "query": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/explore-analyze/query-filter/languages/querydsl"
+ },
+ "description": "The search definition using the Query DSL.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.query_dsl.QueryContainer"
+ }
+ ]
+ },
+ "rescore": {
+ "description": "Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the `query` and `post_filter` phases.",
+ "oneOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.Rescore"
+ },
+ {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_global.search._types.Rescore"
+ }
+ }
+ ]
+ },
+ "retriever": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/retrievers"
+ },
+ "description": "A retriever is a specification to describe top documents returned from a search.\nA retriever replaces other elements of the search API that also return top documents such as `query` and `knn`.",
+ "x-state": "Generally available; Added in 8.14.0",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.RetrieverContainer"
+ }
+ ]
+ },
+ "script_fields": {
+ "description": "Retrieve a script evaluation (based on different fields) for each hit.",
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/_types.ScriptField"
+ }
+ },
+ "search_after": {
+ "description": "Used to retrieve the next page of hits using a set of sort values from the previous page.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.SortResults"
+ }
+ ]
+ },
+ "size": {
+ "description": "The number of hits to return, which must not be negative.\nBy default, you cannot page through more than 10,000 hits using the `from` and `size` parameters.\nTo page through more hits, use the `search_after` property.",
+ "default": 10.0,
+ "type": "number"
+ },
+ "slice": {
+ "description": "Split a scrolled search into multiple slices that can be consumed independently.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.SlicedScroll"
+ }
+ ]
+ },
+ "sort": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/sort-search-results"
+ },
+ "description": "A comma-separated list of : pairs.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Sort"
+ }
+ ]
+ },
+ "_source": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/retrieve-selected-fields#source-filtering"
+ },
+ "description": "The source fields that are returned for matching documents.\nThese fields are returned in the `hits._source` property of the search response.\nIf the `stored_fields` property is specified, the `_source` property defaults to `false`.\nOtherwise, it defaults to `true`.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.SourceConfig"
+ }
+ ]
+ },
+ "fields": {
+ "description": "An array of wildcard (`*`) field patterns.\nThe request returns values for field names matching these patterns in the `hits.fields` property of the response.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_types.query_dsl.FieldAndFormat"
+ }
+ },
+ "suggest": {
+ "description": "Defines a suggester that provides similar looking terms based on a provided text.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.Suggester"
+ }
+ ]
+ },
+ "terminate_after": {
+ "description": "The maximum number of documents to collect for each shard.\nIf a query reaches this limit, Elasticsearch terminates the query early.\nElasticsearch collects documents before sorting.\n\nIMPORTANT: Use with caution.\nElasticsearch applies this property to each shard handling the request.\nWhen possible, let Elasticsearch perform early termination automatically.\nAvoid specifying this property for requests that target data streams with backing indices across multiple data tiers.\n\nIf set to `0` (default), the query does not terminate early.",
+ "default": 0.0,
+ "type": "number"
+ },
+ "timeout": {
+ "description": "The period of time to wait for a response from each shard.\nIf no response is received before the timeout expires, the request fails and returns an error.\nDefaults to no timeout.",
+ "type": "string"
+ },
+ "track_scores": {
+ "description": "If `true`, calculate and return document scores, even if the scores are not used for sorting.",
+ "default": false,
+ "type": "boolean"
+ },
+ "version": {
+ "description": "If `true`, the request returns the document version as part of a hit.",
+ "default": false,
+ "type": "boolean"
+ },
+ "seq_no_primary_term": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/optimistic-concurrency-control"
+ },
+ "description": "If `true`, the request returns sequence number and primary term of the last modification of each hit.",
+ "type": "boolean"
+ },
+ "stored_fields": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/retrieve-selected-fields#stored-fields"
+ },
+ "description": "A comma-separated list of stored fields to return as part of a hit.\nIf no fields are specified, no stored fields are included in the response.\nIf this field is specified, the `_source` property defaults to `false`.\nYou can pass `_source: true` to return both source fields and stored fields in the search response.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Fields"
+ }
+ ]
+ },
+ "pit": {
+ "description": "Limit the search to a point in time (PIT).\nIf you provide a PIT, you cannot specify an `` in the request path.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.PointInTimeReference"
+ }
+ ]
+ },
+ "runtime_mappings": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/manage-data/data-store/mapping/define-runtime-fields-in-search-request"
+ },
+ "description": "One or more runtime fields in the search request.\nThese fields take precedence over mapped fields with the same name.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.mapping.RuntimeFields"
+ }
+ ]
+ },
+ "stats": {
+ "description": "The stats groups to associate with the search.\nEach group maintains a statistics aggregation for its associated searches.\nYou can retrieve these stats using the indices stats API.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "examples": {
+ "SearchRequestExample1": {
+ "summary": "A simple term search",
+ "description": "Run `GET /my-index-000001/_search?from=40&size=20` to run a search.\n",
+ "value": "{\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n}"
+ },
+ "SearchRequestExample2": {
+ "summary": "A point in time search",
+ "description": "Run `POST /_search` to run a point in time search. The `id` parameter tells Elasticsearch to run the request using contexts from this open point in time. The `keep_alive` parameter tells Elasticsearch how long it should extend the time to live of the point in time.\n",
+ "value": "{\n \"size\": 100, \n \"query\": {\n \"match\" : {\n \"title\" : \"elasticsearch\"\n }\n },\n \"pit\": {\n \"id\": \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\", \n \"keep_alive\": \"1m\" \n }\n}"
+ },
+ "SearchRequestExample3": {
+ "summary": "Search slicing",
+ "description": "When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently. The result from running the first `GET /_search` request returns documents belonging to the first slice (`id: 0`). If you run a second request with `id` set to `1', it returns documents in the second slice. Since the maximum number of slices is set to `2`, the union of the results is equivalent to the results of a point-in-time search without slicing.\n",
+ "value": "{\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}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_global.search.ResponseBody"
+ },
+ "examples": {
+ "SearchResponseExample1": {
+ "description": "An abbreviated response from `GET /my-index-000001/_search?from=40&size=20` with a simple term query.\n",
+ "value": "{\n \"took\": 5,\n \"timed_out\": false,\n \"_shards\": {\n \"total\": 1,\n \"successful\": 1,\n \"skipped\": 0,\n \"failed\": 0\n },\n \"hits\": {\n \"total\": {\n \"value\": 20,\n \"relation\": \"eq\"\n },\n \"max_score\": 1.3862942,\n \"hits\": [\n {\n \"_index\": \"my-index-000001\",\n \"_id\": \"0\",\n \"_score\": 1.3862942,\n \"_source\": {\n \"@timestamp\": \"2099-11-15T14:12:12\",\n \"http\": {\n \"request\": {\n \"method\": \"get\"\n },\n \"response\": {\n \"status_code\": 200,\n \"bytes\": 1070000\n },\n \"version\": \"1.1\"\n },\n \"source\": {\n \"ip\": \"127.0.0.1\"\n },\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n }\n }\n ]\n }\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available",
+ "x-variations": [
+ "\n GET\n /_search\n
\n ",
+ "\n POST\n /_search\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "search",
+ "x-category": "search",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET /my-index-000001/_search?from=40&size=20\n{\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.search(\n index=\"my-index-000001\",\n from=\"40\",\n size=\"20\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.search({\n index: \"my-index-000001\",\n from: 40,\n size: 20,\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.search(\n index: \"my-index-000001\",\n from: \"40\",\n size: \"20\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->search([\n \"index\" => \"my-index-000001\",\n \"from\" => \"40\",\n \"size\" => \"20\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_search?from=40&size=20\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/{index}/_search": {
+ "get": {
+ "tags": [
+ "search"
+ ],
+ "summary": "Run a search",
+ "description": "Get search hits that match the query defined in the request.\nYou can provide search queries using the `q` query string parameter or the request body.\nIf both are specified, only the query parameter is used.\n\nIf the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges.\nTo search a point in time (PIT) for an alias, you must have the `read` index privilege for the alias's data streams or indices.\n\n**Search slicing**\n\nWhen paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the `slice` and `pit` properties.\nBy default the splitting is done first on the shards, then locally on each shard.\nThe local splitting partitions the shard into contiguous ranges based on Lucene document IDs.\n\nFor instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard.\n\nIMPORTANT: The same point-in-time ID should be used for all slices.\nIf different PIT IDs are used, slices can overlap and miss documents.\nThis situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index.",
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/deploy-manage/remote-clusters/remote-clusters-cert#remote-clusters-privileges-ccs",
+ "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/search-search.html"
+ },
+ "operationId": "search-2",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "index",
+ "description": "A comma-separated list of data streams, indices, and aliases to search.\nIt supports wildcards (`*`).\nTo search all data streams and indices, omit this parameter or use `*` or `_all`.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Indices"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "allow_no_indices",
+ "description": "If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices.\nThis behavior applies even if the request targets other open indices.\nFor example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "allow_partial_search_results",
+ "description": "If `true` and there are shard request timeouts or shard failures, the request returns partial results.\nIf `false`, it returns an error with no partial results.\n\nTo override the default behavior, you can set the `search.default_allow_partial_results` cluster setting to `false`.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "analyzer",
+ "description": "The analyzer to use for the query string.\nThis parameter can be used only when the `q` query string parameter is specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "analyze_wildcard",
+ "description": "If `true`, wildcard and prefix queries are analyzed.\nThis parameter can be used only when the `q` query string parameter is specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "batched_reduce_size",
+ "description": "The number of shard results that should be reduced at once on the coordinating node.\nIf the potential number of shards in the request can be large, this value should be used as a protection mechanism to reduce the memory overhead per search request.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ccs_minimize_roundtrips",
+ "description": "If `true`, network round-trips between the coordinating node and the remote clusters are minimized when running cross-cluster search (CCS) requests.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "default_operator",
+ "description": "The default operator for the query string query: `and` or `or`.\nThis parameter can be used only when the `q` query string parameter is specified.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.query_dsl.Operator"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "df",
+ "description": "The field to use as a default when no field prefix is given in the query string.\nThis parameter can be used only when the `q` query string parameter is specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "docvalue_fields",
+ "description": "A comma-separated list of fields to return as the docvalue representation of a field for each hit.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "expand_wildcards",
+ "description": "The type of index that wildcard patterns can match.\nIf the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.\nIt supports comma-separated values such as `open,hidden`.\n\nSupported values include:\n - `all`: Match any data stream or index, including hidden ones.\n - `open`: Match open, non-hidden indices. Also matches any non-hidden data stream.\n - `closed`: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.\n - `hidden`: Match hidden data streams and hidden indices. Must be combined with `open`, `closed`, or `both`.\n - `none`: Wildcard expressions are not accepted.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.ExpandWildcards"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "explain",
+ "description": "If `true`, the request returns detailed information about score computation as part of a hit.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ignore_throttled",
+ "description": "If `true`, concrete, expanded or aliased indices will be ignored when frozen.",
+ "deprecated": true,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ignore_unavailable",
+ "description": "If `false`, the request returns an error if it targets a missing or closed index.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "include_named_queries_score",
+ "description": "If `true`, the response includes the score contribution from any named queries.\n\nThis functionality reruns each named query on every hit in a search response.\nTypically, this adds a small overhead to a request.\nHowever, using computationally expensive named queries on a large number of hits may add significant overhead.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "lenient",
+ "description": "If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored.\nThis parameter can be used only when the `q` query string parameter is specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "max_concurrent_shard_requests",
+ "description": "The number of concurrent shard requests per node that the search runs concurrently.\nThis value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "preference",
+ "description": "The nodes and shards used for the search.\nBy default, Elasticsearch selects from eligible nodes and shards using adaptive replica selection, accounting for allocation awareness.\nValid values are:\n\n* `_only_local` to run the search only on shards on the local node.\n* `_local` to, if possible, run the search on shards on the local node, or if not, select shards using the default method.\n* `_only_nodes:,` to run the search on only the specified nodes IDs. If suitable shards exist on more than one selected node, use shards on those nodes using the default method. If none of the specified nodes are available, select shards from any available node using the default method.\n* `_prefer_nodes:,` to if possible, run the search on the specified nodes IDs. If not, select shards using the default method.\n* `_shards:,` to run the search only on the specified shards. You can combine this value with other `preference` values. However, the `_shards` value must come first. For example: `_shards:2,3|_local`.\n* `` (any string that does not start with `_`) to route searches with the same `` to the same shards in the same order.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "pre_filter_shard_size",
+ "description": "A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold.\nThis filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method (if date filters are mandatory to match but the shard bounds and the query are disjoint).\nWhen unspecified, the pre-filter phase is executed if any of these conditions is met:\n\n* The request targets more than 128 shards.\n* The request targets one or more read-only index.\n* The primary sort of the query targets an indexed field.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "request_cache",
+ "description": "If `true`, the caching of search results is enabled for requests where `size` is `0`.\nIt defaults to index level settings.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "routing",
+ "description": "A custom value that is used to route operations to a specific shard.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Routing"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "scroll",
+ "description": "The period to retain the search context for scrolling.\nBy default, this value cannot exceed `1d` (24 hours).\nYou can change this limit by using the `search.max_keep_alive` cluster-level setting.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "search_type",
+ "description": "Indicates how distributed term frequencies are calculated for relevance scoring.\n\nSupported values include:\n - `query_then_fetch`: Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate.\n - `dfs_query_then_fetch`: Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.SearchType"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "stats",
+ "description": "Specific `tag` of the request for logging and statistical purposes.",
+ "deprecated": false,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "stored_fields",
+ "description": "A comma-separated list of stored fields to return as part of a hit.\nIf no fields are specified, no stored fields are included in the response.\nIf this field is specified, the `_source` parameter defaults to `false`.\nYou can pass `_source: true` to return both source fields and stored fields in the search response.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "suggest_field",
+ "description": "The field to use for suggestions.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Field"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "suggest_mode",
+ "description": "The suggest mode.\nThis parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified.\n\nSupported values include:\n - `missing`: Only generate suggestions for terms that are not in the shard.\n - `popular`: Only suggest terms that occur in more docs on the shard than the original term.\n - `always`: Suggest any matching suggestions based on terms in the suggest text.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.SuggestMode"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "suggest_size",
+ "description": "The number of suggestions to return.\nThis parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "suggest_text",
+ "description": "The source text for which the suggestions should be returned.\nThis parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "terminate_after",
+ "description": "The maximum number of documents to collect for each shard.\nIf a query reaches this limit, Elasticsearch terminates the query early.\nElasticsearch collects documents before sorting.\n\nIMPORTANT: Use with caution.\nElasticsearch applies this parameter to each shard handling the request.\nWhen possible, let Elasticsearch perform early termination automatically.\nAvoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers.\nIf set to `0` (default), the query does not terminate early.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "The period of time to wait for a response from each shard.\nIf no response is received before the timeout expires, the request fails and returns an error.\nIt defaults to no timeout.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "track_total_hits",
+ "description": "The number of hits matching the query to count accurately.\nIf `true`, the exact number of hits is returned at the cost of some performance.\nIf `false`, the response does not include the total number of hits matching the query.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_global.search._types.TrackHits"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "track_scores",
+ "description": "If `true`, the request calculates and returns document scores, even if the scores are not used for sorting.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "typed_keys",
+ "description": "If `true`, aggregation and suggester names are be prefixed by their respective types in the response.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "rest_total_hits_as_int",
+ "description": "Indicates whether `hits.total` should be rendered as an integer or an object in the rest search response.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "version",
+ "description": "If `true`, the request returns the document version as part of a hit.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "_source",
+ "description": "The source fields that are returned for matching documents.\nThese fields are returned in the `hits._source` property of the search response.\nValid values are:\n\n* `true` to return the entire document source.\n* `false` to not return the document source.\n* `` to return the source fields that are specified as a comma-separated list that supports wildcard (`*`) patterns.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_global.search._types.SourceConfigParam"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "_source_excludes",
+ "description": "A comma-separated list of source fields to exclude from the response.\nYou can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter.\nIf the `_source` parameter is `false`, this parameter is ignored.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "_source_exclude_vectors",
+ "description": "Whether vectors should be excluded from _source",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "x-state": "Generally available; Added in 9.2.0",
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "_source_includes",
+ "description": "A comma-separated list of source fields to include in the response.\nIf this parameter is specified, only these source fields are returned.\nYou can exclude fields from this subset using the `_source_excludes` query parameter.\nIf the `_source` parameter is `false`, this parameter is ignored.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "seq_no_primary_term",
+ "description": "If `true`, the request returns the sequence number and primary term of the last modification of each hit.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "q",
+ "description": "A query in the Lucene query string syntax.\nQuery parameter searches do not support the full Elasticsearch Query DSL but are handy for testing.\n\nIMPORTANT: This parameter overrides the query parameter in the request body.\nIf both parameters are specified, documents matching the query request body parameter are not returned.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "size",
+ "description": "The number of hits to return.\nBy default, you cannot page through more than 10,000 hits using the `from` and `size` parameters.\nTo page through more hits, use the `search_after` parameter.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "from",
+ "description": "The starting document offset, which must be non-negative.\nBy default, you cannot page through more than 10,000 hits using the `from` and `size` parameters.\nTo page through more hits, use the `search_after` parameter.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "sort",
+ "description": "A comma-separated list of `:` pairs.",
+ "deprecated": false,
+ "schema": {
+ "oneOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ ]
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "aggregations": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/explore-analyze/query-filter/aggregations"
+ },
+ "description": "Defines the aggregations that are run as part of the search request.",
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/_types.aggregations.AggregationContainer"
+ }
+ },
+ "collapse": {
+ "description": "Collapses search results the values of the specified field.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.FieldCollapse"
+ }
+ ]
+ },
+ "explain": {
+ "description": "If `true`, the request returns detailed information about score computation as part of a hit.",
+ "default": false,
+ "type": "boolean"
+ },
+ "ext": {
+ "description": "Configuration of search extensions defined by Elasticsearch plugins.",
+ "type": "object",
+ "additionalProperties": {
+ "type": "object"
+ }
+ },
+ "from": {
+ "description": "The starting document offset, which must be non-negative.\nBy default, you cannot page through more than 10,000 hits using the `from` and `size` parameters.\nTo page through more hits, use the `search_after` parameter.",
+ "default": 0.0,
+ "type": "number"
+ },
+ "highlight": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/highlighting"
+ },
+ "description": "Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.Highlight"
+ }
+ ]
+ },
+ "track_total_hits": {
+ "description": "Number of hits matching the query to count accurately.\nIf `true`, the exact number of hits is returned at the cost of some performance.\nIf `false`, the response does not include the total number of hits matching the query.",
+ "default": "10000",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.TrackHits"
+ }
+ ]
+ },
+ "indices_boost": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/explore-analyze/query-filter/languages/querydsl#relevance-scores"
+ },
+ "description": "Boost the `_score` of documents from specified indices.\nThe boost value is the factor by which scores are multiplied.\nA boost value greater than `1.0` increases the score.\nA boost value between `0` and `1.0` decreases the score.",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "number"
+ },
+ "minProperties": 1,
+ "maxProperties": 1
+ }
+ },
+ "docvalue_fields": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/retrieve-selected-fields#docvalue-fields"
+ },
+ "description": "An array of wildcard (`*`) field patterns.\nThe request returns doc values for field names matching these patterns in the `hits.fields` property of the response.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_types.query_dsl.FieldAndFormat"
+ }
+ },
+ "knn": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/solutions/search/vector/knn#approximate-knn"
+ },
+ "description": "The approximate kNN search to run.",
+ "x-state": "Generally available; Added in 8.4.0",
+ "oneOf": [
+ {
+ "$ref": "#/components/schemas/_types.KnnSearch"
+ },
+ {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_types.KnnSearch"
+ }
+ }
+ ]
+ },
+ "rank": {
+ "description": "The Reciprocal Rank Fusion (RRF) to use.",
+ "x-state": "Generally available; Added in 8.8.0",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.RankContainer"
+ }
+ ]
+ },
+ "min_score": {
+ "description": "The minimum `_score` for matching documents.\nDocuments with a lower `_score` are not included in search results and results collected by aggregations.",
+ "type": "number"
+ },
+ "post_filter": {
+ "description": "Use the `post_filter` parameter to filter search results.\nThe search hits are filtered after the aggregations are calculated.\nA post filter has no impact on the aggregation results.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.query_dsl.QueryContainer"
+ }
+ ]
+ },
+ "profile": {
+ "description": "Set to `true` to return detailed timing information about the execution of individual components in a search request.\nNOTE: This is a debugging tool and adds significant overhead to search execution.",
+ "default": false,
+ "type": "boolean"
+ },
+ "query": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/explore-analyze/query-filter/languages/querydsl"
+ },
+ "description": "The search definition using the Query DSL.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.query_dsl.QueryContainer"
+ }
+ ]
+ },
+ "rescore": {
+ "description": "Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the `query` and `post_filter` phases.",
+ "oneOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.Rescore"
+ },
+ {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_global.search._types.Rescore"
+ }
+ }
+ ]
+ },
+ "retriever": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/retrievers"
+ },
+ "description": "A retriever is a specification to describe top documents returned from a search.\nA retriever replaces other elements of the search API that also return top documents such as `query` and `knn`.",
+ "x-state": "Generally available; Added in 8.14.0",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.RetrieverContainer"
+ }
+ ]
+ },
+ "script_fields": {
+ "description": "Retrieve a script evaluation (based on different fields) for each hit.",
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/_types.ScriptField"
+ }
+ },
+ "search_after": {
+ "description": "Used to retrieve the next page of hits using a set of sort values from the previous page.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.SortResults"
+ }
+ ]
+ },
+ "size": {
+ "description": "The number of hits to return, which must not be negative.\nBy default, you cannot page through more than 10,000 hits using the `from` and `size` parameters.\nTo page through more hits, use the `search_after` property.",
+ "default": 10.0,
+ "type": "number"
+ },
+ "slice": {
+ "description": "Split a scrolled search into multiple slices that can be consumed independently.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.SlicedScroll"
+ }
+ ]
+ },
+ "sort": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/sort-search-results"
+ },
+ "description": "A comma-separated list of : pairs.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Sort"
+ }
+ ]
+ },
+ "_source": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/retrieve-selected-fields#source-filtering"
+ },
+ "description": "The source fields that are returned for matching documents.\nThese fields are returned in the `hits._source` property of the search response.\nIf the `stored_fields` property is specified, the `_source` property defaults to `false`.\nOtherwise, it defaults to `true`.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.SourceConfig"
+ }
+ ]
+ },
+ "fields": {
+ "description": "An array of wildcard (`*`) field patterns.\nThe request returns values for field names matching these patterns in the `hits.fields` property of the response.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_types.query_dsl.FieldAndFormat"
+ }
+ },
+ "suggest": {
+ "description": "Defines a suggester that provides similar looking terms based on a provided text.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.Suggester"
+ }
+ ]
+ },
+ "terminate_after": {
+ "description": "The maximum number of documents to collect for each shard.\nIf a query reaches this limit, Elasticsearch terminates the query early.\nElasticsearch collects documents before sorting.\n\nIMPORTANT: Use with caution.\nElasticsearch applies this property to each shard handling the request.\nWhen possible, let Elasticsearch perform early termination automatically.\nAvoid specifying this property for requests that target data streams with backing indices across multiple data tiers.\n\nIf set to `0` (default), the query does not terminate early.",
+ "default": 0.0,
+ "type": "number"
+ },
+ "timeout": {
+ "description": "The period of time to wait for a response from each shard.\nIf no response is received before the timeout expires, the request fails and returns an error.\nDefaults to no timeout.",
+ "type": "string"
+ },
+ "track_scores": {
+ "description": "If `true`, calculate and return document scores, even if the scores are not used for sorting.",
+ "default": false,
+ "type": "boolean"
+ },
+ "version": {
+ "description": "If `true`, the request returns the document version as part of a hit.",
+ "default": false,
+ "type": "boolean"
+ },
+ "seq_no_primary_term": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/optimistic-concurrency-control"
+ },
+ "description": "If `true`, the request returns sequence number and primary term of the last modification of each hit.",
+ "type": "boolean"
+ },
+ "stored_fields": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/retrieve-selected-fields#stored-fields"
+ },
+ "description": "A comma-separated list of stored fields to return as part of a hit.\nIf no fields are specified, no stored fields are included in the response.\nIf this field is specified, the `_source` property defaults to `false`.\nYou can pass `_source: true` to return both source fields and stored fields in the search response.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Fields"
+ }
+ ]
+ },
+ "pit": {
+ "description": "Limit the search to a point in time (PIT).\nIf you provide a PIT, you cannot specify an `` in the request path.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.PointInTimeReference"
+ }
+ ]
+ },
+ "runtime_mappings": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/manage-data/data-store/mapping/define-runtime-fields-in-search-request"
+ },
+ "description": "One or more runtime fields in the search request.\nThese fields take precedence over mapped fields with the same name.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.mapping.RuntimeFields"
+ }
+ ]
+ },
+ "stats": {
+ "description": "The stats groups to associate with the search.\nEach group maintains a statistics aggregation for its associated searches.\nYou can retrieve these stats using the indices stats API.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "examples": {
+ "SearchRequestExample1": {
+ "summary": "A simple term search",
+ "description": "Run `GET /my-index-000001/_search?from=40&size=20` to run a search.\n",
+ "value": "{\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n}"
+ },
+ "SearchRequestExample2": {
+ "summary": "A point in time search",
+ "description": "Run `POST /_search` to run a point in time search. The `id` parameter tells Elasticsearch to run the request using contexts from this open point in time. The `keep_alive` parameter tells Elasticsearch how long it should extend the time to live of the point in time.\n",
+ "value": "{\n \"size\": 100, \n \"query\": {\n \"match\" : {\n \"title\" : \"elasticsearch\"\n }\n },\n \"pit\": {\n \"id\": \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\", \n \"keep_alive\": \"1m\" \n }\n}"
+ },
+ "SearchRequestExample3": {
+ "summary": "Search slicing",
+ "description": "When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently. The result from running the first `GET /_search` request returns documents belonging to the first slice (`id: 0`). If you run a second request with `id` set to `1', it returns documents in the second slice. Since the maximum number of slices is set to `2`, the union of the results is equivalent to the results of a point-in-time search without slicing.\n",
+ "value": "{\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}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_global.search.ResponseBody"
+ },
+ "examples": {
+ "SearchResponseExample1": {
+ "description": "An abbreviated response from `GET /my-index-000001/_search?from=40&size=20` with a simple term query.\n",
+ "value": "{\n \"took\": 5,\n \"timed_out\": false,\n \"_shards\": {\n \"total\": 1,\n \"successful\": 1,\n \"skipped\": 0,\n \"failed\": 0\n },\n \"hits\": {\n \"total\": {\n \"value\": 20,\n \"relation\": \"eq\"\n },\n \"max_score\": 1.3862942,\n \"hits\": [\n {\n \"_index\": \"my-index-000001\",\n \"_id\": \"0\",\n \"_score\": 1.3862942,\n \"_source\": {\n \"@timestamp\": \"2099-11-15T14:12:12\",\n \"http\": {\n \"request\": {\n \"method\": \"get\"\n },\n \"response\": {\n \"status_code\": 200,\n \"bytes\": 1070000\n },\n \"version\": \"1.1\"\n },\n \"source\": {\n \"ip\": \"127.0.0.1\"\n },\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n }\n }\n ]\n }\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available",
+ "x-variations": [
+ "\n GET\n /{index}/_search\n
\n ",
+ "\n POST\n /{index}/_search\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "search",
+ "x-category": "search",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET /my-index-000001/_search?from=40&size=20\n{\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.search(\n index=\"my-index-000001\",\n from=\"40\",\n size=\"20\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.search({\n index: \"my-index-000001\",\n from: 40,\n size: 20,\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.search(\n index: \"my-index-000001\",\n from: \"40\",\n size: \"20\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->search([\n \"index\" => \"my-index-000001\",\n \"from\" => \"40\",\n \"size\" => \"20\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_search?from=40&size=20\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "post": {
+ "tags": [
+ "search"
+ ],
+ "summary": "Run a search",
+ "description": "Get search hits that match the query defined in the request.\nYou can provide search queries using the `q` query string parameter or the request body.\nIf both are specified, only the query parameter is used.\n\nIf the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges.\nTo search a point in time (PIT) for an alias, you must have the `read` index privilege for the alias's data streams or indices.\n\n**Search slicing**\n\nWhen paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the `slice` and `pit` properties.\nBy default the splitting is done first on the shards, then locally on each shard.\nThe local splitting partitions the shard into contiguous ranges based on Lucene document IDs.\n\nFor instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard.\n\nIMPORTANT: The same point-in-time ID should be used for all slices.\nIf different PIT IDs are used, slices can overlap and miss documents.\nThis situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index.",
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/deploy-manage/remote-clusters/remote-clusters-cert#remote-clusters-privileges-ccs",
+ "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/search-search.html"
+ },
+ "operationId": "search-3",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "index",
+ "description": "A comma-separated list of data streams, indices, and aliases to search.\nIt supports wildcards (`*`).\nTo search all data streams and indices, omit this parameter or use `*` or `_all`.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Indices"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "allow_no_indices",
+ "description": "If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices.\nThis behavior applies even if the request targets other open indices.\nFor example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "allow_partial_search_results",
+ "description": "If `true` and there are shard request timeouts or shard failures, the request returns partial results.\nIf `false`, it returns an error with no partial results.\n\nTo override the default behavior, you can set the `search.default_allow_partial_results` cluster setting to `false`.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "analyzer",
+ "description": "The analyzer to use for the query string.\nThis parameter can be used only when the `q` query string parameter is specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "analyze_wildcard",
+ "description": "If `true`, wildcard and prefix queries are analyzed.\nThis parameter can be used only when the `q` query string parameter is specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "batched_reduce_size",
+ "description": "The number of shard results that should be reduced at once on the coordinating node.\nIf the potential number of shards in the request can be large, this value should be used as a protection mechanism to reduce the memory overhead per search request.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ccs_minimize_roundtrips",
+ "description": "If `true`, network round-trips between the coordinating node and the remote clusters are minimized when running cross-cluster search (CCS) requests.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "default_operator",
+ "description": "The default operator for the query string query: `and` or `or`.\nThis parameter can be used only when the `q` query string parameter is specified.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.query_dsl.Operator"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "df",
+ "description": "The field to use as a default when no field prefix is given in the query string.\nThis parameter can be used only when the `q` query string parameter is specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "docvalue_fields",
+ "description": "A comma-separated list of fields to return as the docvalue representation of a field for each hit.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "expand_wildcards",
+ "description": "The type of index that wildcard patterns can match.\nIf the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.\nIt supports comma-separated values such as `open,hidden`.\n\nSupported values include:\n - `all`: Match any data stream or index, including hidden ones.\n - `open`: Match open, non-hidden indices. Also matches any non-hidden data stream.\n - `closed`: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.\n - `hidden`: Match hidden data streams and hidden indices. Must be combined with `open`, `closed`, or `both`.\n - `none`: Wildcard expressions are not accepted.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.ExpandWildcards"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "explain",
+ "description": "If `true`, the request returns detailed information about score computation as part of a hit.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ignore_throttled",
+ "description": "If `true`, concrete, expanded or aliased indices will be ignored when frozen.",
+ "deprecated": true,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "ignore_unavailable",
+ "description": "If `false`, the request returns an error if it targets a missing or closed index.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "include_named_queries_score",
+ "description": "If `true`, the response includes the score contribution from any named queries.\n\nThis functionality reruns each named query on every hit in a search response.\nTypically, this adds a small overhead to a request.\nHowever, using computationally expensive named queries on a large number of hits may add significant overhead.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "lenient",
+ "description": "If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored.\nThis parameter can be used only when the `q` query string parameter is specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "max_concurrent_shard_requests",
+ "description": "The number of concurrent shard requests per node that the search runs concurrently.\nThis value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "preference",
+ "description": "The nodes and shards used for the search.\nBy default, Elasticsearch selects from eligible nodes and shards using adaptive replica selection, accounting for allocation awareness.\nValid values are:\n\n* `_only_local` to run the search only on shards on the local node.\n* `_local` to, if possible, run the search on shards on the local node, or if not, select shards using the default method.\n* `_only_nodes:,` to run the search on only the specified nodes IDs. If suitable shards exist on more than one selected node, use shards on those nodes using the default method. If none of the specified nodes are available, select shards from any available node using the default method.\n* `_prefer_nodes:,` to if possible, run the search on the specified nodes IDs. If not, select shards using the default method.\n* `_shards:,` to run the search only on the specified shards. You can combine this value with other `preference` values. However, the `_shards` value must come first. For example: `_shards:2,3|_local`.\n* `` (any string that does not start with `_`) to route searches with the same `` to the same shards in the same order.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "pre_filter_shard_size",
+ "description": "A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold.\nThis filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method (if date filters are mandatory to match but the shard bounds and the query are disjoint).\nWhen unspecified, the pre-filter phase is executed if any of these conditions is met:\n\n* The request targets more than 128 shards.\n* The request targets one or more read-only index.\n* The primary sort of the query targets an indexed field.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "request_cache",
+ "description": "If `true`, the caching of search results is enabled for requests where `size` is `0`.\nIt defaults to index level settings.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "routing",
+ "description": "A custom value that is used to route operations to a specific shard.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Routing"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "scroll",
+ "description": "The period to retain the search context for scrolling.\nBy default, this value cannot exceed `1d` (24 hours).\nYou can change this limit by using the `search.max_keep_alive` cluster-level setting.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "search_type",
+ "description": "Indicates how distributed term frequencies are calculated for relevance scoring.\n\nSupported values include:\n - `query_then_fetch`: Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate.\n - `dfs_query_then_fetch`: Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.SearchType"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "stats",
+ "description": "Specific `tag` of the request for logging and statistical purposes.",
+ "deprecated": false,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "stored_fields",
+ "description": "A comma-separated list of stored fields to return as part of a hit.\nIf no fields are specified, no stored fields are included in the response.\nIf this field is specified, the `_source` parameter defaults to `false`.\nYou can pass `_source: true` to return both source fields and stored fields in the search response.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "suggest_field",
+ "description": "The field to use for suggestions.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Field"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "suggest_mode",
+ "description": "The suggest mode.\nThis parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified.\n\nSupported values include:\n - `missing`: Only generate suggestions for terms that are not in the shard.\n - `popular`: Only suggest terms that occur in more docs on the shard than the original term.\n - `always`: Suggest any matching suggestions based on terms in the suggest text.\n\n",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.SuggestMode"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "suggest_size",
+ "description": "The number of suggestions to return.\nThis parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "suggest_text",
+ "description": "The source text for which the suggestions should be returned.\nThis parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "terminate_after",
+ "description": "The maximum number of documents to collect for each shard.\nIf a query reaches this limit, Elasticsearch terminates the query early.\nElasticsearch collects documents before sorting.\n\nIMPORTANT: Use with caution.\nElasticsearch applies this parameter to each shard handling the request.\nWhen possible, let Elasticsearch perform early termination automatically.\nAvoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers.\nIf set to `0` (default), the query does not terminate early.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "timeout",
+ "description": "The period of time to wait for a response from each shard.\nIf no response is received before the timeout expires, the request fails and returns an error.\nIt defaults to no timeout.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Duration"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "track_total_hits",
+ "description": "The number of hits matching the query to count accurately.\nIf `true`, the exact number of hits is returned at the cost of some performance.\nIf `false`, the response does not include the total number of hits matching the query.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_global.search._types.TrackHits"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "track_scores",
+ "description": "If `true`, the request calculates and returns document scores, even if the scores are not used for sorting.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "typed_keys",
+ "description": "If `true`, aggregation and suggester names are be prefixed by their respective types in the response.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "rest_total_hits_as_int",
+ "description": "Indicates whether `hits.total` should be rendered as an integer or an object in the rest search response.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "version",
+ "description": "If `true`, the request returns the document version as part of a hit.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "_source",
+ "description": "The source fields that are returned for matching documents.\nThese fields are returned in the `hits._source` property of the search response.\nValid values are:\n\n* `true` to return the entire document source.\n* `false` to not return the document source.\n* `` to return the source fields that are specified as a comma-separated list that supports wildcard (`*`) patterns.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_global.search._types.SourceConfigParam"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "_source_excludes",
+ "description": "A comma-separated list of source fields to exclude from the response.\nYou can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter.\nIf the `_source` parameter is `false`, this parameter is ignored.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "_source_exclude_vectors",
+ "description": "Whether vectors should be excluded from _source",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "x-state": "Generally available; Added in 9.2.0",
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "_source_includes",
+ "description": "A comma-separated list of source fields to include in the response.\nIf this parameter is specified, only these source fields are returned.\nYou can exclude fields from this subset using the `_source_excludes` query parameter.\nIf the `_source` parameter is `false`, this parameter is ignored.",
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Fields"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "seq_no_primary_term",
+ "description": "If `true`, the request returns the sequence number and primary term of the last modification of each hit.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "q",
+ "description": "A query in the Lucene query string syntax.\nQuery parameter searches do not support the full Elasticsearch Query DSL but are handy for testing.\n\nIMPORTANT: This parameter overrides the query parameter in the request body.\nIf both parameters are specified, documents matching the query request body parameter are not returned.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "size",
+ "description": "The number of hits to return.\nBy default, you cannot page through more than 10,000 hits using the `from` and `size` parameters.\nTo page through more hits, use the `search_after` parameter.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "from",
+ "description": "The starting document offset, which must be non-negative.\nBy default, you cannot page through more than 10,000 hits using the `from` and `size` parameters.\nTo page through more hits, use the `search_after` parameter.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "sort",
+ "description": "A comma-separated list of `:` pairs.",
+ "deprecated": false,
+ "schema": {
+ "oneOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ ]
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "aggregations": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/explore-analyze/query-filter/aggregations"
+ },
+ "description": "Defines the aggregations that are run as part of the search request.",
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/_types.aggregations.AggregationContainer"
+ }
+ },
+ "collapse": {
+ "description": "Collapses search results the values of the specified field.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.FieldCollapse"
+ }
+ ]
+ },
+ "explain": {
+ "description": "If `true`, the request returns detailed information about score computation as part of a hit.",
+ "default": false,
+ "type": "boolean"
+ },
+ "ext": {
+ "description": "Configuration of search extensions defined by Elasticsearch plugins.",
+ "type": "object",
+ "additionalProperties": {
+ "type": "object"
+ }
+ },
+ "from": {
+ "description": "The starting document offset, which must be non-negative.\nBy default, you cannot page through more than 10,000 hits using the `from` and `size` parameters.\nTo page through more hits, use the `search_after` parameter.",
+ "default": 0.0,
+ "type": "number"
+ },
+ "highlight": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/highlighting"
+ },
+ "description": "Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.Highlight"
+ }
+ ]
+ },
+ "track_total_hits": {
+ "description": "Number of hits matching the query to count accurately.\nIf `true`, the exact number of hits is returned at the cost of some performance.\nIf `false`, the response does not include the total number of hits matching the query.",
+ "default": "10000",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.TrackHits"
+ }
+ ]
+ },
+ "indices_boost": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/explore-analyze/query-filter/languages/querydsl#relevance-scores"
+ },
+ "description": "Boost the `_score` of documents from specified indices.\nThe boost value is the factor by which scores are multiplied.\nA boost value greater than `1.0` increases the score.\nA boost value between `0` and `1.0` decreases the score.",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "number"
+ },
+ "minProperties": 1,
+ "maxProperties": 1
+ }
+ },
+ "docvalue_fields": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/retrieve-selected-fields#docvalue-fields"
+ },
+ "description": "An array of wildcard (`*`) field patterns.\nThe request returns doc values for field names matching these patterns in the `hits.fields` property of the response.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_types.query_dsl.FieldAndFormat"
+ }
+ },
+ "knn": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/solutions/search/vector/knn#approximate-knn"
+ },
+ "description": "The approximate kNN search to run.",
+ "x-state": "Generally available; Added in 8.4.0",
+ "oneOf": [
+ {
+ "$ref": "#/components/schemas/_types.KnnSearch"
+ },
+ {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_types.KnnSearch"
+ }
+ }
+ ]
+ },
+ "rank": {
+ "description": "The Reciprocal Rank Fusion (RRF) to use.",
+ "x-state": "Generally available; Added in 8.8.0",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.RankContainer"
+ }
+ ]
+ },
+ "min_score": {
+ "description": "The minimum `_score` for matching documents.\nDocuments with a lower `_score` are not included in search results and results collected by aggregations.",
+ "type": "number"
+ },
+ "post_filter": {
+ "description": "Use the `post_filter` parameter to filter search results.\nThe search hits are filtered after the aggregations are calculated.\nA post filter has no impact on the aggregation results.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.query_dsl.QueryContainer"
+ }
+ ]
+ },
+ "profile": {
+ "description": "Set to `true` to return detailed timing information about the execution of individual components in a search request.\nNOTE: This is a debugging tool and adds significant overhead to search execution.",
+ "default": false,
+ "type": "boolean"
+ },
+ "query": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/explore-analyze/query-filter/languages/querydsl"
+ },
+ "description": "The search definition using the Query DSL.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.query_dsl.QueryContainer"
+ }
+ ]
+ },
+ "rescore": {
+ "description": "Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the `query` and `post_filter` phases.",
+ "oneOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.Rescore"
+ },
+ {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_global.search._types.Rescore"
+ }
+ }
+ ]
+ },
+ "retriever": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/retrievers"
+ },
+ "description": "A retriever is a specification to describe top documents returned from a search.\nA retriever replaces other elements of the search API that also return top documents such as `query` and `knn`.",
+ "x-state": "Generally available; Added in 8.14.0",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.RetrieverContainer"
+ }
+ ]
+ },
+ "script_fields": {
+ "description": "Retrieve a script evaluation (based on different fields) for each hit.",
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/_types.ScriptField"
+ }
+ },
+ "search_after": {
+ "description": "Used to retrieve the next page of hits using a set of sort values from the previous page.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.SortResults"
+ }
+ ]
+ },
+ "size": {
+ "description": "The number of hits to return, which must not be negative.\nBy default, you cannot page through more than 10,000 hits using the `from` and `size` parameters.\nTo page through more hits, use the `search_after` property.",
+ "default": 10.0,
+ "type": "number"
+ },
+ "slice": {
+ "description": "Split a scrolled search into multiple slices that can be consumed independently.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.SlicedScroll"
+ }
+ ]
+ },
+ "sort": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/sort-search-results"
+ },
+ "description": "A comma-separated list of : pairs.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Sort"
+ }
+ ]
+ },
+ "_source": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/retrieve-selected-fields#source-filtering"
+ },
+ "description": "The source fields that are returned for matching documents.\nThese fields are returned in the `hits._source` property of the search response.\nIf the `stored_fields` property is specified, the `_source` property defaults to `false`.\nOtherwise, it defaults to `true`.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.SourceConfig"
+ }
+ ]
+ },
+ "fields": {
+ "description": "An array of wildcard (`*`) field patterns.\nThe request returns values for field names matching these patterns in the `hits.fields` property of the response.",
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_types.query_dsl.FieldAndFormat"
+ }
+ },
+ "suggest": {
+ "description": "Defines a suggester that provides similar looking terms based on a provided text.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.Suggester"
+ }
+ ]
+ },
+ "terminate_after": {
+ "description": "The maximum number of documents to collect for each shard.\nIf a query reaches this limit, Elasticsearch terminates the query early.\nElasticsearch collects documents before sorting.\n\nIMPORTANT: Use with caution.\nElasticsearch applies this property to each shard handling the request.\nWhen possible, let Elasticsearch perform early termination automatically.\nAvoid specifying this property for requests that target data streams with backing indices across multiple data tiers.\n\nIf set to `0` (default), the query does not terminate early.",
+ "default": 0.0,
+ "type": "number"
+ },
+ "timeout": {
+ "description": "The period of time to wait for a response from each shard.\nIf no response is received before the timeout expires, the request fails and returns an error.\nDefaults to no timeout.",
+ "type": "string"
+ },
+ "track_scores": {
+ "description": "If `true`, calculate and return document scores, even if the scores are not used for sorting.",
+ "default": false,
+ "type": "boolean"
+ },
+ "version": {
+ "description": "If `true`, the request returns the document version as part of a hit.",
+ "default": false,
+ "type": "boolean"
+ },
+ "seq_no_primary_term": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/optimistic-concurrency-control"
+ },
+ "description": "If `true`, the request returns sequence number and primary term of the last modification of each hit.",
+ "type": "boolean"
+ },
+ "stored_fields": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/reference/elasticsearch/rest-apis/retrieve-selected-fields#stored-fields"
+ },
+ "description": "A comma-separated list of stored fields to return as part of a hit.\nIf no fields are specified, no stored fields are included in the response.\nIf this field is specified, the `_source` property defaults to `false`.\nYou can pass `_source: true` to return both source fields and stored fields in the search response.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Fields"
+ }
+ ]
+ },
+ "pit": {
+ "description": "Limit the search to a point in time (PIT).\nIf you provide a PIT, you cannot specify an `` in the request path.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_global.search._types.PointInTimeReference"
+ }
+ ]
+ },
+ "runtime_mappings": {
+ "externalDocs": {
+ "url": "https://www.elastic.co/docs/manage-data/data-store/mapping/define-runtime-fields-in-search-request"
+ },
+ "description": "One or more runtime fields in the search request.\nThese fields take precedence over mapped fields with the same name.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.mapping.RuntimeFields"
+ }
+ ]
+ },
+ "stats": {
+ "description": "The stats groups to associate with the search.\nEach group maintains a statistics aggregation for its associated searches.\nYou can retrieve these stats using the indices stats API.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "examples": {
+ "SearchRequestExample1": {
+ "summary": "A simple term search",
+ "description": "Run `GET /my-index-000001/_search?from=40&size=20` to run a search.\n",
+ "value": "{\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n}"
+ },
+ "SearchRequestExample2": {
+ "summary": "A point in time search",
+ "description": "Run `POST /_search` to run a point in time search. The `id` parameter tells Elasticsearch to run the request using contexts from this open point in time. The `keep_alive` parameter tells Elasticsearch how long it should extend the time to live of the point in time.\n",
+ "value": "{\n \"size\": 100, \n \"query\": {\n \"match\" : {\n \"title\" : \"elasticsearch\"\n }\n },\n \"pit\": {\n \"id\": \"46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==\", \n \"keep_alive\": \"1m\" \n }\n}"
+ },
+ "SearchRequestExample3": {
+ "summary": "Search slicing",
+ "description": "When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently. The result from running the first `GET /_search` request returns documents belonging to the first slice (`id: 0`). If you run a second request with `id` set to `1', it returns documents in the second slice. Since the maximum number of slices is set to `2`, the union of the results is equivalent to the results of a point-in-time search without slicing.\n",
+ "value": "{\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}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_global.search.ResponseBody"
+ },
+ "examples": {
+ "SearchResponseExample1": {
+ "description": "An abbreviated response from `GET /my-index-000001/_search?from=40&size=20` with a simple term query.\n",
+ "value": "{\n \"took\": 5,\n \"timed_out\": false,\n \"_shards\": {\n \"total\": 1,\n \"successful\": 1,\n \"skipped\": 0,\n \"failed\": 0\n },\n \"hits\": {\n \"total\": {\n \"value\": 20,\n \"relation\": \"eq\"\n },\n \"max_score\": 1.3862942,\n \"hits\": [\n {\n \"_index\": \"my-index-000001\",\n \"_id\": \"0\",\n \"_score\": 1.3862942,\n \"_source\": {\n \"@timestamp\": \"2099-11-15T14:12:12\",\n \"http\": {\n \"request\": {\n \"method\": \"get\"\n },\n \"response\": {\n \"status_code\": 200,\n \"bytes\": 1070000\n },\n \"version\": \"1.1\"\n },\n \"source\": {\n \"ip\": \"127.0.0.1\"\n },\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n }\n }\n ]\n }\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Generally available",
+ "x-variations": [
+ "\n GET\n /{index}/_search\n
\n ",
+ "\n POST\n /{index}/_search\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `read`\n"
+ ],
+ "x-api": "search",
+ "x-category": "search",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET /my-index-000001/_search?from=40&size=20\n{\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.search(\n index=\"my-index-000001\",\n from=\"40\",\n size=\"20\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.search({\n index: \"my-index-000001\",\n from: 40,\n size: 20,\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.search(\n index: \"my-index-000001\",\n from: \"40\",\n size: \"20\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->search([\n \"index\" => \"my-index-000001\",\n \"from\" => \"40\",\n \"size\" => \"20\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}' \"$ELASTICSEARCH_URL/my-index-000001/_search?from=40&size=20\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_application/search_application/{name}": {
+ "get": {
+ "tags": [
+ "search_application"
+ ],
+ "summary": "Get search application details",
+ "operationId": "search-application-get",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "name",
+ "description": "The name of the search application",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Name"
+ },
+ "style": "simple"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/search_application._types.SearchApplication"
+ },
+ "examples": {
+ "SearchApplicationGetResponseExample1": {
+ "description": "A sucessful response from `GET _application/search_application/my-app/`.",
+ "value": "{\n \"name\": \"my-app\",\n \"indices\": [ \"index1\", \"index2\" ],\n \"updated_at_millis\": 1682105622204,\n \"template\": {\n \"script\": {\n \"source\": {\n \"query\": {\n \"query_string\": {\n \"query\": \"{{query_string}}\",\n \"default_field\": \"{{default_field}}\"\n }\n }\n },\n \"lang\": \"mustache\",\n \"options\": {\n \"content_type\": \"application/json;charset=utf-8\"\n },\n \"params\": {\n \"query_string\": \"*\",\n \"default_field\": \"*\"\n }\n }\n }\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Beta; Added in 8.8.0",
+ "x-variations": [
+ "\n GET\n /_application/search_application/{name}\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_search_application`\n"
+ ],
+ "x-api": "get.search_application",
+ "x-category": "management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _application/search_application/my-app/\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.search_application.get(\n name=\"my-app\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.searchApplication.get({\n name: \"my-app\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.search_application.get(\n name: \"my-app\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->searchApplication()->get([\n \"name\" => \"my-app\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/search_application/my-app/\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.searchApplication().get(g -> g\n .name(\"my-app\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "put": {
+ "tags": [
+ "search_application"
+ ],
+ "summary": "Create or update a search application",
+ "operationId": "search-application-put",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "name",
+ "description": "The name of the search application to be created or updated.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Name"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "create",
+ "description": "If `true`, this request cannot replace or update existing Search Applications.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/search_application._types.SearchApplicationParameters"
+ },
+ "examples": {
+ "SearchApplicationPutRequestExample1": {
+ "description": "Run `PUT _application/search_application/my-app` to create or update a search application called `my-app`. When the dictionary parameter is specified, the search application search API will perform the following parameter validation: it accepts only the `query_string` and `default_field` parameters; it verifies that `query_string` and `default_field` are both strings; it accepts `default_field` only if it takes the values title or description. If the parameters are not valid, the search application search API will return an error.\n",
+ "value": "{\n \"indices\": [ \"index1\", \"index2\" ],\n \"template\": {\n \"script\": {\n \"source\": {\n \"query\": {\n \"query_string\": {\n \"query\": \"{{query_string}}\",\n \"default_field\": \"{{default_field}}\"\n }\n }\n },\n \"params\": {\n \"query_string\": \"*\",\n \"default_field\": \"*\"\n }\n },\n \"dictionary\": {\n \"properties\": {\n \"query_string\": {\n \"type\": \"string\"\n },\n \"default_field\": {\n \"type\": \"string\",\n \"enum\": [\n \"title\",\n \"description\"\n ]\n },\n \"additionalProperties\": false\n },\n \"required\": [\n \"query_string\"\n ]\n }\n }\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "result": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/_types.Result"
+ }
+ ]
+ }
+ },
+ "required": [
+ "result"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Beta; Added in 8.8.0",
+ "x-variations": [
+ "\n PUT\n /_application/search_application/{name}\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `manage`\n",
+ "Cluster privileges: `manage_search_application`\n"
+ ],
+ "x-api": "put.search_application",
+ "x-category": "management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "PUT _application/search_application/my-app\n{\n \"indices\": [ \"index1\", \"index2\" ],\n \"template\": {\n \"script\": {\n \"source\": {\n \"query\": {\n \"query_string\": {\n \"query\": \"{{query_string}}\",\n \"default_field\": \"{{default_field}}\"\n }\n }\n },\n \"params\": {\n \"query_string\": \"*\",\n \"default_field\": \"*\"\n }\n },\n \"dictionary\": {\n \"properties\": {\n \"query_string\": {\n \"type\": \"string\"\n },\n \"default_field\": {\n \"type\": \"string\",\n \"enum\": [\n \"title\",\n \"description\"\n ]\n },\n \"additionalProperties\": false\n },\n \"required\": [\n \"query_string\"\n ]\n }\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.search_application.put(\n name=\"my-app\",\n search_application={\n \"indices\": [\n \"index1\",\n \"index2\"\n ],\n \"template\": {\n \"script\": {\n \"source\": {\n \"query\": {\n \"query_string\": {\n \"query\": \"{{query_string}}\",\n \"default_field\": \"{{default_field}}\"\n }\n }\n },\n \"params\": {\n \"query_string\": \"*\",\n \"default_field\": \"*\"\n }\n },\n \"dictionary\": {\n \"properties\": {\n \"query_string\": {\n \"type\": \"string\"\n },\n \"default_field\": {\n \"type\": \"string\",\n \"enum\": [\n \"title\",\n \"description\"\n ]\n },\n \"additionalProperties\": False\n },\n \"required\": [\n \"query_string\"\n ]\n }\n }\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.searchApplication.put({\n name: \"my-app\",\n search_application: {\n indices: [\"index1\", \"index2\"],\n template: {\n script: {\n source: {\n query: {\n query_string: {\n query: \"{{query_string}}\",\n default_field: \"{{default_field}}\",\n },\n },\n },\n params: {\n query_string: \"*\",\n default_field: \"*\",\n },\n },\n dictionary: {\n properties: {\n query_string: {\n type: \"string\",\n },\n default_field: {\n type: \"string\",\n enum: [\"title\", \"description\"],\n },\n additionalProperties: false,\n },\n required: [\"query_string\"],\n },\n },\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.search_application.put(\n name: \"my-app\",\n body: {\n \"indices\": [\n \"index1\",\n \"index2\"\n ],\n \"template\": {\n \"script\": {\n \"source\": {\n \"query\": {\n \"query_string\": {\n \"query\": \"{{query_string}}\",\n \"default_field\": \"{{default_field}}\"\n }\n }\n },\n \"params\": {\n \"query_string\": \"*\",\n \"default_field\": \"*\"\n }\n },\n \"dictionary\": {\n \"properties\": {\n \"query_string\": {\n \"type\": \"string\"\n },\n \"default_field\": {\n \"type\": \"string\",\n \"enum\": [\n \"title\",\n \"description\"\n ]\n },\n \"additionalProperties\": false\n },\n \"required\": [\n \"query_string\"\n ]\n }\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->searchApplication()->put([\n \"name\" => \"my-app\",\n \"body\" => [\n \"indices\" => array(\n \"index1\",\n \"index2\",\n ),\n \"template\" => [\n \"script\" => [\n \"source\" => [\n \"query\" => [\n \"query_string\" => [\n \"query\" => \"{{query_string}}\",\n \"default_field\" => \"{{default_field}}\",\n ],\n ],\n ],\n \"params\" => [\n \"query_string\" => \"*\",\n \"default_field\" => \"*\",\n ],\n ],\n \"dictionary\" => [\n \"properties\" => [\n \"query_string\" => [\n \"type\" => \"string\",\n ],\n \"default_field\" => [\n \"type\" => \"string\",\n \"enum\" => array(\n \"title\",\n \"description\",\n ),\n ],\n \"additionalProperties\" => false,\n ],\n \"required\" => array(\n \"query_string\",\n ),\n ],\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"indices\":[\"index1\",\"index2\"],\"template\":{\"script\":{\"source\":{\"query\":{\"query_string\":{\"query\":\"{{query_string}}\",\"default_field\":\"{{default_field}}\"}}},\"params\":{\"query_string\":\"*\",\"default_field\":\"*\"}},\"dictionary\":{\"properties\":{\"query_string\":{\"type\":\"string\"},\"default_field\":{\"type\":\"string\",\"enum\":[\"title\",\"description\"]},\"additionalProperties\":false},\"required\":[\"query_string\"]}}}' \"$ELASTICSEARCH_URL/_application/search_application/my-app\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "delete": {
+ "tags": [
+ "search_application"
+ ],
+ "summary": "Delete a search application",
+ "description": "Remove a search application and its associated alias. Indices attached to the search application are not removed.",
+ "operationId": "search-application-delete",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "name",
+ "description": "The name of the search application to delete.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Name"
+ },
+ "style": "simple"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_types.AcknowledgedResponseBase"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Beta; Added in 8.8.0",
+ "x-variations": [
+ "\n DELETE\n /_application/search_application/{name}\n
\n "
+ ],
+ "x-req-auth": [
+ "Index privileges: `manage`\n",
+ "Cluster privileges: `manage_search_application`\n"
+ ],
+ "x-api": "delete.search_application",
+ "x-category": "management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "DELETE _application/search_application/my-app/\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.search_application.delete(\n name=\"my-app\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.searchApplication.delete({\n name: \"my-app\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.search_application.delete(\n name: \"my-app\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->searchApplication()->delete([\n \"name\" => \"my-app\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/search_application/my-app/\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.searchApplication().delete(d -> d\n .name(\"my-app\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_application/analytics/{name}": {
+ "get": {
+ "tags": [
+ "analytics"
+ ],
+ "summary": "Get behavioral analytics collections",
+ "operationId": "search-application-get-behavioral-analytics-1",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "name",
+ "description": "A list of analytics collections to limit the returned information",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/_types.Name"
+ }
+ },
+ "style": "simple"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/search_application._types.AnalyticsCollection"
+ }
+ },
+ "examples": {
+ "BehavioralAnalyticsGetResponseExample1": {
+ "description": "A successful response from `GET _application/analytics/my*`",
+ "value": "{\n \"my_analytics_collection\": {\n \"event_data_stream\": {\n \"name\": \"behavioral_analytics-events-my_analytics_collection\"\n }\n },\n \"my_analytics_collection2\": {\n \"event_data_stream\": {\n \"name\": \"behavioral_analytics-events-my_analytics_collection2\"\n }\n }\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "deprecated": true,
+ "x-state": "Technical preview; Added in 8.8.0",
+ "x-variations": [
+ "\n GET\n /_application/analytics/{name}\n
\n "
+ ],
+ "x-api": "get_behavioral_analytics.search_application",
+ "x-category": "management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _application/analytics/my*\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.search_application.get_behavioral_analytics(\n name=\"my*\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.searchApplication.getBehavioralAnalytics({\n name: \"my*\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.search_application.get_behavioral_analytics(\n name: \"my*\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->searchApplication()->getBehavioralAnalytics([\n \"name\" => \"my*\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/analytics/my*\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.searchApplication().getBehavioralAnalytics(g -> g\n .name(\"my*\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "put": {
+ "tags": [
+ "analytics"
+ ],
+ "summary": "Create a behavioral analytics collection",
+ "operationId": "search-application-put-behavioral-analytics",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "name",
+ "description": "The name of the analytics collection to be created or updated.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Name"
+ },
+ "style": "simple"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/search_application.put_behavioral_analytics.AnalyticsAcknowledgeResponseBase"
+ }
+ }
+ }
+ }
+ },
+ "deprecated": true,
+ "x-state": "Technical preview; Added in 8.8.0",
+ "x-variations": [
+ "\n PUT\n /_application/analytics/{name}\n
\n "
+ ],
+ "x-api": "put_behavioral_analytics.search_application",
+ "x-category": "management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "PUT _application/analytics/my_analytics_collection\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.search_application.put_behavioral_analytics(\n name=\"my_analytics_collection\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.searchApplication.putBehavioralAnalytics({\n name: \"my_analytics_collection\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.search_application.put_behavioral_analytics(\n name: \"my_analytics_collection\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->searchApplication()->putBehavioralAnalytics([\n \"name\" => \"my_analytics_collection\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/analytics/my_analytics_collection\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.searchApplication().putBehavioralAnalytics(p -> p\n .name(\"my_analytics_collection\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "delete": {
+ "tags": [
+ "analytics"
+ ],
+ "summary": "Delete a behavioral analytics collection",
+ "description": "The associated data stream is also deleted.",
+ "operationId": "search-application-delete-behavioral-analytics",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "name",
+ "description": "The name of the analytics collection to be deleted",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Name"
+ },
+ "style": "simple"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_types.AcknowledgedResponseBase"
+ }
+ }
+ }
+ }
+ },
+ "deprecated": true,
+ "x-state": "Technical preview; Added in 8.8.0",
+ "x-variations": [
+ "\n DELETE\n /_application/analytics/{name}\n
\n "
+ ],
+ "x-api": "delete_behavioral_analytics.search_application",
+ "x-category": "management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "DELETE _application/analytics/my_analytics_collection/\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.search_application.delete_behavioral_analytics(\n name=\"my_analytics_collection\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.searchApplication.deleteBehavioralAnalytics({\n name: \"my_analytics_collection\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.search_application.delete_behavioral_analytics(\n name: \"my_analytics_collection\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->searchApplication()->deleteBehavioralAnalytics([\n \"name\" => \"my_analytics_collection\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/analytics/my_analytics_collection/\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.searchApplication().deleteBehavioralAnalytics(d -> d\n .name(\"my_analytics_collection\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_application/analytics": {
+ "get": {
+ "tags": [
+ "analytics"
+ ],
+ "summary": "Get behavioral analytics collections",
+ "operationId": "search-application-get-behavioral-analytics",
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/search_application._types.AnalyticsCollection"
+ }
+ },
+ "examples": {
+ "BehavioralAnalyticsGetResponseExample1": {
+ "description": "A successful response from `GET _application/analytics/my*`",
+ "value": "{\n \"my_analytics_collection\": {\n \"event_data_stream\": {\n \"name\": \"behavioral_analytics-events-my_analytics_collection\"\n }\n },\n \"my_analytics_collection2\": {\n \"event_data_stream\": {\n \"name\": \"behavioral_analytics-events-my_analytics_collection2\"\n }\n }\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "deprecated": true,
+ "x-state": "Technical preview; Added in 8.8.0",
+ "x-variations": [
+ "\n GET\n /_application/analytics\n
\n "
+ ],
+ "x-api": "get_behavioral_analytics.search_application",
+ "x-category": "management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _application/analytics/my*\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.search_application.get_behavioral_analytics(\n name=\"my*\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.searchApplication.getBehavioralAnalytics({\n name: \"my*\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.search_application.get_behavioral_analytics(\n name: \"my*\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->searchApplication()->getBehavioralAnalytics([\n \"name\" => \"my*\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/analytics/my*\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.searchApplication().getBehavioralAnalytics(g -> g\n .name(\"my*\")\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_application/search_application": {
+ "get": {
+ "tags": [
+ "search_application"
+ ],
+ "summary": "Get search applications",
+ "description": "Get information about search applications.",
+ "operationId": "search-application-list",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "q",
+ "description": "Query in the Lucene query string syntax.",
+ "deprecated": false,
+ "schema": {
+ "type": "string"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "from",
+ "description": "Starting offset.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ },
+ {
+ "in": "query",
+ "name": "size",
+ "description": "Specifies a max number of results to get.",
+ "deprecated": false,
+ "schema": {
+ "type": "number"
+ },
+ "style": "form"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "count": {
+ "type": "number"
+ },
+ "results": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/search_application._types.SearchApplication"
+ }
+ }
+ },
+ "required": [
+ "count",
+ "results"
+ ]
+ },
+ "examples": {
+ "SearchApplicationsListResponseExample1": {
+ "description": "A succesful response from `GET _application/search_application?from=0&size=3&q=app*` returns the first three search applications whose names start with `app`.",
+ "value": "{\n \"count\": 2,\n \"results\": [\n {\n \"name\": \"app-1\",\n \"updated_at_millis\": 1690981129366\n },\n {\n \"name\": \"app-2\",\n \"updated_at_millis\": 1691501823939\n }\n ]\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Beta; Added in 8.8.0",
+ "x-variations": [
+ "\n GET\n /_application/search_application\n
\n "
+ ],
+ "x-req-auth": [
+ "Cluster privileges: `manage_search_application`\n"
+ ],
+ "x-api": "list.search_application",
+ "x-category": "management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "GET _application/search_application?from=0&size=3&q=app*\n"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.search_application.list(\n from=\"0\",\n size=\"3\",\n q=\"app*\",\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.searchApplication.list({\n from: 0,\n size: 3,\n q: \"app*\",\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.search_application.list(\n from: \"0\",\n size: \"3\",\n q: \"app*\"\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->searchApplication()->list([\n \"from\" => \"0\",\n \"size\" => \"3\",\n \"q\" => \"app*\",\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_application/search_application?from=0&size=3&q=app*\""
+ },
+ {
+ "lang": "Java",
+ "source": "client.searchApplication().list(l -> l\n .from(0)\n .q(\"app*\")\n .size(3)\n);\n"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_application/analytics/{collection_name}/event/{event_type}": {
+ "post": {
+ "tags": [
+ "analytics"
+ ],
+ "summary": "Create a behavioral analytics collection event",
+ "externalDocs": {
+ "url": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/behavioral-analytics-event-reference.html",
+ "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/post-analytics-collection-event.html"
+ },
+ "operationId": "search-application-post-behavioral-analytics-event",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "collection_name",
+ "description": "The name of the behavioral analytics collection.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Name"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "path",
+ "name": "event_type",
+ "description": "The analytics event type.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/search_application._types.EventType"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "debug",
+ "description": "Whether the response type has to include more details",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object"
+ },
+ "examples": {
+ "BehavioralAnalyticsEventPostRequestExample1": {
+ "description": "Run `POST _application/analytics/my_analytics_collection/event/search_click` to send a `search_click` event to an analytics collection called `my_analytics_collection`.",
+ "value": "{\n \"session\": {\n \"id\": \"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\"\n },\n \"user\": {\n \"id\": \"5f26f01a-bbee-4202-9298-81261067abbd\"\n },\n \"search\":{\n \"query\": \"search term\",\n \"results\": {\n \"items\": [\n {\n \"document\": {\n \"id\": \"123\",\n \"index\": \"products\"\n }\n }\n ],\n \"total_results\": 10\n },\n \"sort\": {\n \"name\": \"relevance\"\n },\n \"search_application\": \"website\"\n },\n \"document\":{\n \"id\": \"123\",\n \"index\": \"products\"\n }\n}"
+ }
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "accepted": {
+ "type": "boolean"
+ },
+ "event": {
+ "type": "object"
+ }
+ },
+ "required": [
+ "accepted"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "deprecated": true,
+ "x-state": "Technical preview",
+ "x-variations": [
+ "\n POST\n /_application/analytics/{collection_name}/event/{event_type}\n
\n "
+ ],
+ "x-api": "post_behavioral_analytics_event.search_application",
+ "x-category": "management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _application/analytics/my_analytics_collection/event/search_click\n{\n \"session\": {\n \"id\": \"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\"\n },\n \"user\": {\n \"id\": \"5f26f01a-bbee-4202-9298-81261067abbd\"\n },\n \"search\":{\n \"query\": \"search term\",\n \"results\": {\n \"items\": [\n {\n \"document\": {\n \"id\": \"123\",\n \"index\": \"products\"\n }\n }\n ],\n \"total_results\": 10\n },\n \"sort\": {\n \"name\": \"relevance\"\n },\n \"search_application\": \"website\"\n },\n \"document\":{\n \"id\": \"123\",\n \"index\": \"products\"\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.search_application.post_behavioral_analytics_event(\n collection_name=\"my_analytics_collection\",\n event_type=\"search_click\",\n payload={\n \"session\": {\n \"id\": \"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\"\n },\n \"user\": {\n \"id\": \"5f26f01a-bbee-4202-9298-81261067abbd\"\n },\n \"search\": {\n \"query\": \"search term\",\n \"results\": {\n \"items\": [\n {\n \"document\": {\n \"id\": \"123\",\n \"index\": \"products\"\n }\n }\n ],\n \"total_results\": 10\n },\n \"sort\": {\n \"name\": \"relevance\"\n },\n \"search_application\": \"website\"\n },\n \"document\": {\n \"id\": \"123\",\n \"index\": \"products\"\n }\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.searchApplication.postBehavioralAnalyticsEvent({\n collection_name: \"my_analytics_collection\",\n event_type: \"search_click\",\n payload: {\n session: {\n id: \"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\",\n },\n user: {\n id: \"5f26f01a-bbee-4202-9298-81261067abbd\",\n },\n search: {\n query: \"search term\",\n results: {\n items: [\n {\n document: {\n id: \"123\",\n index: \"products\",\n },\n },\n ],\n total_results: 10,\n },\n sort: {\n name: \"relevance\",\n },\n search_application: \"website\",\n },\n document: {\n id: \"123\",\n index: \"products\",\n },\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.search_application.post_behavioral_analytics_event(\n collection_name: \"my_analytics_collection\",\n event_type: \"search_click\",\n body: {\n \"session\": {\n \"id\": \"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\"\n },\n \"user\": {\n \"id\": \"5f26f01a-bbee-4202-9298-81261067abbd\"\n },\n \"search\": {\n \"query\": \"search term\",\n \"results\": {\n \"items\": [\n {\n \"document\": {\n \"id\": \"123\",\n \"index\": \"products\"\n }\n }\n ],\n \"total_results\": 10\n },\n \"sort\": {\n \"name\": \"relevance\"\n },\n \"search_application\": \"website\"\n },\n \"document\": {\n \"id\": \"123\",\n \"index\": \"products\"\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->searchApplication()->postBehavioralAnalyticsEvent([\n \"collection_name\" => \"my_analytics_collection\",\n \"event_type\" => \"search_click\",\n \"body\" => [\n \"session\" => [\n \"id\" => \"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\",\n ],\n \"user\" => [\n \"id\" => \"5f26f01a-bbee-4202-9298-81261067abbd\",\n ],\n \"search\" => [\n \"query\" => \"search term\",\n \"results\" => [\n \"items\" => array(\n [\n \"document\" => [\n \"id\" => \"123\",\n \"index\" => \"products\",\n ],\n ],\n ),\n \"total_results\" => 10,\n ],\n \"sort\" => [\n \"name\" => \"relevance\",\n ],\n \"search_application\" => \"website\",\n ],\n \"document\" => [\n \"id\" => \"123\",\n \"index\" => \"products\",\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"session\":{\"id\":\"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\"},\"user\":{\"id\":\"5f26f01a-bbee-4202-9298-81261067abbd\"},\"search\":{\"query\":\"search term\",\"results\":{\"items\":[{\"document\":{\"id\":\"123\",\"index\":\"products\"}}],\"total_results\":10},\"sort\":{\"name\":\"relevance\"},\"search_application\":\"website\"},\"document\":{\"id\":\"123\",\"index\":\"products\"}}' \"$ELASTICSEARCH_URL/_application/analytics/my_analytics_collection/event/search_click\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_application/search_application/{name}/_render_query": {
+ "post": {
+ "tags": [
+ "search_application"
+ ],
+ "summary": "Render a search application query",
+ "description": "Generate an Elasticsearch query using the specified query parameters and the search template associated with the search application or a default template if none is specified.\nIf a parameter used in the search template is not specified in `params`, the parameter's default value will be used.\nThe API returns the specific Elasticsearch query that would be generated and run by calling the search application search API.\n\nYou must have `read` privileges on the backing alias of the search application.",
+ "operationId": "search-application-render-query",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "name",
+ "description": "The name of the search application to render teh query for.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Name"
+ },
+ "style": "simple"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "params": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "object"
+ }
+ }
+ }
+ },
+ "examples": {
+ "SearchApplicationsRenderQueryRequestExample1": {
+ "description": "Run `POST _application/search_application/my-app/_render_query` to generate a query for a search application called `my-app` that uses the search template.",
+ "value": "{\n \"params\": {\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\n \"name\": \"title\",\n \"boost\": 5\n },\n {\n \"name\": \"description\",\n \"boost\": 1\n }\n ]\n }\n}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object"
+ },
+ "examples": {
+ "SearchApplicationsRenderQueryResponseExample1": {
+ "description": "A successful response for generating a query for a search application. The `from`, `size`, and `explain` parameters were not specified in the request, so the default values specified in the search template are used.",
+ "value": "{\n \"from\": 0,\n \"size\": 10,\n \"query\": {\n \"multi_match\": {\n \"query\": \"my first query\",\n \"fields\": [\n \"description^1.0\",\n \"title^5.0\"\n ]\n }\n },\n \"explain\": false\n}"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Technical preview; Added in 8.9.0",
+ "x-variations": [
+ "\n POST\n /_application/search_application/{name}/_render_query\n
\n "
+ ],
+ "x-api": "render_query.search_application",
+ "x-category": "management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _application/search_application/my-app/_render_query\n{\n \"params\": {\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\n \"name\": \"title\",\n \"boost\": 5\n },\n {\n \"name\": \"description\",\n \"boost\": 1\n }\n ]\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.search_application.render_query(\n name=\"my-app\",\n params={\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\n \"name\": \"title\",\n \"boost\": 5\n },\n {\n \"name\": \"description\",\n \"boost\": 1\n }\n ]\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.searchApplication.renderQuery({\n name: \"my-app\",\n params: {\n query_string: \"my first query\",\n text_fields: [\n {\n name: \"title\",\n boost: 5,\n },\n {\n name: \"description\",\n boost: 1,\n },\n ],\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.search_application.render_query(\n name: \"my-app\",\n body: {\n \"params\": {\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\n \"name\": \"title\",\n \"boost\": 5\n },\n {\n \"name\": \"description\",\n \"boost\": 1\n }\n ]\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->searchApplication()->renderQuery([\n \"name\" => \"my-app\",\n \"body\" => [\n \"params\" => [\n \"query_string\" => \"my first query\",\n \"text_fields\" => array(\n [\n \"name\" => \"title\",\n \"boost\" => 5,\n ],\n [\n \"name\" => \"description\",\n \"boost\" => 1,\n ],\n ),\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"params\":{\"query_string\":\"my first query\",\"text_fields\":[{\"name\":\"title\",\"boost\":5},{\"name\":\"description\",\"boost\":1}]}}' \"$ELASTICSEARCH_URL/_application/search_application/my-app/_render_query\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/_application/search_application/{name}/_search": {
+ "get": {
+ "tags": [
+ "search_application"
+ ],
+ "summary": "Run a search application search",
+ "description": "Generate and run an Elasticsearch query that uses the specified query parameteter and the search template associated with the search application or default template.\nUnspecified template parameters are assigned their default values if applicable.",
+ "operationId": "search-application-search",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "name",
+ "description": "The name of the search application to be searched.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Name"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "typed_keys",
+ "description": "Determines whether aggregation names are prefixed by their respective types in the response.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "x-state": "Generally available; Added in 8.14.0",
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "params": {
+ "description": "Query parameters specific to this request, which will override any defaults specified in the template.",
+ "type": "object",
+ "additionalProperties": {
+ "type": "object"
+ }
+ }
+ }
+ },
+ "examples": {
+ "SearchApplicationsSearchRequestExample1": {
+ "description": "Use `POST _application/search_application/my-app/_search` to run a search against a search application called `my-app` that uses a search template.",
+ "value": "{\n \"params\": {\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\"name\": \"title\", \"boost\": 5},\n {\"name\": \"description\", \"boost\": 1}\n ]\n }\n}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_global.search.ResponseBody"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Beta; Added in 8.8.0",
+ "x-variations": [
+ "\n GET\n /_application/search_application/{name}/_search\n
\n ",
+ "\n POST\n /_application/search_application/{name}/_search\n
\n "
+ ],
+ "x-api": "search.search_application",
+ "x-category": "management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _application/search_application/my-app/_search\n{\n \"params\": {\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\"name\": \"title\", \"boost\": 5},\n {\"name\": \"description\", \"boost\": 1}\n ]\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.search_application.search(\n name=\"my-app\",\n params={\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\n \"name\": \"title\",\n \"boost\": 5\n },\n {\n \"name\": \"description\",\n \"boost\": 1\n }\n ]\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.searchApplication.search({\n name: \"my-app\",\n params: {\n query_string: \"my first query\",\n text_fields: [\n {\n name: \"title\",\n boost: 5,\n },\n {\n name: \"description\",\n boost: 1,\n },\n ],\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.search_application.search(\n name: \"my-app\",\n body: {\n \"params\": {\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\n \"name\": \"title\",\n \"boost\": 5\n },\n {\n \"name\": \"description\",\n \"boost\": 1\n }\n ]\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->searchApplication()->search([\n \"name\" => \"my-app\",\n \"body\" => [\n \"params\" => [\n \"query_string\" => \"my first query\",\n \"text_fields\" => array(\n [\n \"name\" => \"title\",\n \"boost\" => 5,\n ],\n [\n \"name\" => \"description\",\n \"boost\" => 1,\n ],\n ),\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"params\":{\"query_string\":\"my first query\",\"text_fields\":[{\"name\":\"title\",\"boost\":5},{\"name\":\"description\",\"boost\":1}]}}' \"$ELASTICSEARCH_URL/_application/search_application/my-app/_search\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ },
+ "post": {
+ "tags": [
+ "search_application"
+ ],
+ "summary": "Run a search application search",
+ "description": "Generate and run an Elasticsearch query that uses the specified query parameteter and the search template associated with the search application or default template.\nUnspecified template parameters are assigned their default values if applicable.",
+ "operationId": "search-application-search-1",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "name",
+ "description": "The name of the search application to be searched.",
+ "required": true,
+ "deprecated": false,
+ "schema": {
+ "$ref": "#/components/schemas/_types.Name"
+ },
+ "style": "simple"
+ },
+ {
+ "in": "query",
+ "name": "typed_keys",
+ "description": "Determines whether aggregation names are prefixed by their respective types in the response.",
+ "deprecated": false,
+ "schema": {
+ "type": "boolean"
+ },
+ "x-state": "Generally available; Added in 8.14.0",
+ "style": "form"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "params": {
+ "description": "Query parameters specific to this request, which will override any defaults specified in the template.",
+ "type": "object",
+ "additionalProperties": {
+ "type": "object"
+ }
+ }
+ }
+ },
+ "examples": {
+ "SearchApplicationsSearchRequestExample1": {
+ "description": "Use `POST _application/search_application/my-app/_search` to run a search against a search application called `my-app` that uses a search template.",
+ "value": "{\n \"params\": {\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\"name\": \"title\", \"boost\": 5},\n {\"name\": \"description\", \"boost\": 1}\n ]\n }\n}"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/_global.search.ResponseBody"
+ }
+ }
+ }
+ }
+ },
+ "x-state": "Beta; Added in 8.8.0",
+ "x-variations": [
+ "\n GET\n /_application/search_application/{name}/_search\n
\n ",
+ "\n POST\n /_application/search_application/{name}/_search\n
\n "
+ ],
+ "x-api": "search.search_application",
+ "x-category": "management",
+ "x-codeSamples": [
+ {
+ "lang": "Console",
+ "source": "POST _application/search_application/my-app/_search\n{\n \"params\": {\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\"name\": \"title\", \"boost\": 5},\n {\"name\": \"description\", \"boost\": 1}\n ]\n }\n}"
+ },
+ {
+ "lang": "Python",
+ "source": "resp = client.search_application.search(\n name=\"my-app\",\n params={\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\n \"name\": \"title\",\n \"boost\": 5\n },\n {\n \"name\": \"description\",\n \"boost\": 1\n }\n ]\n },\n)"
+ },
+ {
+ "lang": "JavaScript",
+ "source": "const response = await client.searchApplication.search({\n name: \"my-app\",\n params: {\n query_string: \"my first query\",\n text_fields: [\n {\n name: \"title\",\n boost: 5,\n },\n {\n name: \"description\",\n boost: 1,\n },\n ],\n },\n});"
+ },
+ {
+ "lang": "Ruby",
+ "source": "response = client.search_application.search(\n name: \"my-app\",\n body: {\n \"params\": {\n \"query_string\": \"my first query\",\n \"text_fields\": [\n {\n \"name\": \"title\",\n \"boost\": 5\n },\n {\n \"name\": \"description\",\n \"boost\": 1\n }\n ]\n }\n }\n)"
+ },
+ {
+ "lang": "PHP",
+ "source": "$resp = $client->searchApplication()->search([\n \"name\" => \"my-app\",\n \"body\" => [\n \"params\" => [\n \"query_string\" => \"my first query\",\n \"text_fields\" => array(\n [\n \"name\" => \"title\",\n \"boost\" => 5,\n ],\n [\n \"name\" => \"description\",\n \"boost\" => 1,\n ],\n ),\n ],\n ],\n]);"
+ },
+ {
+ "lang": "curl",
+ "source": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"params\":{\"query_string\":\"my first query\",\"text_fields\":[{\"name\":\"title\",\"boost\":5},{\"name\":\"description\",\"boost\":1}]}}' \"$ELASTICSEARCH_URL/_application/search_application/my-app/_search\""
+ },
+ {
+ "lang": "Java",
+ "source": "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"
+ }
+ ],
+ "x-metaTags": [
+ {
+ "content": "Elasticsearch",
+ "name": "product_name"
+ }
+ ]
+ }
+ },
+ "/{index}/_mvt/{field}/{zoom}/{x}/{y}": {
+ "get": {
+ "tags": [
+ "search"
+ ],
+ "summary": "Search a vector tile",
+ "description": "Search a vector tile for geospatial values.\nBefore using this API, you should be familiar with the Mapbox vector tile specification.\nThe API returns results as a binary mapbox vector tile.\n\nInternally, Elasticsearch translates a vector tile search API request into a search containing:\n\n* A `geo_bounding_box` query on the ``. The query uses the `//` tile as a bounding box.\n* A `geotile_grid` or `geohex_grid` aggregation on the ``. The `grid_agg` parameter determines the aggregation type. The aggregation uses the `//` tile as a bounding box.\n* Optionally, a `geo_bounds` aggregation on the ``. The search only includes this aggregation if the `exact_bounds` parameter is `true`.\n* If the optional parameter `with_labels` is `true`, the internal search will include a dynamic runtime field that calls the `getLabelPosition` function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label.\n\nThe API returns results as a binary Mapbox vector tile.\nMapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers:\n\n* A `hits` layer containing a feature for each `` value matching the `geo_bounding_box` query.\n* An `aggs` layer containing a feature for each cell of the `geotile_grid` or `geohex_grid`. The layer only contains features for cells with matching data.\n* A meta layer containing:\n * A feature containing a bounding box. By default, this is the bounding box of the tile.\n * Value ranges for any sub-aggregations on the `geotile_grid` or `geohex_grid`.\n * Metadata for the search.\n\nThe API only returns features that can display at its zoom level.\nFor example, if a polygon feature has no area at its zoom level, the API omits it.\nThe API returns errors as UTF-8 encoded JSON.\n\nIMPORTANT: You can specify several options for this API as either a query parameter or request body parameter.\nIf you specify both parameters, the query parameter takes precedence.\n\n**Grid precision for geotile**\n\nFor a `grid_agg` of `geotile`, you can use cells in the `aggs` layer as tiles for lower zoom levels.\n`grid_precision` represents the additional zoom levels available through these cells. The final precision is computed by as follows: ` + grid_precision`.\nFor example, if `` is 7 and `grid_precision` is 8, then the `geotile_grid` aggregation will use a precision of 15.\nThe maximum final precision is 29.\nThe `grid_precision` also determines the number of cells for the grid as follows: `(2^grid_precision) x (2^grid_precision)`.\nFor example, a value of 8 divides the tile into a grid of 256 x 256 cells.\nThe `aggs` layer only contains features for cells with matching data.\n\n**Grid precision for geohex**\n\nFor a `grid_agg` of `geohex`, Elasticsearch uses `