Skip to content

Commit

Permalink
Add refresh policy for writing operation
Browse files Browse the repository at this point in the history
Signed-off-by: zane-neo <[email protected]>
  • Loading branch information
zane-neo committed Jul 30, 2024
1 parent fbee668 commit da12117
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.opensearch.action.index.IndexResponse;
import org.opensearch.action.search.SearchRequest;
import org.opensearch.action.search.SearchResponse;
import org.opensearch.action.support.WriteRequest;
import org.opensearch.action.update.UpdateRequest;
import org.opensearch.action.update.UpdateResponse;
import org.opensearch.client.Client;
Expand Down Expand Up @@ -490,7 +491,7 @@ public void deleteConversation(String conversationId, ActionListener<Boolean> li
internalListener.onResponse(true);
return;
}
BulkRequest request = Requests.bulkRequest();
BulkRequest request = Requests.bulkRequest().setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
for (Interaction interaction : interactions) {
DeleteRequest delRequest = Requests.deleteRequest(INTERACTIONS_INDEX_NAME).id(interaction.getId());
request.add(delRequest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ private void updateModelWithRegisteringToAnotherModelGroup(
ActionListener<UpdateResponse> wrappedListener,
boolean isUpdateModelCache
) {
UpdateRequest updateRequest = new UpdateRequest(ML_MODEL_INDEX, modelId);
UpdateRequest updateRequest = new UpdateRequest(ML_MODEL_INDEX, modelId).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
if (newModelGroupId != null) {
modelAccessControlHelper
.validateModelGroupAccess(user, newModelGroupId, client, ActionListener.wrap(hasNewModelGroupPermission -> {
Expand Down

0 comments on commit da12117

Please sign in to comment.