-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow forcing dynamic object type mapping (#6691)
Currently dynamic mappings are tolerant of unexpected data types. For example, this definition: ``` - name: test type: object object_type: long dynamic: true ``` produces this dynamic template: ``` "test": { "path_match": "test.*", "match_mapping_type": "long", "mapping": { "type": "long" } } ``` If the first value seen is a string, say indexing this document: ``` "test": { "somelong": 16, "somestring": "foo" } ``` the resulting mapping is actually: ``` "test": { "dynamic": "true", "properties": { "test": { "properties": { "somelong": { "type": "long" }, "somestring": { "type": "keyword", "ignore_above": 1024 } } } } } ``` In apm-server, data is already validated before being sent along to elasticsearch, so barring a bug, a string will not be sent where a long is required. This change allows forcing the data for a dynamic field to be a specific type via field config, eg for: ``` - name: test type: object object_type: long object_type_mapping_type: "*" dynamic: true ``` The resulting dynamic template would be: ``` "test": { "path_match": "test.*", "match_mapping_type": "*", "mapping": { "type": "long" } } ``` Any value that can't be mapped to `long` will result in an indexing error. Continuing this example: ``` "error": { "root_cause": [ { "type": "mapper_parsing_exception", "reason": "failed to parse [test.somestring]" } ] } ```
- Loading branch information
1 parent
a69f617
commit cfe008e
Showing
4 changed files
with
54 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters