Skip to content

Instantly share code, notes, and snippets.

@jakelandis
Last active April 10, 2020 01:23
Show Gist options
  • Save jakelandis/16deef3b9f9f9aae3dbd94e9e8f804bd to your computer and use it in GitHub Desktop.
Save jakelandis/16deef3b9f9f9aae3dbd94e9e8f804bd to your computer and use it in GitHub Desktop.
PUT _component_template/base
{
"template": {
"settings": {
"index": {
"number_of_shards": 1,
"number_of_replicas": 3
}
}
}
}
PUT _component_template/with_time
{
"template":{
"settings":{
"index":{
"sort.field":"date",
"sort.order":"desc"
}
},
"mappings":{
"properties":{
"date":{
"type":"date",
"format":"yyyy-MM-dd"
}
}
}
}
}
PUT _index_template/myindex
{
"index_patterns": [
"myindex*"
],
"composed_of": [
"base",
"with_time"
]
}
PUT myindex
GET myindex
@jakelandis
Copy link
Author

results

# PUT _component_template/base
{
  "acknowledged" : true
}

# PUT _component_template/with_time
{
  "acknowledged" : true
}

# PUT _index_template/myindex
{
  "acknowledged" : true
}

# PUT myindex
{
  "acknowledged" : true,
  "shards_acknowledged" : true,
  "index" : "myindex"
}

# GET myindex
{
  "myindex" : {
    "aliases" : { },
    "mappings" : {
      "properties" : {
        "date" : {
          "type" : "date",
          "format" : "yyyy-MM-dd"
        }
      }
    },
    "settings" : {
      "index" : {
        "number_of_shards" : "1",
        "provided_name" : "myindex",
        "creation_date" : "1586481768318",
        "sort" : {
          "field" : "date",
          "order" : "desc"
        },
        "number_of_replicas" : "3",
        "uuid" : "lvRDQ9y5Th-0zCH6yjEMZg",
        "version" : {
          "created" : "7080099"
        }
      }
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment