Skip to content

HLRC: Add ML delete filter action #35382

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

Merged
merged 15 commits into from
Nov 19, 2018
Merged

Conversation

iverase
Copy link
Contributor

@iverase iverase commented Nov 8, 2018

It adds delete ML filter action to the high level rest client.

Relates #29827

It adds delete ML filter action to the high level rest client.

Relates elastic#29827
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

Copy link
Member

@benwtrent benwtrent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a bunch for knocking this out :D.

Just a couple of comments.

Copy link
Member

@benwtrent benwtrent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for not spotting this before :(

*/
public class DeleteFilterRequest implements Validatable {

private final String filter_id;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fields and parameters should be camelCase, so this should be filterId.

Everything else looks good to me.

Copy link
Contributor

@hub-cap hub-cap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nits, ship it.


static Request deleteFilter(DeleteFilterRequest deleteFilterRequest) {
String endpoint = new EndpointBuilder()
.addPathPartAsIs("_xpack")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addPathPartAsIs("_xpack", "ml", "filters")

@iverase
Copy link
Contributor Author

iverase commented Nov 12, 2018

@elasticmachine test this please

@iverase
Copy link
Contributor Author

iverase commented Nov 13, 2018

@elasticmachine test this please

2 similar comments
@iverase
Copy link
Contributor Author

iverase commented Nov 13, 2018

@elasticmachine test this please

@iverase
Copy link
Contributor Author

iverase commented Nov 13, 2018

@elasticmachine test this please

Copy link
Contributor

@hub-cap hub-cap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, 2 deletes, 2 diff responses in your PRs... I think we should consider the differences between the two of these and how to return a single, proper ACK. I wont let this hold up the review tho.

private final String filterId;

public DeleteFilterRequest(String filterId) {
this.filterId = Objects.requireNonNull(filterId, "[filter_id] is required");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this still be [filter_id] ?

Copy link
Member

@benwtrent benwtrent Nov 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hub-cap yes, that holds with other ML null checks.

e.g.

Objects.requireNonNull(detectors, "[" + DETECTORS.getPreferredName() + "] must not be null");

@hub-cap
Copy link
Contributor

hub-cap commented Nov 14, 2018

Can we double check that this does or does not throw a 404? IMHO a resource thats not found should throw a 404 here. This goes back to the other DELETE you did work on @iverase

@benwtrent
Copy link
Member

@hub-cap @iverase It does return a 404,

if (bulkResponse.getItems()[0].status() == RestStatus.NOT_FOUND) {
listener.onFailure(new ResourceNotFoundException("Could not delete filter with ID [" + filterId
+ "] because it does not exist"));

@hub-cap
Copy link
Contributor

hub-cap commented Nov 14, 2018

Cool, so then keeping this one with no ignores=404 is a good thing. ty for verifying @benwtrent

@iverase
Copy link
Contributor Author

iverase commented Nov 19, 2018

@elasticmachine test this please

@iverase iverase merged commit ae6a332 into elastic:master Nov 19, 2018
iverase added a commit that referenced this pull request Nov 19, 2018
* HLRC: Add ML delete filter action

It adds delete ML filter action to the high level rest client.

Relates #29827
@iverase iverase deleted the deleteFilters branch November 19, 2018 10:31
@jimczi jimczi added v7.0.0-beta1 and removed v7.0.0 labels Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants