3

I am using spring data for the elasticsearch and using transport client with the below configuration for elasticsearchtemplate. I am wondering how we can provide the shield user name and password to the elasticsearchtemplate. Can we do that?

<elasticsearch:repositories base-package="edu.mayo.registry.fhir.rest.elasticsearch.repository" />

<elasticsearch:transport-client id="client" client-transport-sniff="true" client-transport-ping-timeout="30s" client-transport-nodes-sampler-interval="30s" 
    cluster-nodes="hostname:9300" />

<!-- <elasticsearch:node-client id="client" local="true"/> -->

<bean name="elasticsearchTemplate"
    class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate">
    <constructor-arg name="client" ref="client" />
</bean> 
Bond
  • 16,071
  • 6
  • 30
  • 53
user3496151
  • 181
  • 1
  • 13
  • Possible duplicate of [Elasticsearch HTTP authentication in Spring](https://stackoverflow.com/questions/33628214/elasticsearch-http-authentication-in-spring) – sbsatter Apr 29 '19 at 05:12

0 Answers0