Skip to content

Commit

Permalink
apply tier filter to new fields endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkime committed Jan 29, 2024
1 parent b98deaa commit b23aafe
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import type {
DataViewsServerPluginStartDependencies,
} from '../../types';
import type { FieldDescriptorRestResponse } from '../route_types';
import { FIELDS_PATH as path } from '../../../common/constants';
import { FIELDS_PATH as path, DATA_VIEWS_FIELDS_EXCLUDED_TIERS } from '../../../common/constants';
import { parseFields, IBody, IQuery, querySchema, validate } from './fields_for';
import { DEFAULT_FIELD_CACHE_FRESHNESS } from '../../constants';
import { getIndexFilterDsl } from './utils';

export function calculateHash(srcBuffer: Buffer) {
const hash = createHash('sha1');
Expand All @@ -31,6 +32,9 @@ const handler: (isRollupsEnabled: () => boolean) => RequestHandler<{}, IQuery, I
const uiSettings = core.uiSettings.client;
const { asCurrentUser } = core.elasticsearch.client;
const indexPatterns = new IndexPatternsFetcher(asCurrentUser, undefined, isRollupsEnabled());
const excludedTiers = await core.uiSettings.client.get<string>(
DATA_VIEWS_FIELDS_EXCLUDED_TIERS
);
const {
pattern,
meta_fields: metaFields,
Expand Down Expand Up @@ -59,6 +63,7 @@ const handler: (isRollupsEnabled: () => boolean) => RequestHandler<{}, IQuery, I
allow_no_indices: allowNoIndex || false,
includeUnmapped,
},
indexFilter: getIndexFilterDsl({ excludedTiers }),
...(parsedFields.length > 0 ? { fields: parsedFields } : {}),
});

Expand Down

0 comments on commit b23aafe

Please sign in to comment.