Skip to content

Commit 24e0140

Browse files
committed
better comment the elaticsearch api endpoint
1 parent 3d8aaf8 commit 24e0140

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

internal/notif/elasticsearch/client.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,15 @@ func (c *Client) Send(entry model.NotifEntry) error {
8282
return err
8383
}
8484

85-
// Create Elasticsearch URL
85+
// Build the Elasticsearch indexing URL
86+
// This uses the Index API (POST /{index}/_doc) to create a document with an auto-generated _id:
87+
// https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-create
8688
url := fmt.Sprintf("%s://%s:%d/%s/_doc", c.cfg.Scheme, c.cfg.Host, c.cfg.Port, c.cfg.Index)
8789

8890
cancelCtx, cancel := context.WithCancelCause(context.Background())
8991
timeoutCtx, _ := context.WithTimeoutCause(cancelCtx, *c.cfg.Timeout, errors.WithStack(context.DeadlineExceeded)) //nolint:govet // no need to manually cancel this context as we already rely on parent
9092
defer func() { cancel(errors.WithStack(context.Canceled)) }()
91-
93+
9294
hc := http.Client{
9395
Transport: &http.Transport{
9496
TLSClientConfig: &tls.Config{

0 commit comments

Comments
 (0)