mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
* [ML] Fixing update datafeed endpoint * adding comments * using internal user * updating comment Co-authored-by: James Gowdy <jgowdy@elastic.co>
This commit is contained in:
parent
e2e9f73567
commit
10bd0ea8c6
1 changed files with 18 additions and 1 deletions
|
@ -471,7 +471,24 @@ export function getMlClient(
|
|||
},
|
||||
async updateDatafeed(...p: Parameters<MlClient['updateDatafeed']>) {
|
||||
await datafeedIdsCheck(p);
|
||||
return mlClient.updateDatafeed(...p);
|
||||
|
||||
// Temporary workaround for the incorrect updateDatafeed function in the esclient
|
||||
if (p.length === 0 || p[0] === undefined) {
|
||||
// Temporary generic error message. This should never be triggered
|
||||
// but is added for type correctness below
|
||||
throw new Error('Incorrect arguments supplied');
|
||||
}
|
||||
const { datafeed_id: id, body } = p[0];
|
||||
|
||||
return client.asInternalUser.transport.request({
|
||||
method: 'POST',
|
||||
path: `/_ml/datafeeds/${id}/_update`,
|
||||
body,
|
||||
});
|
||||
|
||||
// this should be reinstated once https://github.com/elastic/elasticsearch-js/issues/1601
|
||||
// is fixed
|
||||
// return mlClient.updateDatafeed(...p);
|
||||
},
|
||||
async updateFilter(...p: Parameters<MlClient['updateFilter']>) {
|
||||
return mlClient.updateFilter(...p);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue