Add delete rollup job support to HL REST Client#34066
Add delete rollup job support to HL REST Client#34066pcsanwald merged 14 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/es-core-infra |
...nt/rest-high-level/src/main/java/org/elasticsearch/client/rollup/DeleteRollupJobRequest.java
Show resolved
Hide resolved
iverase
left a comment
There was a problem hiding this comment.
In general looks good. Maybe we should add this action to the IT tests:
org.elasticsearch.client.RollupIT
WDYT?
|
@iverase good call, I'll add a test in |
| } | ||
|
|
||
| /** | ||
| * delete a rollup job from the cluster |
|
|
||
| private final String id; | ||
|
|
||
| private static final ParseField ID_FIELD = new ParseField("id"); |
There was a problem hiding this comment.
Nit: We usually place static constants at the beginning of the class, then class members
| private static final ParseField ID_FIELD = new ParseField("id"); | ||
|
|
||
| public DeleteRollupJobRequest(String id) { | ||
| this.id = Objects.requireNonNull(id,"id parameter must not be null"); |
| return PARSER.parse(parser, null); | ||
| } | ||
|
|
||
| private static final ConstructingObjectParser<DeleteRollupJobResponse, Void> PARSER |
There was a problem hiding this comment.
I think we could move the declaration of the PARSER into the AcknowledgedResponse class so that we don't have to repeat the parsing logic in DeleteRollupJobResponse and PutRollupJobResponse?
There was a problem hiding this comment.
originally I tried to do this, but it's a static field and I couldn't work out a way to pass the concrete type without using some kind of builder thing, which felt like overkill for a small amount of duplication. Am I missing an easy way to do this?
There was a problem hiding this comment.
I was thinking of something like declareInnerHitsParseFields or declareAggregationFields (in ParsedAggregation). But I agree this is a bit overkill :)
| } catch (Exception e) { | ||
| // Swallow any exception, this test does not test actually cancelling. | ||
| } | ||
|
|
...t-high-level/src/test/java/org/elasticsearch/client/documentation/RollupDocumentationIT.java
Show resolved
Hide resolved
| [[java-rest-high-x-pack-rollup-delete-job]] | ||
| === Delete Rollup Job API | ||
|
|
||
| The Delete Rollup Job API can be used to create a new Rollup job |
|
|
||
| The Delete Rollup Job API can be used to create a new Rollup job | ||
| in the cluster. The API accepts a `PutRollupJobRequest` object | ||
| as a request and returns a `PutRollupJobResponse`. |
There was a problem hiding this comment.
We now have a mecanism to avoid repeating this section, can you use it? (with DeleteRollupJobRequest instead of PutRollupJobRequest)
There was a problem hiding this comment.
I'd like to do this in a follow up PR: because there is a lot of re-use of RollupDocumentationIT across these, I'd like to just move (get|put|delete) job all at once, and adding that stuff to this PR doesn't feel right to me. I'll open the PR as soon as this is merged. seem reasonable?
| DeleteRollupJobResponse::fromXContent, | ||
| Collections.emptySet()); | ||
| } | ||
| /** |
iverase
left a comment
There was a problem hiding this comment.
LGTM, just a minor comment
Add support for delete rollup job to HL REST Client.
|
hey this needs backporting to 6.x |
|
backported in #35045 |
Related to #29827, add support for deletion of a job to HLRC. A few notes on the PR:
AcknowledgedResponseto remove a small bit of duplication