Elastic Search API

Search and query operations across indices.

OpenAPI Specification

elastic-search-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Elastic Cloud Account Search 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: Search
  description: Search and query operations across indices.
paths:
  /_search:
    get:
      operationId: searchAllIndices
      summary: Search across all indices
      description: Returns search results across all indices in the cluster matching the supplied query parameters or request body.
      tags:
      - Search
      parameters:
      - name: q
        in: query
        description: Lucene query string
        schema:
          type: string
      - name: size
        in: query
        description: Number of hits to return
        schema:
          type: integer
          default: 10
      responses:
        '200':
          description: Search response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
  /{index}/_search:
    get:
      operationId: searchIndex
      summary: Search a specific index
      description: Searches documents in the specified index using a query string or request body DSL.
      tags:
      - Search
      parameters:
      - name: index
        in: path
        required: true
        description: Index name or pattern
        schema:
          type: string
      - name: q
        in: query
        schema:
          type: string
      responses:
        '200':
          description: Search response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
components:
  schemas:
    SearchResponse:
      type: object
      properties:
        took:
          type: integer
        timed_out:
          type: boolean
        hits:
          type: object
          properties:
            total:
              type: object
              properties:
                value:
                  type: integer
                relation:
                  type: string
            max_score:
              type: number
              nullable: true
            hits:
              type: array
              items:
                $ref: '#/components/schemas/Document'
    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