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

HLRC: Add ML get influencers API #33389

Conversation

dimitris-athanasiou
Copy link
Contributor

Relates #29827

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@elasticmachine
Copy link
Collaborator

Pinging @elastic/ml-core

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.

Some copy/paste and find/replace errors are the biggest things.

public static final ParseField SORT = new ParseField("sort");
public static final ParseField DESCENDING = new ParseField("desc");

public static final ObjectParser<GetInfluencersRequest, Void> PARSER = new ObjectParser<>("get_influencers_request",
Copy link
Member

Choose a reason for hiding this comment

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

This should be a ConstructingObjectParser so that the private empty ctr can be removed.

private String sort;
private Boolean descending;

private GetInfluencersRequest() {}
Copy link
Member

Choose a reason for hiding this comment

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

Not necessary with ConstructingObjectParser

/**
* Sets the value of "end" which is a timestamp.
* Only influencers whose timestamp is before the "end" value will be returned.
* @param end value of "end" to be set
Copy link
Member

Choose a reason for hiding this comment

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

Knowing the supported time formats would be helpful for the user. (this goes for all the time fields in this object)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have also taken the opportunity to fix this in other get result request objects.

protected GetRecordsRequest createTestInstance() {
GetRecordsRequest request = new GetRecordsRequest(ESTestCase.randomAlphaOfLengthBetween(1, 20));

if (ESTestCase.randomBoolean()) {
Copy link
Member

Choose a reason for hiding this comment

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

references to ESTestCast can probably be removed as AbstractXContentTestCase extends that class.

@Override
protected GetInfluencersResponse createTestInstance() {
String jobId = ESTestCase.randomAlphaOfLength(20);
int listSize = ESTestCase.randomInt(10);
Copy link
Member

Choose a reason for hiding this comment

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

Again, here references to ESTestCast can probably be removed as AbstractXContentTestCase extends that class.

@@ -25,11 +25,11 @@

import java.io.IOException;

public class GetRecordsRequestTests extends AbstractXContentTestCase<GetRecordsRequest> {
public class GetRecordsRequestTests extends AbstractXContentTestCase<GetInfluencersRequest> {
Copy link
Member

Choose a reason for hiding this comment

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

GetRecordsRequestTests should still reference GetRecordsRequest correct?
This smells like a find/replace error.

[[java-rest-high-x-pack-ml-get-influencers]]
=== Get Influencers API

The Get Records API retrieves one or more influencer results.
Copy link
Member

Choose a reason for hiding this comment

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

Copy paste and find/replace error. Should be Get Influencers API

protected GetRecordsRequest doParseInstance(XContentParser parser) throws IOException {
return GetRecordsRequest.PARSER.apply(parser, null);
protected GetInfluencersRequest doParseInstance(XContentParser parser) throws IOException {
return GetInfluencersRequest.PARSER.apply(parser, null);
Copy link
Member

Choose a reason for hiding this comment

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

Mentioned above, this seems like a find/replace error after a copy paste.

@dimitris-athanasiou
Copy link
Contributor Author

@benwtrent All good points! Pushed a commit addressing all of them.

PARSER.declareBoolean(GetInfluencersRequest::setDescending, DESCENDING);
}

private String jobId;
Copy link
Member

Choose a reason for hiding this comment

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

should be final

@dimitris-athanasiou dimitris-athanasiou merged commit 24776b2 into elastic:master Sep 5, 2018
@dimitris-athanasiou dimitris-athanasiou deleted the add-ml-get-influencers-to-hlrc branch September 5, 2018 14:06
dimitris-athanasiou added a commit that referenced this pull request Sep 5, 2018
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Sep 5, 2018
* master:
  Fix deprecated setting specializations (elastic#33412)
  HLRC: split cluster request converters (elastic#33400)
  HLRC: Add ML get influencers API (elastic#33389)
  Add conditional token filter to elasticsearch (elastic#31958)
  Build: Merge xpack checkstyle config into core (elastic#33399)
  Disable IndexRecoveryIT.testRerouteRecovery.
  INGEST: Implement Drop Processor (elastic#32278)
  [ML] Add field stats to log structure finder (elastic#33351)
  Add interval response parameter to AutoDateInterval histogram (elastic#33254)
  MINOR+CORE: Remove Dead Methods ClusterService (elastic#33346)
@benwtrent benwtrent removed the :ml Machine learning label Oct 25, 2018
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.

4 participants