# Routing in search operation

**URL:** <https://discuss.elastic.co/t/routing-in-search-operation/125103>\
**Category:** Elasticsearch\
**Tags:** rally\
**Created:** [March 22, 2018, 4:16am UTC](https://discuss.elastic.co/t/routing-in-search-operation/125103 "2018-03-22T04:16:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phuong\_Hoang](https://avatars.discourse-cdn.com/v4/letter/p/848f3c/32.png) [@Phuong\_Hoang](https://discuss.elastic.co/u/Phuong_Hoang)\
**Post date:** [March 22, 2018, 4:16am UTC](https://discuss.elastic.co/t/routing-in-search-operation/125103/1 "2018-03-22T04:16:56Z")

</div>

In my case, each `user` has \_routing equal to `group_id`

For search operation, I have a custom parameter sources that randomizes the `group_id` in the search body, how could I add the `_routing` which is equal to `group_id` in the search operation

---

<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:** [March 22, 2018, 10:48am UTC](https://discuss.elastic.co/t/routing-in-search-operation/125103/2 "2018-03-22T10:48:54Z")

</div>

As far as I can tell this is unfortunately currently not supported. Enhancing the search runner to support this does however sound like a good idea. I would recommend opening an issue for this enhancement on [the Rally GitHub repository](https://github.com/elastic/rally).

If you need this functionality before, you should be able to implement this through a custom Runner.

---

<div class="post-metadata">

**Author:** ![Phuong\_Hoang](https://avatars.discourse-cdn.com/v4/letter/p/848f3c/32.png) [@Phuong\_Hoang](https://discuss.elastic.co/u/Phuong_Hoang)\
**Post date:** [March 22, 2018, 5:45pm UTC](https://discuss.elastic.co/t/routing-in-search-operation/125103/3 "2018-03-22T17:45:04Z")

</div>

I saw in the custom parameter source we return `params`

```auto
{
  "body": {
     ...
  }
}

```

Could we include request-params like

```auto
{
  "body": {
     ...
  },
  "request-params": {
    "routing": "some_routing"
  }
}

```

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [April 3, 2018, 9:00am UTC](https://discuss.elastic.co/t/routing-in-search-operation/125103/4 "2018-04-03T09:00:02Z")

</div>

According to the documentation of the Elasticsearch Python client, the [search operation takes a routing parameter](http://elasticsearch-py.readthedocs.io/en/master/api.html?highlight=routing#elasticsearch.Elasticsearch.search), so this should be possible. Please do note however, that the Rally-_internal_ name of the key (between parameter source and runner) is called `request_params` (i.e. with an underscore, not with a hyphen) so in your parameter source you need to name the key differently.

---

<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:** [May 1, 2018, 9:00am UTC](https://discuss.elastic.co/t/routing-in-search-operation/125103/5 "2018-05-01T09:00:10Z")

</div>

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