Index & Template APIs

Index & Template APIs

Index APIs manage indexes, templates, mappings, and aliases. Use them to inspect how Logit.io and your integrations (for example Filebeat) structure log data, or to create custom indexes for direct API ingestion.

Connection details: Connect to Your Cluster.

Full specification: OpenSearch Index APIs (opens in a new tab).

Common endpoints

MethodPathPurpose
PUT/{index}Create an index (with optional settings/mappings)
DELETE/{index}Delete an index
GET/_cat/indices?vList indexes (see also Cluster & CAT APIs)
GET/{index}/_mappingGet field mappings for an index
GET/_index_templateList composable index templates
GET/_index_template/{name}Get a specific composable template
GET/_templateList legacy index templates
GET/_template/{name}Get a legacy template
GET/_aliasList aliases
POST/_aliasesAdd or remove aliases atomically

Logit.io stacks may have both composable (/_index_template) and legacy (/_template) templates depending on version and integrations.

List index templates

curl -X GET "@opensearch.endpointAddress:443/_index_template?pretty" \
  -u "@opensearch.username:@opensearch.password"

Filter by pattern (legacy):

curl -X GET "@opensearch.endpointAddress:443/_template/filebeat-*?apikey=@opensearch.apiKey&pretty"

See also Index templates for the OpenSearch Dashboards Dev Tools workflow.

Get mappings for an index

curl -X GET "@opensearch.endpointAddress:443/filebeat-*/_mapping?pretty" \
  -u "@opensearch.username:@opensearch.password"

Mapping concepts: Mapping overview.

Create a custom index

curl -X PUT "@opensearch.endpointAddress:443/my-custom-logs" \
  -u "@opensearch.username:@opensearch.password" \
  -H "Content-Type: application/json" \
  -d '{
    "settings": {
      "number_of_shards": 1,
      "number_of_replicas": 0
    },
    "mappings": {
      "properties": {
        "@timestamp": {"type": "date"},
        "message": {"type": "text"},
        "level": {"type": "keyword"}
      }
    }
  }'

Shard and replica counts may be adjusted by platform defaults on hosted stacks. If creation fails, contact support.

Manage aliases

Add an alias pointing at an index:

curl -X POST "@opensearch.endpointAddress:443/_aliases" \
  -u "@opensearch.username:@opensearch.password" \
  -H "Content-Type: application/json" \
  -d '{
    "actions": [
      {"add": {"index": "filebeat-2026.06.11", "alias": "logs-today"}}
    ]
  }'

Aliases are useful for reindexing with zero-downtime index swaps.

Delete an index

⚠️

Deleting an index permanently removes all documents in it.

curl -X DELETE "@opensearch.endpointAddress:443/my-custom-logs" \
  -u "@opensearch.username:@opensearch.password"

Further reading