Skip to content

Fix rest validation of search request using a PIT #71688

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

Merged
merged 4 commits into from
Apr 20, 2021
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 @@ -297,7 +297,7 @@ public static void writeSearchRequestParams(SearchRequest request, XContentBuild
if (request.indices() != null) {
xContentBuilder.field("index", request.indices());
}
if (request.indicesOptions() != null && request.indicesOptions() != SearchRequest.DEFAULT_INDICES_OPTIONS) {
if (request.indicesOptions().equals(SearchRequest.DEFAULT_INDICES_OPTIONS) == false) {
WildcardStates.toXContent(request.indicesOptions().getExpandWildcards(), xContentBuilder);
xContentBuilder.field("ignore_unavailable", request.indicesOptions().ignoreUnavailable());
xContentBuilder.field("allow_no_indices", request.indicesOptions().allowNoIndices());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ && request().indicesOptions() != IndicesOptions.strictExpandOpenAndForbidClosed(
* same order as the search requests.
*/
public MultiSearchRequestBuilder add(SearchRequestBuilder request) {
if (request.request().indicesOptions() == SearchRequest.DEFAULT_INDICES_OPTIONS
&& request().indicesOptions() != SearchRequest.DEFAULT_INDICES_OPTIONS) {
if (request.request().indicesOptions().equals(SearchRequest.DEFAULT_INDICES_OPTIONS)
&& request().indicesOptions().equals(SearchRequest.DEFAULT_INDICES_OPTIONS) == false) {
request.request().indicesOptions(request().indicesOptions());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import java.util.function.IntConsumer;

import static org.elasticsearch.action.ValidateActions.addValidationError;
import static org.elasticsearch.action.search.SearchRequest.DEFAULT_INDICES_OPTIONS;
import static org.elasticsearch.common.unit.TimeValue.parseTimeValue;
import static org.elasticsearch.rest.RestRequest.Method.GET;
import static org.elasticsearch.rest.RestRequest.Method.POST;
Expand Down Expand Up @@ -291,7 +292,7 @@ static void preparePointInTime(SearchRequest request, RestRequest restRequest, N
if (request.indices().length > 0) {
validationException = addValidationError("[indices] cannot be used with point in time", validationException);
}
if (request.indicesOptions() != SearchRequest.DEFAULT_INDICES_OPTIONS) {
if (request.indicesOptions().equals(DEFAULT_INDICES_OPTIONS) == false) {
validationException = addValidationError("[indicesOptions] cannot be used with point in time", validationException);
}
if (request.routing() != null) {
Expand Down