-
Notifications
You must be signed in to change notification settings - Fork 36
Conversation
Codecov Report
@@ Coverage Diff @@
## master #286 +/- ##
============================================
+ Coverage 70.15% 71.36% +1.20%
- Complexity 1821 1871 +50
============================================
Files 190 195 +5
Lines 8900 9020 +120
Branches 757 764 +7
============================================
+ Hits 6244 6437 +193
+ Misses 2300 2218 -82
- Partials 356 365 +9
Flags with carried forward coverage won't be shown. Click here to find out more.
|
boolean nameExists = false; | ||
if (searchResponse.getHits().getTotalHits().value > 0) { | ||
nameExists = true; | ||
} else { | ||
nameExists = false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: could condense this into one line: boolean nameExists = searchResponse.getHits().getTotalHits().value > 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, thats a nice idea.
Have you discussed with the tech writer about adding these to the AD Open Distro docs? |
Good question, I will work with the tech writer as we need to update bunch of other information as well for FGAC. |
Cool, don't see any other blockers, will approve. |
One more edge case here - in the case of the |
import org.elasticsearch.action.ActionType; | ||
|
||
public class SearchAnomalyDetectorInfoAction extends ActionType<SearchAnomalyDetectorInfoResponse> { | ||
public static final SearchAnomalyDetectorInfoAction INSTANCE = new SearchAnomalyDetectorInfoAction(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you switched NAME and INSTANCE sequence in this PR #284 , why we need to do that? Should we do the same thing here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure makes sense.
I''ll rebase my changes and update it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just saw the first part of the question, JVM is not smart enough, since INSTANCE depends on ACTION it must be defined first and if defined later string concat does not work. So I had to move it above.
|
||
public class SearchAnomalyDetectorInfoAction extends ActionType<SearchAnomalyDetectorInfoResponse> { | ||
public static final SearchAnomalyDetectorInfoAction INSTANCE = new SearchAnomalyDetectorInfoAction(); | ||
public static final String NAME = "cluster:admin/opendistro/ad/detector/info"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see PR #284 merged, change to use CommonValue.EXTERNAL_ACTION_PREFIX
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, will take care of it.
Sure had a chat offline, it makes sense to return 0, false when index doesnt exist. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks for the fix. LGTM
*Issue #195 *
Description of changes:
Adding new Search Detector Info API to query total number of detectors and match name with existing detectors.
This API will search across all the detectors in detector index irrespective of User context.
Count Request:
GET _opendistro/_anomaly_detection/detectors/count
Response:
{ "count" : 4, "match" : false }
Match Request:
GET _opendistro/_anomaly_detection/detectors/match?name=opendistro_ad
Response:
{ "count" : 0, "match" : false }
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.