-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Weighted Routing] [Backport 2.x] Disallow search request with prefer…
…ence parameter when weighted routing enabled (#6042) * Disallow search request with preference parameter when weighted routing enabled (#5874) * Disallow preference search with strict weighted shard routing Signed-off-by: Anshu Agarwal <[email protected]>
- Loading branch information
Showing
7 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...rc/main/java/org/opensearch/cluster/routing/PreferenceBasedSearchNotAllowedException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.cluster.routing; | ||
|
||
import org.opensearch.OpenSearchException; | ||
import org.opensearch.common.io.stream.StreamInput; | ||
import org.opensearch.rest.RestStatus; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* Thrown to disallow preference based search with strict weighted shard routing. See {@link WeightedRoutingService} | ||
* * for more details. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public class PreferenceBasedSearchNotAllowedException extends OpenSearchException { | ||
|
||
public PreferenceBasedSearchNotAllowedException(StreamInput in) throws IOException { | ||
super(in); | ||
} | ||
|
||
public PreferenceBasedSearchNotAllowedException(String msg, Object... args) { | ||
super(msg, args); | ||
} | ||
|
||
@Override | ||
public RestStatus status() { | ||
return RestStatus.FORBIDDEN; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters