elastic

package
v1.8.8 Latest Latest
Warning

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

Go to latest
Published: May 26, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDocument

func CreateDocument[T any](ctx context.Context, es *elasticsearch.Client, index, id string, obj T) error

func GetResponseData added in v1.2.8

func GetResponseData[T any](response *esapi.Response, err error) (*T, error)

Types

type Hit

type Hit[T any] struct {
	Index  string      `json:"_index"`
	Id     string      `json:"_id"`
	Score  interface{} `json:"_score"`
	Source T           `json:"_source"`
	Sort   []int       `json:"sort"`
}

type Hits

type Hits[T any] struct {
	Total    Total    `json:"total"`
	MaxScore any      `json:"max_score"`
	Hits     []Hit[T] `json:"hits"`
}

type SearchResponse

type SearchResponse[T any] struct {
	Took     int     `json:"took"`
	TimedOut bool    `json:"timed_out"`
	Shards   Shards  `json:"_shards"`
	Hits     Hits[T] `json:"hits"`
}

func GetSearchResponseData added in v1.2.8

func GetSearchResponseData[T any](response *esapi.Response, err error) (*SearchResponse[T], error)

type Shards

type Shards struct {
	Total      int `json:"total"`
	Successful int `json:"successful"`
	Skipped    int `json:"skipped"`
	Failed     int `json:"failed"`
}

type Total

type Total struct {
	Value    int    `json:"value"`
	Relation string `json:"relation"`
}

Jump to

Keyboard shortcuts

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