Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] AIOps Log Rate Analysis: Fixes text field selection #186176

Merged
merged 2 commits into from
Jun 18, 2024
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 @@ -8,6 +8,16 @@
export const fieldCapsPgBenchMock = {
indices: ['.ds-filebeat-8.2.0-2022.06.07-000082'],
fields: {
// The next two fields are not in the original field caps response,
// but are added here to test the logic to ignore fields that are not
// in the white list. It's based on a real world example where the mapping
// included a double mapping of text+integer.
ignore_this_text_field: {
text: { type: 'text', metadata_field: false, searchable: true, aggregatable: false },
},
'ignore_this_text_field.int': {
integer: { type: 'integer', metadata_field: false, searchable: true, aggregatable: true },
},
'kubernetes.node.uid': {
keyword: { type: 'keyword', metadata_field: false, searchable: true, aggregatable: true },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ import { getTotalDocCountRequest } from './get_total_doc_count_request';
// TODO Consolidate with duplicate `fetchPValues` in
// `x-pack/plugins/observability_solution/apm/server/routes/correlations/queries/fetch_duration_field_candidates.ts`

// Supported field names for text fields for log rate analysis.
// If we analyse all detected text fields, we might run into performance
// issues with the `categorize_text` aggregation. Until this is resolved, we
// rely on a predefined white list of supported text fields.
const TEXT_FIELD_WHITE_LIST = ['message', 'error.message'];

const SUPPORTED_ES_FIELD_TYPES = [
ES_FIELD_TYPES.KEYWORD,
ES_FIELD_TYPES.IP,
Expand Down Expand Up @@ -76,7 +82,7 @@ export const fetchIndexInfo = async (
acceptableFields.add(key);
}

if (isTextField) {
if (isTextField && TEXT_FIELD_WHITE_LIST.includes(key)) {
acceptableTextFields.add(key);
}

Expand Down