Skip to content

Commit

Permalink
fixed update payload (opensearch-project#838)
Browse files Browse the repository at this point in the history
Signed-off-by: Amardeepsingh Siglani <[email protected]>
  • Loading branch information
amsiglan committed Feb 14, 2024
1 parent 2e040cb commit 904fbd6
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions public/store/CorrelationsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,26 @@ export class CorrelationsStore implements ICorrelationsStore {
{
name: correlationRule.name,
time_window: correlationRule.time_window,
correlate: correlationRule.queries?.map((query) => ({
index: query.index,
category: query.logType,
query: query.conditions
correlate: correlationRule.queries?.map((query) => {
const queryString = query.conditions
.map((condition) => `${condition.name}:${condition.value}`)
.join(' AND '),
field: query.field,
})),
.join(' AND ');

const correlationInput: any = {
index: query.index,
category: query.logType,
};

if (queryString) {
correlationInput['query'] = queryString;
}

if (query.field) {
correlationInput['field'] = query.field;
}

return correlationInput;
}),
}
);

Expand Down

0 comments on commit 904fbd6

Please sign in to comment.