search

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: MIT Imports: 13 Imported by: 0

README

api-toolkit

Documentation

Index

Constants

View Source
const (
	PropFormatEmpty = PropFormat("")
	PropFormatTime  = PropFormat("epoch_second")
)
View Source
const (
	PropType_Keyword = PropType("keyword")
	PropType_Date    = PropType("date")
	PropType_Double  = PropType("double")
	PropType_Int     = PropType("integer")
)

Variables

This section is empty.

Functions

func AddDocument

func AddDocument(ctx context.Context, clt *elasticsearch.Client, dao SearchDao) error

func BulkAddDocument

func BulkAddDocument(ctx context.Context, clt *elasticsearch.Client, dao []SearchDao) error

func BulkAddDocumentWithIndex

func BulkAddDocumentWithIndex(ctx context.Context, clt *elasticsearch.Client, index string, dao []SearchDao) error

func CreateIndex

func CreateIndex(ctx context.Context, clt *elasticsearch.Client, index string, mapping string) error

func CreateIndexByDao

func CreateIndexByDao(ctx context.Context, clt *elasticsearch.Client, dao SearchDao) error

func DeleteDocument

func DeleteDocument(ctx context.Context, clt *elasticsearch.Client, dao SearchDao) error

func IsIndexExist

func IsIndexExist(ctx context.Context, clt *elasticsearch.Client, index string) (bool, error)

func UpdateDucument

func UpdateDucument(ctx context.Context, clt *elasticsearch.Client, dao SearchDao) error

Types

type IndexBuilder

type IndexBuilder interface {
	AddProperty(string, PropType, PropFormat) IndexBuilder
	String() string
}

func NewIndexBuilder

func NewIndexBuilder() IndexBuilder

type InfoResult

type InfoResult struct {
	ClientVersion string
	ServerVersion string
}

func Info

func Info(ctx context.Context, clt *elasticsearch.Client) (*InfoResult, error)

type PropFormat

type PropFormat string

type PropType

type PropType string

type Q

type Q map[string]any

type SearchDao

type SearchDao interface {
	Id() string
	Index() string
	Body() (*bytes.Reader, error)
	GetMapping() string
}

type SearchResult

type SearchResult struct {
	Status string
	Total  int
	Took   int
	Hits   []*hit
}
func Search(ctx context.Context, clt *elasticsearch.Client, dao SearchDao, q Q) (*SearchResult, error)

func (*SearchResult) AddHit

func (sr *SearchResult) AddHit(id string, s map[string]any)

Jump to

Keyboard shortcuts

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