I am a rookie to the ElasticSearch, and just tried to create a template with the following command. PUT https://myip:myport/_template/templatetest
{
"index_patterns": ["templatetest-*"],
"order": 999,
"settings": {
"refresh_interval":"300s",
"number_of_shards":6,
"number_of_replicas":2
},
"mappings": {
"properties": {
"ActionName": {"type":"text"}
}
},
"aliases": {
"templatetest_all" : {}
}
}
After this, I tried to query the alias with below command, but failed. GET https://myip:myport/_alias/templatetest_all
My question is that if there is anything wrong with my create request or query request.
Thanks.
The _template (legacy) is the old one. I recommend using _index_template.
create an _index_template
PUT _index_template/test_template
{
"index_patterns": ["templatetest-*"],
"order": 999,
"settings": {
"refresh_interval":"300s",
"number_of_shards":6,
"number_of_replicas":2
},
"mappings": {
"properties": {
"ActionName": {"type":"text"}
}
},
"aliases": {
"templatetest_all" : {}
}
}
Create indices
PUT templatetest-001
PUT templatetest-002
Check your indices with an alias
GET _cat/indices/templatetest_all?v
You can also search your data with alias
GET templatetest_all/_search
Some recommendations: