noamt / elasticsearch-grails-plugin

The revived ElasticSearch grails plugin
Based on Graeme Rocher initial stub. Note that it is still in early stage.
Other
63 stars 83 forks source link

elasticSearch.index.name does not seem to be working #208

Closed deepakchaudhari0890 closed 6 years ago

deepakchaudhari0890 commented 7 years ago

Hello, First of all, thanks to you guys for developing this very useful plugin. It has been really helpful for me with indexing huge fairly large documents and the ease of integrating it with our app. Currently, we are planning to use a different index name. I am trying to use elasticSearch.index.name configuration in my application.yml, but the plugin is not able to detect this property. I am noticing that in SearchableClassMapping.groovy:87, its trying to get the property "index.name". I am trying the esConfig.getProperty("index.name") method in my Bootstrap.groovy and it returns me an empty map. However, if I try to insert the property "index.name" in esConfig in Bootstrap.groovy, I am able to retrieve this property. I have tried inserting the elasticSearch.index.name in application.yml and application.groovy but none of these options have worked for me. Can you please guide me how to solve this issue? Following is the code snippet with its output I am trying to debug the issue I am having.

ConfigObject configObject = grailsApplication.config.elasticSearch as ConfigObject  
println configObject  
println configObject.getProperty('index.name') 

elasticSearchService.elasticSearchContextHolder.config.put('index.name', "tempindex")  
println elasticSearchService.elasticSearchContextHolder.config

Output of above code:

[client:[mode:local, hosts:[[host:localhost, port:9300]]], datastoreImpl:hibernateDatastore, bulkIndexOnStartup:true, index:[name:tempindex, numberOfReplicas:0], date:[formats:[yyyy-MM-dd'T'HH:mm:ss.S'Z']], defaultExcludedProperties:[articleResource], disableAutoIndex:true, maxBulkRequest:500, unmarshallComponents:false, searchableProperty:[name:searchable], migration:[strategy:alias, aliasReplacesIndex:true, disableAliasChange:false], includeTransients:false, disableDynamicMethodsInjection:false, searchMethodName:search, countHitsMethodName:countHits]
[:]
[date:[formats:[yyyy-MM-dd'T'HH:mm:ss.S'Z']], client:[hosts:[[host:localhost, port:9300]], mode:local], defaultExcludedProperties:[articleResource], disableAutoIndex:true, bulkIndexOnStartup:true, maxBulkRequest:500, unmarshallComponents:false, searchableProperty:[name:searchable], migration:[strategy:alias, aliasReplacesIndex:true, disableAliasChange:false], index:[numberOfReplicas:0, name:tempindex], includeTransients:false, disableDynamicMethodsInjection:false, searchMethodName:search, countHitsMethodName:countHits, datastoreImpl:hibernateDatastore, bootstrap:[config:[file:[:]]], cluster:[name:[:]], path:[data:[:], plugins:[:], conf:[:]], gateway:[type:[:]], http:[:], index.name:tempindex]

Grails version: 3.1.4 elasticSearch plugin version: 1.2.0 Thank you, Deepak

puneetbehl commented 7 years ago

@deepakchaudhari0890 Here is the demo application where I am able to configure index https://github.com/puneetbehl/esdemo_3.2.4

puneetbehl commented 6 years ago

212 These two are similar