title: Nest and elastic search- update mapping for nested object?
body: <p>I am trying to add a new property to an existing nested document. My document looks like:</p>
  
  <pre><code>"mappings": {
    "test": {
      "_routing": {
        "required": true,
        "path": "tId"
      },
      "properties": {
  
        "series": {
          "type": "nested",
          "properties": {
  
            "iType": {
              "type": "string",
              "index": "not_analyzed",
              "doc_values": true
            },
            "isValid": {
              "type": "boolean"
            },
  
          },
        },
      }
    }
  </code></pre>
  
  <p>The property i want to insert to nested document "series" is "iType". 
  How can i use the NEST <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html#indices-put-mapping" rel="nofollow">put mapping</a> API to update the existing mapping?</p>
  
  <p>Any help will be appreciated.</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>#####*****UPDATED*****##########</strong></p>
  
  <p>i would need to update the mapping for nested element with attributes :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>"iType": {
    "type": "string",
    "fields": {
      "raw": {
        "type": "string",
        "index": "not_analyzed",
        "doc_values": true,
        "fielddata": {
          "loading": "eager_global_ordinals"
        }
      }
    }
  },</code></pre>
  </div>
  </div>
  </p>
  
  <p>How can i do this with NEST ?</p>
  
  <p>My query looks like:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var response2 = elasticClient.Map &lt; Test &gt; (e =&gt; e
    .Properties(props =&gt; props
      .NestedObject &lt; series &gt; (s =&gt; s
        .Properties(sprops =&gt; sprops
          .String(n =&gt; n.Name(name =&gt; "iType"))))));</code></pre>
  </div>
  </div>
  </p>
  
  <p>i get an exception: Could not get field name for nested sobject mapping
  Any corrections to be made in query?</p>