Skip to content

Commit 4f7d18b

Browse files
committed
add document id and total to API
review suggestions
1 parent bfc8e96 commit 4f7d18b

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

x-pack/plugins/security_solution/server/endpoint/routes/actions/audit_log_handler.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,16 @@ export const actionsLogRequestHandler = (
7878
}
7979

8080
return res.ok({
81-
body: result.body.hits.hits.map((e) => {
82-
const type = /^.fleet-actions-\d+$/.test(e._index) ? 'action' : 'response';
83-
return { type, item: e._source };
84-
}),
81+
body: {
82+
total:
83+
typeof result.body.hits.total === 'number'
84+
? result.body.hits.total
85+
: result.body.hits.total.value,
86+
items: result.body.hits.hits.map((e) => ({
87+
type: e._index.startsWith('.fleet-actions') ? 'action' : 'response',
88+
item: { id: e._id, data: e._source },
89+
})),
90+
},
8591
});
8692
};
8793
};

0 commit comments

Comments
 (0)