Documentation ¶
Index ¶
- func RunJSONTests(t *testing.T, tests []JsonTest)
- func RunMapTests(t *testing.T, tests []MapTest)
- type Aggregation
- type CountRequest
- type DeleteRequest
- func (req *DeleteRequest) Index(index ...string) *DeleteRequest
- func (req *DeleteRequest) Query(q Mappable) *DeleteRequest
- func (req *DeleteRequest) Run(api *elasticsearch.Client, o ...func(*esapi.DeleteByQueryRequest)) (res *esapi.Response, err error)
- func (req *DeleteRequest) RunDelete(del esapi.DeleteByQuery, o ...func(*esapi.DeleteByQueryRequest)) (res *esapi.Response, err error)
- type HighlightBoundaryScanner
- type HighlightEncoder
- type HighlightFragmenter
- type HighlightOrder
- type HighlightTagsSchema
- type HighlightType
- type JsonTest
- type MapTest
- type Mappable
- type Order
- type QueryHighlight
- func (q *QueryHighlight) BoundaryChars(s string) *QueryHighlight
- func (q *QueryHighlight) BoundaryMaxScan(i uint16) *QueryHighlight
- func (q *QueryHighlight) BoundaryScanner(t HighlightBoundaryScanner) *QueryHighlight
- func (q *QueryHighlight) BoundaryScannerLocale(l string) *QueryHighlight
- func (q *QueryHighlight) Encoder(e HighlightEncoder) *QueryHighlight
- func (q *QueryHighlight) Field(name string, h ...*QueryHighlight) *QueryHighlight
- func (q *QueryHighlight) Fields(h map[string]*QueryHighlight) *QueryHighlight
- func (q *QueryHighlight) ForceSource(b bool) *QueryHighlight
- func (q *QueryHighlight) FragmentOffset(i uint16) *QueryHighlight
- func (q *QueryHighlight) FragmentSize(i uint16) *QueryHighlight
- func (q *QueryHighlight) Fragmenter(f HighlightFragmenter) *QueryHighlight
- func (q *QueryHighlight) HighlightQuery(b Mappable) *QueryHighlight
- func (q *QueryHighlight) Map() map[string]interface{}
- func (q *QueryHighlight) MatchedFields(s ...string) *QueryHighlight
- func (q *QueryHighlight) NoMatchSize(i uint16) *QueryHighlight
- func (q *QueryHighlight) NumberOfFragments(i uint16) *QueryHighlight
- func (q *QueryHighlight) Order(o HighlightOrder) *QueryHighlight
- func (q *QueryHighlight) PhraseLimit(i uint16) *QueryHighlight
- func (q *QueryHighlight) PostTags(s ...string) *QueryHighlight
- func (q *QueryHighlight) PreTags(s ...string) *QueryHighlight
- func (q *QueryHighlight) RequireFieldMatch(b bool) *QueryHighlight
- func (q *QueryHighlight) TagsSchema(s HighlightTagsSchema) *QueryHighlight
- func (q *QueryHighlight) Type(t HighlightType) *QueryHighlight
- type Sort
- type Source
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunJSONTests ¶
func RunMapTests ¶
Types ¶
type Aggregation ¶
Aggregation is an interface that each aggregation type must implement. It is simply an extension of the Mappable interface to include a Named function, which returns the name of the aggregation.
type CountRequest ¶
type CountRequest struct {
// contains filtered or unexported fields
}
CountRequest represents a request to get the number of matches for a search query, as described in: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html
func Count ¶
func Count(q Mappable) *CountRequest
Count creates a new count request with the provided query.
func (*CountRequest) Map ¶
func (req *CountRequest) Map() map[string]interface{}
Map returns a map representation of the request, thus implementing the Mappable interface.
func (*CountRequest) Run ¶
func (req *CountRequest) Run( api *elasticsearch.Client, o ...func(*esapi.CountRequest), ) (res *esapi.Response, err error)
Run executes the request using the provided ElasticCount client. Zero or more search options can be provided as well. It returns the standard Response type of the official Go client.
func (*CountRequest) RunCount ¶
func (req *CountRequest) RunCount( count esapi.Count, o ...func(*esapi.CountRequest), ) (res *esapi.Response, err error)
RunCount is the same as the Run method, except that it accepts a value of type esapi.Count (usually this is the Count field of an elasticsearch.Client object). Since the ElasticCount client does not provide an interface type for its API (which would allow implementation of mock clients), this provides a workaround. The Count function in the ES client is actually a field of a function type.
type DeleteRequest ¶
type DeleteRequest struct {
// contains filtered or unexported fields
}
DeleteRequest represents a request to ElasticSearch's Delete By Query API, described in https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html
func Delete ¶
func Delete() *DeleteRequest
Delete creates a new DeleteRequest object, to be filled via method chaining.
func (*DeleteRequest) Index ¶
func (req *DeleteRequest) Index(index ...string) *DeleteRequest
Index sets the index names for the request
func (*DeleteRequest) Query ¶
func (req *DeleteRequest) Query(q Mappable) *DeleteRequest
Query sets a query for the request.
func (*DeleteRequest) Run ¶
func (req *DeleteRequest) Run( api *elasticsearch.Client, o ...func(*esapi.DeleteByQueryRequest), ) (res *esapi.Response, err error)
Run executes the request using the provided ElasticSearch client.
func (*DeleteRequest) RunDelete ¶
func (req *DeleteRequest) RunDelete( del esapi.DeleteByQuery, o ...func(*esapi.DeleteByQueryRequest), ) (res *esapi.Response, err error)
RunDelete is the same as the Run method, except that it accepts a value of type esapi.DeleteByQuery (usually this is the DeleteByQuery field of an elasticsearch.Client object). Since the ElasticSearch client does not provide an interface type for its API (which would allow implementation of mock clients), this provides a workaround. The Delete function in the ES client is actually a field of a function type.
type HighlightBoundaryScanner ¶
type HighlightBoundaryScanner uint8
const ( BoundaryScannerDefault HighlightBoundaryScanner = iota // BoundaryScannerChars is the "chars" value BoundaryScannerChars // BoundaryScannerSentence is the "sentence" value BoundaryScannerSentence // BoundaryScannerWord is the "word" value BoundaryScannerWord )
func (HighlightBoundaryScanner) String ¶
func (a HighlightBoundaryScanner) String() string
String returns a string representation of the boundary_scanner parameter, as known to ElasticSearch.
type HighlightEncoder ¶
type HighlightEncoder uint8
const ( // EncoderDefault is the "default" value EncoderDefault HighlightEncoder = iota // EncoderHtml is the "html" value EncoderHtml )
func (HighlightEncoder) String ¶
func (a HighlightEncoder) String() string
String returns a string representation of the encoder parameter, as known to ElasticSearch.
type HighlightFragmenter ¶
type HighlightFragmenter uint8
const ( // FragmentSpan is the "span" value FragmenterSpan HighlightFragmenter = iota // FragmenterSimple is the "simple" value FragmenterSimple )
func (HighlightFragmenter) String ¶
func (a HighlightFragmenter) String() string
String returns a string representation of the fragmenter parameter, as known to ElasticSearch.
type HighlightOrder ¶
type HighlightOrder uint8
const ( // OrderNone is the "none" value OrderNone HighlightOrder = iota // OrderScore is the "score" value OrderScore )
func (HighlightOrder) String ¶
func (a HighlightOrder) String() string
String returns a string representation of the order parameter, as known to ElasticSearch.
type HighlightTagsSchema ¶
type HighlightTagsSchema uint8
const ( TagsSchemaDefault HighlightTagsSchema = iota // TagsSchemaStyled is the "styled" value TagsSchemaStyled )
func (HighlightTagsSchema) String ¶
func (a HighlightTagsSchema) String() string
String returns a string representation of the tags_schema parameter, as known to ElasticSearch.
type HighlightType ¶
type HighlightType uint8
const ( // HighlighterUnified is the "unified" value HighlighterUnified HighlightType = iota // HighlighterPlain is the "plain" value HighlighterPlain // HighlighterFvh is the "fvh" value HighlighterFvh )
func (HighlightType) String ¶
func (a HighlightType) String() string
String returns a string representation of the type parameter, as known to ElasticSearch.
type Mappable ¶
type Mappable interface {
Map() map[string]interface{}
}
Mappable is the interface implemented by the various query and aggregation types provided by the package. It allows the library to easily transform the different queries to "generic" maps that can be easily encoded to JSON.
type QueryHighlight ¶
type QueryHighlight struct {
// contains filtered or unexported fields
}
func Highlight ¶
func Highlight() *QueryHighlight
Highlight creates a new "query" of type "highlight"
func (*QueryHighlight) BoundaryChars ¶
func (q *QueryHighlight) BoundaryChars(s string) *QueryHighlight
BoundaryChars sets the highlight query's boundary_chars ignore unmapped field
func (*QueryHighlight) BoundaryMaxScan ¶
func (q *QueryHighlight) BoundaryMaxScan(i uint16) *QueryHighlight
BoundaryMaxScan sets the highlight query's boundary_max_scan ignore unmapped field
func (*QueryHighlight) BoundaryScanner ¶
func (q *QueryHighlight) BoundaryScanner(t HighlightBoundaryScanner) *QueryHighlight
BoundaryScanner sets the highlight query's boundary_scanner ignore unmapped field
func (*QueryHighlight) BoundaryScannerLocale ¶
func (q *QueryHighlight) BoundaryScannerLocale(l string) *QueryHighlight
BoundaryScannerLocale sets the highlight query's boundary_scanner_locale ignore unmapped field
func (*QueryHighlight) Encoder ¶
func (q *QueryHighlight) Encoder(e HighlightEncoder) *QueryHighlight
Encoder sets the highlight query's encoder ignore unmapped field
func (*QueryHighlight) Field ¶
func (q *QueryHighlight) Field(name string, h ...*QueryHighlight) *QueryHighlight
Field sets an entry the highlight query's fields
func (*QueryHighlight) Fields ¶
func (q *QueryHighlight) Fields(h map[string]*QueryHighlight) *QueryHighlight
Fields sets all entries for the highlight query's fields
func (*QueryHighlight) ForceSource ¶
func (q *QueryHighlight) ForceSource(b bool) *QueryHighlight
ForceSource sets the highlight query's force_source ignore unmapped field
func (*QueryHighlight) FragmentOffset ¶
func (q *QueryHighlight) FragmentOffset(i uint16) *QueryHighlight
FragmentOffset sets the highlight query's fragment_offset ignore unmapped field
func (*QueryHighlight) FragmentSize ¶
func (q *QueryHighlight) FragmentSize(i uint16) *QueryHighlight
FragmentSize sets the highlight query's fragment_size ignore unmapped field
func (*QueryHighlight) Fragmenter ¶
func (q *QueryHighlight) Fragmenter(f HighlightFragmenter) *QueryHighlight
Fragmenter sets the highlight query's fragmenter ignore unmapped field
func (*QueryHighlight) HighlightQuery ¶
func (q *QueryHighlight) HighlightQuery(b Mappable) *QueryHighlight
HighlightQuery sets the highlight query's highlight_query ignore unmapped field
func (*QueryHighlight) Map ¶
func (q *QueryHighlight) Map() map[string]interface{}
Map returns a map representation of the highlight; implementing the Mappable interface.
func (*QueryHighlight) MatchedFields ¶
func (q *QueryHighlight) MatchedFields(s ...string) *QueryHighlight
MatchedFields sets the highlight query's matched_fields ignore unmapped field
func (*QueryHighlight) NoMatchSize ¶
func (q *QueryHighlight) NoMatchSize(i uint16) *QueryHighlight
NoMatchSize sets the highlight query's no_match_size ignore unmapped field
func (*QueryHighlight) NumberOfFragments ¶
func (q *QueryHighlight) NumberOfFragments(i uint16) *QueryHighlight
NumberOfFragments sets the highlight query's number_of_fragments ignore unmapped field
func (*QueryHighlight) Order ¶
func (q *QueryHighlight) Order(o HighlightOrder) *QueryHighlight
Order sets the nested highlight's score order unmapped field
func (*QueryHighlight) PhraseLimit ¶
func (q *QueryHighlight) PhraseLimit(i uint16) *QueryHighlight
PhraseLimit sets the highlight query's phrase_limit ignore unmapped field
func (*QueryHighlight) PostTags ¶
func (q *QueryHighlight) PostTags(s ...string) *QueryHighlight
PostTags sets the highlight query's post_tags ignore unmapped field
func (*QueryHighlight) PreTags ¶
func (q *QueryHighlight) PreTags(s ...string) *QueryHighlight
PreTags sets the highlight query's pre_tags ignore unmapped field
func (*QueryHighlight) RequireFieldMatch ¶
func (q *QueryHighlight) RequireFieldMatch(b bool) *QueryHighlight
RequireFieldMatch sets the highlight query's require_field_match ignore unmapped field
func (*QueryHighlight) TagsSchema ¶
func (q *QueryHighlight) TagsSchema(s HighlightTagsSchema) *QueryHighlight
TagsSchema sets the highlight query's tags_schema ignore unmapped field
func (*QueryHighlight) Type ¶
func (q *QueryHighlight) Type(t HighlightType) *QueryHighlight
Type sets the highlight query's type ignore unmapped field
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
Source represents the "_source" option which is commonly accepted in ES queries. Currently, only the "includes" option is supported.