Skip to content

Commit 8b415f6

Browse files
author
Mathieu Martin
committed
Make all fields linkable directly via an HTML ID (elastic#1148)
1 parent d34f97e commit 8b415f6

File tree

8 files changed

+1643
-416
lines changed

8 files changed

+1643
-416
lines changed

docs/field-details.asciidoc

Lines changed: 1632 additions & 408 deletions
Large diffs are not rendered by default.

experimental/generated/ecs/ecs_flat.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'@timestamp':
2-
dashed_name: -timestamp
2+
dashed_name: timestamp
33
description: 'Date/time when the event originated.
44
55
This is the date/time extracted from the event, typically representing when the

experimental/generated/ecs/ecs_nested.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ base:
158158
events. These fields are common across all types of events.
159159
fields:
160160
'@timestamp':
161-
dashed_name: -timestamp
161+
dashed_name: timestamp
162162
description: 'Date/time when the event originated.
163163
164164
This is the date/time extracted from the event, typically representing when

generated/ecs/ecs_flat.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'@timestamp':
2-
dashed_name: -timestamp
2+
dashed_name: timestamp
33
description: 'Date/time when the event originated.
44
55
This is the date/time extracted from the event, typically representing when the

generated/ecs/ecs_nested.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ base:
160160
events. These fields are common across all types of events.
161161
fields:
162162
'@timestamp':
163-
dashed_name: -timestamp
163+
dashed_name: timestamp
164164
description: 'Date/time when the event originated.
165165
166166
This is the date/time extracted from the event, typically representing when

scripts/schema/finalizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def field_finalizer(details, path):
173173
name_array = path + [details['field_details']['node_name']]
174174
flat_name = '.'.join(name_array)
175175
details['field_details']['flat_name'] = flat_name
176-
details['field_details']['dashed_name'] = re.sub('[@_\.]', '-', flat_name)
176+
details['field_details']['dashed_name'] = re.sub('[_\.]', '-', flat_name).replace('@', '')
177177
if 'multi_fields' in details['field_details']:
178178
for mf in details['field_details']['multi_fields']:
179179
mf['flat_name'] = flat_name + '.' + mf['name']

scripts/templates/field_details.j2

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ Find additional usage and examples in the {{ fieldset['name'] }} fields <<ecs-{{
2525
{% if 'original_fieldset' not in field -%}
2626

2727
{# `Field` column -#}
28-
| {{ field['flat_name'] }}
28+
|
29+
[[field-{{field['dashed_name']}}]]
30+
<<field-{{field['dashed_name']}}, {{ field['flat_name'] }}>>
31+
2932
{# `Description` column -#}
3033
| {{ field['description']|replace("\n", "\n\n") }}
3134

scripts/tests/unit/test_schema_finalizer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def test_calculate_final_values(self):
268268
timestamp_details = base_fields['@timestamp']['field_details']
269269
self.assertEqual(timestamp_details['flat_name'], '@timestamp',
270270
"Field sets with root=true must not namespace field names with the field set's name")
271-
self.assertEqual(timestamp_details['dashed_name'], '-timestamp')
271+
self.assertEqual(timestamp_details['dashed_name'], 'timestamp')
272272
# root=false
273273
self.assertEqual(server_fields['ip']['field_details']['flat_name'], 'server.ip',
274274
"Field sets with root=false must namespace field names with the field set's name")
@@ -288,7 +288,7 @@ def test_calculate_final_values(self):
288288
def test_dashed_name_cleanup(self):
289289
details = {'field_details': {'node_name': '@time.stamp_'}}
290290
finalizer.field_finalizer(details, [])
291-
self.assertEqual(details['field_details']['dashed_name'], '-time-stamp-')
291+
self.assertEqual(details['field_details']['dashed_name'], 'time-stamp-')
292292

293293
# field_group_at_path
294294

0 commit comments

Comments
 (0)