elasticsearch

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ctx

func Ctx(ctx context.Context) *elasticsearch.Client

func Elasticsearch

func Elasticsearch(ctx context.Context, cfg *configs.Config) error

Types

type Config

type Config struct {
	Address  []string
	Username string
	Password string
	Cert     string
}

type ErrorInfo

type ErrorInfo struct {
	RootCause []*ErrorInfo
	Type      string
	Reason    string
	Phase     string
}

type ErrorResponse

type ErrorResponse struct {
	Info *ErrorInfo `json:"error,omitempty"`
}

type IndexResponse

type IndexResponse struct {
	Index   string `json:"_index"`
	ID      string `json:"_id"`
	Version int    `json:"_version"`
	Result  string
}

type SearchHit

type SearchHit[T any] struct {
	Score   float64 `json:"_score"`
	Index   string  `json:"_index"`
	Type    string  `json:"_type"`
	Version int64   `json:"_version,omitempty"`

	Source T `json:"_source"`
}

type SearchResponse

type SearchResponse[T any] struct {
	Took int64
	Hits struct {
		Total struct {
			Value int64
		}
		Hits []*SearchHit[T]
	}
}

Jump to

Keyboard shortcuts

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