Documentation
¶
Index ¶
- Variables
- func AllShardsMustReplyOnElasticSearch(results *elastic.SearchResult, err error) (*elastic.SearchResult, error)
- func BuildElasticBoolQuery(ctx context.Context, filter Filter) (elastic.Query, error)
- func GetElasticPaginatorFromHits(hits []*elastic.SearchHit) (string, error)
- func GetErrorFromElasticResponse(err error) error
- func MarshalQuery(query elastic.Query) string
- type CustomQuery
- type CustomSearch
- type Filter
- type FloatRange
- type FullTextSearchMust
- type FullTextSearchShould
- type IntRange
- type MultiMatchSearchShould
- type Nested
- type Ranges
- type TimeRange
Constants ¶
This section is empty.
Variables ¶
var ErrNotAllShardsReplied = errors.New("not all shards replied")
ErrNotAllShardsReplied is returned when no all elasticsearch's shards successfully reply.
Functions ¶
func AllShardsMustReplyOnElasticSearch ¶
func AllShardsMustReplyOnElasticSearch( results *elastic.SearchResult, err error, ) (*elastic.SearchResult, error)
AllShardsMustReplyOnElasticSearch checks if any shard failed to respond.
func BuildElasticBoolQuery ¶
BuildElasticBoolQuery builds a olivere/elastic's query based on Filter.
func GetElasticPaginatorFromHits ¶
GetElasticPaginatorFromHits gets the elastic sort in the last hit as a json string.
func GetErrorFromElasticResponse ¶
GetErrorFromElasticResponse checks if err is an *elastic.Error and returns an error with a formatted message. nolint: gocritic, errorlint
func MarshalQuery ¶
MarshalQuery transforms a olivere/elastic's query in a string for log and test purpose.
Types ¶
type CustomQuery ¶ added in v0.1.11
CustomQuery is the type function that will return the custom query.
type CustomSearch ¶ added in v0.1.11
type CustomSearch struct {
GetQuery CustomQuery
}
CustomSearch is the struct that contains the CustomQuery function.
func NewCustomSearch ¶ added in v0.1.11
func NewCustomSearch(query CustomQuery) CustomSearch
NewCustomSearch creates a CustomSearch struct with the given CustomQuery function.
type Filter ¶
type Filter struct {
Must interface{}
MustNot interface{}
Exists interface{}
}
Filter is a struct that eill be transformed in a olivere/elastic's query.
"Must" and "MustNot" is for the terms, range and multi match query. "Exists" is for the exists query. For nested queries, uses the Nested type.
type FloatRange ¶
FloatRange represents a float range with a beginning and an end.
type FullTextSearchMust ¶
type FullTextSearchMust struct {
// contains filtered or unexported fields
}
FullTextSearchMust Represents a Must's Full Text Search.
func NewFullTextSearchMust ¶
func NewFullTextSearchMust(payload interface{}) FullTextSearchMust
NewFullTextSearchMust creates a FullTextSearchMust struct with the given payload.
type FullTextSearchShould ¶
type FullTextSearchShould struct {
// contains filtered or unexported fields
}
FullTextSearchMust Represents a Should's Full Text Search.
func NewFullTextSearchShould ¶
func NewFullTextSearchShould(payload interface{}) FullTextSearchShould
NewFullTextSearchShould creates a FullTextSearchShould struct with the given payload.
type MultiMatchSearchShould ¶ added in v0.2.0
type MultiMatchSearchShould struct {
// contains filtered or unexported fields
}
MultiMatchSearchShould Represents a Should's Multi Match Search.
func NewMultiMatchSearchShould ¶ added in v0.2.0
func NewMultiMatchSearchShould(payload interface{}) MultiMatchSearchShould
NewMultiMatchSearchShould creates a MultiMatchSearchShould struct with the given payload.