Documentation ¶
Index ¶
- func CreatePageToken(pit string, from int) string
- func DecodeResponse(r io.ReadCloser, i interface{}) error
- func EncodeRequest(body interface{}) (io.Reader, string)
- func ParsePageToken(pageToken string) (string, int, error)
- func ReadRequestBody(request *http.Request, target interface{})
- type BulkRequest
- type BulkRequestItem
- type Client
- type CreateRequest
- type DeleteRequest
- type ESPitResponse
- type EsBulkOperation
- type EsBulkQueryFragment
- type EsBulkQueryOperationFragment
- type EsBulkResponse
- type EsBulkResponseItem
- type EsDeleteResponse
- type EsDocWithJoin
- type EsGetResponse
- type EsIndexDocError
- type EsIndexDocResponse
- type EsIndexResponse
- type EsJoin
- type EsMultiGetItem
- type EsMultiGetRequest
- type EsMultiGetResponse
- type EsMultiSearchQueryFragment
- type EsMultiSearchResponse
- type EsMultiSearchResponseHit
- type EsMultiSearchResponseHits
- type EsMultiSearchResponseHitsSummary
- type EsSearch
- type EsSearchCollapse
- type EsSearchPit
- type EsSearchResponse
- type EsSearchResponseHit
- type EsSearchResponseHits
- type EsSearchResponseTotal
- type EsSortOrder
- type GetRequest
- type MockEsTransport
- type MultiGetRequest
- type MultiSearchRequest
- type SearchPaginationOptions
- type SearchRequest
- type SearchResponse
- type TransportAction
- type UpdateRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreatePageToken ¶ added in v0.6.1
func DecodeResponse ¶
func DecodeResponse(r io.ReadCloser, i interface{}) error
func EncodeRequest ¶
func ReadRequestBody ¶
Types ¶
type BulkRequest ¶ added in v0.8.0
type BulkRequest struct { Index string Refresh string // TODO: use RefreshOption type Items []*BulkRequestItem }
type BulkRequestItem ¶ added in v0.8.0
type Client ¶ added in v0.6.3
type Client interface { Create(ctx context.Context, request *CreateRequest) (string, error) Bulk(ctx context.Context, request *BulkRequest) (*EsBulkResponse, error) Search(ctx context.Context, request *SearchRequest) (*SearchResponse, error) MultiSearch(ctx context.Context, request *MultiSearchRequest) (*EsMultiSearchResponse, error) Get(ctx context.Context, request *GetRequest) (*EsGetResponse, error) MultiGet(ctx context.Context, request *MultiGetRequest) (*EsMultiGetResponse, error) Update(ctx context.Context, request *UpdateRequest) (*EsIndexDocResponse, error) Delete(ctx context.Context, request *DeleteRequest) error }
type CreateRequest ¶ added in v0.6.3
type DeleteRequest ¶ added in v0.6.3
type ESPitResponse ¶ added in v0.6.1
type ESPitResponse struct {
Id string `json:"id"`
}
type EsBulkOperation ¶ added in v0.8.0
type EsBulkOperation string
const ( BULK_INDEX EsBulkOperation = "INDEX" BULK_CREATE EsBulkOperation = "CREATE" )
type EsBulkQueryFragment ¶ added in v0.6.0
type EsBulkQueryFragment struct { Index *EsBulkQueryOperationFragment `json:"index,omitempty"` Create *EsBulkQueryOperationFragment `json:"create,omitempty"` }
type EsBulkQueryOperationFragment ¶ added in v0.8.0
type EsBulkResponse ¶ added in v0.6.0
type EsBulkResponse struct { Items []*EsBulkResponseItem `json:"items"` Errors bool }
type EsBulkResponseItem ¶ added in v0.6.0
type EsBulkResponseItem struct { Index *EsIndexDocResponse `json:"index,omitempty"` Create *EsIndexDocResponse `json:"create,omitempty"` }
type EsDeleteResponse ¶ added in v0.6.0
type EsDeleteResponse struct { Took int `json:"took"` TimedOut bool `json:"timed_out"` Total int `json:"total"` Deleted int `json:"deleted"` Batches int `json:"batches"` VersionConflicts int `json:"version_conflicts"` Noops int `json:"noops"` ThrottledMillis int `json:"throttled_millis"` RequestsPerSecond float64 `json:"requests_per_second"` ThrottledUntilMillis int `json:"throttled_until_millis"` Failures []interface{} `json:"failures"` }
type EsDocWithJoin ¶ added in v0.8.0
EsDocWithJoin makes it possible to add a "join" field to the source JSON without having to modify the underlying protobuf message. The "join" field is used as described here: https://www.elastic.co/guide/en/elasticsearch/reference/7.10/parent-join.html. When marshaled to JSON, the "join" field will be merged with the protobuf JSON as a patch.
func (*EsDocWithJoin) MarshalJSON ¶ added in v0.8.0
func (e *EsDocWithJoin) MarshalJSON() ([]byte, error)
type EsGetResponse ¶ added in v0.7.0
type EsGetResponse struct { Id string `json:"_id"` Found bool `json:"found"` Source json.RawMessage `json:"_source"` }
type EsIndexDocError ¶ added in v0.6.0
type EsIndexDocResponse ¶ added in v0.6.0
type EsIndexDocResponse struct { Id string `json:"_id"` Result string `json:"result"` Version int `json:"_version"` Status int `json:"status"` Error *EsIndexDocError `json:"error,omitempty"` }
type EsIndexResponse ¶ added in v0.6.1
type EsIndexResponse struct { Acknowledged bool `json:"acknowledged"` ShardsAcknowledged bool `json:"shards_acknowledged"` Index string `json:"index"` }
response for index creation
type EsMultiGetItem ¶ added in v0.8.2
type EsMultiGetRequest ¶ added in v0.6.1
type EsMultiGetRequest struct { IDs []string `json:"ids,omitempty"` Docs []*EsMultiGetItem `json:"docs,omitempty"` }
type EsMultiGetResponse ¶ added in v0.6.1
type EsMultiGetResponse struct {
Docs []*EsGetResponse `json:"docs"`
}
type EsMultiSearchQueryFragment ¶ added in v0.6.0
type EsMultiSearchResponse ¶ added in v0.6.0
type EsMultiSearchResponse struct {
Responses []*EsMultiSearchResponseHitsSummary `json:"responses"`
}
type EsMultiSearchResponseHit ¶ added in v0.6.0
type EsMultiSearchResponseHit struct {
Source json.RawMessage `json:"_source"`
}
type EsMultiSearchResponseHits ¶ added in v0.6.0
type EsMultiSearchResponseHits struct { Total *EsSearchResponseTotal `json:"total"` Hits []*EsMultiSearchResponseHit `json:"hits"` }
type EsMultiSearchResponseHitsSummary ¶ added in v0.6.0
type EsMultiSearchResponseHitsSummary struct {
Hits *EsMultiSearchResponseHits `json:"hits"`
}
type EsSearch ¶ added in v0.6.0
type EsSearch struct { Query *filtering.Query `json:"query,omitempty"` Sort map[string]EsSortOrder `json:"sort,omitempty"` Collapse *EsSearchCollapse `json:"collapse,omitempty"` Pit *EsSearchPit `json:"pit,omitempty"` Routing string `json:"-"` }
type EsSearchCollapse ¶ added in v0.6.1
type EsSearchCollapse struct {
Field string `json:"field,omitempty"`
}
type EsSearchPit ¶ added in v0.6.1
type EsSearchResponse ¶ added in v0.6.0
type EsSearchResponse struct { Took int `json:"took"` Hits *EsSearchResponseHits `json:"hits"` PitId string `json:"pit_id"` }
type EsSearchResponseHit ¶ added in v0.6.0
type EsSearchResponseHit struct { ID string `json:"_id"` Source json.RawMessage `json:"_source"` Highlights json.RawMessage `json:"highlight"` Sort []interface{} `json:"sort"` }
type EsSearchResponseHits ¶ added in v0.6.0
type EsSearchResponseHits struct { Total *EsSearchResponseTotal `json:"total"` Hits []*EsSearchResponseHit `json:"hits"` }
type EsSearchResponseTotal ¶ added in v0.6.0
type EsSearchResponseTotal struct {
Value int `json:"value"`
}
type EsSortOrder ¶ added in v0.6.0
type EsSortOrder string
const ( EsSortOrderAscending EsSortOrder = "asc" EsSortOrderDescending EsSortOrder = "desc" )
type GetRequest ¶ added in v0.7.0
type MockEsTransport ¶
type MockEsTransport struct { ReceivedHttpRequests []*http.Request PreparedHttpResponses []*http.Response Actions []TransportAction }
type MultiGetRequest ¶ added in v0.6.3
type MultiGetRequest struct { Index string DocumentIds []string Items []*EsMultiGetItem }
type MultiSearchRequest ¶ added in v0.6.3
type SearchPaginationOptions ¶ added in v0.6.3
type SearchRequest ¶ added in v0.6.3
type SearchRequest struct { Index string Search *EsSearch Pagination *SearchPaginationOptions }
type SearchResponse ¶ added in v0.6.3
type SearchResponse struct { Hits *EsSearchResponseHits NextPageToken string }
Click to show internal directories.
Click to hide internal directories.