elasticsearch

package
v1.10.1-0...-bfe0789 Latest Latest
Warning

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

Go to latest
Published: May 4, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API aggregates a client and URL and other common data for accessing the API

func NewElasticSearchAPI

func NewElasticSearchAPI(client dphttp.Clienter, elasticSearchAPIURL string, signRequests bool, awsSDKSigner *esauth.Signer, awsService, awsRegion string) *API

NewElasticSearchAPI creates an API object

func (*API) CallElastic

func (api *API) CallElastic(ctx context.Context, path, method string, payload interface{}) ([]byte, int, error)

CallElastic builds a request to elastic search based on the method, path and payload

func (*API) DeleteSearchIndex

func (api *API) DeleteSearchIndex(ctx context.Context, instanceID, dimension string) (int, error)

DeleteSearchIndex removes an index from elasticsearch

func (*API) QuerySearchIndex

func (api *API) QuerySearchIndex(ctx context.Context, instanceID, dimension, term string, limit, offset int) (*models.SearchResponse, int, error)

QuerySearchIndex builds query as a json body to call an elasticsearch index with

type Body

type Body struct {
	From      int        `json:"from"`
	Size      int        `json:"size"`
	Highlight *Highlight `json:"highlight,omitempty"`
	Query     Query      `json:"query"`
	Sort      []Scores   `json:"sort"`
}

Body represents the request body to elasticsearch

type Bool

type Bool struct {
	Must   []Match `json:"must,omitempty"`
	Should []Match `json:"should,omitempty"`
}

Bool represents the desirable goals for query

type Highlight

type Highlight struct {
	PreTags  []string          `json:"pre_tags,omitempty"`
	PostTags []string          `json:"post_tags,omitempty"`
	Fields   map[string]Object `json:"fields,omitempty"`
	Order    string            `json:"score,omitempty"`
}

Highlight represents parts of the fields that matched

type Match

type Match struct {
	Match map[string]string `json:"match,omitempty"`
}

Match represents the fields that the term should or must match within query

type Object

type Object struct{}

Object represents an empty object (as expected by elasticsearch)

type Query

type Query struct {
	Bool Bool `json:"bool"`
}

Query represents the request query details

type Score

type Score struct {
	Order string `json:"order"`
}

Score contains the ordering of the score (ascending or descending)

type Scores

type Scores struct {
	Score Score `json:"_score"`
}

Scores represents a list of scoring, e.g. scoring on relevance, but can add in secondary score such as alphabetical order if relevance is the same for two search results

Jump to

Keyboard shortcuts

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