Closed tobisinghania closed 6 years ago
I have the same problem with version 2.4.0.RC1 in Grails 3.3.2
From Elasticsearch 5.0 on only selected settings like for instance index.codec
can be set on the node level. Please see more information here
Please let me know if this is not the case.
Hi @puneetbehl, index.name
configuration should not be passed to elasticsearch. It is just alternative name of index (instead of package name) and should be used by plugin internally when creating index.
Please see PR#56 - especially getIndexName() method.
@verglor I am sorry for the confusion earlier but the issue is related to index.name
passed in indexSettings
to elasticSearchAdminService.createIndex(indexName, indexSettings, mappings)
method.
I think index default settings should be passed as index.settings.numberOfReplicas
in the config rather than index.numberOfReplicas
so that there is no conflict between indexName
and settings
. Right now, the only solution I see is to remove 'index.nameexplicitly before passing the
settingsto createIndexRequest in
ElasticSearchAdminService.groovy` class.
void createIndex(String index, Map settings=null, Map<String, Map> esMappings = [:]) {
LOG.debug "Creating index ${index} ..."
elasticSearchHelper.withElasticSearch { Client client ->
CreateIndexRequestBuilder builder = client.admin().indices().prepareCreate(index)
if (settings) {
-> builder.setSettings(settings)
}
esMappings.each { String type, Map elasticMapping ->
builder.addMapping(type, elasticMapping)
}
builder
builder.execute().actionGet()
}
}
I will try to release a new version soon with the fix.
I strongly vote for separating default index settings (passed directly to elasticsearch) to separate config key (e.g. elasticSearch.index.settings
as suggested by @puneetbehl) to prevent confusion.
Just an update that this has been implemented in branch v2.4.0.RC2
and soon be released and meanwhile, I am finding some challenges with updating specs in class SearchableClassMappingSpec
Using Grails 3.2.3 with the plugin version 1.4.1 together with elastic search 5.4.1 application startup fails with the following error, if an index name is set:
Example for the configuration:
As far as I understand, the index.name config is only used by the plugin but not by elastic search itself but when a configuration for the index name is specified, the config key seems to be forwarded to elastic search's index settings (together with other configurations like numberOfReplicas). Elastic search itself rejects the settings, as no settings value for
index.name
is expected and the application startup fails.Grails version: 3.2.3 Plugin version: 1.4.1 Elasticsearch version: 5.4.1