Elastic Documents API

Index, update, retrieve, and delete documents.

OpenAPI Specification

elastic-documents-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Elastic Cloud Account Documents API
  description: RESTful API for managing Elastic Cloud hosted deployments. Enables you to perform most operations available in the Elastic Cloud console through API calls, including creating, updating, resizing, and deleting deployments, managing traffic filters, snapshots, and account-level resources.
  version: '1.0'
  contact:
    name: Elastic Cloud Support
    url: https://www.elastic.co/contact
  license:
    name: Elastic License 2.0
    url: https://www.elastic.co/licensing/elastic-license
servers:
- url: https://api.elastic-cloud.com
  description: Elastic Cloud production
security:
- apiKeyAuth: []
tags:
- name: Documents
  description: Index, update, retrieve, and delete documents.
paths:
  /{index}/_doc/{id}:
    get:
      operationId: getDocument
      summary: Get a document by ID
      tags:
      - Documents
      parameters:
      - name: index
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Document response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Document'
        '404':
          description: Not found
    put:
      operationId: indexDocument
      summary: Index a document with explicit ID
      tags:
      - Documents
      parameters:
      - name: index
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
      responses:
        '201':
          description: Created
        '200':
          description: Updated
    delete:
      operationId: deleteDocument
      summary: Delete a document by ID
      tags:
      - Documents
      parameters:
      - name: index
        in: path
        required: true
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Deleted
        '404':
          description: Not found
components:
  schemas:
    Document:
      type: object
      properties:
        _index:
          type: string
        _id:
          type: string
        _score:
          type: number
          nullable: true
        _source:
          type: object
          additionalProperties: true
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: ApiKey <api_key>
externalDocs:
  description: Elastic Cloud API Reference
  url: https://www.elastic.co/docs/api/doc/cloud