Default value of _routing in mapping definition

Hi,

I'm new to elasticsearch.
Go easy on me :slight_smile:

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

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.

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

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