Skip to content

Commit

Permalink
Revert "Only show aggregatable fields for threshold rule grouping"
Browse files Browse the repository at this point in the history
This reverts commit 539fa49.
madirey committed Dec 16, 2020
1 parent 01e4340 commit 6e94e3b
Showing 6 changed files with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -65,16 +65,14 @@ export class IndexPatternsFetcher {
pattern: string | string[];
metaFields?: string[];
fieldCapsOptions?: { allow_no_indices: boolean };
filters?: { aggregatable: boolean };
type?: string;
rollupIndex?: string;
}): Promise<FieldDescriptor[]> {
const { pattern, metaFields, fieldCapsOptions, filters, type, rollupIndex } = options;
const { pattern, metaFields, fieldCapsOptions, type, rollupIndex } = options;
const fieldCapsResponse = await getFieldCapabilities(
this.elasticsearchClient,
pattern,
metaFields,
filters,
{
allow_no_indices: fieldCapsOptions
? fieldCapsOptions.allow_no_indices
Original file line number Diff line number Diff line change
@@ -39,7 +39,6 @@ export async function getFieldCapabilities(
callCluster: ElasticsearchClient,
indices: string | string[] = [],
metaFields: string[] = [],
filters?: { aggregatable: boolean },
fieldCapsOptions?: { allow_no_indices: boolean }
) {
const esFieldCaps = await callFieldCapsApi(callCluster, indices, fieldCapsOptions);
@@ -70,8 +69,7 @@ export async function getFieldCapabilities(
readFromDocValues: false,
})
)
.map(mergeOverrides)
.filter((field) => (filters?.aggregatable ? field.aggregatable === true : true));
.map(mergeOverrides);

return sortBy(allFieldsUnsorted, 'name');
}
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ export const useField = <T, FormType = FormData, I = T>(
) => {
const {
type = FIELD_TYPES.TEXT,
defaultValue = '', // The value to use a fallback mechanism when no initial value is passed
defaultValue = '', // The value to use a fallback mecanism when no initial value is passed
initialValue = config.defaultValue ?? '', // The value explicitly passed
isIncludedInOutput = true,
label = '',
Original file line number Diff line number Diff line change
@@ -51,7 +51,6 @@ export type BeatFields = Record<string, FieldInfo>;
export interface IndexFieldsStrategyRequest extends IEsSearchRequest {
indices: string[];
onlyCheckIfIndicesExist: boolean;
filters?: { aggregatable?: boolean };
}

export interface IndexFieldsStrategyResponse extends IEsSearchResponse {
Original file line number Diff line number Diff line change
@@ -121,8 +121,7 @@ interface FetchIndexReturn {

export const useFetchIndex = (
indexNames: string[],
onlyCheckIfIndicesExist: boolean = false,
filters?: { aggregatable?: boolean }
onlyCheckIfIndicesExist: boolean = false
): [boolean, FetchIndexReturn] => {
const { data, notifications } = useKibana().services;
const abortCtrl = useRef(new AbortController());
@@ -145,7 +144,7 @@ export const useFetchIndex = (
setLoading(true);
const searchSubscription$ = data.search
.search<IndexFieldsStrategyRequest, IndexFieldsStrategyResponse>(
{ indices: iNames, onlyCheckIfIndicesExist, filters },
{ indices: iNames, onlyCheckIfIndicesExist },
{
abortSignal: abortCtrl.current.signal,
strategy: 'securitySolutionIndexFields',
@@ -194,7 +193,7 @@ export const useFetchIndex = (
abortCtrl.current.abort();
};
},
[data.search, filters, notifications.toasts, onlyCheckIfIndicesExist]
[data.search, notifications.toasts, onlyCheckIfIndicesExist]
);

useEffect(() => {
Original file line number Diff line number Diff line change
@@ -37,7 +37,6 @@ export const securitySolutionIndexFieldsProvider = (): ISearchStrategy<
.map((index) =>
indexPatternsFetcher.getFieldsForWildcard({
pattern: index,
filters: request.filters,
})
)
.map((p) => p.catch((e) => false))
@@ -119,7 +118,7 @@ const missingFields: FieldDescriptor[] = [
* and should avoid any and all creation of new arrays, iterating over the arrays or performing
* any n^2 operations.
* @param indexesAlias The index alias
* @param index The index itself
* @param index The index its self
* @param indexesAliasIdx The index within the alias
*/
export const createFieldItem = (

0 comments on commit 6e94e3b

Please sign in to comment.