Skip to content
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

set the refresh policy to IMMEDIATE when updating correlation alerts #1382

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,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.client.Client;
import org.opensearch.common.lucene.uid.Versions;
Expand Down Expand Up @@ -212,9 +213,10 @@ public void acknowledgeAlerts(List<String> alertIds, ActionListener<AckCorrelati
client.search(searchRequest, new ActionListener<SearchResponse>() {
@Override
public void onResponse(SearchResponse searchResponse) {
// Set the refresh policy on the BulkRequest
bulkRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
// Iterate through the search hits
for (SearchHit hit : searchResponse.getHits().getHits()) {
// Construct a script to update the document with the new state and acknowledgedTime
// Construct a script to update the document with the new state and acknowledgedTime
Script script = new Script(ScriptType.INLINE, "painless",
"ctx._source.state = params.state; ctx._source.acknowledged_time = params.time",
Expand Down
Loading