document

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 14 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 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 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