# How to set up 'allow\_custom\_routing' for data streams?

**URL:** <https://discuss.elastic.co/t/how-to-set-up-allow-custom-routing-for-data-streams/312544>\
**Category:** Elasticsearch\
**Tags:** datastreams\
**Created:** [August 21, 2022, 11:43am UTC](https://discuss.elastic.co/t/how-to-set-up-allow-custom-routing-for-data-streams/312544 "2022-08-21T11:43:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dkosenko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dkosenko/32/100392_2.png) [@dkosenko](https://discuss.elastic.co/u/dkosenko)\
**Post date:** [August 21, 2022, 11:43am UTC](https://discuss.elastic.co/t/how-to-set-up-allow-custom-routing-for-data-streams/312544/1 "2022-08-21T11:43:29Z")

</div>

Hi,

How do I create a stream with **"allow\_custom\_routing": true**? I cannot find any documention on it.  
I have specified:

```auto
"mappings": {
    "dynamic": "true",
    "_routing": {
      "required": true
    },

```

but it has no effect.  
`GET _index_template/... ` API  
always shows:

```auto
        "data_stream" : {
          "hidden" : false,
          "allow_custom_routing" : false
        }

```

I am re-indexing data\_content index into stream and it says:  
_"type" : "illegal\_argument\_exception",  
"reason" : "index request targeting data stream [dac-test-icube] specifies a custom routing but the [allow\_custom\_routing] setting was not enabled in the data stream's template."_

Thanks!

---

<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:** [September 18, 2022, 11:44am UTC](https://discuss.elastic.co/t/how-to-set-up-allow-custom-routing-for-data-streams/312544/2 "2022-09-18T11:44:27Z")

</div>

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