Skip to content

Commit

Permalink
Switch to readable
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks committed Feb 7, 2025
1 parent 4157ea0 commit 7bbfd04
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public Index[] concreteIndices(ClusterState state, IndicesRequest request, long
request.includeDataStreams(),
false,
isSystemIndexAccessAllowed(),
false
true
);
return concreteIndices(context, request.indices());
}
Expand Down Expand Up @@ -373,7 +373,7 @@ private void checkSystemIndexAccess(Context context, Metadata metadata, Set<Inde
.stream()
.findFirst()
.orElse(null);
if (descriptor != null && descriptor.isSearchable() && context.isSearchRequest()) {
if (descriptor != null && descriptor.isReadable() && context.isReadRequest()) {
continue;
}
deprecationLogger.deprecate(
Expand Down Expand Up @@ -798,7 +798,7 @@ public static class Context {
private final boolean includeDataStreams;
private final boolean preserveDataStreams;
private final boolean isSystemIndexAccessAllowed;
private final boolean isSearchRequest;
private final boolean isReadRequest;

Context(ClusterState state, IndicesOptions options, boolean isSystemIndexAccessAllowed) {
this(state, options, System.currentTimeMillis(), isSystemIndexAccessAllowed);
Expand Down Expand Up @@ -860,7 +860,7 @@ protected Context(
boolean includeDataStreams,
boolean preserveDataStreams,
boolean isSystemIndexAccessAllowed,
boolean isSearchRequest
boolean isReadRequest
) {
this.state = state;
this.options = options;
Expand All @@ -870,7 +870,7 @@ protected Context(
this.includeDataStreams = includeDataStreams;
this.preserveDataStreams = preserveDataStreams;
this.isSystemIndexAccessAllowed = isSystemIndexAccessAllowed;
this.isSearchRequest = isSearchRequest;
this.isReadRequest = isReadRequest;
}

public ClusterState getState() {
Expand Down Expand Up @@ -910,8 +910,8 @@ public boolean isPreserveDataStreams() {
return preserveDataStreams;
}

public boolean isSearchRequest() {
return isSearchRequest;
public boolean isReadRequest() {
return isReadRequest;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class SystemIndexDescriptor {
private final String indexPattern;
private final String description;
private final CharacterRunAutomaton indexPatternAutomaton;
private boolean searchable;
private boolean readable;

/**
*
Expand Down Expand Up @@ -106,23 +106,24 @@ public String getDescription() {
}

/**
* Set whether this system index is searchable. Defaults to false.
* @param searchable Whether this system index is searchable.
* Set whether this system index is readable. Defaults to false.
* @param readable Whether this system index is readable. A readable index is one where search and get
* actions are permitted.
*/
public void setSearchable(boolean searchable) {
this.searchable = searchable;
public void setReadable(boolean readable) {
this.readable = readable;
}

/**
* @return A boolean corresponding to whether this system index is searchable.
* @return A boolean corresponding to whether this system index is readable.
*/
public boolean isSearchable() {
return searchable;
public boolean isReadable() {
return readable;
}

@Override
public String toString() {
return "SystemIndexDescriptor[pattern=[" + indexPattern + "], description=[" + description + "], searchable=[" + searchable + "]]";
return "SystemIndexDescriptor[pattern=[" + indexPattern + "], description=[" + description + "], readable=[" + readable + "]]";
}

@Override
Expand Down

0 comments on commit 7bbfd04

Please sign in to comment.