-
Notifications
You must be signed in to change notification settings - Fork 24.6k
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
Handle multiple aliases in _cat/aliases api #23698
Changes from 9 commits
cda0a1a
8bb045f
441ea05
6d00ca6
3b9c5fd
3d70207
b4fc1dd
4242b6d
71b9b8c
a691f5f
deaf391
0caed07
4d64514
e157eb4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,7 @@ public RestAliasAction(Settings settings, RestController controller) { | |
@Override | ||
protected RestChannelConsumer doCatRequest(final RestRequest request, final NodeClient client) { | ||
final GetAliasesRequest getAliasesRequest = request.hasParam("alias") ? | ||
new GetAliasesRequest(request.param("alias")) : | ||
new GetAliasesRequest(request.param("alias").split(",")) : | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you could use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't knew about this class. I will use it. |
||
new GetAliasesRequest(); | ||
getAliasesRequest.local(request.paramAsBoolean("local", getAliasesRequest.local())); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,6 +126,48 @@ | |
- match: | ||
$body: / (^|\n)test_2 .+ \n/ | ||
|
||
--- | ||
"Multiple alias names": | ||
|
||
- do: | ||
indices.create: | ||
index: test | ||
|
||
- do: | ||
indices.create: | ||
index: test2 | ||
- do: | ||
indices.create: | ||
index: test3 | ||
|
||
- do: | ||
indices.put_alias: | ||
index: test | ||
name: foo | ||
|
||
- do: | ||
indices.put_alias: | ||
index: test2 | ||
name: bar | ||
- do: | ||
indices.put_alias: | ||
index: test3 | ||
name: baz | ||
|
||
- do: | ||
cat.aliases: | ||
name: foo,bar | ||
|
||
- match: | ||
$body: /(^|\n)foo\s+test / | ||
|
||
- match: | ||
$body: /(^|\n)bar\s+test2 / | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that this test should add a third index, and a third alias, and not request that alias (as you've already done) just so that we can be sure that a non-requested alias is not returned. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will do that |
||
- match: | ||
$body: /(^|\n)[^bar\s+test3] / | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can and should make a stronger assertion here. We can request only the
|
||
|
||
|
||
--- | ||
"Column headers": | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should consider changing the parameter from
alias
toaliases
as it is misleading to pack alist
inalias
.