Skip to content

Commit 51f9485

Browse files
committed
DATAES-421 updated to latest version of ES 6.2.2
1 parent e7b93be commit 51f9485

File tree

7 files changed

+72
-13
lines changed

7 files changed

+72
-13
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<properties>
2020
<commonscollections>3.2.1</commonscollections>
2121
<commonslang>2.6</commonslang>
22-
<elasticsearch>6.1.0</elasticsearch>
22+
<elasticsearch>6.2.2</elasticsearch>
2323
<log4j>2.9.1</log4j>
2424
<springdata.commons>2.1.0.BUILD-SNAPSHOT</springdata.commons>
2525
<java-module-name>spring.data.elasticsearch</java-module-name>

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.io.IOException;
3030
import java.io.InputStreamReader;
3131
import java.util.*;
32+
import java.util.stream.Collectors;
3233

3334
import org.elasticsearch.action.ActionFuture;
3435
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
@@ -961,16 +962,9 @@ public <T> Map getSetting(Class<T> clazz) {
961962
@Override
962963
public Map getSetting(String indexName) {
963964
Assert.notNull(indexName, "No index defined for getSettings");
964-
Settings settings = client.admin().indices().getSettings(new GetSettingsRequest()).actionGet().getIndexToSettings()
965-
.get(indexName);
966-
967-
SortedMap<String, String> settingsMap = new TreeMap<>();
968-
969-
settings.keySet().forEach((key) -> {
970-
settingsMap.put(key, String.valueOf(settings.get(key)));
971-
});
972-
973-
return Collections.unmodifiableSortedMap(settingsMap);
965+
Settings settings = client.admin().indices().getSettings(new GetSettingsRequest()).actionGet()
966+
.getIndexToSettings().get(indexName);
967+
return settings.keySet().stream().collect(Collectors.toMap((key)->key, (key)->settings.get(key)));
974968
}
975969

976970
private <T> SearchRequestBuilder prepareSearch(Query query, Class<T> clazz) {
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Licensed to Elasticsearch under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.elasticsearch.plugins;
21+
22+
import java.security.AccessController;
23+
import java.security.PrivilegedAction;
24+
import java.util.Collections;
25+
import java.util.List;
26+
27+
/**
28+
* A classloader that is a union over the parent core classloader and classloaders of extended plugins.
29+
* Cloned from ES repository
30+
* - that file is only available in ES server libs
31+
* - and we need it o create a node client for unittests
32+
*/
33+
public class ExtendedPluginsClassLoader extends ClassLoader {
34+
35+
/** Loaders of plugins extended by a plugin. */
36+
private final List<ClassLoader> extendedLoaders;
37+
38+
private ExtendedPluginsClassLoader(ClassLoader parent, List<ClassLoader> extendedLoaders) {
39+
super(parent);
40+
this.extendedLoaders = Collections.unmodifiableList(extendedLoaders);
41+
}
42+
43+
@Override
44+
protected Class<?> findClass(String name) throws ClassNotFoundException {
45+
for (ClassLoader loader : extendedLoaders) {
46+
try {
47+
return loader.loadClass(name);
48+
} catch (ClassNotFoundException e) {
49+
// continue
50+
}
51+
}
52+
throw new ClassNotFoundException(name);
53+
}
54+
55+
/**
56+
* Return a new classloader across the parent and extended loaders.
57+
*/
58+
public static ExtendedPluginsClassLoader create(ClassLoader parent, List<ClassLoader> extendedLoaders) {
59+
return AccessController.doPrivileged((PrivilegedAction<ExtendedPluginsClassLoader>)
60+
() -> new ExtendedPluginsClassLoader(parent, extendedLoaders));
61+
}
62+
}
Binary file not shown.

src/test/resources/test-home-dir/modules/lang-expression/plugin-descriptor.properties

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
description=Lucene expressions integration for Elasticsearch
2323
#
2424
# 'version': plugin's version
25-
version=6.1.0
25+
version=6.2.2
2626
#
2727
# 'name': the plugin name
2828
name=lang-expression
@@ -37,9 +37,12 @@ classname=org.elasticsearch.script.expression.ExpressionPlugin
3737
java.version=1.8
3838
#
3939
# 'elasticsearch.version': version of elasticsearch compiled against
40-
elasticsearch.version=6.1.0
40+
elasticsearch.version=6.2.2
4141
### optional elements for plugins:
4242
#
43+
# 'extended.plugins': other plugins this plugin extends through SPI
44+
extended.plugins=
45+
#
4346
# 'has.native.controller': whether or not the plugin has a native controller
4447
has.native.controller=false
4548
#

0 commit comments

Comments
 (0)