elasticsearch: dynamic: strict

raw

1-create-type.json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{
  "index": "test",
  "mappings": {
    "dynamictest": {
      "dynamic": "strict",
      "properties": {
        "title": {
          "type": "string"
        },
        "sub": {
          "properties": {
            "subtitle": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}
raw

2-create-object.json

1
2
3
4
5
6
7
8
{
  "title": "foo",
  "doesnotexist": "bar",
  "sub": {
    "subtitle": "baz",
    "subdoesnotexist": "zzz"
  }
}
raw

3-error.json

1
2
3
4
5
6
7
8
9
10
11
12
13
{
    "error": {
        "root_cause": [
            {
                "type": "strict_dynamic_mapping_exception",
                "reason": "mapping set to strict, dynamic introduction of [subdoesnotexist] within [sub] is not allowed"
            }
        ],
        "type": "strict_dynamic_mapping_exception",
        "reason": "mapping set to strict, dynamic introduction of [subdoesnotexist] within [sub] is not allowed"
    },
    "status": 400
}
Christian Weiske Christian Weiske
owner

History