# 504 Error due to large number of routing parameters

**URL:** <https://discuss.elastic.co/t/504-error-due-to-large-number-of-routing-parameters/250742>\
**Category:** Elasticsearch\
**Created:** [October 1, 2020, 8:56pm UTC](https://discuss.elastic.co/t/504-error-due-to-large-number-of-routing-parameters/250742 "2020-10-01T20:56:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![prosens](https://avatars.discourse-cdn.com/v4/letter/p/c57346/32.png) [@prosens](https://discuss.elastic.co/u/prosens)\
**Post date:** [October 1, 2020, 8:56pm UTC](https://discuss.elastic.co/t/504-error-due-to-large-number-of-routing-parameters/250742/1 "2020-10-01T20:56:13Z")

</div>

We have a large number of shards. The documents are routed using user ids. There are use cases where we need to search across multiple users. When we specify a large number of user ids as the routing parameter, we see a 504 error. I think this is because it is going beyond the limit of max URL length. Is there a way we can specify the routing parameter in the request body instead of the URL?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [October 1, 2020, 9:00pm UTC](https://discuss.elastic.co/t/504-error-due-to-large-number-of-routing-parameters/250742/2 "2020-10-01T21:00:53Z")

</div>

If you are specifying a lot of routing parameters you may be fine querying all shards without routing as you will be hitting a lot of shards anyway. Can you try this?

---

<div class="post-metadata">

**Author:** ![prosens](https://avatars.discourse-cdn.com/v4/letter/p/c57346/32.png) [@prosens](https://discuss.elastic.co/u/prosens)\
**Post date:** [October 1, 2020, 9:42pm UTC](https://discuss.elastic.co/t/504-error-due-to-large-number-of-routing-parameters/250742/3 "2020-10-01T21:42:50Z")

</div>

That works. But the query takes a longer time as it is hitting a very large number of shards(500). With the routing parameters, it is still limited to 40-50 shards only. So, it would be good if there is a way to pass this as a request body.

---

<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:** [October 29, 2020, 9:43pm UTC](https://discuss.elastic.co/t/504-error-due-to-large-number-of-routing-parameters/250742/4 "2020-10-29T21:43:07Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
