Only speficied fields

DELETE test
PUT test
{
  "mappings": {
    "doc": {
      "dynamic": "strict",
      "properties": {
        "name": {
          "type": "text"
        }
      }
    }
  }
}
PUT test/doc/1
{
  "name": "OP",
  "author": "er"
}

gives

{
  "error": {
    "root_cause": [
      {
        "type": "strict_dynamic_mapping_exception",
        "reason": "mapping set to strict, dynamic introduction of [author] within [doc] is not allowed"
      }
    ],
    "type": "strict_dynamic_mapping_exception",
    "reason": "mapping set to strict, dynamic introduction of [author] within [doc] is not allowed"
  },
  "status": 400
}

If you can't reproduce it please share a full formatted script as I just did so I can check it.

1 Like