I have tried
Index Aliases | Elasticsearch Reference [2.0] | Elastic[
^], but what if i need to create alias at time when documents are added into index based on values passed to insert. here in my case that value is customer type, so i want to create an alias which will be added into index based on value passed on Customer Type, If value is different, It should create a new alias other wise won't, can any one has idea about it?
What I have tried:
index name=customeinfo
index type=Customer
Index Mapping
{
"customeinfo": {
"mappings": {
"Customer": {
"properties": {
"Id": {
"type": "long"
},
"Name": {
"type": "string"
},
"Type": {
"type": "string"
},
"type": {
"type": "string"
}
}
}
},
"settings": {
"index": {
"creation_date": "1526625709246",
"number_of_shards": "1",
"number_of_replicas": "1",
"uuid": "uEbfvBvTRK-AGzBaQWqu-Q",
"version": {
"created": "2030399"
}
}
},
"warmers": {}
}
}
when a new document is added in Elastic index like
{
"Id": 1,
"Name": "Alice",
"type": "premium"
}
then a new alias should be added and my index would become like
{
"customeralias": {
"aliases": {
"premiumcustomeralias": {
"filter": {
"term": {
"type": "premium"
}
}
}
},
"mappings": {},
"settings": {},
"warmers": {}
}
}
again a new document is added in Elastic index like
{
"Id": 2,
"Name": "Bob",
"type": "basic"
}
then again a new alias should be added and my index and index would become like
{
"customeralias": {
"aliases": {
"premiumcustomeralias": {
"filter": {
"term": {
"type": "premium"
}
}
},
"basiccustomeralias": {
"filter": {
"term": {
"type": "basic"
}
}
}
},
"mappings": {},
"settings": {},
"warmers": {}
}
}