Cyber Social

Cyber Social · GPT-Aktionen

Elasticsearch API

  • POST /search-any/_doc/Add a new document
  • POST /search-any/_searchSearch for documents
Ursprüngliches API-Schema
{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "Elasticsearch API",
    "license": {
      "name": "Apache 2.0"
    }
  },
  "servers": [
    {
      "url": "https://ef960faf469f4188ba9f0034971a8b07.us-central1.gcp.cloud.es.io:443"
    }
  ],
  "paths": {
    "/search-any/_doc/": {
      "post": {
        "summary": "Add a new document",
        "operationId": "addDocument",
        "tags": [
          "document"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Document"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Document added successfully"
          },
          "default": {
            "description": "Unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/search-any/_search": {
      "post": {
        "summary": "Search for documents",
        "operationId": "searchDocuments",
        "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"
                          }
                        }
                      }
                    }
                  },
                  "sort": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "object",
                        "properties": {
                          "order": {
                            "type": "string",
                            "enum": [
                              "asc",
                              "desc"
                            ]
                          }
                        }
                      }
                    }
                  },
                  "from": {
                    "type": "integer",
                    "description": "Start index for search results"
                  },
                  "size": {
                    "type": "integer",
                    "description": "Number of search results to return"
                  },
                  "_source": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Specific fields to return in the search results"
                  },
                  "aggs": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "object",
                      "properties": {
                        "terms": {
                          "type": "object",
                          "properties": {
                            "field": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Search results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "hits": {
                      "type": "object",
                      "properties": {
                        "hits": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "_source": {
                                "type": "object",
                                "description": "The content of the document"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "integer",
            "format": "int32"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "Document": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "The person's name."
          },
          "content": {
            "type": "string",
            "description": "The content or body of the information."
          },
          "category": {
            "type": "string",
            "description": "The category of the information."
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "Email address."
          },
          "phone": {
            "type": "string",
            "description": "Phone number."
          },
          "facebook": {
            "type": "string",
            "format": "uri",
            "description": "Facebook profile URL."
          },
          "twitter": {
            "type": "string",
            "format": "uri",
            "description": "Twitter profile URL."
          },
          "medium": {
            "type": "string",
            "format": "uri",
            "description": "Medium profile URL."
          },
          "telegram": {
            "type": "string",
            "format": "uri",
            "description": "Telegram profile URL."
          },
          "instagram": {
            "type": "string",
            "format": "uri",
            "description": "Instagram profile URL."
          },
          "linkedin": {
            "type": "string",
            "format": "uri",
            "description": "LinkedIn profile URL."
          },
          "pinterest": {
            "type": "string",
            "format": "uri",
            "description": "Pinterest profile URL."
          },
          "snapchat": {
            "type": "string",
            "format": "uri",
            "description": "Snapchat profile URL."
          },
          "tiktok": {
            "type": "string",
            "format": "uri",
            "description": "TikTok profile URL."
          },
          "youtube": {
            "type": "string",
            "format": "uri",
            "description": "YouTube channel URL."
          },
          "reddit": {
            "type": "string",
            "format": "uri",
            "description": "Reddit profile URL."
          },
          "tumblr": {
            "type": "string",
            "format": "uri",
            "description": "Tumblr blog URL."
          },
          "weibo": {
            "type": "string",
            "format": "uri",
            "description": "Weibo profile URL."
          },
          "github": {
            "type": "string",
            "format": "uri",
            "description": "GitHub profile URL."
          },
          "gitlab": {
            "type": "string",
            "format": "uri",
            "description": "GitLab profile URL."
          },
          "bitbucket": {
            "type": "string",
            "format": "uri",
            "description": "Bitbucket profile URL."
          },
          "discord": {
            "type": "string",
            "format": "uri",
            "description": "Discord profile URL."
          },
          "twitch": {
            "type": "string",
            "format": "uri",
            "description": "Twitch channel URL."
          },
          "behance": {
            "type": "string",
            "format": "uri",
            "description": "Behance profile URL."
          },
          "dribbble": {
            "type": "string",
            "format": "uri",
            "description": "Dribbble profile URL."
          },
          "flickr": {
            "type": "string",
            "format": "uri",
            "description": "Flickr profile URL."
          },
          "gender": {
            "type": "string",
            "description": "Gender of the person."
          },
          "birthdate": {
            "type": "string",
            "format": "date",
            "description": "Birthdate in YYYY-MM-DD format."
          },
          "photoUrl": {
            "type": "string",
            "format": "uri",
            "description": "URL of the person's photograph."
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Tags associated with the person or content."
          },
          "profession": {
            "type": "string",
            "description": "Profession or job title."
          },
          "website": {
            "type": "string",
            "format": "uri",
            "description": "URL of the person's personal or professional website."
          }
        },
        "required": [
          "name",
          "content",
          "category"
        ],
        "additionalProperties": true
      }
    }
  }
}