document

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 19 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bulk

func Bulk(c zhttp.Context)

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

func Bulkv2(c zhttp.Context)

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

func CreateUpdate(c zhttp.Context)

@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

func Delete(c zhttp.Context)

@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

func DoesExistInThisRequest(slice []string, val string) int

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

func ESBulk(c zhttp.Context)

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

func Get(c zhttp.Context)

@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

func LogsHEC(c zhttp.Context)

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

func LogsJSON(c zhttp.Context)

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

func LokiPush(c zhttp.Context)

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

func Multi(c zhttp.Context)

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 MultiWorker

func MultiWorker(indexName string, body io.Reader) (int64, error)

func OTLPLogs added in v1.3.0

func OTLPLogs(c zhttp.Context)

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

func Update(c zhttp.Context)

@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

type BulkResponseItemShard

type BulkResponseItemShard struct {
	Total      int `json:"total"`
	Successful int `json:"successful"`
	Failed     int `json:"failed"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL