openapi: 3.2.0
info:
title: Elasticsearch Document API
description: 'Elasticsearch provides REST APIs that are used by the UI components and can be called directly to configure and access Elasticsearch features.
## Documentation source and versions
This documentation is derived from the main branch of the elasticsearch-specification repository. It is provided under license Attribution-NonCommercial-NoDerivatives 4.0 International.
This documentation contains work-in-progress information for future Elastic Stack releases.'
license:
name: Apache 2.0
url: https://github.com/elastic/elasticsearch-specification/blob/main/LICENSE
version: ''
security:
- apiKeyAuth: []
- basicAuth: []
- bearerAuth: []
tags:
- name: Document
description: The document APIs enable you to create and manage documents in an Elasticsearch index.
externalDocs:
description: Learn more.
url: https://www.elastic.co/docs/deploy-manage/distributed-architecture/reading-and-writing-documents
x-displayName: Document
paths:
/_bulk:
put:
tags:
- Document
summary: Bulk index or delete documents
description: Perform multiple `index`, `create`, `delete`, and `update` actions in a single request.
externalDocs:
url: https://www.elastic.co/docs/deploy-manage/production-guidance/optimize-performance/indexing-speed#disable-refresh-interval
x-previousVersionUrl: https://www.elastic.co/guide/en/elasticsearch/reference/8.19/docs-bulk.html
operationId: bulk-1
parameters:
- in: query
name: include_source_on_error
description: True or false if to include the document source in the error message in case of parsing errors.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: list_executed_pipelines
description: If `true`, the response will include the ingest pipelines that were run for each index or create.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: pipeline
description: 'The pipeline identifier to use to preprocess incoming documents.
If the index has a default ingest pipeline specified, setting the value to `_none` turns off the default ingest pipeline for this request.
If a final pipeline is configured, it will always run regardless of the value of this parameter.'
deprecated: false
schema:
type: string
style: form
- in: query
name: refresh
description: 'If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search.
If `wait_for`, wait for a refresh to make this operation visible to search.
If `false`, do nothing with refreshes.
Valid values: `true`, `false`, `wait_for`.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Refresh'
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: _source
description: Indicates whether to return the `_source` field (`true` or `false`) or contains a list of fields to return.
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.
You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter.
If the `_source` parameter is `false`, this parameter is ignored.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: _source_includes
description: 'A comma-separated list of source fields to include in the response.
If this parameter is specified, only these source fields are returned.
You can exclude fields from this subset using the `_source_excludes` query parameter.
If the `_source` parameter is `false`, this parameter is ignored.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: timeout
description: 'The period each action waits for the following operations: automatic index creation, dynamic mapping updates, and waiting for active shards.
The default is `1m` (one minute), which guarantees Elasticsearch waits for at least the timeout before failing.
The actual wait time could be longer, particularly when multiple waits occur.'
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.
Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).
The default is `1`, which waits for each primary shard to be active.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.WaitForActiveShards'
style: form
- in: query
name: require_alias
description: If `true`, the request's actions must target an index alias.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: require_data_stream
description: If `true`, the request's actions must target a data stream (existing or to be created).
deprecated: false
schema:
type: boolean
style: form
requestBody:
content:
application/json:
schema:
type: array
items:
oneOf:
- $ref: '#/components/schemas/_global.bulk.OperationContainer'
- $ref: '#/components/schemas/_global.bulk.UpdateAction'
- type: object
examples:
BulkRequestExample1:
summary: Multiple operations
description: Run `POST _bulk` to perform multiple operations.
value: '{ "index" : { "_index" : "test", "_id" : "1" } }
{ "field1" : "value1" }
{ "delete" : { "_index" : "test", "_id" : "2" } }
{ "create" : { "_index" : "test", "_id" : "3" } }
{ "field1" : "value3" }
{ "update" : {"_id" : "1", "_index" : "test"} }
{ "doc" : {"field2" : "value2"} }'
BulkRequestExample2:
summary: Bulk updates
description: 'When you run `POST _bulk` and use the `update` action, you can use `retry_on_conflict` as a field in the action itself (not in the extra payload line) to specify how many times an update should be retried in the case of a version conflict.
'
value: '{ "update" : {"_id" : "1", "_index" : "index1", "retry_on_conflict" : 3} }
{ "doc" : {"field" : "value"} }
{ "update" : { "_id" : "0", "_index" : "index1", "retry_on_conflict" : 3} }
{ "script" : { "source": "ctx._source.counter += params.param1", "lang" : "painless", "params" : {"param1" : 1}}, "upsert" : {"counter" : 1}}
{ "update" : {"_id" : "2", "_index" : "index1", "retry_on_conflict" : 3} }
{ "doc" : {"field" : "value"}, "doc_as_upsert" : true }
{ "update" : {"_id" : "3", "_index" : "index1", "_source" : true} }
{ "doc" : {"field" : "value"} }
{ "update" : {"_id" : "4", "_index" : "index1"} }
{ "doc" : {"field" : "value"}, "_source": true}'
BulkRequestExample3:
summary: Filter for failed operations
description: 'To return only information about failed operations, run `POST /_bulk?filter_path=items.*.error`.
'
value: '{ "update": {"_id": "5", "_index": "index1"} }
{ "doc": {"my_field": "foo"} }
{ "update": {"_id": "6", "_index": "index1"} }
{ "doc": {"my_field": "foo"} }
{ "create": {"_id": "7", "_index": "index1"} }
{ "my_field": "foo" }'
BulkRequestExample4:
summary: Dynamic templates
description: 'Run `POST /_bulk` to perform a bulk request that consists of index and create actions with the `dynamic_templates` parameter. The bulk request creates two new fields `work_location` and `home_location` with type `geo_point` according to the `dynamic_templates` parameter. However, the `raw_location` field is created using default dynamic mapping rules, as a text field in that case since it is supplied as a string in the JSON document.
'
value: '{ "index" : { "_index" : "my_index", "_id" : "1", "dynamic_templates": {"work_location": "geo_point"}} }
{ "field" : "value1", "work_location": "41.12,-71.34", "raw_location": "41.12,-71.34"}
{ "create" : { "_index" : "my_index", "_id" : "2", "dynamic_templates": {"home_location": "geo_point"}} }
{ "field" : "value2", "home_location": "41.12,-71.34"}'
required: true
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
properties:
errors:
description: If `true`, one or more of the operations in the bulk request did not complete successfully.
type: boolean
items:
description: The result of each operation in the bulk request, in the order they were submitted.
type: array
items:
type: object
additionalProperties:
$ref: '#/components/schemas/_global.bulk.ResponseItem'
minProperties: 1
maxProperties: 1
took:
description: The length of time, in milliseconds, it took to process the bulk request.
type: number
ingest_took:
type: number
required:
- errors
- items
- took
examples:
BulkResponseExample1:
summary: Multiple successful operations
value: "{\n \"took\": 30,\n \"errors\": false,\n \"items\": [\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"_version\": 1,\n \"result\": \"created\",\n \"_shards\": {\n \"total\": 2,\n \"successful\": 1,\n \"failed\": 0\n },\n \"status\": 201,\n \"_seq_no\" : 0,\n \"_primary_term\": 1\n }\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\",\n \"_version\": 1,\n \"result\": \"not_found\",\n \"_shards\": {\n \"total\": 2,\n \"successful\": 1,\n \"failed\": 0\n },\n \"status\": 404,\n \"_seq_no\" : 1,\n \"_primary_term\" : 2\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\",\n \"_version\": 1,\n \"result\": \"created\",\n \"_shards\": {\n \"total\": 2,\n \"successful\": 1,\n \"failed\": 0\n },\n \"status\": 201,\n \"_seq_no\" : 2,\n \"_primary_term\" : 3\n }\n },\n {\n \"update\": {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"_version\": 2,\n \"result\": \"updated\",\n \"_shards\": {\n \"total\": 2,\n \"successful\": 1,\n \"failed\": 0\n },\n \"status\": 200,\n \"_seq_no\" : 3,\n \"_primary_term\" : 4\n }\n }\n ]\n}"
BulkResponseExample2:
summary: Failed actions
description: 'If you run `POST /_bulk` with operations that update non-existent documents, the operations cannot complete successfully. The API returns a response with an `errors` property value `true`. The response also includes an error object for any failed operations. The error object contains additional information about the failure, such as the error type and reason.
'
value: "{\n \"took\": 486,\n \"errors\": true,\n \"items\": [\n {\n \"update\": {\n \"_index\": \"index1\",\n \"_id\": \"5\",\n \"status\": 404,\n \"error\": {\n \"type\": \"document_missing_exception\",\n \"reason\": \"[5]: document missing\",\n \"index_uuid\": \"aAsFqTI0Tc2W0LCWgPNrOA\",\n \"shard\": \"0\",\n \"index\": \"index1\"\n }\n }\n },\n {\n \"update\": {\n \"_index\": \"index1\",\n \"_id\": \"6\",\n \"status\": 404,\n \"error\": {\n \"type\": \"document_missing_exception\",\n \"reason\": \"[6]: document missing\",\n \"index_uuid\": \"aAsFqTI0Tc2W0LCWgPNrOA\",\n \"shard\": \"0\",\n \"index\": \"index1\"\n }\n }\n },\n {\n \"create\": {\n \"_index\": \"index1\",\n \"_id\": \"7\",\n \"_version\": 1,\n \"result\": \"created\",\n \"_shards\": {\n \"total\": 2,\n \"successful\": 1,\n \"failed\": 0\n },\n \"_seq_no\": 0,\n \"_primary_term\": 1,\n \"status\": 201\n }\n }\n ]\n}"
BulkResponseExample3:
summary: Filter for failed operations
description: 'An example response from `POST /_bulk?filter_path=items.*.error`, which returns only information about failed operations.
'
value: "{\n \"items\": [\n {\n \"update\": {\n \"error\": {\n \"type\": \"document_missing_exception\",\n \"reason\": \"[5]: document missing\",\n \"index_uuid\": \"aAsFqTI0Tc2W0LCWgPNrOA\",\n \"shard\": \"0\",\n \"index\": \"index1\"\n }\n }\n },\n {\n \"update\": {\n \"error\": {\n \"type\": \"document_missing_exception\",\n \"reason\": \"[6]: document missing\",\n \"index_uuid\": \"aAsFqTI0Tc2W0LCWgPNrOA\",\n \"shard\": \"0\",\n \"index\": \"index1\"\n }\n }\n }\n ]\n}"
x-state: Generally available
x-variations:
- "
\n POST\n /_bulk\n
\n "
- "\n PUT\n /_bulk\n
\n "
x-api: bulk
x-category: document management
x-codeSamples:
- lang: Console
source: 'POST _bulk
{ "index" : { "_index" : "test", "_id" : "1" } }
{ "field1" : "value1" }
{ "delete" : { "_index" : "test", "_id" : "2" } }
{ "create" : { "_index" : "test", "_id" : "3" } }
{ "field1" : "value3" }
{ "update" : {"_id" : "1", "_index" : "test"} }
{ "doc" : {"field2" : "value2"} }'
- lang: Python
source: "resp = client.bulk(\n operations=[\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ],\n)"
- lang: JavaScript
source: "const response = await client.bulk({\n operations: [\n {\n index: {\n _index: \"test\",\n _id: \"1\",\n },\n },\n {\n field1: \"value1\",\n },\n {\n delete: {\n _index: \"test\",\n _id: \"2\",\n },\n },\n {\n create: {\n _index: \"test\",\n _id: \"3\",\n },\n },\n {\n field1: \"value3\",\n },\n {\n update: {\n _id: \"1\",\n _index: \"test\",\n },\n },\n {\n doc: {\n field2: \"value2\",\n },\n },\n ],\n});"
- lang: Ruby
source: "response = client.bulk(\n body: [\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ]\n)"
- lang: PHP
source: "$resp = $client->bulk([\n \"body\" => array(\n [\n \"index\" => [\n \"_index\" => \"test\",\n \"_id\" => \"1\",\n ],\n ],\n [\n \"field1\" => \"value1\",\n ],\n [\n \"delete\" => [\n \"_index\" => \"test\",\n \"_id\" => \"2\",\n ],\n ],\n [\n \"create\" => [\n \"_index\" => \"test\",\n \"_id\" => \"3\",\n ],\n ],\n [\n \"field1\" => \"value3\",\n ],\n [\n \"update\" => [\n \"_id\" => \"1\",\n \"_index\" => \"test\",\n ],\n ],\n [\n \"doc\" => [\n \"field2\" => \"value2\",\n ],\n ],\n ),\n]);"
- lang: curl
source: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/x-ndjson" -d $''{"index":{"_index":"test","_id":"1"}}\n{"field1":"value1"}\n{"delete":{"_index":"test","_id":"2"}}\n{"create":{"_index":"test","_id":"3"}}\n{"field1":"value3"}\n{"update":{"_id":"1","_index":"test"}}\n{"doc":{"field2":"value2"}}\n'' "$ELASTICSEARCH_URL/_bulk"'
x-metaTags:
- content: Elasticsearch
name: product_name
post:
tags:
- Document
summary: Bulk index or delete documents
description: Perform multiple `index`, `create`, `delete`, and `update` actions in a single request.
externalDocs:
url: https://www.elastic.co/docs/deploy-manage/production-guidance/optimize-performance/indexing-speed#disable-refresh-interval
x-previousVersionUrl: https://www.elastic.co/guide/en/elasticsearch/reference/8.19/docs-bulk.html
operationId: bulk
parameters:
- in: query
name: include_source_on_error
description: True or false if to include the document source in the error message in case of parsing errors.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: list_executed_pipelines
description: If `true`, the response will include the ingest pipelines that were run for each index or create.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: pipeline
description: 'The pipeline identifier to use to preprocess incoming documents.
If the index has a default ingest pipeline specified, setting the value to `_none` turns off the default ingest pipeline for this request.
If a final pipeline is configured, it will always run regardless of the value of this parameter.'
deprecated: false
schema:
type: string
style: form
- in: query
name: refresh
description: 'If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search.
If `wait_for`, wait for a refresh to make this operation visible to search.
If `false`, do nothing with refreshes.
Valid values: `true`, `false`, `wait_for`.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Refresh'
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: _source
description: Indicates whether to return the `_source` field (`true` or `false`) or contains a list of fields to return.
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.
You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter.
If the `_source` parameter is `false`, this parameter is ignored.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: _source_includes
description: 'A comma-separated list of source fields to include in the response.
If this parameter is specified, only these source fields are returned.
You can exclude fields from this subset using the `_source_excludes` query parameter.
If the `_source` parameter is `false`, this parameter is ignored.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: timeout
description: 'The period each action waits for the following operations: automatic index creation, dynamic mapping updates, and waiting for active shards.
The default is `1m` (one minute), which guarantees Elasticsearch waits for at least the timeout before failing.
The actual wait time could be longer, particularly when multiple waits occur.'
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.
Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).
The default is `1`, which waits for each primary shard to be active.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.WaitForActiveShards'
style: form
- in: query
name: require_alias
description: If `true`, the request's actions must target an index alias.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: require_data_stream
description: If `true`, the request's actions must target a data stream (existing or to be created).
deprecated: false
schema:
type: boolean
style: form
requestBody:
content:
application/json:
schema:
type: array
items:
oneOf:
- $ref: '#/components/schemas/_global.bulk.OperationContainer'
- $ref: '#/components/schemas/_global.bulk.UpdateAction'
- type: object
examples:
BulkRequestExample1:
summary: Multiple operations
description: Run `POST _bulk` to perform multiple operations.
value: '{ "index" : { "_index" : "test", "_id" : "1" } }
{ "field1" : "value1" }
{ "delete" : { "_index" : "test", "_id" : "2" } }
{ "create" : { "_index" : "test", "_id" : "3" } }
{ "field1" : "value3" }
{ "update" : {"_id" : "1", "_index" : "test"} }
{ "doc" : {"field2" : "value2"} }'
BulkRequestExample2:
summary: Bulk updates
description: 'When you run `POST _bulk` and use the `update` action, you can use `retry_on_conflict` as a field in the action itself (not in the extra payload line) to specify how many times an update should be retried in the case of a version conflict.
'
value: '{ "update" : {"_id" : "1", "_index" : "index1", "retry_on_conflict" : 3} }
{ "doc" : {"field" : "value"} }
{ "update" : { "_id" : "0", "_index" : "index1", "retry_on_conflict" : 3} }
{ "script" : { "source": "ctx._source.counter += params.param1", "lang" : "painless", "params" : {"param1" : 1}}, "upsert" : {"counter" : 1}}
{ "update" : {"_id" : "2", "_index" : "index1", "retry_on_conflict" : 3} }
{ "doc" : {"field" : "value"}, "doc_as_upsert" : true }
{ "update" : {"_id" : "3", "_index" : "index1", "_source" : true} }
{ "doc" : {"field" : "value"} }
{ "update" : {"_id" : "4", "_index" : "index1"} }
{ "doc" : {"field" : "value"}, "_source": true}'
BulkRequestExample3:
summary: Filter for failed operations
description: 'To return only information about failed operations, run `POST /_bulk?filter_path=items.*.error`.
'
value: '{ "update": {"_id": "5", "_index": "index1"} }
{ "doc": {"my_field": "foo"} }
{ "update": {"_id": "6", "_index": "index1"} }
{ "doc": {"my_field": "foo"} }
{ "create": {"_id": "7", "_index": "index1"} }
{ "my_field": "foo" }'
BulkRequestExample4:
summary: Dynamic templates
description: 'Run `POST /_bulk` to perform a bulk request that consists of index and create actions with the `dynamic_templates` parameter. The bulk request creates two new fields `work_location` and `home_location` with type `geo_point` according to the `dynamic_templates` parameter. However, the `raw_location` field is created using default dynamic mapping rules, as a text field in that case since it is supplied as a string in the JSON document.
'
value: '{ "index" : { "_index" : "my_index", "_id" : "1", "dynamic_templates": {"work_location": "geo_point"}} }
{ "field" : "value1", "work_location": "41.12,-71.34", "raw_location": "41.12,-71.34"}
{ "create" : { "_index" : "my_index", "_id" : "2", "dynamic_templates": {"home_location": "geo_point"}} }
{ "field" : "value2", "home_location": "41.12,-71.34"}'
required: true
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
properties:
errors:
description: If `true`, one or more of the operations in the bulk request did not complete successfully.
type: boolean
items:
description: The result of each operation in the bulk request, in the order they were submitted.
type: array
items:
type: object
additionalProperties:
$ref: '#/components/schemas/_global.bulk.ResponseItem'
minProperties: 1
maxProperties: 1
took:
description: The length of time, in milliseconds, it took to process the bulk request.
type: number
ingest_took:
type: number
required:
- errors
- items
- took
examples:
BulkResponseExample1:
summary: Multiple successful operations
value: "{\n \"took\": 30,\n \"errors\": false,\n \"items\": [\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"_version\": 1,\n \"result\": \"created\",\n \"_shards\": {\n \"total\": 2,\n \"successful\": 1,\n \"failed\": 0\n },\n \"status\": 201,\n \"_seq_no\" : 0,\n \"_primary_term\": 1\n }\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\",\n \"_version\": 1,\n \"result\": \"not_found\",\n \"_shards\": {\n \"total\": 2,\n \"successful\": 1,\n \"failed\": 0\n },\n \"status\": 404,\n \"_seq_no\" : 1,\n \"_primary_term\" : 2\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\",\n \"_version\": 1,\n \"result\": \"created\",\n \"_shards\": {\n \"total\": 2,\n \"successful\": 1,\n \"failed\": 0\n },\n \"status\": 201,\n \"_seq_no\" : 2,\n \"_primary_term\" : 3\n }\n },\n {\n \"update\": {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"_version\": 2,\n \"result\": \"updated\",\n \"_shards\": {\n \"total\": 2,\n \"successful\": 1,\n \"failed\": 0\n },\n \"status\": 200,\n \"_seq_no\" : 3,\n \"_primary_term\" : 4\n }\n }\n ]\n}"
BulkResponseExample2:
summary: Failed actions
description: 'If you run `POST /_bulk` with operations that update non-existent documents, the operations cannot complete successfully. The API returns a response with an `errors` property value `true`. The response also includes an error object for any failed operations. The error object contains additional information about the failure, such as the error type and reason.
'
value: "{\n \"took\": 486,\n \"errors\": true,\n \"items\": [\n {\n \"update\": {\n \"_index\": \"index1\",\n \"_id\": \"5\",\n \"status\": 404,\n \"error\": {\n \"type\": \"document_missing_exception\",\n \"reason\": \"[5]: document missing\",\n \"index_uuid\": \"aAsFqTI0Tc2W0LCWgPNrOA\",\n \"shard\": \"0\",\n \"index\": \"index1\"\n }\n }\n },\n {\n \"update\": {\n \"_index\": \"index1\",\n \"_id\": \"6\",\n \"status\": 404,\n \"error\": {\n \"type\": \"document_missing_exception\",\n \"reason\": \"[6]: document missing\",\n \"index_uuid\": \"aAsFqTI0Tc2W0LCWgPNrOA\",\n \"shard\": \"0\",\n \"index\": \"index1\"\n }\n }\n },\n {\n \"create\": {\n \"_index\": \"index1\",\n \"_id\": \"7\",\n \"_version\": 1,\n \"result\": \"created\",\n \"_shards\": {\n \"total\": 2,\n \"successful\": 1,\n \"failed\": 0\n },\n \"_seq_no\": 0,\n \"_primary_term\": 1,\n \"status\": 201\n }\n }\n ]\n}"
BulkResponseExample3:
summary: Filter for failed operations
description: 'An example response from `POST /_bulk?filter_path=items.*.error`, which returns only information about failed operations.
'
value: "{\n \"items\": [\n {\n \"update\": {\n \"error\": {\n \"type\": \"document_missing_exception\",\n \"reason\": \"[5]: document missing\",\n \"index_uuid\": \"aAsFqTI0Tc2W0LCWgPNrOA\",\n \"shard\": \"0\",\n \"index\": \"index1\"\n }\n }\n },\n {\n \"update\": {\n \"error\": {\n \"type\": \"document_missing_exception\",\n \"reason\": \"[6]: document missing\",\n \"index_uuid\": \"aAsFqTI0Tc2W0LCWgPNrOA\",\n \"shard\": \"0\",\n \"index\": \"index1\"\n }\n }\n }\n ]\n}"
x-state: Generally available
x-variations:
- "\n POST\n /_bulk\n
\n "
- "\n PUT\n /_bulk\n
\n "
x-api: bulk
x-category: document management
x-codeSamples:
- lang: Console
source: 'POST _bulk
{ "index" : { "_index" : "test", "_id" : "1" } }
{ "field1" : "value1" }
{ "delete" : { "_index" : "test", "_id" : "2" } }
{ "create" : { "_index" : "test", "_id" : "3" } }
{ "field1" : "value3" }
{ "update" : {"_id" : "1", "_index" : "test"} }
{ "doc" : {"field2" : "value2"} }'
- lang: Python
source: "resp = client.bulk(\n operations=[\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ],\n)"
- lang: JavaScript
source: "const response = await client.bulk({\n operations: [\n {\n index: {\n _index: \"test\",\n _id: \"1\",\n },\n },\n {\n field1: \"value1\",\n },\n {\n delete: {\n _index: \"test\",\n _id: \"2\",\n },\n },\n {\n create: {\n _index: \"test\",\n _id: \"3\",\n },\n },\n {\n field1: \"value3\",\n },\n {\n update: {\n _id: \"1\",\n _index: \"test\",\n },\n },\n {\n doc: {\n field2: \"value2\",\n },\n },\n ],\n});"
- lang: Ruby
source: "response = client.bulk(\n body: [\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ]\n)"
- lang: PHP
source: "$resp = $client->bulk([\n \"body\" => array(\n [\n \"index\" => [\n \"_index\" => \"test\",\n \"_id\" => \"1\",\n ],\n ],\n [\n \"field1\" => \"value1\",\n ],\n [\n \"delete\" => [\n \"_index\" => \"test\",\n \"_id\" => \"2\",\n ],\n ],\n [\n \"create\" => [\n \"_index\" => \"test\",\n \"_id\" => \"3\",\n ],\n ],\n [\n \"field1\" => \"value3\",\n ],\n [\n \"update\" => [\n \"_id\" => \"1\",\n \"_index\" => \"test\",\n ],\n ],\n [\n \"doc\" => [\n \"field2\" => \"value2\",\n ],\n ],\n ),\n]);"
- lang: curl
source: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/x-ndjson" -d $''{"index":{"_index":"test","_id":"1"}}\n{"field1":"value1"}\n{"delete":{"_index":"test","_id":"2"}}\n{"create":{"_index":"test","_id":"3"}}\n{"field1":"value3"}\n{"update":{"_id":"1","_index":"test"}}\n{"doc":{"field2":"value2"}}\n'' "$ELASTICSEARCH_URL/_bulk"'
x-metaTags:
- content: Elasticsearch
name: product_name
/{index}/_bulk:
put:
tags:
- Document
summary: Bulk index or delete documents
description: Perform multiple `index`, `create`, `delete`, and `update` actions in a single request.
externalDocs:
url: https://www.elastic.co/docs/deploy-manage/production-guidance/optimize-performance/indexing-speed#disable-refresh-interval
x-previousVersionUrl: https://www.elastic.co/guide/en/elasticsearch/reference/8.19/docs-bulk.html
operationId: bulk-3
parameters:
- in: path
name: index
description: The name of the data stream, index, or index alias to perform bulk actions on.
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.IndexName'
style: simple
- in: query
name: include_source_on_error
description: True or false if to include the document source in the error message in case of parsing errors.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: list_executed_pipelines
description: If `true`, the response will include the ingest pipelines that were run for each index or create.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: pipeline
description: 'The pipeline identifier to use to preprocess incoming documents.
If the index has a default ingest pipeline specified, setting the value to `_none` turns off the default ingest pipeline for this request.
If a final pipeline is configured, it will always run regardless of the value of this parameter.'
deprecated: false
schema:
type: string
style: form
- in: query
name: refresh
description: 'If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search.
If `wait_for`, wait for a refresh to make this operation visible to search.
If `false`, do nothing with refreshes.
Valid values: `true`, `false`, `wait_for`.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Refresh'
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: _source
description: Indicates whether to return the `_source` field (`true` or `false`) or contains a list of fields to return.
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.
You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter.
If the `_source` parameter is `false`, this parameter is ignored.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: _source_includes
description: 'A comma-separated list of source fields to include in the response.
If this parameter is specified, only these source fields are returned.
You can exclude fields from this subset using the `_source_excludes` query parameter.
If the `_source` parameter is `false`, this parameter is ignored.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: timeout
description: 'The period each action waits for the following operations: automatic index creation, dynamic mapping updates, and waiting for active shards.
The default is `1m` (one minute), which guarantees Elasticsearch waits for at least the timeout before failing.
The actual wait time could be longer, particularly when multiple waits occur.'
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.
Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).
The default is `1`, which waits for each primary shard to be active.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.WaitForActiveShards'
style: form
- in: query
name: require_alias
description: If `true`, the request's actions must target an index alias.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: require_data_stream
description: If `true`, the request's actions must target a data stream (existing or to be created).
deprecated: false
schema:
type: boolean
style: form
requestBody:
content:
application/json:
schema:
type: array
items:
oneOf:
- $ref: '#/components/schemas/_global.bulk.OperationContainer'
- $ref: '#/components/schemas/_global.bulk.UpdateAction'
- type: object
examples:
BulkRequestExample1:
summary: Multiple operations
description: Run `POST _bulk` to perform multiple operations.
value: '{ "index" : { "_index" : "test", "_id" : "1" } }
{ "field1" : "value1" }
{ "delete" : { "_index" : "test", "_id" : "2" } }
{ "create" : { "_index" : "test", "_id" : "3" } }
{ "field1" : "value3" }
{ "update" : {"_id" : "1", "_index" : "test"} }
{ "doc" : {"field2" : "value2"} }'
BulkRequestExample2:
summary: Bulk updates
description: 'When you run `POST _bulk` and use the `update` action, you can use `retry_on_conflict` as a field in the action itself (not in the extra payload line) to specify how many times an update should be retried in the case of a version conflict.
'
value: '{ "update" : {"_id" : "1", "_index" : "index1", "retry_on_conflict" : 3} }
{ "doc" : {"field" : "value"} }
{ "update" : { "_id" : "0", "_index" : "index1", "retry_on_conflict" : 3} }
{ "script" : { "source": "ctx._source.counter += params.param1", "lang" : "painless", "params" : {"param1" : 1}}, "upsert" : {"counter" : 1}}
{ "update" : {"_id" : "2", "_index" : "index1", "retry_on_conflict" : 3} }
{ "doc" : {"field" : "value"}, "doc_as_upsert" : true }
{ "update" : {"_id" : "3", "_index" : "index1", "_source" : true} }
{ "doc" : {"field" : "value"} }
{ "update" : {"_id" : "4", "_index" : "index1"} }
{ "doc" : {"field" : "value"}, "_source": true}'
BulkRequestExample3:
summary: Filter for failed operations
description: 'To return only information about failed operations, run `POST /_bulk?filter_path=items.*.error`.
'
value: '{ "update": {"_id": "5", "_index": "index1"} }
{ "doc": {"my_field": "foo"} }
{ "update": {"_id": "6", "_index": "index1"} }
{ "doc": {"my_field": "foo"} }
{ "create": {"_id": "7", "_index": "index1"} }
{ "my_field": "foo" }'
BulkRequestExample4:
summary: Dynamic templates
description: 'Run `POST /_bulk` to perform a bulk request that consists of index and create actions with the `dynamic_templates` parameter. The bulk request creates two new fields `work_location` and `home_location` with type `geo_point` according to the `dynamic_templates` parameter. However, the `raw_location` field is created using default dynamic mapping rules, as a text field in that case since it is supplied as a string in the JSON document.
'
value: '{ "index" : { "_index" : "my_index", "_id" : "1", "dynamic_templates": {"work_location": "geo_point"}} }
{ "field" : "value1", "work_location": "41.12,-71.34", "raw_location": "41.12,-71.34"}
{ "create" : { "_index" : "my_index", "_id" : "2", "dynamic_templates": {"home_location": "geo_point"}} }
{ "field" : "value2", "home_location": "41.12,-71.34"}'
required: true
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
properties:
errors:
description: If `true`, one or more of the operations in the bulk request did not complete successfully.
type: boolean
items:
description: The result of each operation in the bulk request, in the order they were submitted.
type: array
items:
type: object
additionalProperties:
$ref: '#/components/schemas/_global.bulk.ResponseItem'
minProperties: 1
maxProperties: 1
took:
description: The length of time, in milliseconds, it took to process the bulk request.
type: number
ingest_took:
type: number
required:
- errors
- items
- took
examples:
BulkResponseExample1:
summary: Multiple successful operations
value: "{\n \"took\": 30,\n \"errors\": false,\n \"items\": [\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"_version\": 1,\n \"result\": \"created\",\n \"_shards\": {\n \"total\": 2,\n \"successful\": 1,\n \"failed\": 0\n },\n \"status\": 201,\n \"_seq_no\" : 0,\n \"_primary_term\": 1\n }\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\",\n \"_version\": 1,\n \"result\": \"not_found\",\n \"_shards\": {\n \"total\": 2,\n \"successful\": 1,\n \"failed\": 0\n },\n \"status\": 404,\n \"_seq_no\" : 1,\n \"_primary_term\" : 2\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\",\n \"_version\": 1,\n \"result\": \"created\",\n \"_shards\": {\n \"total\": 2,\n \"successful\": 1,\n \"failed\": 0\n },\n \"status\": 201,\n \"_seq_no\" : 2,\n \"_primary_term\" : 3\n }\n },\n {\n \"update\": {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"_version\": 2,\n \"result\": \"updated\",\n \"_shards\": {\n \"total\": 2,\n \"successful\": 1,\n \"failed\": 0\n },\n \"status\": 200,\n \"_seq_no\" : 3,\n \"_primary_term\" : 4\n }\n }\n ]\n}"
BulkResponseExample2:
summary: Failed actions
description: 'If you run `POST /_bulk` with operations that update non-existent documents, the operations cannot complete successfully. The API returns a response with an `errors` property value `true`. The response also includes an error object for any failed operations. The error object contains additional information about the failure, such as the error type and reason.
'
value: "{\n \"took\": 486,\n \"errors\": true,\n \"items\": [\n {\n \"update\": {\n \"_index\": \"index1\",\n \"_id\": \"5\",\n \"status\": 404,\n \"error\": {\n \"type\": \"document_missing_exception\",\n \"reason\": \"[5]: document missing\",\n \"index_uuid\": \"aAsFqTI0Tc2W0LCWgPNrOA\",\n \"shard\": \"0\",\n \"index\": \"index1\"\n }\n }\n },\n {\n \"update\": {\n \"_index\": \"index1\",\n \"_id\": \"6\",\n \"status\": 404,\n \"error\": {\n \"type\": \"document_missing_exception\",\n \"reason\": \"[6]: document missing\",\n \"index_uuid\": \"aAsFqTI0Tc2W0LCWgPNrOA\",\n \"shard\": \"0\",\n \"index\": \"index1\"\n }\n }\n },\n {\n \"create\": {\n \"_index\": \"index1\",\n \"_id\": \"7\",\n \"_version\": 1,\n \"result\": \"created\",\n \"_shards\": {\n \"total\": 2,\n \"successful\": 1,\n \"failed\": 0\n },\n \"_seq_no\": 0,\n \"_primary_term\": 1,\n \"status\": 201\n }\n }\n ]\n}"
BulkResponseExample3:
summary: Filter for failed operations
description: 'An example response from `POST /_bulk?filter_path=items.*.error`, which returns only information about failed operations.
'
value: "{\n \"items\": [\n {\n \"update\": {\n \"error\": {\n \"type\": \"document_missing_exception\",\n \"reason\": \"[5]: document missing\",\n \"index_uuid\": \"aAsFqTI0Tc2W0LCWgPNrOA\",\n \"shard\": \"0\",\n \"index\": \"index1\"\n }\n }\n },\n {\n \"update\": {\n \"error\": {\n \"type\": \"document_missing_exception\",\n \"reason\": \"[6]: document missing\",\n \"index_uuid\": \"aAsFqTI0Tc2W0LCWgPNrOA\",\n \"shard\": \"0\",\n \"index\": \"index1\"\n }\n }\n }\n ]\n}"
x-state: Generally available
x-variations:
- "\n POST\n /{index}/_bulk\n
\n "
- "\n PUT\n /{index}/_bulk\n
\n "
x-api: bulk
x-category: document management
x-codeSamples:
- lang: Console
source: 'POST _bulk
{ "index" : { "_index" : "test", "_id" : "1" } }
{ "field1" : "value1" }
{ "delete" : { "_index" : "test", "_id" : "2" } }
{ "create" : { "_index" : "test", "_id" : "3" } }
{ "field1" : "value3" }
{ "update" : {"_id" : "1", "_index" : "test"} }
{ "doc" : {"field2" : "value2"} }'
- lang: Python
source: "resp = client.bulk(\n operations=[\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ],\n)"
- lang: JavaScript
source: "const response = await client.bulk({\n operations: [\n {\n index: {\n _index: \"test\",\n _id: \"1\",\n },\n },\n {\n field1: \"value1\",\n },\n {\n delete: {\n _index: \"test\",\n _id: \"2\",\n },\n },\n {\n create: {\n _index: \"test\",\n _id: \"3\",\n },\n },\n {\n field1: \"value3\",\n },\n {\n update: {\n _id: \"1\",\n _index: \"test\",\n },\n },\n {\n doc: {\n field2: \"value2\",\n },\n },\n ],\n});"
- lang: Ruby
source: "response = client.bulk(\n body: [\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ]\n)"
- lang: PHP
source: "$resp = $client->bulk([\n \"body\" => array(\n [\n \"index\" => [\n \"_index\" => \"test\",\n \"_id\" => \"1\",\n ],\n ],\n [\n \"field1\" => \"value1\",\n ],\n [\n \"delete\" => [\n \"_index\" => \"test\",\n \"_id\" => \"2\",\n ],\n ],\n [\n \"create\" => [\n \"_index\" => \"test\",\n \"_id\" => \"3\",\n ],\n ],\n [\n \"field1\" => \"value3\",\n ],\n [\n \"update\" => [\n \"_id\" => \"1\",\n \"_index\" => \"test\",\n ],\n ],\n [\n \"doc\" => [\n \"field2\" => \"value2\",\n ],\n ],\n ),\n]);"
- lang: curl
source: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/x-ndjson" -d $''{"index":{"_index":"test","_id":"1"}}\n{"field1":"value1"}\n{"delete":{"_index":"test","_id":"2"}}\n{"create":{"_index":"test","_id":"3"}}\n{"field1":"value3"}\n{"update":{"_id":"1","_index":"test"}}\n{"doc":{"field2":"value2"}}\n'' "$ELASTICSEARCH_URL/_bulk"'
x-metaTags:
- content: Elasticsearch
name: product_name
post:
tags:
- Document
summary: Bulk index or delete documents
description: Perform multiple `index`, `create`, `delete`, and `update` actions in a single request.
externalDocs:
url: https://www.elastic.co/docs/deploy-manage/production-guidance/optimize-performance/indexing-speed#disable-refresh-interval
x-previousVersionUrl: https://www.elastic.co/guide/en/elasticsearch/reference/8.19/docs-bulk.html
operationId: bulk-2
parameters:
- in: path
name: index
description: The name of the data stream, index, or index alias to perform bulk actions on.
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.IndexName'
style: simple
- in: query
name: include_source_on_error
description: True or false if to include the document source in the error message in case of parsing errors.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: list_executed_pipelines
description: If `true`, the response will include the ingest pipelines that were run for each index or create.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: pipeline
description: 'The pipeline identifier to use to preprocess incoming documents.
If the index has a default ingest pipeline specified, setting the value to `_none` turns off the default ingest pipeline for this request.
If a final pipeline is configured, it will always run regardless of the value of this parameter.'
deprecated: false
schema:
type: string
style: form
- in: query
name: refresh
description: 'If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search.
If `wait_for`, wait for a refresh to make this operation visible to search.
If `false`, do nothing with refreshes.
Valid values: `true`, `false`, `wait_for`.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Refresh'
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: _source
description: Indicates whether to return the `_source` field (`true` or `false`) or contains a list of fields to return.
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.
You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter.
If the `_source` parameter is `false`, this parameter is ignored.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: _source_includes
description: 'A comma-separated list of source fields to include in the response.
If this parameter is specified, only these source fields are returned.
You can exclude fields from this subset using the `_source_excludes` query parameter.
If the `_source` parameter is `false`, this parameter is ignored.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: timeout
description: 'The period each action waits for the following operations: automatic index creation, dynamic mapping updates, and waiting for active shards.
The default is `1m` (one minute), which guarantees Elasticsearch waits for at least the timeout before failing.
The actual wait time could be longer, particularly when multiple waits occur.'
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.
Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).
The default is `1`, which waits for each primary shard to be active.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.WaitForActiveShards'
style: form
- in: query
name: require_alias
description: If `true`, the request's actions must target an index alias.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: require_data_stream
description: If `true`, the request's actions must target a data stream (existing or to be created).
deprecated: false
schema:
type: boolean
style: form
requestBody:
content:
application/json:
schema:
type: array
items:
oneOf:
- $ref: '#/components/schemas/_global.bulk.OperationContainer'
- $ref: '#/components/schemas/_global.bulk.UpdateAction'
- type: object
examples:
BulkRequestExample1:
summary: Multiple operations
description: Run `POST _bulk` to perform multiple operations.
value: '{ "index" : { "_index" : "test", "_id" : "1" } }
{ "field1" : "value1" }
{ "delete" : { "_index" : "test", "_id" : "2" } }
{ "create" : { "_index" : "test", "_id" : "3" } }
{ "field1" : "value3" }
{ "update" : {"_id" : "1", "_index" : "test"} }
{ "doc" : {"field2" : "value2"} }'
BulkRequestExample2:
summary: Bulk updates
description: 'When you run `POST _bulk` and use the `update` action, you can use `retry_on_conflict` as a field in the action itself (not in the extra payload line) to specify how many times an update should be retried in the case of a version conflict.
'
value: '{ "update" : {"_id" : "1", "_index" : "index1", "retry_on_conflict" : 3} }
{ "doc" : {"field" : "value"} }
{ "update" : { "_id" : "0", "_index" : "index1", "retry_on_conflict" : 3} }
{ "script" : { "source": "ctx._source.counter += params.param1", "lang" : "painless", "params" : {"param1" : 1}}, "upsert" : {"counter" : 1}}
{ "update" : {"_id" : "2", "_index" : "index1", "retry_on_conflict" : 3} }
{ "doc" : {"field" : "value"}, "doc_as_upsert" : true }
{ "update" : {"_id" : "3", "_index" : "index1", "_source" : true} }
{ "doc" : {"field" : "value"} }
{ "update" : {"_id" : "4", "_index" : "index1"} }
{ "doc" : {"field" : "value"}, "_source": true}'
BulkRequestExample3:
summary: Filter for failed operations
description: 'To return only information about failed operations, run `POST /_bulk?filter_path=items.*.error`.
'
value: '{ "update": {"_id": "5", "_index": "index1"} }
{ "doc": {"my_field": "foo"} }
{ "update": {"_id": "6", "_index": "index1"} }
{ "doc": {"my_field": "foo"} }
{ "create": {"_id": "7", "_index": "index1"} }
{ "my_field": "foo" }'
BulkRequestExample4:
summary: Dynamic templates
description: 'Run `POST /_bulk` to perform a bulk request that consists of index and create actions with the `dynamic_templates` parameter. The bulk request creates two new fields `work_location` and `home_location` with type `geo_point` according to the `dynamic_templates` parameter. However, the `raw_location` field is created using default dynamic mapping rules, as a text field in that case since it is supplied as a string in the JSON document.
'
value: '{ "index" : { "_index" : "my_index", "_id" : "1", "dynamic_templates": {"work_location": "geo_point"}} }
{ "field" : "value1", "work_location": "41.12,-71.34", "raw_location": "41.12,-71.34"}
{ "create" : { "_index" : "my_index", "_id" : "2", "dynamic_templates": {"home_location": "geo_point"}} }
{ "field" : "value2", "home_location": "41.12,-71.34"}'
required: true
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
properties:
errors:
description: If `true`, one or more of the operations in the bulk request did not complete successfully.
type: boolean
items:
description: The result of each operation in the bulk request, in the order they were submitted.
type: array
items:
type: object
additionalProperties:
$ref: '#/components/schemas/_global.bulk.ResponseItem'
minProperties: 1
maxProperties: 1
took:
description: The length of time, in milliseconds, it took to process the bulk request.
type: number
ingest_took:
type: number
required:
- errors
- items
- took
examples:
BulkResponseExample1:
summary: Multiple successful operations
value: "{\n \"took\": 30,\n \"errors\": false,\n \"items\": [\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"_version\": 1,\n \"result\": \"created\",\n \"_shards\": {\n \"total\": 2,\n \"successful\": 1,\n \"failed\": 0\n },\n \"status\": 201,\n \"_seq_no\" : 0,\n \"_primary_term\": 1\n }\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\",\n \"_version\": 1,\n \"result\": \"not_found\",\n \"_shards\": {\n \"total\": 2,\n \"successful\": 1,\n \"failed\": 0\n },\n \"status\": 404,\n \"_seq_no\" : 1,\n \"_primary_term\" : 2\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\",\n \"_version\": 1,\n \"result\": \"created\",\n \"_shards\": {\n \"total\": 2,\n \"successful\": 1,\n \"failed\": 0\n },\n \"status\": 201,\n \"_seq_no\" : 2,\n \"_primary_term\" : 3\n }\n },\n {\n \"update\": {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"_version\": 2,\n \"result\": \"updated\",\n \"_shards\": {\n \"total\": 2,\n \"successful\": 1,\n \"failed\": 0\n },\n \"status\": 200,\n \"_seq_no\" : 3,\n \"_primary_term\" : 4\n }\n }\n ]\n}"
BulkResponseExample2:
summary: Failed actions
description: 'If you run `POST /_bulk` with operations that update non-existent documents, the operations cannot complete successfully. The API returns a response with an `errors` property value `true`. The response also includes an error object for any failed operations. The error object contains additional information about the failure, such as the error type and reason.
'
value: "{\n \"took\": 486,\n \"errors\": true,\n \"items\": [\n {\n \"update\": {\n \"_index\": \"index1\",\n \"_id\": \"5\",\n \"status\": 404,\n \"error\": {\n \"type\": \"document_missing_exception\",\n \"reason\": \"[5]: document missing\",\n \"index_uuid\": \"aAsFqTI0Tc2W0LCWgPNrOA\",\n \"shard\": \"0\",\n \"index\": \"index1\"\n }\n }\n },\n {\n \"update\": {\n \"_index\": \"index1\",\n \"_id\": \"6\",\n \"status\": 404,\n \"error\": {\n \"type\": \"document_missing_exception\",\n \"reason\": \"[6]: document missing\",\n \"index_uuid\": \"aAsFqTI0Tc2W0LCWgPNrOA\",\n \"shard\": \"0\",\n \"index\": \"index1\"\n }\n }\n },\n {\n \"create\": {\n \"_index\": \"index1\",\n \"_id\": \"7\",\n \"_version\": 1,\n \"result\": \"created\",\n \"_shards\": {\n \"total\": 2,\n \"successful\": 1,\n \"failed\": 0\n },\n \"_seq_no\": 0,\n \"_primary_term\": 1,\n \"status\": 201\n }\n }\n ]\n}"
BulkResponseExample3:
summary: Filter for failed operations
description: 'An example response from `POST /_bulk?filter_path=items.*.error`, which returns only information about failed operations.
'
value: "{\n \"items\": [\n {\n \"update\": {\n \"error\": {\n \"type\": \"document_missing_exception\",\n \"reason\": \"[5]: document missing\",\n \"index_uuid\": \"aAsFqTI0Tc2W0LCWgPNrOA\",\n \"shard\": \"0\",\n \"index\": \"index1\"\n }\n }\n },\n {\n \"update\": {\n \"error\": {\n \"type\": \"document_missing_exception\",\n \"reason\": \"[6]: document missing\",\n \"index_uuid\": \"aAsFqTI0Tc2W0LCWgPNrOA\",\n \"shard\": \"0\",\n \"index\": \"index1\"\n }\n }\n }\n ]\n}"
x-state: Generally available
x-variations:
- "\n POST\n /{index}/_bulk\n
\n "
- "\n PUT\n /{index}/_bulk\n
\n "
x-api: bulk
x-category: document management
x-codeSamples:
- lang: Console
source: 'POST _bulk
{ "index" : { "_index" : "test", "_id" : "1" } }
{ "field1" : "value1" }
{ "delete" : { "_index" : "test", "_id" : "2" } }
{ "create" : { "_index" : "test", "_id" : "3" } }
{ "field1" : "value3" }
{ "update" : {"_id" : "1", "_index" : "test"} }
{ "doc" : {"field2" : "value2"} }'
- lang: Python
source: "resp = client.bulk(\n operations=[\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ],\n)"
- lang: JavaScript
source: "const response = await client.bulk({\n operations: [\n {\n index: {\n _index: \"test\",\n _id: \"1\",\n },\n },\n {\n field1: \"value1\",\n },\n {\n delete: {\n _index: \"test\",\n _id: \"2\",\n },\n },\n {\n create: {\n _index: \"test\",\n _id: \"3\",\n },\n },\n {\n field1: \"value3\",\n },\n {\n update: {\n _id: \"1\",\n _index: \"test\",\n },\n },\n {\n doc: {\n field2: \"value2\",\n },\n },\n ],\n});"
- lang: Ruby
source: "response = client.bulk(\n body: [\n {\n \"index\": {\n \"_index\": \"test\",\n \"_id\": \"1\"\n }\n },\n {\n \"field1\": \"value1\"\n },\n {\n \"delete\": {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n },\n {\n \"create\": {\n \"_index\": \"test\",\n \"_id\": \"3\"\n }\n },\n {\n \"field1\": \"value3\"\n },\n {\n \"update\": {\n \"_id\": \"1\",\n \"_index\": \"test\"\n }\n },\n {\n \"doc\": {\n \"field2\": \"value2\"\n }\n }\n ]\n)"
- lang: PHP
source: "$resp = $client->bulk([\n \"body\" => array(\n [\n \"index\" => [\n \"_index\" => \"test\",\n \"_id\" => \"1\",\n ],\n ],\n [\n \"field1\" => \"value1\",\n ],\n [\n \"delete\" => [\n \"_index\" => \"test\",\n \"_id\" => \"2\",\n ],\n ],\n [\n \"create\" => [\n \"_index\" => \"test\",\n \"_id\" => \"3\",\n ],\n ],\n [\n \"field1\" => \"value3\",\n ],\n [\n \"update\" => [\n \"_id\" => \"1\",\n \"_index\" => \"test\",\n ],\n ],\n [\n \"doc\" => [\n \"field2\" => \"value2\",\n ],\n ],\n ),\n]);"
- lang: curl
source: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/x-ndjson" -d $''{"index":{"_index":"test","_id":"1"}}\n{"field1":"value1"}\n{"delete":{"_index":"test","_id":"2"}}\n{"create":{"_index":"test","_id":"3"}}\n{"field1":"value3"}\n{"update":{"_id":"1","_index":"test"}}\n{"doc":{"field2":"value2"}}\n'' "$ELASTICSEARCH_URL/_bulk"'
x-metaTags:
- content: Elasticsearch
name: product_name
/{index}/_create/{id}:
put:
tags:
- Document
summary: Create a new document in the index
description: 'You can index a new JSON document with the `//_doc/` or `//_create/` APIs
Using `_create` guarantees that the document is indexed only if it does not already exist.'
externalDocs:
description: Data streams
url: https://www.elastic.co/docs/manage-data/data-store/data-streams
x-previousVersionUrl: https://www.elastic.co/guide/en/elasticsearch/reference/8.19/docs-index_.html
operationId: create
parameters:
- in: path
name: index
description: 'The name of the data stream or index to target.
If the target doesn''t exist and matches the name or wildcard (`*`) pattern of an index template with a `data_stream` definition, this request creates the data stream.
If the target doesn''t exist and doesn’t match a data stream template, this request creates the index.'
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.IndexName'
style: simple
- in: path
name: id
description: 'A unique identifier for the document.
To automatically generate a document ID, use the `POST //_doc/` request format.'
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.Id'
style: simple
- in: query
name: include_source_on_error
description: True or false if to include the document source in the error message in case of parsing errors.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: pipeline
description: 'The ID of the pipeline to use to preprocess incoming documents.
If the index has a default ingest pipeline specified, setting the value to `_none` turns off the default ingest pipeline for this request.
If a final pipeline is configured, it will always run regardless of the value of this parameter.'
deprecated: false
schema:
type: string
style: form
- in: query
name: refresh
description: 'If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search.
If `wait_for`, it waits for a refresh to make this operation visible to search.
If `false`, it does nothing with refreshes.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Refresh'
style: form
- in: query
name: require_alias
description: If `true`, the destination must be an index alias.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: require_data_stream
description: If `true`, the request's actions must target a data stream (existing or to be created).
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: timeout
description: 'The period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards.
Elasticsearch waits for at least the specified timeout period before failing.
The actual wait time could be longer, particularly when multiple waits occur.
This parameter is useful for situations where the primary shard assigned to perform the operation might not be available when the operation runs.
Some reasons for this might be that the primary shard is currently recovering from a gateway or undergoing relocation.
By default, the operation will wait on the primary shard to become available for at least 1 minute before failing and responding with an error.
The actual wait time could be longer, particularly when multiple waits occur.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Duration'
style: form
- in: query
name: version
description: 'The explicit version number for concurrency control.
It must be a non-negative long number.'
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
- in: query
name: wait_for_active_shards
description: 'The number of shard copies that must be active before proceeding with the operation.
You can set it to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).
The default value of `1` means it waits for each primary shard to be active.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.WaitForActiveShards'
style: form
requestBody:
content:
application/json:
schema:
type: object
examples:
CreateRequestExample1:
description: 'Run `PUT my-index-000001/_create/1` to index a document into the `my-index-000001` index if no document with that ID exists.
'
value: "{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}"
required: true
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/_types.WriteResponseBase'
examples:
CreateResponseExample1:
description: A successful response from `PUT my-index-000001/_create/1` which indexes a document.
value: "{\n \"_index\": \"my-index-000001\",\n \"_id\": \"1\",\n \"_version\": 1,\n \"result\": \"created\",\n \"_shards\": {\n \"total\": 1,\n \"successful\": 1,\n \"failed\": 0\n },\n \"_seq_no\": 0,\n \"_primary_term\": 1\n}"
x-state: Generally available; Added in 5.0.0
x-variations:
- "\n PUT\n /{index}/_create/{id}\n
\n "
- "\n POST\n /{index}/_create/{id}\n
\n "
x-req-auth:
- 'Index privileges: `create`
'
x-api: create
x-category: document management
x-codeSamples:
- lang: Console
source: "PUT my-index-000001/_create/1\n{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}"
- lang: Python
source: "resp = client.create(\n index=\"my-index-000001\",\n id=\"1\",\n document={\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n },\n)"
- lang: JavaScript
source: "const response = await client.create({\n index: \"my-index-000001\",\n id: 1,\n document: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n message: \"GET /search HTTP/1.1 200 1070000\",\n user: {\n id: \"kimchy\",\n },\n },\n});"
- lang: Ruby
source: "response = client.create(\n index: \"my-index-000001\",\n id: \"1\",\n body: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n }\n)"
- lang: PHP
source: "$resp = $client->create([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"body\" => [\n \"@timestamp\" => \"2099-11-15T13:12:00\",\n \"message\" => \"GET /search HTTP/1.1 200 1070000\",\n \"user\" => [\n \"id\" => \"kimchy\",\n ],\n ],\n]);"
- lang: curl
source: 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"@timestamp":"2099-11-15T13:12:00","message":"GET /search HTTP/1.1 200 1070000","user":{"id":"kimchy"}}'' "$ELASTICSEARCH_URL/my-index-000001/_create/1"'
- lang: Java
source: "client.create(c -> c\n .id(\"1\")\n .index(\"my-index-000001\")\n .document(JsonData.fromJson(\"{\\\"@timestamp\\\":\\\"2099-11-15T13:12:00\\\",\\\"message\\\":\\\"GET /search HTTP/1.1 200 1070000\\\",\\\"user\\\":{\\\"id\\\":\\\"kimchy\\\"}}\"))\n);\n"
x-metaTags:
- content: Elasticsearch
name: product_name
post:
tags:
- Document
summary: Create a new document in the index
description: 'You can index a new JSON document with the `//_doc/` or `//_create/` APIs
Using `_create` guarantees that the document is indexed only if it does not already exist.'
externalDocs:
description: Data streams
url: https://www.elastic.co/docs/manage-data/data-store/data-streams
x-previousVersionUrl: https://www.elastic.co/guide/en/elasticsearch/reference/8.19/docs-index_.html
operationId: create-1
parameters:
- in: path
name: index
description: 'The name of the data stream or index to target.
If the target doesn''t exist and matches the name or wildcard (`*`) pattern of an index template with a `data_stream` definition, this request creates the data stream.
If the target doesn''t exist and doesn’t match a data stream template, this request creates the index.'
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.IndexName'
style: simple
- in: path
name: id
description: 'A unique identifier for the document.
To automatically generate a document ID, use the `POST //_doc/` request format.'
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.Id'
style: simple
- in: query
name: include_source_on_error
description: True or false if to include the document source in the error message in case of parsing errors.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: pipeline
description: 'The ID of the pipeline to use to preprocess incoming documents.
If the index has a default ingest pipeline specified, setting the value to `_none` turns off the default ingest pipeline for this request.
If a final pipeline is configured, it will always run regardless of the value of this parameter.'
deprecated: false
schema:
type: string
style: form
- in: query
name: refresh
description: 'If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search.
If `wait_for`, it waits for a refresh to make this operation visible to search.
If `false`, it does nothing with refreshes.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Refresh'
style: form
- in: query
name: require_alias
description: If `true`, the destination must be an index alias.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: require_data_stream
description: If `true`, the request's actions must target a data stream (existing or to be created).
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: timeout
description: 'The period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards.
Elasticsearch waits for at least the specified timeout period before failing.
The actual wait time could be longer, particularly when multiple waits occur.
This parameter is useful for situations where the primary shard assigned to perform the operation might not be available when the operation runs.
Some reasons for this might be that the primary shard is currently recovering from a gateway or undergoing relocation.
By default, the operation will wait on the primary shard to become available for at least 1 minute before failing and responding with an error.
The actual wait time could be longer, particularly when multiple waits occur.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Duration'
style: form
- in: query
name: version
description: 'The explicit version number for concurrency control.
It must be a non-negative long number.'
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
- in: query
name: wait_for_active_shards
description: 'The number of shard copies that must be active before proceeding with the operation.
You can set it to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).
The default value of `1` means it waits for each primary shard to be active.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.WaitForActiveShards'
style: form
requestBody:
content:
application/json:
schema:
type: object
examples:
CreateRequestExample1:
description: 'Run `PUT my-index-000001/_create/1` to index a document into the `my-index-000001` index if no document with that ID exists.
'
value: "{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}"
required: true
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/_types.WriteResponseBase'
examples:
CreateResponseExample1:
description: A successful response from `PUT my-index-000001/_create/1` which indexes a document.
value: "{\n \"_index\": \"my-index-000001\",\n \"_id\": \"1\",\n \"_version\": 1,\n \"result\": \"created\",\n \"_shards\": {\n \"total\": 1,\n \"successful\": 1,\n \"failed\": 0\n },\n \"_seq_no\": 0,\n \"_primary_term\": 1\n}"
x-state: Generally available; Added in 5.0.0
x-variations:
- "\n PUT\n /{index}/_create/{id}\n
\n "
- "\n POST\n /{index}/_create/{id}\n
\n "
x-req-auth:
- 'Index privileges: `create`
'
x-api: create
x-category: document management
x-codeSamples:
- lang: Console
source: "PUT my-index-000001/_create/1\n{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}"
- lang: Python
source: "resp = client.create(\n index=\"my-index-000001\",\n id=\"1\",\n document={\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n },\n)"
- lang: JavaScript
source: "const response = await client.create({\n index: \"my-index-000001\",\n id: 1,\n document: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n message: \"GET /search HTTP/1.1 200 1070000\",\n user: {\n id: \"kimchy\",\n },\n },\n});"
- lang: Ruby
source: "response = client.create(\n index: \"my-index-000001\",\n id: \"1\",\n body: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n }\n)"
- lang: PHP
source: "$resp = $client->create([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"body\" => [\n \"@timestamp\" => \"2099-11-15T13:12:00\",\n \"message\" => \"GET /search HTTP/1.1 200 1070000\",\n \"user\" => [\n \"id\" => \"kimchy\",\n ],\n ],\n]);"
- lang: curl
source: 'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"@timestamp":"2099-11-15T13:12:00","message":"GET /search HTTP/1.1 200 1070000","user":{"id":"kimchy"}}'' "$ELASTICSEARCH_URL/my-index-000001/_create/1"'
- lang: Java
source: "client.create(c -> c\n .id(\"1\")\n .index(\"my-index-000001\")\n .document(JsonData.fromJson(\"{\\\"@timestamp\\\":\\\"2099-11-15T13:12:00\\\",\\\"message\\\":\\\"GET /search HTTP/1.1 200 1070000\\\",\\\"user\\\":{\\\"id\\\":\\\"kimchy\\\"}}\"))\n);\n"
x-metaTags:
- content: Elasticsearch
name: product_name
/{index}/_doc/{id}:
get:
tags:
- Document
summary: Get a document by its ID
description: 'Get a document and its source or stored fields from an index.
By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search).
In the case where stored fields are requested with the `stored_fields` parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields.
To turn off realtime behavior, set the `realtime` parameter to false.
**Source filtering**
By default, the API returns the contents of the `_source` field unless you have used the `stored_fields` parameter or the `_source` field is turned off.
You can turn off `_source` retrieval by using the `_source` parameter:
```
GET my-index-000001/_doc/0?_source=false
```
If you only need one or two fields from the `_source`, use the `_source_includes` or `_source_excludes` parameters to include or filter out particular fields.
This can be helpful with large documents where partial retrieval can save on network overhead
Both parameters take a comma separated list of fields or wildcard expressions.
For example:
```
GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities
```
If you only want to specify includes, you can use a shorter notation:
```
GET my-index-000001/_doc/0?_source=*.id
```
**Routing**
If routing is used during indexing, the routing value also needs to be specified to retrieve a document.
For example:
```
GET my-index-000001/_doc/2?routing=user1
```
This request gets the document with ID 2, but it is routed based on the user.
The document is not fetched if the correct routing is not specified.
**Distributed**
The GET operation is hashed into a specific shard ID.
It is then redirected to one of the replicas within that shard ID and returns the result.
The replicas are the primary shard and its replicas within that shard ID group.
This means that the more replicas you have, the better your GET scaling will be.
**Versioning support**
You can use the `version` parameter to retrieve the document only if its current version is equal to the specified one.
Internally, Elasticsearch has marked the old document as deleted and added an entirely new document.
The old version of the document doesn''t disappear immediately, although you won''t be able to access it.
Elasticsearch cleans up deleted documents in the background as you continue to index more data.'
operationId: get
parameters:
- in: path
name: index
description: The name of the index that contains the document.
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.IndexName'
style: simple
- in: path
name: id
description: A unique document identifier.
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.Id'
style: simple
- in: query
name: preference
description: 'The node or shard the operation should be performed on.
By default, the operation is randomized between the shard replicas.
If it is set to `_local`, the operation will prefer to be run on a local allocated shard when possible.
If it is set to a custom value, the value is used to guarantee that the same shards will be used for the same custom value.
This can help with "jumping values" when hitting different shards in different refresh states.
A sample value can be something like the web session ID or the user name.'
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: refresh
description: 'If `true`, the request refreshes the relevant shards before retrieving the document.
Setting it to `true` should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing).'
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: _source
description: Indicates whether to return the `_source` field (`true` or `false`) or lists the fields to return.
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.
You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter.
If the `_source` parameter is `false`, this parameter is ignored.'
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.
If this parameter is specified, only these source fields are returned.
You can exclude fields from this subset using the `_source_excludes` query parameter.
If the `_source` parameter is `false`, this parameter is ignored.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: stored_fields
description: 'A comma-separated list of stored fields to return as part of a hit.
If no fields are specified, no stored fields are included in the response.
If this field is specified, the `_source` parameter defaults to `false`.
Only leaf fields can be retrieved with the `stored_fields` option.
Object fields can''t be returned; if specified, the request fails.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: version
description: 'The version number for concurrency control.
It must match the current version of the document for the request to succeed.'
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
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/_global.get.GetResult'
examples:
GetResponseExample1:
summary: Get a document
description: 'A successful response from `GET my-index-000001/_doc/0`. It retrieves the JSON document with the `_id` 0 from the `my-index-000001` index.
'
value: "{\n \"_index\": \"my-index-000001\",\n \"_id\": \"0\",\n \"_version\": 1,\n \"_seq_no\": 0,\n \"_primary_term\": 1,\n \"found\": true,\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}"
GetResponseExample2:
summary: Get stored fields
description: 'A successful response from `GET my-index-000001/_doc/1?stored_fields=tags,counter`, which retrieves a set of stored fields. Field values fetched from the document itself are always returned as an array. Any requested fields that are not stored (such as the counter field in this example) are ignored.
'
value: "{\n \"_index\": \"my-index-000001\",\n \"_id\": \"1\",\n \"_version\": 1,\n \"_seq_no\" : 22,\n \"_primary_term\" : 1,\n \"found\": true,\n \"fields\": {\n \"tags\": [\n \"production\"\n ]\n }\n}"
GetResponseExample3:
summary: Get metadata fields
description: 'A successful response from `GET my-index-000001/_doc/2?routing=user1&stored_fields=tags,counter`, which retrieves the `_routing` metadata field.
'
value: "{\n \"_index\": \"my-index-000001\",\n \"_id\": \"2\",\n \"_version\": 1,\n \"_seq_no\" : 13,\n \"_primary_term\" : 1,\n \"_routing\": \"user1\",\n \"found\": true,\n \"fields\": {\n \"tags\": [\n \"env2\"\n ]\n }\n}"
x-state: Generally available
x-variations:
- "\n GET\n /{index}/_doc/{id}\n
\n "
x-req-auth:
- 'Index privileges: `read`
'
x-api: get
x-category: document management
x-codeSamples:
- lang: Console
source: 'GET my-index-000001/_doc/1?stored_fields=tags,counter
'
- lang: Python
source: "resp = client.get(\n index=\"my-index-000001\",\n id=\"1\",\n stored_fields=\"tags,counter\",\n)"
- lang: JavaScript
source: "const response = await client.get({\n index: \"my-index-000001\",\n id: 1,\n stored_fields: \"tags,counter\",\n});"
- lang: Ruby
source: "response = client.get(\n index: \"my-index-000001\",\n id: \"1\",\n stored_fields: \"tags,counter\"\n)"
- lang: PHP
source: "$resp = $client->get([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"stored_fields\" => \"tags,counter\",\n]);"
- lang: curl
source: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index-000001/_doc/1?stored_fields=tags,counter"'
- lang: Java
source: "client.get(g -> g\n .id(\"1\")\n .index(\"my-index-000001\")\n .storedFields(List.of(\"tags\",\"counter\"))\n);\n"
x-metaTags:
- content: Elasticsearch
name: product_name
put:
tags:
- Document
summary: Create or update a document in an index
description: Add a JSON document to the specified data stream or index and make it searchable.
externalDocs:
description: Data streams
url: https://www.elastic.co/docs/manage-data/data-store/data-streams
x-previousVersionUrl: https://www.elastic.co/guide/en/elasticsearch/reference/8.19/docs-index_.html
operationId: index
parameters:
- in: path
name: index
description: 'The name of the data stream or index to target.
If the target doesn''t exist and matches the name or wildcard (`*`) pattern of an index template with a `data_stream` definition, this request creates the data stream.
If the target doesn''t exist and doesn''t match a data stream template, this request creates the index.
You can check for existing targets with the resolve index API.'
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.IndexName'
style: simple
- in: path
name: id
description: 'A unique identifier for the document.
To automatically generate a document ID, use the `POST //_doc/` request format and omit this parameter.'
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.Id'
style: simple
- in: query
name: if_primary_term
description: Only perform the operation if the document has this primary term.
deprecated: false
schema:
type: number
style: form
- in: query
name: if_seq_no
description: Only perform the operation if the document has this sequence number.
deprecated: false
schema:
$ref: '#/components/schemas/_types.SequenceNumber'
style: form
- in: query
name: include_source_on_error
description: True or false if to include the document source in the error message in case of parsing errors.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: op_type
description: "Set to `create` to only index the document if it does not already exist (put if absent).\nIf a document with the specified `_id` already exists, the indexing operation will fail.\nThe behavior is the same as using the `/_create` endpoint.\nIf a document ID is specified, this paramater defaults to `index`.\nOtherwise, it defaults to `create`.\nIf the request targets a data stream, an `op_type` of `create` is required.\n\nSupported values include:\n - `index`: Overwrite any documents that already exist.\n - `create`: Only index documents that do not already exist.\n\n"
deprecated: false
schema:
$ref: '#/components/schemas/_types.OpType'
style: form
- in: query
name: pipeline
description: 'The ID of the pipeline to use to preprocess incoming documents.
If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request.
If a final pipeline is configured it will always run, regardless of the value of this parameter.'
deprecated: false
schema:
type: string
style: form
- in: query
name: refresh
description: 'If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search.
If `wait_for`, it waits for a refresh to make this operation visible to search.
If `false`, it does nothing with refreshes.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Refresh'
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: timeout
description: 'The period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards.
This parameter is useful for situations where the primary shard assigned to perform the operation might not be available when the operation runs.
Some reasons for this might be that the primary shard is currently recovering from a gateway or undergoing relocation.
By default, the operation will wait on the primary shard to become available for at least 1 minute before failing and responding with an error.
The actual wait time could be longer, particularly when multiple waits occur.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Duration'
style: form
- in: query
name: version
description: 'An explicit version number for concurrency control.
It must be a non-negative long number.'
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
- in: query
name: wait_for_active_shards
description: 'The number of shard copies that must be active before proceeding with the operation.
You can set it to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).
The default value of `1` means it waits for each primary shard to be active.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.WaitForActiveShards'
style: form
- in: query
name: require_alias
description: If `true`, the destination must be an index alias.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: require_data_stream
description: If `true`, the request's actions must target a data stream (existing or to be created).
deprecated: false
schema:
type: boolean
style: form
requestBody:
content:
application/json:
schema:
type: object
examples:
IndexRequestExample1:
summary: Automate document IDs
description: 'Run `POST my-index-000001/_doc/` to index a document. When you use the `POST //_doc/` request format, the `op_type` is automatically set to `create` and the index operation generates a unique ID for the document.
'
value: "{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}"
IndexRequestExample2:
summary: Define document IDs
description: 'Run `PUT my-index-000001/_doc/1` to insert a JSON document into the `my-index-000001` index with an `_id` of 1.
'
value: "{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}"
required: true
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/_types.WriteResponseBase'
examples:
IndexResponseExample1:
summary: Automate document IDs
description: A successful response from `POST my-index-000001/_doc/`, which contains an automated document ID.
value: "{\n \"_shards\": {\n \"total\": 2,\n \"failed\": 0,\n \"successful\": 2\n },\n \"_index\": \"my-index-000001\",\n \"_id\": \"W0tpsmIBdwcYyG50zbta\",\n \"_version\": 1,\n \"_seq_no\": 0,\n \"_primary_term\": 1,\n \"result\": \"created\"\n}"
IndexResponseExample2:
summary: Define document IDs
description: A successful response from `PUT my-index-000001/_doc/1`.
value: "{\n \"_shards\": {\n \"total\": 2,\n \"failed\": 0,\n \"successful\": 2\n },\n \"_index\": \"my-index-000001\",\n \"_id\": \"1\",\n \"_version\": 1,\n \"_seq_no\": 0,\n \"_primary_term\": 1,\n \"result\": \"created\"\n}"
x-state: Generally available
x-variations:
- "\n PUT\n /{index}/_doc/{id}\n
\n "
- "\n POST\n /{index}/_doc/{id}\n
\n "
x-req-auth:
- 'Index privileges: `index`
'
x-api: index
x-category: document management
x-codeSamples:
- lang: Console
source: "POST my-index-000001/_doc/\n{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}"
- lang: Python
source: "resp = client.index(\n index=\"my-index-000001\",\n document={\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n },\n)"
- lang: JavaScript
source: "const response = await client.index({\n index: \"my-index-000001\",\n document: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n message: \"GET /search HTTP/1.1 200 1070000\",\n user: {\n id: \"kimchy\",\n },\n },\n});"
- lang: Ruby
source: "response = client.index(\n index: \"my-index-000001\",\n body: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n }\n)"
- lang: PHP
source: "$resp = $client->index([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"@timestamp\" => \"2099-11-15T13:12:00\",\n \"message\" => \"GET /search HTTP/1.1 200 1070000\",\n \"user\" => [\n \"id\" => \"kimchy\",\n ],\n ],\n]);"
- lang: curl
source: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"@timestamp":"2099-11-15T13:12:00","message":"GET /search HTTP/1.1 200 1070000","user":{"id":"kimchy"}}'' "$ELASTICSEARCH_URL/my-index-000001/_doc/"'
- lang: Java
source: "client.index(i -> i\n .index(\"my-index-000001\")\n .document(JsonData.fromJson(\"{\\\"@timestamp\\\":\\\"2099-11-15T13:12:00\\\",\\\"message\\\":\\\"GET /search HTTP/1.1 200 1070000\\\",\\\"user\\\":{\\\"id\\\":\\\"kimchy\\\"}}\"))\n);\n"
x-metaTags:
- content: Elasticsearch
name: product_name
post:
tags:
- Document
summary: Create or update a document in an index
description: Add a JSON document to the specified data stream or index and make it searchable.
externalDocs:
description: Data streams
url: https://www.elastic.co/docs/manage-data/data-store/data-streams
x-previousVersionUrl: https://www.elastic.co/guide/en/elasticsearch/reference/8.19/docs-index_.html
operationId: index-1
parameters:
- in: path
name: index
description: 'The name of the data stream or index to target.
If the target doesn''t exist and matches the name or wildcard (`*`) pattern of an index template with a `data_stream` definition, this request creates the data stream.
If the target doesn''t exist and doesn''t match a data stream template, this request creates the index.
You can check for existing targets with the resolve index API.'
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.IndexName'
style: simple
- in: path
name: id
description: 'A unique identifier for the document.
To automatically generate a document ID, use the `POST //_doc/` request format and omit this parameter.'
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.Id'
style: simple
- in: query
name: if_primary_term
description: Only perform the operation if the document has this primary term.
deprecated: false
schema:
type: number
style: form
- in: query
name: if_seq_no
description: Only perform the operation if the document has this sequence number.
deprecated: false
schema:
$ref: '#/components/schemas/_types.SequenceNumber'
style: form
- in: query
name: include_source_on_error
description: True or false if to include the document source in the error message in case of parsing errors.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: op_type
description: "Set to `create` to only index the document if it does not already exist (put if absent).\nIf a document with the specified `_id` already exists, the indexing operation will fail.\nThe behavior is the same as using the `/_create` endpoint.\nIf a document ID is specified, this paramater defaults to `index`.\nOtherwise, it defaults to `create`.\nIf the request targets a data stream, an `op_type` of `create` is required.\n\nSupported values include:\n - `index`: Overwrite any documents that already exist.\n - `create`: Only index documents that do not already exist.\n\n"
deprecated: false
schema:
$ref: '#/components/schemas/_types.OpType'
style: form
- in: query
name: pipeline
description: 'The ID of the pipeline to use to preprocess incoming documents.
If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request.
If a final pipeline is configured it will always run, regardless of the value of this parameter.'
deprecated: false
schema:
type: string
style: form
- in: query
name: refresh
description: 'If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search.
If `wait_for`, it waits for a refresh to make this operation visible to search.
If `false`, it does nothing with refreshes.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Refresh'
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: timeout
description: 'The period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards.
This parameter is useful for situations where the primary shard assigned to perform the operation might not be available when the operation runs.
Some reasons for this might be that the primary shard is currently recovering from a gateway or undergoing relocation.
By default, the operation will wait on the primary shard to become available for at least 1 minute before failing and responding with an error.
The actual wait time could be longer, particularly when multiple waits occur.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Duration'
style: form
- in: query
name: version
description: 'An explicit version number for concurrency control.
It must be a non-negative long number.'
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
- in: query
name: wait_for_active_shards
description: 'The number of shard copies that must be active before proceeding with the operation.
You can set it to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).
The default value of `1` means it waits for each primary shard to be active.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.WaitForActiveShards'
style: form
- in: query
name: require_alias
description: If `true`, the destination must be an index alias.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: require_data_stream
description: If `true`, the request's actions must target a data stream (existing or to be created).
deprecated: false
schema:
type: boolean
style: form
requestBody:
content:
application/json:
schema:
type: object
examples:
IndexRequestExample1:
summary: Automate document IDs
description: 'Run `POST my-index-000001/_doc/` to index a document. When you use the `POST //_doc/` request format, the `op_type` is automatically set to `create` and the index operation generates a unique ID for the document.
'
value: "{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}"
IndexRequestExample2:
summary: Define document IDs
description: 'Run `PUT my-index-000001/_doc/1` to insert a JSON document into the `my-index-000001` index with an `_id` of 1.
'
value: "{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}"
required: true
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/_types.WriteResponseBase'
examples:
IndexResponseExample1:
summary: Automate document IDs
description: A successful response from `POST my-index-000001/_doc/`, which contains an automated document ID.
value: "{\n \"_shards\": {\n \"total\": 2,\n \"failed\": 0,\n \"successful\": 2\n },\n \"_index\": \"my-index-000001\",\n \"_id\": \"W0tpsmIBdwcYyG50zbta\",\n \"_version\": 1,\n \"_seq_no\": 0,\n \"_primary_term\": 1,\n \"result\": \"created\"\n}"
IndexResponseExample2:
summary: Define document IDs
description: A successful response from `PUT my-index-000001/_doc/1`.
value: "{\n \"_shards\": {\n \"total\": 2,\n \"failed\": 0,\n \"successful\": 2\n },\n \"_index\": \"my-index-000001\",\n \"_id\": \"1\",\n \"_version\": 1,\n \"_seq_no\": 0,\n \"_primary_term\": 1,\n \"result\": \"created\"\n}"
x-state: Generally available
x-variations:
- "\n PUT\n /{index}/_doc/{id}\n
\n "
- "\n POST\n /{index}/_doc/{id}\n
\n "
x-req-auth:
- 'Index privileges: `index`
'
x-api: index
x-category: document management
x-codeSamples:
- lang: Console
source: "POST my-index-000001/_doc/\n{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}"
- lang: Python
source: "resp = client.index(\n index=\"my-index-000001\",\n document={\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n },\n)"
- lang: JavaScript
source: "const response = await client.index({\n index: \"my-index-000001\",\n document: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n message: \"GET /search HTTP/1.1 200 1070000\",\n user: {\n id: \"kimchy\",\n },\n },\n});"
- lang: Ruby
source: "response = client.index(\n index: \"my-index-000001\",\n body: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n }\n)"
- lang: PHP
source: "$resp = $client->index([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"@timestamp\" => \"2099-11-15T13:12:00\",\n \"message\" => \"GET /search HTTP/1.1 200 1070000\",\n \"user\" => [\n \"id\" => \"kimchy\",\n ],\n ],\n]);"
- lang: curl
source: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"@timestamp":"2099-11-15T13:12:00","message":"GET /search HTTP/1.1 200 1070000","user":{"id":"kimchy"}}'' "$ELASTICSEARCH_URL/my-index-000001/_doc/"'
- lang: Java
source: "client.index(i -> i\n .index(\"my-index-000001\")\n .document(JsonData.fromJson(\"{\\\"@timestamp\\\":\\\"2099-11-15T13:12:00\\\",\\\"message\\\":\\\"GET /search HTTP/1.1 200 1070000\\\",\\\"user\\\":{\\\"id\\\":\\\"kimchy\\\"}}\"))\n);\n"
x-metaTags:
- content: Elasticsearch
name: product_name
delete:
tags:
- Document
summary: Delete a document
description: 'Remove a JSON document from the specified index.
NOTE: You cannot send deletion requests directly to a data stream.
To delete a document in a data stream, you must target the backing index containing the document.
**Optimistic concurrency control**
Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the `if_seq_no` and `if_primary_term` parameters.
If a mismatch is detected, the operation will result in a `VersionConflictException` and a status code of `409`.
**Versioning**
Each document indexed is versioned.
When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime.
Every write operation run on a document, deletes included, causes its version to be incremented.
The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations.
The length of time for which a deleted document''s version remains available is determined by the `index.gc_deletes` index setting.
**Routing**
If routing is used during indexing, the routing value also needs to be specified to delete a document.
If the `_routing` mapping is set to `required` and no routing value is specified, the delete API throws a `RoutingMissingException` and rejects the request.
For example:
```
DELETE /my-index-000001/_doc/1?routing=shard-1
```
This request deletes the document with ID 1, but it is routed based on the user.
The document is not deleted if the correct routing is not specified.
**Distributed**
The delete operation gets hashed into a specific shard ID.
It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group.'
operationId: delete
parameters:
- in: path
name: index
description: The name of the target index.
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.IndexName'
style: simple
- in: path
name: id
description: A unique identifier for the document.
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.Id'
style: simple
- in: query
name: if_primary_term
description: Only perform the operation if the document has this primary term.
deprecated: false
schema:
type: number
style: form
- in: query
name: if_seq_no
description: Only perform the operation if the document has this sequence number.
deprecated: false
schema:
$ref: '#/components/schemas/_types.SequenceNumber'
style: form
- in: query
name: refresh
description: 'If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search.
If `wait_for`, it waits for a refresh to make this operation visible to search.
If `false`, it does nothing with refreshes.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Refresh'
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: timeout
description: 'The period to wait for active shards.
This parameter is useful for situations where the primary shard assigned to perform the delete operation might not be available when the delete operation runs.
Some reasons for this might be that the primary shard is currently recovering from a store or undergoing relocation.
By default, the delete operation will wait on the primary shard to become available for up to 1 minute before failing and responding with an error.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Duration'
style: form
- in: query
name: version
description: 'An explicit version number for concurrency control.
It must match the current version of the document for the request to succeed.'
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
- in: query
name: wait_for_active_shards
description: 'The minimum number of shard copies that must be active before proceeding with the operation.
You can set it to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).
The default value of `1` means it waits for each primary shard to be active.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.WaitForActiveShards'
style: form
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/_types.WriteResponseBase'
examples:
DeleteResponseExample1:
description: A successful response from `DELETE /my-index-000001/_doc/1`, which deletes the JSON document 1 from the `my-index-000001` index.
value: "{\n \"_shards\": {\n \"total\": 2,\n \"failed\": 0,\n \"successful\": 2\n },\n \"_index\": \"my-index-000001\",\n \"_id\": \"1\",\n \"_version\": 2,\n \"_primary_term\": 1,\n \"_seq_no\": 5,\n \"result\": \"deleted\"\n}"
x-state: Generally available
x-variations:
- "\n DELETE\n /{index}/_doc/{id}\n
\n "
x-req-auth:
- 'Index privileges: `delete`
'
x-api: delete
x-category: document management
x-codeSamples:
- lang: Console
source: 'DELETE /my-index-000001/_doc/1
'
- lang: Python
source: "resp = client.delete(\n index=\"my-index-000001\",\n id=\"1\",\n)"
- lang: JavaScript
source: "const response = await client.delete({\n index: \"my-index-000001\",\n id: 1,\n});"
- lang: Ruby
source: "response = client.delete(\n index: \"my-index-000001\",\n id: \"1\"\n)"
- lang: PHP
source: "$resp = $client->delete([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n]);"
- lang: curl
source: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index-000001/_doc/1"'
- lang: Java
source: "client.delete(d -> d\n .id(\"1\")\n .index(\"my-index-000001\")\n);\n"
x-metaTags:
- content: Elasticsearch
name: product_name
head:
tags:
- Document
summary: Check a document
description: 'Verify that a document exists.
For example, check to see if a document with the `_id` 0 exists:
```
HEAD my-index-000001/_doc/0
```
If the document exists, the API returns a status code of `200 - OK`.
If the document doesn’t exist, the API returns `404 - Not Found`.
**Versioning support**
You can use the `version` parameter to check the document only if its current version is equal to the specified one.
Internally, Elasticsearch has marked the old document as deleted and added an entirely new document.
The old version of the document doesn''t disappear immediately, although you won''t be able to access it.
Elasticsearch cleans up deleted documents in the background as you continue to index more data.'
operationId: exists
parameters:
- in: path
name: index
description: 'A comma-separated list of data streams, indices, and aliases.
It supports wildcards (`*`).'
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.IndexName'
style: simple
- in: path
name: id
description: A unique document identifier.
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.Id'
style: simple
- in: query
name: preference
description: 'The node or shard the operation should be performed on.
By default, the operation is randomized between the shard replicas.
If it is set to `_local`, the operation will prefer to be run on a local allocated shard when possible.
If it is set to a custom value, the value is used to guarantee that the same shards will be used for the same custom value.
This can help with "jumping values" when hitting different shards in different refresh states.
A sample value can be something like the web session ID or the user name.'
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: refresh
description: 'If `true`, the request refreshes the relevant shards before retrieving the document.
Setting it to `true` should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing).'
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: _source
description: Indicates whether to return the `_source` field (`true` or `false`) or lists the fields to return.
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.
You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter.
If the `_source` parameter is `false`, this parameter is ignored.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: _source_includes
description: 'A comma-separated list of source fields to include in the response.
If this parameter is specified, only these source fields are returned.
You can exclude fields from this subset using the `_source_excludes` query parameter.
If the `_source` parameter is `false`, this parameter is ignored.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: stored_fields
description: 'A comma-separated list of stored fields to return as part of a hit.
If no fields are specified, no stored fields are included in the response.
If this field is specified, the `_source` parameter defaults to `false`.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: version
description: 'Explicit version number for concurrency control.
The specified version must match the current version of the document for the request to succeed.'
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
responses:
'200':
description: ''
content:
application/json: {}
x-state: Generally available
x-variations:
- "\n HEAD\n /{index}/_doc/{id}\n
\n "
x-api: exists
x-category: search
x-codeSamples:
- lang: Console
source: 'HEAD my-index-000001/_doc/0
'
- lang: Python
source: "resp = client.exists(\n index=\"my-index-000001\",\n id=\"0\",\n)"
- lang: JavaScript
source: "const response = await client.exists({\n index: \"my-index-000001\",\n id: 0,\n});"
- lang: Ruby
source: "response = client.exists(\n index: \"my-index-000001\",\n id: \"0\"\n)"
- lang: PHP
source: "$resp = $client->exists([\n \"index\" => \"my-index-000001\",\n \"id\" => \"0\",\n]);"
- lang: curl
source: 'curl --head -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index-000001/_doc/0"'
- lang: Java
source: "client.exists(e -> e\n .id(\"0\")\n .index(\"my-index-000001\")\n);\n"
x-metaTags:
- content: Elasticsearch
name: product_name
/{index}/_delete_by_query:
post:
tags:
- Document
summary: Delete documents
description: Deletes documents that match the specified query.
operationId: delete-by-query
parameters:
- in: path
name: index
description: 'A comma-separated list of data streams, indices, and aliases to search.
It supports wildcards (`*`).
To search all data streams or indices, omit this parameter or use `*` or `_all`.'
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: analyzer
description: 'Analyzer to use for the query string.
This 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.
This parameter can be used only when the `q` query string parameter is specified.'
deprecated: false
schema:
type: boolean
style: form
- in: query
name: conflicts
description: "What to do if delete by query hits version conflicts: `abort` or `proceed`.\n\nSupported values include:\n - `abort`: Stop reindexing if there are conflicts.\n - `proceed`: Continue reindexing even if there are conflicts.\n\n"
deprecated: false
schema:
$ref: '#/components/schemas/_types.Conflicts'
style: form
- in: query
name: default_operator
description: 'The default operator for query string query: `and` or `or`.
This 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 default where no field prefix is given in the query string.
This parameter can be used only when the `q` query string parameter is specified.'
deprecated: false
schema:
type: string
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: from
description: Skips the specified number of documents.
deprecated: false
schema:
type: number
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: lenient
description: 'If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored.
This parameter can be used only when the `q` query string parameter is specified.'
deprecated: false
schema:
type: boolean
style: form
- in: query
name: max_docs
description: 'The maximum number of documents to process.
Defaults to all documents.
When set to a value less then or equal to `scroll_size`, a scroll will not be used to retrieve the results for the operation.'
deprecated: false
schema:
type: number
style: form
- in: query
name: preference
description: 'The node or shard the operation should be performed on.
It is random by default.'
deprecated: false
schema:
type: string
style: form
- in: query
name: refresh
description: 'If `true`, Elasticsearch refreshes all shards involved in the delete by query after the request completes.
This is different than the delete API''s `refresh` parameter, which causes just the shard that received the delete request to be refreshed.
Unlike the delete API, it does not support `wait_for`.'
deprecated: false
schema:
type: boolean
style: form
- in: query
name: request_cache
description: 'If `true`, the request cache is used for this request.
Defaults to the index-level setting.'
deprecated: false
schema:
type: boolean
style: form
- in: query
name: requests_per_second
description: The throttle for this request in sub-requests per second.
deprecated: false
schema:
type: number
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: q
description: A query in the Lucene query string syntax.
deprecated: false
schema:
type: string
style: form
- in: query
name: scroll
description: The period to retain the search context for scrolling.
deprecated: false
schema:
$ref: '#/components/schemas/_types.Duration'
style: form
- in: query
name: scroll_size
description: The size of the scroll request that powers the operation.
deprecated: false
schema:
type: number
style: form
- in: query
name: search_timeout
description: 'The explicit timeout for each search request.
It defaults to no timeout.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Duration'
style: form
- in: query
name: search_type
description: "The type of the search operation.\nAvailable options include `query_then_fetch` and `dfs_query_then_fetch`.\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: slices
description: The number of slices this task should be divided into.
deprecated: false
schema:
$ref: '#/components/schemas/_types.Slices'
style: form
- in: query
name: sort
description: A comma-separated list of `:` pairs.
deprecated: true
schema:
type: array
items:
type: string
style: form
- in: query
name: stats
description: The specific `tag` of the request for logging and statistical purposes.
deprecated: false
schema:
type: array
items:
type: string
style: form
- in: query
name: terminate_after
description: 'The maximum number of documents to collect for each shard.
If a query reaches this limit, Elasticsearch terminates the query early.
Elasticsearch collects documents before sorting.
Use with caution.
Elasticsearch applies this parameter to each shard handling the request.
When possible, let Elasticsearch perform early termination automatically.
Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers.'
deprecated: false
schema:
type: number
style: form
- in: query
name: timeout
description: The period each deletion request waits for active shards.
deprecated: false
schema:
$ref: '#/components/schemas/_types.Duration'
style: form
- in: query
name: version
description: If `true`, returns the document version as part of a hit.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: wait_for_active_shards
description: 'The number of shard copies that must be active before proceeding with the operation.
Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).
The `timeout` value controls how long each write request waits for unavailable shards to become available.'
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.
If `false`, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. Elasticsearch creates a record of this task as a document at `.tasks/task/${taskId}`. When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space.'
deprecated: false
schema:
type: boolean
style: form
requestBody:
content:
application/json:
schema:
type: object
properties:
max_docs:
description: The maximum number of documents to delete.
type: number
query:
description: The documents to delete specified with Query DSL.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
slice:
description: Slice the request manually using the provided slice ID and total number of slices.
allOf:
- $ref: '#/components/schemas/_types.SlicedScroll'
sort:
description: A sort object that specifies the order of deleted documents.
allOf:
- $ref: '#/components/schemas/_types.Sort'
examples:
DeleteByQueryRequestExample1:
summary: Delete all documents
description: Run `POST /my-index-000001,my-index-000002/_delete_by_query` to delete all documents from multiple data streams or indices.
value: "{\n \"query\": {\n \"match_all\": {}\n }\n}"
DeleteByQueryRequestExample2:
summary: Delete a single document
description: Run `POST my-index-000001/_delete_by_query` to delete a document by using a unique attribute.
value: "{\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n \"max_docs\": 1\n}"
DeleteByQueryRequestExample3:
summary: Slice manually
description: 'Run `POST my-index-000001/_delete_by_query` to slice a delete by query manually. Provide a slice ID and total number of slices.
'
value: "{\n \"slice\": {\n \"id\": 0,\n \"max\": 2\n },\n \"query\": {\n \"range\": {\n \"http.response.bytes\": {\n \"lt\": 2000000\n }\n }\n }\n}"
DeleteByQueryRequestExample4:
summary: Automatic slicing
description: 'Run `POST my-index-000001/_delete_by_query?refresh&slices=5` to let delete by query automatically parallelize using sliced scroll to slice on `_id`. The `slices` query parameter value specifies the number of slices to use.
'
value: "{\n \"query\": {\n \"range\": {\n \"http.response.bytes\": {\n \"lt\": 2000000\n }\n }\n }\n}"
required: true
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
properties:
batches:
description: The number of scroll responses pulled back by the delete by query.
type: number
deleted:
description: The number of documents that were successfully deleted.
type: number
failures:
description: 'An array of failures if there were any unrecoverable errors during the process.
If this array is not empty, the request ended abnormally because of those failures.
Delete by query is implemented using batches and any failures cause the entire process to end but all failures in the current batch are collected into the array.
You can use the `conflicts` option to prevent reindex from ending on version conflicts.'
type: array
items:
$ref: '#/components/schemas/_types.BulkIndexByScrollFailure'
noops:
description: 'This field is always equal to zero for delete by query.
It exists only so that delete by query, update by query, and reindex APIs return responses with the same structure.'
type: number
requests_per_second:
description: The number of requests per second effectively run during the delete by query.
type: number
retries:
description: 'The number of retries attempted by delete by query.
`bulk` is the number of bulk actions retried.
`search` is the number of search actions retried.'
allOf:
- $ref: '#/components/schemas/_types.Retries'
slice_id:
type: number
slices:
description: Status of each slice if the delete by query was sliced
type: array
items:
$ref: '#/components/schemas/_types.ReindexStatus'
task:
allOf:
- $ref: '#/components/schemas/_types.TaskId'
throttled:
allOf:
- $ref: '#/components/schemas/_types.Duration'
throttled_millis:
description: The number of milliseconds the request slept to conform to `requests_per_second`.
allOf:
- $ref: '#/components/schemas/_types.DurationValueUnitMillis'
throttled_until:
allOf:
- $ref: '#/components/schemas/_types.Duration'
throttled_until_millis:
description: 'This field should always be equal to zero in a `_delete_by_query` response.
It has meaning only when using the task API, where it indicates the next time (in milliseconds since epoch) a throttled request will be run again in order to conform to `requests_per_second`.'
allOf:
- $ref: '#/components/schemas/_types.DurationValueUnitMillis'
timed_out:
description: If `true`, some requests run during the delete by query operation timed out.
type: boolean
took:
description: The number of milliseconds from start to end of the whole operation.
allOf:
- $ref: '#/components/schemas/_types.DurationValueUnitMillis'
total:
description: The number of documents that were successfully processed.
type: number
version_conflicts:
description: The number of version conflicts that the delete by query hit.
type: number
examples:
DeleteByQueryResponseExample1:
description: A successful response from `POST /my-index-000001/_delete_by_query`.
value: "{\n \"took\" : 147,\n \"timed_out\": false,\n \"total\": 119,\n \"deleted\": 119,\n \"batches\": 1,\n \"version_conflicts\": 0,\n \"noops\": 0,\n \"retries\": {\n \"bulk\": 0,\n \"search\": 0\n },\n \"throttled_millis\": 0,\n \"requests_per_second\": -1.0,\n \"throttled_until_millis\": 0,\n \"failures\" : [ ]\n}"
x-state: Generally available; Added in 5.0.0
x-variations:
- "\n POST\n /{index}/_delete_by_query\n
\n "
x-req-auth:
- 'Index privileges: `read`,`delete`
'
x-api: delete_by_query
x-category: document management
x-codeSamples:
- lang: Console
source: "POST /my-index-000001,my-index-000002/_delete_by_query\n{\n \"query\": {\n \"match_all\": {}\n }\n}"
- lang: Python
source: "resp = client.delete_by_query(\n index=\"my-index-000001,my-index-000002\",\n query={\n \"match_all\": {}\n },\n)"
- lang: JavaScript
source: "const response = await client.deleteByQuery({\n index: \"my-index-000001,my-index-000002\",\n query: {\n match_all: {},\n },\n});"
- lang: Ruby
source: "response = client.delete_by_query(\n index: \"my-index-000001,my-index-000002\",\n body: {\n \"query\": {\n \"match_all\": {}\n }\n }\n)"
- lang: PHP
source: "$resp = $client->deleteByQuery([\n \"index\" => \"my-index-000001,my-index-000002\",\n \"body\" => [\n \"query\" => [\n \"match_all\" => new ArrayObject([]),\n ],\n ],\n]);"
- lang: curl
source: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"query":{"match_all":{}}}'' "$ELASTICSEARCH_URL/my-index-000001,my-index-000002/_delete_by_query"'
- lang: Java
source: "client.deleteByQuery(d -> d\n .index(List.of(\"my-index-000001\",\"my-index-000002\"))\n .query(q -> q\n .matchAll(m -> m)\n )\n);\n"
x-metaTags:
- content: Elasticsearch
name: product_name
/_delete_by_query/{task_id}/_rethrottle:
post:
tags:
- Document
summary: Throttle a delete by query operation
description: 'Change the number of requests per second for a particular delete by query operation.
Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts.'
operationId: delete-by-query-rethrottle
parameters:
- in: path
name: task_id
description: The ID for the task.
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.TaskId'
style: simple
- in: query
name: requests_per_second
description: 'The throttle for this request in sub-requests per second.
To disable throttling, set it to `-1`.'
required: true
deprecated: false
schema:
type: number
style: form
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/tasks._types.TaskListResponseBase'
x-state: Generally available; Added in 6.5.0
x-variations:
- "\n POST\n /_delete_by_query/{task_id}/_rethrottle\n
\n "
x-api: delete_by_query_rethrottle
x-category: document management
x-codeSamples:
- lang: Console
source: 'POST _delete_by_query/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1
'
- lang: Python
source: "resp = client.delete_by_query_rethrottle(\n task_id=\"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second=\"-1\",\n)"
- lang: JavaScript
source: "const response = await client.deleteByQueryRethrottle({\n task_id: \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second: \"-1\",\n});"
- lang: Ruby
source: "response = client.delete_by_query_rethrottle(\n task_id: \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second: \"-1\"\n)"
- lang: PHP
source: "$resp = $client->deleteByQueryRethrottle([\n \"task_id\" => \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n \"requests_per_second\" => \"-1\",\n]);"
- lang: curl
source: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_delete_by_query/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1"'
- lang: Java
source: "client.deleteByQueryRethrottle(d -> d\n .requestsPerSecond(-1.0F)\n .taskId(\"r1A2WoRbTwKZ516z6NEs5A:36619\")\n);\n"
x-metaTags:
- content: Elasticsearch
name: product_name
/{index}/_source/{id}:
get:
tags:
- Document
summary: Get a document's source
description: 'Get the source of a document.
For example:
```
GET my-index-000001/_source/1
```
You can use the source filtering parameters to control which parts of the `_source` are returned:
```
GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities
```'
externalDocs:
url: https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/mapping-source-field
x-previousVersionUrl: https://www.elastic.co/guide/en/elasticsearch/reference/8.19/docs-get.html
operationId: get-source
parameters:
- in: path
name: index
description: The name of the index that contains the document.
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.IndexName'
style: simple
- in: path
name: id
description: A unique document identifier.
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.Id'
style: simple
- in: query
name: preference
description: 'The node or shard the operation should be performed on.
By default, the operation is randomized between the shard replicas.'
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: refresh
description: 'If `true`, the request refreshes the relevant shards before retrieving the document.
Setting it to `true` should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing).'
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: _source
description: Indicates whether to return the `_source` field (`true` or `false`) or lists the fields to return.
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 in the response.
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: _source_includes
description: A comma-separated list of source fields to include in the response.
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: version
description: 'The version number for concurrency control.
It must match the current version of the document for the request to succeed.'
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
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
x-state: Generally available
x-variations:
- "\n GET\n /{index}/_source/{id}\n
\n "
x-req-auth:
- 'Index privileges: `read`
'
x-api: get_source
x-category: document management
x-codeSamples:
- lang: Console
source: 'GET my-index-000001/_source/1
'
- lang: Python
source: "resp = client.get_source(\n index=\"my-index-000001\",\n id=\"1\",\n)"
- lang: JavaScript
source: "const response = await client.getSource({\n index: \"my-index-000001\",\n id: 1,\n});"
- lang: Ruby
source: "response = client.get_source(\n index: \"my-index-000001\",\n id: \"1\"\n)"
- lang: PHP
source: "$resp = $client->getSource([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n]);"
- lang: curl
source: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index-000001/_source/1"'
- lang: Java
source: "client.getSource(g -> g\n .id(\"1\")\n .index(\"my-index-000001\")\n);\n"
x-metaTags:
- content: Elasticsearch
name: product_name
head:
tags:
- Document
summary: Check for a document source
description: 'Check whether a document source exists in an index.
For example:
```
HEAD my-index-000001/_source/1
```
A document''s source is not available if it is disabled in the mapping.'
externalDocs:
url: https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/mapping-source-field
x-previousVersionUrl: https://www.elastic.co/guide/en/elasticsearch/reference/8.19/docs-get.html
operationId: exists-source
parameters:
- in: path
name: index
description: 'A comma-separated list of data streams, indices, and aliases.
It supports wildcards (`*`).'
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.IndexName'
style: simple
- in: path
name: id
description: A unique identifier for the document.
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.Id'
style: simple
- in: query
name: preference
description: 'The node or shard the operation should be performed on.
By default, the operation is randomized between the shard replicas.'
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: refresh
description: 'If `true`, the request refreshes the relevant shards before retrieving the document.
Setting it to `true` should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing).'
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: _source
description: Indicates whether to return the `_source` field (`true` or `false`) or lists the fields to return.
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 in the response.
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: _source_includes
description: A comma-separated list of source fields to include in the response.
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: version
description: 'The version number for concurrency control.
It must match the current version of the document for the request to succeed.'
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
responses:
'200':
description: ''
content:
application/json: {}
x-state: Generally available; Added in 5.4.0
x-variations:
- "\n HEAD\n /{index}/_source/{id}\n
\n "
x-req-auth:
- 'Index privileges: `read`
'
x-api: exists_source
x-category: search
x-codeSamples:
- lang: Console
source: 'HEAD my-index-000001/_source/1
'
- lang: Python
source: "resp = client.exists_source(\n index=\"my-index-000001\",\n id=\"1\",\n)"
- lang: JavaScript
source: "const response = await client.existsSource({\n index: \"my-index-000001\",\n id: 1,\n});"
- lang: Ruby
source: "response = client.exists_source(\n index: \"my-index-000001\",\n id: \"1\"\n)"
- lang: PHP
source: "$resp = $client->existsSource([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n]);"
- lang: curl
source: 'curl --head -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index-000001/_source/1"'
- lang: Java
source: "client.existsSource(e -> e\n .id(\"1\")\n .index(\"my-index-000001\")\n);\n"
x-metaTags:
- content: Elasticsearch
name: product_name
/{index}/_doc:
post:
tags:
- Document
summary: Create or update a document in an index
description: Add a JSON document to the specified data stream or index and make it searchable.
externalDocs:
description: Data streams
url: https://www.elastic.co/docs/manage-data/data-store/data-streams
x-previousVersionUrl: https://www.elastic.co/guide/en/elasticsearch/reference/8.19/docs-index_.html
operationId: index-2
parameters:
- in: path
name: index
description: 'The name of the data stream or index to target.
If the target doesn''t exist and matches the name or wildcard (`*`) pattern of an index template with a `data_stream` definition, this request creates the data stream.
If the target doesn''t exist and doesn''t match a data stream template, this request creates the index.
You can check for existing targets with the resolve index API.'
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.IndexName'
style: simple
- in: query
name: if_primary_term
description: Only perform the operation if the document has this primary term.
deprecated: false
schema:
type: number
style: form
- in: query
name: if_seq_no
description: Only perform the operation if the document has this sequence number.
deprecated: false
schema:
$ref: '#/components/schemas/_types.SequenceNumber'
style: form
- in: query
name: include_source_on_error
description: True or false if to include the document source in the error message in case of parsing errors.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: op_type
description: "Set to `create` to only index the document if it does not already exist (put if absent).\nIf a document with the specified `_id` already exists, the indexing operation will fail.\nThe behavior is the same as using the `/_create` endpoint.\nIf a document ID is specified, this paramater defaults to `index`.\nOtherwise, it defaults to `create`.\nIf the request targets a data stream, an `op_type` of `create` is required.\n\nSupported values include:\n - `index`: Overwrite any documents that already exist.\n - `create`: Only index documents that do not already exist.\n\n"
deprecated: false
schema:
$ref: '#/components/schemas/_types.OpType'
style: form
- in: query
name: pipeline
description: 'The ID of the pipeline to use to preprocess incoming documents.
If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request.
If a final pipeline is configured it will always run, regardless of the value of this parameter.'
deprecated: false
schema:
type: string
style: form
- in: query
name: refresh
description: 'If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search.
If `wait_for`, it waits for a refresh to make this operation visible to search.
If `false`, it does nothing with refreshes.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Refresh'
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: timeout
description: 'The period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards.
This parameter is useful for situations where the primary shard assigned to perform the operation might not be available when the operation runs.
Some reasons for this might be that the primary shard is currently recovering from a gateway or undergoing relocation.
By default, the operation will wait on the primary shard to become available for at least 1 minute before failing and responding with an error.
The actual wait time could be longer, particularly when multiple waits occur.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Duration'
style: form
- in: query
name: version
description: 'An explicit version number for concurrency control.
It must be a non-negative long number.'
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
- in: query
name: wait_for_active_shards
description: 'The number of shard copies that must be active before proceeding with the operation.
You can set it to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).
The default value of `1` means it waits for each primary shard to be active.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.WaitForActiveShards'
style: form
- in: query
name: require_alias
description: If `true`, the destination must be an index alias.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: require_data_stream
description: If `true`, the request's actions must target a data stream (existing or to be created).
deprecated: false
schema:
type: boolean
style: form
requestBody:
content:
application/json:
schema:
type: object
examples:
IndexRequestExample1:
summary: Automate document IDs
description: 'Run `POST my-index-000001/_doc/` to index a document. When you use the `POST //_doc/` request format, the `op_type` is automatically set to `create` and the index operation generates a unique ID for the document.
'
value: "{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}"
IndexRequestExample2:
summary: Define document IDs
description: 'Run `PUT my-index-000001/_doc/1` to insert a JSON document into the `my-index-000001` index with an `_id` of 1.
'
value: "{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}"
required: true
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/_types.WriteResponseBase'
examples:
IndexResponseExample1:
summary: Automate document IDs
description: A successful response from `POST my-index-000001/_doc/`, which contains an automated document ID.
value: "{\n \"_shards\": {\n \"total\": 2,\n \"failed\": 0,\n \"successful\": 2\n },\n \"_index\": \"my-index-000001\",\n \"_id\": \"W0tpsmIBdwcYyG50zbta\",\n \"_version\": 1,\n \"_seq_no\": 0,\n \"_primary_term\": 1,\n \"result\": \"created\"\n}"
IndexResponseExample2:
summary: Define document IDs
description: A successful response from `PUT my-index-000001/_doc/1`.
value: "{\n \"_shards\": {\n \"total\": 2,\n \"failed\": 0,\n \"successful\": 2\n },\n \"_index\": \"my-index-000001\",\n \"_id\": \"1\",\n \"_version\": 1,\n \"_seq_no\": 0,\n \"_primary_term\": 1,\n \"result\": \"created\"\n}"
x-state: Generally available
x-variations:
- "\n POST\n /{index}/_doc\n
\n "
x-req-auth:
- 'Index privileges: `index`
'
x-api: index
x-category: document management
x-codeSamples:
- lang: Console
source: "POST my-index-000001/_doc/\n{\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n}"
- lang: Python
source: "resp = client.index(\n index=\"my-index-000001\",\n document={\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n },\n)"
- lang: JavaScript
source: "const response = await client.index({\n index: \"my-index-000001\",\n document: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n message: \"GET /search HTTP/1.1 200 1070000\",\n user: {\n id: \"kimchy\",\n },\n },\n});"
- lang: Ruby
source: "response = client.index(\n index: \"my-index-000001\",\n body: {\n \"@timestamp\": \"2099-11-15T13:12:00\",\n \"message\": \"GET /search HTTP/1.1 200 1070000\",\n \"user\": {\n \"id\": \"kimchy\"\n }\n }\n)"
- lang: PHP
source: "$resp = $client->index([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"@timestamp\" => \"2099-11-15T13:12:00\",\n \"message\" => \"GET /search HTTP/1.1 200 1070000\",\n \"user\" => [\n \"id\" => \"kimchy\",\n ],\n ],\n]);"
- lang: curl
source: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"@timestamp":"2099-11-15T13:12:00","message":"GET /search HTTP/1.1 200 1070000","user":{"id":"kimchy"}}'' "$ELASTICSEARCH_URL/my-index-000001/_doc/"'
- lang: Java
source: "client.index(i -> i\n .index(\"my-index-000001\")\n .document(JsonData.fromJson(\"{\\\"@timestamp\\\":\\\"2099-11-15T13:12:00\\\",\\\"message\\\":\\\"GET /search HTTP/1.1 200 1070000\\\",\\\"user\\\":{\\\"id\\\":\\\"kimchy\\\"}}\"))\n);\n"
x-metaTags:
- content: Elasticsearch
name: product_name
/_mget:
get:
tags:
- Document
summary: Get multiple documents
description: 'Get multiple JSON documents by ID from one or more indices.
If you specify an index in the request URI, you only need to specify the document IDs in the request body.
To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail.
**Filter source fields**
By default, the `_source` field is returned for every document (if stored).
Use the `_source` and `_source_include` or `source_exclude` attributes to filter what fields are returned for a particular document.
You can include the `_source`, `_source_includes`, and `_source_excludes` query parameters in the request URI to specify the defaults to use when there are no per-document instructions.
**Get stored fields**
Use the `stored_fields` attribute to specify the set of stored fields you want to retrieve.
Any requested fields that are not stored are ignored.
You can include the `stored_fields` query parameter in the request URI to specify the defaults to use when there are no per-document instructions.'
operationId: mget
parameters:
- in: query
name: preference
description: Specifies the node or shard the operation should be performed on. 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: refresh
description: If `true`, the request refreshes relevant shards before retrieving documents.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: routing
description: Custom value used to route operations to a specific shard.
deprecated: false
schema:
$ref: '#/components/schemas/_types.Routing'
style: form
- in: query
name: _source
description: True or false to return the `_source` field or not, or a list of fields to return.
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.
You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: _source_includes
description: 'A comma-separated list of source fields to include in the response.
If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the `_source_excludes` query parameter.
If the `_source` parameter is `false`, this parameter is ignored.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: stored_fields
description: If `true`, retrieves the document fields stored in the index rather than the document `_source`.
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
requestBody:
content:
application/json:
schema:
type: object
properties:
docs:
description: The documents you want to retrieve. Required if no index is specified in the request URI.
type: array
items:
$ref: '#/components/schemas/_global.mget.Operation'
ids:
description: The IDs of the documents you want to retrieve. Allowed when the index is specified in the request URI.
allOf:
- $ref: '#/components/schemas/_types.Ids'
examples:
MultiGetRequestExample1:
summary: Get documents by ID
description: 'Run `GET /my-index-000001/_mget`. When you specify an index in the request URI, only the document IDs are required in the request body.
'
value: "{\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n}"
MultiGetRequestExample2:
summary: Filter source fields
description: 'Run `GET /_mget`. This request sets `_source` to `false` for document 1 to exclude the source entirely. It retrieves `field3` and `field4` from document 2. It retrieves the `user` field from document 3 but filters out the `user.location` field.
'
value: "{\n \"docs\": [\n {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"_source\": false\n },\n {\n \"_index\": \"test\",\n \"_id\": \"2\",\n \"_source\": [ \"field3\", \"field4\" ]\n },\n {\n \"_index\": \"test\",\n \"_id\": \"3\",\n \"_source\": {\n \"include\": [ \"user\" ],\n \"exclude\": [ \"user.location\" ]\n }\n }\n ]\n}"
MultiGetRequestExample3:
summary: Get stored fields
description: 'Run `GET /_mget`. This request retrieves `field1` and `field2` from document 1 and `field3` and `field4` from document 2.
'
value: "{\n \"docs\": [\n {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"stored_fields\": [ \"field1\", \"field2\" ]\n },\n {\n \"_index\": \"test\",\n \"_id\": \"2\",\n \"stored_fields\": [ \"field3\", \"field4\" ]\n }\n ]\n}"
MultiGetRequestExample4:
summary: Document routing
description: 'Run `GET /_mget?routing=key1`. If routing is used during indexing, you need to specify the routing value to retrieve documents. This request fetches `test/_doc/2` from the shard corresponding to routing key `key1`. It fetches `test/_doc/1` from the shard corresponding to routing key `key2`.
'
value: "{\n \"docs\": [\n {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"routing\": \"key2\"\n },\n {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n ]\n}"
required: true
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
properties:
docs:
description: 'The response includes a docs array that contains the documents in the order specified in the request.
The structure of the returned documents is similar to that returned by the get API.
If there is a failure getting a particular document, the error is included in place of the document.'
type: array
items:
$ref: '#/components/schemas/_global.mget.ResponseItem'
required:
- docs
x-state: Generally available; Added in 1.3.0
x-variations:
- "\n GET\n /_mget\n
\n "
- "\n POST\n /_mget\n
\n "
x-req-auth:
- 'Index privileges: `read`
'
x-api: mget
x-category: document management
x-codeSamples:
- lang: Console
source: "GET /my-index-000001/_mget\n{\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n}"
- lang: Python
source: "resp = client.mget(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ],\n)"
- lang: JavaScript
source: "const response = await client.mget({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"1\",\n },\n {\n _id: \"2\",\n },\n ],\n});"
- lang: Ruby
source: "response = client.mget(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n }\n)"
- lang: PHP
source: "$resp = $client->mget([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"1\",\n ],\n [\n \"_id\" => \"2\",\n ],\n ),\n ],\n]);"
- lang: curl
source: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"docs":[{"_id":"1"},{"_id":"2"}]}'' "$ELASTICSEARCH_URL/my-index-000001/_mget"'
- lang: Java
source: "client.mget(m -> m\n .docs(List.of(MultiGetOperation.of(mu -> mu\n .id(\"1\")\n ),MultiGetOperation.of(mu -> mu\n .id(\"2\")\n )))\n .index(\"my-index-000001\")\n);\n"
x-metaTags:
- content: Elasticsearch
name: product_name
post:
tags:
- Document
summary: Get multiple documents
description: 'Get multiple JSON documents by ID from one or more indices.
If you specify an index in the request URI, you only need to specify the document IDs in the request body.
To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail.
**Filter source fields**
By default, the `_source` field is returned for every document (if stored).
Use the `_source` and `_source_include` or `source_exclude` attributes to filter what fields are returned for a particular document.
You can include the `_source`, `_source_includes`, and `_source_excludes` query parameters in the request URI to specify the defaults to use when there are no per-document instructions.
**Get stored fields**
Use the `stored_fields` attribute to specify the set of stored fields you want to retrieve.
Any requested fields that are not stored are ignored.
You can include the `stored_fields` query parameter in the request URI to specify the defaults to use when there are no per-document instructions.'
operationId: mget-1
parameters:
- in: query
name: preference
description: Specifies the node or shard the operation should be performed on. 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: refresh
description: If `true`, the request refreshes relevant shards before retrieving documents.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: routing
description: Custom value used to route operations to a specific shard.
deprecated: false
schema:
$ref: '#/components/schemas/_types.Routing'
style: form
- in: query
name: _source
description: True or false to return the `_source` field or not, or a list of fields to return.
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.
You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: _source_includes
description: 'A comma-separated list of source fields to include in the response.
If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the `_source_excludes` query parameter.
If the `_source` parameter is `false`, this parameter is ignored.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: stored_fields
description: If `true`, retrieves the document fields stored in the index rather than the document `_source`.
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
requestBody:
content:
application/json:
schema:
type: object
properties:
docs:
description: The documents you want to retrieve. Required if no index is specified in the request URI.
type: array
items:
$ref: '#/components/schemas/_global.mget.Operation'
ids:
description: The IDs of the documents you want to retrieve. Allowed when the index is specified in the request URI.
allOf:
- $ref: '#/components/schemas/_types.Ids'
examples:
MultiGetRequestExample1:
summary: Get documents by ID
description: 'Run `GET /my-index-000001/_mget`. When you specify an index in the request URI, only the document IDs are required in the request body.
'
value: "{\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n}"
MultiGetRequestExample2:
summary: Filter source fields
description: 'Run `GET /_mget`. This request sets `_source` to `false` for document 1 to exclude the source entirely. It retrieves `field3` and `field4` from document 2. It retrieves the `user` field from document 3 but filters out the `user.location` field.
'
value: "{\n \"docs\": [\n {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"_source\": false\n },\n {\n \"_index\": \"test\",\n \"_id\": \"2\",\n \"_source\": [ \"field3\", \"field4\" ]\n },\n {\n \"_index\": \"test\",\n \"_id\": \"3\",\n \"_source\": {\n \"include\": [ \"user\" ],\n \"exclude\": [ \"user.location\" ]\n }\n }\n ]\n}"
MultiGetRequestExample3:
summary: Get stored fields
description: 'Run `GET /_mget`. This request retrieves `field1` and `field2` from document 1 and `field3` and `field4` from document 2.
'
value: "{\n \"docs\": [\n {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"stored_fields\": [ \"field1\", \"field2\" ]\n },\n {\n \"_index\": \"test\",\n \"_id\": \"2\",\n \"stored_fields\": [ \"field3\", \"field4\" ]\n }\n ]\n}"
MultiGetRequestExample4:
summary: Document routing
description: 'Run `GET /_mget?routing=key1`. If routing is used during indexing, you need to specify the routing value to retrieve documents. This request fetches `test/_doc/2` from the shard corresponding to routing key `key1`. It fetches `test/_doc/1` from the shard corresponding to routing key `key2`.
'
value: "{\n \"docs\": [\n {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"routing\": \"key2\"\n },\n {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n ]\n}"
required: true
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
properties:
docs:
description: 'The response includes a docs array that contains the documents in the order specified in the request.
The structure of the returned documents is similar to that returned by the get API.
If there is a failure getting a particular document, the error is included in place of the document.'
type: array
items:
$ref: '#/components/schemas/_global.mget.ResponseItem'
required:
- docs
x-state: Generally available; Added in 1.3.0
x-variations:
- "\n GET\n /_mget\n
\n "
- "\n POST\n /_mget\n
\n "
x-req-auth:
- 'Index privileges: `read`
'
x-api: mget
x-category: document management
x-codeSamples:
- lang: Console
source: "GET /my-index-000001/_mget\n{\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n}"
- lang: Python
source: "resp = client.mget(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ],\n)"
- lang: JavaScript
source: "const response = await client.mget({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"1\",\n },\n {\n _id: \"2\",\n },\n ],\n});"
- lang: Ruby
source: "response = client.mget(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n }\n)"
- lang: PHP
source: "$resp = $client->mget([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"1\",\n ],\n [\n \"_id\" => \"2\",\n ],\n ),\n ],\n]);"
- lang: curl
source: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"docs":[{"_id":"1"},{"_id":"2"}]}'' "$ELASTICSEARCH_URL/my-index-000001/_mget"'
- lang: Java
source: "client.mget(m -> m\n .docs(List.of(MultiGetOperation.of(mu -> mu\n .id(\"1\")\n ),MultiGetOperation.of(mu -> mu\n .id(\"2\")\n )))\n .index(\"my-index-000001\")\n);\n"
x-metaTags:
- content: Elasticsearch
name: product_name
/{index}/_mget:
get:
tags:
- Document
summary: Get multiple documents
description: 'Get multiple JSON documents by ID from one or more indices.
If you specify an index in the request URI, you only need to specify the document IDs in the request body.
To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail.
**Filter source fields**
By default, the `_source` field is returned for every document (if stored).
Use the `_source` and `_source_include` or `source_exclude` attributes to filter what fields are returned for a particular document.
You can include the `_source`, `_source_includes`, and `_source_excludes` query parameters in the request URI to specify the defaults to use when there are no per-document instructions.
**Get stored fields**
Use the `stored_fields` attribute to specify the set of stored fields you want to retrieve.
Any requested fields that are not stored are ignored.
You can include the `stored_fields` query parameter in the request URI to specify the defaults to use when there are no per-document instructions.'
operationId: mget-2
parameters:
- in: path
name: index
description: Name of the index to retrieve documents from when `ids` are specified, or when a document in the `docs` array does not specify an index.
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.IndexName'
style: simple
- in: query
name: preference
description: Specifies the node or shard the operation should be performed on. 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: refresh
description: If `true`, the request refreshes relevant shards before retrieving documents.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: routing
description: Custom value used to route operations to a specific shard.
deprecated: false
schema:
$ref: '#/components/schemas/_types.Routing'
style: form
- in: query
name: _source
description: True or false to return the `_source` field or not, or a list of fields to return.
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.
You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: _source_includes
description: 'A comma-separated list of source fields to include in the response.
If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the `_source_excludes` query parameter.
If the `_source` parameter is `false`, this parameter is ignored.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: stored_fields
description: If `true`, retrieves the document fields stored in the index rather than the document `_source`.
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
requestBody:
content:
application/json:
schema:
type: object
properties:
docs:
description: The documents you want to retrieve. Required if no index is specified in the request URI.
type: array
items:
$ref: '#/components/schemas/_global.mget.Operation'
ids:
description: The IDs of the documents you want to retrieve. Allowed when the index is specified in the request URI.
allOf:
- $ref: '#/components/schemas/_types.Ids'
examples:
MultiGetRequestExample1:
summary: Get documents by ID
description: 'Run `GET /my-index-000001/_mget`. When you specify an index in the request URI, only the document IDs are required in the request body.
'
value: "{\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n}"
MultiGetRequestExample2:
summary: Filter source fields
description: 'Run `GET /_mget`. This request sets `_source` to `false` for document 1 to exclude the source entirely. It retrieves `field3` and `field4` from document 2. It retrieves the `user` field from document 3 but filters out the `user.location` field.
'
value: "{\n \"docs\": [\n {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"_source\": false\n },\n {\n \"_index\": \"test\",\n \"_id\": \"2\",\n \"_source\": [ \"field3\", \"field4\" ]\n },\n {\n \"_index\": \"test\",\n \"_id\": \"3\",\n \"_source\": {\n \"include\": [ \"user\" ],\n \"exclude\": [ \"user.location\" ]\n }\n }\n ]\n}"
MultiGetRequestExample3:
summary: Get stored fields
description: 'Run `GET /_mget`. This request retrieves `field1` and `field2` from document 1 and `field3` and `field4` from document 2.
'
value: "{\n \"docs\": [\n {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"stored_fields\": [ \"field1\", \"field2\" ]\n },\n {\n \"_index\": \"test\",\n \"_id\": \"2\",\n \"stored_fields\": [ \"field3\", \"field4\" ]\n }\n ]\n}"
MultiGetRequestExample4:
summary: Document routing
description: 'Run `GET /_mget?routing=key1`. If routing is used during indexing, you need to specify the routing value to retrieve documents. This request fetches `test/_doc/2` from the shard corresponding to routing key `key1`. It fetches `test/_doc/1` from the shard corresponding to routing key `key2`.
'
value: "{\n \"docs\": [\n {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"routing\": \"key2\"\n },\n {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n ]\n}"
required: true
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
properties:
docs:
description: 'The response includes a docs array that contains the documents in the order specified in the request.
The structure of the returned documents is similar to that returned by the get API.
If there is a failure getting a particular document, the error is included in place of the document.'
type: array
items:
$ref: '#/components/schemas/_global.mget.ResponseItem'
required:
- docs
x-state: Generally available; Added in 1.3.0
x-variations:
- "\n GET\n /{index}/_mget\n
\n "
- "\n POST\n /{index}/_mget\n
\n "
x-req-auth:
- 'Index privileges: `read`
'
x-api: mget
x-category: document management
x-codeSamples:
- lang: Console
source: "GET /my-index-000001/_mget\n{\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n}"
- lang: Python
source: "resp = client.mget(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ],\n)"
- lang: JavaScript
source: "const response = await client.mget({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"1\",\n },\n {\n _id: \"2\",\n },\n ],\n});"
- lang: Ruby
source: "response = client.mget(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n }\n)"
- lang: PHP
source: "$resp = $client->mget([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"1\",\n ],\n [\n \"_id\" => \"2\",\n ],\n ),\n ],\n]);"
- lang: curl
source: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"docs":[{"_id":"1"},{"_id":"2"}]}'' "$ELASTICSEARCH_URL/my-index-000001/_mget"'
- lang: Java
source: "client.mget(m -> m\n .docs(List.of(MultiGetOperation.of(mu -> mu\n .id(\"1\")\n ),MultiGetOperation.of(mu -> mu\n .id(\"2\")\n )))\n .index(\"my-index-000001\")\n);\n"
x-metaTags:
- content: Elasticsearch
name: product_name
post:
tags:
- Document
summary: Get multiple documents
description: 'Get multiple JSON documents by ID from one or more indices.
If you specify an index in the request URI, you only need to specify the document IDs in the request body.
To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail.
**Filter source fields**
By default, the `_source` field is returned for every document (if stored).
Use the `_source` and `_source_include` or `source_exclude` attributes to filter what fields are returned for a particular document.
You can include the `_source`, `_source_includes`, and `_source_excludes` query parameters in the request URI to specify the defaults to use when there are no per-document instructions.
**Get stored fields**
Use the `stored_fields` attribute to specify the set of stored fields you want to retrieve.
Any requested fields that are not stored are ignored.
You can include the `stored_fields` query parameter in the request URI to specify the defaults to use when there are no per-document instructions.'
operationId: mget-3
parameters:
- in: path
name: index
description: Name of the index to retrieve documents from when `ids` are specified, or when a document in the `docs` array does not specify an index.
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.IndexName'
style: simple
- in: query
name: preference
description: Specifies the node or shard the operation should be performed on. 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: refresh
description: If `true`, the request refreshes relevant shards before retrieving documents.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: routing
description: Custom value used to route operations to a specific shard.
deprecated: false
schema:
$ref: '#/components/schemas/_types.Routing'
style: form
- in: query
name: _source
description: True or false to return the `_source` field or not, or a list of fields to return.
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.
You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: _source_includes
description: 'A comma-separated list of source fields to include in the response.
If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the `_source_excludes` query parameter.
If the `_source` parameter is `false`, this parameter is ignored.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: stored_fields
description: If `true`, retrieves the document fields stored in the index rather than the document `_source`.
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
requestBody:
content:
application/json:
schema:
type: object
properties:
docs:
description: The documents you want to retrieve. Required if no index is specified in the request URI.
type: array
items:
$ref: '#/components/schemas/_global.mget.Operation'
ids:
description: The IDs of the documents you want to retrieve. Allowed when the index is specified in the request URI.
allOf:
- $ref: '#/components/schemas/_types.Ids'
examples:
MultiGetRequestExample1:
summary: Get documents by ID
description: 'Run `GET /my-index-000001/_mget`. When you specify an index in the request URI, only the document IDs are required in the request body.
'
value: "{\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n}"
MultiGetRequestExample2:
summary: Filter source fields
description: 'Run `GET /_mget`. This request sets `_source` to `false` for document 1 to exclude the source entirely. It retrieves `field3` and `field4` from document 2. It retrieves the `user` field from document 3 but filters out the `user.location` field.
'
value: "{\n \"docs\": [\n {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"_source\": false\n },\n {\n \"_index\": \"test\",\n \"_id\": \"2\",\n \"_source\": [ \"field3\", \"field4\" ]\n },\n {\n \"_index\": \"test\",\n \"_id\": \"3\",\n \"_source\": {\n \"include\": [ \"user\" ],\n \"exclude\": [ \"user.location\" ]\n }\n }\n ]\n}"
MultiGetRequestExample3:
summary: Get stored fields
description: 'Run `GET /_mget`. This request retrieves `field1` and `field2` from document 1 and `field3` and `field4` from document 2.
'
value: "{\n \"docs\": [\n {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"stored_fields\": [ \"field1\", \"field2\" ]\n },\n {\n \"_index\": \"test\",\n \"_id\": \"2\",\n \"stored_fields\": [ \"field3\", \"field4\" ]\n }\n ]\n}"
MultiGetRequestExample4:
summary: Document routing
description: 'Run `GET /_mget?routing=key1`. If routing is used during indexing, you need to specify the routing value to retrieve documents. This request fetches `test/_doc/2` from the shard corresponding to routing key `key1`. It fetches `test/_doc/1` from the shard corresponding to routing key `key2`.
'
value: "{\n \"docs\": [\n {\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"routing\": \"key2\"\n },\n {\n \"_index\": \"test\",\n \"_id\": \"2\"\n }\n ]\n}"
required: true
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
properties:
docs:
description: 'The response includes a docs array that contains the documents in the order specified in the request.
The structure of the returned documents is similar to that returned by the get API.
If there is a failure getting a particular document, the error is included in place of the document.'
type: array
items:
$ref: '#/components/schemas/_global.mget.ResponseItem'
required:
- docs
x-state: Generally available; Added in 1.3.0
x-variations:
- "\n GET\n /{index}/_mget\n
\n "
- "\n POST\n /{index}/_mget\n
\n "
x-req-auth:
- 'Index privileges: `read`
'
x-api: mget
x-category: document management
x-codeSamples:
- lang: Console
source: "GET /my-index-000001/_mget\n{\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n}"
- lang: Python
source: "resp = client.mget(\n index=\"my-index-000001\",\n docs=[\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ],\n)"
- lang: JavaScript
source: "const response = await client.mget({\n index: \"my-index-000001\",\n docs: [\n {\n _id: \"1\",\n },\n {\n _id: \"2\",\n },\n ],\n});"
- lang: Ruby
source: "response = client.mget(\n index: \"my-index-000001\",\n body: {\n \"docs\": [\n {\n \"_id\": \"1\"\n },\n {\n \"_id\": \"2\"\n }\n ]\n }\n)"
- lang: PHP
source: "$resp = $client->mget([\n \"index\" => \"my-index-000001\",\n \"body\" => [\n \"docs\" => array(\n [\n \"_id\" => \"1\",\n ],\n [\n \"_id\" => \"2\",\n ],\n ),\n ],\n]);"
- lang: curl
source: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"docs":[{"_id":"1"},{"_id":"2"}]}'' "$ELASTICSEARCH_URL/my-index-000001/_mget"'
- lang: Java
source: "client.mget(m -> m\n .docs(List.of(MultiGetOperation.of(mu -> mu\n .id(\"1\")\n ),MultiGetOperation.of(mu -> mu\n .id(\"2\")\n )))\n .index(\"my-index-000001\")\n);\n"
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.
You can specify existing documents by index and ID or provide artificial documents in the body of the request.
You can specify the index in the request body or request URI.
The response contains a `docs` array with all the fetched termvectors.
Each element has the structure provided by the termvectors API.
**Artificial documents**
You can also use `mtermvectors` to generate term vectors for artificial documents provided in the body of the request.
The mapping used is determined by the specified `_index`.'
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.
It 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.
It 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.
'
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.
'
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`.
'
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`
'
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.
You can specify existing documents by index and ID or provide artificial documents in the body of the request.
You can specify the index in the request body or request URI.
The response contains a `docs` array with all the fetched termvectors.
Each element has the structure provided by the termvectors API.
**Artificial documents**
You can also use `mtermvectors` to generate term vectors for artificial documents provided in the body of the request.
The mapping used is determined by the specified `_index`.'
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.
It 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.
It 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.
'
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.
'
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`.
'
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`
'
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.
You can specify existing documents by index and ID or provide artificial documents in the body of the request.
You can specify the index in the request body or request URI.
The response contains a `docs` array with all the fetched termvectors.
Each element has the structure provided by the termvectors API.
**Artificial documents**
You can also use `mtermvectors` to generate term vectors for artificial documents provided in the body of the request.
The mapping used is determined by the specified `_index`.'
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.
It 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.
It 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.
'
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.
'
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`.
'
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`
'
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.
You can specify existing documents by index and ID or provide artificial documents in the body of the request.
You can specify the index in the request body or request URI.
The response contains a `docs` array with all the fetched termvectors.
Each element has the structure provided by the termvectors API.
**Artificial documents**
You can also use `mtermvectors` to generate term vectors for artificial documents provided in the body of the request.
The mapping used is determined by the specified `_index`.'
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.
It 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.
It 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.
'
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.
'
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`.
'
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`
'
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
/_reindex:
post:
tags:
- Document
summary: Reindex documents
description: 'Copy documents from a source to a destination.
You can copy all documents to the destination index or reindex a subset of the documents.
The source can be any existing index, alias, or data stream.
The destination must differ from the source.
For example, you cannot reindex a data stream into itself.
IMPORTANT: Reindex requires `_source` to be enabled for all documents in the source.
The destination should be configured as wanted before calling the reindex API.
Reindex does not copy the settings from the source or its associated template.
Mappings, shard counts, and replicas, for example, must be configured ahead of time.
If the Elasticsearch security features are enabled, you must have the following security privileges:
* The `read` index privilege for the source data stream, index, or alias.
* The `write` index privilege for the destination data stream, index, or index alias.
* To automatically create a data stream or index with a reindex API request, you must have the `auto_configure`, `create_index`, or `manage` index privilege for the destination data stream, index, or alias.
* If reindexing from a remote cluster, the `source.remote.user` must have the `monitor` cluster privilege and the `read` index privilege for the source data stream, index, or alias.
If reindexing from a remote cluster into a cluster using Elastic Stack, you must explicitly allow the remote host using the `reindex.remote.whitelist` node setting on the destination cluster.
If reindexing from a remote cluster into an Elastic Cloud Serverless project, only remote hosts from Elastic Cloud Hosted are allowed.
Automatic data stream creation requires a matching index template with data stream enabled.
The `dest` element can be configured like the index API to control optimistic concurrency control.
Omitting `version_type` or setting it to `internal` causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID.
Setting `version_type` to `external` causes Elasticsearch to preserve the `version` from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source.
Setting `op_type` to `create` causes the reindex API to create only missing documents in the destination.
All existing documents will cause a version conflict.
IMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an `op_type` of `create`.
A reindex can only add new documents to a destination data stream.
It cannot update existing documents in a destination data stream.
By default, version conflicts abort the reindex process.
To continue reindexing if there are conflicts, set the `conflicts` request body property to `proceed`.
In this case, the response includes a count of the version conflicts that were encountered.
Note that the handling of other error types is unaffected by the `conflicts` property.
Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than `max_docs` until it has successfully indexed `max_docs` documents into the target or it has gone through every document in the source query.
It''s recommended to reindex on indices with a green status. Reindexing can fail when a node shuts down or crashes.
* When requested with `wait_for_completion=true` (default), the request fails if the node shuts down.
* 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.
When retrying a failed reindex operation, it might be necessary to set `conflicts=proceed` or to first delete the partial destination index.
Additionally, dry runs, checking disk space, and fetching index recovery information can help address the root cause.
Refer 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.
By 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.
It defaults to one slice, which means the task isn''t sliced into subtasks.
Reindex supports sliced scroll to parallelize the reindexing process.
This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts.
NOTE: Reindexing from remote clusters does not support manual or automatic slicing.
If set to `auto`, Elasticsearch chooses the number of slices to use.
This setting will use one slice per shard, up to a certain limit.
If there are multiple sources, it will choose the number of slices based on the index or backing index with the smallest number of shards.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Slices'
style: form
- in: query
name: max_docs
description: 'The maximum number of documents to reindex.
By default, all documents are reindexed.
If it is a value less then or equal to `scroll_size`, a scroll will not be used to retrieve the results for the operation.
If `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.
By default, Elasticsearch waits for at least one minute before failing.
The 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.
Set it to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).
The default value is one, which means it waits for each primary shard to be active.'
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.
By default, all documents are reindexed.
If it is a value less then or equal to `scroll_size`, a scroll will not be used to retrieve the results for the operation.
If `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.
'
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`.
'
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.
'
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.
'
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.
'
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.
'
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.
'
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`.
'
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`.
'
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`.
'
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.
'
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.
'
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.
If this array is not empty, the request ended because of those failures.
Reindex 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.
You 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.
It has meaning only when using the task API, where it indicates the next time (in milliseconds since epoch) that a throttled request will be run again in order to conform to `requests_per_second`.'
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.
That 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`
'
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.
For example:
```
POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1
```
Rethrottling that speeds up the query takes effect immediately.
Rethrottling that slows down the query will take effect after completing the current batch.
This behavior prevents scroll timeouts.'
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.
It 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
'
- 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
/{index}/_termvectors/{id}:
get:
tags:
- Document
summary: Get term vector information
description: 'Get information and statistics about terms in the fields of a particular document.
You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request.
You can specify the fields you are interested in through the `fields` parameter or by adding the fields to the request body.
For example:
```
GET /my-index-000001/_termvectors/1?fields=message
```
Fields can be specified using wildcards, similar to the multi match query.
Term vectors are real-time by default, not near real-time.
This can be changed by setting `realtime` parameter to `false`.
You can request three types of values: _term information_, _term statistics_, and _field statistics_.
By default, all term information and field statistics are returned for all fields but term statistics are excluded.
**Term information**
* term frequency in the field (always returned)
* term positions (`positions: true`)
* start and end offsets (`offsets: true`)
* term payloads (`payloads: true`), as base64 encoded bytes
If the requested information wasn''t stored in the index, it will be computed on the fly if possible.
Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user.
> warn
> Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16.
**Behaviour**
The term and field statistics are not accurate.
Deleted documents are not taken into account.
The information is only retrieved for the shard the requested document resides in.
The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context.
By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected.
Use `routing` only to hit a particular shard.
Refer to the linked documentation for detailed examples of how to use this API.'
externalDocs:
url: https://www.elastic.co/docs/reference/elasticsearch/rest-apis/term-vectors-examples
x-previousVersionUrl: https://www.elastic.co/guide/en/elasticsearch/reference/8.19/docs-termvectors.html
operationId: termvectors
parameters:
- in: path
name: index
description: The name of the index that contains the document.
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.IndexName'
style: simple
- in: path
name: id
description: A unique identifier for the document.
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.Id'
style: simple
- in: query
name: fields
description: 'A comma-separated list or wildcard expressions of fields to include in the statistics.
It is used as the default list unless a specific field list is provided in the `completion_fields` or `fielddata_fields` parameters.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: field_statistics
description: 'If `true`, the response includes:
* The document count (how many documents contain this field).
* The sum of document frequencies (the sum of document frequencies for all terms in this field).
* The sum of total term frequencies (the sum of total term frequencies of each term in this field).'
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.
It 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 that is 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:
* The total term frequency (how often a term occurs in all documents).
* The document frequency (the number of documents containing the current term).
By default these values are not returned since term statistics can have a serious performance impact.'
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:
doc:
description: An artificial document (a document not present in the index) for which you want to retrieve term vectors.
type: object
filter:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-mlt-query
description: 'Filter terms based on their tf-idf scores.
This could be useful in order find out a good characteristic vector of a document.
This feature works in a similar manner to the second phase of the More Like This Query.'
allOf:
- $ref: '#/components/schemas/_global.termvectors.Filter'
per_field_analyzer:
description: 'Override the default per-field analyzer.
This is useful in order to generate term vectors in any fashion, especially when using artificial documents.
When providing an analyzer for a field that already stores term vectors, the term vectors will be regenerated.'
type: object
additionalProperties:
type: string
fields:
description: 'A list of fields to include in the statistics.
It is used as the default list unless a specific field list is provided in the `completion_fields` or `fielddata_fields` parameters.'
type: array
items:
$ref: '#/components/schemas/_types.Field'
field_statistics:
description: 'If `true`, the response includes:
* The document count (how many documents contain this field).
* The sum of document frequencies (the sum of document frequencies for all terms in this field).
* The sum of total term frequencies (the sum of total term frequencies of each term in this field).'
default: true
type: boolean
offsets:
description: If `true`, the response includes term offsets.
default: true
type: boolean
payloads:
description: If `true`, the response includes term payloads.
default: true
type: boolean
positions:
description: If `true`, the response includes term positions.
default: true
type: boolean
term_statistics:
description: 'If `true`, the response includes:
* The total term frequency (how often a term occurs in all documents).
* The document frequency (the number of documents containing the current term).
By default these values are not returned since term statistics can have a serious performance impact.'
default: false
type: boolean
routing:
description: A custom value that is used to route operations to a specific shard.
allOf:
- $ref: '#/components/schemas/_types.Routing'
version:
description: If `true`, returns the document version as part of a hit.
allOf:
- $ref: '#/components/schemas/_types.VersionNumber'
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"
allOf:
- $ref: '#/components/schemas/_types.VersionType'
examples:
TermVectorsRequestExample1:
summary: Return stored term vectors
description: 'Run `GET /my-index-000001/_termvectors/1` to return all information and statistics for field `text` in document 1.
'
value: "{\n \"fields\" : [\"text\"],\n \"offsets\" : true,\n \"payloads\" : true,\n \"positions\" : true,\n \"term_statistics\" : true,\n \"field_statistics\" : true\n}"
TermVectorsRequestExample2:
summary: Per-field analyzer
description: 'Run `GET /my-index-000001/_termvectors/1` to set per-field analyzers. A different analyzer than the one at the field may be provided by using the `per_field_analyzer` parameter.
'
value: "{\n \"doc\" : {\n \"fullname\" : \"John Doe\",\n \"text\" : \"test test test\"\n },\n \"fields\": [\"fullname\"],\n \"per_field_analyzer\" : {\n \"fullname\": \"keyword\"\n }\n}"
TermVectorsRequestExample3:
summary: Terms filtering
description: 'Run `GET /imdb/_termvectors` to filter the terms returned based on their tf-idf scores. It returns the three most "interesting" keywords from the artificial document having the given "plot" field value. Notice that the keyword "Tony" or any stop words are not part of the response, as their tf-idf must be too low.
'
value: "{\n \"doc\": {\n \"plot\": \"When wealthy industrialist Tony Stark is forced to build an armored suit after a life-threatening incident, he ultimately decides to use its technology to fight against evil.\"\n },\n \"term_statistics\": true,\n \"field_statistics\": true,\n \"positions\": false,\n \"offsets\": false,\n \"filter\": {\n \"max_num_terms\": 3,\n \"min_term_freq\": 1,\n \"min_doc_freq\": 1\n }\n}"
TermVectorsRequestExample4:
summary: Generate term vectors on the fly
description: 'Run `GET /my-index-000001/_termvectors/1`. Term vectors which are not explicitly stored in the index are automatically computed on the fly. This request returns all information and statistics for the fields in document 1, even though the terms haven''t been explicitly stored in the index. Note that for the field text, the terms are not regenerated.
'
value: "{\n \"fields\" : [\"text\", \"some_field_without_term_vectors\"],\n \"offsets\" : true,\n \"positions\" : true,\n \"term_statistics\" : true,\n \"field_statistics\" : true\n}"
TermVectorsRequestExample5:
summary: Artificial documents
description: 'Run `GET /my-index-000001/_termvectors`. Term vectors can be generated for artificial documents, that is for documents not present in the index. If dynamic mapping is turned on (default), the document fields not in the original mapping will be dynamically created.
'
value: "{\n \"doc\" : {\n \"fullname\" : \"John Doe\",\n \"text\" : \"test test test\"\n }\n}"
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
properties:
found:
type: boolean
_id:
allOf:
- $ref: '#/components/schemas/_types.Id'
_index:
allOf:
- $ref: '#/components/schemas/_types.IndexName'
term_vectors:
type: object
additionalProperties:
$ref: '#/components/schemas/_global.termvectors.TermVector'
took:
type: number
_version:
allOf:
- $ref: '#/components/schemas/_types.VersionNumber'
required:
- found
- _index
- took
- _version
examples:
TermVectorsResponseExample1:
summary: Return stored term vectors
description: A successful response from `GET /my-index-000001/_termvectors/1`.
value: "{\n \"_index\": \"my-index-000001\",\n \"_id\": \"1\",\n \"_version\": 1,\n \"found\": true,\n \"took\": 6,\n \"term_vectors\": {\n \"text\": {\n \"field_statistics\": {\n \"sum_doc_freq\": 4,\n \"doc_count\": 2,\n \"sum_ttf\": 6\n },\n \"terms\": {\n \"test\": {\n \"doc_freq\": 2,\n \"ttf\": 4,\n \"term_freq\": 3,\n \"tokens\": [\n {\n \"position\": 0,\n \"start_offset\": 0,\n \"end_offset\": 4,\n \"payload\": \"d29yZA==\"\n },\n {\n \"position\": 1,\n \"start_offset\": 5,\n \"end_offset\": 9,\n \"payload\": \"d29yZA==\"\n },\n {\n \"position\": 2,\n \"start_offset\": 10,\n \"end_offset\": 14,\n \"payload\": \"d29yZA==\"\n }\n ]\n }\n }\n }\n }\n}"
TermVectorsResponseExample2:
summary: Per-field analyzer
description: A successful response from `GET /my-index-000001/_termvectors` with `per_field_analyzer` in the request body.
value: "{\n \"_index\": \"my-index-000001\",\n \"_version\": 0,\n \"found\": true,\n \"took\": 6,\n \"term_vectors\": {\n \"fullname\": {\n \"field_statistics\": {\n \"sum_doc_freq\": 2,\n \"doc_count\": 4,\n \"sum_ttf\": 4\n },\n \"terms\": {\n \"John Doe\": {\n \"term_freq\": 1,\n \"tokens\": [\n {\n \"position\": 0,\n \"start_offset\": 0,\n \"end_offset\": 8\n }\n ]\n }\n }\n }\n }\n}"
TermVectorsResponseExample3:
summary: Terms filtering
description: A successful response from `GET /my-index-000001/_termvectors` with a `filter` in the request body.
value: "{\n \"_index\": \"imdb\",\n \"_version\": 0,\n \"found\": true,\n \"term_vectors\": {\n \"plot\": {\n \"field_statistics\": {\n \"sum_doc_freq\": 3384269,\n \"doc_count\": 176214,\n \"sum_ttf\": 3753460\n },\n \"terms\": {\n \"armored\": {\n \"doc_freq\": 27,\n \"ttf\": 27,\n \"term_freq\": 1,\n \"score\": 9.74725\n },\n \"industrialist\": {\n \"doc_freq\": 88,\n \"ttf\": 88,\n \"term_freq\": 1,\n \"score\": 8.590818\n },\n \"stark\": {\n \"doc_freq\": 44,\n \"ttf\": 47,\n \"term_freq\": 1,\n \"score\": 9.272792\n }\n }\n }\n }\n}"
x-state: Generally available
x-variations:
- "\n GET\n /{index}/_termvectors/{id}\n
\n "
- "\n POST\n /{index}/_termvectors/{id}\n
\n "
x-req-auth:
- 'Index privileges: `read`
'
x-api: termvectors
x-category: document management
x-codeSamples:
- lang: Console
source: "GET /my-index-000001/_termvectors/1\n{\n \"fields\" : [\"text\"],\n \"offsets\" : true,\n \"payloads\" : true,\n \"positions\" : true,\n \"term_statistics\" : true,\n \"field_statistics\" : true\n}"
- lang: Python
source: "resp = client.termvectors(\n index=\"my-index-000001\",\n id=\"1\",\n fields=[\n \"text\"\n ],\n offsets=True,\n payloads=True,\n positions=True,\n term_statistics=True,\n field_statistics=True,\n)"
- lang: JavaScript
source: "const response = await client.termvectors({\n index: \"my-index-000001\",\n id: 1,\n fields: [\"text\"],\n offsets: true,\n payloads: true,\n positions: true,\n term_statistics: true,\n field_statistics: true,\n});"
- lang: Ruby
source: "response = client.termvectors(\n index: \"my-index-000001\",\n id: \"1\",\n body: {\n \"fields\": [\n \"text\"\n ],\n \"offsets\": true,\n \"payloads\": true,\n \"positions\": true,\n \"term_statistics\": true,\n \"field_statistics\": true\n }\n)"
- lang: PHP
source: "$resp = $client->termvectors([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"body\" => [\n \"fields\" => array(\n \"text\",\n ),\n \"offsets\" => true,\n \"payloads\" => true,\n \"positions\" => true,\n \"term_statistics\" => true,\n \"field_statistics\" => true,\n ],\n]);"
- lang: curl
source: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"fields":["text"],"offsets":true,"payloads":true,"positions":true,"term_statistics":true,"field_statistics":true}'' "$ELASTICSEARCH_URL/my-index-000001/_termvectors/1"'
- lang: Java
source: "client.termvectors(t -> t\n .fieldStatistics(true)\n .fields(\"text\")\n .id(\"1\")\n .index(\"my-index-000001\")\n .offsets(true)\n .payloads(true)\n .positions(true)\n .termStatistics(true)\n);\n"
x-metaTags:
- content: Elasticsearch
name: product_name
post:
tags:
- Document
summary: Get term vector information
description: 'Get information and statistics about terms in the fields of a particular document.
You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request.
You can specify the fields you are interested in through the `fields` parameter or by adding the fields to the request body.
For example:
```
GET /my-index-000001/_termvectors/1?fields=message
```
Fields can be specified using wildcards, similar to the multi match query.
Term vectors are real-time by default, not near real-time.
This can be changed by setting `realtime` parameter to `false`.
You can request three types of values: _term information_, _term statistics_, and _field statistics_.
By default, all term information and field statistics are returned for all fields but term statistics are excluded.
**Term information**
* term frequency in the field (always returned)
* term positions (`positions: true`)
* start and end offsets (`offsets: true`)
* term payloads (`payloads: true`), as base64 encoded bytes
If the requested information wasn''t stored in the index, it will be computed on the fly if possible.
Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user.
> warn
> Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16.
**Behaviour**
The term and field statistics are not accurate.
Deleted documents are not taken into account.
The information is only retrieved for the shard the requested document resides in.
The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context.
By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected.
Use `routing` only to hit a particular shard.
Refer to the linked documentation for detailed examples of how to use this API.'
externalDocs:
url: https://www.elastic.co/docs/reference/elasticsearch/rest-apis/term-vectors-examples
x-previousVersionUrl: https://www.elastic.co/guide/en/elasticsearch/reference/8.19/docs-termvectors.html
operationId: termvectors-1
parameters:
- in: path
name: index
description: The name of the index that contains the document.
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.IndexName'
style: simple
- in: path
name: id
description: A unique identifier for the document.
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.Id'
style: simple
- in: query
name: fields
description: 'A comma-separated list or wildcard expressions of fields to include in the statistics.
It is used as the default list unless a specific field list is provided in the `completion_fields` or `fielddata_fields` parameters.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: field_statistics
description: 'If `true`, the response includes:
* The document count (how many documents contain this field).
* The sum of document frequencies (the sum of document frequencies for all terms in this field).
* The sum of total term frequencies (the sum of total term frequencies of each term in this field).'
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.
It 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 that is 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:
* The total term frequency (how often a term occurs in all documents).
* The document frequency (the number of documents containing the current term).
By default these values are not returned since term statistics can have a serious performance impact.'
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:
doc:
description: An artificial document (a document not present in the index) for which you want to retrieve term vectors.
type: object
filter:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-mlt-query
description: 'Filter terms based on their tf-idf scores.
This could be useful in order find out a good characteristic vector of a document.
This feature works in a similar manner to the second phase of the More Like This Query.'
allOf:
- $ref: '#/components/schemas/_global.termvectors.Filter'
per_field_analyzer:
description: 'Override the default per-field analyzer.
This is useful in order to generate term vectors in any fashion, especially when using artificial documents.
When providing an analyzer for a field that already stores term vectors, the term vectors will be regenerated.'
type: object
additionalProperties:
type: string
fields:
description: 'A list of fields to include in the statistics.
It is used as the default list unless a specific field list is provided in the `completion_fields` or `fielddata_fields` parameters.'
type: array
items:
$ref: '#/components/schemas/_types.Field'
field_statistics:
description: 'If `true`, the response includes:
* The document count (how many documents contain this field).
* The sum of document frequencies (the sum of document frequencies for all terms in this field).
* The sum of total term frequencies (the sum of total term frequencies of each term in this field).'
default: true
type: boolean
offsets:
description: If `true`, the response includes term offsets.
default: true
type: boolean
payloads:
description: If `true`, the response includes term payloads.
default: true
type: boolean
positions:
description: If `true`, the response includes term positions.
default: true
type: boolean
term_statistics:
description: 'If `true`, the response includes:
* The total term frequency (how often a term occurs in all documents).
* The document frequency (the number of documents containing the current term).
By default these values are not returned since term statistics can have a serious performance impact.'
default: false
type: boolean
routing:
description: A custom value that is used to route operations to a specific shard.
allOf:
- $ref: '#/components/schemas/_types.Routing'
version:
description: If `true`, returns the document version as part of a hit.
allOf:
- $ref: '#/components/schemas/_types.VersionNumber'
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"
allOf:
- $ref: '#/components/schemas/_types.VersionType'
examples:
TermVectorsRequestExample1:
summary: Return stored term vectors
description: 'Run `GET /my-index-000001/_termvectors/1` to return all information and statistics for field `text` in document 1.
'
value: "{\n \"fields\" : [\"text\"],\n \"offsets\" : true,\n \"payloads\" : true,\n \"positions\" : true,\n \"term_statistics\" : true,\n \"field_statistics\" : true\n}"
TermVectorsRequestExample2:
summary: Per-field analyzer
description: 'Run `GET /my-index-000001/_termvectors/1` to set per-field analyzers. A different analyzer than the one at the field may be provided by using the `per_field_analyzer` parameter.
'
value: "{\n \"doc\" : {\n \"fullname\" : \"John Doe\",\n \"text\" : \"test test test\"\n },\n \"fields\": [\"fullname\"],\n \"per_field_analyzer\" : {\n \"fullname\": \"keyword\"\n }\n}"
TermVectorsRequestExample3:
summary: Terms filtering
description: 'Run `GET /imdb/_termvectors` to filter the terms returned based on their tf-idf scores. It returns the three most "interesting" keywords from the artificial document having the given "plot" field value. Notice that the keyword "Tony" or any stop words are not part of the response, as their tf-idf must be too low.
'
value: "{\n \"doc\": {\n \"plot\": \"When wealthy industrialist Tony Stark is forced to build an armored suit after a life-threatening incident, he ultimately decides to use its technology to fight against evil.\"\n },\n \"term_statistics\": true,\n \"field_statistics\": true,\n \"positions\": false,\n \"offsets\": false,\n \"filter\": {\n \"max_num_terms\": 3,\n \"min_term_freq\": 1,\n \"min_doc_freq\": 1\n }\n}"
TermVectorsRequestExample4:
summary: Generate term vectors on the fly
description: 'Run `GET /my-index-000001/_termvectors/1`. Term vectors which are not explicitly stored in the index are automatically computed on the fly. This request returns all information and statistics for the fields in document 1, even though the terms haven''t been explicitly stored in the index. Note that for the field text, the terms are not regenerated.
'
value: "{\n \"fields\" : [\"text\", \"some_field_without_term_vectors\"],\n \"offsets\" : true,\n \"positions\" : true,\n \"term_statistics\" : true,\n \"field_statistics\" : true\n}"
TermVectorsRequestExample5:
summary: Artificial documents
description: 'Run `GET /my-index-000001/_termvectors`. Term vectors can be generated for artificial documents, that is for documents not present in the index. If dynamic mapping is turned on (default), the document fields not in the original mapping will be dynamically created.
'
value: "{\n \"doc\" : {\n \"fullname\" : \"John Doe\",\n \"text\" : \"test test test\"\n }\n}"
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
properties:
found:
type: boolean
_id:
allOf:
- $ref: '#/components/schemas/_types.Id'
_index:
allOf:
- $ref: '#/components/schemas/_types.IndexName'
term_vectors:
type: object
additionalProperties:
$ref: '#/components/schemas/_global.termvectors.TermVector'
took:
type: number
_version:
allOf:
- $ref: '#/components/schemas/_types.VersionNumber'
required:
- found
- _index
- took
- _version
examples:
TermVectorsResponseExample1:
summary: Return stored term vectors
description: A successful response from `GET /my-index-000001/_termvectors/1`.
value: "{\n \"_index\": \"my-index-000001\",\n \"_id\": \"1\",\n \"_version\": 1,\n \"found\": true,\n \"took\": 6,\n \"term_vectors\": {\n \"text\": {\n \"field_statistics\": {\n \"sum_doc_freq\": 4,\n \"doc_count\": 2,\n \"sum_ttf\": 6\n },\n \"terms\": {\n \"test\": {\n \"doc_freq\": 2,\n \"ttf\": 4,\n \"term_freq\": 3,\n \"tokens\": [\n {\n \"position\": 0,\n \"start_offset\": 0,\n \"end_offset\": 4,\n \"payload\": \"d29yZA==\"\n },\n {\n \"position\": 1,\n \"start_offset\": 5,\n \"end_offset\": 9,\n \"payload\": \"d29yZA==\"\n },\n {\n \"position\": 2,\n \"start_offset\": 10,\n \"end_offset\": 14,\n \"payload\": \"d29yZA==\"\n }\n ]\n }\n }\n }\n }\n}"
TermVectorsResponseExample2:
summary: Per-field analyzer
description: A successful response from `GET /my-index-000001/_termvectors` with `per_field_analyzer` in the request body.
value: "{\n \"_index\": \"my-index-000001\",\n \"_version\": 0,\n \"found\": true,\n \"took\": 6,\n \"term_vectors\": {\n \"fullname\": {\n \"field_statistics\": {\n \"sum_doc_freq\": 2,\n \"doc_count\": 4,\n \"sum_ttf\": 4\n },\n \"terms\": {\n \"John Doe\": {\n \"term_freq\": 1,\n \"tokens\": [\n {\n \"position\": 0,\n \"start_offset\": 0,\n \"end_offset\": 8\n }\n ]\n }\n }\n }\n }\n}"
TermVectorsResponseExample3:
summary: Terms filtering
description: A successful response from `GET /my-index-000001/_termvectors` with a `filter` in the request body.
value: "{\n \"_index\": \"imdb\",\n \"_version\": 0,\n \"found\": true,\n \"term_vectors\": {\n \"plot\": {\n \"field_statistics\": {\n \"sum_doc_freq\": 3384269,\n \"doc_count\": 176214,\n \"sum_ttf\": 3753460\n },\n \"terms\": {\n \"armored\": {\n \"doc_freq\": 27,\n \"ttf\": 27,\n \"term_freq\": 1,\n \"score\": 9.74725\n },\n \"industrialist\": {\n \"doc_freq\": 88,\n \"ttf\": 88,\n \"term_freq\": 1,\n \"score\": 8.590818\n },\n \"stark\": {\n \"doc_freq\": 44,\n \"ttf\": 47,\n \"term_freq\": 1,\n \"score\": 9.272792\n }\n }\n }\n }\n}"
x-state: Generally available
x-variations:
- "\n GET\n /{index}/_termvectors/{id}\n
\n "
- "\n POST\n /{index}/_termvectors/{id}\n
\n "
x-req-auth:
- 'Index privileges: `read`
'
x-api: termvectors
x-category: document management
x-codeSamples:
- lang: Console
source: "GET /my-index-000001/_termvectors/1\n{\n \"fields\" : [\"text\"],\n \"offsets\" : true,\n \"payloads\" : true,\n \"positions\" : true,\n \"term_statistics\" : true,\n \"field_statistics\" : true\n}"
- lang: Python
source: "resp = client.termvectors(\n index=\"my-index-000001\",\n id=\"1\",\n fields=[\n \"text\"\n ],\n offsets=True,\n payloads=True,\n positions=True,\n term_statistics=True,\n field_statistics=True,\n)"
- lang: JavaScript
source: "const response = await client.termvectors({\n index: \"my-index-000001\",\n id: 1,\n fields: [\"text\"],\n offsets: true,\n payloads: true,\n positions: true,\n term_statistics: true,\n field_statistics: true,\n});"
- lang: Ruby
source: "response = client.termvectors(\n index: \"my-index-000001\",\n id: \"1\",\n body: {\n \"fields\": [\n \"text\"\n ],\n \"offsets\": true,\n \"payloads\": true,\n \"positions\": true,\n \"term_statistics\": true,\n \"field_statistics\": true\n }\n)"
- lang: PHP
source: "$resp = $client->termvectors([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"body\" => [\n \"fields\" => array(\n \"text\",\n ),\n \"offsets\" => true,\n \"payloads\" => true,\n \"positions\" => true,\n \"term_statistics\" => true,\n \"field_statistics\" => true,\n ],\n]);"
- lang: curl
source: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"fields":["text"],"offsets":true,"payloads":true,"positions":true,"term_statistics":true,"field_statistics":true}'' "$ELASTICSEARCH_URL/my-index-000001/_termvectors/1"'
- lang: Java
source: "client.termvectors(t -> t\n .fieldStatistics(true)\n .fields(\"text\")\n .id(\"1\")\n .index(\"my-index-000001\")\n .offsets(true)\n .payloads(true)\n .positions(true)\n .termStatistics(true)\n);\n"
x-metaTags:
- content: Elasticsearch
name: product_name
/{index}/_termvectors:
get:
tags:
- Document
summary: Get term vector information
description: 'Get information and statistics about terms in the fields of a particular document.
You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request.
You can specify the fields you are interested in through the `fields` parameter or by adding the fields to the request body.
For example:
```
GET /my-index-000001/_termvectors/1?fields=message
```
Fields can be specified using wildcards, similar to the multi match query.
Term vectors are real-time by default, not near real-time.
This can be changed by setting `realtime` parameter to `false`.
You can request three types of values: _term information_, _term statistics_, and _field statistics_.
By default, all term information and field statistics are returned for all fields but term statistics are excluded.
**Term information**
* term frequency in the field (always returned)
* term positions (`positions: true`)
* start and end offsets (`offsets: true`)
* term payloads (`payloads: true`), as base64 encoded bytes
If the requested information wasn''t stored in the index, it will be computed on the fly if possible.
Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user.
> warn
> Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16.
**Behaviour**
The term and field statistics are not accurate.
Deleted documents are not taken into account.
The information is only retrieved for the shard the requested document resides in.
The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context.
By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected.
Use `routing` only to hit a particular shard.
Refer to the linked documentation for detailed examples of how to use this API.'
externalDocs:
url: https://www.elastic.co/docs/reference/elasticsearch/rest-apis/term-vectors-examples
x-previousVersionUrl: https://www.elastic.co/guide/en/elasticsearch/reference/8.19/docs-termvectors.html
operationId: termvectors-2
parameters:
- in: path
name: index
description: The name of the index that contains the document.
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.IndexName'
style: simple
- in: query
name: fields
description: 'A comma-separated list or wildcard expressions of fields to include in the statistics.
It is used as the default list unless a specific field list is provided in the `completion_fields` or `fielddata_fields` parameters.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: field_statistics
description: 'If `true`, the response includes:
* The document count (how many documents contain this field).
* The sum of document frequencies (the sum of document frequencies for all terms in this field).
* The sum of total term frequencies (the sum of total term frequencies of each term in this field).'
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.
It 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 that is 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:
* The total term frequency (how often a term occurs in all documents).
* The document frequency (the number of documents containing the current term).
By default these values are not returned since term statistics can have a serious performance impact.'
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:
doc:
description: An artificial document (a document not present in the index) for which you want to retrieve term vectors.
type: object
filter:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-mlt-query
description: 'Filter terms based on their tf-idf scores.
This could be useful in order find out a good characteristic vector of a document.
This feature works in a similar manner to the second phase of the More Like This Query.'
allOf:
- $ref: '#/components/schemas/_global.termvectors.Filter'
per_field_analyzer:
description: 'Override the default per-field analyzer.
This is useful in order to generate term vectors in any fashion, especially when using artificial documents.
When providing an analyzer for a field that already stores term vectors, the term vectors will be regenerated.'
type: object
additionalProperties:
type: string
fields:
description: 'A list of fields to include in the statistics.
It is used as the default list unless a specific field list is provided in the `completion_fields` or `fielddata_fields` parameters.'
type: array
items:
$ref: '#/components/schemas/_types.Field'
field_statistics:
description: 'If `true`, the response includes:
* The document count (how many documents contain this field).
* The sum of document frequencies (the sum of document frequencies for all terms in this field).
* The sum of total term frequencies (the sum of total term frequencies of each term in this field).'
default: true
type: boolean
offsets:
description: If `true`, the response includes term offsets.
default: true
type: boolean
payloads:
description: If `true`, the response includes term payloads.
default: true
type: boolean
positions:
description: If `true`, the response includes term positions.
default: true
type: boolean
term_statistics:
description: 'If `true`, the response includes:
* The total term frequency (how often a term occurs in all documents).
* The document frequency (the number of documents containing the current term).
By default these values are not returned since term statistics can have a serious performance impact.'
default: false
type: boolean
routing:
description: A custom value that is used to route operations to a specific shard.
allOf:
- $ref: '#/components/schemas/_types.Routing'
version:
description: If `true`, returns the document version as part of a hit.
allOf:
- $ref: '#/components/schemas/_types.VersionNumber'
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"
allOf:
- $ref: '#/components/schemas/_types.VersionType'
examples:
TermVectorsRequestExample1:
summary: Return stored term vectors
description: 'Run `GET /my-index-000001/_termvectors/1` to return all information and statistics for field `text` in document 1.
'
value: "{\n \"fields\" : [\"text\"],\n \"offsets\" : true,\n \"payloads\" : true,\n \"positions\" : true,\n \"term_statistics\" : true,\n \"field_statistics\" : true\n}"
TermVectorsRequestExample2:
summary: Per-field analyzer
description: 'Run `GET /my-index-000001/_termvectors/1` to set per-field analyzers. A different analyzer than the one at the field may be provided by using the `per_field_analyzer` parameter.
'
value: "{\n \"doc\" : {\n \"fullname\" : \"John Doe\",\n \"text\" : \"test test test\"\n },\n \"fields\": [\"fullname\"],\n \"per_field_analyzer\" : {\n \"fullname\": \"keyword\"\n }\n}"
TermVectorsRequestExample3:
summary: Terms filtering
description: 'Run `GET /imdb/_termvectors` to filter the terms returned based on their tf-idf scores. It returns the three most "interesting" keywords from the artificial document having the given "plot" field value. Notice that the keyword "Tony" or any stop words are not part of the response, as their tf-idf must be too low.
'
value: "{\n \"doc\": {\n \"plot\": \"When wealthy industrialist Tony Stark is forced to build an armored suit after a life-threatening incident, he ultimately decides to use its technology to fight against evil.\"\n },\n \"term_statistics\": true,\n \"field_statistics\": true,\n \"positions\": false,\n \"offsets\": false,\n \"filter\": {\n \"max_num_terms\": 3,\n \"min_term_freq\": 1,\n \"min_doc_freq\": 1\n }\n}"
TermVectorsRequestExample4:
summary: Generate term vectors on the fly
description: 'Run `GET /my-index-000001/_termvectors/1`. Term vectors which are not explicitly stored in the index are automatically computed on the fly. This request returns all information and statistics for the fields in document 1, even though the terms haven''t been explicitly stored in the index. Note that for the field text, the terms are not regenerated.
'
value: "{\n \"fields\" : [\"text\", \"some_field_without_term_vectors\"],\n \"offsets\" : true,\n \"positions\" : true,\n \"term_statistics\" : true,\n \"field_statistics\" : true\n}"
TermVectorsRequestExample5:
summary: Artificial documents
description: 'Run `GET /my-index-000001/_termvectors`. Term vectors can be generated for artificial documents, that is for documents not present in the index. If dynamic mapping is turned on (default), the document fields not in the original mapping will be dynamically created.
'
value: "{\n \"doc\" : {\n \"fullname\" : \"John Doe\",\n \"text\" : \"test test test\"\n }\n}"
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
properties:
found:
type: boolean
_id:
allOf:
- $ref: '#/components/schemas/_types.Id'
_index:
allOf:
- $ref: '#/components/schemas/_types.IndexName'
term_vectors:
type: object
additionalProperties:
$ref: '#/components/schemas/_global.termvectors.TermVector'
took:
type: number
_version:
allOf:
- $ref: '#/components/schemas/_types.VersionNumber'
required:
- found
- _index
- took
- _version
examples:
TermVectorsResponseExample1:
summary: Return stored term vectors
description: A successful response from `GET /my-index-000001/_termvectors/1`.
value: "{\n \"_index\": \"my-index-000001\",\n \"_id\": \"1\",\n \"_version\": 1,\n \"found\": true,\n \"took\": 6,\n \"term_vectors\": {\n \"text\": {\n \"field_statistics\": {\n \"sum_doc_freq\": 4,\n \"doc_count\": 2,\n \"sum_ttf\": 6\n },\n \"terms\": {\n \"test\": {\n \"doc_freq\": 2,\n \"ttf\": 4,\n \"term_freq\": 3,\n \"tokens\": [\n {\n \"position\": 0,\n \"start_offset\": 0,\n \"end_offset\": 4,\n \"payload\": \"d29yZA==\"\n },\n {\n \"position\": 1,\n \"start_offset\": 5,\n \"end_offset\": 9,\n \"payload\": \"d29yZA==\"\n },\n {\n \"position\": 2,\n \"start_offset\": 10,\n \"end_offset\": 14,\n \"payload\": \"d29yZA==\"\n }\n ]\n }\n }\n }\n }\n}"
TermVectorsResponseExample2:
summary: Per-field analyzer
description: A successful response from `GET /my-index-000001/_termvectors` with `per_field_analyzer` in the request body.
value: "{\n \"_index\": \"my-index-000001\",\n \"_version\": 0,\n \"found\": true,\n \"took\": 6,\n \"term_vectors\": {\n \"fullname\": {\n \"field_statistics\": {\n \"sum_doc_freq\": 2,\n \"doc_count\": 4,\n \"sum_ttf\": 4\n },\n \"terms\": {\n \"John Doe\": {\n \"term_freq\": 1,\n \"tokens\": [\n {\n \"position\": 0,\n \"start_offset\": 0,\n \"end_offset\": 8\n }\n ]\n }\n }\n }\n }\n}"
TermVectorsResponseExample3:
summary: Terms filtering
description: A successful response from `GET /my-index-000001/_termvectors` with a `filter` in the request body.
value: "{\n \"_index\": \"imdb\",\n \"_version\": 0,\n \"found\": true,\n \"term_vectors\": {\n \"plot\": {\n \"field_statistics\": {\n \"sum_doc_freq\": 3384269,\n \"doc_count\": 176214,\n \"sum_ttf\": 3753460\n },\n \"terms\": {\n \"armored\": {\n \"doc_freq\": 27,\n \"ttf\": 27,\n \"term_freq\": 1,\n \"score\": 9.74725\n },\n \"industrialist\": {\n \"doc_freq\": 88,\n \"ttf\": 88,\n \"term_freq\": 1,\n \"score\": 8.590818\n },\n \"stark\": {\n \"doc_freq\": 44,\n \"ttf\": 47,\n \"term_freq\": 1,\n \"score\": 9.272792\n }\n }\n }\n }\n}"
x-state: Generally available
x-variations:
- "\n GET\n /{index}/_termvectors\n
\n "
- "\n POST\n /{index}/_termvectors\n
\n "
x-req-auth:
- 'Index privileges: `read`
'
x-api: termvectors
x-category: document management
x-codeSamples:
- lang: Console
source: "GET /my-index-000001/_termvectors/1\n{\n \"fields\" : [\"text\"],\n \"offsets\" : true,\n \"payloads\" : true,\n \"positions\" : true,\n \"term_statistics\" : true,\n \"field_statistics\" : true\n}"
- lang: Python
source: "resp = client.termvectors(\n index=\"my-index-000001\",\n id=\"1\",\n fields=[\n \"text\"\n ],\n offsets=True,\n payloads=True,\n positions=True,\n term_statistics=True,\n field_statistics=True,\n)"
- lang: JavaScript
source: "const response = await client.termvectors({\n index: \"my-index-000001\",\n id: 1,\n fields: [\"text\"],\n offsets: true,\n payloads: true,\n positions: true,\n term_statistics: true,\n field_statistics: true,\n});"
- lang: Ruby
source: "response = client.termvectors(\n index: \"my-index-000001\",\n id: \"1\",\n body: {\n \"fields\": [\n \"text\"\n ],\n \"offsets\": true,\n \"payloads\": true,\n \"positions\": true,\n \"term_statistics\": true,\n \"field_statistics\": true\n }\n)"
- lang: PHP
source: "$resp = $client->termvectors([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"body\" => [\n \"fields\" => array(\n \"text\",\n ),\n \"offsets\" => true,\n \"payloads\" => true,\n \"positions\" => true,\n \"term_statistics\" => true,\n \"field_statistics\" => true,\n ],\n]);"
- lang: curl
source: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"fields":["text"],"offsets":true,"payloads":true,"positions":true,"term_statistics":true,"field_statistics":true}'' "$ELASTICSEARCH_URL/my-index-000001/_termvectors/1"'
- lang: Java
source: "client.termvectors(t -> t\n .fieldStatistics(true)\n .fields(\"text\")\n .id(\"1\")\n .index(\"my-index-000001\")\n .offsets(true)\n .payloads(true)\n .positions(true)\n .termStatistics(true)\n);\n"
x-metaTags:
- content: Elasticsearch
name: product_name
post:
tags:
- Document
summary: Get term vector information
description: 'Get information and statistics about terms in the fields of a particular document.
You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request.
You can specify the fields you are interested in through the `fields` parameter or by adding the fields to the request body.
For example:
```
GET /my-index-000001/_termvectors/1?fields=message
```
Fields can be specified using wildcards, similar to the multi match query.
Term vectors are real-time by default, not near real-time.
This can be changed by setting `realtime` parameter to `false`.
You can request three types of values: _term information_, _term statistics_, and _field statistics_.
By default, all term information and field statistics are returned for all fields but term statistics are excluded.
**Term information**
* term frequency in the field (always returned)
* term positions (`positions: true`)
* start and end offsets (`offsets: true`)
* term payloads (`payloads: true`), as base64 encoded bytes
If the requested information wasn''t stored in the index, it will be computed on the fly if possible.
Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user.
> warn
> Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16.
**Behaviour**
The term and field statistics are not accurate.
Deleted documents are not taken into account.
The information is only retrieved for the shard the requested document resides in.
The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context.
By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected.
Use `routing` only to hit a particular shard.
Refer to the linked documentation for detailed examples of how to use this API.'
externalDocs:
url: https://www.elastic.co/docs/reference/elasticsearch/rest-apis/term-vectors-examples
x-previousVersionUrl: https://www.elastic.co/guide/en/elasticsearch/reference/8.19/docs-termvectors.html
operationId: termvectors-3
parameters:
- in: path
name: index
description: The name of the index that contains the document.
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.IndexName'
style: simple
- in: query
name: fields
description: 'A comma-separated list or wildcard expressions of fields to include in the statistics.
It is used as the default list unless a specific field list is provided in the `completion_fields` or `fielddata_fields` parameters.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: field_statistics
description: 'If `true`, the response includes:
* The document count (how many documents contain this field).
* The sum of document frequencies (the sum of document frequencies for all terms in this field).
* The sum of total term frequencies (the sum of total term frequencies of each term in this field).'
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.
It 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 that is 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:
* The total term frequency (how often a term occurs in all documents).
* The document frequency (the number of documents containing the current term).
By default these values are not returned since term statistics can have a serious performance impact.'
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:
doc:
description: An artificial document (a document not present in the index) for which you want to retrieve term vectors.
type: object
filter:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-mlt-query
description: 'Filter terms based on their tf-idf scores.
This could be useful in order find out a good characteristic vector of a document.
This feature works in a similar manner to the second phase of the More Like This Query.'
allOf:
- $ref: '#/components/schemas/_global.termvectors.Filter'
per_field_analyzer:
description: 'Override the default per-field analyzer.
This is useful in order to generate term vectors in any fashion, especially when using artificial documents.
When providing an analyzer for a field that already stores term vectors, the term vectors will be regenerated.'
type: object
additionalProperties:
type: string
fields:
description: 'A list of fields to include in the statistics.
It is used as the default list unless a specific field list is provided in the `completion_fields` or `fielddata_fields` parameters.'
type: array
items:
$ref: '#/components/schemas/_types.Field'
field_statistics:
description: 'If `true`, the response includes:
* The document count (how many documents contain this field).
* The sum of document frequencies (the sum of document frequencies for all terms in this field).
* The sum of total term frequencies (the sum of total term frequencies of each term in this field).'
default: true
type: boolean
offsets:
description: If `true`, the response includes term offsets.
default: true
type: boolean
payloads:
description: If `true`, the response includes term payloads.
default: true
type: boolean
positions:
description: If `true`, the response includes term positions.
default: true
type: boolean
term_statistics:
description: 'If `true`, the response includes:
* The total term frequency (how often a term occurs in all documents).
* The document frequency (the number of documents containing the current term).
By default these values are not returned since term statistics can have a serious performance impact.'
default: false
type: boolean
routing:
description: A custom value that is used to route operations to a specific shard.
allOf:
- $ref: '#/components/schemas/_types.Routing'
version:
description: If `true`, returns the document version as part of a hit.
allOf:
- $ref: '#/components/schemas/_types.VersionNumber'
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"
allOf:
- $ref: '#/components/schemas/_types.VersionType'
examples:
TermVectorsRequestExample1:
summary: Return stored term vectors
description: 'Run `GET /my-index-000001/_termvectors/1` to return all information and statistics for field `text` in document 1.
'
value: "{\n \"fields\" : [\"text\"],\n \"offsets\" : true,\n \"payloads\" : true,\n \"positions\" : true,\n \"term_statistics\" : true,\n \"field_statistics\" : true\n}"
TermVectorsRequestExample2:
summary: Per-field analyzer
description: 'Run `GET /my-index-000001/_termvectors/1` to set per-field analyzers. A different analyzer than the one at the field may be provided by using the `per_field_analyzer` parameter.
'
value: "{\n \"doc\" : {\n \"fullname\" : \"John Doe\",\n \"text\" : \"test test test\"\n },\n \"fields\": [\"fullname\"],\n \"per_field_analyzer\" : {\n \"fullname\": \"keyword\"\n }\n}"
TermVectorsRequestExample3:
summary: Terms filtering
description: 'Run `GET /imdb/_termvectors` to filter the terms returned based on their tf-idf scores. It returns the three most "interesting" keywords from the artificial document having the given "plot" field value. Notice that the keyword "Tony" or any stop words are not part of the response, as their tf-idf must be too low.
'
value: "{\n \"doc\": {\n \"plot\": \"When wealthy industrialist Tony Stark is forced to build an armored suit after a life-threatening incident, he ultimately decides to use its technology to fight against evil.\"\n },\n \"term_statistics\": true,\n \"field_statistics\": true,\n \"positions\": false,\n \"offsets\": false,\n \"filter\": {\n \"max_num_terms\": 3,\n \"min_term_freq\": 1,\n \"min_doc_freq\": 1\n }\n}"
TermVectorsRequestExample4:
summary: Generate term vectors on the fly
description: 'Run `GET /my-index-000001/_termvectors/1`. Term vectors which are not explicitly stored in the index are automatically computed on the fly. This request returns all information and statistics for the fields in document 1, even though the terms haven''t been explicitly stored in the index. Note that for the field text, the terms are not regenerated.
'
value: "{\n \"fields\" : [\"text\", \"some_field_without_term_vectors\"],\n \"offsets\" : true,\n \"positions\" : true,\n \"term_statistics\" : true,\n \"field_statistics\" : true\n}"
TermVectorsRequestExample5:
summary: Artificial documents
description: 'Run `GET /my-index-000001/_termvectors`. Term vectors can be generated for artificial documents, that is for documents not present in the index. If dynamic mapping is turned on (default), the document fields not in the original mapping will be dynamically created.
'
value: "{\n \"doc\" : {\n \"fullname\" : \"John Doe\",\n \"text\" : \"test test test\"\n }\n}"
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
properties:
found:
type: boolean
_id:
allOf:
- $ref: '#/components/schemas/_types.Id'
_index:
allOf:
- $ref: '#/components/schemas/_types.IndexName'
term_vectors:
type: object
additionalProperties:
$ref: '#/components/schemas/_global.termvectors.TermVector'
took:
type: number
_version:
allOf:
- $ref: '#/components/schemas/_types.VersionNumber'
required:
- found
- _index
- took
- _version
examples:
TermVectorsResponseExample1:
summary: Return stored term vectors
description: A successful response from `GET /my-index-000001/_termvectors/1`.
value: "{\n \"_index\": \"my-index-000001\",\n \"_id\": \"1\",\n \"_version\": 1,\n \"found\": true,\n \"took\": 6,\n \"term_vectors\": {\n \"text\": {\n \"field_statistics\": {\n \"sum_doc_freq\": 4,\n \"doc_count\": 2,\n \"sum_ttf\": 6\n },\n \"terms\": {\n \"test\": {\n \"doc_freq\": 2,\n \"ttf\": 4,\n \"term_freq\": 3,\n \"tokens\": [\n {\n \"position\": 0,\n \"start_offset\": 0,\n \"end_offset\": 4,\n \"payload\": \"d29yZA==\"\n },\n {\n \"position\": 1,\n \"start_offset\": 5,\n \"end_offset\": 9,\n \"payload\": \"d29yZA==\"\n },\n {\n \"position\": 2,\n \"start_offset\": 10,\n \"end_offset\": 14,\n \"payload\": \"d29yZA==\"\n }\n ]\n }\n }\n }\n }\n}"
TermVectorsResponseExample2:
summary: Per-field analyzer
description: A successful response from `GET /my-index-000001/_termvectors` with `per_field_analyzer` in the request body.
value: "{\n \"_index\": \"my-index-000001\",\n \"_version\": 0,\n \"found\": true,\n \"took\": 6,\n \"term_vectors\": {\n \"fullname\": {\n \"field_statistics\": {\n \"sum_doc_freq\": 2,\n \"doc_count\": 4,\n \"sum_ttf\": 4\n },\n \"terms\": {\n \"John Doe\": {\n \"term_freq\": 1,\n \"tokens\": [\n {\n \"position\": 0,\n \"start_offset\": 0,\n \"end_offset\": 8\n }\n ]\n }\n }\n }\n }\n}"
TermVectorsResponseExample3:
summary: Terms filtering
description: A successful response from `GET /my-index-000001/_termvectors` with a `filter` in the request body.
value: "{\n \"_index\": \"imdb\",\n \"_version\": 0,\n \"found\": true,\n \"term_vectors\": {\n \"plot\": {\n \"field_statistics\": {\n \"sum_doc_freq\": 3384269,\n \"doc_count\": 176214,\n \"sum_ttf\": 3753460\n },\n \"terms\": {\n \"armored\": {\n \"doc_freq\": 27,\n \"ttf\": 27,\n \"term_freq\": 1,\n \"score\": 9.74725\n },\n \"industrialist\": {\n \"doc_freq\": 88,\n \"ttf\": 88,\n \"term_freq\": 1,\n \"score\": 8.590818\n },\n \"stark\": {\n \"doc_freq\": 44,\n \"ttf\": 47,\n \"term_freq\": 1,\n \"score\": 9.272792\n }\n }\n }\n }\n}"
x-state: Generally available
x-variations:
- "\n GET\n /{index}/_termvectors\n
\n "
- "\n POST\n /{index}/_termvectors\n
\n "
x-req-auth:
- 'Index privileges: `read`
'
x-api: termvectors
x-category: document management
x-codeSamples:
- lang: Console
source: "GET /my-index-000001/_termvectors/1\n{\n \"fields\" : [\"text\"],\n \"offsets\" : true,\n \"payloads\" : true,\n \"positions\" : true,\n \"term_statistics\" : true,\n \"field_statistics\" : true\n}"
- lang: Python
source: "resp = client.termvectors(\n index=\"my-index-000001\",\n id=\"1\",\n fields=[\n \"text\"\n ],\n offsets=True,\n payloads=True,\n positions=True,\n term_statistics=True,\n field_statistics=True,\n)"
- lang: JavaScript
source: "const response = await client.termvectors({\n index: \"my-index-000001\",\n id: 1,\n fields: [\"text\"],\n offsets: true,\n payloads: true,\n positions: true,\n term_statistics: true,\n field_statistics: true,\n});"
- lang: Ruby
source: "response = client.termvectors(\n index: \"my-index-000001\",\n id: \"1\",\n body: {\n \"fields\": [\n \"text\"\n ],\n \"offsets\": true,\n \"payloads\": true,\n \"positions\": true,\n \"term_statistics\": true,\n \"field_statistics\": true\n }\n)"
- lang: PHP
source: "$resp = $client->termvectors([\n \"index\" => \"my-index-000001\",\n \"id\" => \"1\",\n \"body\" => [\n \"fields\" => array(\n \"text\",\n ),\n \"offsets\" => true,\n \"payloads\" => true,\n \"positions\" => true,\n \"term_statistics\" => true,\n \"field_statistics\" => true,\n ],\n]);"
- lang: curl
source: 'curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"fields":["text"],"offsets":true,"payloads":true,"positions":true,"term_statistics":true,"field_statistics":true}'' "$ELASTICSEARCH_URL/my-index-000001/_termvectors/1"'
- lang: Java
source: "client.termvectors(t -> t\n .fieldStatistics(true)\n .fields(\"text\")\n .id(\"1\")\n .index(\"my-index-000001\")\n .offsets(true)\n .payloads(true)\n .positions(true)\n .termStatistics(true)\n);\n"
x-metaTags:
- content: Elasticsearch
name: product_name
/{index}/_update/{id}:
post:
tags:
- Document
summary: Update a document
description: 'Update a document by running a script or passing a partial document.
If the Elasticsearch security features are enabled, you must have the `index` or `write` index privilege for the target index or index alias.
The script can update, delete, or skip modifying the document.
The API also supports passing a partial document, which is merged into the existing document.
To fully replace an existing document, use the index API.
This operation:
* Gets the document (collocated with the shard) from the index.
* Runs the specified script.
* Indexes the result.
The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation.
The `_source` field must be enabled to use this API.
In addition to `_source`, you can access the following variables through the `ctx` map: `_index`, `_type`, `_id`, `_version`, `_routing`, and `_now` (the current timestamp).
For usage examples such as partial updates, upserts, and scripted updates, see the External documentation.'
externalDocs:
url: https://www.elastic.co/docs/reference/elasticsearch/rest-apis/update-document
x-previousVersionUrl: https://www.elastic.co/guide/en/elasticsearch/reference/8.19/docs-update.html
operationId: update
parameters:
- in: path
name: index
description: 'The name of the target index.
By default, the index is created automatically if it doesn''t exist.'
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.IndexName'
style: simple
- in: path
name: id
description: A unique identifier for the document to be updated.
required: true
deprecated: false
schema:
$ref: '#/components/schemas/_types.Id'
style: simple
- in: query
name: if_primary_term
description: Only perform the operation if the document has this primary term.
deprecated: false
schema:
type: number
style: form
- in: query
name: if_seq_no
description: Only perform the operation if the document has this sequence number.
deprecated: false
schema:
$ref: '#/components/schemas/_types.SequenceNumber'
style: form
- in: query
name: include_source_on_error
description: True or false if to include the document source in the error message in case of parsing errors.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: lang
description: The script language.
deprecated: false
schema:
type: string
style: form
- in: query
name: refresh
description: 'If ''true'', Elasticsearch refreshes the affected shards to make this operation visible to search.
If ''wait_for'', it waits for a refresh to make this operation visible to search.
If ''false'', it does nothing with refreshes.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Refresh'
style: form
- in: query
name: require_alias
description: If `true`, the destination must be an index alias.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: retry_on_conflict
description: The number of times the operation should be retried when a conflict occurs.
deprecated: false
schema:
type: number
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: timeout
description: 'The period to wait for the following operations: dynamic mapping updates and waiting for active shards.
Elasticsearch waits for at least the timeout period before failing.
The actual wait time could be longer, particularly when multiple waits occur.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Duration'
style: form
- in: query
name: wait_for_active_shards
description: 'The number of copies of each shard that must be active before proceeding with the operation.
Set to ''all'' or any positive integer up to the total number of shards in the index (`number_of_replicas`+1).
The default value of `1` means it waits for each primary shard to be active.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.WaitForActiveShards'
style: form
- in: query
name: _source
description: 'If `false`, source retrieval is turned off.
You can also specify a comma-separated list of the fields you want to retrieve.'
deprecated: false
schema:
$ref: '#/components/schemas/_global.search._types.SourceConfigParam'
style: form
- in: query
name: _source_excludes
description: The source fields you want to exclude.
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
- in: query
name: _source_includes
description: The source fields you want to retrieve.
deprecated: false
schema:
$ref: '#/components/schemas/_types.Fields'
style: form
requestBody:
content:
application/json:
schema:
type: object
properties:
detect_noop:
description: If `true`, the `result` in the response is set to `noop` (no operation) when there are no changes to the document.
default: true
type: boolean
doc:
description: 'A partial update to an existing document.
If both `doc` and `script` are specified, `doc` is ignored.'
type: object
doc_as_upsert:
description: 'If `true`, use the contents of ''doc'' as the value of ''upsert''.
NOTE: Using ingest pipelines with `doc_as_upsert` is not supported.'
default: false
type: boolean
script:
description: The script to run to update the document.
allOf:
- $ref: '#/components/schemas/_types.Script'
scripted_upsert:
description: If `true`, run the script whether or not the document exists.
default: false
type: boolean
_source:
description: 'If `false`, turn off source retrieval.
You can also specify a comma-separated list of the fields you want to retrieve.'
default: 'true'
allOf:
- $ref: '#/components/schemas/_global.search._types.SourceConfig'
upsert:
description: 'If the document does not already exist, the contents of ''upsert'' are inserted as a new document.
If the document exists, the ''script'' is run.'
type: object
examples:
UpdateRequestExample1:
summary: Update a counter with a script
description: Run `POST test/_update/1` to increment a counter by using a script.
value: "{\n \"script\" : {\n \"source\": \"ctx._source.counter += params.count\",\n \"lang\": \"painless\",\n \"params\" : {\n \"count\" : 4\n }\n }\n}"
UpdateRequestExample10:
summary: Scripted upsert
description: 'Run `POST test/_update/1` to perform a scripted upsert. When `scripted_upsert` is `true`, the script runs whether or not the document exists.
'
value: "{\n \"scripted_upsert\": true,\n \"script\": {\n \"source\": \"\"\"\n if ( ctx.op == 'create' ) {\n ctx._source.counter = params.count\n } else {\n ctx._source.counter += params.count\n }\n \"\"\",\n \"params\": {\n \"count\": 4\n }\n },\n \"upsert\": {}\n}"
UpdateRequestExample11:
summary: Doc as upsert
description: 'Run `POST test/_update/1` to perform a doc as upsert. Instead of sending a partial `doc` plus an `upsert` doc, you can set `doc_as_upsert` to `true` to use the contents of `doc` as the `upsert` value.
'
value: "{\n \"doc\": {\n \"name\": \"new_name\"\n },\n \"doc_as_upsert\": true\n}"
UpdateRequestExample2:
summary: Add a tag with a script
description: 'Run `POST test/_update/1` to use a script to add a tag to a list of tags. In this example, it is just a list, so the tag is added even it exists.
'
value: "{\n \"script\": {\n \"source\": \"ctx._source.tags.add(params.tag)\",\n \"lang\": \"painless\",\n \"params\": {\n \"tag\": \"blue\"\n }\n }\n}"
UpdateRequestExample3:
summary: Remove a tag with a script
description: 'Run `POST test/_update/1` to use a script to remove a tag from a list of tags. The Painless function to remove a tag takes the array index of the element you want to remove. To avoid a possible runtime error, you first need to make sure the tag exists. If the list contains duplicates of the tag, this script just removes one occurrence.
'
value: "{\n \"script\": {\n \"source\": \"if (ctx._source.tags.contains(params.tag)) { ctx._source.tags.remove(ctx._source.tags.indexOf(params.tag)) }\",\n \"lang\": \"painless\",\n \"params\": {\n \"tag\": \"blue\"\n }\n }\n}"
UpdateRequestExample4:
summary: Add fields with a script
description: 'Run `POST test/_update/1` to use a script to add a field `new_field` to the document.
'
value: "{\n \"script\" : \"ctx._source.new_field = 'value_of_new_field'\"\n}"
UpdateRequestExample5:
summary: Remove fields with a script
description: 'Run `POST test/_update/1` to use a script to remove a field `new_field` from the document.
'
value: "{\n \"script\" : \"ctx._source.remove('new_field')\"\n}"
UpdateRequestExample6:
summary: Remove subfields with a script
description: 'Run `POST test/_update/1` to use a script to remove a subfield from an object field.
'
value: "{\n \"script\": \"ctx._source['my-object'].remove('my-subfield')\"\n}"
UpdateRequestExample7:
summary: Change the operation with a script
description: 'Run `POST test/_update/1` to change the operation that runs from within the script. For example, this request deletes the document if the `tags` field contains `green`, otherwise it does nothing (`noop`).
'
value: "{\n \"script\": {\n \"source\": \"if (ctx._source.tags.contains(params.tag)) { ctx.op = 'delete' } else { ctx.op = 'noop' }\",\n \"lang\": \"painless\",\n \"params\": {\n \"tag\": \"green\"\n }\n }\n}"
UpdateRequestExample8:
summary: Update part of a document
description: 'Run `POST test/_update/1` to do a partial update that adds a new field to the existing document.
'
value: "{\n \"doc\": {\n \"name\": \"new_name\"\n }\n}"
UpdateRequestExample9:
summary: Upsert
description: 'Run `POST test/_update/1` to perfom an upsert. If the document does not already exist, the contents of the upsert element are inserted as a new document. If the document exists, the script is run.
'
value: "{\n \"script\": {\n \"source\": \"ctx._source.counter += params.count\",\n \"lang\": \"painless\",\n \"params\": {\n \"count\": 4\n }\n },\n \"upsert\": {\n \"counter\": 1\n }\n}"
required: true
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/_global.update.UpdateWriteResponseBase'
examples:
UpdateResponseExample1:
summary: Detect noop updates
description: 'By default updates that don''t change anything detect that they don''t change anything and return `"result": "noop"`.
'
value: "{\n \"_shards\": {\n \"total\": 0,\n \"successful\": 0,\n \"failed\": 0\n },\n \"_index\": \"test\",\n \"_id\": \"1\",\n \"_version\": 2,\n \"_primary_term\": 1,\n \"_seq_no\": 1,\n \"result\": \"noop\"\n}"
x-state: Generally available
x-variations:
- "\n POST\n /{index}/_update/{id}\n
\n "
x-req-auth:
- 'Index privileges: `write`
'
x-api: update
x-category: document management
x-codeSamples:
- lang: Console
source: "POST test/_update/1\n{\n \"script\" : {\n \"source\": \"ctx._source.counter += params.count\",\n \"lang\": \"painless\",\n \"params\" : {\n \"count\" : 4\n }\n }\n}"
- lang: Python
source: "resp = client.update(\n index=\"test\",\n id=\"1\",\n script={\n \"source\": \"ctx._source.counter += params.count\",\n \"lang\": \"painless\",\n \"params\": {\n \"count\": 4\n }\n },\n)"
- lang: JavaScript
source: "const response = await client.update({\n index: \"test\",\n id: 1,\n script: {\n source: \"ctx._source.counter += params.count\",\n lang: \"painless\",\n params: {\n count: 4,\n },\n },\n});"
- lang: Ruby
source: "response = client.update(\n index: \"test\",\n id: \"1\",\n body: {\n \"script\": {\n \"source\": \"ctx._source.counter += params.count\",\n \"lang\": \"painless\",\n \"params\": {\n \"count\": 4\n }\n }\n }\n)"
- lang: PHP
source: "$resp = $client->update([\n \"index\" => \"test\",\n \"id\" => \"1\",\n \"body\" => [\n \"script\" => [\n \"source\" => \"ctx._source.counter += params.count\",\n \"lang\" => \"painless\",\n \"params\" => [\n \"count\" => 4,\n ],\n ],\n ],\n]);"
- lang: curl
source: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"script":{"source":"ctx._source.counter += params.count","lang":"painless","params":{"count":4}}}'' "$ELASTICSEARCH_URL/test/_update/1"'
- lang: Java
source: "client.update(u -> u\n .id(\"1\")\n .index(\"test\")\n .script(s -> s\n .source(so -> so\n .scriptString(\"ctx._source.counter += params.count\")\n )\n .params(\"count\", JsonData.fromJson(\"4\"))\n .lang(\"painless\")\n )\n,Void.class);\n"
x-metaTags:
- content: Elasticsearch
name: product_name
/{index}/_update_by_query:
post:
tags:
- Document
summary: Update documents
description: Updates documents that match the specified query.
externalDocs:
url: https://www.elastic.co/docs/reference/elasticsearch/rest-apis/update-by-query-api
x-previousVersionUrl: https://www.elastic.co/guide/en/elasticsearch/reference/8.19/docs-update-by-query.html
operationId: update-by-query
parameters:
- in: path
name: index
description: 'A comma-separated list of data streams, indices, and aliases to search.
It supports wildcards (`*`).
To search all data streams or indices, omit this parameter or use `*` or `_all`.'
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: analyzer
description: 'The analyzer to use for the query string.
This 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.
This parameter can be used only when the `q` query string parameter is specified.'
deprecated: false
schema:
type: boolean
style: form
- in: query
name: conflicts
description: "The preferred behavior when update by query hits version conflicts: `abort` or `proceed`.\n\nSupported values include:\n - `abort`: Stop reindexing if there are conflicts.\n - `proceed`: Continue reindexing even if there are conflicts.\n\n"
deprecated: false
schema:
$ref: '#/components/schemas/_types.Conflicts'
style: form
- in: query
name: default_operator
description: 'The default operator for query string query: `and` or `or`.
This 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 default where no field prefix is given in the query string.
This parameter can be used only when the `q` query string parameter is specified.'
deprecated: false
schema:
type: string
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: from
description: Skips the specified number of documents.
deprecated: false
schema:
type: number
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: lenient
description: 'If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored.
This parameter can be used only when the `q` query string parameter is specified.'
deprecated: false
schema:
type: boolean
style: form
- in: query
name: max_docs
description: 'The maximum number of documents to process.
It defaults to all documents.
When set to a value less then or equal to `scroll_size` then a scroll will not be used to retrieve the results for the operation.'
deprecated: false
schema:
type: number
style: form
- in: query
name: pipeline
description: 'The ID of the pipeline to use to preprocess incoming documents.
If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request.
If a final pipeline is configured it will always run, regardless of the value of this parameter.'
deprecated: false
schema:
type: string
style: form
- in: query
name: preference
description: 'The node or shard the operation should be performed on.
It is random by default.'
deprecated: false
schema:
type: string
style: form
- in: query
name: q
description: A query in the Lucene query string syntax.
deprecated: false
schema:
type: string
style: form
- in: query
name: refresh
description: 'If `true`, Elasticsearch refreshes affected shards to make the operation visible to search after the request completes.
This is different than the update API''s `refresh` parameter, which causes just the shard that received the request to be refreshed.'
deprecated: false
schema:
type: boolean
style: form
- in: query
name: request_cache
description: 'If `true`, the request cache is used for this request.
It defaults to the index-level setting.'
deprecated: false
schema:
type: boolean
style: form
- in: query
name: requests_per_second
description: The throttle for this request in sub-requests per second.
deprecated: false
schema:
type: number
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: scroll
description: The period to retain the search context for scrolling.
deprecated: false
schema:
$ref: '#/components/schemas/_types.Duration'
style: form
- in: query
name: scroll_size
description: The size of the scroll request that powers the operation.
deprecated: false
schema:
type: number
style: form
- in: query
name: search_timeout
description: 'An explicit timeout for each search request.
By default, there is no timeout.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Duration'
style: form
- in: query
name: search_type
description: "The type of the search operation. Available options include `query_then_fetch` and `dfs_query_then_fetch`.\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: slices
description: The number of slices this task should be divided into.
deprecated: false
schema:
$ref: '#/components/schemas/_types.Slices'
style: form
- in: query
name: sort
description: A comma-separated list of : pairs.
deprecated: false
schema:
type: array
items:
type: string
style: form
- in: query
name: stats
description: The specific `tag` of the request for logging and statistical purposes.
deprecated: false
schema:
type: array
items:
type: string
style: form
- in: query
name: terminate_after
description: 'The maximum number of documents to collect for each shard.
If a query reaches this limit, Elasticsearch terminates the query early.
Elasticsearch collects documents before sorting.
IMPORTANT: Use with caution.
Elasticsearch applies this parameter to each shard handling the request.
When possible, let Elasticsearch perform early termination automatically.
Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers.'
deprecated: false
schema:
type: number
style: form
- in: query
name: timeout
description: 'The period each update request waits for the following operations: dynamic mapping updates, waiting for active shards.
By default, it is one minute.
This guarantees Elasticsearch waits for at least the timeout before failing.
The actual wait time could be longer, particularly when multiple waits occur.'
deprecated: false
schema:
$ref: '#/components/schemas/_types.Duration'
style: form
- in: query
name: version
description: If `true`, returns the document version as part of a hit.
deprecated: false
schema:
type: boolean
style: form
- in: query
name: version_type
description: Should the document increment the version number (internal) on hit or not (reindex)
deprecated: false
schema:
type: boolean
style: form
- in: query
name: wait_for_active_shards
description: 'The number of shard copies that must be active before proceeding with the operation.
Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).
The `timeout` parameter controls how long each write request waits for unavailable shards to become available.
Both work exactly the way they work in the bulk API.'
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.
If `false`, Elasticsearch performs some preflight checks, launches the request, and returns a task ID that you can use to cancel or get the status of the task.
Elasticsearch creates a record of this task as a document at `.tasks/task/${taskId}`.'
deprecated: false
schema:
type: boolean
style: form
requestBody:
content:
application/json:
schema:
type: object
properties:
max_docs:
description: The maximum number of documents to update.
type: number
query:
description: The documents to update using the Query DSL.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
script:
description: The script to run to update the document source or metadata when updating.
allOf:
- $ref: '#/components/schemas/_types.Script'
slice:
description: Slice the request manually using the provided slice ID and total number of slices.
allOf:
- $ref: '#/components/schemas/_types.SlicedScroll'
conflicts:
description: "The preferred behavior when update by query hits version conflicts: `abort` or `proceed`.\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'
examples:
UpdateByQueryRequestExample1:
summary: Update selected documents
description: 'Run `POST my-index-000001/_update_by_query?conflicts=proceed` to update documents that match a query.
'
value: "{\n \"query\": { \n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n}"
UpdateByQueryRequestExample2:
summary: Update the document source
description: 'Run `POST my-index-000001/_update_by_query` with a script to update the document source. It increments the `count` field for all documents with a `user.id` of `kimchy` in `my-index-000001`.
'
value: "{\n \"script\": {\n \"source\": \"ctx._source.count++\",\n \"lang\": \"painless\"\n },\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n}"
UpdateByQueryRequestExample3:
summary: Slice manually
description: 'Run `POST my-index-000001/_update_by_query` to slice an update by query manually. Provide a slice ID and total number of slices to each request.
'
value: "{\n \"slice\": {\n \"id\": 0,\n \"max\": 2\n },\n \"script\": {\n \"source\": \"ctx._source['extra'] = 'test'\"\n }\n}"
UpdateByQueryRequestExample4:
summary: Slice automatically
description: 'Run `POST my-index-000001/_update_by_query?refresh&slices=5` to use automatic slicing. It automatically parallelizes using sliced scroll to slice on `_id`.
'
value: "{\n \"script\": {\n \"source\": \"ctx._source['extra'] = 'test'\"\n }\n}"
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
properties:
batches:
description: The number of scroll responses pulled back by the update by query.
type: number
failures:
description: 'Array of failures if there were any unrecoverable errors during the process.
If this is non-empty then the request ended because of those failures.
Update by query is implemented using batches.
Any failure causes the entire process to end, but all failures in the current batch are collected into the array.
You can use the `conflicts` option to prevent reindex from ending when version conflicts occur.'
type: array
items:
$ref: '#/components/schemas/_types.BulkIndexByScrollFailure'
noops:
description: The number of documents that were ignored because the script used for the update by query returned a noop value for `ctx.op`.
type: number
deleted:
description: The number of documents that were successfully deleted.
type: number
requests_per_second:
description: The number of requests per second effectively run during the update by query.
type: number
retries:
description: 'The number of retries attempted by update by query.
`bulk` is the number of bulk actions retried.
`search` is the number of search actions retried.'
allOf:
- $ref: '#/components/schemas/_types.Retries'
slices:
description: Status of each slice if the update by query was sliced
type: array
items:
$ref: '#/components/schemas/_types.ReindexStatus'
task:
allOf:
- $ref: '#/components/schemas/_types.TaskId'
timed_out:
description: If true, some requests timed out during the update by query.
type: boolean
took:
description: The number of milliseconds from start to end of the whole operation.
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.
type: number
version_conflicts:
description: The number of version conflicts that the update by query hit.
type: number
throttled:
allOf:
- $ref: '#/components/schemas/_types.Duration'
throttled_millis:
description: The number of milliseconds the request slept to conform to `requests_per_second`.
allOf:
- $ref: '#/components/schemas/_types.DurationValueUnitMillis'
throttled_until:
allOf:
- $ref: '#/components/schemas/_types.Duration'
throttled_until_millis:
description: 'This field should always be equal to zero in an _update_by_query response.
It only has meaning when using the task API, where it indicates the next time (in milliseconds since epoch) a throttled request will be run again in order to conform to `requests_per_second`.'
allOf:
- $ref: '#/components/schemas/_types.DurationValueUnitMillis'
x-state: Generally available; Added in 2.4.0
x-variations:
- "\n POST\n /{index}/_update_by_query\n
\n "
x-req-auth:
- 'Index privileges: `read`,`write`
'
x-api: update_by_query
x-category: document management
x-codeSamples:
- lang: Console
source: "POST my-index-000001/_update_by_query?conflicts=proceed\n{\n \"query\": { \n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n}"
- lang: Python
source: "resp = client.update_by_query(\n index=\"my-index-000001\",\n conflicts=\"proceed\",\n query={\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n)"
- lang: JavaScript
source: "const response = await client.updateByQuery({\n index: \"my-index-000001\",\n conflicts: \"proceed\",\n query: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n});"
- lang: Ruby
source: "response = client.update_by_query(\n index: \"my-index-000001\",\n conflicts: \"proceed\",\n body: {\n \"query\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n }\n)"
- lang: PHP
source: "$resp = $client->updateByQuery([\n \"index\" => \"my-index-000001\",\n \"conflicts\" => \"proceed\",\n \"body\" => [\n \"query\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n ],\n]);"
- lang: curl
source: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d ''{"query":{"term":{"user.id":"kimchy"}}}'' "$ELASTICSEARCH_URL/my-index-000001/_update_by_query?conflicts=proceed"'
- lang: Java
source: "client.updateByQuery(u -> u\n .conflicts(Conflicts.Proceed)\n .index(\"my-index-000001\")\n .query(q -> q\n .term(t -> t\n .field(\"user.id\")\n .value(FieldValue.of(\"kimchy\"))\n )\n )\n);\n"
x-metaTags:
- content: Elasticsearch
name: product_name
/_update_by_query/{task_id}/_rethrottle:
post:
tags:
- Document
summary: Throttle an update by query operation
description: 'Change the number of requests per second for a particular update by query operation.
Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts.'
operationId: update-by-query-rethrottle
parameters:
- in: path
name: task_id
description: The ID for the task.
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.
To turn off throttling, set it to `-1`.'
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.update_by_query_rethrottle.UpdateByQueryRethrottleNode'
required:
- nodes
x-state: Generally available; Added in 6.5.0
x-variations:
- "\n POST\n /_update_by_query/{task_id}/_rethrottle\n
\n "
x-api: update_by_query_rethrottle
x-category: document management
x-codeSamples:
- lang: Console
source: 'POST _update_by_query/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1
'
- lang: Python
source: "resp = client.update_by_query_rethrottle(\n task_id=\"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second=\"-1\",\n)"
- lang: JavaScript
source: "const response = await client.updateByQueryRethrottle({\n task_id: \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second: \"-1\",\n});"
- lang: Ruby
source: "response = client.update_by_query_rethrottle(\n task_id: \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n requests_per_second: \"-1\"\n)"
- lang: PHP
source: "$resp = $client->updateByQueryRethrottle([\n \"task_id\" => \"r1A2WoRbTwKZ516z6NEs5A:36619\",\n \"requests_per_second\" => \"-1\",\n]);"
- lang: curl
source: 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_update_by_query/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1"'
- lang: Java
source: "client.updateByQueryRethrottle(u -> u\n .requestsPerSecond(-1.0F)\n .taskId(\"r1A2WoRbTwKZ516z6NEs5A:36619\")\n);\n"
x-metaTags:
- content: Elasticsearch
name: product_name
components:
schemas:
_types.ScriptSort:
type: object
properties:
order:
description: "\n\nSupported values include:\n - `asc`: Ascending (smallest to largest)\n - `desc`: Descending (largest to smallest)\n\n"
allOf:
- $ref: '#/components/schemas/_types.SortOrder'
script:
allOf:
- $ref: '#/components/schemas/_types.Script'
type:
allOf:
- $ref: '#/components/schemas/_types.ScriptSortType'
mode:
allOf:
- $ref: '#/components/schemas/_types.SortMode'
nested:
allOf:
- $ref: '#/components/schemas/_types.NestedSortValue'
required:
- script
_types.aggregations.GeoLineAggregation:
type: object
properties:
point:
description: The name of the geo_point field.
allOf:
- $ref: '#/components/schemas/_types.aggregations.GeoLinePoint'
sort:
description: 'The name of the numeric field to use as the sort key for ordering the points.
When the `geo_line` aggregation is nested inside a `time_series` aggregation, this field defaults to `@timestamp`, and any other value will result in error.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.GeoLineSort'
include_sort:
description: When `true`, returns an additional array of the sort values in the feature properties.
type: boolean
sort_order:
description: "The order in which the line is sorted (ascending or descending).\n\nSupported values include:\n - `asc`: Ascending (smallest to largest)\n - `desc`: Descending (largest to smallest)\n\n"
default: asc
allOf:
- $ref: '#/components/schemas/_types.SortOrder'
size:
description: 'The maximum length of the line represented in the aggregation.
Valid sizes are between 1 and 10000.'
default: 10000.0
type: number
required:
- point
_types.query_dsl.GeoExecution:
type: string
enum:
- memory
- indexed
_types.query_dsl.TermQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
value:
description: Term you wish to find in the provided field.
allOf:
- $ref: '#/components/schemas/_types.FieldValue'
case_insensitive:
description: 'Allows ASCII case insensitive matching of the value with the indexed field values when set to `true`.
When `false`, the case sensitivity of matching depends on the underlying field’s mapping.'
default: false
x-state: Generally available; Added in 7.10.0
type: boolean
required:
- value
_types.LinearRetriever:
allOf:
- $ref: '#/components/schemas/_types.RetrieverBase'
- type: object
properties:
retrievers:
description: Inner retrievers.
type: array
items:
$ref: '#/components/schemas/_types.InnerRetriever'
rank_window_size:
type: number
query:
type: string
fields:
type: array
items:
type: string
normalizer:
allOf:
- $ref: '#/components/schemas/_types.ScoreNormalizer'
_types.GeoTilePrecision:
type: number
_types.Ip:
type: string
_types.aggregations.DiversifiedSamplerAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
execution_hint:
description: "The type of value used for de-duplication.\n\nSupported values include:\n - `map`: Hold field values directly.\n - `global_ordinals`: Hold ordinals of the field as determined by the Lucene index.\n - `bytes_hash`: Hold hashes of the field values - with potential for hash collisions.\n\n"
default: global_ordinals
allOf:
- $ref: '#/components/schemas/_types.aggregations.SamplerAggregationExecutionHint'
max_docs_per_value:
description: Limits how many documents are permitted per choice of de-duplicating value.
default: 1.0
type: number
script:
allOf:
- $ref: '#/components/schemas/_types.Script'
shard_size:
description: Limits how many top-scoring documents are collected in the sample processed on each shard.
default: 100.0
type: number
field:
description: The field used to provide values used for de-duplication.
allOf:
- $ref: '#/components/schemas/_types.Field'
_types.Metadata:
type: object
additionalProperties:
type: object
_types.aggregations.TimeSeriesAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
size:
description: The maximum number of results to return.
default: 10000.0
type: number
keyed:
description: Set to `true` to associate a unique string key with each bucket and returns the ranges as a hash rather than an array.
type: boolean
_types.query_dsl.MatchQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
analyzer:
description: Analyzer used to convert the text in the query value into tokens.
type: string
auto_generate_synonyms_phrase_query:
description: If `true`, match phrase queries are automatically created for multi-term synonyms.
default: true
type: boolean
cutoff_frequency:
deprecated: true
type: number
fuzziness:
description: Maximum edit distance allowed for matching.
allOf:
- $ref: '#/components/schemas/_types.Fuzziness'
fuzzy_rewrite:
description: Method used to rewrite the query.
allOf:
- $ref: '#/components/schemas/_types.MultiTermQueryRewrite'
fuzzy_transpositions:
description: If `true`, edits for fuzzy matching include transpositions of two adjacent characters (for example, `ab` to `ba`).
default: true
type: boolean
lenient:
description: If `true`, format-based errors, such as providing a text query value for a numeric field, are ignored.
default: false
type: boolean
max_expansions:
description: Maximum number of terms to which the query will expand.
default: 50.0
type: number
minimum_should_match:
description: Minimum number of clauses that must match for a document to be returned.
allOf:
- $ref: '#/components/schemas/_types.MinimumShouldMatch'
operator:
description: Boolean logic used to interpret text in the query value.
default: '''or'''
allOf:
- $ref: '#/components/schemas/_types.query_dsl.Operator'
prefix_length:
description: Number of beginning characters left unchanged for fuzzy matching.
default: 0.0
type: number
query:
description: Text, number, boolean value or date you wish to find in the provided field.
oneOf:
- type: string
- type: number
- type: boolean
zero_terms_query:
description: "Indicates whether no documents are returned if the `analyzer` removes all tokens, such as when using a `stop` filter.\n\nSupported values include:\n - `all`: Returns all documents, similar to a `match_all` query.\n - `none`: No documents are returned if the `analyzer` removes all tokens.\n\n"
default: '''none'''
allOf:
- $ref: '#/components/schemas/_types.query_dsl.ZeroTermsQuery'
required:
- query
tasks._types.TaskInfo:
type: object
properties:
action:
type: string
cancelled:
type: boolean
cancellable:
type: boolean
description:
description: 'Human readable text that identifies the particular request that the task is performing.
For example, it might identify the search request being performed by a search task.
Other kinds of tasks have different descriptions, like `_reindex` which has the source and the destination, or `_bulk` which just has the number of requests and the destination indices.
Many requests will have only an empty description because more detailed information about the request is not easily available or particularly helpful in identifying the request.'
type: string
headers:
type: object
additionalProperties:
type: string
id:
type: number
node:
allOf:
- $ref: '#/components/schemas/_types.NodeId'
running_time:
allOf:
- $ref: '#/components/schemas/_types.Duration'
running_time_in_nanos:
allOf:
- $ref: '#/components/schemas/_types.DurationValueUnitNanos'
start_time_in_millis:
allOf:
- $ref: '#/components/schemas/_types.EpochTimeUnitMillis'
status:
description: 'The internal status of the task, which varies from task to task.
The format also varies.
While the goal is to keep the status for a particular task consistent from version to version, this is not always possible because sometimes the implementation changes.
Fields might be removed from the status for a particular request so any parsing you do of the status might break in minor releases.'
type: object
type:
type: string
parent_task_id:
allOf:
- $ref: '#/components/schemas/_types.TaskId'
required:
- action
- cancellable
- headers
- id
- node
- running_time_in_nanos
- start_time_in_millis
- type
_types.aggregations.FormattableMetricAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.MetricAggregationBase'
- type: object
properties:
format:
type: string
_types.aggregations.LinearMovingAverageAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.MovingAverageAggregationBase'
- type: object
properties:
model:
type: string
enum:
- linear
settings:
allOf:
- $ref: '#/components/schemas/_types.EmptyObject'
required:
- model
- settings
_types.aggregations.CompositeHistogramAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.CompositeAggregationBase'
- type: object
properties:
interval:
type: number
required:
- interval
_types.query_dsl.IntervalsFuzzy:
type: object
properties:
analyzer:
description: Analyzer used to normalize the term.
type: string
fuzziness:
description: Maximum edit distance allowed for matching.
default: auto
allOf:
- $ref: '#/components/schemas/_types.Fuzziness'
prefix_length:
description: Number of beginning characters left unchanged when creating expansions.
default: 0.0
type: number
term:
description: The term to match.
type: string
transpositions:
description: Indicates whether edits include transpositions of two adjacent characters (for example, `ab` to `ba`).
default: true
type: boolean
use_field:
description: 'If specified, match intervals from this field rather than the top-level field.
The `term` is normalized using the search analyzer from this field, unless `analyzer` is specified separately.'
allOf:
- $ref: '#/components/schemas/_types.Field'
required:
- term
_types.aggregations.InferenceConfigContainer:
type: object
properties:
regression:
description: Regression configuration for inference.
allOf:
- $ref: '#/components/schemas/ml._types.RegressionInferenceOptions'
classification:
description: Classification configuration for inference.
allOf:
- $ref: '#/components/schemas/ml._types.ClassificationInferenceOptions'
minProperties: 1
maxProperties: 1
_types.ExpandWildcard:
type: string
enum:
- all
- open
- closed
- hidden
- none
_types.SlicedScroll:
type: object
properties:
field:
allOf:
- $ref: '#/components/schemas/_types.Field'
id:
allOf:
- $ref: '#/components/schemas/_types.Id'
max:
type: number
required:
- id
- max
_types.mapping.RuntimeFieldType:
type: string
enum:
- boolean
- composite
- date
- double
- geo_point
- geo_shape
- ip
- keyword
- long
- lookup
_types.query_dsl.GeoPolygonQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
validation_method:
description: "\n\nSupported values include:\n - `coerce`: Accept geo points with invalid latitude or longitude and additionally try and infer correct coordinates.\n - `ignore_malformed`: Accept geo points with invalid latitude or longitude.\n - `strict`\n\n"
default: '''strict'''
allOf:
- $ref: '#/components/schemas/_types.query_dsl.GeoValidationMethod'
ignore_unmapped:
type: boolean
_types.aggregations.IpRangeAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
field:
description: The date field whose values are used to build ranges.
allOf:
- $ref: '#/components/schemas/_types.Field'
ranges:
description: Array of IP ranges.
type: array
items:
$ref: '#/components/schemas/_types.aggregations.IpRangeAggregationRange'
_types.query_dsl.RangeQueryBasedouble:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
relation:
description: "Indicates how the range query matches values for `range` fields.\n\nSupported values include:\n - `within`: Matches documents with a range field value entirely within the query’s range.\n - `contains`: Matches documents with a range field value that entirely contains the query’s range.\n - `intersects`: Matches documents with a range field value that intersects the query’s range.\n\n"
default: intersects
allOf:
- $ref: '#/components/schemas/_types.query_dsl.RangeRelation'
gt:
description: Greater than.
type: number
gte:
description: Greater than or equal to.
type: number
lt:
description: Less than.
type: number
lte:
description: Less than or equal to.
type: number
_types.aggregations.BucketScriptAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.PipelineAggregationBase'
- type: object
properties:
script:
description: The script to run for this aggregation.
allOf:
- $ref: '#/components/schemas/_types.Script'
_types.query_dsl.TermsSetQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
minimum_should_match:
description: Specification describing number of matching terms required to return a document.
x-state: Generally available; Added in 8.10.0
allOf:
- $ref: '#/components/schemas/_types.MinimumShouldMatch'
minimum_should_match_field:
description: Numeric field containing the number of matching terms required to return a document.
allOf:
- $ref: '#/components/schemas/_types.Field'
minimum_should_match_script:
description: Custom script containing the number of matching terms required to return a document.
allOf:
- $ref: '#/components/schemas/_types.Script'
terms:
description: Array of terms you wish to find in the provided field.
type: array
items:
$ref: '#/components/schemas/_types.FieldValue'
required:
- terms
_types.aggregations.TTestType:
type: string
enum:
- paired
- homoscedastic
- heteroscedastic
_types.DurationValueUnitMillis:
allOf:
- $ref: '#/components/schemas/_types.UnitMillis'
_types.query_dsl.GeoShapeQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
ignore_unmapped:
description: 'Set to `true` to ignore an unmapped field and not match any documents for this query.
Set to `false` to throw an exception if the field is not mapped.'
default: false
type: boolean
tasks._types.NodeTasks:
type: object
properties:
name:
allOf:
- $ref: '#/components/schemas/_types.NodeId'
transport_address:
allOf:
- $ref: '#/components/schemas/_types.TransportAddress'
host:
allOf:
- $ref: '#/components/schemas/_types.Host'
ip:
allOf:
- $ref: '#/components/schemas/_types.Ip'
roles:
type: array
items:
type: string
attributes:
type: object
additionalProperties:
type: string
tasks:
type: object
additionalProperties:
$ref: '#/components/schemas/tasks._types.TaskInfo'
required:
- tasks
_types.aggregations.MatrixAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.Aggregation'
- type: object
properties:
fields:
description: An array of fields for computing the statistics.
allOf:
- $ref: '#/components/schemas/_types.Fields'
missing:
description: 'The value to apply to documents that do not have a value.
By default, documents without a value are ignored.'
type: object
additionalProperties:
type: number
_types.query_dsl.Like:
description: Text that we want similar documents for or a lookup to a document's field for the text.
oneOf:
- type: string
- $ref: '#/components/schemas/_types.query_dsl.LikeDocument'
_global.update.UpdateWriteResponseBase:
allOf:
- $ref: '#/components/schemas/_types.WriteResponseBase'
- type: object
properties:
get:
allOf:
- $ref: '#/components/schemas/_types.InlineGet'
_types.query_dsl.MultiMatchQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
analyzer:
description: Analyzer used to convert the text in the query value into tokens.
type: string
auto_generate_synonyms_phrase_query:
description: If `true`, match phrase queries are automatically created for multi-term synonyms.
default: true
type: boolean
cutoff_frequency:
deprecated: true
type: number
fields:
description: 'The fields to be queried.
Defaults to the `index.query.default_field` index settings, which in turn defaults to `*`.'
allOf:
- $ref: '#/components/schemas/_types.Fields'
fuzziness:
description: Maximum edit distance allowed for matching.
allOf:
- $ref: '#/components/schemas/_types.Fuzziness'
fuzzy_rewrite:
description: Method used to rewrite the query.
allOf:
- $ref: '#/components/schemas/_types.MultiTermQueryRewrite'
fuzzy_transpositions:
description: 'If `true`, edits for fuzzy matching include transpositions of two adjacent characters (for example, `ab` to `ba`).
Can be applied to the term subqueries constructed for all terms but the final term.'
default: true
type: boolean
lenient:
description: If `true`, format-based errors, such as providing a text query value for a numeric field, are ignored.
default: false
type: boolean
max_expansions:
description: Maximum number of terms to which the query will expand.
default: 50.0
type: number
minimum_should_match:
description: Minimum number of clauses that must match for a document to be returned.
allOf:
- $ref: '#/components/schemas/_types.MinimumShouldMatch'
operator:
description: Boolean logic used to interpret text in the query value.
default: '''or'''
allOf:
- $ref: '#/components/schemas/_types.query_dsl.Operator'
prefix_length:
description: Number of beginning characters left unchanged for fuzzy matching.
default: 0.0
type: number
query:
description: Text, number, boolean value or date you wish to find in the provided field.
type: string
slop:
description: Maximum number of positions allowed between matching tokens.
default: 0.0
type: number
tie_breaker:
description: Determines how scores for each per-term blended query and scores across groups are combined.
default: 0.0
type: number
type:
description: "How `the` multi_match query is executed internally.\n\nSupported values include:\n - `best_fields`: Finds documents that match any field, but uses the `_score` from the best field.\n - `most_fields`: Finds documents that match any field and combines the `_score` from each field.\n - `cross_fields`: Treats fields with the same analyzer as though they were one big field.\nLooks for each word in any field.\n - `phrase`: Runs a `match_phrase` query on each field and uses the `_score` from the best field.\n - `phrase_prefix`: Runs a `match_phrase_prefix` query on each field and uses the `_score` from the best field.\n - `bool_prefix`: Creates a `match_bool_prefix` query on each field and combines the `_score` from each field.\n\n"
default: '''best_fields'''
allOf:
- $ref: '#/components/schemas/_types.query_dsl.TextQueryType'
zero_terms_query:
description: "Indicates whether no documents are returned if the `analyzer` removes all tokens, such as when using a `stop` filter.\n\nSupported values include:\n - `all`: Returns all documents, similar to a `match_all` query.\n - `none`: No documents are returned if the `analyzer` removes all tokens.\n\n"
default: '''none'''
allOf:
- $ref: '#/components/schemas/_types.query_dsl.ZeroTermsQuery'
required:
- query
_types.Field:
description: Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.
type: string
_types.aggregations.BucketCorrelationFunctionCountCorrelationIndicator:
type: object
properties:
doc_count:
description: 'The total number of documents that initially created the expectations. It’s required to be greater
than or equal to the sum of all values in the buckets_path as this is the originating superset of data
to which the term values are correlated.'
type: number
expectations:
description: 'An array of numbers with which to correlate the configured `bucket_path` values.
The length of this value must always equal the number of buckets returned by the `bucket_path`.'
type: array
items:
type: number
fractions:
description: 'An array of fractions to use when averaging and calculating variance. This should be used if
the pre-calculated data and the buckets_path have known gaps. The length of fractions, if provided,
must equal expectations.'
type: array
items:
type: number
required:
- doc_count
- expectations
_types.aggregations.SumAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.FormatMetricAggregationBase'
- type: object
_types.QueryVector:
type: array
items:
type: number
_types.query_dsl.RuleQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
organic:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
ruleset_ids:
oneOf:
- $ref: '#/components/schemas/_types.Id'
- type: array
items:
$ref: '#/components/schemas/_types.Id'
ruleset_id:
type: string
match_criteria:
type: object
required:
- organic
- match_criteria
_types.Conflicts:
type: string
enum:
- abort
- proceed
_types.Duration:
externalDocs:
url: https://www.elastic.co/docs/reference/elasticsearch/rest-apis/api-conventions#time-units
description: 'A duration. Units can be `nanos`, `micros`, `ms` (milliseconds), `s` (seconds), `m` (minutes), `h` (hours) and
`d` (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.'
oneOf:
- type: string
- type: string
enum:
- '-1'
- type: string
enum:
- '0'
_spec_utils.BaseNode:
type: object
properties:
attributes:
type: object
additionalProperties:
type: string
host:
allOf:
- $ref: '#/components/schemas/_types.Host'
ip:
allOf:
- $ref: '#/components/schemas/_types.Ip'
name:
allOf:
- $ref: '#/components/schemas/_types.Name'
roles:
allOf:
- $ref: '#/components/schemas/_types.NodeRoles'
transport_address:
allOf:
- $ref: '#/components/schemas/_types.TransportAddress'
required:
- attributes
- host
- ip
- name
- transport_address
_types.GeoLocation:
description: 'A latitude/longitude as a 2 dimensional point. It can be represented in various ways:
- as a `{lat, long}` object
- as a geo hash value
- as a `[lon, lat]` array
- as a string in `", "` or WKT point formats'
oneOf:
- $ref: '#/components/schemas/_types.LatLonGeoLocation'
- $ref: '#/components/schemas/_types.GeoHashLocation'
- type: array
items:
type: number
- type: string
_types.aggregations.ScriptedMetricAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.MetricAggregationBase'
- type: object
properties:
combine_script:
description: 'Runs once on each shard after document collection is complete.
Allows the aggregation to consolidate the state returned from each shard.'
allOf:
- $ref: '#/components/schemas/_types.Script'
init_script:
description: 'Runs prior to any collection of documents.
Allows the aggregation to set up any initial state.'
allOf:
- $ref: '#/components/schemas/_types.Script'
map_script:
description: 'Run once per document collected.
If no `combine_script` is specified, the resulting state needs to be stored in the `state` object.'
allOf:
- $ref: '#/components/schemas/_types.Script'
params:
description: 'A global object with script parameters for `init`, `map` and `combine` scripts.
It is shared between the scripts.'
type: object
additionalProperties:
type: object
reduce_script:
description: 'Runs once on the coordinating node after all shards have returned their results.
The script is provided with access to a variable `states`, which is an array of the result of the `combine_script` on each shard.'
allOf:
- $ref: '#/components/schemas/_types.Script'
_types.aggregations.DateRangeAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
field:
description: The date field whose values are use to build ranges.
allOf:
- $ref: '#/components/schemas/_types.Field'
format:
description: The date format used to format `from` and `to` in the response.
type: string
missing:
description: 'The value to apply to documents that do not have a value.
By default, documents without a value are ignored.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.Missing'
ranges:
description: Array of date ranges.
type: array
items:
$ref: '#/components/schemas/_types.aggregations.DateRangeExpression'
time_zone:
description: Time zone used to convert dates from another time zone to UTC.
allOf:
- $ref: '#/components/schemas/_types.TimeZone'
keyed:
description: Set to `true` to associate a unique string key with each bucket and returns the ranges as a hash rather than an array.
type: boolean
_types.query_dsl.MatchPhrasePrefixQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
analyzer:
description: Analyzer used to convert text in the query value into tokens.
type: string
max_expansions:
description: Maximum number of terms to which the last provided term of the query value will expand.
default: 50.0
type: number
query:
description: Text you wish to find in the provided field.
type: string
slop:
description: Maximum number of positions allowed between matching tokens.
default: 0.0
type: number
zero_terms_query:
description: "Indicates whether no documents are returned if the analyzer removes all tokens, such as when using a `stop` filter.\n\nSupported values include:\n - `all`: Returns all documents, similar to a `match_all` query.\n - `none`: No documents are returned if the `analyzer` removes all tokens.\n\n"
default: none
allOf:
- $ref: '#/components/schemas/_types.query_dsl.ZeroTermsQuery'
required:
- query
_types.SortCombinations:
oneOf:
- $ref: '#/components/schemas/_types.Field'
- $ref: '#/components/schemas/_types.SortOptions'
_types.query_dsl.DateDistanceFeatureQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.DistanceFeatureQueryBaseDateMathDuration'
- type: object
_types.query_dsl.ExistsQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
field:
description: Name of the field you wish to search.
allOf:
- $ref: '#/components/schemas/_types.Field'
required:
- field
_types.aggregations.PipelineAggregationBase:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketPathAggregation'
- type: object
properties:
format:
description: '`DecimalFormat` pattern for the output value.
If specified, the formatted value is returned in the aggregation’s `value_as_string` property.'
type: string
gap_policy:
description: "Policy to apply when gaps are found in the data.\n\nSupported values include:\n - `skip`: Treats missing data as if the bucket does not exist. It will skip the bucket and\ncontinue calculating using the next available value.\n - `insert_zeros`: Replace missing values with a zero (0) and pipeline aggregation computation will proceed as normal.\n - `keep_values`: Similar to skip, except if the metric provides a non-null, non-NaN value this value is used,\notherwise the empty bucket is skipped.\n\n"
default: skip
allOf:
- $ref: '#/components/schemas/_types.aggregations.GapPolicy'
_types.aggregations.WeightedAverageValue:
type: object
properties:
field:
description: The field from which to extract the values or weights.
allOf:
- $ref: '#/components/schemas/_types.Field'
missing:
description: A value or weight to use if the field is missing.
type: number
script:
allOf:
- $ref: '#/components/schemas/_types.Script'
_types.GeoHashLocation:
type: object
properties:
geohash:
allOf:
- $ref: '#/components/schemas/_types.GeoHash'
required:
- geohash
_types.aggregations.FormatMetricAggregationBase:
allOf:
- $ref: '#/components/schemas/_types.aggregations.MetricAggregationBase'
- type: object
properties:
format:
type: string
_types.aggregations.BucketsPath:
description: 'Buckets path can be expressed in different ways, and an aggregation may accept some or all of these
forms depending on its type. Please refer to each aggregation''s documentation to know what buckets
path forms they accept.'
oneOf:
- type: string
- type: array
items:
type: string
- type: object
additionalProperties:
type: string
_global.search._types.HighlightField:
allOf:
- $ref: '#/components/schemas/_global.search._types.HighlightBase'
- type: object
properties:
fragment_offset:
type: number
matched_fields:
allOf:
- $ref: '#/components/schemas/_types.Fields'
_types.query_dsl.ScriptScoreFunction:
type: object
properties:
script:
description: A script that computes a score.
allOf:
- $ref: '#/components/schemas/_types.Script'
required:
- script
_types.aggregations.MatrixStatsAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.MatrixAggregation'
- type: object
properties:
mode:
description: Array value the aggregation will use for array or multi-valued fields.
default: avg
allOf:
- $ref: '#/components/schemas/_types.SortMode'
_types.query_dsl.QueryBase:
type: object
properties:
boost:
description: 'Floating point number used to decrease or increase the relevance scores of the query.
Boost values are relative to the default value of 1.0.
A boost value between 0 and 1.0 decreases the relevance score.
A value greater than 1.0 increases the relevance score.'
default: 1.0
type: number
_name:
type: string
_types.TopLeftBottomRightGeoBounds:
type: object
properties:
top_left:
allOf:
- $ref: '#/components/schemas/_types.GeoLocation'
bottom_right:
allOf:
- $ref: '#/components/schemas/_types.GeoLocation'
required:
- top_left
- bottom_right
_types.TokenPruningConfig:
type: object
properties:
tokens_freq_ratio_threshold:
description: Tokens whose frequency is more than this threshold times the average frequency of all tokens in the specified field are considered outliers and pruned.
default: 5.0
type: number
tokens_weight_threshold:
description: Tokens whose weight is less than this threshold are considered nonsignificant and pruned.
default: 0.4
type: number
only_score_pruned_tokens:
description: Whether to only score pruned tokens, vs only scoring kept tokens.
default: false
type: boolean
_global.search._types.Highlight:
allOf:
- $ref: '#/components/schemas/_global.search._types.HighlightBase'
- type: object
properties:
encoder:
allOf:
- $ref: '#/components/schemas/_global.search._types.HighlighterEncoder'
fields:
oneOf:
- type: object
additionalProperties:
$ref: '#/components/schemas/_global.search._types.HighlightField'
minProperties: 1
maxProperties: 1
- type: array
items:
type: object
additionalProperties:
$ref: '#/components/schemas/_global.search._types.HighlightField'
minProperties: 1
maxProperties: 1
required:
- fields
_global.termvectors.Term:
type: object
properties:
doc_freq:
type: number
score:
type: number
term_freq:
type: number
tokens:
type: array
items:
$ref: '#/components/schemas/_global.termvectors.Token'
ttf:
type: number
required:
- term_freq
_types.query_dsl.SpanMultiTermQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
match:
description: Should be a multi term query (one of `wildcard`, `fuzzy`, `prefix`, `range`, or `regexp` query).
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
required:
- match
_global.termvectors.Token:
type: object
properties:
end_offset:
type: number
payload:
type: string
position:
type: number
start_offset:
type: number
required:
- position
_types.mapping.RuntimeField:
type: object
properties:
fields:
description: For type `composite`
type: object
additionalProperties:
$ref: '#/components/schemas/_types.mapping.CompositeSubField'
fetch_fields:
description: For type `lookup`
type: array
items:
$ref: '#/components/schemas/_types.mapping.RuntimeFieldFetchFields'
format:
description: A custom format for `date` type runtime fields.
type: string
input_field:
description: For type `lookup`
allOf:
- $ref: '#/components/schemas/_types.Field'
target_field:
description: For type `lookup`
allOf:
- $ref: '#/components/schemas/_types.Field'
target_index:
description: For type `lookup`
allOf:
- $ref: '#/components/schemas/_types.IndexName'
script:
description: Painless script executed at query time.
allOf:
- $ref: '#/components/schemas/_types.Script'
type:
description: 'Field type, which can be: `boolean`, `composite`, `date`, `double`, `geo_point`, `ip`,`keyword`, `long`, or `lookup`.'
allOf:
- $ref: '#/components/schemas/_types.mapping.RuntimeFieldType'
required:
- type
_types.SortOrder:
type: string
enum:
- asc
- desc
_global.mget.MultiGetError:
type: object
properties:
error:
allOf:
- $ref: '#/components/schemas/_types.ErrorCause'
_id:
allOf:
- $ref: '#/components/schemas/_types.Id'
_index:
allOf:
- $ref: '#/components/schemas/_types.IndexName'
required:
- error
- _id
- _index
_global.search._types.FieldCollapse:
type: object
properties:
field:
description: The field to collapse the result set on
allOf:
- $ref: '#/components/schemas/_types.Field'
inner_hits:
description: The number of inner hits and their sort order
oneOf:
- $ref: '#/components/schemas/_global.search._types.InnerHits'
- type: array
items:
$ref: '#/components/schemas/_global.search._types.InnerHits'
max_concurrent_group_searches:
description: The number of concurrent requests allowed to retrieve the inner_hits per group
type: number
collapse:
allOf:
- $ref: '#/components/schemas/_global.search._types.FieldCollapse'
required:
- field
_types.query_dsl.ShapeQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
ignore_unmapped:
description: When set to `true` the query ignores an unmapped field and will not match any documents.
type: boolean
_types.SortMode:
type: string
enum:
- min
- max
- sum
- avg
- median
_types.aggregations.ExtendedStatsAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.FormatMetricAggregationBase'
- type: object
properties:
sigma:
description: The number of standard deviations above/below the mean to display.
type: number
_types.PinnedRetriever:
allOf:
- $ref: '#/components/schemas/_types.RetrieverBase'
- type: object
properties:
retriever:
description: Inner retriever.
allOf:
- $ref: '#/components/schemas/_types.RetrieverContainer'
ids:
type: array
items:
type: string
docs:
type: array
items:
$ref: '#/components/schemas/_types.SpecifiedDocument'
rank_window_size:
type: number
required:
- retriever
_global.search._types.ScoreMode:
type: string
enum:
- avg
- max
- min
- multiply
- total
_types.TransportAddress:
type: string
_types.query_dsl.FunctionScoreContainer:
allOf:
- type: object
properties:
filter:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
weight:
type: number
- type: object
properties:
exp:
description: Function that scores a document with a exponential decay, depending on the distance of a numeric field value of the document from an origin.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.DecayFunction'
gauss:
description: Function that scores a document with a normal decay, depending on the distance of a numeric field value of the document from an origin.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.DecayFunction'
linear:
description: Function that scores a document with a linear decay, depending on the distance of a numeric field value of the document from an origin.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.DecayFunction'
field_value_factor:
description: 'Function allows you to use a field from a document to influence the score.
It’s similar to using the script_score function, however, it avoids the overhead of scripting.'
allOf:
- $ref: '#/components/schemas/_types.query_dsl.FieldValueFactorScoreFunction'
random_score:
description: 'Generates scores that are uniformly distributed from 0 up to but not including 1.
In case you want scores to be reproducible, it is possible to provide a `seed` and `field`.'
allOf:
- $ref: '#/components/schemas/_types.query_dsl.RandomScoreFunction'
script_score:
description: Enables you to wrap another query and customize the scoring of it optionally with a computation derived from other numeric field values in the doc using a script expression.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.ScriptScoreFunction'
minProperties: 1
maxProperties: 1
_types.Fuzziness:
oneOf:
- type: string
- type: number
_types.aggregations.PercentilesBucketAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.PipelineAggregationBase'
- type: object
properties:
percents:
description: The list of percentiles to calculate.
type: array
items:
type: number
_types.query_dsl.GeoValidationMethod:
type: string
enum:
- coerce
- ignore_malformed
- strict
_types.EmptyObject:
description: For empty Class assignments
type: object
_global.search._types.Suggester:
type: object
properties:
text:
description: Global suggest text, to avoid repetition when the same text is used in several suggesters
type: string
_types.Ids:
oneOf:
- $ref: '#/components/schemas/_types.Id'
- type: array
items:
$ref: '#/components/schemas/_types.Id'
_global.search._types.LearningToRank:
type: object
properties:
model_id:
description: The unique identifier of the trained model uploaded to Elasticsearch
type: string
params:
description: Named parameters to be passed to the query templates used for feature
type: object
additionalProperties:
type: object
required:
- model_id
_types.TopRightBottomLeftGeoBounds:
type: object
properties:
top_right:
allOf:
- $ref: '#/components/schemas/_types.GeoLocation'
bottom_left:
allOf:
- $ref: '#/components/schemas/_types.GeoLocation'
required:
- top_right
- bottom_left
_types.aggregations.MovingAverageAggregationBase:
allOf:
- $ref: '#/components/schemas/_types.aggregations.PipelineAggregationBase'
- type: object
properties:
minimize:
type: boolean
predict:
type: number
window:
type: number
_types.MultiTermQueryRewrite:
type: string
_types.query_dsl.IntervalsFilter:
type: object
properties:
after:
description: Query used to return intervals that follow an interval from the `filter` rule.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsContainer'
before:
description: Query used to return intervals that occur before an interval from the `filter` rule.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsContainer'
contained_by:
description: Query used to return intervals contained by an interval from the `filter` rule.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsContainer'
containing:
description: Query used to return intervals that contain an interval from the `filter` rule.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsContainer'
not_contained_by:
description: Query used to return intervals that are **not** contained by an interval from the `filter` rule.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsContainer'
not_containing:
description: Query used to return intervals that do **not** contain an interval from the `filter` rule.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsContainer'
not_overlapping:
description: Query used to return intervals that do **not** overlap with an interval from the `filter` rule.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsContainer'
overlapping:
description: Query used to return intervals that overlap with an interval from the `filter` rule.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsContainer'
script:
description: 'Script used to return matching documents.
This script must return a boolean value: `true` or `false`.'
allOf:
- $ref: '#/components/schemas/_types.Script'
minProperties: 1
maxProperties: 1
_types.Retries:
type: object
properties:
bulk:
description: The number of bulk actions retried.
type: number
search:
description: The number of search actions retried.
type: number
required:
- bulk
- search
_types.query_dsl.SpanQuery:
type: object
properties:
span_containing:
description: Accepts a list of span queries, but only returns those spans which also match a second span query.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanContainingQuery'
span_field_masking:
description: Allows queries like `span_near` or `span_or` across different fields.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanFieldMaskingQuery'
span_first:
description: Accepts another span query whose matches must appear within the first N positions of the field.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanFirstQuery'
span_gap:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanGapQuery'
span_multi:
description: Wraps a `term`, `range`, `prefix`, `wildcard`, `regexp`, or `fuzzy` query.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanMultiTermQuery'
span_near:
description: Accepts multiple span queries whose matches must be within the specified distance of each other, and possibly in the same order.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanNearQuery'
span_not:
description: Wraps another span query, and excludes any documents which match that query.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanNotQuery'
span_or:
description: Combines multiple span queries and returns documents which match any of the specified queries.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanOrQuery'
span_term:
description: The equivalent of the `term` query but for use with other span queries.
type: object
additionalProperties:
$ref: '#/components/schemas/_types.query_dsl.SpanTermQuery'
minProperties: 1
maxProperties: 1
span_within:
description: The result from a single span query is returned as long is its span falls within the spans returned by a list of other span queries.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanWithinQuery'
minProperties: 1
maxProperties: 1
_global.search._types.SourceConfig:
description: Defines how to fetch a source. Fetching can be disabled entirely, or the source can be filtered.
oneOf:
- type: boolean
- $ref: '#/components/schemas/_global.search._types.SourceFilter'
_types.query_dsl.SparseVectorQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-sparse-vector-query
allOf:
- type: object
properties:
field:
description: 'The name of the field that contains the token-weight pairs to be searched against.
This field must be a mapped sparse_vector field.'
allOf:
- $ref: '#/components/schemas/_types.Field'
query:
description: 'The query text you want to use for search.
If inference_id is specified, query must also be specified.'
type: string
prune:
description: 'Whether to perform pruning, omitting the non-significant tokens from the query to improve query performance.
If prune is true but the pruning_config is not specified, pruning will occur but default values will be used.
Default: false'
x-state: Generally available; Added in 8.15.0
type: boolean
pruning_config:
description: 'Optional pruning configuration.
If enabled, this will omit non-significant tokens from the query in order to improve query performance.
This is only used if prune is set to true.
If prune is set to true but pruning_config is not specified, default values will be used.'
x-state: Generally available; Added in 8.15.0
allOf:
- $ref: '#/components/schemas/_types.TokenPruningConfig'
required:
- field
- type: object
properties:
query_vector:
description: 'Dictionary of precomputed sparse vectors and their associated weights.
Only one of inference_id or query_vector may be supplied in a request.'
type: object
additionalProperties:
type: number
inference_id:
description: 'The inference ID to use to convert the query text into token-weight pairs.
It must be the same inference ID that was used to create the tokens from the input text.
Only one of inference_id and query_vector is allowed.
If inference_id is specified, query must also be specified.
Only one of inference_id or query_vector may be supplied in a request.'
allOf:
- $ref: '#/components/schemas/_types.Id'
minProperties: 1
maxProperties: 1
_types.query_dsl.SpanOrQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
clauses:
description: Array of one or more other span type queries.
type: array
items:
$ref: '#/components/schemas/_types.query_dsl.SpanQuery'
required:
- clauses
_types.aggregations.TermsAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
collect_mode:
description: "Determines how child aggregations should be calculated: breadth-first or depth-first.\n\nSupported values include:\n - `depth_first`: Expands all branches of the aggregation tree in one depth-first pass, before any pruning occurs.\n - `breadth_first`: Caches the set of documents that fall into the uppermost buckets for subsequent replay.\n\n"
allOf:
- $ref: '#/components/schemas/_types.aggregations.TermsAggregationCollectMode'
exclude:
description: 'Values to exclude.
Accepts regular expressions and partitions.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.TermsExclude'
execution_hint:
description: Determines whether the aggregation will use field values directly or global ordinals.
allOf:
- $ref: '#/components/schemas/_types.aggregations.TermsAggregationExecutionHint'
field:
description: The field from which to return terms.
allOf:
- $ref: '#/components/schemas/_types.Field'
include:
description: 'Values to include.
Accepts regular expressions and partitions.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.TermsInclude'
min_doc_count:
description: Only return values that are found in more than `min_doc_count` hits.
default: 1.0
type: number
missing:
description: 'The value to apply to documents that do not have a value.
By default, documents without a value are ignored.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.Missing'
missing_order:
allOf:
- $ref: '#/components/schemas/_types.aggregations.MissingOrder'
missing_bucket:
type: boolean
value_type:
description: Coerced unmapped fields into the specified type.
type: string
order:
description: 'Specifies the sort order of the buckets.
Defaults to sorting by descending document count.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.AggregateOrder'
script:
allOf:
- $ref: '#/components/schemas/_types.Script'
shard_min_doc_count:
description: 'Regulates the certainty a shard has if the term should actually be added to the candidate list or not with respect to the `min_doc_count`.
Terms will only be considered if their local shard frequency within the set is higher than the `shard_min_doc_count`.'
type: number
shard_size:
description: 'The number of candidate terms produced by each shard.
By default, `shard_size` will be automatically estimated based on the number of shards and the `size` parameter.'
type: number
show_term_doc_count_error:
description: Set to `true` to return the `doc_count_error_upper_bound`, which is an upper bound to the error on the `doc_count` returned by each shard.
type: boolean
size:
description: The number of buckets returned out of the overall terms list.
default: 10.0
type: number
format:
type: string
_types.aggregations.PValueHeuristic:
type: object
properties:
background_is_superset:
type: boolean
normalize_above:
description: 'Should the results be normalized when above the given value.
Allows for consistent significance results at various scales.
Note: `0` is a special value which means no normalization'
default: 0.0
type: number
_types.query_dsl.SpanWithinQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
big:
description: 'Can be any span query.
Matching spans from `little` that are enclosed within `big` are returned.'
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanQuery'
little:
description: 'Can be any span query.
Matching spans from `little` that are enclosed within `big` are returned.'
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanQuery'
required:
- big
- little
_types.query_dsl.IntervalsAllOf:
type: object
properties:
intervals:
description: An array of rules to combine. All rules must produce a match in a document for the overall source to match.
type: array
items:
$ref: '#/components/schemas/_types.query_dsl.IntervalsContainer'
max_gaps:
description: 'Maximum number of positions between the matching terms.
Intervals produced by the rules further apart than this are not considered matches.'
default: -1.0
type: number
ordered:
description: If `true`, intervals produced by the rules should appear in the order in which they are specified.
default: false
type: boolean
filter:
description: Rule used to filter returned intervals.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsFilter'
required:
- intervals
_types.query_dsl.DisMaxQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
queries:
description: 'One or more query clauses.
Returned documents must match one or more of these queries.
If a document matches multiple queries, Elasticsearch uses the highest relevance score.'
type: array
items:
$ref: '#/components/schemas/_types.query_dsl.QueryContainer'
tie_breaker:
description: Floating point number between 0 and 1.0 used to increase the relevance scores of documents matching multiple query clauses.
default: 0.0
type: number
required:
- queries
_types.Slices:
description: Slices configuration used to parallelize a process.
oneOf:
- type: number
- $ref: '#/components/schemas/_types.SlicesCalculation'
_types.SortOptions:
type: object
properties:
_score:
allOf:
- $ref: '#/components/schemas/_types.ScoreSort'
_doc:
allOf:
- $ref: '#/components/schemas/_types.ScoreSort'
_geo_distance:
allOf:
- $ref: '#/components/schemas/_types.GeoDistanceSort'
_script:
allOf:
- $ref: '#/components/schemas/_types.ScriptSort'
minProperties: 1
maxProperties: 1
_types.mapping.CompositeSubField:
type: object
properties:
type:
allOf:
- $ref: '#/components/schemas/_types.mapping.RuntimeFieldType'
required:
- type
_types.query_dsl.IntervalsWildcard:
type: object
properties:
analyzer:
description: 'Analyzer used to analyze the `pattern`.
Defaults to the top-level field''s analyzer.'
type: string
pattern:
description: Wildcard pattern used to find matching terms.
type: string
use_field:
description: 'If specified, match intervals from this field rather than the top-level field.
The `pattern` is normalized using the search analyzer from this field, unless `analyzer` is specified separately.'
allOf:
- $ref: '#/components/schemas/_types.Field'
required:
- pattern
_types.LatLonGeoLocation:
type: object
properties:
lat:
description: Latitude
type: number
lon:
description: Longitude
type: number
required:
- lat
- lon
_types.aggregations.GeoLineSort:
type: object
properties:
field:
description: The name of the numeric field to use as the sort key for ordering the points.
allOf:
- $ref: '#/components/schemas/_types.Field'
required:
- field
_types.query_dsl.SemanticQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
field:
description: The field to query, which must be a semantic_text field type
type: string
query:
description: The query text
type: string
required:
- field
- query
_types.query_dsl.UntypedRangeQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.RangeQueryBase'
- type: object
properties:
format:
description: Date format used to convert `date` values in the query.
allOf:
- $ref: '#/components/schemas/_types.DateFormat'
time_zone:
description: Coordinated Universal Time (UTC) offset or IANA time zone used to convert `date` values in the query to UTC.
allOf:
- $ref: '#/components/schemas/_types.TimeZone'
_types.aggregations.HoltWintersModelSettings:
type: object
properties:
alpha:
type: number
beta:
type: number
gamma:
type: number
pad:
type: boolean
period:
type: number
type:
allOf:
- $ref: '#/components/schemas/_types.aggregations.HoltWintersType'
_types.aggregations.TTestAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.Aggregation'
- type: object
properties:
a:
description: Test population A.
allOf:
- $ref: '#/components/schemas/_types.aggregations.TestPopulation'
b:
description: Test population B.
allOf:
- $ref: '#/components/schemas/_types.aggregations.TestPopulation'
type:
description: "The type of test.\n\nSupported values include:\n - `paired`: Performs paired t-test.\n - `homoscedastic`: Performs two-sample equal variance test.\n - `heteroscedastic`: Performs two-sample unequal variance test.\n\n"
default: heteroscedastic
allOf:
- $ref: '#/components/schemas/_types.aggregations.TTestType'
_types.query_dsl.DateRangeQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.RangeQueryBaseDateMath'
- type: object
properties:
format:
description: Date format used to convert `date` values in the query.
allOf:
- $ref: '#/components/schemas/_types.DateFormat'
time_zone:
description: Coordinated Universal Time (UTC) offset or IANA time zone used to convert `date` values in the query to UTC.
allOf:
- $ref: '#/components/schemas/_types.TimeZone'
_global.bulk.ResponseItem:
type: object
properties:
_id:
description: The document ID associated with the operation.
oneOf:
- type: string
- type:
- string
- 'null'
_index:
description: 'The name of the index associated with the operation.
If the operation targeted a data stream, this is the backing index into which the document was written.'
type: string
status:
description: The HTTP status code returned for the operation.
type: number
failure_store:
allOf:
- $ref: '#/components/schemas/_global.bulk.FailureStoreStatus'
error:
description: 'Additional information about the failed operation.
The property is returned only for failed operations.'
allOf:
- $ref: '#/components/schemas/_types.ErrorCause'
_primary_term:
description: 'The primary term assigned to the document for the operation.
This property is returned only for successful operations.'
type: number
result:
description: 'The result of the operation.
Successful values are `created`, `deleted`, and `updated`.'
type: string
_seq_no:
description: 'The sequence number assigned to the document for the operation.
Sequence numbers are used to ensure an older version of a document doesn''t overwrite a newer version.'
allOf:
- $ref: '#/components/schemas/_types.SequenceNumber'
_shards:
description: Shard information for the operation.
allOf:
- $ref: '#/components/schemas/_types.ShardStatistics'
_version:
description: 'The document version associated with the operation.
The document version is incremented each time the document is updated.
This property is returned only for successful actions.'
allOf:
- $ref: '#/components/schemas/_types.VersionNumber'
forced_refresh:
type: boolean
get:
allOf:
- $ref: '#/components/schemas/_types.InlineGetDictUserDefined'
required:
- _index
- status
_global.search._types.HighlighterFragmenter:
type: string
enum:
- simple
- span
_types.aggregations.TDigest:
type: object
properties:
compression:
description: Limits the maximum number of nodes used by the underlying TDigest algorithm to `20 * compression`, enabling control of memory usage and approximation error.
type: number
execution_hint:
description: 'The default implementation of TDigest is optimized for performance, scaling to millions or even billions of sample values while maintaining acceptable accuracy levels (close to 1% relative error for millions of samples in some cases).
To use an implementation optimized for accuracy, set this parameter to high_accuracy instead.'
default: default
allOf:
- $ref: '#/components/schemas/_types.aggregations.TDigestExecutionHint'
_types.ScoreNormalizer:
type: string
enum:
- none
- minmax
- l2_norm
_types.InlineGet:
type: object
properties:
fields:
type: object
additionalProperties:
type: object
found:
type: boolean
_seq_no:
allOf:
- $ref: '#/components/schemas/_types.SequenceNumber'
_primary_term:
type: number
_routing:
allOf:
- $ref: '#/components/schemas/_types.Routing'
_source:
type: object
required:
- found
_types.query_dsl.CommonTermsQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
analyzer:
type: string
cutoff_frequency:
type: number
high_freq_operator:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.Operator'
low_freq_operator:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.Operator'
minimum_should_match:
allOf:
- $ref: '#/components/schemas/_types.MinimumShouldMatch'
query:
type: string
required:
- query
_types.query_dsl.RankFeatureFunctionSigmoid:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.RankFeatureFunction'
- type: object
properties:
pivot:
description: Configurable pivot value so that the result will be less than 0.5.
type: number
exponent:
description: Configurable Exponent.
type: number
required:
- pivot
- exponent
_types.aggregations.GeoTileGridAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
field:
description: 'Field containing indexed `geo_point` or `geo_shape` values.
If the field contains an array, `geotile_grid` aggregates all array values.'
allOf:
- $ref: '#/components/schemas/_types.Field'
precision:
description: 'Integer zoom of the key used to define cells/buckets in the results.
Values outside of the range [0,29] will be rejected.'
default: '7'
allOf:
- $ref: '#/components/schemas/_types.GeoTilePrecision'
shard_size:
description: 'Allows for more accurate counting of the top cells returned in the final result the aggregation.
Defaults to returning `max(10,(size x number-of-shards))` buckets from each shard.'
type: number
size:
description: The maximum number of buckets to return.
default: 10000.0
type: number
bounds:
description: A bounding box to filter the geo-points or geo-shapes in each bucket.
allOf:
- $ref: '#/components/schemas/_types.GeoBounds'
_types.aggregations.Aggregation:
type: object
_types.aggregations.AverageAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.FormatMetricAggregationBase'
- type: object
_types.query_dsl.FunctionScoreQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
boost_mode:
description: "Defines how he newly computed score is combined with the score of the query\n\nSupported values include:\n - `multiply`: Query score and function score are multiplied\n - `replace`: Only the function score is used.\nThe query score is ignored.\n - `sum`: Query score and function score are added\n - `avg`: Query score and function score are averaged\n - `max`: Max of query score and function score\n - `min`: Min of query score and function score\n\n"
default: multiply
allOf:
- $ref: '#/components/schemas/_types.query_dsl.FunctionBoostMode'
functions:
description: One or more functions that compute a new score for each document returned by the query.
type: array
items:
$ref: '#/components/schemas/_types.query_dsl.FunctionScoreContainer'
max_boost:
description: Restricts the new score to not exceed the provided limit.
type: number
min_score:
description: Excludes documents that do not meet the provided score threshold.
type: number
query:
description: A query that determines the documents for which a new score is computed.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
score_mode:
description: "Specifies how the computed scores are combined\n\nSupported values include:\n - `multiply`: Scores are multiplied.\n - `sum`: Scores are summed.\n - `avg`: Scores are averaged.\n - `first`: The first function that has a matching filter is applied.\n - `max`: Maximum score is used.\n - `min`: Minimum score is used.\n\n"
default: multiply
allOf:
- $ref: '#/components/schemas/_types.query_dsl.FunctionScoreMode'
_global.update_by_query_rethrottle.UpdateByQueryRethrottleNode:
allOf:
- $ref: '#/components/schemas/_spec_utils.BaseNode'
- type: object
properties:
tasks:
type: object
additionalProperties:
$ref: '#/components/schemas/tasks._types.TaskInfo'
required:
- tasks
_types.aggregations.MedianAbsoluteDeviationAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.FormatMetricAggregationBase'
- type: object
properties:
compression:
description: Limits the maximum number of nodes used by the underlying TDigest algorithm to `20 * compression`, enabling control of memory usage and approximation error.
default: 1000.0
type: number
execution_hint:
description: 'The default implementation of TDigest is optimized for performance, scaling to millions or even billions of sample values while maintaining acceptable accuracy levels (close to 1% relative error for millions of samples in some cases).
To use an implementation optimized for accuracy, set this parameter to high_accuracy instead.'
default: default
allOf:
- $ref: '#/components/schemas/_types.aggregations.TDigestExecutionHint'
_types.aggregations.MinimumInterval:
type: string
enum:
- second
- minute
- hour
- day
- month
- year
_types.query_dsl.SimpleQueryStringFlag:
type: string
enum:
- NONE
- AND
- NOT
- OR
- PREFIX
- PHRASE
- PRECEDENCE
- ESCAPE
- WHITESPACE
- FUZZY
- NEAR
- SLOP
- ALL
_types.HttpHeaders:
type: object
additionalProperties:
oneOf:
- type: string
- type: array
items:
type: string
_types.query_dsl.RangeQuery:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-range-query
oneOf:
- $ref: '#/components/schemas/_types.query_dsl.UntypedRangeQuery'
- $ref: '#/components/schemas/_types.query_dsl.DateRangeQuery'
- $ref: '#/components/schemas/_types.query_dsl.NumberRangeQuery'
- $ref: '#/components/schemas/_types.query_dsl.TermRangeQuery'
_global.reindex_rethrottle.ReindexNode:
allOf:
- $ref: '#/components/schemas/_spec_utils.BaseNode'
- type: object
properties:
tasks:
type: object
additionalProperties:
$ref: '#/components/schemas/_global.reindex_rethrottle.ReindexTask'
required:
- tasks
_types.aggregations.DateHistogramAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
calendar_interval:
description: 'Calendar-aware interval.
Can be specified using the unit name, such as `month`, or as a single unit quantity, such as `1M`.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.CalendarInterval'
extended_bounds:
description: Enables extending the bounds of the histogram beyond the data itself.
allOf:
- $ref: '#/components/schemas/_types.aggregations.ExtendedBoundsFieldDateMath'
hard_bounds:
description: Limits the histogram to specified bounds.
allOf:
- $ref: '#/components/schemas/_types.aggregations.ExtendedBoundsFieldDateMath'
field:
description: The date field whose values are use to build a histogram.
allOf:
- $ref: '#/components/schemas/_types.Field'
fixed_interval:
description: 'Fixed intervals: a fixed number of SI units and never deviate, regardless of where they fall on the calendar.'
allOf:
- $ref: '#/components/schemas/_types.Duration'
format:
description: 'The date format used to format `key_as_string` in the response.
If no `format` is specified, the first date format specified in the field mapping is used.'
type: string
interval:
deprecated: true
allOf:
- $ref: '#/components/schemas/_types.Duration'
min_doc_count:
description: 'Only returns buckets that have `min_doc_count` number of documents.
By default, all buckets between the first bucket that matches documents and the last one are returned.'
type: number
missing:
description: 'The value to apply to documents that do not have a value.
By default, documents without a value are ignored.'
allOf:
- $ref: '#/components/schemas/_types.DateTime'
offset:
description: Changes the start value of each bucket by the specified positive (`+`) or negative offset (`-`) duration.
allOf:
- $ref: '#/components/schemas/_types.Duration'
order:
description: The sort order of the returned buckets.
allOf:
- $ref: '#/components/schemas/_types.aggregations.AggregateOrder'
params:
type: object
additionalProperties:
type: object
script:
allOf:
- $ref: '#/components/schemas/_types.Script'
time_zone:
description: 'Time zone used for bucketing and rounding.
Defaults to Coordinated Universal Time (UTC).'
allOf:
- $ref: '#/components/schemas/_types.TimeZone'
keyed:
description: Set to `true` to associate a unique string key with each bucket and return the ranges as a hash rather than an array.
type: boolean
_types.aggregations.TermsExclude:
oneOf:
- type: string
- type: array
items:
type: string
_types.aggregations.CategorizeTextAnalyzer:
oneOf:
- type: string
- $ref: '#/components/schemas/_types.aggregations.CustomCategorizeTextAnalyzer'
_global.bulk.IndexOperation:
allOf:
- $ref: '#/components/schemas/_global.bulk.WriteOperation'
- type: object
_types.query_dsl.DistanceFeatureQueryBaseGeoLocationDistance:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
origin:
description: 'Date or point of origin used to calculate distances.
If the `field` value is a `date` or `date_nanos` field, the `origin` value must be a date.
Date Math, such as `now-1h`, is supported.
If the field value is a `geo_point` field, the `origin` value must be a geopoint.'
allOf:
- $ref: '#/components/schemas/_types.GeoLocation'
pivot:
description: 'Distance from the `origin` at which relevance scores receive half of the `boost` value.
If the `field` value is a `date` or `date_nanos` field, the `pivot` value must be a time unit, such as `1h` or `10d`. If the `field` value is a `geo_point` field, the `pivot` value must be a distance unit, such as `1km` or `12m`.'
allOf:
- $ref: '#/components/schemas/_types.Distance'
field:
description: 'Name of the field used to calculate distances. This field must meet the following criteria:
be a `date`, `date_nanos` or `geo_point` field;
have an `index` mapping parameter value of `true`, which is the default;
have an `doc_values` mapping parameter value of `true`, which is the default.'
allOf:
- $ref: '#/components/schemas/_types.Field'
required:
- origin
- pivot
- field
_types.aggregations.TopHitsAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.MetricAggregationBase'
- type: object
properties:
docvalue_fields:
description: Fields for which to return doc values.
type: array
items:
$ref: '#/components/schemas/_types.query_dsl.FieldAndFormat'
explain:
description: If `true`, returns detailed information about score computation as part of a hit.
default: false
type: boolean
fields:
description: 'Array of wildcard (*) patterns. The 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'
from:
description: Starting document offset.
default: 0.0
type: number
highlight:
description: Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in the search results.
allOf:
- $ref: '#/components/schemas/_global.search._types.Highlight'
script_fields:
description: Returns the result of one or more script evaluations for each hit.
type: object
additionalProperties:
$ref: '#/components/schemas/_types.ScriptField'
size:
description: The maximum number of top matching hits to return per bucket.
default: 3.0
type: number
sort:
description: 'Sort order of the top matching hits.
By default, the hits are sorted by the score of the main query.'
allOf:
- $ref: '#/components/schemas/_types.Sort'
_source:
description: Selects the fields of the source that are returned.
allOf:
- $ref: '#/components/schemas/_global.search._types.SourceConfig'
stored_fields:
description: Returns values for the specified stored fields (fields that use the `store` mapping option).
allOf:
- $ref: '#/components/schemas/_types.Fields'
track_scores:
description: If `true`, calculates and returns document scores, even if the scores are not used for sorting.
default: false
type: boolean
version:
description: If `true`, returns document version as part of a hit.
default: false
type: boolean
seq_no_primary_term:
description: If `true`, returns sequence number and primary term of the last modification of each hit.
type: boolean
_global.termvectors.Filter:
type: object
properties:
max_doc_freq:
description: 'Ignore words which occur in more than this many docs.
Defaults to unbounded.'
type: number
max_num_terms:
description: The maximum number of terms that must be returned per field.
default: 25.0
type: number
max_term_freq:
description: 'Ignore words with more than this frequency in the source doc.
It defaults to unbounded.'
type: number
max_word_length:
description: 'The maximum word length above which words will be ignored.
Defaults to unbounded.'
default: 0.0
type: number
min_doc_freq:
description: Ignore terms which do not occur in at least this many docs.
default: 1.0
type: number
min_term_freq:
description: Ignore words with less than this frequency in the source doc.
default: 1.0
type: number
min_word_length:
description: The minimum word length below which words will be ignored.
default: 0.0
type: number
_types.query_dsl.DecayFunctionBaseGeoLocationDistance:
type: object
properties:
multi_value_mode:
description: "Determines how the distance is calculated when a field used for computing the decay contains multiple values.\n\nSupported values include:\n - `min`: Distance is the minimum distance.\n - `max`: Distance is the maximum distance.\n - `avg`: Distance is the average distance.\n - `sum`: Distance is the sum of all distances.\n\n"
default: min
allOf:
- $ref: '#/components/schemas/_types.query_dsl.MultiValueMode'
_types.ScriptField:
type: object
properties:
script:
allOf:
- $ref: '#/components/schemas/_types.Script'
ignore_failure:
type: boolean
required:
- script
_types.ScoreSort:
type: object
properties:
order:
description: "\n\nSupported values include:\n - `asc`: Ascending (smallest to largest)\n - `desc`: Descending (largest to smallest)\n\n"
allOf:
- $ref: '#/components/schemas/_types.SortOrder'
_types.EpochTimeUnitMillis:
allOf:
- $ref: '#/components/schemas/_types.UnitMillis'
_types.GeoDistanceSort:
type: object
properties:
mode:
allOf:
- $ref: '#/components/schemas/_types.SortMode'
distance_type:
description: "\n\nSupported values include:\n - `arc`: The `arc` calculation is the most accurate.\n - `plane`: The `plane` calculation is faster but less accurate.\n\n"
allOf:
- $ref: '#/components/schemas/_types.GeoDistanceType'
ignore_unmapped:
type: boolean
order:
description: "\n\nSupported values include:\n - `asc`: Ascending (smallest to largest)\n - `desc`: Descending (largest to smallest)\n\n"
allOf:
- $ref: '#/components/schemas/_types.SortOrder'
unit:
allOf:
- $ref: '#/components/schemas/_types.DistanceUnit'
nested:
allOf:
- $ref: '#/components/schemas/_types.NestedSortValue'
tasks._types.TaskInfos:
oneOf:
- type: array
items:
$ref: '#/components/schemas/tasks._types.TaskInfo'
- type: object
additionalProperties:
$ref: '#/components/schemas/tasks._types.ParentTaskInfo'
_types.aggregations.AggregationRange:
type: object
properties:
from:
description: Start of the range (inclusive).
oneOf:
- type: number
- type:
- string
- 'null'
key:
description: Custom key to return the range with.
type: string
to:
description: End of the range (exclusive).
oneOf:
- type: number
- type:
- string
- 'null'
_types.aggregations.InferenceAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.PipelineAggregationBase'
- type: object
properties:
model_id:
description: The ID or alias for the trained model.
allOf:
- $ref: '#/components/schemas/_types.Name'
inference_config:
description: Contains the inference type and its options.
allOf:
- $ref: '#/components/schemas/_types.aggregations.InferenceConfigContainer'
required:
- model_id
_types.query_dsl.IntervalsContainer:
type: object
properties:
all_of:
description: Returns matches that span a combination of other rules.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsAllOf'
any_of:
description: Returns intervals produced by any of its sub-rules.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsAnyOf'
fuzzy:
description: Matches analyzed text.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsFuzzy'
match:
description: Matches analyzed text.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsMatch'
prefix:
description: Matches terms that start with a specified set of characters.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsPrefix'
range:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsRange'
regexp:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsRegexp'
wildcard:
description: Matches terms using a wildcard pattern.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsWildcard'
minProperties: 1
maxProperties: 1
_types.query_dsl.FunctionScoreMode:
type: string
enum:
- multiply
- sum
- avg
- first
- max
- min
_types.SpecifiedDocument:
type: object
properties:
index:
allOf:
- $ref: '#/components/schemas/_types.IndexName'
id:
allOf:
- $ref: '#/components/schemas/_types.Id'
required:
- id
_types.query_dsl.RankFeatureQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
field:
description: '`rank_feature` or `rank_features` field used to boost relevance scores.'
allOf:
- $ref: '#/components/schemas/_types.Field'
saturation:
description: Saturation function used to boost relevance scores based on the value of the rank feature `field`.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.RankFeatureFunctionSaturation'
log:
description: Logarithmic function used to boost relevance scores based on the value of the rank feature `field`.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.RankFeatureFunctionLogarithm'
linear:
description: Linear function used to boost relevance scores based on the value of the rank feature `field`.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.RankFeatureFunctionLinear'
sigmoid:
description: Sigmoid function used to boost relevance scores based on the value of the rank feature `field`.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.RankFeatureFunctionSigmoid'
required:
- field
_types.ErrorCause:
description: 'Cause and details about a request failure. This class defines the properties common to all error types.
Additional details are also provided, that depend on the error type.'
type: object
properties:
type:
description: The type of error
type: string
reason:
description: A human-readable explanation of the error, in English.
oneOf:
- type: string
- type:
- string
- 'null'
stack_trace:
description: The server stack trace. Present only if the `error_trace=true` parameter was sent with the request.
type: string
caused_by:
allOf:
- $ref: '#/components/schemas/_types.ErrorCause'
root_cause:
type: array
items:
$ref: '#/components/schemas/_types.ErrorCause'
suppressed:
type: array
items:
$ref: '#/components/schemas/_types.ErrorCause'
required:
- type
_types.aggregations.GeoBoundsAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.MetricAggregationBase'
- type: object
properties:
wrap_longitude:
description: Specifies whether the bounding box should be allowed to overlap the international date line.
default: true
type: boolean
_types.query_dsl.ScriptQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
script:
description: 'Contains a script to run as a query.
This script must return a boolean value, `true` or `false`.'
allOf:
- $ref: '#/components/schemas/_types.Script'
required:
- script
_types.TaskFailure:
type: object
properties:
task_id:
type: number
node_id:
allOf:
- $ref: '#/components/schemas/_types.NodeId'
status:
type: string
reason:
allOf:
- $ref: '#/components/schemas/_types.ErrorCause'
required:
- task_id
- node_id
- status
- reason
_types.query_dsl.FieldValueFactorScoreFunction:
type: object
properties:
field:
description: Field to be extracted from the document.
allOf:
- $ref: '#/components/schemas/_types.Field'
factor:
description: Optional factor to multiply the field value with.
default: 1.0
type: number
missing:
description: 'Value used if the document doesn’t have that field.
The modifier and factor are still applied to it as though it were read from the document.'
type: number
modifier:
description: "Modifier to apply to the field value.\n\nSupported values include:\n - `none`: Do not apply any multiplier to the field value.\n - `log`: Take the common logarithm of the field value.\nBecause this function will return a negative value and cause an error if used on values between 0 and 1, it is recommended to use `log1p` instead.\n - `log1p`: Add 1 to the field value and take the common logarithm.\n - `log2p`: Add 2 to the field value and take the common logarithm.\n - `ln`: Take the natural logarithm of the field value.\nBecause this function will return a negative value and cause an error if used on values between 0 and 1, it is recommended to use `ln1p` instead.\n - `ln1p`: Add 1 to the field value and take the natural logarithm.\n - `ln2p`: Add 2 to the field value and take the natural logarithm.\n - `square`: Square the field value (multiply it by itself).\n - `sqrt`: Take the square root of the field value.\n - `reciprocal`: Reciprocate the field value, same as `1/x` where `x` is the field’s value.\n\n"
allOf:
- $ref: '#/components/schemas/_types.query_dsl.FieldValueFactorModifier'
required:
- field
_global.mget.ResponseItem:
oneOf:
- $ref: '#/components/schemas/_global.get.GetResult'
- $ref: '#/components/schemas/_global.mget.MultiGetError'
_types.aggregations.MultiTermsAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
collect_mode:
description: "Specifies the strategy for data collection.\n\nSupported values include:\n - `depth_first`: Expands all branches of the aggregation tree in one depth-first pass, before any pruning occurs.\n - `breadth_first`: Caches the set of documents that fall into the uppermost buckets for subsequent replay.\n\n"
default: breadth_first
allOf:
- $ref: '#/components/schemas/_types.aggregations.TermsAggregationCollectMode'
order:
description: 'Specifies the sort order of the buckets.
Defaults to sorting by descending document count.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.AggregateOrder'
min_doc_count:
description: The minimum number of documents in a bucket for it to be returned.
default: 1.0
type: number
shard_min_doc_count:
description: The minimum number of documents in a bucket on each shard for it to be returned.
default: 1.0
type: number
shard_size:
description: 'The number of candidate terms produced by each shard.
By default, `shard_size` will be automatically estimated based on the number of shards and the `size` parameter.'
type: number
show_term_doc_count_error:
description: Calculates the doc count error on per term basis.
default: false
type: boolean
size:
description: The number of term buckets should be returned out of the overall terms list.
default: 10.0
type: number
terms:
description: The field from which to generate sets of terms.
type: array
items:
$ref: '#/components/schemas/_types.aggregations.MultiTermLookup'
required:
- terms
_types.TimeZone:
type: string
_types.aggregations.ReverseNestedAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
path:
description: 'Defines the nested object field that should be joined back to.
The default is empty, which means that it joins back to the root/main document level.'
allOf:
- $ref: '#/components/schemas/_types.Field'
_types.query_dsl.DistanceFeatureQuery:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-distance-feature-query
oneOf:
- $ref: '#/components/schemas/_types.query_dsl.UntypedDistanceFeatureQuery'
- $ref: '#/components/schemas/_types.query_dsl.GeoDistanceFeatureQuery'
- $ref: '#/components/schemas/_types.query_dsl.DateDistanceFeatureQuery'
_global.reindex.Source:
type: object
properties:
index:
description: 'The name of the data stream, index, or alias you are copying from.
It accepts a comma-separated list to reindex from multiple sources.'
allOf:
- $ref: '#/components/schemas/_types.Indices'
query:
description: The documents to reindex, which is defined with Query DSL.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
remote:
description: A remote instance of Elasticsearch that you want to index from.
x-state: Generally available; Added in 5.0.0
allOf:
- $ref: '#/components/schemas/_global.reindex.RemoteSource'
size:
description: 'The number of documents to index per batch.
Use it when you are indexing from remote to ensure that the batches fit within the on-heap buffer, which defaults to a maximum size of 100 MB.'
default: 1000.0
type: number
slice:
description: Slice the reindex request manually using the provided slice ID and total number of slices.
allOf:
- $ref: '#/components/schemas/_types.SlicedScroll'
sort:
deprecated: true
description: 'A comma-separated list of `:` pairs to sort by before indexing.
Use it in conjunction with `max_docs` to control what documents are reindexed.
WARNING: Sort in reindex is deprecated.
Sorting in reindex was never guaranteed to index documents in order and prevents further development of reindex such as resilience and performance improvements.
If used in combination with `max_docs`, consider using a query filter instead.'
allOf:
- $ref: '#/components/schemas/_types.Sort'
_source:
description: 'If `true`, reindex all source fields.
Set it to a list to reindex select fields.'
default: 'true'
allOf:
- $ref: '#/components/schemas/_global.search._types.SourceConfig'
runtime_mappings:
allOf:
- $ref: '#/components/schemas/_types.mapping.RuntimeFields'
required:
- index
_types.aggregations.MovingPercentilesAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.PipelineAggregationBase'
- type: object
properties:
window:
description: The size of window to "slide" across the histogram.
type: number
shift:
description: 'By default, the window consists of the last n values excluding the current bucket.
Increasing `shift` by 1, moves the starting window position by 1 to the right.'
default: 0.0
type: number
keyed:
type: boolean
_types.aggregations.CompositeAggregationBase:
type: object
properties:
field:
description: Either `field` or `script` must be present
allOf:
- $ref: '#/components/schemas/_types.Field'
missing_bucket:
type: boolean
missing_order:
allOf:
- $ref: '#/components/schemas/_types.aggregations.MissingOrder'
script:
description: Either `field` or `script` must be present
allOf:
- $ref: '#/components/schemas/_types.Script'
value_type:
allOf:
- $ref: '#/components/schemas/_types.aggregations.ValueType'
order:
description: "\n\nSupported values include:\n - `asc`: Ascending (smallest to largest)\n - `desc`: Descending (largest to smallest)\n\n"
allOf:
- $ref: '#/components/schemas/_types.SortOrder'
_types.aggregations.SerialDifferencingAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.PipelineAggregationBase'
- type: object
properties:
lag:
description: 'The historical bucket to subtract from the current value.
Must be a positive, non-zero integer.'
type: number
_types.mapping.RuntimeFields:
type: object
additionalProperties:
$ref: '#/components/schemas/_types.mapping.RuntimeField'
_types.aggregations.NestedAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
path:
description: The path to the field of type `nested`.
allOf:
- $ref: '#/components/schemas/_types.Field'
_types.query_dsl.QueryContainer:
externalDocs:
url: https://www.elastic.co/docs/explore-analyze/query-filter/languages/querydsl
description: An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.
type: object
properties:
bool:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-bool-query
description: matches documents matching boolean combinations of other queries.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.BoolQuery'
boosting:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-boosting-query
description: Returns documents matching a `positive` query while reducing the relevance score of documents that also match a `negative` query.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.BoostingQuery'
common:
deprecated: true
type: object
additionalProperties:
$ref: '#/components/schemas/_types.query_dsl.CommonTermsQuery'
minProperties: 1
maxProperties: 1
combined_fields:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-combined-fields-query
description: The `combined_fields` query supports searching multiple text fields as if their contents had been indexed into one combined field.
x-state: Generally available; Added in 7.13.0
allOf:
- $ref: '#/components/schemas/_types.query_dsl.CombinedFieldsQuery'
constant_score:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-constant-score-query
description: Wraps a filter query and returns every matching document with a relevance score equal to the `boost` parameter value.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.ConstantScoreQuery'
dis_max:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-dis-max-query
description: 'Returns documents matching one or more wrapped queries, called query clauses or clauses.
If a returned document matches multiple query clauses, the `dis_max` query assigns the document the highest relevance score from any matching clause, plus a tie breaking increment for any additional matching subqueries.'
allOf:
- $ref: '#/components/schemas/_types.query_dsl.DisMaxQuery'
distance_feature:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-distance-feature-query
description: 'Boosts the relevance score of documents closer to a provided origin date or point.
For example, you can use this query to give more weight to documents closer to a certain date or location.'
allOf:
- $ref: '#/components/schemas/_types.query_dsl.DistanceFeatureQuery'
exists:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-exists-query
description: Returns documents that contain an indexed value for a field.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.ExistsQuery'
function_score:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-function-score-query
description: The `function_score` enables you to modify the score of documents that are retrieved by a query.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.FunctionScoreQuery'
fuzzy:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-fuzzy-query
description: Returns documents that contain terms similar to the search term, as measured by a Levenshtein edit distance.
type: object
additionalProperties:
$ref: '#/components/schemas/_types.query_dsl.FuzzyQuery'
minProperties: 1
maxProperties: 1
geo_bounding_box:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-geo-bounding-box-query
description: Matches geo_point and geo_shape values that intersect a bounding box.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.GeoBoundingBoxQuery'
geo_distance:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-geo-distance-query
description: Matches `geo_point` and `geo_shape` values within a given distance of a geopoint.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.GeoDistanceQuery'
geo_grid:
description: Matches `geo_point` and `geo_shape` values that intersect a grid cell from a GeoGrid aggregation.
type: object
additionalProperties:
$ref: '#/components/schemas/_types.query_dsl.GeoGridQuery'
minProperties: 1
maxProperties: 1
geo_polygon:
deprecated: true
allOf:
- $ref: '#/components/schemas/_types.query_dsl.GeoPolygonQuery'
geo_shape:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-geo-shape-query
description: Filter documents indexed using either the `geo_shape` or the `geo_point` type.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.GeoShapeQuery'
has_child:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-has-child-query
description: Returns parent documents whose joined child documents match a provided query.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.HasChildQuery'
has_parent:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-has-parent-query
description: Returns child documents whose joined parent document matches a provided query.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.HasParentQuery'
ids:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-ids-query
description: 'Returns documents based on their IDs.
This query uses document IDs stored in the `_id` field.'
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IdsQuery'
intervals:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-intervals-query
description: Returns documents based on the order and proximity of matching terms.
type: object
additionalProperties:
$ref: '#/components/schemas/_types.query_dsl.IntervalsQuery'
minProperties: 1
maxProperties: 1
knn:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-knn-query
description: 'Finds the k nearest vectors to a query vector, as measured by a similarity
metric. knn query finds nearest vectors through approximate search on indexed
dense_vectors.'
allOf:
- $ref: '#/components/schemas/_types.KnnQuery'
match:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-match-query
description: 'Returns documents that match a provided text, number, date or boolean value.
The provided text is analyzed before matching.'
type: object
additionalProperties:
$ref: '#/components/schemas/_types.query_dsl.MatchQuery'
minProperties: 1
maxProperties: 1
match_all:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-match-all-query
description: Matches all documents, giving them all a `_score` of 1.0.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.MatchAllQuery'
match_bool_prefix:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-match-bool-prefix-query
description: 'Analyzes its input and constructs a `bool` query from the terms.
Each term except the last is used in a `term` query.
The last term is used in a prefix query.'
type: object
additionalProperties:
$ref: '#/components/schemas/_types.query_dsl.MatchBoolPrefixQuery'
minProperties: 1
maxProperties: 1
match_none:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-match-all-query#query-dsl-match-none-query
description: Matches no documents.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.MatchNoneQuery'
match_phrase:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-match-query-phrase
description: Analyzes the text and creates a phrase query out of the analyzed text.
type: object
additionalProperties:
$ref: '#/components/schemas/_types.query_dsl.MatchPhraseQuery'
minProperties: 1
maxProperties: 1
match_phrase_prefix:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-match-query-phrase-prefix
description: 'Returns documents that contain the words of a provided text, in the same order as provided.
The last term of the provided text is treated as a prefix, matching any words that begin with that term.'
type: object
additionalProperties:
$ref: '#/components/schemas/_types.query_dsl.MatchPhrasePrefixQuery'
minProperties: 1
maxProperties: 1
more_like_this:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-mlt-query
description: Returns documents that are "like" a given set of documents.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.MoreLikeThisQuery'
multi_match:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-multi-match-query
description: 'Enables you to search for a provided text, number, date or boolean value across multiple fields.
The provided text is analyzed before matching.'
allOf:
- $ref: '#/components/schemas/_types.query_dsl.MultiMatchQuery'
nested:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-nested-query
description: 'Wraps another query to search nested fields.
If an object matches the search, the nested query returns the root parent document.'
allOf:
- $ref: '#/components/schemas/_types.query_dsl.NestedQuery'
parent_id:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-parent-id-query
description: Returns child documents joined to a specific parent document.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.ParentIdQuery'
percolate:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-percolate-query
description: Matches queries stored in an index.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.PercolateQuery'
pinned:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-pinned-query
description: Promotes selected documents to rank higher than those matching a given query.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.PinnedQuery'
prefix:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-prefix-query
description: Returns documents that contain a specific prefix in a provided field.
type: object
additionalProperties:
$ref: '#/components/schemas/_types.query_dsl.PrefixQuery'
minProperties: 1
maxProperties: 1
query_string:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-query-string-query
description: Returns documents based on a provided query string, using a parser with a strict syntax.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryStringQuery'
range:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-range-query
description: Returns documents that contain terms within a provided range.
type: object
additionalProperties:
$ref: '#/components/schemas/_types.query_dsl.RangeQuery'
minProperties: 1
maxProperties: 1
rank_feature:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-rank-feature-query
description: Boosts the relevance score of documents based on the numeric value of a `rank_feature` or `rank_features` field.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.RankFeatureQuery'
regexp:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-regexp-query
description: Returns documents that contain terms matching a regular expression.
type: object
additionalProperties:
$ref: '#/components/schemas/_types.query_dsl.RegexpQuery'
minProperties: 1
maxProperties: 1
rule:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.RuleQuery'
script:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-script-query
description: 'Filters documents based on a provided script.
The script query is typically used in a filter context.'
allOf:
- $ref: '#/components/schemas/_types.query_dsl.ScriptQuery'
script_score:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-script-score-query
description: Uses a script to provide a custom score for returned documents.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.ScriptScoreQuery'
semantic:
description: A semantic query to semantic_text field types
x-state: Generally available; Added in 8.15.0
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SemanticQuery'
shape:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-shape-query
description: Queries documents that contain fields indexed using the `shape` type.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.ShapeQuery'
simple_query_string:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-simple-query-string-query
description: Returns documents based on a provided query string, using a parser with a limited but fault-tolerant syntax.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SimpleQueryStringQuery'
span_containing:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-span-containing-query
description: Returns matches which enclose another span query.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanContainingQuery'
span_field_masking:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-span-field-masking-query
description: Wrapper to allow span queries to participate in composite single-field span queries by _lying_ about their search field.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanFieldMaskingQuery'
span_first:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-span-first-query
description: Matches spans near the beginning of a field.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanFirstQuery'
span_multi:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-span-multi-term-query
description: Allows you to wrap a multi term query (one of `wildcard`, `fuzzy`, `prefix`, `range`, or `regexp` query) as a `span` query, so it can be nested.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanMultiTermQuery'
span_near:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-span-near-query
description: 'Matches spans which are near one another.
You can specify `slop`, the maximum number of intervening unmatched positions, as well as whether matches are required to be in-order.'
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanNearQuery'
span_not:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-span-not-query
description: Removes matches which overlap with another span query or which are within x tokens before (controlled by the parameter `pre`) or y tokens after (controlled by the parameter `post`) another span query.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanNotQuery'
span_or:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-span-query
description: Matches the union of its span clauses.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanOrQuery'
span_term:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-span-term-query
description: Matches spans containing a term.
type: object
additionalProperties:
$ref: '#/components/schemas/_types.query_dsl.SpanTermQuery'
minProperties: 1
maxProperties: 1
span_within:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-span-within-query
description: Returns matches which are enclosed inside another span query.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanWithinQuery'
sparse_vector:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-sparse-vector-query
description: Using input query vectors or a natural language processing model to convert a query into a list of token-weight pairs, queries against a sparse vector field.
x-state: Generally available; Added in 8.15.0
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SparseVectorQuery'
term:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-term-query
description: 'Returns documents that contain an exact term in a provided field.
To return a document, the query term must exactly match the queried field''s value, including whitespace and capitalization.'
type: object
additionalProperties:
$ref: '#/components/schemas/_types.query_dsl.TermQuery'
minProperties: 1
maxProperties: 1
terms:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-terms-query
description: 'Returns documents that contain one or more exact terms in a provided field.
To return a document, one or more terms must exactly match a field value, including whitespace and capitalization.'
allOf:
- $ref: '#/components/schemas/_types.query_dsl.TermsQuery'
terms_set:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-terms-set-query
description: 'Returns documents that contain a minimum number of exact terms in a provided field.
To return a document, a required number of terms must exactly match the field values, including whitespace and capitalization.'
type: object
additionalProperties:
$ref: '#/components/schemas/_types.query_dsl.TermsSetQuery'
minProperties: 1
maxProperties: 1
text_expansion:
deprecated: true
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-text-expansion-query
description: Uses a natural language processing model to convert the query text into a list of token-weight pairs which are then used in a query against a sparse vector or rank features field.
x-state: Generally available; Added in 8.8.0
type: object
additionalProperties:
$ref: '#/components/schemas/_types.query_dsl.TextExpansionQuery'
minProperties: 1
maxProperties: 1
weighted_tokens:
deprecated: true
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-weighted-tokens-query
description: Supports returning text_expansion query results by sending in precomputed tokens with the query.
x-state: Generally available; Added in 8.13.0
type: object
additionalProperties:
$ref: '#/components/schemas/_types.query_dsl.WeightedTokensQuery'
minProperties: 1
maxProperties: 1
wildcard:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-wildcard-query
description: Returns documents that contain terms matching a wildcard pattern.
type: object
additionalProperties:
$ref: '#/components/schemas/_types.query_dsl.WildcardQuery'
minProperties: 1
maxProperties: 1
wrapper:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-wrapper-query
description: A query that accepts any other query as base64 encoded string.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.WrapperQuery'
type:
deprecated: true
allOf:
- $ref: '#/components/schemas/_types.query_dsl.TypeQuery'
minProperties: 1
maxProperties: 1
_types.KnnQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
field:
description: The name of the vector field to search against
allOf:
- $ref: '#/components/schemas/_types.Field'
query_vector:
description: The query vector
allOf:
- $ref: '#/components/schemas/_types.QueryVector'
query_vector_builder:
description: The query vector builder. You must provide a query_vector_builder or query_vector, but not both.
allOf:
- $ref: '#/components/schemas/_types.QueryVectorBuilder'
num_candidates:
description: The number of nearest neighbor candidates to consider per shard
type: number
visit_percentage:
description: The percentage of vectors to explore per shard while doing knn search with bbq_disk
x-state: Generally available; Added in 9.2.0
type: number
k:
description: The final number of nearest neighbors to return as top hits
type: number
filter:
description: Filters for the kNN search query
oneOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
- type: array
items:
$ref: '#/components/schemas/_types.query_dsl.QueryContainer'
similarity:
description: The minimum similarity for a vector to be considered a match
type: number
rescore_vector:
description: Apply oversampling and rescoring to quantized vectors
x-state: Generally available; Added in 8.18.0
allOf:
- $ref: '#/components/schemas/_types.RescoreVector'
required:
- field
_types.SortResults:
type: array
items:
$ref: '#/components/schemas/_types.FieldValue'
_types.aggregations.BucketAggregationBase:
description: Base type for bucket aggregations. These aggregations also accept sub-aggregations.
allOf:
- $ref: '#/components/schemas/_types.aggregations.Aggregation'
- type: object
_global.search._types.HighlighterOrder:
type: string
enum:
- score
_types.ExpandWildcards:
oneOf:
- $ref: '#/components/schemas/_types.ExpandWildcard'
- type: array
items:
$ref: '#/components/schemas/_types.ExpandWildcard'
_types.query_dsl.CombinedFieldsOperator:
type: string
enum:
- or
- and
_types.aggregations.IpRangeAggregationRange:
type: object
properties:
from:
description: Start of the range.
oneOf:
- type: string
- type:
- string
- 'null'
mask:
description: IP range defined as a CIDR mask.
type: string
to:
description: End of the range.
oneOf:
- type: string
- type:
- string
- 'null'
_global.mget.Operation:
type: object
properties:
_id:
description: The unique document ID.
allOf:
- $ref: '#/components/schemas/_types.Id'
_index:
description: The index that contains the document.
allOf:
- $ref: '#/components/schemas/_types.IndexName'
routing:
description: The key for the primary shard the document resides on. Required if routing is used during indexing.
allOf:
- $ref: '#/components/schemas/_types.Routing'
_source:
description: If `false`, excludes all _source fields.
allOf:
- $ref: '#/components/schemas/_global.search._types.SourceConfig'
stored_fields:
description: The stored fields you want to retrieve.
allOf:
- $ref: '#/components/schemas/_types.Fields'
version:
allOf:
- $ref: '#/components/schemas/_types.VersionNumber'
version_type:
description: "\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"
allOf:
- $ref: '#/components/schemas/_types.VersionType'
required:
- _id
_types.query_dsl.RankFeatureFunctionLogarithm:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.RankFeatureFunction'
- type: object
properties:
scaling_factor:
description: Configurable scaling factor.
type: number
required:
- scaling_factor
_types.WaitForActiveShardOptions:
type: string
enum:
- all
- index-setting
_types.aggregations.TermsAggregationExecutionHint:
type: string
enum:
- map
- global_ordinals
- global_ordinals_hash
- global_ordinals_low_cardinality
_types.query_dsl.RangeQueryBaseDateMath:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
relation:
description: "Indicates how the range query matches values for `range` fields.\n\nSupported values include:\n - `within`: Matches documents with a range field value entirely within the query’s range.\n - `contains`: Matches documents with a range field value that entirely contains the query’s range.\n - `intersects`: Matches documents with a range field value that intersects the query’s range.\n\n"
default: intersects
allOf:
- $ref: '#/components/schemas/_types.query_dsl.RangeRelation'
gt:
description: Greater than.
allOf:
- $ref: '#/components/schemas/_types.DateMath'
gte:
description: Greater than or equal to.
allOf:
- $ref: '#/components/schemas/_types.DateMath'
lt:
description: Less than.
allOf:
- $ref: '#/components/schemas/_types.DateMath'
lte:
description: Less than or equal to.
allOf:
- $ref: '#/components/schemas/_types.DateMath'
_types.aggregations.BoxplotAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.MetricAggregationBase'
- type: object
properties:
compression:
description: Limits the maximum number of nodes used by the underlying TDigest algorithm to `20 * compression`, enabling control of memory usage and approximation error.
type: number
execution_hint:
description: 'The default implementation of TDigest is optimized for performance, scaling to millions or even billions of sample values while maintaining acceptable accuracy levels (close to 1% relative error for millions of samples in some cases).
To use an implementation optimized for accuracy, set this parameter to high_accuracy instead.'
default: default
allOf:
- $ref: '#/components/schemas/_types.aggregations.TDigestExecutionHint'
_types.aggregations.ValueType:
type: string
enum:
- string
- long
- double
- number
- date
- date_nanos
- ip
- numeric
- geo_point
- boolean
_global.search._types.BoundaryScanner:
type: string
enum:
- chars
- sentence
- word
_types.query_dsl.PinnedQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-pinned-query
allOf:
- type: object
properties:
organic:
description: Any choice of query used to rank documents which will be ranked below the "pinned" documents.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
required:
- organic
- type: object
properties:
ids:
description: 'Document IDs listed in the order they are to appear in results.
Required if `docs` is not specified.'
type: array
items:
$ref: '#/components/schemas/_types.Id'
docs:
description: 'Documents listed in the order they are to appear in results.
Required if `ids` is not specified.'
type: array
items:
$ref: '#/components/schemas/_types.query_dsl.PinnedDoc'
minProperties: 1
maxProperties: 1
_types.aggregations.DateRangeExpression:
type: object
properties:
from:
description: Start of the range (inclusive).
allOf:
- $ref: '#/components/schemas/_types.aggregations.FieldDateMath'
key:
description: Custom key to return the range with.
type: string
to:
description: End of the range (exclusive).
allOf:
- $ref: '#/components/schemas/_types.aggregations.FieldDateMath'
_types.aggregations.TermsAggregationCollectMode:
type: string
enum:
- depth_first
- breadth_first
_types.aggregations.BucketCorrelationFunction:
type: object
properties:
count_correlation:
description: The configuration to calculate a count correlation. This function is designed for determining the correlation of a term value and a given metric.
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketCorrelationFunctionCountCorrelation'
required:
- count_correlation
_types.query_dsl.IntervalsAnyOf:
type: object
properties:
intervals:
description: An array of rules to match.
type: array
items:
$ref: '#/components/schemas/_types.query_dsl.IntervalsContainer'
filter:
description: Rule used to filter returned intervals.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsFilter'
required:
- intervals
_types.aggregations.BucketSelectorAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.PipelineAggregationBase'
- type: object
properties:
script:
description: The script to run for this aggregation.
allOf:
- $ref: '#/components/schemas/_types.Script'
_types.UnitMillis:
description: Time unit for milliseconds
type: number
_types.ChunkRescorer:
type: object
properties:
size:
description: The number of chunks per document to evaluate for reranking.
type: number
chunking_settings:
description: Chunking settings to apply
allOf:
- $ref: '#/components/schemas/_types.mapping.ChunkRescorerChunkingSettings'
_types.query_dsl.RandomScoreFunction:
type: object
properties:
field:
allOf:
- $ref: '#/components/schemas/_types.Field'
seed:
oneOf:
- type: number
- type: string
_types.RRFRetrieverComponent:
description: Wraps a retriever with an optional weight for RRF scoring.
type: object
properties:
retriever:
description: The nested retriever configuration.
allOf:
- $ref: '#/components/schemas/_types.RetrieverContainer'
weight:
description: Weight multiplier for this retriever's contribution to the RRF score. Higher values increase influence. Defaults to 1.0 if not specified. Must be non-negative.
default: 1.0
type: number
required:
- retriever
_types.BulkIndexByScrollFailure:
type: object
properties:
cause:
allOf:
- $ref: '#/components/schemas/_types.ErrorCause'
id:
allOf:
- $ref: '#/components/schemas/_types.Id'
index:
allOf:
- $ref: '#/components/schemas/_types.IndexName'
status:
type: number
required:
- cause
- id
- index
- status
_types.query_dsl.PinnedDoc:
type: object
properties:
_id:
description: The unique document ID.
allOf:
- $ref: '#/components/schemas/_types.Id'
_index:
description: The index that contains the document.
allOf:
- $ref: '#/components/schemas/_types.IndexName'
required:
- _id
_types.aggregations.DerivativeAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.PipelineAggregationBase'
- type: object
_types.SearchType:
type: string
enum:
- query_then_fetch
- dfs_query_then_fetch
ml._types.RegressionInferenceOptions:
type: object
properties:
results_field:
description: The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.
allOf:
- $ref: '#/components/schemas/_types.Field'
num_top_feature_importance_values:
description: Specifies the maximum number of feature importance values per document.
default: 0.0
type: number
_types.DiversifyRetriever:
allOf:
- $ref: '#/components/schemas/_types.RetrieverBase'
- type: object
properties:
type:
description: The diversification strategy to apply.
allOf:
- $ref: '#/components/schemas/_types.DiversifyRetrieverTypes'
field:
description: The document field on which to diversify results on.
type: string
retriever:
description: The nested retriever whose results will be diversified.
allOf:
- $ref: '#/components/schemas/_types.RetrieverContainer'
size:
description: The number of top documents to return after diversification.
type: number
rank_window_size:
description: The number of top documents from the nested retriever to consider for diversification.
type: number
query_vector:
description: The query vector used for diversification.
allOf:
- $ref: '#/components/schemas/_types.QueryVector'
query_vector_builder:
description: a dense vector query vector builder to use instead of a static query_vector
allOf:
- $ref: '#/components/schemas/_types.QueryVectorBuilder'
lambda:
description: Controls the trade-off between relevance and diversity for MMR. A value of 0.0 focuses solely on diversity, while a value of 1.0 focuses solely on relevance. Required for MMR
type: number
required:
- type
- field
- retriever
_global.bulk.UpdateOperation:
allOf:
- $ref: '#/components/schemas/_global.bulk.OperationBase'
- type: object
properties:
require_alias:
description: If `true`, the request's actions must target an index alias.
default: false
type: boolean
retry_on_conflict:
description: The number of times an update should be retried in the case of a version conflict.
type: number
_types.query_dsl.RankFeatureFunctionSaturation:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.RankFeatureFunction'
- type: object
properties:
pivot:
description: Configurable pivot value so that the result will be less than 0.5.
type: number
_global.search._types.HighlighterTagsSchema:
type: string
enum:
- styled
_types.query_dsl.DecayFunctionBase:
type: object
properties:
multi_value_mode:
description: "Determines how the distance is calculated when a field used for computing the decay contains multiple values.\n\nSupported values include:\n - `min`: Distance is the minimum distance.\n - `max`: Distance is the maximum distance.\n - `avg`: Distance is the average distance.\n - `sum`: Distance is the sum of all distances.\n\n"
default: min
allOf:
- $ref: '#/components/schemas/_types.query_dsl.MultiValueMode'
_types.RuleRetriever:
allOf:
- $ref: '#/components/schemas/_types.RetrieverBase'
- type: object
properties:
ruleset_ids:
description: The ruleset IDs containing the rules this retriever is evaluating against.
oneOf:
- $ref: '#/components/schemas/_types.Id'
- type: array
items:
$ref: '#/components/schemas/_types.Id'
match_criteria:
description: The match criteria that will determine if a rule in the provided rulesets should be applied.
type: object
retriever:
description: The retriever whose results rules should be applied to.
allOf:
- $ref: '#/components/schemas/_types.RetrieverContainer'
rank_window_size:
description: This value determines the size of the individual result set.
type: number
required:
- ruleset_ids
- match_criteria
- retriever
_types.aggregations.Missing:
oneOf:
- type: string
- type: number
- type: number
- type: boolean
_types.aggregations.BucketCorrelationFunctionCountCorrelation:
type: object
properties:
indicator:
description: The indicator with which to correlate the configured `bucket_path` values.
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketCorrelationFunctionCountCorrelationIndicator'
required:
- indicator
_spec_utils.PipeSeparatedFlagsSimpleQueryStringFlag:
description: 'A set of flags that can be represented as a single enum value or a set of values that are encoded
as a pipe-separated string
Depending on the target language, code generators can use this hint to generate language specific
flags enum constructs and the corresponding (de-)serialization code.'
oneOf:
- $ref: '#/components/schemas/_types.query_dsl.SimpleQueryStringFlag'
- type: string
_types.aggregations.FieldDateMath:
description: 'A date range limit, represented either as a DateMath expression or a number expressed
according to the target field''s precision.'
oneOf:
- $ref: '#/components/schemas/_types.DateMath'
- type: number
_types.query_dsl.SpanContainingQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
big:
description: 'Can be any span query.
Matching spans from `big` that contain matches from `little` are returned.'
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanQuery'
little:
description: 'Can be any span query.
Matching spans from `big` that contain matches from `little` are returned.'
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanQuery'
required:
- big
- little
_types.query_dsl.FuzzyQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
max_expansions:
description: Maximum number of variations created.
default: 50.0
type: number
prefix_length:
description: Number of beginning characters left unchanged when creating expansions.
default: 0.0
type: number
rewrite:
description: Number of beginning characters left unchanged when creating expansions.
default: constant_score
allOf:
- $ref: '#/components/schemas/_types.MultiTermQueryRewrite'
transpositions:
description: Indicates whether edits include transpositions of two adjacent characters (for example `ab` to `ba`).
default: true
type: boolean
fuzziness:
description: Maximum edit distance allowed for matching.
allOf:
- $ref: '#/components/schemas/_types.Fuzziness'
value:
description: Term you wish to find in the provided field.
oneOf:
- type: string
- type: number
- type: boolean
required:
- value
_global.search._types.RescoreQuery:
type: object
properties:
rescore_query:
description: 'The query to use for rescoring.
This query is only run on the Top-K results returned by the `query` and `post_filter` phases.'
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
query_weight:
description: Relative importance of the original query versus the rescore query.
default: 1.0
type: number
rescore_query_weight:
description: Relative importance of the rescore query versus the original query.
default: 1.0
type: number
score_mode:
description: "Determines how scores are combined.\n\nSupported values include:\n - `avg`: Average the original score and the rescore query score.\n - `max`: Take the max of original score and the rescore query score.\n - `min`: Take the min of the original score and the rescore query score.\n - `multiply`: Multiply the original score by the rescore query score.\nUseful for `function` query rescores.\n - `total`: Add the original score and the rescore query score.\n\n"
default: total
allOf:
- $ref: '#/components/schemas/_global.search._types.ScoreMode'
required:
- rescore_query
_types.aggregations.TopMetricsValue:
type: object
properties:
field:
description: A field to return as a metric.
allOf:
- $ref: '#/components/schemas/_types.Field'
required:
- field
_types.aggregations.StringStatsAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.MetricAggregationBase'
- type: object
properties:
show_distribution:
description: Shows the probability distribution for all characters.
default: false
type: boolean
_types.aggregations.CompositeTermsAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.CompositeAggregationBase'
- type: object
_types.query_dsl.SpanNearQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
clauses:
description: Array of one or more other span type queries.
type: array
items:
$ref: '#/components/schemas/_types.query_dsl.SpanQuery'
in_order:
description: Controls whether matches are required to be in-order.
type: boolean
slop:
description: Controls the maximum number of intervening unmatched positions permitted.
type: number
required:
- clauses
_types.RrfRank:
allOf:
- $ref: '#/components/schemas/_types.RankBase'
- type: object
properties:
rank_constant:
description: How much influence documents in individual result sets per query have over the final ranked result set
type: number
rank_window_size:
description: Size of the individual result sets per query
type: number
_types.aggregations.GeoLinePoint:
type: object
properties:
field:
description: The name of the geo_point field.
allOf:
- $ref: '#/components/schemas/_types.Field'
required:
- field
_types.query_dsl.ScriptScoreQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
min_score:
description: Documents with a score lower than this floating point number are excluded from the search results.
type: number
query:
description: Query used to return documents.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
script:
description: 'Script used to compute the score of documents returned by the query.
Important: final relevance scores from the `script_score` query cannot be negative.'
allOf:
- $ref: '#/components/schemas/_types.Script'
required:
- query
- script
_types.analysis.StopWordLanguage:
type: string
enum:
- _arabic_
- _armenian_
- _basque_
- _bengali_
- _brazilian_
- _bulgarian_
- _catalan_
- _cjk_
- _czech_
- _danish_
- _dutch_
- _english_
- _estonian_
- _finnish_
- _french_
- _galician_
- _german_
- _greek_
- _hindi_
- _hungarian_
- _indonesian_
- _irish_
- _italian_
- _latvian_
- _lithuanian_
- _norwegian_
- _persian_
- _portuguese_
- _romanian_
- _russian_
- _serbian_
- _sorani_
- _spanish_
- _swedish_
- _thai_
- _turkish_
- _none_
_types.Name:
type: string
_types.InlineGetDictUserDefined:
type: object
properties:
fields:
type: object
additionalProperties:
type: object
found:
type: boolean
_seq_no:
allOf:
- $ref: '#/components/schemas/_types.SequenceNumber'
_primary_term:
type: number
_routing:
allOf:
- $ref: '#/components/schemas/_types.Routing'
_source:
type: object
additionalProperties:
type: object
required:
- found
_types.aggregations.CompositeAggregationSource:
type: object
properties:
terms:
description: A terms aggregation.
allOf:
- $ref: '#/components/schemas/_types.aggregations.CompositeTermsAggregation'
histogram:
description: A histogram aggregation.
allOf:
- $ref: '#/components/schemas/_types.aggregations.CompositeHistogramAggregation'
date_histogram:
description: A date histogram aggregation.
allOf:
- $ref: '#/components/schemas/_types.aggregations.CompositeDateHistogramAggregation'
geotile_grid:
description: A geotile grid aggregation.
allOf:
- $ref: '#/components/schemas/_types.aggregations.CompositeGeoTileGridAggregation'
minProperties: 1
maxProperties: 1
_global.mtermvectors.TermVectorsResult:
type: object
properties:
_id:
allOf:
- $ref: '#/components/schemas/_types.Id'
_index:
allOf:
- $ref: '#/components/schemas/_types.IndexName'
_version:
allOf:
- $ref: '#/components/schemas/_types.VersionNumber'
took:
type: number
found:
type: boolean
term_vectors:
type: object
additionalProperties:
$ref: '#/components/schemas/_global.termvectors.TermVector'
error:
allOf:
- $ref: '#/components/schemas/_types.ErrorCause'
required:
- _index
_types.query_dsl.SpanFirstQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
end:
description: Controls the maximum end position permitted in a match.
type: number
match:
description: Can be any other span type query.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanQuery'
required:
- end
- match
_types.aggregations.RareTermsAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
exclude:
description: Terms that should be excluded from the aggregation.
allOf:
- $ref: '#/components/schemas/_types.aggregations.TermsExclude'
field:
description: The field from which to return rare terms.
allOf:
- $ref: '#/components/schemas/_types.Field'
include:
description: Terms that should be included in the aggregation.
allOf:
- $ref: '#/components/schemas/_types.aggregations.TermsInclude'
max_doc_count:
description: The maximum number of documents a term should appear in.
default: 1.0
type: number
missing:
description: 'The value to apply to documents that do not have a value.
By default, documents without a value are ignored.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.Missing'
precision:
description: 'The precision of the internal CuckooFilters.
Smaller precision leads to better approximation, but higher memory usage.'
default: 0.001
type: number
value_type:
type: string
_types.query_dsl.BoostingQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
negative_boost:
description: Floating point number between 0 and 1.0 used to decrease the relevance scores of documents matching the `negative` query.
type: number
negative:
description: Query used to decrease the relevance score of matching documents.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
positive:
description: Any returned documents must match this query.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
required:
- negative_boost
- negative
- positive
_types.WktGeoBounds:
type: object
properties:
wkt:
type: string
required:
- wkt
_types.NodeRole:
type: string
enum:
- master
- data
- data_cold
- data_content
- data_frozen
- data_hot
- data_warm
- client
- ingest
- ml
- voting_only
- transform
- remote_cluster_client
- coordinating_only
_types.aggregations.ScriptedHeuristic:
type: object
properties:
script:
allOf:
- $ref: '#/components/schemas/_types.Script'
required:
- script
_global.search._types.PointInTimeReference:
type: object
properties:
id:
allOf:
- $ref: '#/components/schemas/_types.Id'
keep_alive:
allOf:
- $ref: '#/components/schemas/_types.Duration'
required:
- id
_types.CoordsGeoBounds:
type: object
properties:
top:
type: number
bottom:
type: number
left:
type: number
right:
type: number
required:
- top
- bottom
- left
- right
_types.WaitForActiveShards:
oneOf:
- type: number
- $ref: '#/components/schemas/_types.WaitForActiveShardOptions'
_types.aggregations.CumulativeSumAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.PipelineAggregationBase'
- type: object
_types.query_dsl.WildcardQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
case_insensitive:
description: Allows case insensitive matching of the pattern with the indexed field values when set to true. Default is false which means the case sensitivity of matching depends on the underlying field’s mapping.
x-state: Generally available; Added in 7.10.0
type: boolean
rewrite:
description: Method used to rewrite the query.
allOf:
- $ref: '#/components/schemas/_types.MultiTermQueryRewrite'
value:
description: Wildcard pattern for terms you wish to find in the provided field. Required, when wildcard is not set.
type: string
wildcard:
description: Wildcard pattern for terms you wish to find in the provided field. Required, when value is not set.
type: string
_types.query_dsl.TermRangeQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.RangeQueryBasestring'
- type: object
_types.query_dsl.MatchBoolPrefixQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
analyzer:
description: Analyzer used to convert the text in the query value into tokens.
type: string
fuzziness:
description: 'Maximum edit distance allowed for matching.
Can be applied to the term subqueries constructed for all terms but the final term.'
allOf:
- $ref: '#/components/schemas/_types.Fuzziness'
fuzzy_rewrite:
description: 'Method used to rewrite the query.
Can be applied to the term subqueries constructed for all terms but the final term.'
allOf:
- $ref: '#/components/schemas/_types.MultiTermQueryRewrite'
fuzzy_transpositions:
description: 'If `true`, edits for fuzzy matching include transpositions of two adjacent characters (for example, `ab` to `ba`).
Can be applied to the term subqueries constructed for all terms but the final term.'
default: true
type: boolean
max_expansions:
description: 'Maximum number of terms to which the query will expand.
Can be applied to the term subqueries constructed for all terms but the final term.'
default: 50.0
type: number
minimum_should_match:
description: 'Minimum number of clauses that must match for a document to be returned.
Applied to the constructed bool query.'
allOf:
- $ref: '#/components/schemas/_types.MinimumShouldMatch'
operator:
description: 'Boolean logic used to interpret text in the query value.
Applied to the constructed bool query.'
default: '''or'''
allOf:
- $ref: '#/components/schemas/_types.query_dsl.Operator'
prefix_length:
description: 'Number of beginning characters left unchanged for fuzzy matching.
Can be applied to the term subqueries constructed for all terms but the final term.'
default: 0.0
type: number
query:
description: 'Terms you wish to find in the provided field.
The last term is used in a prefix query.'
type: string
required:
- query
_types.query_dsl.SimpleQueryStringQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
analyzer:
description: Analyzer used to convert text in the query string into tokens.
type: string
analyze_wildcard:
description: If `true`, the query attempts to analyze wildcard terms in the query string.
default: false
type: boolean
auto_generate_synonyms_phrase_query:
description: If `true`, the parser creates a match_phrase query for each multi-position token.
default: true
type: boolean
default_operator:
description: Default boolean logic used to interpret text in the query string if no operators are specified.
default: '''or'''
allOf:
- $ref: '#/components/schemas/_types.query_dsl.Operator'
fields:
description: 'Array of fields you wish to search.
Accepts wildcard expressions.
You also can boost relevance scores for matches to particular fields using a caret (`^`) notation.
Defaults to the `index.query.default_field index` setting, which has a default value of `*`.'
type: array
items:
$ref: '#/components/schemas/_types.Field'
flags:
description: List of enabled operators for the simple query string syntax.
default: ALL
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SimpleQueryStringFlags'
fuzzy_max_expansions:
description: Maximum number of terms to which the query expands for fuzzy matching.
default: 50.0
type: number
fuzzy_prefix_length:
description: Number of beginning characters left unchanged for fuzzy matching.
default: 0.0
type: number
fuzzy_transpositions:
description: If `true`, edits for fuzzy matching include transpositions of two adjacent characters (for example, `ab` to `ba`).
type: boolean
lenient:
description: If `true`, format-based errors, such as providing a text value for a numeric field, are ignored.
default: false
type: boolean
minimum_should_match:
description: Minimum number of clauses that must match for a document to be returned.
allOf:
- $ref: '#/components/schemas/_types.MinimumShouldMatch'
query:
description: Query string in the simple query string syntax you wish to parse and use for search.
type: string
quote_field_suffix:
description: Suffix appended to quoted text in the query string.
type: string
required:
- query
_types.aggregations.TermsInclude:
oneOf:
- type: string
- type: array
items:
type: string
- $ref: '#/components/schemas/_types.aggregations.TermsPartition'
_types.query_dsl.MatchAllQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
_types.RankBase:
type: object
_types.query_dsl.DateDecayFunction:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.DecayFunctionBaseDateMathDuration'
- type: object
_types.aggregations.SignificantTermsAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
background_filter:
description: A background filter that can be used to focus in on significant terms within a narrower context, instead of the entire index.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
chi_square:
description: Use Chi square, as described in "Information Retrieval", Manning et al., Chapter 13.5.2, as the significance score.
allOf:
- $ref: '#/components/schemas/_types.aggregations.ChiSquareHeuristic'
exclude:
description: Terms to exclude.
allOf:
- $ref: '#/components/schemas/_types.aggregations.TermsExclude'
execution_hint:
description: 'Mechanism by which the aggregation should be executed: using field values directly or using global ordinals.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.TermsAggregationExecutionHint'
field:
description: The field from which to return significant terms.
allOf:
- $ref: '#/components/schemas/_types.Field'
gnd:
description: Use Google normalized distance as described in "The Google Similarity Distance", Cilibrasi and Vitanyi, 2007, as the significance score.
allOf:
- $ref: '#/components/schemas/_types.aggregations.GoogleNormalizedDistanceHeuristic'
include:
description: Terms to include.
allOf:
- $ref: '#/components/schemas/_types.aggregations.TermsInclude'
jlh:
description: Use JLH score as the significance score.
allOf:
- $ref: '#/components/schemas/_types.EmptyObject'
min_doc_count:
description: Only return terms that are found in more than `min_doc_count` hits.
default: 3.0
type: number
mutual_information:
description: Use mutual information as described in "Information Retrieval", Manning et al., Chapter 13.5.1, as the significance score.
allOf:
- $ref: '#/components/schemas/_types.aggregations.MutualInformationHeuristic'
percentage:
description: A simple calculation of the number of documents in the foreground sample with a term divided by the number of documents in the background with the term.
allOf:
- $ref: '#/components/schemas/_types.aggregations.PercentageScoreHeuristic'
script_heuristic:
description: Customized score, implemented via a script.
allOf:
- $ref: '#/components/schemas/_types.aggregations.ScriptedHeuristic'
p_value:
description: 'Significant terms heuristic that calculates the p-value between the term existing in foreground and background sets.
The p-value is the probability of obtaining test results at least as extreme as
the results actually observed, under the assumption that the null hypothesis is
correct. The p-value is calculated assuming that the foreground set and the
background set are independent https://en.wikipedia.org/wiki/Bernoulli_trial, with the null
hypothesis that the probabilities are the same.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.PValueHeuristic'
shard_min_doc_count:
description: 'Regulates the certainty a shard has if the term should actually be added to the candidate list or not with respect to the `min_doc_count`.
Terms will only be considered if their local shard frequency within the set is higher than the `shard_min_doc_count`.'
type: number
shard_size:
description: 'Can be used to control the volumes of candidate terms produced by each shard.
By default, `shard_size` will be automatically estimated based on the number of shards and the `size` parameter.'
type: number
size:
description: The number of buckets returned out of the overall terms list.
type: number
_types.RescorerRetriever:
allOf:
- $ref: '#/components/schemas/_types.RetrieverBase'
- type: object
properties:
retriever:
description: Inner retriever.
allOf:
- $ref: '#/components/schemas/_types.RetrieverContainer'
rescore:
oneOf:
- $ref: '#/components/schemas/_global.search._types.Rescore'
- type: array
items:
$ref: '#/components/schemas/_global.search._types.Rescore'
required:
- retriever
- rescore
_types.aggregations.MaxBucketAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.PipelineAggregationBase'
- type: object
_types.aggregations.MissingOrder:
type: string
enum:
- first
- last
- default
_types.query_dsl.ParentIdQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
id:
description: ID of the parent document.
allOf:
- $ref: '#/components/schemas/_types.Id'
ignore_unmapped:
description: Indicates whether to ignore an unmapped `type` and not return any documents instead of an error.
default: false
type: boolean
type:
description: Name of the child relationship mapped for the `join` field.
allOf:
- $ref: '#/components/schemas/_types.RelationName'
_types.Password:
type: string
_types.query_dsl.ZeroTermsQuery:
type: string
enum:
- all
- none
_types.UnitNanos:
description: Time unit for nanoseconds
type: number
_types.aggregations.TermsPartition:
type: object
properties:
num_partitions:
description: The number of partitions.
type: number
partition:
description: The partition number for this request.
type: number
required:
- num_partitions
- partition
_types.Sort:
oneOf:
- $ref: '#/components/schemas/_types.SortCombinations'
- type: array
items:
$ref: '#/components/schemas/_types.SortCombinations'
_types.aggregations.NormalizeAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.PipelineAggregationBase'
- type: object
properties:
method:
description: "The specific method to apply.\n\nSupported values include:\n - `rescale_0_1`: This method rescales the data such that the minimum number is 0, and the maximum number is 1, with the rest normalized linearly in-between.\n - `rescale_0_100`: This method rescales the data such that the minimum number is 0, and the maximum number is 100, with the rest normalized linearly in-between.\n - `percent_of_sum`: This method normalizes each value so that it represents a percentage of the total sum it attributes to.\n - `mean`: This method normalizes such that each value is normalized by how much it differs from the average.\n - `z-score`: This method normalizes such that each value represents how far it is from the mean relative to the standard deviation.\n - `softmax`: This method normalizes such that each value is exponentiated and relative to the sum of the exponents of the original values.\n\n"
allOf:
- $ref: '#/components/schemas/_types.aggregations.NormalizeMethod'
_types.aggregations.FrequentItemSetsAggregation:
type: object
properties:
fields:
description: Fields to analyze.
type: array
items:
$ref: '#/components/schemas/_types.aggregations.FrequentItemSetsField'
minimum_set_size:
description: The minimum size of one item set.
default: 1.0
type: number
minimum_support:
description: The minimum support of one item set.
default: 0.1
type: number
size:
description: The number of top item sets to return.
default: 10.0
type: number
filter:
description: Query that filters documents from analysis.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
required:
- fields
_types.query_dsl.TermsQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
ml._types.ClassificationInferenceOptions:
type: object
properties:
num_top_classes:
description: Specifies the number of top class predictions to return. Defaults to 0.
type: number
num_top_feature_importance_values:
description: Specifies the maximum number of feature importance values per document.
default: 0.0
type: number
prediction_field_type:
description: 'Specifies the type of the predicted field to write. Acceptable values are: string, number, boolean. When boolean is provided 1.0 is transformed to true and 0.0 to false.'
type: string
results_field:
description: The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.
type: string
top_classes_results_field:
description: Specifies the field to which the top classes are written. Defaults to top_classes.
type: string
_types.aggregations.MissingAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
field:
description: The name of the field.
allOf:
- $ref: '#/components/schemas/_types.Field'
missing:
allOf:
- $ref: '#/components/schemas/_types.aggregations.Missing'
_types.query_dsl.FunctionBoostMode:
type: string
enum:
- multiply
- replace
- sum
- avg
- max
- min
_types.aggregations.CustomCategorizeTextAnalyzer:
type: object
properties:
char_filter:
type: array
items:
type: string
tokenizer:
type: string
filter:
type: array
items:
type: string
_types.TaskId:
type: string
_types.query_dsl.LikeDocument:
type: object
properties:
doc:
description: A document not present in the index.
type: object
fields:
type: array
items:
$ref: '#/components/schemas/_types.Field'
_id:
description: ID of a document.
allOf:
- $ref: '#/components/schemas/_types.Id'
_index:
description: Index of a document.
allOf:
- $ref: '#/components/schemas/_types.IndexName'
per_field_analyzer:
description: Overrides the default analyzer.
type: object
additionalProperties:
type: string
routing:
allOf:
- $ref: '#/components/schemas/_types.Routing'
version:
allOf:
- $ref: '#/components/schemas/_types.VersionNumber'
version_type:
description: "\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"
default: '''internal'''
allOf:
- $ref: '#/components/schemas/_types.VersionType'
_types.TextSimilarityReranker:
allOf:
- $ref: '#/components/schemas/_types.RetrieverBase'
- type: object
properties:
retriever:
description: The nested retriever which will produce the first-level results, that will later be used for reranking.
allOf:
- $ref: '#/components/schemas/_types.RetrieverContainer'
rank_window_size:
description: This value determines how many documents we will consider from the nested retriever.
type: number
inference_id:
description: Unique identifier of the inference endpoint created using the inference API.
type: string
inference_text:
description: The text snippet used as the basis for similarity comparison.
type: string
field:
description: The document field to be used for text similarity comparisons. This field should contain the text that will be evaluated against the inference_text.
type: string
chunk_rescorer:
description: Whether to rescore on only the best matching chunks.
x-state: Generally available; Added in 9.2.0
allOf:
- $ref: '#/components/schemas/_types.ChunkRescorer'
required:
- retriever
- inference_text
- field
_global.termvectors.TermVector:
type: object
properties:
field_statistics:
allOf:
- $ref: '#/components/schemas/_global.termvectors.FieldStatistics'
terms:
type: object
additionalProperties:
$ref: '#/components/schemas/_global.termvectors.Term'
required:
- terms
_types.aggregations.SignificantTextAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
background_filter:
description: A background filter that can be used to focus in on significant terms within a narrower context, instead of the entire index.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
chi_square:
description: Use Chi square, as described in "Information Retrieval", Manning et al., Chapter 13.5.2, as the significance score.
allOf:
- $ref: '#/components/schemas/_types.aggregations.ChiSquareHeuristic'
exclude:
description: Values to exclude.
allOf:
- $ref: '#/components/schemas/_types.aggregations.TermsExclude'
execution_hint:
description: Determines whether the aggregation will use field values directly or global ordinals.
allOf:
- $ref: '#/components/schemas/_types.aggregations.TermsAggregationExecutionHint'
field:
description: The field from which to return significant text.
allOf:
- $ref: '#/components/schemas/_types.Field'
filter_duplicate_text:
description: Whether to out duplicate text to deal with noisy data.
type: boolean
gnd:
description: Use Google normalized distance as described in "The Google Similarity Distance", Cilibrasi and Vitanyi, 2007, as the significance score.
allOf:
- $ref: '#/components/schemas/_types.aggregations.GoogleNormalizedDistanceHeuristic'
include:
description: Values to include.
allOf:
- $ref: '#/components/schemas/_types.aggregations.TermsInclude'
jlh:
description: Use JLH score as the significance score.
allOf:
- $ref: '#/components/schemas/_types.EmptyObject'
min_doc_count:
description: Only return values that are found in more than `min_doc_count` hits.
default: 3.0
type: number
mutual_information:
description: Use mutual information as described in "Information Retrieval", Manning et al., Chapter 13.5.1, as the significance score.
allOf:
- $ref: '#/components/schemas/_types.aggregations.MutualInformationHeuristic'
percentage:
description: A simple calculation of the number of documents in the foreground sample with a term divided by the number of documents in the background with the term.
allOf:
- $ref: '#/components/schemas/_types.aggregations.PercentageScoreHeuristic'
script_heuristic:
description: Customized score, implemented via a script.
allOf:
- $ref: '#/components/schemas/_types.aggregations.ScriptedHeuristic'
shard_min_doc_count:
description: 'Regulates the certainty a shard has if the values should actually be added to the candidate list or not with respect to the min_doc_count.
Values will only be considered if their local shard frequency within the set is higher than the `shard_min_doc_count`.'
type: number
shard_size:
description: 'The number of candidate terms produced by each shard.
By default, `shard_size` will be automatically estimated based on the number of shards and the `size` parameter.'
type: number
size:
description: The number of buckets returned out of the overall terms list.
type: number
source_fields:
description: Overrides the JSON `_source` fields from which text will be analyzed.
allOf:
- $ref: '#/components/schemas/_types.Fields'
_global.termvectors.FieldStatistics:
type: object
properties:
doc_count:
type: number
sum_doc_freq:
type: number
sum_ttf:
type: number
required:
- doc_count
- sum_doc_freq
- sum_ttf
_types.query_dsl.DistanceFeatureQueryBaseDateMathDuration:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
origin:
description: 'Date or point of origin used to calculate distances.
If the `field` value is a `date` or `date_nanos` field, the `origin` value must be a date.
Date Math, such as `now-1h`, is supported.
If the field value is a `geo_point` field, the `origin` value must be a geopoint.'
allOf:
- $ref: '#/components/schemas/_types.DateMath'
pivot:
description: 'Distance from the `origin` at which relevance scores receive half of the `boost` value.
If the `field` value is a `date` or `date_nanos` field, the `pivot` value must be a time unit, such as `1h` or `10d`. If the `field` value is a `geo_point` field, the `pivot` value must be a distance unit, such as `1km` or `12m`.'
allOf:
- $ref: '#/components/schemas/_types.Duration'
field:
description: 'Name of the field used to calculate distances. This field must meet the following criteria:
be a `date`, `date_nanos` or `geo_point` field;
have an `index` mapping parameter value of `true`, which is the default;
have an `doc_values` mapping parameter value of `true`, which is the default.'
allOf:
- $ref: '#/components/schemas/_types.Field'
required:
- origin
- pivot
- field
_types.aggregations.CompositeAggregateKey:
type: object
additionalProperties:
$ref: '#/components/schemas/_types.FieldValue'
_types.query_dsl.FieldAndFormat:
description: A reference to a field with formatting instructions on how to return the value
type: object
properties:
field:
description: A wildcard pattern. The request returns values for field names matching this pattern.
allOf:
- $ref: '#/components/schemas/_types.Field'
format:
description: The format in which the values are returned.
type: string
include_unmapped:
type: boolean
required:
- field
_types.query_dsl.MatchNoneQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
_types.aggregations.StatsBucketAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.PipelineAggregationBase'
- type: object
_types.aggregations.RateAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.FormatMetricAggregationBase'
- type: object
properties:
unit:
description: 'The interval used to calculate the rate.
By default, the interval of the `date_histogram` is used.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.CalendarInterval'
mode:
description: "How the rate is calculated.\n\nSupported values include:\n - `sum`: Calculates the sum of all values of the field.\n - `value_count`: Uses the number of values of the field.\n\n"
default: sum
allOf:
- $ref: '#/components/schemas/_types.aggregations.RateMode'
_types.query_dsl.DistanceFeatureQueryBase:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
origin:
description: 'Date or point of origin used to calculate distances.
If the `field` value is a `date` or `date_nanos` field, the `origin` value must be a date.
Date Math, such as `now-1h`, is supported.
If the field value is a `geo_point` field, the `origin` value must be a geopoint.'
type: object
pivot:
description: 'Distance from the `origin` at which relevance scores receive half of the `boost` value.
If the `field` value is a `date` or `date_nanos` field, the `pivot` value must be a time unit, such as `1h` or `10d`. If the `field` value is a `geo_point` field, the `pivot` value must be a distance unit, such as `1km` or `12m`.'
type: object
field:
description: 'Name of the field used to calculate distances. This field must meet the following criteria:
be a `date`, `date_nanos` or `geo_point` field;
have an `index` mapping parameter value of `true`, which is the default;
have an `doc_values` mapping parameter value of `true`, which is the default.'
allOf:
- $ref: '#/components/schemas/_types.Field'
required:
- origin
- pivot
- field
_types.aggregations.RateMode:
type: string
enum:
- sum
- value_count
_types.ShardStatistics:
type: object
properties:
failed:
description: The number of shards the operation or search attempted to run on but failed.
allOf:
- $ref: '#/components/schemas/_types.uint'
successful:
description: The number of shards the operation or search succeeded on.
allOf:
- $ref: '#/components/schemas/_types.uint'
total:
description: The number of shards the operation or search will run on overall.
allOf:
- $ref: '#/components/schemas/_types.uint'
failures:
type: array
items:
$ref: '#/components/schemas/_types.ShardFailure'
skipped:
allOf:
- $ref: '#/components/schemas/_types.uint'
required:
- failed
- successful
- total
_types.query_dsl.DecayFunction:
oneOf:
- $ref: '#/components/schemas/_types.query_dsl.UntypedDecayFunction'
- $ref: '#/components/schemas/_types.query_dsl.DateDecayFunction'
- $ref: '#/components/schemas/_types.query_dsl.NumericDecayFunction'
- $ref: '#/components/schemas/_types.query_dsl.GeoDecayFunction'
_global.bulk.DeleteOperation:
allOf:
- $ref: '#/components/schemas/_global.bulk.OperationBase'
- type: object
_global.get.GetResult:
type: object
properties:
_index:
description: The name of the index the document belongs to.
allOf:
- $ref: '#/components/schemas/_types.IndexName'
fields:
description: If the `stored_fields` parameter is set to `true` and `found` is `true`, it contains the document fields stored in the index.
type: object
additionalProperties:
type: object
_ignored:
type: array
items:
type: string
found:
description: Indicates whether the document exists.
type: boolean
_id:
description: The unique identifier for the document.
allOf:
- $ref: '#/components/schemas/_types.Id'
_primary_term:
description: The primary term assigned to the document for the indexing operation.
type: number
_routing:
description: The explicit routing, if set.
type: string
_seq_no:
description: 'The sequence number assigned to the document for the indexing operation.
Sequence numbers are used to ensure an older version of a document doesn''t overwrite a newer version.'
allOf:
- $ref: '#/components/schemas/_types.SequenceNumber'
_source:
description: 'If `found` is `true`, it contains the document data formatted in JSON.
If the `_source` parameter is set to `false` or the `stored_fields` parameter is set to `true`, it is excluded.'
type: object
_version:
description: The document version, which is ncremented each time the document is updated.
allOf:
- $ref: '#/components/schemas/_types.VersionNumber'
required:
- _index
- found
- _id
_global.mtermvectors.Operation:
type: object
properties:
_id:
description: The ID of the document.
allOf:
- $ref: '#/components/schemas/_types.Id'
_index:
description: The index of the document.
allOf:
- $ref: '#/components/schemas/_types.IndexName'
doc:
description: An artificial document (a document not present in the index) for which you want to retrieve term vectors.
type: object
fields:
description: 'Comma-separated list or wildcard expressions of fields to include in the statistics.
Used as the default list unless a specific field list is provided in the `completion_fields` or `fielddata_fields` parameters.'
allOf:
- $ref: '#/components/schemas/_types.Fields'
field_statistics:
description: If `true`, the response includes the document count, sum of document frequencies, and sum of total term frequencies.
default: true
type: boolean
filter:
description: Filter terms based on their tf-idf scores.
allOf:
- $ref: '#/components/schemas/_global.termvectors.Filter'
offsets:
description: If `true`, the response includes term offsets.
default: true
type: boolean
payloads:
description: If `true`, the response includes term payloads.
default: true
type: boolean
positions:
description: If `true`, the response includes term positions.
default: true
type: boolean
routing:
description: Custom value used to route operations to a specific shard.
allOf:
- $ref: '#/components/schemas/_types.Routing'
term_statistics:
description: If true, the response includes term frequency and document frequency.
default: false
type: boolean
version:
description: If `true`, returns the document version as part of a hit.
allOf:
- $ref: '#/components/schemas/_types.VersionNumber'
version_type:
description: "Specific 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"
allOf:
- $ref: '#/components/schemas/_types.VersionType'
_global.search._types.InnerHits:
type: object
properties:
name:
description: 'The name for the particular inner hit definition in the response.
Useful when a search request contains multiple inner hits.'
allOf:
- $ref: '#/components/schemas/_types.Name'
size:
description: The maximum number of hits to return per `inner_hits`.
default: 3.0
type: number
from:
description: Inner hit starting document offset.
default: 0.0
type: number
collapse:
allOf:
- $ref: '#/components/schemas/_global.search._types.FieldCollapse'
docvalue_fields:
type: array
items:
$ref: '#/components/schemas/_types.query_dsl.FieldAndFormat'
explain:
type: boolean
highlight:
allOf:
- $ref: '#/components/schemas/_global.search._types.Highlight'
ignore_unmapped:
type: boolean
script_fields:
type: object
additionalProperties:
$ref: '#/components/schemas/_types.ScriptField'
seq_no_primary_term:
type: boolean
fields:
type: array
items:
$ref: '#/components/schemas/_types.Field'
sort:
description: 'How the inner hits should be sorted per `inner_hits`.
By default, inner hits are sorted by score.'
allOf:
- $ref: '#/components/schemas/_types.Sort'
_source:
allOf:
- $ref: '#/components/schemas/_global.search._types.SourceConfig'
stored_fields:
allOf:
- $ref: '#/components/schemas/_types.Fields'
track_scores:
default: false
type: boolean
version:
type: boolean
_types.aggregations.AggregationContainer:
allOf:
- type: object
properties:
aggregations:
description: 'Sub-aggregations for this aggregation.
Only applies to bucket aggregations.'
type: object
additionalProperties:
$ref: '#/components/schemas/_types.aggregations.AggregationContainer'
meta:
allOf:
- $ref: '#/components/schemas/_types.Metadata'
- type: object
properties:
adjacency_matrix:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-adjacency-matrix-aggregation
description: 'A bucket aggregation returning a form of adjacency matrix.
The request provides a collection of named filter expressions, similar to the `filters` aggregation.
Each bucket in the response represents a non-empty cell in the matrix of intersecting filters.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.AdjacencyMatrixAggregation'
auto_date_histogram:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-autodatehistogram-aggregation
description: A multi-bucket aggregation similar to the date histogram, except instead of providing an interval to use as the width of each bucket, a target number of buckets is provided.
allOf:
- $ref: '#/components/schemas/_types.aggregations.AutoDateHistogramAggregation'
avg:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-avg-aggregation
description: A single-value metrics aggregation that computes the average of numeric values that are extracted from the aggregated documents.
allOf:
- $ref: '#/components/schemas/_types.aggregations.AverageAggregation'
avg_bucket:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-pipeline-avg-bucket-aggregation
description: 'A sibling pipeline aggregation which calculates the mean value of a specified metric in a sibling aggregation.
The specified metric must be numeric and the sibling aggregation must be a multi-bucket aggregation.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.AverageBucketAggregation'
boxplot:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-boxplot-aggregation
description: A metrics aggregation that computes a box plot of numeric values extracted from the aggregated documents.
allOf:
- $ref: '#/components/schemas/_types.aggregations.BoxplotAggregation'
bucket_script:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-pipeline-bucket-script-aggregation
description: A parent pipeline aggregation which runs a script which can perform per bucket computations on metrics in the parent multi-bucket aggregation.
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketScriptAggregation'
bucket_selector:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-pipeline-bucket-selector-aggregation
description: A parent pipeline aggregation which runs a script to determine whether the current bucket will be retained in the parent multi-bucket aggregation.
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketSelectorAggregation'
bucket_sort:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-pipeline-bucket-sort-aggregation
description: A parent pipeline aggregation which sorts the buckets of its parent multi-bucket aggregation.
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketSortAggregation'
bucket_count_ks_test:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-count-ks-test-aggregation
description: A sibling pipeline aggregation which runs a two sample Kolmogorov–Smirnov test ("K-S test") against a provided distribution and the distribution implied by the documents counts in the configured sibling aggregation.
x-state: Technical preview
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketKsAggregation'
bucket_correlation:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-correlation-aggregation
description: A sibling pipeline aggregation which runs a correlation function on the configured sibling multi-bucket aggregation.
x-state: Technical preview
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketCorrelationAggregation'
cardinality:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-cardinality-aggregation
description: A single-value metrics aggregation that calculates an approximate count of distinct values.
allOf:
- $ref: '#/components/schemas/_types.aggregations.CardinalityAggregation'
cartesian_bounds:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-cartesian-bounds-aggregation
description: A metric aggregation that computes the spatial bounding box containing all values for a Point or Shape field.
allOf:
- $ref: '#/components/schemas/_types.aggregations.CartesianBoundsAggregation'
cartesian_centroid:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-cartesian-centroid-aggregation
description: A metric aggregation that computes the weighted centroid from all coordinate values for point and shape fields.
allOf:
- $ref: '#/components/schemas/_types.aggregations.CartesianCentroidAggregation'
categorize_text:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-categorize-text-aggregation
description: A multi-bucket aggregation that groups semi-structured text into buckets.
x-state: Technical preview
allOf:
- $ref: '#/components/schemas/_types.aggregations.CategorizeTextAggregation'
change_point:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-change-point-aggregation
description: 'A sibling pipeline that detects, spikes, dips, and change points in a metric.
Given a distribution of values provided by the sibling multi-bucket aggregation,
this aggregation indicates the bucket of any spike or dip and/or the bucket at which
the largest change in the distribution of values, if they are statistically significant.
There must be at least 22 bucketed values. Fewer than 1,000 is preferred.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.ChangePointAggregation'
children:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-children-aggregation
description: A single bucket aggregation that selects child documents that have the specified type, as defined in a `join` field.
allOf:
- $ref: '#/components/schemas/_types.aggregations.ChildrenAggregation'
composite:
description: 'A multi-bucket aggregation that creates composite buckets from different sources.
Unlike the other multi-bucket aggregations, you can use the `composite` aggregation to paginate *all* buckets from a multi-level aggregation efficiently.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.CompositeAggregation'
cumulative_cardinality:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-pipeline-cumulative-cardinality-aggregation
description: A parent pipeline aggregation which calculates the cumulative cardinality in a parent `histogram` or `date_histogram` aggregation.
allOf:
- $ref: '#/components/schemas/_types.aggregations.CumulativeCardinalityAggregation'
cumulative_sum:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-pipeline-cumulative-sum-aggregation
description: A parent pipeline aggregation which calculates the cumulative sum of a specified metric in a parent `histogram` or `date_histogram` aggregation.
allOf:
- $ref: '#/components/schemas/_types.aggregations.CumulativeSumAggregation'
date_histogram:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-datehistogram-aggregation
description: 'A multi-bucket values source based aggregation that can be applied on date values or date range values extracted from the documents.
It dynamically builds fixed size (interval) buckets over the values.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.DateHistogramAggregation'
date_range:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-daterange-aggregation
description: A multi-bucket value source based aggregation that enables the user to define a set of date ranges - each representing a bucket.
allOf:
- $ref: '#/components/schemas/_types.aggregations.DateRangeAggregation'
derivative:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-pipeline-derivative-aggregation
description: A parent pipeline aggregation which calculates the derivative of a specified metric in a parent `histogram` or `date_histogram` aggregation.
allOf:
- $ref: '#/components/schemas/_types.aggregations.DerivativeAggregation'
diversified_sampler:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-diversified-sampler-aggregation
description: 'A filtering aggregation used to limit any sub aggregations'' processing to a sample of the top-scoring documents.
Similar to the `sampler` aggregation, but adds the ability to limit the number of matches that share a common value.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.DiversifiedSamplerAggregation'
extended_stats:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-extendedstats-aggregation
description: A multi-value metrics aggregation that computes stats over numeric values extracted from the aggregated documents.
allOf:
- $ref: '#/components/schemas/_types.aggregations.ExtendedStatsAggregation'
extended_stats_bucket:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-pipeline-extended-stats-bucket-aggregation
description: A sibling pipeline aggregation which calculates a variety of stats across all bucket of a specified metric in a sibling aggregation.
allOf:
- $ref: '#/components/schemas/_types.aggregations.ExtendedStatsBucketAggregation'
frequent_item_sets:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-frequent-item-sets-aggregation
description: A bucket aggregation which finds frequent item sets, a form of association rules mining that identifies items that often occur together.
allOf:
- $ref: '#/components/schemas/_types.aggregations.FrequentItemSetsAggregation'
filter:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-filter-aggregation
description: A single bucket aggregation that narrows the set of documents to those that match a query.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
filters:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-filters-aggregation
description: A multi-bucket aggregation where each bucket contains the documents that match a query.
allOf:
- $ref: '#/components/schemas/_types.aggregations.FiltersAggregation'
geo_bounds:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-geobounds-aggregation
description: A metric aggregation that computes the geographic bounding box containing all values for a Geopoint or Geoshape field.
allOf:
- $ref: '#/components/schemas/_types.aggregations.GeoBoundsAggregation'
geo_centroid:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-geocentroid-aggregation
description: A metric aggregation that computes the weighted centroid from all coordinate values for geo fields.
allOf:
- $ref: '#/components/schemas/_types.aggregations.GeoCentroidAggregation'
geo_distance:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-geodistance-aggregation
description: 'A multi-bucket aggregation that works on `geo_point` fields.
Evaluates the distance of each document value from an origin point and determines the buckets it belongs to, based on ranges defined in the request.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.GeoDistanceAggregation'
geohash_grid:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-geohashgrid-aggregation
description: 'A multi-bucket aggregation that groups `geo_point` and `geo_shape` values into buckets that represent a grid.
Each cell is labeled using a geohash which is of user-definable precision.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.GeoHashGridAggregation'
geo_line:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-geo-line
description: Aggregates all `geo_point` values within a bucket into a `LineString` ordered by the chosen sort field.
allOf:
- $ref: '#/components/schemas/_types.aggregations.GeoLineAggregation'
geotile_grid:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-geotilegrid-aggregation
description: 'A multi-bucket aggregation that groups `geo_point` and `geo_shape` values into buckets that represent a grid.
Each cell corresponds to a map tile as used by many online map sites.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.GeoTileGridAggregation'
geohex_grid:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-geohexgrid-aggregation
description: 'A multi-bucket aggregation that groups `geo_point` and `geo_shape` values into buckets that represent a grid.
Each cell corresponds to a H3 cell index and is labeled using the H3Index representation.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.GeohexGridAggregation'
global:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-global-aggregation
description: 'Defines a single bucket of all the documents within the search execution context.
This context is defined by the indices and the document types you’re searching on, but is not influenced by the search query itself.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.GlobalAggregation'
histogram:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-histogram-aggregation
description: 'A multi-bucket values source based aggregation that can be applied on numeric values or numeric range values extracted from the documents.
It dynamically builds fixed size (interval) buckets over the values.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.HistogramAggregation'
ip_range:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-iprange-aggregation
description: A multi-bucket value source based aggregation that enables the user to define a set of IP ranges - each representing a bucket.
allOf:
- $ref: '#/components/schemas/_types.aggregations.IpRangeAggregation'
ip_prefix:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-ipprefix-aggregation
description: A bucket aggregation that groups documents based on the network or sub-network of an IP address.
allOf:
- $ref: '#/components/schemas/_types.aggregations.IpPrefixAggregation'
inference:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-pipeline-inference-bucket-aggregation
description: A parent pipeline aggregation which loads a pre-trained model and performs inference on the collated result fields from the parent bucket aggregation.
allOf:
- $ref: '#/components/schemas/_types.aggregations.InferenceAggregation'
line:
allOf:
- $ref: '#/components/schemas/_types.aggregations.GeoLineAggregation'
matrix_stats:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-matrix-stats-aggregation
description: 'A numeric aggregation that computes the following statistics over a set of document fields: `count`, `mean`, `variance`, `skewness`, `kurtosis`, `covariance`, and `covariance`.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.MatrixStatsAggregation'
max:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-max-aggregation
description: A single-value metrics aggregation that returns the maximum value among the numeric values extracted from the aggregated documents.
allOf:
- $ref: '#/components/schemas/_types.aggregations.MaxAggregation'
max_bucket:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-pipeline-max-bucket-aggregation
description: A sibling pipeline aggregation which identifies the bucket(s) with the maximum value of a specified metric in a sibling aggregation and outputs both the value and the key(s) of the bucket(s).
allOf:
- $ref: '#/components/schemas/_types.aggregations.MaxBucketAggregation'
median_absolute_deviation:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-median-absolute-deviation-aggregation
description: A single-value aggregation that approximates the median absolute deviation of its search results.
allOf:
- $ref: '#/components/schemas/_types.aggregations.MedianAbsoluteDeviationAggregation'
min:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-min-aggregation
description: A single-value metrics aggregation that returns the minimum value among numeric values extracted from the aggregated documents.
allOf:
- $ref: '#/components/schemas/_types.aggregations.MinAggregation'
min_bucket:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-pipeline-min-bucket-aggregation
description: A sibling pipeline aggregation which identifies the bucket(s) with the minimum value of a specified metric in a sibling aggregation and outputs both the value and the key(s) of the bucket(s).
allOf:
- $ref: '#/components/schemas/_types.aggregations.MinBucketAggregation'
missing:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-missing-aggregation
description: A field data based single bucket aggregation, that creates a bucket of all documents in the current document set context that are missing a field value (effectively, missing a field or having the configured NULL value set).
allOf:
- $ref: '#/components/schemas/_types.aggregations.MissingAggregation'
moving_avg:
allOf:
- $ref: '#/components/schemas/_types.aggregations.MovingAverageAggregation'
moving_percentiles:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-pipeline-moving-percentiles-aggregation
description: Given an ordered series of percentiles, "slides" a window across those percentiles and computes cumulative percentiles.
allOf:
- $ref: '#/components/schemas/_types.aggregations.MovingPercentilesAggregation'
moving_fn:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-pipeline-movfn-aggregation
description: 'Given an ordered series of data, "slides" a window across the data and runs a custom script on each window of data.
For convenience, a number of common functions are predefined such as `min`, `max`, and moving averages.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.MovingFunctionAggregation'
multi_terms:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-multi-terms-aggregation
description: A multi-bucket value source based aggregation where buckets are dynamically built - one per unique set of values.
allOf:
- $ref: '#/components/schemas/_types.aggregations.MultiTermsAggregation'
nested:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-nested-aggregation
description: A special single bucket aggregation that enables aggregating nested documents.
allOf:
- $ref: '#/components/schemas/_types.aggregations.NestedAggregation'
normalize:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-pipeline-normalize-aggregation
description: A parent pipeline aggregation which calculates the specific normalized/rescaled value for a specific bucket value.
allOf:
- $ref: '#/components/schemas/_types.aggregations.NormalizeAggregation'
parent:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-parent-aggregation
description: A special single bucket aggregation that selects parent documents that have the specified type, as defined in a `join` field.
allOf:
- $ref: '#/components/schemas/_types.aggregations.ParentAggregation'
percentile_ranks:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-percentile-rank-aggregation
description: A multi-value metrics aggregation that calculates one or more percentile ranks over numeric values extracted from the aggregated documents.
allOf:
- $ref: '#/components/schemas/_types.aggregations.PercentileRanksAggregation'
percentiles:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-percentile-aggregation
description: A multi-value metrics aggregation that calculates one or more percentiles over numeric values extracted from the aggregated documents.
allOf:
- $ref: '#/components/schemas/_types.aggregations.PercentilesAggregation'
percentiles_bucket:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-pipeline-percentiles-bucket-aggregation
description: A sibling pipeline aggregation which calculates percentiles across all bucket of a specified metric in a sibling aggregation.
allOf:
- $ref: '#/components/schemas/_types.aggregations.PercentilesBucketAggregation'
range:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-range-aggregation
description: A multi-bucket value source based aggregation that enables the user to define a set of ranges - each representing a bucket.
allOf:
- $ref: '#/components/schemas/_types.aggregations.RangeAggregation'
rare_terms:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-rare-terms-aggregation
description: A multi-bucket value source based aggregation which finds "rare" terms — terms that are at the long-tail of the distribution and are not frequent.
allOf:
- $ref: '#/components/schemas/_types.aggregations.RareTermsAggregation'
rate:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-rate-aggregation
description: 'Calculates a rate of documents or a field in each bucket.
Can only be used inside a `date_histogram` or `composite` aggregation.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.RateAggregation'
reverse_nested:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-reverse-nested-aggregation
description: 'A special single bucket aggregation that enables aggregating on parent documents from nested documents.
Should only be defined inside a `nested` aggregation.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.ReverseNestedAggregation'
random_sampler:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-random-sampler-aggregation
description: 'A single bucket aggregation that randomly includes documents in the aggregated results.
Sampling provides significant speed improvement at the cost of accuracy.'
x-state: Technical preview; Added in 8.1.0
allOf:
- $ref: '#/components/schemas/_types.aggregations.RandomSamplerAggregation'
sampler:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-sampler-aggregation
description: A filtering aggregation used to limit any sub aggregations' processing to a sample of the top-scoring documents.
allOf:
- $ref: '#/components/schemas/_types.aggregations.SamplerAggregation'
scripted_metric:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-scripted-metric-aggregation
description: A metric aggregation that uses scripts to provide a metric output.
allOf:
- $ref: '#/components/schemas/_types.aggregations.ScriptedMetricAggregation'
serial_diff:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-pipeline-serialdiff-aggregation
description: An aggregation that subtracts values in a time series from themselves at different time lags or periods.
allOf:
- $ref: '#/components/schemas/_types.aggregations.SerialDifferencingAggregation'
significant_terms:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-significantterms-aggregation
description: Returns interesting or unusual occurrences of terms in a set.
allOf:
- $ref: '#/components/schemas/_types.aggregations.SignificantTermsAggregation'
significant_text:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-significanttext-aggregation
description: Returns interesting or unusual occurrences of free-text terms in a set.
allOf:
- $ref: '#/components/schemas/_types.aggregations.SignificantTextAggregation'
stats:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-stats-aggregation
description: A multi-value metrics aggregation that computes stats over numeric values extracted from the aggregated documents.
allOf:
- $ref: '#/components/schemas/_types.aggregations.StatsAggregation'
stats_bucket:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-pipeline-stats-bucket-aggregation
description: A sibling pipeline aggregation which calculates a variety of stats across all bucket of a specified metric in a sibling aggregation.
allOf:
- $ref: '#/components/schemas/_types.aggregations.StatsBucketAggregation'
string_stats:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-string-stats-aggregation
description: A multi-value metrics aggregation that computes statistics over string values extracted from the aggregated documents.
allOf:
- $ref: '#/components/schemas/_types.aggregations.StringStatsAggregation'
sum:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-sum-aggregation
description: A single-value metrics aggregation that sums numeric values that are extracted from the aggregated documents.
allOf:
- $ref: '#/components/schemas/_types.aggregations.SumAggregation'
sum_bucket:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-pipeline-sum-bucket-aggregation
description: A sibling pipeline aggregation which calculates the sum of a specified metric across all buckets in a sibling aggregation.
allOf:
- $ref: '#/components/schemas/_types.aggregations.SumBucketAggregation'
terms:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-terms-aggregation
description: A multi-bucket value source based aggregation where buckets are dynamically built - one per unique value.
allOf:
- $ref: '#/components/schemas/_types.aggregations.TermsAggregation'
time_series:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-time-series-aggregation
description: 'The time series aggregation queries data created using a time series index.
This is typically data such as metrics or other data streams with a time component, and requires creating an index using the time series mode.'
x-state: Technical preview
allOf:
- $ref: '#/components/schemas/_types.aggregations.TimeSeriesAggregation'
top_hits:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-top-hits-aggregation
description: A metric aggregation that returns the top matching documents per bucket.
allOf:
- $ref: '#/components/schemas/_types.aggregations.TopHitsAggregation'
t_test:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-ttest-aggregation
description: A metrics aggregation that performs a statistical hypothesis test in which the test statistic follows a Student’s t-distribution under the null hypothesis on numeric values extracted from the aggregated documents.
allOf:
- $ref: '#/components/schemas/_types.aggregations.TTestAggregation'
top_metrics:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-top-metrics
description: A metric aggregation that selects metrics from the document with the largest or smallest sort value.
allOf:
- $ref: '#/components/schemas/_types.aggregations.TopMetricsAggregation'
value_count:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-valuecount-aggregation
description: A single-value metrics aggregation that counts the number of values that are extracted from the aggregated documents.
allOf:
- $ref: '#/components/schemas/_types.aggregations.ValueCountAggregation'
weighted_avg:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-weight-avg-aggregation
description: A single-value metrics aggregation that computes the weighted average of numeric values that are extracted from the aggregated documents.
allOf:
- $ref: '#/components/schemas/_types.aggregations.WeightedAverageAggregation'
variable_width_histogram:
externalDocs:
url: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-variablewidthhistogram-aggregation
description: A multi-bucket aggregation similar to the histogram, except instead of providing an interval to use as the width of each bucket, a target number of buckets is provided.
allOf:
- $ref: '#/components/schemas/_types.aggregations.VariableWidthHistogramAggregation'
minProperties: 1
maxProperties: 1
_types.query_dsl.RangeQueryBasestring:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
relation:
description: "Indicates how the range query matches values for `range` fields.\n\nSupported values include:\n - `within`: Matches documents with a range field value entirely within the query’s range.\n - `contains`: Matches documents with a range field value that entirely contains the query’s range.\n - `intersects`: Matches documents with a range field value that intersects the query’s range.\n\n"
default: intersects
allOf:
- $ref: '#/components/schemas/_types.query_dsl.RangeRelation'
gt:
description: Greater than.
type: string
gte:
description: Greater than or equal to.
type: string
lt:
description: Less than.
type: string
lte:
description: Less than or equal to.
type: string
_types.query_dsl.IdsQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
values:
description: An array of document IDs.
allOf:
- $ref: '#/components/schemas/_types.Ids'
_types.aggregations.TestPopulation:
type: object
properties:
field:
description: The field to aggregate.
allOf:
- $ref: '#/components/schemas/_types.Field'
script:
allOf:
- $ref: '#/components/schemas/_types.Script'
filter:
description: A filter used to define a set of records to run unpaired t-test on.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
required:
- field
_types.RetrieverContainer:
type: object
properties:
standard:
description: A retriever that replaces the functionality of a traditional query.
allOf:
- $ref: '#/components/schemas/_types.StandardRetriever'
knn:
description: A retriever that replaces the functionality of a knn search.
allOf:
- $ref: '#/components/schemas/_types.KnnRetriever'
rrf:
description: A retriever that produces top documents from reciprocal rank fusion (RRF).
allOf:
- $ref: '#/components/schemas/_types.RRFRetriever'
text_similarity_reranker:
description: A retriever that reranks the top documents based on a reranking model using the InferenceAPI
allOf:
- $ref: '#/components/schemas/_types.TextSimilarityReranker'
rule:
description: A retriever that replaces the functionality of a rule query.
allOf:
- $ref: '#/components/schemas/_types.RuleRetriever'
rescorer:
description: A retriever that re-scores only the results produced by its child retriever.
allOf:
- $ref: '#/components/schemas/_types.RescorerRetriever'
linear:
description: A retriever that supports the combination of different retrievers through a weighted linear combination.
allOf:
- $ref: '#/components/schemas/_types.LinearRetriever'
pinned:
description: 'A pinned retriever applies pinned documents to the underlying retriever.
This retriever will rewrite to a PinnedQueryBuilder.'
allOf:
- $ref: '#/components/schemas/_types.PinnedRetriever'
diversify:
description: A retriever that diversifies the results from its child retriever.
allOf:
- $ref: '#/components/schemas/_types.DiversifyRetriever'
minProperties: 1
maxProperties: 1
_types.query_dsl.UntypedDecayFunction:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.DecayFunctionBase'
- type: object
_types.query_dsl.TypeQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
value:
type: string
required:
- value
_types.ScriptSource:
oneOf:
- type: string
- $ref: '#/components/schemas/_global.search._types.SearchRequestBody'
_types.aggregations.HoltMovingAverageAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.MovingAverageAggregationBase'
- type: object
properties:
model:
type: string
enum:
- holt
settings:
allOf:
- $ref: '#/components/schemas/_types.aggregations.HoltLinearModelSettings'
required:
- model
- settings
_global.search._types.SourceFilter:
type: object
properties:
exclude_vectors:
description: 'If `true`, vector fields are excluded from the returned source.
This option takes precedence over `includes`: any vector field will
remain excluded even if it matches an `includes` rule.'
type: boolean
excludes:
description: A list of fields to exclude from the returned source.
allOf:
- $ref: '#/components/schemas/_types.Fields'
includes:
description: A list of fields to include in the returned source.
allOf:
- $ref: '#/components/schemas/_types.Fields'
_types.RRFRetriever:
allOf:
- $ref: '#/components/schemas/_types.RetrieverBase'
- type: object
properties:
retrievers:
description: A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. Each retriever can optionally include a weight parameter.
type: array
items:
$ref: '#/components/schemas/_types.RRFRetrieverEntry'
rank_constant:
description: This value determines how much influence documents in individual result sets per query have over the final ranked result set.
type: number
rank_window_size:
description: This value determines the size of the individual result sets per query.
type: number
query:
type: string
fields:
type: array
items:
type: string
required:
- retrievers
_types.aggregations.MaxAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.FormatMetricAggregationBase'
- type: object
_types.query_dsl.GeoBoundingBoxQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
type:
deprecated: true
allOf:
- $ref: '#/components/schemas/_types.query_dsl.GeoExecution'
validation_method:
description: "Set to `IGNORE_MALFORMED` to accept geo points with invalid latitude or longitude.\nSet to `COERCE` to also try to infer correct latitude or longitude.\n\nSupported values include:\n - `coerce`: Accept geo points with invalid latitude or longitude and additionally try and infer correct coordinates.\n - `ignore_malformed`: Accept geo points with invalid latitude or longitude.\n - `strict`\n\n"
default: '''strict'''
allOf:
- $ref: '#/components/schemas/_types.query_dsl.GeoValidationMethod'
ignore_unmapped:
description: 'Set to `true` to ignore an unmapped field and not match any documents for this query.
Set to `false` to throw an exception if the field is not mapped.'
default: false
type: boolean
_types.VersionNumber:
type: number
_types.mapping.ChunkRescorerChunkingSettings:
type: object
properties:
strategy:
externalDocs:
url: https://www.elastic.co/docs/explore-analyze/elastic-inference/inference-api#chunking-strategies
description: "The chunking strategy: `sentence`, `word`, `none` or `recursive`.\n\n * If `strategy` is set to `recursive`, you must also specify:\n\n- `max_chunk_size`\n- either `separators` or`separator_group`\n\nLearn more about different chunking strategies in the linked documentation."
default: sentence
type: string
separator_group:
description: 'Only applicable to the `recursive` strategy and required when using it.
Sets a predefined list of separators in the saved chunking settings based on the selected text type.
Values can be `markdown` or `plaintext`.
Using this parameter is an alternative to manually specifying a custom `separators` list.'
type: string
separators:
description: 'Only applicable to the `recursive` strategy and required when using it.
A list of strings used as possible split points when chunking text.
Each string can be a plain string or a regular expression (regex) pattern.
The system tries each separator in order to split the text, starting from the first item in the list.
After splitting, it attempts to recombine smaller pieces into larger chunks that stay within
the `max_chunk_size` limit, to reduce the total number of chunks generated.'
type: array
items:
type: string
max_chunk_size:
description: 'The maximum size of a chunk in words.
This value cannot be lower than `20` (for `sentence` strategy) or `10` (for `word` strategy).
This value should not exceed the window size for the associated model.'
default: 250.0
type: number
overlap:
description: 'The number of overlapping words for chunks.
It is applicable only to a `word` chunking strategy.
This value cannot be higher than half the `max_chunk_size` value.'
default: 100.0
type: number
sentence_overlap:
description: 'The number of overlapping sentences for chunks.
It is applicable only for a `sentence` chunking strategy.
It can be either `1` or `0`.'
default: 1.0
type: number
required:
- max_chunk_size
_types.RankContainer:
type: object
properties:
rrf:
description: The reciprocal rank fusion parameters
allOf:
- $ref: '#/components/schemas/_types.RrfRank'
minProperties: 1
maxProperties: 1
_types.query_dsl.GeoGridQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
geotile:
allOf:
- $ref: '#/components/schemas/_types.GeoTile'
geohash:
allOf:
- $ref: '#/components/schemas/_types.GeoHash'
geohex:
allOf:
- $ref: '#/components/schemas/_types.GeoHexCell'
minProperties: 1
maxProperties: 1
_types.Id:
type: string
_types.DiversifyRetrieverTypes:
type: string
enum:
- mmr
_types.query_dsl.NestedQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
ignore_unmapped:
description: Indicates whether to ignore an unmapped path and not return any documents instead of an error.
default: false
type: boolean
inner_hits:
description: If defined, each search hit will contain inner hits.
allOf:
- $ref: '#/components/schemas/_global.search._types.InnerHits'
path:
description: Path to the nested object you wish to search.
allOf:
- $ref: '#/components/schemas/_types.Field'
query:
description: Query you wish to run on nested objects in the path.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
score_mode:
description: How scores for matching child objects affect the root parent document’s relevance score.
default: '''avg'''
allOf:
- $ref: '#/components/schemas/_types.query_dsl.ChildScoreMode'
required:
- path
- query
_types.SequenceNumber:
type: number
_global.search._types.HighlightBase:
type: object
properties:
type:
description: "\n\nSupported values include:\n - `plain`: The `plain` highlighter uses the standard Lucene highlighter\n - `fvh`: The fvh highlighter uses the Lucene Fast Vector highlighter.\n - `unified`: The unified highlighter uses the Lucene Unified Highlighter.\n\n"
allOf:
- $ref: '#/components/schemas/_global.search._types.HighlighterType'
boundary_chars:
description: A string that contains each boundary character.
default: .,!? \t\n
type: string
boundary_max_scan:
description: How far to scan for boundary characters.
default: 20.0
type: number
boundary_scanner:
description: "Specifies how to break the highlighted fragments: chars, sentence, or word.\nOnly valid for the unified and fvh highlighters.\nDefaults to `sentence` for the `unified` highlighter. Defaults to `chars` for the `fvh` highlighter.\n\nSupported values include:\n - `chars`: Use the characters specified by `boundary_chars` as highlighting boundaries.\nThe `boundary_max_scan` setting controls how far to scan for boundary characters.\nOnly valid for the `fvh` highlighter.\n - `sentence`: Break highlighted fragments at the next sentence boundary, as determined by Java’s `BreakIterator`.\nYou can specify the locale to use with `boundary_scanner_locale`.\nWhen used with the `unified` highlighter, the `sentence` scanner splits sentences bigger than `fragment_size` at the first word boundary next to fragment_size.\nYou can set `fragment_size` to `0` to never split any sentence.\n - `word`: Break highlighted fragments at the next word boundary, as determined by Java’s `BreakIterator`.\nYou can specify the locale to use with `boundary_scanner_locale`.\n\n"
allOf:
- $ref: '#/components/schemas/_global.search._types.BoundaryScanner'
boundary_scanner_locale:
description: 'Controls which locale is used to search for sentence and word boundaries.
This parameter takes a form of a language tag, for example: `"en-US"`, `"fr-FR"`, `"ja-JP"`.'
default: Locale.ROOT
type: string
force_source:
deprecated: true
type: boolean
fragmenter:
description: 'Specifies how text should be broken up in highlight snippets: `simple` or `span`.
Only valid for the `plain` highlighter.'
default: span
allOf:
- $ref: '#/components/schemas/_global.search._types.HighlighterFragmenter'
fragment_size:
description: The size of the highlighted fragment in characters.
default: 100.0
type: number
highlight_filter:
type: boolean
highlight_query:
description: 'Highlight matches for a query other than the search query.
This is especially useful if you use a rescore query because those are not taken into account by highlighting by default.'
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
max_fragment_length:
type: number
max_analyzed_offset:
description: 'If set to a non-negative value, highlighting stops at this defined maximum limit.
The rest of the text is not processed, thus not highlighted and no error is returned
The `max_analyzed_offset` query setting does not override the `index.highlight.max_analyzed_offset` setting, which prevails when it’s set to lower value than the query setting.'
type: number
no_match_size:
description: The amount of text you want to return from the beginning of the field if there are no matching fragments to highlight.
default: 0.0
type: number
number_of_fragments:
description: 'The maximum number of fragments to return.
If the number of fragments is set to `0`, no fragments are returned.
Instead, the entire field contents are highlighted and returned.
This can be handy when you need to highlight short texts such as a title or address, but fragmentation is not required.
If `number_of_fragments` is `0`, `fragment_size` is ignored.'
default: 5.0
type: number
options:
type: object
additionalProperties:
type: object
order:
description: 'Sorts highlighted fragments by score when set to `score`.
By default, fragments will be output in the order they appear in the field (order: `none`).
Setting this option to `score` will output the most relevant fragments first.
Each highlighter applies its own logic to compute relevancy scores.'
default: none
allOf:
- $ref: '#/components/schemas/_global.search._types.HighlighterOrder'
phrase_limit:
description: 'Controls the number of matching phrases in a document that are considered.
Prevents the `fvh` highlighter from analyzing too many phrases and consuming too much memory.
When using `matched_fields`, `phrase_limit` phrases per matched field are considered. Raising the limit increases query time and consumes more memory.
Only supported by the `fvh` highlighter.'
default: 256.0
type: number
post_tags:
description: 'Use in conjunction with `pre_tags` to define the HTML tags to use for the highlighted text.
By default, highlighted text is wrapped in `` and `` tags.'
type: array
items:
type: string
pre_tags:
description: 'Use in conjunction with `post_tags` to define the HTML tags to use for the highlighted text.
By default, highlighted text is wrapped in `` and `` tags.'
type: array
items:
type: string
require_field_match:
description: 'By default, only fields that contains a query match are highlighted.
Set to `false` to highlight all fields.'
default: true
type: boolean
tags_schema:
description: Set to `styled` to use the built-in tag schema.
allOf:
- $ref: '#/components/schemas/_global.search._types.HighlighterTagsSchema'
_types.aggregations.MovingAverageAggregation:
discriminator:
propertyName: model
mapping:
ewma: '#/components/schemas/_types.aggregations.EwmaMovingAverageAggregation'
holt: '#/components/schemas/_types.aggregations.HoltMovingAverageAggregation'
holt_winters: '#/components/schemas/_types.aggregations.HoltWintersMovingAverageAggregation'
linear: '#/components/schemas/_types.aggregations.LinearMovingAverageAggregation'
simple: '#/components/schemas/_types.aggregations.SimpleMovingAverageAggregation'
oneOf:
- $ref: '#/components/schemas/_types.aggregations.LinearMovingAverageAggregation'
- $ref: '#/components/schemas/_types.aggregations.SimpleMovingAverageAggregation'
- $ref: '#/components/schemas/_types.aggregations.EwmaMovingAverageAggregation'
- $ref: '#/components/schemas/_types.aggregations.HoltMovingAverageAggregation'
- $ref: '#/components/schemas/_types.aggregations.HoltWintersMovingAverageAggregation'
_types.StandardRetriever:
allOf:
- $ref: '#/components/schemas/_types.RetrieverBase'
- type: object
properties:
query:
description: Defines a query to retrieve a set of top documents.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
search_after:
description: Defines a search after object parameter used for pagination.
allOf:
- $ref: '#/components/schemas/_types.SortResults'
terminate_after:
description: Maximum number of documents to collect for each shard.
type: number
sort:
description: A sort object that that specifies the order of matching documents.
allOf:
- $ref: '#/components/schemas/_types.Sort'
collapse:
description: Collapses the top documents by a specified key into a single top document per key.
allOf:
- $ref: '#/components/schemas/_global.search._types.FieldCollapse'
_types.RetrieverBase:
type: object
properties:
filter:
description: Query to filter the documents that can match.
oneOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
- type: array
items:
$ref: '#/components/schemas/_types.query_dsl.QueryContainer'
min_score:
description: Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
type: number
_name:
description: Retriever name.
type: string
_types.query_dsl.UntypedDistanceFeatureQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.DistanceFeatureQueryBase'
- type: object
_types.aggregations.BucketPathAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.Aggregation'
- type: object
properties:
buckets_path:
description: Path to the buckets that contain one set of values to correlate.
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketsPath'
_types.query_dsl.TextExpansionQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
model_id:
description: The text expansion NLP model to use
type: string
model_text:
description: The query text
type: string
pruning_config:
description: Token pruning configurations
x-state: Technical preview; Added in 8.13.0
allOf:
- $ref: '#/components/schemas/_types.TokenPruningConfig'
required:
- model_id
- model_text
_types.aggregations.EwmaModelSettings:
type: object
properties:
alpha:
type: number
_types.KnnRetriever:
allOf:
- $ref: '#/components/schemas/_types.RetrieverBase'
- type: object
properties:
field:
description: The name of the vector field to search against.
type: string
query_vector:
description: Query vector. Must have the same number of dimensions as the vector field you are searching against. You must provide a query_vector_builder or query_vector, but not both.
allOf:
- $ref: '#/components/schemas/_types.QueryVector'
query_vector_builder:
description: Defines a model to build a query vector.
allOf:
- $ref: '#/components/schemas/_types.QueryVectorBuilder'
k:
description: Number of nearest neighbors to return as top hits.
type: number
num_candidates:
description: Number of nearest neighbor candidates to consider per shard.
type: number
visit_percentage:
description: The percentage of vectors to explore per shard while doing knn search with bbq_disk
x-state: Generally available; Added in 9.2.0
type: number
similarity:
description: The minimum similarity required for a document to be considered a match.
type: number
rescore_vector:
description: Apply oversampling and rescoring to quantized vectors
x-state: Generally available; Added in 8.18.0
allOf:
- $ref: '#/components/schemas/_types.RescoreVector'
required:
- field
- k
- num_candidates
_global.bulk.OperationContainer:
type: object
properties:
index:
description: 'Index the specified document.
If the document exists, it replaces the document and increments the version.
The following line must contain the source data to be indexed.'
allOf:
- $ref: '#/components/schemas/_global.bulk.IndexOperation'
create:
description: 'Index the specified document if it does not already exist.
The following line must contain the source data to be indexed.'
allOf:
- $ref: '#/components/schemas/_global.bulk.CreateOperation'
update:
description: 'Perform a partial document update.
The following line must contain the partial document and update options.'
allOf:
- $ref: '#/components/schemas/_global.bulk.UpdateOperation'
delete:
description: Remove the specified document from the index.
allOf:
- $ref: '#/components/schemas/_global.bulk.DeleteOperation'
minProperties: 1
maxProperties: 1
_types.aggregations.MultiTermLookup:
type: object
properties:
field:
description: A fields from which to retrieve terms.
allOf:
- $ref: '#/components/schemas/_types.Field'
missing:
description: 'The value to apply to documents that do not have a value.
By default, documents without a value are ignored.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.Missing'
required:
- field
_types.Result:
type: string
enum:
- created
- updated
- deleted
- not_found
- noop
_types.ScriptSortType:
type: string
enum:
- string
- number
- version
_types.query_dsl.RangeQueryBase:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
relation:
description: "Indicates how the range query matches values for `range` fields.\n\nSupported values include:\n - `within`: Matches documents with a range field value entirely within the query’s range.\n - `contains`: Matches documents with a range field value that entirely contains the query’s range.\n - `intersects`: Matches documents with a range field value that intersects the query’s range.\n\n"
default: intersects
allOf:
- $ref: '#/components/schemas/_types.query_dsl.RangeRelation'
gt:
description: Greater than.
type: object
gte:
description: Greater than or equal to.
type: object
lt:
description: Less than.
type: object
lte:
description: Less than or equal to.
type: object
_types.aggregations.SimpleMovingAverageAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.MovingAverageAggregationBase'
- type: object
properties:
model:
type: string
enum:
- simple
settings:
allOf:
- $ref: '#/components/schemas/_types.EmptyObject'
required:
- model
- settings
_types.query_dsl.SpanFieldMaskingQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
field:
allOf:
- $ref: '#/components/schemas/_types.Field'
query:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanQuery'
required:
- field
- query
_types.DurationValueUnitNanos:
allOf:
- $ref: '#/components/schemas/_types.UnitNanos'
_types.aggregations.AggregateOrder:
oneOf:
- type: object
additionalProperties:
$ref: '#/components/schemas/_types.SortOrder'
minProperties: 1
maxProperties: 1
- type: array
items:
type: object
additionalProperties:
$ref: '#/components/schemas/_types.SortOrder'
minProperties: 1
maxProperties: 1
tasks._types.ParentTaskInfo:
allOf:
- $ref: '#/components/schemas/tasks._types.TaskInfo'
- type: object
properties:
children:
type: array
items:
$ref: '#/components/schemas/tasks._types.TaskInfo'
_types.aggregations.WeightedAverageAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.Aggregation'
- type: object
properties:
format:
description: A numeric response formatter.
type: string
value:
description: Configuration for the field that provides the values.
allOf:
- $ref: '#/components/schemas/_types.aggregations.WeightedAverageValue'
value_type:
allOf:
- $ref: '#/components/schemas/_types.aggregations.ValueType'
weight:
description: Configuration for the field or script that provides the weights.
allOf:
- $ref: '#/components/schemas/_types.aggregations.WeightedAverageValue'
_types.aggregations.EwmaMovingAverageAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.MovingAverageAggregationBase'
- type: object
properties:
model:
type: string
enum:
- ewma
settings:
allOf:
- $ref: '#/components/schemas/_types.aggregations.EwmaModelSettings'
required:
- model
- settings
_global.search._types.SourceConfigParam:
description: 'Defines how to fetch a source. Fetching can be disabled entirely, or the source can be filtered.
Used as a query parameter along with the `_source_includes` and `_source_excludes` parameters.'
oneOf:
- type: boolean
- $ref: '#/components/schemas/_types.Fields'
_types.aggregations.TDigestExecutionHint:
type: string
enum:
- default
- high_accuracy
_types.query_dsl.GeoDistanceQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
distance:
description: 'The radius of the circle centred on the specified location.
Points which fall into this circle are considered to be matches.'
allOf:
- $ref: '#/components/schemas/_types.Distance'
distance_type:
description: "How to compute the distance.\nSet to `plane` for a faster calculation that's inaccurate on long distances and close to the poles.\n\nSupported values include:\n - `arc`: The `arc` calculation is the most accurate.\n - `plane`: The `plane` calculation is faster but less accurate.\n\n"
default: '''arc'''
allOf:
- $ref: '#/components/schemas/_types.GeoDistanceType'
validation_method:
description: "Set to `IGNORE_MALFORMED` to accept geo points with invalid latitude or longitude.\nSet to `COERCE` to also try to infer correct latitude or longitude.\n\nSupported values include:\n - `coerce`: Accept geo points with invalid latitude or longitude and additionally try and infer correct coordinates.\n - `ignore_malformed`: Accept geo points with invalid latitude or longitude.\n - `strict`\n\n"
default: '''strict'''
allOf:
- $ref: '#/components/schemas/_types.query_dsl.GeoValidationMethod'
ignore_unmapped:
description: 'Set to `true` to ignore an unmapped field and not match any documents for this query.
Set to `false` to throw an exception if the field is not mapped.'
default: false
type: boolean
required:
- distance
_types.query_dsl.GeoDecayFunction:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.DecayFunctionBaseGeoLocationDistance'
- type: object
_global.search._types.HighlighterType:
anyOf:
- type: string
enum:
- plain
- fvh
- unified
- type: string
_types.query_dsl.SimpleQueryStringFlags:
description: Query flags can be either a single flag or a combination of flags, e.g. `OR|AND|PREFIX`
allOf:
- $ref: '#/components/schemas/_spec_utils.PipeSeparatedFlagsSimpleQueryStringFlag'
_types.VersionType:
type: string
enum:
- internal
- external
- external_gte
_types.aggregations.ChiSquareHeuristic:
type: object
properties:
background_is_superset:
description: Set to `false` if you defined a custom background filter that represents a different set of documents that you want to compare to.
type: boolean
include_negatives:
description: Set to `false` to filter out the terms that appear less often in the subset than in documents outside the subset.
type: boolean
required:
- background_is_superset
- include_negatives
_types.aggregations.PercentageScoreHeuristic:
type: object
_types.query_dsl.HasChildQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
ignore_unmapped:
description: Indicates whether to ignore an unmapped `type` and not return any documents instead of an error.
default: false
type: boolean
inner_hits:
description: If defined, each search hit will contain inner hits.
allOf:
- $ref: '#/components/schemas/_global.search._types.InnerHits'
max_children:
description: 'Maximum number of child documents that match the query allowed for a returned parent document.
If the parent document exceeds this limit, it is excluded from the search results.'
type: number
min_children:
description: 'Minimum number of child documents that match the query required to match the query for a returned parent document.
If the parent document does not meet this limit, it is excluded from the search results.'
type: number
query:
description: 'Query you wish to run on child documents of the `type` field.
If a child document matches the search, the query returns the parent document.'
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
score_mode:
description: Indicates how scores for matching child documents affect the root parent document’s relevance score.
default: '''none'''
allOf:
- $ref: '#/components/schemas/_types.query_dsl.ChildScoreMode'
type:
description: Name of the child relationship mapped for the `join` field.
allOf:
- $ref: '#/components/schemas/_types.RelationName'
required:
- query
- type
_types.Routing:
oneOf:
- type: string
- type: array
items:
type: string
_types.aggregations.MovingFunctionAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.PipelineAggregationBase'
- type: object
properties:
script:
description: The script that should be executed on each window of data.
type: string
shift:
description: 'By default, the window consists of the last n values excluding the current bucket.
Increasing `shift` by 1, moves the starting window position by 1 to the right.'
default: 0.0
type: number
window:
description: The size of window to "slide" across the histogram.
type: number
_types.query_dsl.CombinedFieldsZeroTerms:
type: string
enum:
- none
- all
_types.NodeRoles:
type: array
items:
$ref: '#/components/schemas/_types.NodeRole'
_types.aggregations.MutualInformationHeuristic:
type: object
properties:
background_is_superset:
description: Set to `false` if you defined a custom background filter that represents a different set of documents that you want to compare to.
type: boolean
include_negatives:
description: Set to `false` to filter out the terms that appear less often in the subset than in documents outside the subset.
type: boolean
tasks._types.TaskListResponseBase:
type: object
properties:
node_failures:
type: array
items:
$ref: '#/components/schemas/_types.ErrorCause'
task_failures:
type: array
items:
$ref: '#/components/schemas/_types.TaskFailure'
nodes:
description: Task information grouped by node, if `group_by` was set to `node` (the default).
type: object
additionalProperties:
$ref: '#/components/schemas/tasks._types.NodeTasks'
tasks:
description: 'Either a flat list of tasks if `group_by` was set to `none`, or grouped by parents if
`group_by` was set to `parents`.'
allOf:
- $ref: '#/components/schemas/tasks._types.TaskInfos'
_types.query_dsl.RankFeatureFunctionLinear:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.RankFeatureFunction'
- type: object
_types.query_dsl.ChildScoreMode:
type: string
enum:
- none
- avg
- sum
- max
- min
_types.aggregations.CompositeAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
after:
description: When paginating, use the `after_key` value returned in the previous response to retrieve the next page.
allOf:
- $ref: '#/components/schemas/_types.aggregations.CompositeAggregateKey'
size:
description: The number of composite buckets that should be returned.
default: 10.0
type: number
sources:
description: 'The value sources used to build composite buckets.
Keys are returned in the order of the `sources` definition.'
type: array
items:
type: object
additionalProperties:
$ref: '#/components/schemas/_types.aggregations.CompositeAggregationSource'
minProperties: 1
maxProperties: 1
_types.query_dsl.SpanGapQuery:
description: Can only be used as a clause in a span_near query.
type: object
additionalProperties:
type: number
minProperties: 1
maxProperties: 1
_types.QueryVectorBuilder:
type: object
properties:
text_embedding:
allOf:
- $ref: '#/components/schemas/_types.TextEmbedding'
minProperties: 1
maxProperties: 1
_types.DateFormat:
type: string
_types.Script:
type: object
properties:
source:
description: The script source.
allOf:
- $ref: '#/components/schemas/_types.ScriptSource'
id:
description: The `id` for a stored script.
allOf:
- $ref: '#/components/schemas/_types.Id'
params:
description: 'Specifies any named parameters that are passed into the script as variables.
Use parameters instead of hard-coded values to decrease compile time.'
type: object
additionalProperties:
type: object
lang:
description: "Specifies the language the script is written in.\n\nSupported values include:\n - `painless`: Painless scripting language, purpose-built for Elasticsearch.\n - `expression`: Lucene’s expressions language, compiles a JavaScript expression to bytecode.\n - `mustache`: Mustache templated, used for templates.\n - `java`: Expert Java API\n\n"
default: painless
allOf:
- $ref: '#/components/schemas/_types.ScriptLanguage'
options:
type: object
additionalProperties:
type: string
_types.GeoDistanceType:
type: string
enum:
- arc
- plane
_types.DurationLarge:
description: 'A date histogram interval. Similar to `Duration` with additional units: `w` (week), `M` (month), `q` (quarter) and
`y` (year)'
type: string
_types.aggregations.BucketKsAggregation:
description: 'A sibling pipeline aggregation which executes a two sample Kolmogorov–Smirnov test (referred
to as a "K-S test" from now on) against a provided distribution, and the distribution implied
by the documents counts in the configured sibling aggregation. Specifically, for some metric,
assuming that the percentile intervals of the metric are known beforehand or have been computed
by an aggregation, then one would use range aggregation for the sibling to compute the p-value
of the distribution difference between the metric and the restriction of that metric to a subset
of the documents. A natural use case is if the sibling aggregation range aggregation nested in a
terms aggregation, in which case one compares the overall distribution of metric to its restriction
to each term.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketPathAggregation'
- type: object
properties:
alternative:
description: 'A list of string values indicating which K-S test alternative to calculate. The valid values
are: "greater", "less", "two_sided". This parameter is key for determining the K-S statistic used
when calculating the K-S test. Default value is all possible alternative hypotheses.'
type: array
items:
type: string
fractions:
description: 'A list of doubles indicating the distribution of the samples with which to compare to the `buckets_path` results.
In typical usage this is the overall proportion of documents in each bucket, which is compared with the actual
document proportions in each bucket from the sibling aggregation counts. The default is to assume that overall
documents are uniformly distributed on these buckets, which they would be if one used equal percentiles of a
metric to define the bucket end points.'
type: array
items:
type: number
sampling_method:
description: 'Indicates the sampling methodology when calculating the K-S test. Note, this is sampling of the returned values.
This determines the cumulative distribution function (CDF) points used comparing the two samples. Default is
`upper_tail`, which emphasizes the upper end of the CDF points. Valid options are: `upper_tail`, `uniform`,
and `lower_tail`.'
type: string
_types.aggregations.BucketCorrelationAggregation:
description: A sibling pipeline aggregation which executes a correlation function on the configured sibling multi-bucket aggregation.
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketPathAggregation'
- type: object
properties:
function:
description: The correlation function to execute.
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketCorrelationFunction'
required:
- function
_types.aggregations.GeoHashGridAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
bounds:
description: The bounding box to filter the points in each bucket.
allOf:
- $ref: '#/components/schemas/_types.GeoBounds'
field:
description: 'Field containing indexed `geo_point` or `geo_shape` values.
If the field contains an array, `geohash_grid` aggregates all array values.'
allOf:
- $ref: '#/components/schemas/_types.Field'
precision:
description: The string length of the geohashes used to define cells/buckets in the results.
default: '5'
allOf:
- $ref: '#/components/schemas/_types.GeoHashPrecision'
shard_size:
description: 'Allows for more accurate counting of the top cells returned in the final result the aggregation.
Defaults to returning `max(10,(size x number-of-shards))` buckets from each shard.'
type: number
size:
description: The maximum number of geohash buckets to return.
default: 10000.0
type: number
_types.aggregations.GlobalAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
_types.NestedSortValue:
type: object
properties:
filter:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
max_children:
type: number
nested:
allOf:
- $ref: '#/components/schemas/_types.NestedSortValue'
path:
allOf:
- $ref: '#/components/schemas/_types.Field'
required:
- path
_types.GeoTile:
description: A map tile reference, represented as `{zoom}/{x}/{y}`
type: string
_types.aggregations.VariableWidthHistogramAggregation:
type: object
properties:
field:
description: The name of the field.
allOf:
- $ref: '#/components/schemas/_types.Field'
buckets:
description: The target number of buckets.
default: 10.0
type: number
shard_size:
description: 'The number of buckets that the coordinating node will request from each shard.
Defaults to `buckets * 50`.'
type: number
initial_buffer:
description: 'Specifies the number of individual documents that will be stored in memory on a shard before the initial bucketing algorithm is run.
Defaults to `min(10 * shard_size, 50000)`.'
type: number
script:
allOf:
- $ref: '#/components/schemas/_types.Script'
_types.aggregations.MinBucketAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.PipelineAggregationBase'
- type: object
_types.query_dsl.IntervalsPrefix:
type: object
properties:
analyzer:
description: Analyzer used to analyze the `prefix`.
type: string
prefix:
description: Beginning characters of terms you wish to find in the top-level field.
type: string
use_field:
description: 'If specified, match intervals from this field rather than the top-level field.
The `prefix` is normalized using the search analyzer from this field, unless `analyzer` is specified separately.'
allOf:
- $ref: '#/components/schemas/_types.Field'
required:
- prefix
_types.RescoreVector:
type: object
properties:
oversample:
description: Applies the specified oversample factor to k on the approximate kNN search
type: number
required:
- oversample
_types.aggregations.GoogleNormalizedDistanceHeuristic:
type: object
properties:
background_is_superset:
description: Set to `false` if you defined a custom background filter that represents a different set of documents that you want to compare to.
type: boolean
_types.query_dsl.IntervalsRange:
type: object
properties:
analyzer:
description: Analyzer used to analyze the `prefix`.
type: string
gte:
description: Lower term, either gte or gt must be provided.
type: string
gt:
description: Lower term, either gte or gt must be provided.
type: string
lte:
description: Upper term, either lte or lt must be provided.
type: string
lt:
description: Upper term, either lte or lt must be provided.
type: string
use_field:
description: 'If specified, match intervals from this field rather than the top-level field.
The `prefix` is normalized using the search analyzer from this field, unless `analyzer` is specified separately.'
allOf:
- $ref: '#/components/schemas/_types.Field'
_types.Host:
type: string
_types.OpType:
type: string
enum:
- index
- create
_types.query_dsl.RangeRelation:
type: string
enum:
- within
- contains
- intersects
_types.aggregations.AverageBucketAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.PipelineAggregationBase'
- type: object
_types.query_dsl.PercolateQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
document:
description: The source of the document being percolated.
type: object
documents:
description: An array of sources of the documents being percolated.
type: array
items:
type: object
field:
description: Field that holds the indexed queries. The field must use the `percolator` mapping type.
allOf:
- $ref: '#/components/schemas/_types.Field'
id:
description: The ID of a stored document to percolate.
allOf:
- $ref: '#/components/schemas/_types.Id'
index:
description: The index of a stored document to percolate.
allOf:
- $ref: '#/components/schemas/_types.IndexName'
name:
description: The suffix used for the `_percolator_document_slot` field when multiple `percolate` queries are specified.
type: string
preference:
description: Preference used to fetch document to percolate.
type: string
routing:
description: Routing used to fetch document to percolate.
allOf:
- $ref: '#/components/schemas/_types.Routing'
version:
description: The expected version of a stored document to percolate.
allOf:
- $ref: '#/components/schemas/_types.VersionNumber'
required:
- field
_types.uint:
type: number
_types.aggregations.HdrMethod:
type: object
properties:
number_of_significant_value_digits:
description: Specifies the resolution of values for the histogram in number of significant digits.
type: number
_types.GeoHexCell:
description: A map hex cell (H3) reference
type: string
_types.DistanceUnit:
type: string
enum:
- in
- ft
- yd
- mi
- nmi
- km
- m
- cm
- mm
_types.aggregations.CategorizeTextAggregation:
description: 'A multi-bucket aggregation that groups semi-structured text into buckets. Each text
field is re-analyzed using a custom analyzer. The resulting tokens are then categorized
creating buckets of similarly formatted text values. This aggregation works best with machine
generated text like system logs. Only the first 100 analyzed tokens are used to categorize the text.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.Aggregation'
- type: object
properties:
field:
description: The semi-structured text field to categorize.
allOf:
- $ref: '#/components/schemas/_types.Field'
max_unique_tokens:
description: 'The maximum number of unique tokens at any position up to max_matched_tokens. Must be larger than 1.
Smaller values use less memory and create fewer categories. Larger values will use more memory and
create narrower categories. Max allowed value is 100.'
default: 50.0
type: number
max_matched_tokens:
description: 'The maximum number of token positions to match on before attempting to merge categories. Larger
values will use more memory and create narrower categories. Max allowed value is 100.'
default: 5.0
type: number
similarity_threshold:
description: 'The minimum percentage of tokens that must match for text to be added to the category bucket. Must
be between 1 and 100. The larger the value the narrower the categories. Larger values will increase memory
usage and create narrower categories.'
default: 50.0
type: number
categorization_filters:
description: 'This property expects an array of regular expressions. The expressions are used to filter out matching
sequences from the categorization field values. You can use this functionality to fine tune the categorization
by excluding sequences from consideration when categories are defined. For example, you can exclude SQL
statements that appear in your log files. This property cannot be used at the same time as categorization_analyzer.
If you only want to define simple regular expression filters that are applied prior to tokenization, setting
this property is the easiest method. If you also want to customize the tokenizer or post-tokenization filtering,
use the categorization_analyzer property instead and include the filters as pattern_replace character filters.'
type: array
items:
type: string
categorization_analyzer:
externalDocs:
url: https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-analyze
description: 'The categorization analyzer specifies how the text is analyzed and tokenized before being categorized.
The syntax is very similar to that used to define the analyzer in the analyze API. This property
cannot be used at the same time as `categorization_filters`.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.CategorizeTextAnalyzer'
shard_size:
description: The number of categorization buckets to return from each shard before merging all the results.
type: number
size:
description: The number of buckets to return.
default: 10.0
type: number
min_doc_count:
description: The minimum number of documents in a bucket to be returned to the results.
type: number
shard_min_doc_count:
description: The minimum number of documents in a bucket to be returned from the shard before merging.
type: number
required:
- field
_types.aggregations.ChangePointAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.PipelineAggregationBase'
- type: object
_global.search._types.ScriptRescore:
type: object
properties:
script:
allOf:
- $ref: '#/components/schemas/_types.Script'
required:
- script
_types.query_dsl.MultiValueMode:
type: string
enum:
- min
- max
- avg
- sum
_types.query_dsl.MatchPhraseQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
analyzer:
description: Analyzer used to convert the text in the query value into tokens.
type: string
query:
description: Query terms that are analyzed and turned into a phrase query.
type: string
slop:
description: Maximum number of positions allowed between matching tokens.
default: 0.0
type: number
zero_terms_query:
description: "Indicates whether no documents are returned if the `analyzer` removes all tokens, such as when using a `stop` filter.\n\nSupported values include:\n - `all`: Returns all documents, similar to a `match_all` query.\n - `none`: No documents are returned if the `analyzer` removes all tokens.\n\n"
default: '''none'''
allOf:
- $ref: '#/components/schemas/_types.query_dsl.ZeroTermsQuery'
required:
- query
_types.FieldValue:
description: A field value.
oneOf:
- type: number
- type: number
- type: string
- type: boolean
- type:
- string
- 'null'
_types.aggregations.BucketSortAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.Aggregation'
- type: object
properties:
from:
description: Buckets in positions prior to `from` will be truncated.
type: number
gap_policy:
description: "The policy to apply when gaps are found in the data.\n\nSupported values include:\n - `skip`: Treats missing data as if the bucket does not exist. It will skip the bucket and\ncontinue calculating using the next available value.\n - `insert_zeros`: Replace missing values with a zero (0) and pipeline aggregation computation will proceed as normal.\n - `keep_values`: Similar to skip, except if the metric provides a non-null, non-NaN value this value is used,\notherwise the empty bucket is skipped.\n\n"
default: skip
allOf:
- $ref: '#/components/schemas/_types.aggregations.GapPolicy'
size:
description: 'The number of buckets to return.
Defaults to all buckets of the parent aggregation.'
type: number
sort:
description: The list of fields to sort on.
allOf:
- $ref: '#/components/schemas/_types.Sort'
_types.query_dsl.NumericDecayFunction:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.DecayFunctionBasedoubledouble'
- type: object
_types.aggregations.MetricAggregationBase:
type: object
properties:
field:
description: The field on which to run the aggregation.
allOf:
- $ref: '#/components/schemas/_types.Field'
missing:
description: 'The value to apply to documents that do not have a value.
By default, documents without a value are ignored.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.Missing'
script:
allOf:
- $ref: '#/components/schemas/_types.Script'
_types.GeoHashPrecision:
description: A precision that can be expressed as a geohash length between 1 and 12, or a distance measure like "1km", "10m".
oneOf:
- type: number
- type: string
_types.aggregations.ExtendedBoundsFieldDateMath:
type: object
properties:
max:
description: Maximum value for the bound.
allOf:
- $ref: '#/components/schemas/_types.aggregations.FieldDateMath'
min:
description: Minimum value for the bound.
allOf:
- $ref: '#/components/schemas/_types.aggregations.FieldDateMath'
_types.WriteResponseBase:
type: object
properties:
_id:
description: The unique identifier for the added document.
allOf:
- $ref: '#/components/schemas/_types.Id'
_index:
description: The name of the index the document was added to.
allOf:
- $ref: '#/components/schemas/_types.IndexName'
_primary_term:
description: The primary term assigned to the document for the indexing operation.
type: number
result:
description: 'The result of the indexing operation: `created` or `updated`.'
allOf:
- $ref: '#/components/schemas/_types.Result'
_seq_no:
description: 'The sequence number assigned to the document for the indexing operation.
Sequence numbers are used to ensure an older version of a document doesn''t overwrite a newer version.'
allOf:
- $ref: '#/components/schemas/_types.SequenceNumber'
_shards:
description: Information about the replication process of the operation.
allOf:
- $ref: '#/components/schemas/_types.ShardStatistics'
_version:
description: The document version, which is incremented each time the document is updated.
allOf:
- $ref: '#/components/schemas/_types.VersionNumber'
failure_store:
description: The role of the failure store in this document response
allOf:
- $ref: '#/components/schemas/_global.bulk.FailureStoreStatus'
forced_refresh:
type: boolean
required:
- _id
- _index
- result
- _shards
- _version
_types.Refresh:
type: string
enum:
- 'true'
- 'false'
- wait_for
_types.aggregations.MinAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.FormatMetricAggregationBase'
- type: object
_types.query_dsl.DecayFunctionBaseDateMathDuration:
type: object
properties:
multi_value_mode:
description: "Determines how the distance is calculated when a field used for computing the decay contains multiple values.\n\nSupported values include:\n - `min`: Distance is the minimum distance.\n - `max`: Distance is the maximum distance.\n - `avg`: Distance is the average distance.\n - `sum`: Distance is the sum of all distances.\n\n"
default: min
allOf:
- $ref: '#/components/schemas/_types.query_dsl.MultiValueMode'
_types.aggregations.HistogramAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
extended_bounds:
description: Enables extending the bounds of the histogram beyond the data itself.
allOf:
- $ref: '#/components/schemas/_types.aggregations.ExtendedBoundsdouble'
hard_bounds:
description: 'Limits the range of buckets in the histogram.
It is particularly useful in the case of open data ranges that can result in a very large number of buckets.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.ExtendedBoundsdouble'
field:
description: The name of the field to aggregate on.
allOf:
- $ref: '#/components/schemas/_types.Field'
interval:
description: 'The interval for the buckets.
Must be a positive decimal.'
type: number
min_doc_count:
description: 'Only returns buckets that have `min_doc_count` number of documents.
By default, the response will fill gaps in the histogram with empty buckets.'
type: number
missing:
description: 'The value to apply to documents that do not have a value.
By default, documents without a value are ignored.'
type: number
offset:
description: 'By default, the bucket keys start with 0 and then continue in even spaced steps of `interval`.
The bucket boundaries can be shifted by using the `offset` option.'
type: number
order:
description: 'The sort order of the returned buckets.
By default, the returned buckets are sorted by their key ascending.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.AggregateOrder'
script:
allOf:
- $ref: '#/components/schemas/_types.Script'
format:
type: string
keyed:
description: If `true`, returns buckets as a hash instead of an array, keyed by the bucket keys.
default: false
type: boolean
_types.query_dsl.NumberRangeQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.RangeQueryBasedouble'
- type: object
_global.bulk.OperationBase:
type: object
properties:
_id:
description: The document ID.
allOf:
- $ref: '#/components/schemas/_types.Id'
_index:
description: The name of the index or index alias to perform the action on.
allOf:
- $ref: '#/components/schemas/_types.IndexName'
routing:
description: A custom value used to route operations to a specific shard.
allOf:
- $ref: '#/components/schemas/_types.Routing'
if_primary_term:
type: number
if_seq_no:
allOf:
- $ref: '#/components/schemas/_types.SequenceNumber'
version:
allOf:
- $ref: '#/components/schemas/_types.VersionNumber'
version_type:
description: "\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"
allOf:
- $ref: '#/components/schemas/_types.VersionType'
_types.query_dsl.Operator:
type: string
enum:
- and
- AND
- or
- OR
_types.query_dsl.IntervalsRegexp:
type: object
properties:
analyzer:
description: Analyzer used to analyze the `prefix`.
type: string
pattern:
description: Regex pattern.
type: string
use_field:
description: 'If specified, match intervals from this field rather than the top-level field.
The `prefix` is normalized using the search analyzer from this field, unless `analyzer` is specified separately.'
allOf:
- $ref: '#/components/schemas/_types.Field'
required:
- pattern
_types.query_dsl.FieldValueFactorModifier:
type: string
enum:
- none
- log
- log1p
- log2p
- ln
- ln1p
- ln2p
- square
- sqrt
- reciprocal
_types.aggregations.TopMetricsAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.MetricAggregationBase'
- type: object
properties:
metrics:
description: The fields of the top document to return.
oneOf:
- $ref: '#/components/schemas/_types.aggregations.TopMetricsValue'
- type: array
items:
$ref: '#/components/schemas/_types.aggregations.TopMetricsValue'
size:
description: The number of top documents from which to return metrics.
default: 1.0
type: number
sort:
description: The sort order of the documents.
allOf:
- $ref: '#/components/schemas/_types.Sort'
_types.aggregations.HoltLinearModelSettings:
type: object
properties:
alpha:
type: number
beta:
type: number
_types.RRFRetrieverEntry:
description: Either a direct RetrieverContainer (backward compatible) or an RRFRetrieverComponent with weight.
oneOf:
- $ref: '#/components/schemas/_types.RetrieverContainer'
- $ref: '#/components/schemas/_types.RRFRetrieverComponent'
_types.DateTime:
description: 'A date and time, either as a string whose format can depend on the context (defaulting to ISO 8601), or a
number of milliseconds since the Epoch. Elasticsearch accepts both as input, but will generally output a string
representation.'
oneOf:
- type: string
- $ref: '#/components/schemas/_types.EpochTimeUnitMillis'
_types.aggregations.SamplerAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
shard_size:
description: Limits how many top-scoring documents are collected in the sample processed on each shard.
default: 100.0
type: number
_types.aggregations.PercentilesAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.FormatMetricAggregationBase'
- type: object
properties:
keyed:
description: 'By default, the aggregation associates a unique string key with each bucket and returns the ranges as a hash rather than an array.
Set to `false` to disable this behavior.'
default: true
type: boolean
percents:
description: The percentiles to calculate.
oneOf:
- type: number
- type: array
items:
type: number
hdr:
description: Uses the alternative High Dynamic Range Histogram algorithm to calculate percentiles.
allOf:
- $ref: '#/components/schemas/_types.aggregations.HdrMethod'
tdigest:
description: Sets parameters for the default TDigest algorithm used to calculate percentiles.
allOf:
- $ref: '#/components/schemas/_types.aggregations.TDigest'
_types.query_dsl.WrapperQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
query:
description: 'A base64 encoded query.
The binary data format can be any of JSON, YAML, CBOR or SMILE encodings'
type: string
required:
- query
_types.query_dsl.MoreLikeThisQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
analyzer:
externalDocs:
url: https://www.elastic.co/docs/manage-data/data-store/text-analysis
description: 'The analyzer that is used to analyze the free form text.
Defaults to the analyzer associated with the first field in fields.'
type: string
boost_terms:
description: 'Each term in the formed query could be further boosted by their tf-idf score.
This sets the boost factor to use when using this feature.
Defaults to deactivated (0).'
default: 0.0
type: number
fail_on_unsupported_field:
description: Controls whether the query should fail (throw an exception) if any of the specified fields are not of the supported types (`text` or `keyword`).
default: true
type: boolean
fields:
description: 'A list of fields to fetch and analyze the text from.
Defaults to the `index.query.default_field` index setting, which has a default value of `*`.'
type: array
items:
$ref: '#/components/schemas/_types.Field'
include:
description: Specifies whether the input documents should also be included in the search results returned.
default: false
type: boolean
like:
description: Specifies free form text and/or a single or multiple documents for which you want to find similar documents.
oneOf:
- $ref: '#/components/schemas/_types.query_dsl.Like'
- type: array
items:
$ref: '#/components/schemas/_types.query_dsl.Like'
max_doc_freq:
description: The maximum document frequency above which the terms are ignored from the input document.
type: number
max_query_terms:
description: The maximum number of query terms that can be selected.
default: 25.0
type: number
max_word_length:
description: 'The maximum word length above which the terms are ignored.
Defaults to unbounded (`0`).'
default: 0.0
type: number
min_doc_freq:
description: The minimum document frequency below which the terms are ignored from the input document.
default: 5.0
type: number
minimum_should_match:
description: After the disjunctive query has been formed, this parameter controls the number of terms that must match.
allOf:
- $ref: '#/components/schemas/_types.MinimumShouldMatch'
min_term_freq:
description: The minimum term frequency below which the terms are ignored from the input document.
default: 2.0
type: number
min_word_length:
description: The minimum word length below which the terms are ignored.
default: 0.0
type: number
routing:
allOf:
- $ref: '#/components/schemas/_types.Routing'
stop_words:
description: 'An array of stop words.
Any word in this set is ignored.'
allOf:
- $ref: '#/components/schemas/_types.analysis.StopWords'
unlike:
description: Used in combination with `like` to exclude documents that match a set of terms.
oneOf:
- $ref: '#/components/schemas/_types.query_dsl.Like'
- type: array
items:
$ref: '#/components/schemas/_types.query_dsl.Like'
version:
allOf:
- $ref: '#/components/schemas/_types.VersionNumber'
version_type:
description: "\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"
default: '''internal'''
allOf:
- $ref: '#/components/schemas/_types.VersionType'
required:
- like
_types.query_dsl.BoolQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
filter:
description: 'The clause (query) must appear in matching documents.
However, unlike `must`, the score of the query will be ignored.'
oneOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
- type: array
items:
$ref: '#/components/schemas/_types.query_dsl.QueryContainer'
minimum_should_match:
description: Specifies the number or percentage of `should` clauses returned documents must match.
allOf:
- $ref: '#/components/schemas/_types.MinimumShouldMatch'
must:
description: The clause (query) must appear in matching documents and will contribute to the score.
oneOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
- type: array
items:
$ref: '#/components/schemas/_types.query_dsl.QueryContainer'
must_not:
description: 'The clause (query) must not appear in the matching documents.
Because scoring is ignored, a score of `0` is returned for all documents.'
oneOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
- type: array
items:
$ref: '#/components/schemas/_types.query_dsl.QueryContainer'
should:
description: The clause (query) should appear in the matching document.
oneOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
- type: array
items:
$ref: '#/components/schemas/_types.query_dsl.QueryContainer'
_types.aggregations.ValueCountAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.FormattableMetricAggregation'
- type: object
_global.bulk.UpdateAction:
type: object
properties:
detect_noop:
description: If true, the `result` in the response is set to 'noop' when no changes to the document occur.
default: true
type: boolean
doc:
description: A partial update to an existing document.
type: object
doc_as_upsert:
description: Set to `true` to use the contents of `doc` as the value of `upsert`.
default: false
type: boolean
script:
description: The script to run to update the document.
allOf:
- $ref: '#/components/schemas/_types.Script'
scripted_upsert:
description: Set to `true` to run the script whether or not the document exists.
default: false
type: boolean
_source:
description: 'If `false`, source retrieval is turned off.
You can also specify a comma-separated list of the fields you want to retrieve.'
default: 'true'
allOf:
- $ref: '#/components/schemas/_global.search._types.SourceConfig'
upsert:
description: 'If the document does not already exist, the contents of `upsert` are inserted as a new document.
If the document exists, the `script` is run.'
type: object
_types.aggregations.SumBucketAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.PipelineAggregationBase'
- type: object
_types.aggregations.CartesianCentroidAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.MetricAggregationBase'
- type: object
_types.query_dsl.HasParentQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
ignore_unmapped:
description: 'Indicates whether to ignore an unmapped `parent_type` and not return any documents instead of an error.
You can use this parameter to query multiple indices that may not contain the `parent_type`.'
default: false
type: boolean
inner_hits:
description: If defined, each search hit will contain inner hits.
allOf:
- $ref: '#/components/schemas/_global.search._types.InnerHits'
parent_type:
description: Name of the parent relationship mapped for the `join` field.
allOf:
- $ref: '#/components/schemas/_types.RelationName'
query:
description: 'Query you wish to run on parent documents of the `parent_type` field.
If a parent document matches the search, the query returns its child documents.'
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
score:
description: Indicates whether the relevance score of a matching parent document is aggregated into its child documents.
default: false
type: boolean
required:
- parent_type
- query
_types.query_dsl.QueryStringQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
allow_leading_wildcard:
description: If `true`, the wildcard characters `*` and `?` are allowed as the first character of the query string.
default: true
type: boolean
analyzer:
description: Analyzer used to convert text in the query string into tokens.
type: string
analyze_wildcard:
description: If `true`, the query attempts to analyze wildcard terms in the query string.
default: false
type: boolean
auto_generate_synonyms_phrase_query:
description: If `true`, match phrase queries are automatically created for multi-term synonyms.
default: true
type: boolean
default_field:
description: 'Default field to search if no field is provided in the query string.
Supports wildcards (`*`).
Defaults to the `index.query.default_field` index setting, which has a default value of `*`.'
allOf:
- $ref: '#/components/schemas/_types.Field'
default_operator:
description: Default boolean logic used to interpret text in the query string if no operators are specified.
default: '''or'''
allOf:
- $ref: '#/components/schemas/_types.query_dsl.Operator'
enable_position_increments:
description: If `true`, enable position increments in queries constructed from a `query_string` search.
default: true
type: boolean
escape:
default: false
type: boolean
fields:
description: Array of fields to search. Supports wildcards (`*`).
type: array
items:
$ref: '#/components/schemas/_types.Field'
fuzziness:
description: Maximum edit distance allowed for fuzzy matching.
allOf:
- $ref: '#/components/schemas/_types.Fuzziness'
fuzzy_max_expansions:
description: Maximum number of terms to which the query expands for fuzzy matching.
default: 50.0
type: number
fuzzy_prefix_length:
description: Number of beginning characters left unchanged for fuzzy matching.
default: 0.0
type: number
fuzzy_rewrite:
description: Method used to rewrite the query.
allOf:
- $ref: '#/components/schemas/_types.MultiTermQueryRewrite'
fuzzy_transpositions:
description: If `true`, edits for fuzzy matching include transpositions of two adjacent characters (for example, `ab` to `ba`).
default: true
type: boolean
lenient:
description: If `true`, format-based errors, such as providing a text value for a numeric field, are ignored.
default: false
type: boolean
max_determinized_states:
description: Maximum number of automaton states required for the query.
default: 10000.0
type: number
minimum_should_match:
description: Minimum number of clauses that must match for a document to be returned.
allOf:
- $ref: '#/components/schemas/_types.MinimumShouldMatch'
phrase_slop:
description: Maximum number of positions allowed between matching tokens for phrases.
default: 0.0
type: number
query:
description: Query string you wish to parse and use for search.
type: string
quote_analyzer:
description: 'Analyzer used to convert quoted text in the query string into tokens.
For quoted text, this parameter overrides the analyzer specified in the `analyzer` parameter.'
type: string
quote_field_suffix:
description: 'Suffix appended to quoted text in the query string.
You can use this suffix to use a different analysis method for exact matches.'
type: string
rewrite:
description: Method used to rewrite the query.
allOf:
- $ref: '#/components/schemas/_types.MultiTermQueryRewrite'
tie_breaker:
description: How to combine the queries generated from the individual search terms in the resulting `dis_max` query.
type: number
time_zone:
description: Coordinated Universal Time (UTC) offset or IANA time zone used to convert date values in the query string to UTC.
allOf:
- $ref: '#/components/schemas/_types.TimeZone'
type:
description: "Determines how the query matches and scores documents.\n\nSupported values include:\n - `best_fields`: Finds documents that match any field, but uses the `_score` from the best field.\n - `most_fields`: Finds documents that match any field and combines the `_score` from each field.\n - `cross_fields`: Treats fields with the same analyzer as though they were one big field.\nLooks for each word in any field.\n - `phrase`: Runs a `match_phrase` query on each field and uses the `_score` from the best field.\n - `phrase_prefix`: Runs a `match_phrase_prefix` query on each field and uses the `_score` from the best field.\n - `bool_prefix`: Creates a `match_bool_prefix` query on each field and combines the `_score` from each field.\n\n"
default: '''best_fields'''
allOf:
- $ref: '#/components/schemas/_types.query_dsl.TextQueryType'
required:
- query
_types.ShardFailure:
type: object
properties:
index:
allOf:
- $ref: '#/components/schemas/_types.IndexName'
node:
type: string
reason:
allOf:
- $ref: '#/components/schemas/_types.ErrorCause'
shard:
type: number
status:
type: string
primary:
type: boolean
required:
- reason
_types.aggregations.StatsAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.FormatMetricAggregationBase'
- type: object
_types.mapping.RuntimeFieldFetchFields:
type: object
properties:
field:
allOf:
- $ref: '#/components/schemas/_types.Field'
format:
type: string
required:
- field
_types.DateMath:
type: string
_types.InnerRetriever:
type: object
properties:
retriever:
allOf:
- $ref: '#/components/schemas/_types.RetrieverContainer'
weight:
type: number
normalizer:
allOf:
- $ref: '#/components/schemas/_types.ScoreNormalizer'
required:
- retriever
- weight
- normalizer
_types.aggregations.CompositeGeoTileGridAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.CompositeAggregationBase'
- type: object
properties:
precision:
type: number
bounds:
allOf:
- $ref: '#/components/schemas/_types.GeoBounds'
_types.aggregations.CartesianBoundsAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.MetricAggregationBase'
- type: object
_global.search._types.HighlighterEncoder:
type: string
enum:
- default
- html
_types.query_dsl.RankFeatureFunction:
type: object
_types.query_dsl.SpanNotQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
dist:
description: 'The number of tokens from within the include span that can’t have overlap with the exclude span.
Equivalent to setting both `pre` and `post`.'
type: number
exclude:
description: Span query whose matches must not overlap those returned.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanQuery'
include:
description: Span query whose matches are filtered.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.SpanQuery'
post:
description: The number of tokens after the include span that can’t have overlap with the exclude span.
default: 0.0
type: number
pre:
description: The number of tokens before the include span that can’t have overlap with the exclude span.
default: 0.0
type: number
required:
- exclude
- include
_types.aggregations.ExtendedStatsBucketAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.PipelineAggregationBase'
- type: object
properties:
sigma:
description: The number of standard deviations above/below the mean to display.
type: number
_types.query_dsl.RegexpQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
case_insensitive:
description: 'Allows case insensitive matching of the regular expression value with the indexed field values when set to `true`.
When `false`, case sensitivity of matching depends on the underlying field’s mapping.'
default: false
x-state: Generally available; Added in 7.10.0
type: boolean
flags:
description: Enables optional operators for the regular expression.
type: string
max_determinized_states:
description: Maximum number of automaton states required for the query.
default: 10000.0
type: number
rewrite:
description: Method used to rewrite the query.
allOf:
- $ref: '#/components/schemas/_types.MultiTermQueryRewrite'
value:
description: Regular expression for terms you wish to find in the provided field.
type: string
required:
- value
_types.query_dsl.ConstantScoreQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
filter:
description: 'Filter query you wish to run. Any returned documents must match this query.
Filter queries do not calculate relevance scores.
To speed up performance, Elasticsearch automatically caches frequently used filter queries.'
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
required:
- filter
_global.reindex.RemoteSource:
type: object
properties:
connect_timeout:
description: The remote connection timeout.
default: 30s
allOf:
- $ref: '#/components/schemas/_types.Duration'
headers:
description: An object containing the headers of the request.
type: object
additionalProperties:
type: string
host:
description: 'The URL for the remote instance of Elasticsearch that you want to index from.
This information is required when you''re indexing from remote.'
allOf:
- $ref: '#/components/schemas/_types.Host'
username:
description: The username to use for authentication with the remote host (required when using basic auth).
allOf:
- $ref: '#/components/schemas/_types.Username'
password:
description: The password to use for authentication with the remote host (required when using basic auth).
allOf:
- $ref: '#/components/schemas/_types.Password'
api_key:
description: 'The API key to use for authentication with the remote host (as an alternative to basic auth when the remote cluster is in Elastic Cloud).
(It is not permitted to set this and also to set an `Authorization` header via `headers`.)'
x-state: Generally available; Added in 9.3.0
type: string
socket_timeout:
description: The remote socket read timeout.
default: 30s
allOf:
- $ref: '#/components/schemas/_types.Duration'
required:
- host
_types.aggregations.CompositeDateHistogramAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.CompositeAggregationBase'
- type: object
properties:
format:
type: string
calendar_interval:
description: Either `calendar_interval` or `fixed_interval` must be present
allOf:
- $ref: '#/components/schemas/_types.DurationLarge'
fixed_interval:
description: Either `calendar_interval` or `fixed_interval` must be present
allOf:
- $ref: '#/components/schemas/_types.DurationLarge'
offset:
allOf:
- $ref: '#/components/schemas/_types.Duration'
time_zone:
allOf:
- $ref: '#/components/schemas/_types.TimeZone'
_types.aggregations.AdjacencyMatrixAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
filters:
description: 'Filters used to create buckets.
At least one filter is required.'
type: object
additionalProperties:
$ref: '#/components/schemas/_types.query_dsl.QueryContainer'
separator:
description: Separator used to concatenate filter names. Defaults to &.
type: string
_types.aggregations.RangeAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
field:
description: The date field whose values are use to build ranges.
allOf:
- $ref: '#/components/schemas/_types.Field'
missing:
description: 'The value to apply to documents that do not have a value.
By default, documents without a value are ignored.'
type: number
ranges:
description: An array of ranges used to bucket documents.
type: array
items:
$ref: '#/components/schemas/_types.aggregations.AggregationRange'
script:
allOf:
- $ref: '#/components/schemas/_types.Script'
keyed:
description: Set to `true` to associate a unique string key with each bucket and return the ranges as a hash rather than an array.
type: boolean
format:
type: string
_types.query_dsl.GeoDistanceFeatureQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.DistanceFeatureQueryBaseGeoLocationDistance'
- type: object
_types.query_dsl.DecayFunctionBasedoubledouble:
type: object
properties:
multi_value_mode:
description: "Determines how the distance is calculated when a field used for computing the decay contains multiple values.\n\nSupported values include:\n - `min`: Distance is the minimum distance.\n - `max`: Distance is the maximum distance.\n - `avg`: Distance is the average distance.\n - `sum`: Distance is the sum of all distances.\n\n"
default: min
allOf:
- $ref: '#/components/schemas/_types.query_dsl.MultiValueMode'
_types.aggregations.CardinalityExecutionMode:
type: string
enum:
- global_ordinals
- segment_ordinals
- direct
- save_memory_heuristic
- save_time_heuristic
_types.query_dsl.PrefixQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
rewrite:
description: Method used to rewrite the query.
allOf:
- $ref: '#/components/schemas/_types.MultiTermQueryRewrite'
value:
description: Beginning characters of terms you wish to find in the provided field.
type: string
case_insensitive:
description: 'Allows ASCII case insensitive matching of the value with the indexed field values when set to `true`.
Default is `false` which means the case sensitivity of matching depends on the underlying field’s mapping.'
default: false
x-state: Generally available; Added in 7.10.0
type: boolean
required:
- value
_types.aggregations.AutoDateHistogramAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
buckets:
description: The target number of buckets.
default: 10.0
type: number
field:
description: The field on which to run the aggregation.
allOf:
- $ref: '#/components/schemas/_types.Field'
format:
description: 'The date format used to format `key_as_string` in the response.
If no `format` is specified, the first date format specified in the field mapping is used.'
type: string
minimum_interval:
description: 'The minimum rounding interval.
This can make the collection process more efficient, as the aggregation will not attempt to round at any interval lower than `minimum_interval`.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.MinimumInterval'
missing:
description: 'The value to apply to documents that do not have a value.
By default, documents without a value are ignored.'
allOf:
- $ref: '#/components/schemas/_types.DateTime'
offset:
description: Time zone specified as a ISO 8601 UTC offset.
type: string
params:
type: object
additionalProperties:
type: object
script:
allOf:
- $ref: '#/components/schemas/_types.Script'
time_zone:
description: Time zone ID.
allOf:
- $ref: '#/components/schemas/_types.TimeZone'
_types.query_dsl.WeightedTokensQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
tokens:
description: The tokens representing this query
oneOf:
- type: object
additionalProperties:
type: number
- type: array
items:
type: object
additionalProperties:
type: number
pruning_config:
description: Token pruning configurations
allOf:
- $ref: '#/components/schemas/_types.TokenPruningConfig'
required:
- tokens
_types.query_dsl.TextQueryType:
type: string
enum:
- best_fields
- most_fields
- cross_fields
- phrase
- phrase_prefix
- bool_prefix
_types.aggregations.NormalizeMethod:
type: string
enum:
- rescale_0_1
- rescale_0_100
- percent_of_sum
- mean
- z-score
- softmax
_types.ScriptLanguage:
anyOf:
- type: string
enum:
- painless
- expression
- mustache
- java
- type: string
_types.aggregations.GapPolicy:
type: string
enum:
- skip
- insert_zeros
- keep_values
_global.bulk.CreateOperation:
allOf:
- $ref: '#/components/schemas/_global.bulk.WriteOperation'
- type: object
_types.aggregations.CumulativeCardinalityAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.PipelineAggregationBase'
- type: object
_types.aggregations.CalendarInterval:
type: string
enum:
- second
- 1s
- minute
- 1m
- hour
- 1h
- day
- 1d
- week
- 1w
- month
- 1M
- quarter
- 1q
- year
- 1y
_types.aggregations.HoltWintersType:
type: string
enum:
- add
- mult
_types.aggregations.FiltersAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
filters:
description: Collection of queries from which to build buckets.
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketsQueryContainer'
other_bucket:
description: Set to `true` to add a bucket to the response which will contain all documents that do not match any of the given filters.
type: boolean
other_bucket_key:
description: The key with which the other bucket is returned.
default: _other_
type: string
keyed:
description: 'By default, the named filters aggregation returns the buckets as an object.
Set to `false` to return the buckets as an array of objects.'
default: true
type: boolean
_types.query_dsl.IntervalsQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-intervals-query
type: object
properties:
all_of:
description: Returns matches that span a combination of other rules.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsAllOf'
any_of:
description: Returns intervals produced by any of its sub-rules.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsAnyOf'
fuzzy:
description: Matches terms that are similar to the provided term, within an edit distance defined by `fuzziness`.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsFuzzy'
match:
description: Matches analyzed text.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsMatch'
prefix:
description: Matches terms that start with a specified set of characters.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsPrefix'
range:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsRange'
regexp:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsRegexp'
wildcard:
description: Matches terms using a wildcard pattern.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsWildcard'
minProperties: 1
maxProperties: 1
_types.MinimumShouldMatch:
description: The minimum number of terms that should match as integer, percentage or range
oneOf:
- type: number
- type: string
_types.aggregations.HoltWintersMovingAverageAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.MovingAverageAggregationBase'
- type: object
properties:
model:
type: string
enum:
- holt_winters
settings:
allOf:
- $ref: '#/components/schemas/_types.aggregations.HoltWintersModelSettings'
required:
- model
- settings
_types.SlicesCalculation:
type: string
enum:
- auto
_types.IndexName:
type: string
_global.reindex.Destination:
type: object
properties:
index:
description: The name of the data stream, index, or index alias you are copying to.
allOf:
- $ref: '#/components/schemas/_types.IndexName'
op_type:
description: "If it is `create`, the operation will only index documents that do not already exist (also known as \"put if absent\").\n\nIMPORTANT: To reindex to a data stream destination, this argument must be `create`.\n\nSupported values include:\n - `index`: Overwrite any documents that already exist.\n - `create`: Only index documents that do not already exist.\n\n"
default: index
allOf:
- $ref: '#/components/schemas/_types.OpType'
pipeline:
description: The name of the pipeline to use.
type: string
routing:
description: 'By default, a document''s routing is preserved unless it''s changed by the script.
If it is `keep`, the routing on the bulk request sent for each match is set to the routing on the match.
If it is `discard`, the routing on the bulk request sent for each match is set to `null`.
If it is `=value`, the routing on the bulk request sent for each match is set to all value specified after the equals sign (`=`).'
default: keep
allOf:
- $ref: '#/components/schemas/_types.Routing'
version_type:
description: "The versioning to use for the indexing operation.\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"
allOf:
- $ref: '#/components/schemas/_types.VersionType'
required:
- index
_types.GeoBounds:
description: 'A geo bounding box. It can be represented in various ways:
- as 4 top/bottom/left/right coordinates
- as 2 top_left / bottom_right points
- as 2 top_right / bottom_left points
- as a WKT bounding box'
oneOf:
- $ref: '#/components/schemas/_types.CoordsGeoBounds'
- $ref: '#/components/schemas/_types.TopLeftBottomRightGeoBounds'
- $ref: '#/components/schemas/_types.TopRightBottomLeftGeoBounds'
- $ref: '#/components/schemas/_types.WktGeoBounds'
_types.Fields:
oneOf:
- $ref: '#/components/schemas/_types.Field'
- type: array
items:
$ref: '#/components/schemas/_types.Field'
_types.query_dsl.CombinedFieldsQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
fields:
description: List of fields to search. Field wildcard patterns are allowed. Only `text` fields are supported, and they must all have the same search `analyzer`.
type: array
items:
$ref: '#/components/schemas/_types.Field'
query:
description: 'Text to search for in the provided `fields`.
The `combined_fields` query analyzes the provided text before performing a search.'
type: string
auto_generate_synonyms_phrase_query:
description: If true, match phrase queries are automatically created for multi-term synonyms.
default: true
type: boolean
operator:
description: Boolean logic used to interpret text in the query value.
default: or
allOf:
- $ref: '#/components/schemas/_types.query_dsl.CombinedFieldsOperator'
minimum_should_match:
externalDocs:
url: https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-minimum-should-match
description: Minimum number of clauses that must match for a document to be returned.
allOf:
- $ref: '#/components/schemas/_types.MinimumShouldMatch'
zero_terms_query:
description: "Indicates whether no documents are returned if the analyzer removes all tokens, such as when using a `stop` filter.\n\nSupported values include:\n - `none`: No documents are returned if the analyzer removes all tokens.\n - `all`: Returns all documents, similar to a `match_all` query.\n\n"
default: none
allOf:
- $ref: '#/components/schemas/_types.query_dsl.CombinedFieldsZeroTerms'
required:
- fields
- query
_global.search._types.Rescore:
allOf:
- type: object
properties:
window_size:
type: number
- type: object
properties:
query:
allOf:
- $ref: '#/components/schemas/_global.search._types.RescoreQuery'
learning_to_rank:
allOf:
- $ref: '#/components/schemas/_global.search._types.LearningToRank'
script:
allOf:
- $ref: '#/components/schemas/_global.search._types.ScriptRescore'
minProperties: 1
maxProperties: 1
_types.analysis.StopWords:
description: 'Language value, such as _arabic_ or _thai_. Defaults to _english_.
Each language value corresponds to a predefined list of stop words in Lucene. See Stop words by language for supported language values and their stop words.
Also accepts an array of stop words.'
oneOf:
- $ref: '#/components/schemas/_types.analysis.StopWordLanguage'
- type: array
items:
type: string
_types.aggregations.PercentileRanksAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.FormatMetricAggregationBase'
- type: object
properties:
keyed:
description: 'By default, the aggregation associates a unique string key with each bucket and returns the ranges as a hash rather than an array.
Set to `false` to disable this behavior.'
default: true
type: boolean
values:
description: An array of values for which to calculate the percentile ranks.
oneOf:
- type: array
items:
type: number
- type:
- string
- 'null'
hdr:
description: Uses the alternative High Dynamic Range Histogram algorithm to calculate percentile ranks.
allOf:
- $ref: '#/components/schemas/_types.aggregations.HdrMethod'
tdigest:
description: Sets parameters for the default TDigest algorithm used to calculate percentile ranks.
allOf:
- $ref: '#/components/schemas/_types.aggregations.TDigest'
_types.aggregations.GeoCentroidAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.MetricAggregationBase'
- type: object
properties:
count:
type: number
location:
allOf:
- $ref: '#/components/schemas/_types.GeoLocation'
_types.ReindexStatus:
type: object
properties:
slice_id:
description: The slice ID
type: number
batches:
description: The number of scroll responses 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
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
requests_per_second:
description: The number of requests per second effectively executed during the reindex.
type: number
retries:
description: The number of retries attempted by reindex. `bulk` is the number of bulk actions retried and `search` is the number of search actions retried.
allOf:
- $ref: '#/components/schemas/_types.Retries'
throttled:
allOf:
- $ref: '#/components/schemas/_types.Duration'
throttled_millis:
description: Number of milliseconds the request slept to conform to `requests_per_second`.
allOf:
- $ref: '#/components/schemas/_types.DurationValueUnitMillis'
throttled_until:
allOf:
- $ref: '#/components/schemas/_types.Duration'
throttled_until_millis:
description: 'This field should always be equal to zero in a `_reindex` response.
It only has meaning when using the Task API, where it indicates the next time (in milliseconds since epoch) a throttled request will be executed again in order to conform to `requests_per_second`.'
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, for example, a document with same ID already existed prior to reindex updating it.
type: number
version_conflicts:
description: The number of version conflicts that reindex hits.
type: number
cancelled:
description: The reason for cancellation if the slice was canceled
type: string
required:
- batches
- deleted
- noops
- requests_per_second
- retries
- throttled_millis
- throttled_until_millis
- total
- version_conflicts
_types.NodeId:
type: string
_types.aggregations.SamplerAggregationExecutionHint:
type: string
enum:
- map
- global_ordinals
- bytes_hash
_types.GeoHash:
type: string
_types.TextEmbedding:
type: object
properties:
model_id:
description: 'Model ID is required for all dense_vector fields but
may be inferred for semantic_text fields'
x-state: Generally available; Added in 8.18.0
type: string
model_text:
type: string
required:
- model_text
_types.Username:
type: string
_global.bulk.FailureStoreStatus:
type: string
enum:
- not_applicable_or_unknown
- used
- not_enabled
- failed
_types.RelationName:
type: string
_types.aggregations.BucketsQueryContainer:
description: 'Aggregation buckets. By default they are returned as an array, but if the aggregation has keys configured for
the different buckets, the result is a dictionary.'
oneOf:
- type: object
additionalProperties:
$ref: '#/components/schemas/_types.query_dsl.QueryContainer'
- type: array
items:
$ref: '#/components/schemas/_types.query_dsl.QueryContainer'
_types.aggregations.CardinalityAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.MetricAggregationBase'
- type: object
properties:
precision_threshold:
description: 'A unique count below which counts are expected to be close to accurate.
This allows to trade memory for accuracy.'
default: 3000.0
type: number
rehash:
type: boolean
execution_hint:
description: "Mechanism by which cardinality aggregations is run.\n\nSupported values include:\n - `global_ordinals`: Run the aggregation by using global ordinals of the field and resolving those values after finishing a shard.\n - `segment_ordinals`: Run the aggregation by using segment ordinal values and resolving those values after each segment.\n - `direct`: Run the aggregation by using field values directly.\n - `save_memory_heuristic`: Heuristic-based mode, default in Elasticsearch 8.3 and earlier.\n - `save_time_heuristic`: Heuristic-based mode, default in Elasticsearch 8.4 and later.\n\n"
allOf:
- $ref: '#/components/schemas/_types.aggregations.CardinalityExecutionMode'
_global.reindex_rethrottle.ReindexTask:
type: object
properties:
action:
type: string
cancellable:
type: boolean
cancelled:
type: boolean
description:
type: string
id:
type: number
node:
allOf:
- $ref: '#/components/schemas/_types.Name'
running_time_in_nanos:
allOf:
- $ref: '#/components/schemas/_types.DurationValueUnitNanos'
start_time_in_millis:
allOf:
- $ref: '#/components/schemas/_types.EpochTimeUnitMillis'
status:
allOf:
- $ref: '#/components/schemas/_types.ReindexStatus'
type:
type: string
headers:
allOf:
- $ref: '#/components/schemas/_types.HttpHeaders'
required:
- action
- cancellable
- cancelled
- description
- id
- node
- running_time_in_nanos
- start_time_in_millis
- status
- type
- headers
_types.aggregations.FrequentItemSetsField:
type: object
properties:
field:
allOf:
- $ref: '#/components/schemas/_types.Field'
exclude:
description: 'Values to exclude.
Can be regular expression strings or arrays of strings of exact terms.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.TermsExclude'
include:
description: 'Values to include.
Can be regular expression strings or arrays of strings of exact terms.'
allOf:
- $ref: '#/components/schemas/_types.aggregations.TermsInclude'
required:
- field
_types.aggregations.IpPrefixAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
field:
description: The IP address field to aggregation on. The field mapping type must be `ip`.
allOf:
- $ref: '#/components/schemas/_types.Field'
prefix_length:
description: 'Length of the network prefix. For IPv4 addresses the accepted range is [0, 32].
For IPv6 addresses the accepted range is [0, 128].'
type: number
is_ipv6:
description: Defines whether the prefix applies to IPv6 addresses.
default: false
type: boolean
append_prefix_length:
description: Defines whether the prefix length is appended to IP address keys in the response.
default: false
type: boolean
keyed:
description: Defines whether buckets are returned as a hash rather than an array in the response.
type: boolean
min_doc_count:
description: Minimum number of documents in a bucket for it to be included in the response.
default: 1.0
type: number
required:
- field
- prefix_length
_types.query_dsl.IntervalsMatch:
type: object
properties:
analyzer:
description: Analyzer used to analyze terms in the query.
type: string
max_gaps:
description: 'Maximum number of positions between the matching terms.
Terms further apart than this are not considered matches.'
default: -1.0
type: number
ordered:
description: If `true`, matching terms must appear in their specified order.
default: false
type: boolean
query:
description: Text you wish to find in the provided field.
type: string
use_field:
description: 'If specified, match intervals from this field rather than the top-level field.
The `term` is normalized using the search analyzer from this field, unless `analyzer` is specified separately.'
allOf:
- $ref: '#/components/schemas/_types.Field'
filter:
description: An optional interval filter.
allOf:
- $ref: '#/components/schemas/_types.query_dsl.IntervalsFilter'
required:
- query
_types.Distance:
type: string
_global.search._types.SearchRequestBody:
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.
By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters.
To page through more hits, use the `search_after` parameter.'
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.
If `true`, the exact number of hits is returned at the cost of some performance.
If `false`, the response does not include the total number of hits matching the query.'
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.
The boost value is the factor by which scores are multiplied.
A boost value greater than `1.0` increases the score.
A boost value between `0` and `1.0` decreases the score.'
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.
The 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.
Documents with a lower `_score` are not included in search results or results collected by aggregations.'
type: number
post_filter:
description: 'Use the `post_filter` parameter to filter search results.
The search hits are filtered after the aggregations are calculated.
A post filter has no impact on the aggregation results.'
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.
NOTE: 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.
A 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.
By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters.
To page through more hits, use the `search_after` property.'
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.
These fields are returned in the `hits._source` property of the search response.
If the `stored_fields` property is specified, the `_source` property defaults to `false`.
Otherwise, it defaults to `true`.'
allOf:
- $ref: '#/components/schemas/_global.search._types.SourceConfig'
fields:
description: 'An array of wildcard (`*`) field patterns.
The 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.
If a query reaches this limit, Elasticsearch terminates the query early.
Elasticsearch collects documents before sorting.
IMPORTANT: Use with caution.
Elasticsearch applies this property to each shard handling the request.
When possible, let Elasticsearch perform early termination automatically.
Avoid specifying this property for requests that target data streams with backing indices across multiple data tiers.
If set to `0` (default), the query does not terminate early.'
default: 0.0
type: number
timeout:
description: 'The period of time to wait for a response from each shard.
If no response is received before the timeout expires, the request fails and returns an error.
Defaults to no timeout.'
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.
If no fields are specified, no stored fields are included in the response.
If this field is specified, the `_source` property defaults to `false`.
You can pass `_source: true` to return both source fields and stored fields in the search response.'
allOf:
- $ref: '#/components/schemas/_types.Fields'
pit:
description: 'Limit the search to a point in time (PIT).
If 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.
These 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.
Each group maintains a statistics aggregation for its associated searches.
You can retrieve these stats using the indices stats API.'
type: array
items:
type: string
_types.Indices:
oneOf:
- $ref: '#/components/schemas/_types.IndexName'
- type: array
items:
$ref: '#/components/schemas/_types.IndexName'
_global.bulk.WriteOperation:
allOf:
- $ref: '#/components/schemas/_global.bulk.OperationBase'
- type: object
properties:
dynamic_templates:
description: 'A map from the full name of fields to the name of dynamic templates.
It defaults to an empty map.
If a name matches a dynamic template, that template will be applied regardless of other match predicates defined in the template.
If a field is already defined in the mapping, then this parameter won''t be used.'
type: object
additionalProperties:
type: string
pipeline:
description: 'The ID of the pipeline to use to preprocess incoming documents.
If the index has a default ingest pipeline specified, setting the value to `_none` turns off the default ingest pipeline for this request.
If a final pipeline is configured, it will always run regardless of the value of this parameter.'
type: string
require_alias:
description: If `true`, the request's actions must target an index alias.
default: false
type: boolean
_types.query_dsl.SpanTermQuery:
allOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryBase'
- type: object
properties:
value:
allOf:
- $ref: '#/components/schemas/_types.FieldValue'
required:
- value
_types.aggregations.GeohexGridAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
field:
description: 'Field containing indexed `geo_point` or `geo_shape` values.
If the field contains an array, `geohex_grid` aggregates all array values.'
allOf:
- $ref: '#/components/schemas/_types.Field'
precision:
description: 'Integer zoom of the key used to defined cells or buckets
in the results. Value should be between 0-15.'
default: 6.0
type: number
bounds:
description: Bounding box used to filter the geo-points in each bucket.
allOf:
- $ref: '#/components/schemas/_types.GeoBounds'
size:
description: Maximum number of buckets to return.
default: 10000.0
type: number
shard_size:
description: Number of buckets returned from each shard.
type: number
required:
- field
_global.search._types.TrackHits:
description: 'Number of hits matching the query to count accurately. If true, the exact
number of hits is returned at the cost of some performance. If false, the
response does not include the total number of hits matching the query.
Defaults to 10,000 hits.'
oneOf:
- type: boolean
- type: number
_types.KnnSearch:
type: object
properties:
field:
description: The name of the vector field to search against
allOf:
- $ref: '#/components/schemas/_types.Field'
query_vector:
description: The query vector
allOf:
- $ref: '#/components/schemas/_types.QueryVector'
query_vector_builder:
description: The query vector builder. You must provide a query_vector_builder or query_vector, but not both.
allOf:
- $ref: '#/components/schemas/_types.QueryVectorBuilder'
k:
description: The final number of nearest neighbors to return as top hits
type: number
num_candidates:
description: The number of nearest neighbor candidates to consider per shard
type: number
visit_percentage:
description: The percentage of vectors to explore per shard while doing knn search with bbq_disk
x-state: Generally available; Added in 9.2.0
type: number
boost:
description: Boost value to apply to kNN scores
type: number
filter:
description: Filters for the kNN search query
oneOf:
- $ref: '#/components/schemas/_types.query_dsl.QueryContainer'
- type: array
items:
$ref: '#/components/schemas/_types.query_dsl.QueryContainer'
similarity:
description: The minimum similarity for a vector to be considered a match
type: number
inner_hits:
description: If defined, each search hit will contain inner hits.
allOf:
- $ref: '#/components/schemas/_global.search._types.InnerHits'
rescore_vector:
description: Apply oversampling and rescoring to quantized vectors
x-state: Generally available; Added in 8.18.0
allOf:
- $ref: '#/components/schemas/_types.RescoreVector'
_name:
type: string
required:
- field
_types.aggregations.ParentAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
type:
description: The child type that should be selected.
allOf:
- $ref: '#/components/schemas/_types.RelationName'
_types.aggregations.ChildrenAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
type:
description: The child type that should be selected.
allOf:
- $ref: '#/components/schemas/_types.RelationName'
_types.aggregations.RandomSamplerAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
probability:
description: 'The probability that a document will be included in the aggregated data.
Must be greater than 0, less than 0.5, or exactly 1.
The lower the probability, the fewer documents are matched.'
type: number
seed:
description: 'The seed to generate the random sampling of documents.
When a seed is provided, the random subset of documents is the same between calls.'
type: number
shard_seed:
description: When combined with seed, setting shard_seed ensures 100% consistent sampling over shards where data is exactly the same.
x-state: Generally available; Added in 8.14.0
type: number
required:
- probability
_types.aggregations.GeoDistanceAggregation:
allOf:
- $ref: '#/components/schemas/_types.aggregations.BucketAggregationBase'
- type: object
properties:
distance_type:
description: "The distance calculation type.\n\nSupported values include:\n - `arc`: The `arc` calculation is the most accurate.\n - `plane`: The `plane` calculation is faster but less accurate.\n\n"
default: arc
allOf:
- $ref: '#/components/schemas/_types.GeoDistanceType'
field:
description: A field of type `geo_point` used to evaluate the distance.
allOf:
- $ref: '#/components/schemas/_types.Field'
origin:
description: The origin used to evaluate the distance.
allOf:
- $ref: '#/components/schemas/_types.GeoLocation'
ranges:
description: An array of ranges used to bucket documents.
type: array
items:
$ref: '#/components/schemas/_types.aggregations.AggregationRange'
unit:
description: The distance unit.
default: m
allOf:
- $ref: '#/components/schemas/_types.DistanceUnit'
_types.aggregations.ExtendedBoundsdouble:
type: object
properties:
max:
description: Maximum value for the bound.
type: number
min:
description: Minimum value for the bound.
type: number
securitySchemes:
apiKeyAuth:
type: apiKey
in: header
name: Authorization
description: "Elasticsearch APIs support key-based authentication.\nYou must create an API key and use the encoded value in the request header.\nFor example:\n\n```\ncurl -X GET \"${ES_URL}/_cat/indices?v=true\" \\\n -H \"Authorization: ApiKey ${API_KEY}\"\n```\n\nTo get API keys, use the `/_security/api_key` APIs."
basicAuth:
type: http
scheme: basic
bearerAuth:
type: http
scheme: bearer
description: 'Elasticsearch APIs support the use of bearer tokens in the `Authorization` HTTP header to authenticate with the API.
For examples, refer to [Token-based authentication services](https://www.elastic.co/docs/deploy-manage/users-roles/cluster-or-deployment-auth/token-based-authentication-services)'
x-tagGroups:
- name: AI & Machine Learning
tags:
- analytics
- graph
- inference
- ml
- ml anomaly
- ml data frame
- ml trained model
- query_rules
- text_structure
- name: Cluster Management
tags:
- ccr
- cluster
- connector
- data stream
- ilm
- indices
- rollup
- script
- search_application
- searchable_snapshots
- slm
- snapshot
- name: Data Processing
tags:
- enrich
- fleet
- ingest
- logstash
- synonyms
- transform
- name: Information & Monitoring
tags:
- cat
- features
- health_report
- info
- license
- migration
- tasks
- watcher
- xpack
- name: Search & Document APIs
tags:
- document
- eql
- esql
- search
- sql
- name: Security
tags:
- security