-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[rule based autotagging] Add Create Rule API Logic #17335
base: main
Are you sure you want to change the base?
Conversation
❌ Gradle check result for bab1e6e: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
bab1e6e
to
3c4c098
Compare
❌ Gradle check result for 3c4c098: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Signed-off-by: Ruirui Zhang <[email protected]>
3c4c098
to
27567d7
Compare
❌ Gradle check result for 27567d7: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
@@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | |||
- Add dynamic setting allowing size > 0 requests to be cached in the request cache ([#16483](https://github.com/opensearch-project/OpenSearch/pull/16483)) | |||
- Support installing plugin SNAPSHOTs with SNASPHOT distribution ([#16581](https://github.com/opensearch-project/OpenSearch/pull/16581)) | |||
- Make IndexStoreListener a pluggable interface ([#16583](https://github.com/opensearch-project/OpenSearch/pull/16583)) | |||
- Add create rule api logic for rule-based auto tagging ([#17335](https://github.com/opensearch-project/OpenSearch/pull/17335)) |
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.
We should add the project name in the beginning since it will help the viewer to set the context faster without reading the full line, e,g;
[Rule based auto-tagging] Add create rule API
/** | ||
* Default constructor | ||
*/ |
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.
We should try to put meaningful comments if there is absolute need. In this case This is not a default constructor but to ensure that the created instances are created in the class scope only.
* @opensearch.experimental | ||
*/ | ||
public class CreateRuleResponse extends ActionResponse implements ToXContent, ToXContentObject { | ||
private final String _id; |
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.
If the Rule object is already carrying the id then this is redundant information.
import org.opensearch.action.ActionType; | ||
|
||
/** | ||
* Transport action to create Rule |
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 think the comment is misleading here because the class is not a TransportAction
class but it defines the type for the action which is used to define the mappings at co-ordinator and/or shard level request handling.
import java.util.Map; | ||
|
||
/** | ||
* This class defines the functions for Rule persistence |
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 think the following javadoc is more effective description of the class
This class encapsulates the logic to manage the lifecycle of rules at index level
/** | ||
* client getter | ||
*/ | ||
public Client getClient() { | ||
return client; | ||
} | ||
|
||
/** | ||
* clusterService getter | ||
*/ | ||
public ClusterService getClusterService() { | ||
return clusterService; | ||
} |
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.
What is the use case for exposing these members ? I think it should not be required because the responsibility of the class is to deal with persistance of the Rules
public void onResponse(Boolean indexCreated) { | ||
persistRule(rule, listener); |
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.
We are not using the method param here. I think either we should remove this or make use of it to justify it in the method signature
Description
This PR introduces the create Rule API Logic.
An exampe API request is:
And the return would be
Rule Schema PR:
#17238
RFC:
#16797
Check List