Skip to content
Merged
Show file tree
Hide file tree
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 @@ -32,6 +32,28 @@ setup:
- do:
indices.refresh: {}

---
"Execute successful search with wait_for_checkpoints default":
- do:
fleet.search:
index: "test-after-refresh"
allow_partial_search_results: false

body: { query: { match_all: {} } }

- match: { _shards.successful: 1 }
- match: { hits.total.value: 2 }

- do:
fleet.search:
index: "test-after-refresh"
allow_partial_search_results: false
wait_for_checkpoints: []
body: { query: { match_all: { } } }

- match: { _shards.successful: 1 }
- match: { hits.total.value: 2 }

---
"Execute successful after refresh search":
- do:
Expand Down Expand Up @@ -114,3 +136,19 @@ setup:
- match: { responses.1._shards.successful: 1 }
- match: { responses.1.hits.total.value: 2 }
- match: { responses.2.error.caused_by.type: "illegal_argument_exception" }

---
"Test msearch wait_for_checkpoints default":
- do:
fleet.msearch:
index: "test-after-refresh"
body:
- { "allow_partial_search_results": false }
- { query: { match_all: { } } }
- { "allow_partial_search_results": false, wait_for_checkpoints: [] }
- { query: { match_all: { } } }

- match: { responses.0._shards.successful: 1 }
- match: { responses.0.hits.total.value: 2 }
- match: { responses.1._shards.successful: 1 }
- match: { responses.1.hits.total.value: 2 }
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient cli
for (int i = 0; i < stringWaitForCheckpoints.length; ++i) {
waitForCheckpoints[i] = Long.parseLong(stringWaitForCheckpoints[i]);
}
searchRequest.setWaitForCheckpoints(Collections.singletonMap("*", waitForCheckpoints));
if (waitForCheckpoints.length != 0) {
searchRequest.setWaitForCheckpoints(Collections.singletonMap("*", waitForCheckpoints));
}
return true;
} else if ("wait_for_checkpoints_timeout".equals(key)) {
final TimeValue waitForCheckpointsTimeout = nodeTimeValue(value, TimeValue.timeValueSeconds(30));
Expand Down Expand Up @@ -96,7 +98,9 @@ protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient cli
}
}
long[] checkpoints = searchRequest.getWaitForCheckpoints().get("*");
searchRequest.setWaitForCheckpoints(Collections.singletonMap(indices[0], checkpoints));
if (checkpoints != null) {
searchRequest.setWaitForCheckpoints(Collections.singletonMap(indices[0], checkpoints));
}
}

return channel -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient cli
"Fleet search API only supports searching a single index. Found: [" + Arrays.toString(indices1) + "]."
);
}
sr.setWaitForCheckpoints(Collections.singletonMap(indices1[0], waitForCheckpoints));
if (waitForCheckpoints.length != 0) {
sr.setWaitForCheckpoints(Collections.singletonMap(indices1[0], waitForCheckpoints));
}
final TimeValue waitForCheckpointsTimeout = request.paramAsTime(
"wait_for_checkpoints_timeout",
TimeValue.timeValueSeconds(30)
Expand Down