Skip to content
This repository was archived by the owner on Dec 11, 2024. It is now read-only.

Commit f7c8bb4

Browse files
committed
Merge branch 'Issue#212' into 2.4.0.RC2
2 parents bbe402e + bcb8805 commit f7c8bb4

File tree

4 files changed

+24
-19
lines changed

4 files changed

+24
-19
lines changed

grails-app/conf/application.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,19 @@ environments:
9393
datastoreImpl: hibernateDatastore
9494
index:
9595
store.type: simplefs
96-
analysis:
97-
filter:
98-
replace_synonyms:
99-
type: synonym
100-
synonyms: ['abc => xyz']
101-
analyzer:
102-
test_analyzer:
103-
tokenizer: standard
104-
filter: ['lowercase']
105-
repl_analyzer:
106-
tokenizer: standard
107-
filter: ['lowercase', 'replace_synonyms']
96+
settings:
97+
analysis:
98+
filter:
99+
replace_synonyms:
100+
type: synonym
101+
synonyms: ['abc => xyz']
102+
analyzer:
103+
test_analyzer:
104+
tokenizer: standard
105+
filter: ['lowercase']
106+
repl_analyzer:
107+
tokenizer: standard
108+
filter: ['lowercase', 'replace_synonyms']
108109
production:
109110
elasticSearch:
110111
client:

grails-app/conf/plugin.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ elasticSearch {
6868
*/
6969
migration.disableAliasChange = false
7070

71-
index.numberOfReplicas = 0
71+
index.settings.numberOfReplicas = 0
7272

7373
/**
7474
* Whether to index and search all non excluded transient properties. All explicitly included transients in @only@ will be indexed regardless.

src/main/groovy/grails/plugins/elasticsearch/mapping/SearchableClassMappingConfigurator.groovy

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,21 +187,21 @@ class SearchableClassMappingConfigurator implements ElasticSearchConfigAware {
187187
}
188188

189189
private Map<String, Object> buildIndexSettings() {
190-
Map<String, Object> indexSettings = new HashMap<String, Object>()
191-
indexSettings.put("number_of_replicas", numberOfReplicas())
190+
Map<String, Object> settings = new HashMap<String, Object>()
191+
settings.put("number_of_replicas", numberOfReplicas())
192192
// Look for default index settings.
193193
if (esConfig != null) {
194-
Map<String, Object> indexDefaults = esConfig.get("index") as Map<String, Object>
194+
Map<String, Object> indexDefaults = indexSettings as Map<String, Object>
195195
LOG.debug("Retrieved index settings")
196196
if (indexDefaults != null) {
197197
for (Map.Entry<String, Object> entry : indexDefaults.entrySet()) {
198198
String key = entry.getKey();
199199
if(key == 'numberOfReplicas') key = 'number_of_replicas'
200-
indexSettings.put("index." + key, entry.getValue())
200+
settings.put("index." + key, entry.getValue())
201201
}
202202
}
203203
}
204-
indexSettings
204+
settings
205205
}
206206

207207
private Map<SearchableClassMapping, Map> buildElasticMappings(Collection<SearchableClassMapping> mappings) {
@@ -215,7 +215,7 @@ class SearchableClassMappingConfigurator implements ElasticSearchConfigAware {
215215
}
216216

217217
private int numberOfReplicas() {
218-
def defaultNumber = (esConfig.index as ConfigObject).numberOfReplicas
218+
def defaultNumber = indexSettings.numberOfReplicas
219219
if (!defaultNumber) {
220220
return 0
221221
}

src/main/groovy/grails/plugins/elasticsearch/util/ElasticSearchConfigAware.groovy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ trait ElasticSearchConfigAware {
1111

1212
abstract GrailsApplication getGrailsApplication()
1313

14+
ConfigObject getIndexSettings() {
15+
(esConfig?.index as ConfigObject)?.settings as ConfigObject
16+
}
17+
1418
ConfigObject getEsConfig() {
1519
grailsApplication?.config?.elasticSearch as ConfigObject
1620
}

0 commit comments

Comments
 (0)