OpenSearch/x-pack/qa/multi-node
Julie Tibshirani 3ce7d2c9b6
Make sure to reject mappings with type _doc when include_type_name is false. (#38270)
`CreateIndexRequest#source(Map<String, Object>, ... )`, which is used when
deserializing index creation requests, accidentally accepts mappings that are
nested twice under the type key (as described in the bug report #38266).

This in turn causes us to be too lenient in parsing typeless mappings. In
particular, we accept the following index creation request, even though it
should not contain the type key `_doc`:

```
PUT index?include_type_name=false
{
  "mappings": {
    "_doc": {
      "properties": { ... }
    }
  }
}
```

There is a similar issue for both 'put templates' and 'put mappings' requests
as well.

This PR makes the minimal changes to detect and reject these typed mappings in
requests. It does not address #38266 generally, or attempt a larger refactor
around types in these server-side requests, as I think this should be done at a
later time.
2019-02-05 10:52:32 -08:00
..
src/test/java/org/elasticsearch/multi_node Make sure to reject mappings with type _doc when include_type_name is false. (#38270) 2019-02-05 10:52:32 -08:00
build.gradle Merge branch 'master' into index-lifecycle 2018-08-23 11:52:59 -06:00
roles.yml Migrate x-pack-elasticsearch source to elasticsearch 2018-04-20 15:29:54 -07:00