elasticsearch/request.go

71 lines
2.0 KiB
Go
Raw Permalink Normal View History

2022-03-19 04:59:43 +00:00
package elasticsearch
// Request ...
type Request struct {
}
// ProductSearch ...
2022-03-19 06:33:06 +00:00
func (Request) ProductSearch(query ESQuery) (*Response, error) {
2022-03-19 06:12:59 +00:00
return requestNats(SubjectRequestProductSearch, toBytes(query))
2022-03-19 04:59:43 +00:00
}
// ProductUpsert ...
2022-03-21 02:19:46 +00:00
func (Request) ProductUpsert(payload Payload) (*Response, error) {
return requestNats(SubjectRequestProductUpsert, toBytes(payload))
2022-03-19 04:59:43 +00:00
}
2022-03-30 12:46:42 +00:00
// ProductCreateIndex ...
func (Request) ProductCreateIndex() (*Response, error) {
return requestNats(SubjectRequestProductCreateIndex, toBytes(Payload{}))
}
2022-03-19 04:59:43 +00:00
// UserSearch ...
2022-03-19 06:33:06 +00:00
func (Request) UserSearch(query ESQuery) (*Response, error) {
2022-03-19 06:12:59 +00:00
return requestNats(SubjectRequestUserSearch, toBytes(query))
2022-03-19 04:59:43 +00:00
}
// UserUpsert ...
2022-03-21 02:19:46 +00:00
func (Request) UserUpsert(payload Payload) (*Response, error) {
return requestNats(SubjectRequestUserUpsert, toBytes(payload))
2022-03-19 04:59:43 +00:00
}
2022-03-30 12:46:42 +00:00
// UserCreateIndex ...
func (Request) UserCreateIndex() (*Response, error) {
return requestNats(SubjectRequestUserCreateIndex, toBytes(Payload{}))
}
2022-03-19 04:59:43 +00:00
// OrderSearch ...
2022-03-19 06:33:06 +00:00
func (Request) OrderSearch(query ESQuery) (*Response, error) {
2022-03-19 06:12:59 +00:00
return requestNats(SubjectRequestOrderSearch, toBytes(query))
2022-03-19 04:59:43 +00:00
}
// OrderUpsert ...
2022-03-21 02:19:46 +00:00
func (Request) OrderUpsert(payload Payload) (*Response, error) {
return requestNats(SubjectRequestOrderUpsert, toBytes(payload))
2022-03-19 04:59:43 +00:00
}
2022-03-24 03:26:23 +00:00
2022-03-30 12:46:42 +00:00
// OrderCreateIndex ...
func (Request) OrderCreateIndex() (*Response, error) {
return requestNats(SubjectRequestOrderCreateIndex, toBytes(Payload{}))
}
2022-03-24 03:26:23 +00:00
// KeywordSearch ...
func (Request) KeywordSearch(query ESQuery) (*Response, error) {
return requestNats(SubjectRequestKeywordSearch, toBytes(query))
}
// KeywordUpsert ...
func (Request) KeywordUpsert(payload Payload) (*Response, error) {
return requestNats(SubjectRequestKeywordUpsert, toBytes(payload))
}
2022-03-25 02:59:45 +00:00
2022-03-30 12:46:42 +00:00
// KeywordCreateIndex ...
func (Request) KeywordCreateIndex() (*Response, error) {
return requestNats(SubjectRequestKeywordCreateIndex, toBytes(Payload{}))
2022-03-25 02:59:45 +00:00
}
2022-04-01 03:15:11 +00:00
// DeleteMultipleIndex ...
func (Request) DeleteMultipleIndex(indexes []string) (*Response, error) {
return requestNats(SubjectRequestDeleteMultipleIndex, toBytes(indexes))
}