title: elasticsearch: how to define mapping with nested fields?
body: <p>I am going to define mapping with nested fields. according to this <a href="https://www.elastic.co/guide/en/elasticsearch/guide/current/nested-mapping.html" rel="nofollow noreferrer">documentation</a>, payload to <code>/order-statistics/_mapping/order</code> looks like:</p>
  
  <pre><code>{
    "mappings" : {
    "order": {
      "properties" : {
        "order_no" : {
          "type" : "string"
        },
        "order_products" : {
          "type" : "nested",
          "properties" : {
            "order_product_no" : {
              "type" : "int"
            },
            "order_product_options" : {
              "type" : "nested",
              "properties" : {
                "order_product_option_no" : {
                  "type" : "int"
                }
              }
            }
          }
        }
      }
    }
    }
  }
  </code></pre>
  
  <p>I've already created the <code>order-statistics</code> index with a call to <code>curl -XPUT 'localhost:9200/order-statistics'</code> and I'm using predefined types such as <code>int</code>, <code>string</code>, <code>double</code>, But I get the following error and can't find what wrong with. </p>
  
  <pre><code>{  
      "error":{  
          "root_cause":[  
              {  
                  "type":"mapper_parsing_exception",
                  "reason":"Root mapping definition has unsupported parameters:  [mappings : {order={properties={order_no={type=string}, order_products={type=nested, properties={order_product_no={type=int}, order_product_options={type=nested, properties={order_product_option_no={type=int}}}}}}}}]"
              }
          ],
          "type":"mapper_parsing_exception",
          "reason":"Root mapping definition has unsupported parameters:  [mappings : {order={properties={order_no={type=string}, order_products={type=nested, properties={order_product_no={type=int}, order_product_options={type=nested, properties={order_product_option_no={type=int}}}}}}}}]"
      },
      "status":400
  }
  </code></pre>
  
  <p>could someone explain why this not work?</p>