Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.x] Add normalizer multi-field capability (#971) #978

Merged
merged 1 commit into from
Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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