Skip to content

Commit

Permalink
fix to throw appropriate error message
Browse files Browse the repository at this point in the history
Signed-off-by: srikanth padakanti <srikanth29.9@gmail.com>
  • Loading branch information
srikanthpadakanti committed Apr 18, 2024
1 parent 51ed18f commit f7a1951
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ public void testIndicesOptions() {
request.indicesOptions(IndicesOptions.fromParameters("closed", null, null, "false", SearchRequest.DEFAULT_INDICES_OPTIONS));
response = client().execute(RankEvalAction.INSTANCE, request).actionGet();
assertEquals(1, response.getFailures().size());
assertThat(response.getFailures().get("amsterdam_query"), instanceOf(IllegalArgumentException.class));
assertThat(response.getFailures().get("amsterdam_query"), instanceOf(IndexClosedException.class));

// test allow_no_indices
request = new RankEvalRequest(task, new String[] { "bad*" });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ private void checkSystemIndexAccess(Context context, Metadata metadata, Set<Inde
private static boolean shouldTrackConcreteIndex(Context context, IndicesOptions options, IndexMetadata index) {
if (index.getState() == IndexMetadata.State.CLOSE) {
if (options.forbidClosedIndices() && options.ignoreUnavailable() == false) {
if (options.expandWildcardsClosed() == true) {
if (options.expandWildcardsClosed() == true && options.getExpandWildcards().size() == 1) {
throw new IllegalArgumentException(
"To expand [" + index.getState() + "] wildcard, please set forbid_closed_indices to `false`"
);
Expand Down

0 comments on commit f7a1951

Please sign in to comment.