search

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 13 Imported by: 1 module, 2 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

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