Documentation
¶
Index ¶
- Constants
- Variables
- func CreateReader(value any) (*bytes.Reader, error)
- func EncodeBulkItems(buffer *bytes.Buffer, items []BulkItem) error
- func ExtractResponseError(body io.ReadCloser, statusCode int) error
- func IsErrResponse(res apiResponse) error
- func Ptr[T any](i T) *T
- type Aggregation
- type BoolFilter
- type BulkIndex
- type BulkItem
- type BulkResponse
- type BulkResponseItem
- type CardinalityAgg
- type CausedBy
- type Client
- type Condition
- type CountResponse
- type DateHistogramAgg
- type DeleteByQueryRequest
- type ESPercentilesAgg
- type ErrIllegalArgument
- type ErrQueryInvalid
- type ErrResourceAlreadyExists
- type ExistsFilter
- type ExpFunction
- type Field
- type FieldValueFactor
- type Function
- type FunctionScore
- type Highlight
- type HistogramAgg
- type Hit
- type Hits
- type IndexRequest
- type IndexStats
- type IndexStatsResponse
- type IndexWithIDRequest
- type KNNQuery
- type Mapper
- type MappingResponse
- type Mappings
- type Metadata
- type MultiMatch
- type Query
- type QueryBody
- type ResponseError
- type RetryableError
- type RootCause
- type Script
- type ScriptScore
- type SearchRequest
- type SearchResponse
- type Sort
- type SumMinMaxAgg
- type TermsAgg
- type Type
Constants ¶
View Source
const ( SearchExecutionException = "search_phase_execution_exception" TooManyBucketsException = "too_many_buckets_exception" TooManyNestedClausesException = "too_many_nested_clauses" TooManyClausesException = "too_many_clauses" IllegalArgumentException = "illegal_argument_exception" SnapshotInProgressException = "snapshot_in_progress_exception" ResourceAlreadyExistsException = "resource_already_exists_exception" )
Variables ¶
View Source
var ( ErrTooManyRequests = errors.New("too many requests") ErrTooManyBuckets = errors.New("too many buckets") ErrTooManyNestedClauses = errors.New("too many nested clauses") ErrTooManyClauses = errors.New("too many clauses") ErrUnsupportedSearchFieldType = errors.New("unsupported search field type") ErrResourceNotFound = errors.New("search resource not found") )
Functions ¶
func CreateReader ¶
createReader returns a reader on the JSON representation of the given value.
func ExtractResponseError ¶ added in v0.4.0
func ExtractResponseError(body io.ReadCloser, statusCode int) error
func IsErrResponse ¶
func IsErrResponse(res apiResponse) error
Types ¶
type Aggregation ¶
type Aggregation struct {
Filter *Condition `json:"filter,omitempty"`
Cardinality *CardinalityAgg `json:"cardinality,omitempty"`
DateHistogram *DateHistogramAgg `json:"date_histogram,omitempty"`
Sum *SumMinMaxAgg `json:"sum,omitempty"`
Min *SumMinMaxAgg `json:"min,omitempty"`
Max *SumMinMaxAgg `json:"max,omitempty"`
Avg *SumMinMaxAgg `json:"avg,omitempty"`
Percentiles *ESPercentilesAgg `json:"percentiles,omitempty"`
Terms *TermsAgg `json:"terms,omitempty"`
Histogram *HistogramAgg `json:"histogram,omitempty"`
Aggs map[string]Aggregation `json:"aggs,omitempty"`
}
type BoolFilter ¶
type BulkItem ¶
type BulkResponse ¶
type BulkResponse struct {
Errors bool `json:"errors"`
Items []BulkResponseItem
}
type BulkResponseItem ¶
type BulkResponseItem struct {
Index struct {
Status int `json:"status"`
Error json.RawMessage `json:"error"`
} `json:"index"`
Delete struct {
Status int `json:"status"`
Error json.RawMessage `json:"error"`
} `json:"delete"`
}
type CardinalityAgg ¶
type Client ¶
type Client interface {
CloseIndex(ctx context.Context, index string) error
Count(ctx context.Context, index string) (int, error)
CreateIndex(ctx context.Context, index string, body map[string]any) error
DeleteByQuery(ctx context.Context, req *DeleteByQueryRequest) error
DeleteIndex(ctx context.Context, index []string) error
GetIndexAlias(ctx context.Context, name string) (map[string]any, error)
GetIndexMappings(ctx context.Context, index string) (*Mappings, error)
GetIndicesStats(ctx context.Context, indexPattern string) ([]IndexStats, error)
Index(ctx context.Context, req *IndexRequest) error
IndexWithID(ctx context.Context, req *IndexWithIDRequest) error
IndexExists(ctx context.Context, index string) (bool, error)
ListIndices(ctx context.Context, indices []string) ([]string, error)
Perform(req *http.Request) (*http.Response, error)
PutIndexAlias(ctx context.Context, index []string, name string) error
PutIndexMappings(ctx context.Context, index string, body map[string]any) error
PutIndexSettings(ctx context.Context, index string, body map[string]any) error
RefreshIndex(ctx context.Context, index string) error
Search(ctx context.Context, req *SearchRequest) (*SearchResponse, error)
SendBulkRequest(ctx context.Context, items []BulkItem) ([]BulkItem, error)
GetMapper() Mapper
}
type Condition ¶
type Condition struct {
Term map[string]any `json:"term,omitempty"`
Terms map[string]any `json:"terms,omitempty"`
Prefix map[string]any `json:"prefix,omitempty"`
Wildcard map[string]any `json:"wildcard,omitempty"`
IDs map[string]any `json:"ids,omitempty"`
Range map[string]any `json:"range,omitempty"`
Exists *ExistsFilter `json:"exists,omitempty"`
Bool *BoolFilter `json:"bool,omitempty"`
MultiMatch *MultiMatch `json:"multi_match,omitempty"`
}
type CountResponse ¶
type CountResponse struct {
Count int `json:"count"`
}
type DateHistogramAgg ¶
type DeleteByQueryRequest ¶
type ESPercentilesAgg ¶
type ErrIllegalArgument ¶
type ErrIllegalArgument struct {
Reason string
}
func (*ErrIllegalArgument) Error ¶
func (e *ErrIllegalArgument) Error() string
type ErrQueryInvalid ¶
type ErrQueryInvalid struct {
Cause error
}
func (ErrQueryInvalid) Error ¶
func (e ErrQueryInvalid) Error() string
type ErrResourceAlreadyExists ¶
type ErrResourceAlreadyExists struct {
Reason string
}
func (ErrResourceAlreadyExists) Error ¶
func (e ErrResourceAlreadyExists) Error() string
type ExistsFilter ¶
type ExistsFilter struct {
Field string `json:"field"`
}
type ExpFunction ¶
type FieldValueFactor ¶
type Function ¶
type Function struct {
Filter *Condition `json:"filter,omitempty"`
FieldValueFactor *FieldValueFactor `json:"field_value_factor,omitempty"`
Weight *float64 `json:"weight,omitempty"`
Exp map[string]ExpFunction `json:"exp,omitempty"`
}
type FunctionScore ¶
type HistogramAgg ¶
type IndexRequest ¶
type IndexStats ¶
type IndexStatsResponse ¶
type IndexWithIDRequest ¶
type MappingResponse ¶
type MultiMatch ¶
type Query ¶
type Query struct {
Bool *BoolFilter `json:"bool,omitempty"`
FunctionScore *FunctionScore `json:"function_score,omitempty"`
ScriptScore *ScriptScore `json:"script_score,omitempty"`
KNN *map[string]KNNQuery `json:"knn,omitempty"`
}
type ResponseError ¶
type RetryableError ¶
type RetryableError struct {
Cause error
}
func (RetryableError) Error ¶
func (r RetryableError) Error() string
func (RetryableError) Unwrap ¶
func (r RetryableError) Unwrap() error
type ScriptScore ¶
type ScriptScore struct {
Query json.RawMessage `json:"query,omitempty"`
Script *Script `json:"script,omitempty"`
}
type SearchRequest ¶
type SearchResponse ¶
type SumMinMaxAgg ¶
type SumMinMaxAgg struct {
Field string `json:"field"`
}
Click to show internal directories.
Click to hide internal directories.