Skip to content

Conversation

@jtibshirani
Copy link
Contributor

@jtibshirani jtibshirani commented Feb 6, 2019

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.

Backport of #38270.

… false.

`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 elastic#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 elastic#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.
@jtibshirani jtibshirani added >bug :Search Foundations/Mapping Index mappings, including merging and defining field types :Data Management/Indices APIs APIs to create and manage indices and templates backport labels Feb 6, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features

@jtibshirani jtibshirani force-pushed the dummy-type-in-typeless-requests branch from 9d8729d to f72ac83 Compare February 6, 2019 04:37
@jtibshirani jtibshirani merged commit fcdc509 into elastic:6.x Feb 6, 2019
@jtibshirani jtibshirani deleted the dummy-type-in-typeless-requests branch February 6, 2019 07:40
@danielmitterdorfer danielmitterdorfer removed the :Data Management/Indices APIs APIs to create and manage indices and templates label Feb 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport >bug :Search Foundations/Mapping Index mappings, including merging and defining field types

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants