# Calls to \_aliases very slow

**URL:** <https://discuss.elastic.co/t/calls-to--aliases-very-slow/9015>\
**Category:** Elasticsearch\
**Created:** [September 13, 2012, 5:53pm UTC](https://discuss.elastic.co/t/calls-to--aliases-very-slow/9015 "2012-09-13T17:53:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bryan\_Brunetti](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bryan_brunetti/32/2724_2.png) [@Bryan\_Brunetti](https://discuss.elastic.co/u/Bryan_Brunetti)\
**Post date:** [September 13, 2012, 5:53pm UTC](https://discuss.elastic.co/t/calls-to--aliases-very-slow/9015/1 "2012-09-13T17:53:33Z")

</div>

Anyone have an idea on why calls to /\_aliases would be slow while most  
other calls are fast?

Each call takes around ~2s wether it's a single add action:

curl -XPOST '[http://elastic.server:9200/\_aliases?'](http://elastic.server:9200/_aliases?') -d  
'{"actions":[{"add":{"index":"index\_name","alias":"alias\_name","routing":123,"filter":{"term":{"site\_id":123}}}}]}'

or multiple actions:

curl -XPOST '[http://elastic.server:9200/\_aliases?'](http://elastic.server:9200/_aliases?') -d '  
{  
"actions" : [

{"add":{"index":"index\_one","alias":"index\_alias\_one","routing":1,"filter":{"term":{"site\_id":1}}}},

{"add":{"index":"index\_two","alias":"index\_alias\_two","routing":1,"filter":{"term":{"site\_id":0}}}},

{"add":{"index":"index\_three","alias":"index\_alias\_three","routing":1,"filter":{"term":{"site\_id":1}}}}  
]  
}'

--

---

<div class="post-metadata">

**Author:** ![Klaus\_Brunner](https://avatars.discourse-cdn.com/v4/letter/k/9fc29f/32.png) [@Klaus\_Brunner](https://discuss.elastic.co/u/Klaus_Brunner)\
**Post date:** [October 17, 2012, 7:30am UTC](https://discuss.elastic.co/t/calls-to--aliases-very-slow/9015/2 "2012-10-17T07:30:26Z")

</div>

On Thursday, 13 September 2012 19:53:33 UTC+2, Bryan Brunetti wrote:

> Anyone have an idea on why calls to /\_aliases would be slow while most  
> other calls are fast?

I'm seeing the same behaviour, with all alias-updating calls taking ~10  
seconds. This is on a single-node cluster (OpenJDK 1.7.0\_07) and ES 0.19.7.  
It doesn't seem to happen on all machines I've tested, though. I initially  
suspected something to do with replicas, but those are set to 0. Health is  
reported as OK, no unassigned\_shards or similar.

Did you get any further with this?

Klaus

--

---

<div class="post-metadata">

**Author:** ![Klaus\_Brunner](https://avatars.discourse-cdn.com/v4/letter/k/9fc29f/32.png) [@Klaus\_Brunner](https://discuss.elastic.co/u/Klaus_Brunner)\
**Post date:** [October 18, 2012, 2:08pm UTC](https://discuss.elastic.co/t/calls-to--aliases-very-slow/9015/3 "2012-10-18T14:08:22Z")

</div>

On Wednesday, 17 October 2012 09:30:26 UTC+2, Klaus Brunner wrote:

> I'm seeing the same behaviour, with all alias-updating calls taking ~10  
> seconds. This is on a single-node cluster (OpenJDK 1.7.0\_07) and ES 0.19.7.  
> It doesn't seem to happen on all machines I've tested, though. I initially  
> suspected something to do with replicas, but those are set to 0. Health is  
> reported as OK, no unassigned\_shards or similar.

Okay, I've finally narrowed it down to alias requests of this form, where  
there's a matching remove and add:

POST [http://localhost:9200/\_aliases](http://localhost:9200/_aliases)  
{  
"actions" : [  
{ "remove" : { "index" : "foo", "alias" : "bla" } },  
{ "add" : { "index" : "foo", "alias" : "bla" } }  
]  
}

That's admittedly a bit of a pathological case, but if anything, I'd expect  
an error, not a long delay.

Klaus

--

---

<div class="post-metadata">

**Author:** ![Rafal\_Kuc\_3](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rafal_kuc_3/32/799_2.png) [@Rafal\_Kuc\_3](https://discuss.elastic.co/u/Rafal_Kuc_3)\
**Post date:** [October 18, 2012, 2:11pm UTC](https://discuss.elastic.co/t/calls-to--aliases-very-slow/9015/4 "2012-10-18T14:11:45Z")

</div>

Hello!

I don't think we should see error in such case. You've sent a proper request, however it seems that it took a bit longer for ES to add and than remove the same alias.

_--_

Regards,

Rafał Kuć

Sematext :: [http://sematext.com/](http://sematext.com/) _:: Solr - Lucene - Nutch - ElasticSearch_

On Wednesday, 17 October 2012 09:30:26 UTC+2, Klaus Brunner wrote:

I'm seeing the same behaviour, with all alias-updating calls taking ~10 seconds. This is on a single-node cluster (OpenJDK 1.7.0\_07) and ES 0.19.7. It doesn't seem to happen on all machines I've tested, though. I initially suspected something to do with replicas, but those are set to 0. Health is reported as OK, no unassigned\_shards or similar.

Okay, I've finally narrowed it down to alias requests of this form, where there's a matching remove and add:

POST [http://localhost:9200/\_aliases](http://localhost:9200/_aliases)

{

```
"actions" : [

    { "remove" : { "index" : "foo", "alias" : "bla" } },

    { "add" : { "index" : "foo", "alias" : "bla" } }

]

```

}

That's admittedly a bit of a pathological case, but if anything, I'd expect an error, not a long delay.

Klaus

--

---

<div class="post-metadata">

**Author:** ![Klaus\_Brunner](https://avatars.discourse-cdn.com/v4/letter/k/9fc29f/32.png) [@Klaus\_Brunner](https://discuss.elastic.co/u/Klaus_Brunner)\
**Post date:** [October 19, 2012, 6:54am UTC](https://discuss.elastic.co/t/calls-to--aliases-very-slow/9015/5 "2012-10-19T06:54:22Z")

</div>

On Thursday, 18 October 2012 16:11:59 UTC+2, Rafał Kuć wrote:

> Hello!
> 
> I don't think we should see error in such case. You've sent a proper  
> request, however it seems that it took a bit longer for ES to add and than  
> remove the same alias.

That's okay, but a delay of 10 seconds is quite problematic (and I'm now  
able to reproduce this on all machines, every time). I guess it runs into  
some kind of silly loop.

Klaus

--

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [October 21, 2012, 12:43am UTC](https://discuss.elastic.co/t/calls-to--aliases-very-slow/9015/6 "2012-10-21T00:43:35Z")

</div>

I tried to recreate it, and the only time it happens (it waits for 10s, which is the timeout it waits to get validation that it actually been applied across the cluster) is when you the alias actions end up not actually changing anything, like removing and adding an alias that already exists (resulting in actual 0 change in aliases). Here is the issue: [Aliases API times out when actions end up with no actual change to aliases · Issue #2345 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/2345), should be fixed shortly.

On Oct 19, 2012, at 8:54 AM, Klaus Brunner [klaus.brunner@gmail.com](mailto:klaus.brunner@gmail.com) wrote:

> On Thursday, 18 October 2012 16:11:59 UTC+2, Rafał Kuć wrote:  
> Hello!
> 
> I don't think we should see error in such case. You've sent a proper request, however it seems that it took a bit longer for ES to add and than remove the same alias.
> 
> That's okay, but a delay of 10 seconds is quite problematic (and I'm now able to reproduce this on all machines, every time). I guess it runs into some kind of silly loop.
> 
> Klaus
> 
> --

--

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:07am UTC](https://discuss.elastic.co/t/calls-to--aliases-very-slow/9015/7 "2017-07-06T03:07:47Z")

</div>


