-
Notifications
You must be signed in to change notification settings - Fork 6
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
Job for reindexing elastic indexes & move index aliases #258
Conversation
Makes the reindex API available
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.
...
@Override | ||
protected void collectParameters(Consumer<Parameter<?, ?>> parameterCollector) { | ||
if (stringParameter == null) { | ||
stringParameter = new StringParameter("destination", NLS.get("MoveIndexAliasJobFactory.destinationParameter")); |
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.
do not cache the parameter here, as NLS.get is dependent on the user locale - so the first user would determine the parameter name for all successive calls
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.
simply use collector.accept(new StringParameter(...).markRequired())
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.
or even better - initialize the fields directly and uses a constant for label as it will be auto translated
@Override | ||
protected void collectParameters(Consumer<Parameter<?, ?>> parameterCollector) { | ||
if (entityDescriptorParameter == null) { | ||
entityDescriptorParameter = new ElasticEntityDescriptorParameter("ed", NLS.get("ReindexJobFactory.descriptorParameter")); |
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.
s.a.
private Elastic elastic; | ||
|
||
private ElasticEntityDescriptorParameter entityDescriptorParameter = null; | ||
private StringParameter stringParameter = null; |
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.
private StringParameter stringParameter = null; | |
private StringParameter stringParameter = new StringParameter("destination", "MoveIndexAliasJobFactory.destinationParameter"); |
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.
- .markRequired()
@Part | ||
private Elastic elastic; | ||
|
||
private ElasticEntityDescriptorParameter entityDescriptorParameter = null; |
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.
private ElasticEntityDescriptorParameter entityDescriptorParameter = null; | |
private ElasticEntityDescriptorParameter entityDescriptorParameter = new ElasticEntityDescriptorParameter("ed", "MoveIndexAliasJobFactory.descriptorParameter").markRequired(); |
* Implements a job which reindexes a given index in elastic. | ||
*/ | ||
@Register(classes = JobFactory.class) | ||
public class ReindexJobFactory extends BatchProcessJobFactory { |
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.
@Permission(TenantUserManager.PERMISSION_SYSTEM_TENANT)
|
||
@Override | ||
public String getCategory() { | ||
return "MAINTENANCE"; |
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.
JobCategory.CATEGORY_MISC
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.
...
(ElasticEntityDescriptorParameter) new ElasticEntityDescriptorParameter("ed", | ||
"$MoveIndexAliasJobFactory.descriptorParameter") | ||
.markRequired(); | ||
private StringParameter stringParameter = |
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.
destinationParameter
|
||
@Override | ||
protected String createProcessTitle(Map<String, String> context) { | ||
return "MoveIndexAlias"; |
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.
something like Strings.apply("Movin Elasticsearch Index %s to %s, ....) - would be very nice
|
||
@Override | ||
protected String createProcessTitle(Map<String, String> context) { | ||
return "Reindex"; |
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.
s.a.
No description provided.