Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -438,10 +438,10 @@ export const getSavedObjects = (): SavedObject[] => [
attributes: {
title: 'kibana_sample_data_flights',
timeFieldName: 'timestamp',
fields:
'[{"name":"hour_of_day","type":"number","count":0,"scripted":true,"script":"doc[\'timestamp\'].value.hourOfDay","lang":"painless","searchable":true,"aggregatable":true,"readFromDocValues":false}]',
fieldFormatMap:
'{"hour_of_day":{"id":"number","params":{"pattern":"00"}},"AvgTicketPrice":{"id":"number","params":{"pattern":"$0,0.[00]"}}}',
runtimeFieldMap:
'{"hour_of_day":{"type":"long","script":{"source":"emit(doc[\'timestamp\'].value.hourOfDay);"}}}',
},
references: [],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,9 @@ export const getSavedObjects = (): SavedObject[] => [
attributes: {
title: 'kibana_sample_data_logs',
timeFieldName: 'timestamp',
fields:
'[{"name":"hour_of_day","type":"number","count":0,"scripted":true,"script":"doc[\'timestamp\'].value.getHour()","lang":"painless","searchable":true,"aggregatable":true,"readFromDocValues":false}]',
fieldFormatMap: '{"hour_of_day":{}}',
runtimeFieldMap:
'{"hour_of_day":{"type":"long","script":{"source":"emit(doc[\'timestamp\'].value.getHour());"}}}',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, is the discrepancy between the hour_of_day type from number to long because of the saved objects attributes schema?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TinaHeiligers Good question. No, its because scripted fields use kibana types (javascript) whereas runtime fields use ES field types.

},
references: [],
},
Expand Down