# Default value of \_routing in mapping definition

**URL:** <https://discuss.elastic.co/t/default-value-of--routing-in-mapping-definition/58891>\
**Category:** Elasticsearch\
**Created:** [August 25, 2016, 6:33am UTC](https://discuss.elastic.co/t/default-value-of--routing-in-mapping-definition/58891 "2016-08-25T06:33:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yoshinori\_Sano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yoshinori_sano/32/11586_2.png) [@Yoshinori\_Sano](https://discuss.elastic.co/u/Yoshinori_Sano)\
**Post date:** [August 25, 2016, 6:33am UTC](https://discuss.elastic.co/t/default-value-of--routing-in-mapping-definition/58891/1 "2016-08-25T06:33:57Z")

</div>

Hi,

I'm new to elasticsearch.  
Go easy on me 🙂

I cannot find info in the doc, so could I post some questions?  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-routing-field.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-routing-field.html)

Say, we have the following mapping definition:

```
$ cat test.json
{
  "mappings": {
    "x": {
      "properties": {
        "x_prop": {
          "type": "text"
        }
      }
    },
    "y": {
      "_parent": {
        "type": "x"
      },
      "properties": {
        "y_prop": {
          "type": "text"
        }
      }
    }
  }
}

```

Note that there is no \_routing description.

And then, we create index:

`$ curl -X PUT http://localhost:9200/test --data-binary @test.json`

Finally, the mapping definition returns like this:

```
$ curl -s http://localhost:9200/test/_mappings?pretty
{
  "test" : {
    "mappings" : {
      "y" : {
        "_parent" : {
          "type" : "x"
        },
        "_routing" : {
          "required" : true
        },
        "properties" : {
          "y_prop" : {
            "type" : "text"
          }
        }
      },
      "x" : {
        "properties" : {
          "x_prop" : {
            "type" : "text"
          }
        }
      }
    }
  }
}

```

Here is my question.

Although I did not specify \_routing, the mapping definition says that \_routing is required.  
Is this default behavior?  
If I don't want to set \_routing is required, should I specify that \_routing is NOT required?

I'm using 5.0.0-alpha4.

I look forward to hearing from you.

---

<div class="post-metadata">

**Author:** ![ywelsch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ywelsch/32/7751_2.png) [@ywelsch](https://discuss.elastic.co/u/ywelsch)\
**Post date:** [August 25, 2016, 7:12am UTC](https://discuss.elastic.co/t/default-value-of--routing-in-mapping-definition/58891/2 "2016-08-25T07:12:17Z")

</div>

Yes, the reason the \_routing is required is because you use `parent-child` relations in your mapping. The details why this requires routing is explained here:

[https://www.elastic.co/guide/en/elasticsearch/guide/current/indexing-parent-child.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/indexing-parent-child.html)

---

<div class="post-metadata">

**Author:** ![Yoshinori\_Sano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yoshinori_sano/32/11586_2.png) [@Yoshinori\_Sano](https://discuss.elastic.co/u/Yoshinori_Sano)\
**Post date:** [August 25, 2016, 7:50am UTC](https://discuss.elastic.co/t/default-value-of--routing-in-mapping-definition/58891/3 "2016-08-25T07:50:40Z")

</div>

Thank you for your quick response! 🙂  
I'll read that document and understand it.

---

<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 5, 2017, 10:25pm UTC](https://discuss.elastic.co/t/default-value-of--routing-in-mapping-definition/58891/4 "2017-07-05T22:25:19Z")

</div>


