Documentation
¶
Index ¶
- func Bulk(c zhttp.Context)
- func Bulkv2(c zhttp.Context)
- func Bulkv2Worker(indexName string, body meta.JSONIngest) (int64, error)
- func CreateUpdate(c zhttp.Context)
- func CreateWithIDForSDK()
- func Delete(c zhttp.Context)
- func DoesExistInThisRequest(slice []string, val string) int
- func ESBulk(c zhttp.Context)
- func Get(c zhttp.Context)
- func IngestLogs(target string, docs []map[string]interface{}) (logs.StreamStatus, error)
- func LogsHEC(c zhttp.Context)
- func LogsJSON(c zhttp.Context)
- func LokiPush(c zhttp.Context)
- func Multi(c zhttp.Context)
- func MultiWorker(indexName string, body io.Reader) (int64, error)
- func OTLPLogs(c zhttp.Context)
- func Update(c zhttp.Context)
- type BulkResponse
- type BulkResponseItem
- type BulkResponseItemShard
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bulk ¶
Bulk accept multiple documents, first line index metadata, second line document
@Id Bulk @Summary Bulk documents @security BasicAuth @Tags Document @Accept plain @Produce json @Param query body string true "Query" @Success 200 {object} meta.HTTPResponseRecordCount @Failure 500 {object} meta.HTTPResponseError @Router /api/_bulk [post]
func Bulkv2 ¶
Bulkv2 accept JSONIngest json documents. Its a simpler and standard format to ingest data. support use field `_id` set document id
@Id Bulkv2 @Summary Bulkv2 documents @security BasicAuth @Tags Document @Accept json @Produce json @Param query body meta.JSONIngest true "Query" @Success 200 {object} meta.HTTPResponseRecordCount @Failure 400 {object} meta.HTTPResponseError @Failure 500 {object} meta.HTTPResponseError @Router /api/_bulkv2 [post]
func Bulkv2Worker ¶
func Bulkv2Worker(indexName string, body meta.JSONIngest) (int64, error)
Bulkv2Worker accept JSONIngest json documents. It provides a simpler format to ingest data.
func CreateUpdate ¶
@Id IndexDocument @Summary Create or update document @security BasicAuth @Tags Document @Accept json @Produce json @Param index path string true "Index" @Param document body map[string]interface{} true "Document" @Success 200 {object} meta.HTTPResponseID @Failure 400 {object} meta.HTTPResponseError @Failure 500 {object} meta.HTTPResponseError @Router /api/{index}/_doc [post]
func CreateWithIDForSDK ¶
func CreateWithIDForSDK()
@Id IndexDocumentWithID @Summary Create or update document with id @security BasicAuth @Tags Document @Accept json @Produce json @Param index path string true "Index" @Param id path string true "ID" @Param document body map[string]interface{} true "Document" @Success 200 {object} meta.HTTPResponseID @Failure 400 {object} meta.HTTPResponseError @Failure 500 {object} meta.HTTPResponseError @Router /api/{index}/_doc/{id} [put]
func Delete ¶
@Id DeleteDocument @Summary Delete document @security BasicAuth @Tags Document @Produce json @Param index path string true "Index" @Param id path string true "ID" @Success 200 {object} meta.HTTPResponseDocument @Failure 400 {object} meta.HTTPResponseError @Failure 500 {object} meta.HTTPResponseError @Router /api/{index}/_doc/{id} [delete]
func DoesExistInThisRequest ¶
DoesExistInThisRequest takes a slice and looks for an element in it. If found it will return it's index, otherwise it will return -1.
func ESBulk ¶
ESBulk accept multiple documents, first line index metadata, second line document
@Id ESBulk @Summary ES bulk documents @security BasicAuth @Tags Document @Accept plain @Produce json @Param query body string true "Query" @Success 200 {object} map[string]interface{} @Failure 500 {object} meta.HTTPResponseError @Router /es/_bulk [post]
func Get ¶
@Id GetDocument @Summary get document with id @security BasicAuth @Tags Document @Accept json @Produce json @Param index path string true "Index" @Param id path string true "ID" @Success 200 {object} meta.Hit @Failure 400 {object} meta.HTTPResponseError @Failure 500 {object} meta.HTTPResponseError @Router /api/{index}/_doc/{id} [get]
func IngestLogs ¶ added in v1.3.0
func IngestLogs(target string, docs []map[string]interface{}) (logs.StreamStatus, error)
IngestLogs writes records to target, creating it as a logs index when it doesn't exist and no template sets its index_type. Invalid records, including those outside the configured ingestion window, are counted as failed and don't stop the rest. A storage failure stops the batch and is returned: the client retries it whole, so delivery is at least once and records written before the failure may be stored twice.
func LogsHEC ¶ added in v1.3.0
LogsHEC ingests Splunk HTTP Event Collector events.
@Id LogsHEC @Summary Ingest Splunk HEC events @security BasicAuth @Tags Document @Accept plain @Produce json @Param index path string true "Index" @Param events body string true "Concatenated HEC event objects" @Success 200 {object} map[string]interface{} @Failure 400 {object} map[string]interface{} @Router /api/{index}/_hec [post]
func LogsJSON ¶ added in v1.3.0
LogsJSON ingests an OpenObserve `_json` body, a JSON array of log records.
@Id LogsJSON @Summary Ingest log records (OpenObserve _json) @security BasicAuth @Tags Document @Accept json @Produce json @Param index path string true "Index" @Param logs body []map[string]interface{} true "Log records" @Success 200 {object} logs.IngestResponse @Failure 400 {object} meta.HTTPResponseError @Router /api/{index}/_json [post]
func LokiPush ¶ added in v1.3.0
LokiPush ingests a Loki push API JSON request.
@Id LokiPush @Summary Ingest Loki push request (JSON) @security BasicAuth @Tags Document @Accept json @Produce json @Param index path string true "Index" @Param push body map[string]interface{} true "Loki push request" @Success 204 @Failure 400 {object} logs.IngestResponse @Router /api/{index}/loki/api/v1/push [post]
func Multi ¶
Multi accept multiple line json documents support use field `_id` set document id
@Id Multi @Summary Multi documents @security BasicAuth @Tags Document @Accept plain @Produce json @Param index path string true "Index" @Param query body string true "Query" @Success 200 {object} meta.HTTPResponseRecordCount @Failure 400 {object} meta.HTTPResponseError @Failure 500 {object} meta.HTTPResponseError @Router /api/{index}/_multi [post]
func OTLPLogs ¶ added in v1.3.0
OTLPLogs ingests an OTLP/HTTP JSON logs export request.
@Id OTLPLogs @Summary Ingest OTLP logs (HTTP/JSON) @security BasicAuth @Tags Document @Accept json @Produce json @Param index path string true "Index" @Param logs body map[string]interface{} true "OTLP logs export request" @Success 200 {object} map[string]interface{} @Failure 400 {object} meta.HTTPResponseError @Router /api/{index}/v1/logs [post]
func Update ¶
@Id UpdateDocument @Summary Update document with id @security BasicAuth @Tags Document @Accept json @Produce json @Param index path string true "Index" @Param id path string true "ID" @Param document body map[string]interface{} true "Document" @Success 200 {object} meta.HTTPResponseID @Failure 400 {object} meta.HTTPResponseError @Failure 500 {object} meta.HTTPResponseError @Router /api/{index}/_update/{id} [post]
Types ¶
type BulkResponse ¶
type BulkResponse struct {
Took int `json:"took"`
Errors bool `json:"errors"`
Error string `json:"error,omitempty"`
Items []map[string]BulkResponseItem `json:"items"`
Count int64 `json:"-"`
}
func BulkWorker ¶
func BulkWorker(target string, body io.Reader) (*BulkResponse, error)
type BulkResponseItem ¶
type BulkResponseItem struct {
Index string `json:"_index"`
Type string `json:"_type"`
ID string `json:"_id"`
Version int64 `json:"_version"`
Result string `json:"result"`
Status int `json:"status"`
Shards BulkResponseItemShard `json:"_shards"`
SeqNo int64 `json:"_seq_no"`
PrimaryTerm int `json:"_primary_term"`
Error string `json:"error,omitempty"`
}
func NewBulkResponseItem ¶
func NewBulkResponseItem(seqNo int64, index, id, result string, err error) BulkResponseItem