Documentation
¶
Index ¶
- func Bulk(c *gin.Context)
- func Bulkv2(c *gin.Context)
- func Bulkv2Worker(indexName string, body meta.JSONIngest) (int64, error)
- func CreateUpdate(c *gin.Context)
- func CreateWithIDForSDK()
- func Delete(c *gin.Context)
- func DoesExistInThisRequest(slice []string, val string) int
- func ESBulk(c *gin.Context)
- func Get(c *gin.Context)
- func Multi(c *gin.Context)
- func MultiWorker(indexName string, body io.Reader) (int64, error)
- func Update(c *gin.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 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 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