elasticsearch

package
v0.0.0-...-4c03c20 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildFilters

func BuildFilters(req SearchRequest) []elastic.Query

func Connect

func Connect() (err error)

func CreateSnapshot

func CreateSnapshot(indices ...string) (string, error)

func GetESDocument

func GetESDocument(doi string) (map[string]interface{}, error)

func GetSnapshotStatus

func GetSnapshotStatus(name string) (string, error)

func LoadSnapshot

func LoadSnapshot(addr string, snapshotName string) error

func NewProcessTerms

func NewProcessTerms(req SearchRequest) elastic.Query

Types

type IndexMetadata

type IndexMetadata struct {
	Name        string  `json:"name"`
	Size        float32 `json:"indexSize"`
	SizeContent float32 `json:"contentSize"`
}

func GetIndexMetadata

func GetIndexMetadata() ([]*IndexMetadata, error)

type SearchRequest

type SearchRequest struct {
	Query     string   `json:"query"`
	Filters   []string `json:"filters"`
	Offset    int      `json:"offset"`
	Limit     int      `json:"limit"`
	Facets    []string `json:"facets"`
	Stats     []string `json:"stats"`
	Fields    []string `json:"fields"`
	Highlight []string `json:"highlight"`
}

SearchRequest represents an incoming search from the app

type SearchResult

type SearchResult struct {
	Total     int64                               `json:"total"`
	QueryTime int64                               `json:"qtime"`
	Documents []map[string]interface{}            `json:"docs"`
	Stats     map[string]interface{}              `json:"stats"`
	Facets    map[string][]map[string]interface{} `json:"facets"`
}

SearchResult represents an outgoing result to the app

func ParseResults

func ParseResults(esRes *elastic.SearchResult) *SearchResult

Jump to

Keyboard shortcuts

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