Elastic Document API

The document APIs enable you to create and manage documents in an Elasticsearch index.

GitHub OpenAPI
Pull this API's OpenAPI, operations, scores and pricing into your own code or AI agent with a free APIs.io key — sign in with GitHub, Google or LinkedIn. No form to fill in; signing in shares your email address with us (Privacy).

Operations 33

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

PUT /_bulk Bulk index or delete documents with PUT · Bulk index or delete documents #
Ask an LLM
“Can I send a bulk batch of index and delete actions with a PUT request?”
“Is there a PUT form of the bulk endpoint that isn't tied to one index?”
Tell an agent
PUT a bulk batch of index and delete actions across any indices.
Send this bulk payload with PUT and run it through pipeline {pipeline}.
POST /_bulk Bulk index, update or delete many documents · Bulk index or delete documents #
Ask an LLM
“How do I load thousands of documents into Elasticsearch in one request?”
“Can a single bulk request write to several different indices at once?”
Tell an agent
Bulk load these documents into the cluster in one request.
Run a bulk request and refresh afterwards with refresh set to {refresh}.
PUT /{index}/_bulk Bulk write to one index using PUT · Bulk index or delete documents #
Ask an LLM
“Can I PUT a bulk batch that defaults every action to one index?”
“What's the PUT variant of bulk indexing scoped to a single index?”
Tell an agent
PUT a bulk batch into index {index}.
Use PUT to bulk write documents to {index} through pipeline {pipeline}.
POST /{index}/_bulk Bulk index or delete documents in one index · Bulk index or delete documents #
Ask an LLM
“How can I bulk load documents into a single index without naming it on every line?”
“Can bulk writes to my products index go through an ingest pipeline?”
Tell an agent
Bulk index these documents into {index}.
Bulk write to {index} and wait for refresh with refresh set to {refresh}.
PUT /{index}/_create/{id} Create a document only if its ID is new · Create a new document in the index #
Ask an LLM
“How do I add a document that must fail if the ID already exists?”
“Can I create a document in a data stream with a fixed ID?”
Tell an agent
Create document {id} in {index}, failing if it already exists.
Create new document {id} in {index} through pipeline {pipeline}.
POST /{index}/_create/{id} Create a new document with a given ID via POST · Create a new document in the index #
Ask an LLM
“Is there a POST form of the create-only document endpoint?”
“Can I POST a document to _create so it never overwrites an existing one?”
Tell an agent
POST new document {id} to {index} using the create-only endpoint.
Use POST _create to add {id} to {index} with routing {routing}.
GET /{index}/_doc/{id} Retrieve a document by its ID · Get a document by its ID #
Ask an LLM
“How do I fetch a single document from an index by its ID?”
“Can I fetch only certain source fields of a document?”
Tell an agent
Get document {id} from {index}.
Fetch document {id} from {index} including only fields {source_includes}.
PUT /{index}/_doc/{id} Create or replace a document at a given ID · Create or update a document in an index #
Ask an LLM
“How do I store a document under a specific ID, replacing any existing one?”
“Can I use optimistic concurrency with sequence numbers when overwriting a document?”
Tell an agent
Index this document as {id} in {index}, replacing it if it exists.
Overwrite {id} in {index} only if seq_no is {if_seq_no} and primary term is {if_primary_term}.
POST /{index}/_doc/{id} Create or replace a document at an ID via POST · Create or update a document in an index #
Ask an LLM
“Can I POST a document to a specific ID instead of using PUT?”
“Is POST to _doc with an ID the same as indexing with PUT?”
Tell an agent
POST this document to {index} as ID {id}.
Use POST _doc to write {id} into {index} with op_type {op_type}.
DELETE /{index}/_doc/{id} Delete a document by ID · Delete a document #
Ask an LLM
“How do I remove one document from an index by its ID?”
“Can I delete a document only if it hasn't changed since I read it?”
Tell an agent destructive · confirm first
Delete document {id} from {index}.
Delete {id} from {index} only if its seq_no is {if_seq_no}.
HEAD /{index}/_doc/{id} Check whether a document exists · Check a document #
Ask an LLM
“Can I check if a document exists without downloading it?”
“What's the cheapest way to test for a document ID in an index?”
Tell an agent
Check whether document {id} exists in {index}.
Tell me if {index} contains a document with ID {id}.
POST /{index}/_delete_by_query Delete every document matching a query · Delete documents #
Ask an LLM
“How do I delete all documents older than a date from an index?”
“Can a delete by query keep going when it hits version conflicts?”
Tell an agent destructive · confirm first
Delete all documents in {index} that match this query.
Delete matching docs in {index}, proceeding on conflicts set to {conflicts}.
POST /_delete_by_query/{task_id}/_rethrottle Change the speed of a running delete by query · Throttle a delete by query operation #
Ask an LLM
“Can I slow down a delete by query that's already running?”
“How do I speed up an in-progress delete by query task?”
Tell an agent
Rethrottle delete by query task {task_id} to {rps} requests per second.
Set the delete by query task {task_id} to {rps} requests per second.
GET /{index}/_source/{id} Get only a document's source JSON · Get a document's source #
Ask an LLM
“How do I get just the _source of a document without metadata?”
“Can I fetch only part of a document's source body?”
Tell an agent
Return only the source of document {id} in {index}.
Get the source of {id} from {index}, excluding fields {source_excludes}.
HEAD /{index}/_source/{id} Check whether a document's source is stored · Check for a document source #
Ask an LLM
“Can I tell if a document has its _source stored without fetching it?”
“Is there a check for source availability on a single document?”
Tell an agent
Check whether document {id} in {index} has a stored source.
Confirm the _source of {id} exists in {index}.
POST /{index}/_doc Add a document with an auto-generated ID · Create or update a document in an index #
Ask an LLM
“How do I add a document and let Elasticsearch pick the ID?”
“Can I append a log event to a data stream without choosing an ID?”
Tell an agent
Add this document to {index} with an auto-generated ID.
Append this event to {index} through pipeline {pipeline}, letting the ID be generated.
GET /_mget Fetch many documents by ID in one request · Get multiple documents #
Ask an LLM
“How do I retrieve several documents from different indices at once?”
“Can one multi-get request pull documents by ID from more than one index?”
Tell an agent
Get these documents from their indices in one multi-get.
Multi-get documents with IDs {ids}.
POST /_mget Fetch many documents by ID using POST · Get multiple documents #
Ask an LLM
“Can I send a multi-get as POST when my client can't put a body on GET?”
“Is there a POST form of the cluster-wide multi-get?”
Tell an agent
POST a multi-get for these docs across indices.
Use POST to multi-get the documents listed in {docs}.
GET /{index}/_mget Fetch many documents from one index by ID · Get multiple documents #
Ask an LLM
“How do I fetch a batch of IDs from my users index in one call?”
“Can I multi-get from a single index by just listing IDs?”
Tell an agent
Get documents {ids} from {index}.
Multi-get from {index} returning only fields {source_includes}.
POST /{index}/_mget Fetch many documents from one index via POST · Get multiple documents #
Ask an LLM
“Is there a POST variant of multi-get scoped to one index?”
“Can I POST a list of IDs to fetch from a single index?”
Tell an agent
POST a multi-get of IDs {ids} against {index}.
Use POST to fetch several documents from {index}.
GET /_mtermvectors Get term vectors for many documents · Get multiple term vectors #
Ask an LLM
“Can I get term frequencies for several documents in one request?”
“Which term statistics can a multi term vectors call return across indices?”
Tell an agent
Get term vectors for documents {ids} in one call.
Return multi term vectors for fields {fields} with term statistics on.
POST /_mtermvectors Get term vectors for many documents via POST · Get multiple term vectors #
Ask an LLM
“Can I POST a multi term vectors request with a docs body?”
“Is there a POST form of the cluster-wide multi term vectors call?”
Tell an agent
POST a multi term vectors request for these docs.
Use POST to get term vectors for IDs {ids}.
GET /{index}/_mtermvectors Get term vectors for many docs in one index · Get multiple term vectors #
Ask an LLM
“How do I get term vectors for several documents in my articles index?”
“Can I include offsets and positions for many docs in one index?”
Tell an agent
Get term vectors for docs {ids} in {index}.
Return multi term vectors in {index} with positions set to {positions}.
POST /{index}/_mtermvectors Get term vectors for many docs in one index via POST · Get multiple term vectors #
Ask an LLM
“Is there a POST variant of multi term vectors for a single index?”
“Can I POST document IDs to get their term vectors from one index?”
Tell an agent
POST a multi term vectors request for {ids} in {index}.
Use POST to get term vectors from {index} for fields {fields}.
POST /_reindex Copy documents from one index to another · Reindex documents #
Ask an LLM
“How do I copy all documents from an old index into a new one?”
“Can I transform documents with a script while reindexing?”
Tell an agent
Reindex everything from source {source} into destination {dest}.
Reindex {source} into {dest} throttled to {rps} requests per second.
POST /_reindex/{task_id}/_rethrottle Change the speed of a running reindex · Throttle a reindex operation #
Ask an LLM
“Can I throttle a reindex that is overloading my cluster?”
“How do I remove the throttle on a reindex task in progress?”
Tell an agent
Rethrottle reindex task {task_id} to {rps} requests per second.
Set running reindex {task_id} to {rps} requests per second.
GET /{index}/_termvectors/{id} Get term vectors for a stored document · Get term vector information #
Ask an LLM
“What terms and frequencies are in a specific document's text field?”
“Can I see token positions and offsets for one document?”
Tell an agent
Get term vectors for document {id} in {index}.
Show term vectors of {id} in {index} for fields {fields}.
POST /{index}/_termvectors/{id} Get term vectors for a stored document via POST · Get term vector information #
Ask an LLM
“Can I POST a term vectors request for one document by ID?”
“Is there a POST form for a single document's term vectors with filter settings?”
Tell an agent
Send a POST for the single-document term vectors of {id} stored in {index}.
Use POST to get term vectors of {id} in {index} with term statistics set to {term_statistics}.
GET /{index}/_termvectors Get term vectors for an ad-hoc document · Get term vector information #
Ask an LLM
“Can I see how a piece of text would be tokenized without indexing it?”
“How do I get term vectors for an artificial document I pass in the body?”
Tell an agent
Get term vectors in {index} for this artificial document {doc}.
Analyze artificial doc {doc} against {index} mappings and return term vectors.
POST /{index}/_termvectors Get term vectors for an ad-hoc document via POST · Get term vector information #
Ask an LLM
“Is there a POST variant for term vectors of a document I supply inline?”
“Can I POST text with a per-field analyzer to see its term vectors?”
Tell an agent
POST artificial document {doc} to {index} for term vectors.
Use POST with per-field analyzer {per_field_analyzer} to get term vectors in {index}.
POST /{index}/_update/{id} Partially update a document · Update a document #
Ask an LLM
“How do I change a few fields on an existing document without resending it?”
“Can I upsert a document if it doesn't exist yet?”
Tell an agent
Update document {id} in {index} with these fields {doc}.
Update {id} in {index} with script {script}, retrying {retries} times on conflict.
POST /{index}/_update_by_query Update every document matching a query · Update documents #
Ask an LLM
“How do I apply a script to all documents that match a query?”
“Can I pick up a mapping change by updating documents in place?”
Tell an agent
Run update by query on {index} with script {script}.
Update documents in {index} matching {query} with script {script}.
POST /_update_by_query/{task_id}/_rethrottle Change the speed of a running update by query · Throttle an update by query operation #
Ask an LLM
“Can I change the throttle of an update by query mid-run?”
“Is it possible to speed up an update by query task already running?”
Tell an agent
Rethrottle update by query task {task_id} to {rps} requests per second.
Set update by query {task_id} to {rps} requests per second.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/elastic:elastic-document-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

elastic-document-api-openapi.yml Raw ↑
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:


# --- truncated at 32 KB (788 KB total) ---
# Full source: https://artifacts.apis.io/elastic/openapi/elastic-document-api-openapi.yml