Elasticsearch defines all the operations GoFr users need.
| 750 | |
| 751 | // Elasticsearch defines all the operations GoFr users need. |
| 752 | type Elasticsearch interface { |
| 753 | // CreateIndex creates a new index with optional mapping/settings. |
| 754 | CreateIndex(ctx context.Context, index string, settings map[string]any) error |
| 755 | |
| 756 | // DeleteIndex deletes an existing index. |
| 757 | DeleteIndex(ctx context.Context, index string) error |
| 758 | |
| 759 | // IndexDocument indexes (creates or replaces) a single document. |
| 760 | IndexDocument(ctx context.Context, index, id string, document any) error |
| 761 | |
| 762 | // GetDocument retrieves a single document by ID. |
| 763 | // Returns the raw JSON as a map. |
| 764 | GetDocument(ctx context.Context, index, id string) (map[string]any, error) |
| 765 | |
| 766 | // UpdateDocument applies a partial update to an existing document. |
| 767 | UpdateDocument(ctx context.Context, index, id string, update map[string]any) error |
| 768 | |
| 769 | // DeleteDocument removes a document by ID. |
| 770 | DeleteDocument(ctx context.Context, index, id string) error |
| 771 | |
| 772 | // Bulk executes multiple indexing/updating/deleting operations in one request. |
| 773 | // Each entry in `operations` should be a JSON‑serializable object |
| 774 | // following the Elasticsearch bulk API format. |
| 775 | Bulk(ctx context.Context, operations []map[string]any) (map[string]any, error) |
| 776 | |
| 777 | // Search executes a query against one or more indices. |
| 778 | // Returns the entire response JSON as a map. |
| 779 | Search(ctx context.Context, indices []string, query map[string]any) (map[string]any, error) |
| 780 | |
| 781 | HealthChecker |
| 782 | } |
| 783 | |
| 784 | // ElasticsearchProvider an interface that extends Elasticsearch with additional methods for logging, metrics, and connection management. |
| 785 | // |
nothing calls this directly
no outgoing calls
no test coverage detected