What is the simplest way to upload a custom metric?

I want to upload a custom metric to Elastic Cloud. Every 30 seconds a script will run, call an API, download a zip file, extract it, turn it into JSON, and send it to Elastic Cloud so I can monitor it on a dashboard.

What is the simplest way to do this please? The Elastic Observability docs seem to have only info on existing Integrations, not on how to send your own data to Elastic Cloud.

GPT recommends MetricBeat, which I have to write a custom Go module for, or calling the Elasticsearch API directly. I can't find good documentation or a how-to guide for either. Please advise.

Removed #elastic-cloud

The easiest way I found is to call the Elasticsearch API directly.

Create an index, where the key is your encoded field from your API key:

export elasticKey="WGdLQ=="
export elasticUrl="https://c301.us-central1.gcp.cloud.es.io:443"
curl -X PUT "${elasticUrl}/falogins" -H "Authorization: ApiKey ${elasticKey}" -H "Content-Type: application/json" -d'
{
  "mappings": {
    "properties": {
      "timestamp": { "type": "date" },
      "value": { "type": "text" }
    }
  }
}'

# Result:
# {"acknowledged":true,"shards_acknowledged":true,"index":"logins"}

Upload a value

curl -X POST "${elasticUrl}/falogins/_doc" -H "Authorization: ApiKey ${elasticKey}" -H "Content-Type: application/json" -d '{  "timestamp": 1721193965740,  "value": "bob" }'