Skip to content

Instantly share code, notes, and snippets.

@numpde
Created February 15, 2024 18:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save numpde/e47019be69ae19926868ac00b6b643be to your computer and use it in GitHub Desktop.
Save numpde/e47019be69ae19926868ac00b6b643be to your computer and use it in GitHub Desktop.
Elasticsearch Index OpenAPI Specification
openapi: 3.0.0
info:
version: 1.0.0
title: Elasticsearch Index API
license:
name: Apache 2.0
servers:
- url: ****
paths:
/search-backend1:
get:
operationId: testConnection
summary: Test connection to the Elasticsearch backend
tags:
- test
responses:
"200":
description: Connection successful
"401":
description: Unauthorized
"404":
description: Index not found
security:
- ApiKeyAuth: []
/search-backend1/_doc:
post:
summary: Add a new note
operationId: addNote
tags:
- note
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/Note"
responses:
"201":
description: Note added successfully
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
security:
- ApiKeyAuth: []
/search-backend1/_search:
post:
summary: Search for notes
operationId: searchNotes
tags:
- search
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
query:
type: object
properties:
query_string:
type: object
properties:
query:
type: string
description: The search query
responses:
"200":
description: Search results
content:
application/json:
schema:
type: object
properties:
hits:
type: object
properties:
total:
type: object
properties:
value:
type: integer
relation:
type: string
enum:
- eq
- gte
hits:
type: array
items:
type: object
properties:
_source:
type: object
description: The content of the note
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
security:
- ApiKeyAuth: []
components:
schemas:
Error:
type: object
required:
- code
- message
properties:
code:
type: integer
format: int32
message:
type: string
Note:
type: object
properties:
title:
type: string
description: The title of the note.
body:
type: string
description: The body or main content of the note.
keywords:
type: array
items:
type: string
description: Keywords associated with the note for categorization and search.
required:
- title
- body
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: Authorization
description: Use the provided API key for authorization as "ApiKey ****"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment