GET _cat/indices
Create the template:
PUT _index_template/blogposts
{
"index_patterns": ["post-*"],
"template": {
"settings": {
"number_of_shards": 1
},
"mappings": {
"_source": {
"enabled": true
},
"properties": {
"name": { "type": "text" },
"age": { "type": "integer" }
}
},
"aliases": {
"mydata": { }
}
}
}
Added documents for month 08
POST post-2020-08/_doc/1
{
"name": "Marcelo",
"age": 31
}
POST post-2020-08/_doc/2
{
"name": "Marcelo2",
"age": 31
}
POST post-2020-08/_doc/3
{
"name": "Marcelo3",
"age": 31
}
Added documents for month 09
POST post-2020-09/_doc/4
{
"name": "Marcelo4",
"age": 31
}
POST post-2020-09/_doc/5
{
"name": "Marcelo5",
"age": 31
}
Searh on multiples indexes using wilcard
GET post-2020-*/_search
{
"query": {
"match_all": {}
}
}