Cyber Network

Cyber Network · GPT 작업

Elasticsearch API

  • POST /search-any/_doc/Add a new document
  • POST /search-any/_searchSearch for documents
원본 API 스키마
{
  "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": {
                "type": "object",
                "properties": {
                  "data": {
                    "type": "object",
                    "description": "The content of the document to be indexed"
                  }
                }
              }
            }
          }
        },
        "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"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "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"
          }
        }
      }
    }
  }
}

Elasticsearch API

  • POST /search-any/_doc/Add a new document
  • POST /search-any/_searchSearch for documents
원본 API 스키마
{
  "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": {
                "type": "object",
                "properties": {
                  "data": {
                    "type": "object",
                    "description": "The content of the document to be indexed"
                  }
                }
              }
            }
          }
        },
        "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"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "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"
          }
        }
      }
    }
  }
}