-
Notifications
You must be signed in to change notification settings - Fork 102
Adding new reindex data stream apis #3518
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
Conversation
Following you can find the validation results for the APIs you have changed.
You can validate these APIs yourself by using the |
Following you can find the validation results for the APIs you have changed.
You can validate these APIs yourself by using the |
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.
Thanks! I was able to run our YAML test validation locally, and fixed the relevant issues. I also ran make contrib
to make validation run, even though it's not super useful for now.
(Also, oops, I'm just realizing that I commented my own PR. Feel free to add your fixes there.)
*/ | ||
|
||
import { RequestBase } from '@_types/Base' | ||
import { CreateFrom } from '../_types/CreateFrom' |
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.
Since CreateFrom
is only used in this file, it can be included inline. As mentioned in https://github.com/elastic/elasticsearch-specification/blob/main/docs/add-new-api.md:
Try to use less files as possible, for example there is no need to create a custom file for an enum, you can define it in the same file where it's used, unless is a commonly used type.
/** The source index or data stream name */ | ||
source: string | ||
/** The destination index or data stream name */ | ||
dest: string |
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.
/** The source index or data stream name */ | |
source: string | |
/** The destination index or data stream name */ | |
dest: string | |
/** The source index or data stream name */ | |
source: IndexName | |
/** The destination index or data stream name */ | |
dest: IndexName |
(You will also need to add import { IndexName } from '@_types/common'
at the top of the file.)
export class Response { | ||
body: { | ||
acknowledged: boolean | ||
index: IndexName | ||
shards_acknowledged: boolean | ||
} | ||
} |
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'm wondering, how/why isn't toXContent used? I know it's not a mistake, as it's confirmed by the YAML tests.
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.
Ha, we knew that question would come up, which is why it's in that comment:
/*
* This only exists for the sake of testing the xcontent parser
*/
This is the request, not the response. The response is just AcknowledgedResponse
. The request accepts xcontent. In order to use AbstractXContentSerializingTestCase, we added this toXContent (although for unrelated reasons we later ripped that out and wrote our own xcontent serialization test, and could have moved this toXContent into the unit test).
import { AcknowledgedResponseBase } from '@_types/Base' | ||
|
||
export class Response { | ||
body: AcknowledgedResponseBase |
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'm also confused, why isn't toXContent used?
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.
This is a bug in my PR. I'll fix it.
*/ | ||
|
||
import { RequestBase } from '@_types/Base' | ||
import { MigrateReindex } from '../_types/MigrateReindex' |
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.
As above, since MigrateReindex is only used in this file, it can be included inline.
/** | ||
* Reindex mode. Currently only 'upgrade' is supported. | ||
*/ | ||
mode: string |
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.
source: Index | ||
} | ||
|
||
export class Index { |
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.
Please use a more specific name, maybe SourceIndex
?
import { AcknowledgedResponseBase } from '@_types/Base' | ||
|
||
export class Response { | ||
body: AcknowledgedResponseBase |
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.
Again, toXContent does not appear to be used. (And this is confirmed by the YAML tests.)
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.
This is for historical reasons. The Response originally returned information, but was changed to return nothing other than what AcknowledgeResponse returns. I'll fix that in Elasticsearch.
The request implements toXContent, but that's for serialization testing in the unit test only.
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.
Removed in elastic/elasticsearch#120321. I think this PR is correct as-is though (for this).
Following you can find the validation results for the APIs you have changed.
You can validate these APIs yourself by using the |
Following you can find the validation results for the APIs you have changed.
You can validate these APIs yourself by using the |
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.
Thanks, LGTM! Validation passed locally:
❯ make validate api=migrate.create_from branch=main
Validating endpoints
Validating migrate.create_from
migrate.create_from request has been successfully validated!
✔ 2 out of 2 test request cases are passing.
✔ 2 out of 2 test response cases are passing.
❯ make validate api=migrate.reindex branch=main
Validating endpoints
Validating migrate.reindex
migrate.reindex request has been successfully validated!
✔ 2 out of 2 test request cases are passing.
✔ 2 out of 2 test response cases are passing.
❯ make validate api=migrate.get_reindex_status branch=main
Validating endpoints
Validating migrate.get_reindex_status
migrate.get_reindex_status request has been successfully validated!
✔ 1 out of 1 test request cases are passing.
✔ 1 out of 1 test response cases are passing.
I can't approve my PR. Can you please do it and merge it? Thank you. |
Co-authored-by: Keith Massey <[email protected]> (cherry picked from commit b596a79)
This is a trick to run validation on #3517.
This adds elasticsearch-specification code for the new data stream reindex API. Specifically:
/_migration/reindex
/_migration/reindex/{index}/_status
/_migration/reindex/{index}/_cancel
/_create_from/{source}/{dest}