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 @@ -16,6 +16,8 @@
import org.elasticsearch.action.admin.indices.get.GetIndexRequest.Feature;
import org.elasticsearch.action.admin.indices.get.GetIndexResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.IndicesOptions.Option;
import org.elasticsearch.action.support.IndicesOptions.WildcardStates;
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.metadata.AliasMetaData;
import org.elasticsearch.cluster.metadata.MappingMetaData;
Expand Down Expand Up @@ -117,6 +119,10 @@ public boolean equals(Object obj) {
}
}

private static final IndicesOptions INDICES_ONLY_OPTIONS = new IndicesOptions(
EnumSet.of(Option.ALLOW_NO_INDICES, Option.IGNORE_UNAVAILABLE, Option.IGNORE_ALIASES), EnumSet.of(WildcardStates.OPEN));


private final Client client;
private final String clusterName;

Expand Down Expand Up @@ -144,7 +150,6 @@ public void resolveNames(String indexWildcard, String javaRegex, EnumSet<IndexTy
if (retrieveAliases) {
GetAliasesRequest aliasRequest = new GetAliasesRequest()
.local(true)
.indices(indices)
.aliases(indices)
.indicesOptions(IndicesOptions.lenientExpandOpen());

Expand Down Expand Up @@ -176,7 +181,7 @@ private void resolveIndices(String[] indices, String javaRegex, GetAliasesRespon
.indices(indices)
.features(Feature.SETTINGS)
.includeDefaults(false)
.indicesOptions(IndicesOptions.lenientExpandOpen());
.indicesOptions(INDICES_ONLY_OPTIONS);

client.admin().indices().getIndex(indexRequest,
ActionListener.wrap(response -> filterResults(javaRegex, aliases, response, listener),
Expand Down
8 changes: 8 additions & 0 deletions x-pack/qa/sql/src/main/resources/command.csv-spec
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@ test_emp_copy |BASE TABLE
test_emp_with_nulls|BASE TABLE
;

showTablesIdentifierPatternOnAliases
SHOW TABLES "test*,-test_emp*";

name:s | type:s
test_alias |ALIAS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see how this one should show aliases. Can you add a test that shouldn't show aliases so that it hits more of the change you made above?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately that doesn't currently work; I've raised a bug for it: #33395

test_alias_emp |ALIAS
;

// DESCRIBE

describeSimpleLike
Expand Down