Documentation ¶
Overview ¶
Package elasticsearchCRUD provides APIs for storing and retrieving objects from Elasticsearch and searching among those objects.
Index ¶
- func ArrayOfRefsAsJSON(refs []*firestore.DocumentRef) string
- func Create(client *elasticsearch.Client, i common.Queryable, collectionName string) error
- func Delete(client *elasticsearch.Client, firestoreID string, collectionName string) error
- func GetClient() (*elasticsearch.Client, error)
- func PrintResponseError(res *esapi.Response)
- func Read(client *elasticsearch.Client, firestoreID string, collectionName string) (commonObject interface{}, docID string, err error)
- func Update(client *elasticsearch.Client, i common.Queryable, collectionName string) error
- type ESIter
- type Query
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrayOfRefsAsJSON ¶
func ArrayOfRefsAsJSON(refs []*firestore.DocumentRef) string
ArrayOfRefsAsJSON converts and array of DocumentRefs into something which can be indexed in elasticsearch
func Create ¶
Create creates a new Queryable document from the given collectionName. A query is performed to ensure duplicate FirestoreIDs are not being entered.
func Delete ¶
Delete will deleteByQuery any provided FirestoreID via a query. If no document is found an error is NOT thrown.
func GetClient ¶
func GetClient() (*elasticsearch.Client, error)
GetClient gets a client. User Role documentation (since apparently there's nowhere else to put this?) apm_system Role to enable the Health Check test to run. monitoring_user because we may wish to monitor our cluster at runtime. Web_Server gives it access to the indices for this app and a test index, /test.
func PrintResponseError ¶
PrintResponseError prints out some error information from a es response Call this if res.IsError()
func Read ¶
func Read(client *elasticsearch.Client, firestoreID string, collectionName string) (commonObject interface{}, docID string, err error)
Read a document from the given collectionName. A query is performed to do this.
Types ¶
type ESIter ¶
type ESIter struct {
// contains filtered or unexported fields
}
ESIter implements the common.Iter interface.
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
func (*Query) AddArrayContains ¶
AddArrayContains is unimplemented.
func (*Query) AddEquals ¶
AddEquals searches for any field name 'k' which includes all of the input values.
func (*Query) Init ¶
Init this query. This should be called first. collectionID parameter is optional & SHOULD be used for collection Data.
func (*Query) QueryRead ¶
QueryRead performs the created query and returns results. This is a Term query. Because Firestore already gives us (better) access to regular Querying, the QueryRead() function here tries fuzzy matching.
While iterating through the results I highly recommend casting each result to the appropriate struct, like *common.Data.