<p dir="auto">(Updated - my first examples were wrong)</p>
<p dir="auto">In the following example the document will be deleted:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="DELETE testidx
PUT testidx
PUT testidx/doc/_mapping
{
  &quot;_ttl&quot;:{
    &quot;enabled&quot;: &quot;true&quot;
  }
}

GET testidx/_mapping


PUT testidx/doc/_mapping
{
  &quot;_ttl&quot;:{
    &quot;enabled&quot;: &quot;false&quot;
  }
}
# _ttl is enabled anyway
GET testidx/_mapping
POST testidx/doc/1
{
  &quot;text&quot;:&quot;foo&quot;,
  &quot;_ttl&quot;: &quot;10ms&quot;
}

#document will be deleted after a while
GET testidx/doc/1"><pre class="notranslate"><code class="notranslate">DELETE testidx
PUT testidx
PUT testidx/doc/_mapping
{
  "_ttl":{
    "enabled": "true"
  }
}

GET testidx/_mapping


PUT testidx/doc/_mapping
{
  "_ttl":{
    "enabled": "false"
  }
}
# _ttl is enabled anyway
GET testidx/_mapping
POST testidx/doc/1
{
  "text":"foo",
  "_ttl": "10ms"
}

#document will be deleted after a while
GET testidx/doc/1
</code></pre></div>
<p dir="auto">When putting a mapping, if there is a conflict in <code class="notranslate">properties</code>, an exception is thrown.  However, any conflicts in the other parameters ( eg <code class="notranslate">_all</code>, <code class="notranslate">dynamic</code> etc) are silently ignored.</p>
<p dir="auto">These should also throw errors.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="# [Sat Mar 12 19:38:18 2011] Protocol: http, Server: 127.0.0.1:9200
curl -XPUT 'http://127.0.0.1:9200/foo/' 

# [Sat Mar 12 19:38:18 2011] Response:
# {
#    &quot;ok&quot; : true,
#    &quot;acknowledged&quot; : true
# }

# [Sat Mar 12 19:38:21 2011] Protocol: http, Server: 127.0.0.1:9200
curl -XPUT 'http://127.0.0.1:9200/foo/bar/_mapping'  -d '
{
   &quot;bar&quot; : {
      &quot;_all&quot; : {
         &quot;enabled&quot; : 0
      },
      &quot;dynamic&quot; : 0,
      &quot;properties&quot; : {
         &quot;text&quot; : {
            &quot;type&quot; : &quot;string&quot;
         }
      }
   }
}
'

# [Sat Mar 12 19:38:21 2011] Response:
# {
#    &quot;ok&quot; : true,
#    &quot;acknowledged&quot; : true
# }

# [Sat Mar 12 19:38:24 2011] Protocol: http, Server: 127.0.0.1:9200
curl -XPUT 'http://127.0.0.1:9200/foo/bar/_mapping'  -d '
{
   &quot;bar&quot; : {
      &quot;_all&quot; : {
         &quot;enabled&quot; : 1
      },
      &quot;dynamic&quot; : 1,
      &quot;properties&quot; : {
         &quot;text&quot; : {
            &quot;type&quot; : &quot;string&quot;
         }
      }
   }
}
'

# [Sat Mar 12 19:38:24 2011] Response:
# {
#    &quot;ok&quot; : true,
#    &quot;acknowledged&quot; : true
# }"><pre class="notranslate"><code class="notranslate"># [Sat Mar 12 19:38:18 2011] Protocol: http, Server: 127.0.0.1:9200
curl -XPUT 'http://127.0.0.1:9200/foo/' 

# [Sat Mar 12 19:38:18 2011] Response:
# {
#    "ok" : true,
#    "acknowledged" : true
# }

# [Sat Mar 12 19:38:21 2011] Protocol: http, Server: 127.0.0.1:9200
curl -XPUT 'http://127.0.0.1:9200/foo/bar/_mapping'  -d '
{
   "bar" : {
      "_all" : {
         "enabled" : 0
      },
      "dynamic" : 0,
      "properties" : {
         "text" : {
            "type" : "string"
         }
      }
   }
}
'

# [Sat Mar 12 19:38:21 2011] Response:
# {
#    "ok" : true,
#    "acknowledged" : true
# }

# [Sat Mar 12 19:38:24 2011] Protocol: http, Server: 127.0.0.1:9200
curl -XPUT 'http://127.0.0.1:9200/foo/bar/_mapping'  -d '
{
   "bar" : {
      "_all" : {
         "enabled" : 1
      },
      "dynamic" : 1,
      "properties" : {
         "text" : {
            "type" : "string"
         }
      }
   }
}
'

# [Sat Mar 12 19:38:24 2011] Response:
# {
#    "ok" : true,
#    "acknowledged" : true
# }
</code></pre></div>