Commit 5c5d723
authored
Improve error message when aliases are not supported (#25728)
With #23997 and #25268 we have changed put alias, delete alias, update aliases and delete index to not accept aliases. Instead concrete indices should be provided as their index parameter.
This commit improves the error message in case aliases are provided, from an IndexNotFoundException (404 status code) with "no such index" message, to an IllegalArgumentException (400 status code) with "The provided expression [alias] matches an alias, specify the corresponding concrete indices instead." message.
Note that there is no specific error message for the case where wildcard expressions match one or more aliases. In fact, aliases are simply ignored when expanding wildcards for such APIs. An error is thrown only when the expression ends up matching no indices at all, and allow_no_indices is set to false. In that case the error is still the generic "404 - no such index".1 parent ff4a251 commit 5c5d723
File tree
5 files changed
+181
-86
lines changed- core/src
- main/java/org/elasticsearch/cluster/metadata
- test/java/org/elasticsearch
- aliases
- cluster/metadata
- rest-api-spec/src/main/resources/rest-api-spec/test/indices.delete
5 files changed
+181
-86
lines changedLines changed: 26 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | | - | |
| 178 | + | |
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
186 | 192 | | |
187 | 193 | | |
188 | 194 | | |
| |||
192 | 198 | | |
193 | 199 | | |
194 | 200 | | |
195 | | - | |
| 201 | + | |
| 202 | + | |
196 | 203 | | |
197 | 204 | | |
198 | 205 | | |
| |||
220 | 227 | | |
221 | 228 | | |
222 | 229 | | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
223 | 235 | | |
224 | 236 | | |
225 | 237 | | |
| |||
270 | 282 | | |
271 | 283 | | |
272 | 284 | | |
273 | | - | |
274 | | - | |
| 285 | + | |
275 | 286 | | |
276 | 287 | | |
277 | 288 | | |
| |||
588 | 599 | | |
589 | 600 | | |
590 | 601 | | |
591 | | - | |
| 602 | + | |
592 | 603 | | |
593 | 604 | | |
594 | 605 | | |
| |||
608 | 619 | | |
609 | 620 | | |
610 | 621 | | |
611 | | - | |
612 | | - | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
613 | 630 | | |
614 | 631 | | |
615 | 632 | | |
| |||
628 | 645 | | |
629 | 646 | | |
630 | 647 | | |
631 | | - | |
| 648 | + | |
632 | 649 | | |
633 | 650 | | |
634 | 651 | | |
| |||
637 | 654 | | |
638 | 655 | | |
639 | 656 | | |
640 | | - | |
641 | | - | |
642 | | - | |
643 | | - | |
644 | 657 | | |
645 | 658 | | |
646 | 659 | | |
647 | 660 | | |
648 | 661 | | |
649 | 662 | | |
650 | | - | |
| 663 | + | |
651 | 664 | | |
652 | 665 | | |
653 | 666 | | |
| |||
Lines changed: 9 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
40 | | - | |
41 | 39 | | |
42 | 40 | | |
43 | 41 | | |
| |||
442 | 440 | | |
443 | 441 | | |
444 | 442 | | |
445 | | - | |
| 443 | + | |
446 | 444 | | |
| 445 | + | |
| 446 | + | |
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
| |||
824 | 824 | | |
825 | 825 | | |
826 | 826 | | |
827 | | - | |
| 827 | + | |
828 | 828 | | |
829 | | - | |
830 | | - | |
| 829 | + | |
| 830 | + | |
831 | 831 | | |
832 | 832 | | |
833 | 833 | | |
| |||
916 | 916 | | |
917 | 917 | | |
918 | 918 | | |
919 | | - | |
| 919 | + | |
920 | 920 | | |
| 921 | + | |
| 922 | + | |
921 | 923 | | |
922 | 924 | | |
923 | 925 | | |
| |||
Lines changed: 28 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
657 | 657 | | |
658 | 658 | | |
659 | 659 | | |
660 | | - | |
| 660 | + | |
661 | 661 | | |
662 | | - | |
| 662 | + | |
| 663 | + | |
663 | 664 | | |
664 | 665 | | |
665 | 666 | | |
| |||
1005 | 1006 | | |
1006 | 1007 | | |
1007 | 1008 | | |
| 1009 | + | |
1008 | 1010 | | |
1009 | 1011 | | |
1010 | | - | |
| 1012 | + | |
1011 | 1013 | | |
1012 | | - | |
| 1014 | + | |
| 1015 | + | |
1013 | 1016 | | |
1014 | 1017 | | |
1015 | 1018 | | |
| |||
1049 | 1052 | | |
1050 | 1053 | | |
1051 | 1054 | | |
1052 | | - | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
1053 | 1059 | | |
1054 | 1060 | | |
1055 | 1061 | | |
1056 | | - | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
1057 | 1065 | | |
1058 | 1066 | | |
1059 | 1067 | | |
| |||
1069 | 1077 | | |
1070 | 1078 | | |
1071 | 1079 | | |
1072 | | - | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
1073 | 1084 | | |
1074 | 1085 | | |
1075 | 1086 | | |
1076 | | - | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
1077 | 1090 | | |
1078 | 1091 | | |
1079 | 1092 | | |
| |||
1089 | 1102 | | |
1090 | 1103 | | |
1091 | 1104 | | |
1092 | | - | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
1093 | 1109 | | |
1094 | 1110 | | |
1095 | 1111 | | |
1096 | | - | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
1097 | 1115 | | |
1098 | 1116 | | |
1099 | 1117 | | |
| |||
0 commit comments