<p dir="auto">When a key is present in json object multiple times it doesn't raise a parse error and only last value is used. This should instead raise <code class="notranslate">json_parse_exception</code>.</p>
<p dir="auto"><strong>Elasticsearch version</strong>: verified on 2.x, 5.0.0-alpha3</p>
<p dir="auto"><strong>Steps to reproduce</strong>:</p>
<ol dir="auto">
<li><code class="notranslate">curl -X PUT localhost:9200/i -d '{"settings": {"number_of_replicas": 2}, "settings": {"number_of_shards": 1}}'</code></li>
<li><code class="notranslate">curl -X GET localhost:9200/i</code></li>
</ol>
<p dir="auto">Hello guys,</p>
<p dir="auto">This config worked in ES v1.7.2 but since i tried to use the configuration in ES v2.1 I have a error... So :</p>
<p dir="auto">I use this mapping :</p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="PUT /my_index/_mapping/_default_
{
    &quot;_default_&quot;: {
        &quot;dynamic_date_formats&quot; : [
            &quot;yyyy-MM-dd HH:mm:ss&quot;,
            &quot;yyyy-MM-dd HH:mm:ss||yyyyMMdd-HH:mm:ss||yyyyMMdd-HH:mm:ss.SSS&quot;
        ],
        &quot;dynamic_templates&quot;: [
            {
                &quot;template_1&quot; : {
                    &quot;match&quot; : &quot;*&quot;,
                    &quot;match_mapping_type&quot; : &quot;string&quot;,
                    &quot;mapping&quot; : {
                        &quot;type&quot; : &quot;string&quot;,
                        &quot;index&quot; : &quot;not_analyzed&quot;
                    }
                }
            }, {
                &quot;template_2&quot; : {
                    &quot;match&quot; : &quot;*@expire&quot;,
                    &quot;match_mapping_type&quot; : &quot;date&quot;,
                    &quot;mapping&quot; : {
                        &quot;type&quot; : &quot;string&quot;,
                        &quot;index&quot; : &quot;not_analyzed&quot;
                    }
                }
            }
        ]
    }
}"><pre class="notranslate"><span class="pl-ii">PUT /my_index/_mapping/_default_</span>
{
    <span class="pl-ent">"_default_"</span>: {
        <span class="pl-ent">"dynamic_date_formats"</span> : [
            <span class="pl-s"><span class="pl-pds">"</span>yyyy-MM-dd HH:mm:ss<span class="pl-pds">"</span></span>,
            <span class="pl-s"><span class="pl-pds">"</span>yyyy-MM-dd HH:mm:ss||yyyyMMdd-HH:mm:ss||yyyyMMdd-HH:mm:ss.SSS<span class="pl-pds">"</span></span>
        ],
        <span class="pl-ent">"dynamic_templates"</span>: [
            {
                <span class="pl-ent">"template_1"</span> : {
                    <span class="pl-ent">"match"</span> : <span class="pl-s"><span class="pl-pds">"</span>*<span class="pl-pds">"</span></span>,
                    <span class="pl-ent">"match_mapping_type"</span> : <span class="pl-s"><span class="pl-pds">"</span>string<span class="pl-pds">"</span></span>,
                    <span class="pl-ent">"mapping"</span> : {
                        <span class="pl-ent">"type"</span> : <span class="pl-s"><span class="pl-pds">"</span>string<span class="pl-pds">"</span></span>,
                        <span class="pl-ent">"index"</span> : <span class="pl-s"><span class="pl-pds">"</span>not_analyzed<span class="pl-pds">"</span></span>
                    }
                }
            }, {
                <span class="pl-ent">"template_2"</span> : {
                    <span class="pl-ent">"match"</span> : <span class="pl-s"><span class="pl-pds">"</span>*@expire<span class="pl-pds">"</span></span>,
                    <span class="pl-ent">"match_mapping_type"</span> : <span class="pl-s"><span class="pl-pds">"</span>date<span class="pl-pds">"</span></span>,
                    <span class="pl-ent">"mapping"</span> : {
                        <span class="pl-ent">"type"</span> : <span class="pl-s"><span class="pl-pds">"</span>string<span class="pl-pds">"</span></span>,
                        <span class="pl-ent">"index"</span> : <span class="pl-s"><span class="pl-pds">"</span>not_analyzed<span class="pl-pds">"</span></span>
                    }
                }
            }
        ]
    }
}</pre></div>
<p dir="auto">And after a first type insert, I get the expected result. But if I try to insert a second or third type like :</p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="POST /my_index/my_type
{
   &quot;source&quot;:&quot;my_source&quot;,
   &quot;country&quot;:&quot;my_country&quot;,
   &quot;company&quot;:&quot;my_company&quot;,
   &quot;server&quot;:&quot;my_server&quot;,
   &quot;@timestamp&quot;:&quot;2016-01-01 00:07:10&quot;
}"><pre class="notranslate"><span class="pl-ii">POST /my_index/my_type</span>
{
   <span class="pl-ent">"source"</span>:<span class="pl-s"><span class="pl-pds">"</span>my_source<span class="pl-pds">"</span></span>,
   <span class="pl-ent">"country"</span>:<span class="pl-s"><span class="pl-pds">"</span>my_country<span class="pl-pds">"</span></span>,
   <span class="pl-ent">"company"</span>:<span class="pl-s"><span class="pl-pds">"</span>my_company<span class="pl-pds">"</span></span>,
   <span class="pl-ent">"server"</span>:<span class="pl-s"><span class="pl-pds">"</span>my_server<span class="pl-pds">"</span></span>,
   <span class="pl-ent">"@timestamp"</span>:<span class="pl-s"><span class="pl-pds">"</span>2016-01-01 00:07:10<span class="pl-pds">"</span></span>
}</pre></div>
<p dir="auto">Result return is :</p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
   &quot;error&quot;: {
      &quot;root_cause&quot;: [
         {
            &quot;type&quot;: &quot;mapper_parsing_exception&quot;,
            &quot;reason&quot;: &quot;failed to parse [@timestamp]&quot;
         }
      ],
      &quot;type&quot;: &quot;mapper_parsing_exception&quot;,
      &quot;reason&quot;: &quot;failed to parse [@timestamp]&quot;,
      &quot;caused_by&quot;: {
         &quot;type&quot;: &quot;illegal_argument_exception&quot;,
         &quot;reason&quot;: &quot;Invalid format: \&quot;2016-01-01 00:07:10\&quot; is malformed at \&quot; 00:07:10\&quot;&quot;
      }
   },
   &quot;status&quot;: 400
}"><pre class="notranslate">{
   <span class="pl-ent">"error"</span>: {
      <span class="pl-ent">"root_cause"</span>: [
         {
            <span class="pl-ent">"type"</span>: <span class="pl-s"><span class="pl-pds">"</span>mapper_parsing_exception<span class="pl-pds">"</span></span>,
            <span class="pl-ent">"reason"</span>: <span class="pl-s"><span class="pl-pds">"</span>failed to parse [@timestamp]<span class="pl-pds">"</span></span>
         }
      ],
      <span class="pl-ent">"type"</span>: <span class="pl-s"><span class="pl-pds">"</span>mapper_parsing_exception<span class="pl-pds">"</span></span>,
      <span class="pl-ent">"reason"</span>: <span class="pl-s"><span class="pl-pds">"</span>failed to parse [@timestamp]<span class="pl-pds">"</span></span>,
      <span class="pl-ent">"caused_by"</span>: {
         <span class="pl-ent">"type"</span>: <span class="pl-s"><span class="pl-pds">"</span>illegal_argument_exception<span class="pl-pds">"</span></span>,
         <span class="pl-ent">"reason"</span>: <span class="pl-s"><span class="pl-pds">"</span>Invalid format: <span class="pl-cce">\"</span>2016-01-01 00:07:10<span class="pl-cce">\"</span> is malformed at <span class="pl-cce">\"</span> 00:07:10<span class="pl-cce">\"</span><span class="pl-pds">"</span></span>
      }
   },
   <span class="pl-ent">"status"</span>: <span class="pl-c1">400</span>
}</pre></div>
<p dir="auto">If I try to insert it on the first type, this is working... Perhaps bug, or just my mistake but i do not understand.</p>
<p dir="auto">FYI: if i swap the order of the type inserted, it is always the first that it work correctly.</p>