Skip to content

Indices

Anton edited this page Jan 6, 2020 · 2 revisions

Indices are "databases" in ElasticSearch that store data for a particular period. Each index will have a number of shards and replicas, while each shard will consume more memory. Therefore, for smaller indices (<1m records), 1 shard with 0 replicas are enough.

Logarithm supports some operations on indices.

Delete

An index (or wildcard indices) can be deleted using the -i {index-pattern-*} -d command:

user:~$ logarithm es.local:9200 -i clients-2019.2 -d
user:~$ logarithm es.local:9200 -i clients-* -d
Are you sure you want to delete index clients-2019.2 (y/n): [n] y
Successfully deleted index clients-2019.2

Assign Template

A template can be created for an index pattern from a JSON file, e.g., -i {index-pattern-*} -t index.template.json. The structure will be read from this file, that can be the following:

{
  "mappings": {
    "properties": {
      "billed": { "type": "keyword" },
      "date": { "type": "date" }
    }
  }
}

The name of the template will be deducted from the filename, e.g., usage.template.json -> usage.template, and the index pattern will be set to the value of the -i argument.

Clone this wiki locally