I’m new to ISM, and wondering how do use ISM to create the initial index using an ISM policy.
Note I cannot create the index manually, since we are creating different index groups on the fly.
My goal is that when I write in my backend code that uses the alias for writing, the initial backing index will be created automatically. But I can’t get it to work.
This is the backend code:
client.index({
index: 'my_alias',
body: {
prop: 'joe'
})
I created the following policy and index template:
{
"policy": {
"default_state": "open",
"ism_template": {
"index_patterns": ["ppp*"],
"priority": 100
},
"states": [ {
"name": "open"
}]
}
}
PUT _template/ppp_template
{
"index_patterns": [ "ppp*"],
"aliases": {
"my_alias": {
}
}
}
But when I try to index a document to my_alias
I get the following error:
{
“error” : {
“root_cause” : [
{
“type” : “illegal_state_exception”,
“reason” : “index, alias, and data stream names need to be unique, but the following duplicates were found [pppx (alias of [pppx/StEAdDnHRButkRXs-otvqA]) conflicts with index]”
}
],
“type” : “illegal_state_exception”,
“reason” : “index, alias, and data stream names need to be unique, but the following duplicates were found [pppx (alias of [pppx/StEAdDnHRButkRXs-otvqA]) conflicts with index]”
},
“status” : 500
}
What am I doing wrong?