Skip to content

Commit

Permalink
Add normalizer multi-field capability (#971)
Browse files Browse the repository at this point in the history
Co-authored-by: Eric Beahan <ebeahan@gmail.com>
  • Loading branch information
madirey and ebeahan authored Sep 24, 2020
1 parent 56a7e6c commit 33120c9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Thanks, you're awesome :-) -->

* Introduced `--strict` flag to perform stricter schema validation when running the generator script. #937
* Added check under `--strict` that ensures composite types in example fields are quoted. #966
* Added `ignore_above` and `normalizer` support for keyword multi-fields. #971

#### Improvements

Expand Down
2 changes: 1 addition & 1 deletion scripts/generators/beats.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def fieldset_field_array(source_fields, df_whitelist, fieldset_prefix):
'ignore_above', 'multi_fields', 'format', 'input_format',
'output_format', 'output_precision', 'description',
'example', 'enabled', 'index']
multi_fields_allowed_keys = ['name', 'type', 'norms', 'default_field']
multi_fields_allowed_keys = ['name', 'type', 'norms', 'default_field', 'normalizer', 'ignore_above']

fields = []
for nested_field_name in source_fields:
Expand Down
7 changes: 5 additions & 2 deletions scripts/generators/es_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,11 @@ def entry_for(field):
if 'multi_fields' in field:
field_entry['fields'] = {}
for mf in field['multi_fields']:
mf_entry = {'type': mf['type']}
if mf['type'] == 'text':
mf_type = mf['type']
mf_entry = {'type': mf_type}
if mf_type == 'keyword':
ecs_helpers.dict_copy_existing_keys(mf, mf_entry, ['normalizer', 'ignore_above'])
elif mf_type == 'text':
ecs_helpers.dict_copy_existing_keys(mf, mf_entry, ['norms'])
field_entry['fields'][mf['name']] = mf_entry

Expand Down

0 comments on commit 33120c9

Please sign in to comment.