Skip to content

Commit 5100fe0

Browse files
authored
DATES-821 - Fix code for adding an alias.
Original PR: #451
1 parent a4fd008 commit 5100fe0

File tree

2 files changed

+41
-3
lines changed

2 files changed

+41
-3
lines changed

src/main/java/org/springframework/data/elasticsearch/core/RequestFactory.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,20 @@ public IndicesAliasesRequest.AliasActions aliasAction(AliasQuery query, IndexCoo
107107
aliasAction.filter(query.getFilterBuilder());
108108
} else if (query.getFilter() != null) {
109109
aliasAction.filter(query.getFilter());
110-
} else if (!StringUtils.isEmpty(query.getRouting())) {
110+
}
111+
112+
if (!StringUtils.isEmpty(query.getRouting())) {
111113
aliasAction.routing(query.getRouting());
112-
} else if (!StringUtils.isEmpty(query.getSearchRouting())) {
114+
}
115+
116+
if (!StringUtils.isEmpty(query.getSearchRouting())) {
113117
aliasAction.searchRouting(query.getSearchRouting());
114-
} else if (!StringUtils.isEmpty(query.getIndexRouting())) {
118+
}
119+
120+
if (!StringUtils.isEmpty(query.getIndexRouting())) {
115121
aliasAction.indexRouting(query.getIndexRouting());
116122
}
123+
117124
return aliasAction;
118125
}
119126

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright 2020 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.data.elasticsearch.config.notnested;
17+
18+
import org.springframework.context.annotation.Configuration;
19+
import org.springframework.context.annotation.Import;
20+
import org.springframework.data.elasticsearch.junit.jupiter.ElasticsearchTemplateConfiguration;
21+
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
22+
23+
/**
24+
* @author Peter-Josef Meisch
25+
*/
26+
public class EnableElasticsearchRepositoriesTransportTests extends EnableElasticsearchRepositoriesTests {
27+
@Configuration
28+
@Import({ ElasticsearchTemplateConfiguration.class })
29+
@EnableElasticsearchRepositories(considerNestedRepositories = true)
30+
static class Config {}
31+
}

0 commit comments

Comments
 (0)