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 @@ -2,9 +2,6 @@

exports[`Header should render normally 1`] = `
<div>
<EuiSpacer
size="m"
/>
<EuiTitle
size="m"
>
Expand Down Expand Up @@ -59,9 +56,6 @@ exports[`Header should render normally 1`] = `

exports[`Header should render without including system indices 1`] = `
<div>
<EuiSpacer
size="m"
/>
<EuiTitle
size="m"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export const Header = ({
onChangeIncludingSystemIndices,
}) => (
<div>
<EuiSpacer size="m"/>
<EuiTitle>
<h1>
<FormattedMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<div
ng-controller="managementIndicesEdit"
data-test-subj="editIndexPattern"
class="kuiViewContent"
role="region"
aria-label="{{::'kbn.management.editIndexPattern.detailsAria' | i18n: { defaultMessage: 'Index pattern details' } }}"
>
Expand Down
55 changes: 38 additions & 17 deletions x-pack/plugins/rollup/server/routes/api/index_patterns.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,44 @@ export function registerFieldsForWildcardRoute(server) {
readFromDocValues: true,
};

rollupFields.push(
...fields
// For each field of the aggregation, filter out ones that have already been added
// to the field list bcause the same field can be part of multiple aggregations, but
// end consumption doesn't differentiate fields based on their aggregation abilities.
.filter(field => !rollupFieldNames.includes(field))
// Then expand each field into object format that end consumption expects.
.map(field => {
const fieldCapsKey = `${field}.${agg}.${agg === 'date_histogram' ? 'timestamp' : 'value'}`;
rollupFieldNames.push(field);
return {
...fieldsFromFieldCapsApi[fieldCapsKey],
...defaultField,
name: field,
};
})
);
// Date histogram agg only ever has one field defined, let date type overwrite a
// previous type if defined (such as number from max and min aggs).
if(agg === 'date_histogram') {
const timeFieldName = fields[0];
const fieldCapsKey = `${timeFieldName}.${agg}.timestamp`;
const newField = {
...fieldsFromFieldCapsApi[fieldCapsKey],
...defaultField,
name: timeFieldName,
};
const existingField = rollupFields.find(field => field.name === timeFieldName);

if(existingField) {
Object.assign(existingField, newField);
} else {
rollupFieldNames.push(timeFieldName);
rollupFields.push(newField);
}
}
// For all other aggs, filter out ones that have already been added to the field list
// because the same field can be part of multiple aggregations, but end consumption
// doesn't differentiate fields based on their aggregation abilities.
else {
rollupFields.push(
...fields
.filter(field => !rollupFieldNames.includes(field))
.map(field => {
// Expand each field into object format that end consumption expects.
const fieldCapsKey = `${field}.${agg}.value`;
rollupFieldNames.push(field);
return {
...fieldsFromFieldCapsApi[fieldCapsKey],
...defaultField,
name: field,
};
})
);
}
});

return {
Expand Down