Inserting using alias

Can I use alias to insert document assuming that alias is mapped to only one index?

Hi @Pradeep_Gowda,

Let's try it out:

PUT /testindex

POST /_aliases
{
    "actions": [
       {
          "add": {
             "index": "testindex",
             "alias": "testalias"
          }
       }
    ]
}

POST /testindex/mytype
{
    "name": "Bart"
}

POST /testalias/mytype
{
    "name": "Lisa"
}

The last statement returns:

{
   "_index": "testindex",
   "_type": "mytype",
   "_id": "AVTiPdo8LXFccQXiKN6n",
   "_version": 1,
   "_shards": {
      "total": 2,
      "successful": 1,
      "failed": 0
   },
   "created": true
}

So this is indeed possible.

Daniel